Skip to content

Commit a0557ba

Browse files
committed
Merge latest main branch - integrate calendar-view, filter-builder, markdown and other new components
2 parents 8e8999f + 57424b3 commit a0557ba

31 files changed

Lines changed: 3711 additions & 33 deletions

apps/playground/src/data/examples.ts

Lines changed: 119 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,93 @@ export const examples = {
640640
]
641641
}`,
642642

643+
// Calendar View - Airtable-style calendar
644+
'calendar-view': `{
645+
"type": "div",
646+
"className": "space-y-4",
647+
"body": [
648+
{
649+
"type": "div",
650+
"className": "space-y-2",
651+
"body": [
652+
{
653+
"type": "text",
654+
"content": "Calendar View",
655+
"className": "text-2xl font-bold"
656+
},
657+
{
658+
"type": "text",
659+
"content": "Airtable-style calendar for displaying records as events",
660+
"className": "text-muted-foreground"
661+
}
662+
]
663+
},
664+
{
665+
"type": "calendar-view",
666+
"className": "h-[600px] border rounded-lg",
667+
"view": "month",
668+
"titleField": "title",
669+
"startDateField": "start",
670+
"endDateField": "end",
671+
"colorField": "type",
672+
"colorMapping": {
673+
"meeting": "#3b82f6",
674+
"deadline": "#ef4444",
675+
"event": "#10b981",
676+
"holiday": "#8b5cf6"
677+
},
678+
"data": [
679+
{
680+
"id": 1,
681+
"title": "Team Standup",
682+
"start": "${new Date(new Date().setHours(9, 0, 0, 0)).toISOString()}",
683+
"end": "${new Date(new Date().setHours(9, 30, 0, 0)).toISOString()}",
684+
"type": "meeting",
685+
"allDay": false
686+
},
687+
{
688+
"id": 2,
689+
"title": "Project Launch",
690+
"start": "${new Date(new Date().setDate(new Date().getDate() + 3)).toISOString()}",
691+
"type": "deadline",
692+
"allDay": true
693+
},
694+
{
695+
"id": 3,
696+
"title": "Client Meeting",
697+
"start": "${new Date(new Date().setDate(new Date().getDate() + 5)).toISOString()}",
698+
"end": "${new Date(new Date(new Date().setDate(new Date().getDate() + 5)).setHours(14, 0, 0, 0)).toISOString()}",
699+
"type": "meeting",
700+
"allDay": false
701+
},
702+
{
703+
"id": 4,
704+
"title": "Team Building Event",
705+
"start": "${new Date(new Date().setDate(new Date().getDate() + 7)).toISOString()}",
706+
"end": "${new Date(new Date().setDate(new Date().getDate() + 9)).toISOString()}",
707+
"type": "event",
708+
"allDay": true
709+
},
710+
{
711+
"id": 5,
712+
"title": "Code Review",
713+
"start": "${new Date(new Date().setDate(new Date().getDate() + 1)).toISOString()}",
714+
"end": "${new Date(new Date(new Date().setDate(new Date().getDate() + 1)).setHours(15, 0, 0, 0)).toISOString()}",
715+
"type": "meeting",
716+
"allDay": false
717+
},
718+
{
719+
"id": 6,
720+
"title": "National Holiday",
721+
"start": "${new Date(new Date().setDate(new Date().getDate() + 10)).toISOString()}",
722+
"type": "holiday",
723+
"allDay": true
724+
}
725+
]
726+
}
727+
]
728+
}`,
729+
643730
// Enterprise Data Table - Airtable-like functionality
644731
'enterprise-table': `{
645732
"type": "div",
@@ -698,6 +785,7 @@ export const examples = {
698785
{
699786
"header": "Status",
700787
"accessorKey": "status",
788+
"width": "100px",
701789
"sortable": true
702790
},
703791
{
@@ -718,8 +806,8 @@ export const examples = {
718806
"email": "john.doe@company.com",
719807
"department": "Engineering",
720808
"status": "Active",
721-
"role": "Senior Engineer",
722-
"joinDate": "2020-03-15"
809+
"role": "Senior Developer",
810+
"joinDate": "2022-01-15"
723811
},
724812
{
725813
"id": 2,
@@ -728,34 +816,34 @@ export const examples = {
728816
"department": "Product",
729817
"status": "Active",
730818
"role": "Product Manager",
731-
"joinDate": "2019-07-22"
819+
"joinDate": "2021-11-20"
732820
},
733821
{
734822
"id": 3,
735823
"name": "Bob Johnson",
736824
"email": "bob.johnson@company.com",
737825
"department": "Sales",
738826
"status": "Inactive",
739-
"role": "Sales Rep",
740-
"joinDate": "2021-01-10"
827+
"role": "Sales Representative",
828+
"joinDate": "2020-05-10"
741829
},
742830
{
743831
"id": 4,
744832
"name": "Alice Williams",
745833
"email": "alice.williams@company.com",
746834
"department": "Engineering",
747835
"status": "Active",
748-
"role": "Engineering Manager",
749-
"joinDate": "2018-11-05"
836+
"role": "Tech Lead",
837+
"joinDate": "2019-08-22"
750838
},
751839
{
752840
"id": 5,
753841
"name": "Charlie Brown",
754842
"email": "charlie.brown@company.com",
755843
"department": "Marketing",
756844
"status": "Active",
757-
"role": "Marketing Specialist",
758-
"joinDate": "2022-02-28"
845+
"role": "Marketing Manager",
846+
"joinDate": "2021-03-14"
759847
},
760848
{
761849
"id": 6,
@@ -764,16 +852,16 @@ export const examples = {
764852
"department": "HR",
765853
"status": "Active",
766854
"role": "HR Director",
767-
"joinDate": "2017-06-12"
855+
"joinDate": "2018-12-01"
768856
},
769857
{
770858
"id": 7,
771859
"name": "Ethan Hunt",
772860
"email": "ethan.hunt@company.com",
773861
"department": "Operations",
774862
"status": "Inactive",
775-
"role": "Operations Lead",
776-
"joinDate": "2020-09-01"
863+
"role": "Operations Coordinator",
864+
"joinDate": "2022-06-30"
777865
},
778866
{
779867
"id": 8,
@@ -782,43 +870,43 @@ export const examples = {
782870
"department": "Finance",
783871
"status": "Active",
784872
"role": "Financial Analyst",
785-
"joinDate": "2021-04-18"
873+
"joinDate": "2020-09-18"
786874
},
787875
{
788876
"id": 9,
789877
"name": "George Wilson",
790878
"email": "george.wilson@company.com",
791-
"department": "Product",
879+
"department": "Engineering",
792880
"status": "Active",
793-
"role": "Product Designer",
794-
"joinDate": "2019-12-03"
881+
"role": "DevOps Engineer",
882+
"joinDate": "2021-04-25"
795883
},
796884
{
797885
"id": 10,
798886
"name": "Hannah Montana",
799887
"email": "hannah.montana@company.com",
800-
"department": "Marketing",
888+
"department": "Product",
801889
"status": "Active",
802-
"role": "Content Creator",
803-
"joinDate": "2022-05-20"
890+
"role": "Product Designer",
891+
"joinDate": "2022-02-10"
804892
},
805893
{
806894
"id": 11,
807895
"name": "Ivan Drago",
808896
"email": "ivan.drago@company.com",
809897
"department": "Engineering",
810898
"status": "Inactive",
811-
"role": "Junior Engineer",
812-
"joinDate": "2023-01-15"
899+
"role": "Backend Developer",
900+
"joinDate": "2020-07-12"
813901
},
814902
{
815903
"id": 12,
816904
"name": "Julia Roberts",
817905
"email": "julia.roberts@company.com",
818-
"department": "Legal",
906+
"department": "Marketing",
819907
"status": "Active",
820-
"role": "Legal Counsel",
821-
"joinDate": "2018-08-25"
908+
"role": "Content Strategist",
909+
"joinDate": "2021-10-05"
822910
},
823911
{
824912
"id": 13,
@@ -827,16 +915,16 @@ export const examples = {
827915
"department": "Sales",
828916
"status": "Active",
829917
"role": "Sales Director",
830-
"joinDate": "2019-03-10"
918+
"joinDate": "2019-03-20"
831919
},
832920
{
833921
"id": 14,
834-
"name": "Laura Palmer",
835-
"email": "laura.palmer@company.com",
836-
"department": "Customer Support",
922+
"name": "Laura Croft",
923+
"email": "laura.croft@company.com",
924+
"department": "Operations",
837925
"status": "Active",
838-
"role": "Support Lead",
839-
"joinDate": "2020-11-22"
926+
"role": "Operations Analyst",
927+
"joinDate": "2021-12-08"
840928
},
841929
{
842930
"id": 15,
@@ -904,5 +992,5 @@ export const exampleCategories = {
904992
'Primitives': ['simple-page', 'input-states', 'button-variants'],
905993
'Layouts': ['grid-layout', 'dashboard', 'tabs-demo'],
906994
'Forms': ['form-demo'],
907-
'Data Display': ['enterprise-table', 'data-table-simple']
995+
'Data Display': ['calendar-view', 'enterprise-table', 'data-table-simple']
908996
};

docs/components/calendar-view.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Calendar View Component
2+
3+
The `calendar-view` component is an Airtable-style calendar for displaying records as events. It provides three view modes: Month, Week, and Day.
4+
5+
## Features
6+
7+
- **Multiple View Modes**: Switch between Month, Week, and Day views
8+
- **Flexible Data Mapping**: Map your data fields to event properties
9+
- **Color Coding**: Support for color-coded events with custom color mappings
10+
- **Interactive**: Click on events and dates (with callbacks)
11+
- **Responsive**: Works seamlessly on different screen sizes
12+
13+
## Basic Usage
14+
15+
```json
16+
{
17+
"type": "calendar-view",
18+
"data": [
19+
{
20+
"id": 1,
21+
"title": "Team Meeting",
22+
"start": "2026-01-13T10:00:00.000Z",
23+
"end": "2026-01-13T11:00:00.000Z",
24+
"color": "#3b82f6"
25+
}
26+
]
27+
}
28+
```
29+
30+
## Properties
31+
32+
| Property | Type | Default | Description |
33+
|:---|:---|:---|:---|
34+
| `data` | `array` | `[]` | Array of record objects to display as events |
35+
| `view` | `'month' \| 'week' \| 'day'` | `'month'` | Default view mode |
36+
| `titleField` | `string` | `'title'` | Field name to use for event title |
37+
| `startDateField` | `string` | `'start'` | Field name for event start date |
38+
| `endDateField` | `string` | `'end'` | Field name for event end date (optional) |
39+
| `allDayField` | `string` | `'allDay'` | Field name for all-day flag |
40+
| `colorField` | `string` | `'color'` | Field name for event color |
41+
| `colorMapping` | `object` | `{}` | Map field values to colors |
42+
| `allowCreate` | `boolean` | `false` | Allow creating events by clicking on dates |
43+
| `className` | `string` | - | Additional CSS classes |
44+
45+
## Data Structure
46+
47+
Each event object in the `data` array should have the following structure:
48+
49+
```typescript
50+
{
51+
id: string | number; // Unique identifier
52+
title: string; // Event title (or use custom titleField)
53+
start: string | Date; // Start date/time (ISO string or Date)
54+
end?: string | Date; // End date/time (optional)
55+
allDay?: boolean; // Whether it's an all-day event
56+
color?: string; // Event color (hex or CSS color)
57+
[key: string]: any; // Any other custom data
58+
}
59+
```
60+
61+
## Examples
62+
63+
### Month View with Color Mapping
64+
65+
```json
66+
{
67+
"type": "calendar-view",
68+
"className": "h-[600px] border rounded-lg",
69+
"view": "month",
70+
"colorField": "type",
71+
"colorMapping": {
72+
"meeting": "#3b82f6",
73+
"deadline": "#ef4444",
74+
"event": "#10b981"
75+
},
76+
"data": [
77+
{
78+
"id": 1,
79+
"title": "Team Standup",
80+
"start": "2026-01-13T09:00:00.000Z",
81+
"end": "2026-01-13T09:30:00.000Z",
82+
"type": "meeting"
83+
},
84+
{
85+
"id": 2,
86+
"title": "Project Deadline",
87+
"start": "2026-01-20T00:00:00.000Z",
88+
"type": "deadline",
89+
"allDay": true
90+
}
91+
]
92+
}
93+
```
94+
95+
## View Modes
96+
97+
### Month View
98+
Displays a full month calendar grid with events shown as colored bars on their respective dates. Perfect for getting a high-level overview of the month.
99+
100+
### Week View
101+
Shows a week at a time with each day in a column. Events display with their times, ideal for detailed weekly planning.
102+
103+
### Day View
104+
Displays a single day with hourly time slots from 12 AM to 11 PM. Events are positioned at their scheduled times, great for detailed daily schedules.
105+
106+
## Events & Callbacks
107+
108+
The calendar view supports several event callbacks through the `onAction` mechanism:
109+
110+
- `event_click`: Triggered when an event is clicked
111+
- `date_click`: Triggered when a date cell is clicked
112+
- `view_change`: Triggered when the view mode changes
113+
- `navigate`: Triggered when navigating between dates
114+
115+
## Styling
116+
117+
The calendar view is fully styled with Tailwind CSS and supports custom styling through the `className` prop.
118+
119+
## Integration with ObjectQL
120+
121+
When used with ObjectQL, the calendar view can automatically fetch and display records from your database.

docs/spec/component-library.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Components for visualizing data.
6868
| `alert` | Highlighted message | `variant`, `title`, `description` |
6969
| `table` | Data-driven table | `columns`, `data`, `caption`, `footer` |
7070
| `carousel` | Slideshow component | `items`, `orientation`, `showArrows` |
71+
| `calendar-view` | Airtable-style calendar | `data`, `view`, `titleField`, `startDateField`, `endDateField`, `colorField` |
7172

7273
## 6. Feedback Components
7374
Indicators for system status or feedback.

0 commit comments

Comments
 (0)