@app-studio/web 0.9.34 → 0.9.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,49 +88,6 @@ export const MonthViewCalendar = () => {
88
88
  };
89
89
  ```
90
90
 
91
- ### **Custom Event Rendering**
92
- Customize how events are displayed using the `renderEvent` prop.
93
-
94
- ```tsx
95
- import React from 'react';
96
- import { Vertical, Horizontal } from 'app-studio';
97
- import { Calendar } from '../Calendar';
98
- import { CalendarEvent, CalendarRenderEventContext } from '../Calendar/Calendar.props';
99
- import { Text } from '../../Text/Text';
100
-
101
- export const CustomRenderCalendar = () => {
102
- const events: CalendarEvent[] = [
103
- {
104
- id: 1,
105
- title: 'High Priority Meeting',
106
- start: new Date(2025, 9, 15, 10, 0),
107
- metadata: { priority: 'high' },
108
- },
109
- ];
110
-
111
- const renderEvent = (event: CalendarEvent, context: CalendarRenderEventContext) => {
112
- const priority = event.metadata?.priority as string;
113
-
114
- return (
115
- <Vertical
116
- gap={8}
117
- padding={12}
118
- borderRadius={12}
119
- backgroundColor="color.error.50"
120
- borderWidth={1}
121
- borderStyle="solid"
122
- borderColor="color.error.200"
123
- >
124
- <Text fontWeight="600">{event.title}</Text>
125
- <Text fontSize={12} color="color.error.600">{priority}</Text>
126
- </Vertical>
127
- );
128
- };
129
-
130
- return <Calendar events={events} renderEvent={renderEvent} />;
131
- };
132
- ```
133
-
134
91
  ### **Week Starts On**
135
92
  Configure which day the week starts on (0 = Sunday, 1 = Monday, etc.).
136
93
 
@@ -146,78 +103,33 @@ export const WeekStartsOnMonday = () => {
146
103
  ### **Custom Styles**
147
104
  Customize the appearance of calendar elements using the `views` prop.
148
105
 
149
- ```tsx
150
- import React from 'react';
151
- import { Calendar } from '../Calendar';
152
-
153
- export const CustomStyledCalendar = () => {
154
- return (
155
- <Calendar
156
- views={{
157
- container: {
158
- backgroundColor: 'color.primary.50',
159
- borderColor: 'color.primary.300',
160
- },
161
- headerTitle: {
162
- color: 'color.primary.700',
163
- fontSize: 24,
164
- },
165
- event: {
166
- backgroundColor: 'color.primary.100',
167
- borderColor: 'color.primary.400',
168
- },
169
- }}
170
- />
171
- );
172
- };
173
- ```
174
-
175
- ### **Fixed Height with Scrolling**
176
- Set a fixed height for the calendar with scrollable content areas.
177
-
178
- ```tsx
179
- import React from 'react';
180
- import { Calendar } from '../Calendar';
181
-
182
- export const FixedHeightCalendar = () => {
183
- const events = [
184
- {
185
- id: 1,
186
- title: 'Team Meeting',
187
- start: new Date(2025, 9, 15, 10, 0),
188
- end: new Date(2025, 9, 15, 11, 0),
189
- },
190
- // ... more events
191
- ];
192
-
193
- return <Calendar events={events} height="600px" initialView="week" />;
194
- };
195
- ```
196
-
197
106
  ## Props
198
107
 
199
- | Prop | Type | Description | Default |
200
- | -------------- | ----------------------- | -------------------------------------------------------------- | ----------- |
201
- | events | CalendarEvent[] | Array of events to display in the calendar. | [] |
202
- | initialDate | Date \| string | Starting date displayed in the calendar. | new Date() |
203
- | initialView | 'day' \| 'week' \| 'month' | Initial visible view. | 'month' |
204
- | weekStartsOn | 0-6 | First day of the week (0 = Sunday, 1 = Monday, etc.). | 0 |
205
- | height | string \| number | Height of the calendar container (enables scrolling). | '800px' |
206
- | renderEvent | function | Custom render method for events. | - |
207
- | onDateChange | function | Callback when the visible anchor date changes. | - |
208
- | onViewChange | function | Callback when the active view changes. | - |
209
- | views | CalendarViews | Customize styling of calendar areas. | - |
108
+ | Prop | Type | Description | Default |
109
+ | --- | --- | --- | --- |
110
+ | `events` | `CalendarEvent[]` | Array of events to display. | `[]` |
111
+ | `initialDate` | `Date \| string` | Initial date to display (ISO string or Date object). | `new Date()` |
112
+ | `initialView` | `'day' \| 'week' \| 'month'` | Initial view to display. | `'month'` |
113
+ | `weekStartsOn` | `0-6` | Day the week starts on (0 = Sunday, 1 = Monday). | `0` |
114
+ | `onEventDrop` | `(event: CalendarEvent) => void` | Callback when an event is moved to a new date. | - |
115
+ | `onEventResize` | `(event: CalendarEvent) => void` | Callback when an event is resized. | - |
116
+ | `onEventAdd` | `(start: string, end: string) => void` | Callback when a date is double-clicked to add an event. | - |
117
+ | `onDateClick` | `(date: string) => void` | Callback when a date is clicked. | - |
118
+ | `onDateChange` | `(date: Date) => void` | Callback when the visible date range changes. | - |
119
+ | `onViewChange` | `(view: CalendarView) => void` | Callback when the active view changes. | - |
120
+ | `views` | `CalendarViews` | Style overrides for various parts of the component. | `{}` |
210
121
 
211
122
  ## CalendarEvent Interface
212
123
 
213
- | Property | Type | Description |
214
- | ----------- | --------------------- | ------------------------------------------------ |
215
- | id | string \| number | Unique identifier for the event. |
216
- | title | string | Event title shown in the calendar cell. |
217
- | start | Date \| string | Start date/time of the event. |
218
- | end | Date \| string | Optional end date/time of the event. |
219
- | description | string | Optional description or supporting information. |
220
- | metadata | Record<string, unknown> | Additional metadata for the event. |
124
+ | Property | Type | Description |
125
+ | --- | --- | --- |
126
+ | `id` | `string \| number` | Unique identifier for the event. |
127
+ | `title` | `string` | Event title shown in the calendar. |
128
+ | `start` | `string` | Start date/time in ISO format (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM`). |
129
+ | `end` | `string` | End date/time in ISO format (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM`). |
130
+ | `color` | `'blue' \| 'red' \| 'green' \| 'purple' \| 'orange'` | Color variant for the event. |
131
+ | `description` | `string` | Optional description (used for tooltips or custom rendering). |
132
+ | `metadata` | `Record<string, unknown>` | Additional metadata for custom logic. |
221
133
 
222
134
  ## CalendarViews Interface
223
135
 
@@ -0,0 +1,156 @@
1
+ # KanbanBoard
2
+
3
+ A flexible Kanban board component for managing tasks and workflows. Features drag-and-drop functionality for cards between columns, customizable card and column rendering, and comprehensive styling options.
4
+
5
+ ### **Import**
6
+ ```tsx
7
+ import { KanbanBoard } from '@app-studio/web';
8
+ ```
9
+
10
+ ### **Default**
11
+ ```tsx
12
+ import React, { useState } from 'react';
13
+ import { KanbanBoard } from '../KanbanBoard';
14
+ import { KanbanBoardColumn } from '../KanbanBoard/KanbanBoard.props';
15
+
16
+ export const DefaultKanbanBoard = () => {
17
+ const [columns, setColumns] = useState<KanbanBoardColumn[]>([
18
+ {
19
+ id: 'todo',
20
+ title: 'To Do',
21
+ cards: [
22
+ { id: '1', title: 'Design System', description: 'Create a new design system.' },
23
+ { id: '2', title: 'API Integration', description: 'Integrate with the new API.' },
24
+ ],
25
+ },
26
+ {
27
+ id: 'inprogress',
28
+ title: 'In Progress',
29
+ cards: [
30
+ { id: '3', title: 'User Dashboard', description: 'Develop the main user dashboard.' },
31
+ ],
32
+ },
33
+ {
34
+ id: 'done',
35
+ title: 'Done',
36
+ cards: [
37
+ { id: '4', title: 'Project Setup', description: 'Initial project setup and configuration.' },
38
+ ],
39
+ },
40
+ ]);
41
+
42
+ return <KanbanBoard columns={columns} onChange={setColumns} />;
43
+ };
44
+ ```
45
+
46
+ ### **Custom Card Rendering**
47
+ Customize how cards are displayed using the `renderCard` prop.
48
+
49
+ ```tsx
50
+ import React, { useState } from 'react';
51
+ import { KanbanBoard } from '../KanbanBoard';
52
+ import { KanbanBoardColumn, KanbanBoardCard } from '../KanbanBoard/KanbanBoard.props';
53
+ import { View, Text, Horizontal } from 'app-studio';
54
+
55
+ export const CustomRenderKanbanBoard = () => {
56
+ const [columns, setColumns] = useState<KanbanBoardColumn[]>([
57
+ {
58
+ id: 'todo',
59
+ title: 'To Do',
60
+ cards: [
61
+ { id: '1', title: 'Design System', description: 'Create a new design system.', metadata: { priority: 'high' } },
62
+ { id: '2', title: 'API Integration', description: 'Integrate with the new API.', metadata: { priority: 'low' } },
63
+ ],
64
+ },
65
+ {
66
+ id: 'inprogress',
67
+ title: 'In Progress',
68
+ cards: [
69
+ { id: '3', title: 'User Dashboard', description: 'Develop the main user dashboard.', metadata: { priority: 'medium' } },
70
+ ],
71
+ },
72
+ {
73
+ id: 'done',
74
+ title: 'Done',
75
+ cards: [
76
+ { id: '4', title: 'Project Setup', description: 'Initial project setup and configuration.', metadata: { priority: 'low' } },
77
+ ],
78
+ },
79
+ ]);
80
+
81
+ const renderCard = (card: KanbanBoardCard, column: KanbanBoardColumn) => {
82
+ const priority = card.metadata?.priority as string;
83
+ const priorityColors = {
84
+ low: 'color.green.500',
85
+ medium: 'color.yellow.500',
86
+ high: 'color.red.500',
87
+ };
88
+
89
+ return (
90
+ <View>
91
+ <Horizontal alignItems="center" marginBottom={8}>
92
+ <View
93
+ width={8}
94
+ height={8}
95
+ borderRadius="50%"
96
+ backgroundColor={priorityColors[priority]}
97
+ marginRight={8}
98
+ />
99
+ <Text fontWeight="semibold">{card.title}</Text>
100
+ </Horizontal>
101
+ <Text fontSize={14} color="color.gray.600">
102
+ {card.description}
103
+ </Text>
104
+ </View>
105
+ );
106
+ };
107
+
108
+ return <KanbanBoard columns={columns} onChange={setColumns} renderCard={renderCard} />;
109
+ };
110
+ ```
111
+
112
+ ## Props
113
+
114
+ | Prop | Type | Description | Default |
115
+ | --- | --- | --- | --- |
116
+ | `columns` | `KanbanBoardColumn[]` | Array of columns to display. | `[]` |
117
+ | `onChange` | `(columns: KanbanBoardColumn[]) => void` | Callback when columns or cards are changed. | - |
118
+ | `renderCard` | `(card: KanbanBoardCard, column: KanbanBoardColumn) => React.ReactNode` | Custom render method for cards. | - |
119
+ | `renderColumnHeader` | `(column: KanbanBoardColumn) => React.ReactNode` | Custom render method for column headers. | - |
120
+ | `renderEmptyState` | `(column: KanbanBoardColumn) => React.ReactNode` | Custom render method for empty column state. | - |
121
+ | `views` | `KanbanBoardViews` | Style overrides for various parts of the component. | `{}` |
122
+
123
+ ## KanbanBoardColumn Interface
124
+
125
+ | Property | Type | Description |
126
+ | --- | --- | --- |
127
+ | `id` | `string` | Unique identifier for the column. |
128
+ | `title` | `string` | Column title shown in the header. |
129
+ | `cards` | `KanbanBoardCard[]` | Array of cards within the column. |
130
+ | `footer` | `React.ReactNode` | Optional footer content for the column. |
131
+ | `metadata` | `Record<string, unknown>` | Additional metadata for the column. |
132
+
133
+ ## KanbanBoardCard Interface
134
+
135
+ | Property | Type | Description |
136
+ | --- | --- | --- |
137
+ | `id` | `string` | Unique identifier for the card. |
138
+ | `title` | `string` | Card title. |
139
+ | `description` | `string` | Optional card description. |
140
+ | `metadata` | `Record<string, unknown>` | Additional metadata for the card. |
141
+
142
+ ## KanbanBoardViews Interface
143
+
144
+ Customize the appearance of different Kanban board elements.
145
+
146
+ | Property | Type | Description |
147
+ | --- | --- | --- |
148
+ | `board` | `ViewProps` | Main board container. |
149
+ | `column` | `ViewProps` | Individual column container. |
150
+ | `columnHeader` | `ViewProps` | Column header container. |
151
+ | `columnTitle` | `TextProps` | Column title text. |
152
+ | `columnBody` | `ViewProps` | Column body container (wraps cards). |
153
+ | `columnFooter` | `ViewProps` | Column footer container. |
154
+ | `card` | `ViewProps` | Individual card container. |
155
+ | `cardContent` | `ViewProps` | Content wrapper inside the card. |
156
+ | `emptyState` | `ViewProps` | Empty state container in a column. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-studio/web",
3
- "version": "0.9.34",
3
+ "version": "0.9.35",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/components/index.d.ts",
6
6
  "files": [
@@ -1,51 +0,0 @@
1
- import { ViewProps } from 'app-studio';
2
- export interface CalendarWeekEvent {
3
- /** Unique identifier for the event */
4
- id: string;
5
- /** Event title/label */
6
- title: string;
7
- /** Start date in ISO format (YYYY-MM-DD) */
8
- start: string;
9
- /** End date in ISO format (YYYY-MM-DD) */
10
- end: string;
11
- /** Color variant for the event */
12
- color?: 'blue' | 'red' | 'green' | 'purple' | 'orange';
13
- }
14
- export interface CalendarWeekViews {
15
- /** Style overrides for the main container */
16
- container?: ViewProps;
17
- /** Style overrides for the week grid */
18
- weekGrid?: ViewProps;
19
- /** Style overrides for individual day columns */
20
- dayColumn?: ViewProps;
21
- /** Style overrides for day column headers */
22
- dayHeader?: ViewProps;
23
- /** Style overrides for day names (e.g., "Mon", "Tue") */
24
- dayName?: ViewProps;
25
- /** Style overrides for day dates (the circular number) */
26
- dayDate?: ViewProps;
27
- /** Style overrides for the events area */
28
- eventsArea?: ViewProps;
29
- /** Style overrides for individual events */
30
- event?: ViewProps;
31
- }
32
- export interface CalendarWeekProps {
33
- /** Start date of the week in ISO format (YYYY-MM-DD) */
34
- startDate: string;
35
- /** Array of events to display */
36
- events?: CalendarWeekEvent[];
37
- /** Today's date in ISO format (defaults to current date) */
38
- today?: string;
39
- /** Callback when an event is dragged to a new position */
40
- onEventDrop?: (event: CalendarWeekEvent) => void;
41
- /** Callback when an event is resized */
42
- onEventResize?: (event: CalendarWeekEvent) => void;
43
- /** Callback when a date is clicked */
44
- onDateClick?: (date: string) => void;
45
- /** Style overrides for various parts of the component */
46
- views?: CalendarWeekViews;
47
- /** Width of the calendar (default: '100%') */
48
- width?: number | string;
49
- /** Maximum width of the calendar (default: 1200) */
50
- maxWidth?: number | string;
51
- }
@@ -1,90 +0,0 @@
1
- /// <reference types="react" />
2
- import { ViewProps } from 'app-studio';
3
- /**
4
- * Event color configurations
5
- */
6
- export declare const EVENT_COLORS: {
7
- readonly blue: {
8
- readonly background: "color.blue.50";
9
- readonly border: "color.blue.500";
10
- readonly text: "color.blue.700";
11
- };
12
- readonly red: {
13
- readonly background: "color.red.50";
14
- readonly border: "color.red.500";
15
- readonly text: "color.red.700";
16
- };
17
- readonly green: {
18
- readonly background: "color.green.50";
19
- readonly border: "color.green.500";
20
- readonly text: "color.green.700";
21
- };
22
- readonly purple: {
23
- readonly background: "color.purple.50";
24
- readonly border: "color.purple.500";
25
- readonly text: "color.purple.700";
26
- };
27
- readonly orange: {
28
- readonly background: "color.orange.50";
29
- readonly border: "color.orange.500";
30
- readonly text: "color.orange.700";
31
- };
32
- };
33
- /**
34
- * Base styles for the calendar container
35
- */
36
- export declare const containerStyles: ViewProps;
37
- /**
38
- * Week grid styles (7 columns)
39
- */
40
- export declare const weekGridStyles: ViewProps;
41
- /**
42
- * Individual day column styles
43
- */
44
- export declare const dayColumnStyles: ViewProps;
45
- /**
46
- * Day header styles
47
- */
48
- export declare const dayHeaderStyles: ViewProps;
49
- /**
50
- * Day name styles (e.g., "Mon", "Tue")
51
- */
52
- export declare const dayNameStyles: ViewProps;
53
- /**
54
- * Day date styles (the circular number)
55
- */
56
- export declare const dayDateStyles: ViewProps;
57
- /**
58
- * Today date styles
59
- */
60
- export declare const todayDateStyles: ViewProps;
61
- /**
62
- * Selected date styles
63
- */
64
- export declare const selectedDateStyles: ViewProps;
65
- /**
66
- * Events area styles
67
- */
68
- export declare const eventsAreaStyles: ViewProps;
69
- /**
70
- * Events layer styles (absolute positioned over the grid)
71
- */
72
- export declare const eventsLayerStyles: ViewProps;
73
- /**
74
- * Base event styles
75
- */
76
- export declare const eventStyles: ViewProps;
77
- /**
78
- * Drop target indicator styles
79
- */
80
- export declare const dropTargetStyles: ViewProps;
81
- /**
82
- * Calculate event position styles
83
- */
84
- export declare const getEventPositionStyles: (startDay: number, duration: number, row: number) => React.CSSProperties;
85
- /**
86
- * Resize handle styles
87
- */
88
- export declare const resizeHandleStyles: React.CSSProperties;
89
- export declare const leftResizeHandleStyles: React.CSSProperties;
90
- export declare const rightResizeHandleStyles: React.CSSProperties;
@@ -1,51 +0,0 @@
1
- import { CalendarWeekEvent } from './CalendarWeek.props';
2
- export interface PositionedEvent extends CalendarWeekEvent {
3
- /** Starting day index (0-6) within the week */
4
- startDay: number;
5
- /** Ending day index (0-6) within the week */
6
- endDay: number;
7
- /** Number of days the event spans */
8
- duration: number;
9
- /** Row index for vertical positioning (to avoid overlaps) */
10
- row: number;
11
- }
12
- /**
13
- * Convert an ISO date string to a UTC Date object
14
- */
15
- export declare const dateUTC: (iso: string) => Date;
16
- /**
17
- * Calculate the number of days between two ISO date strings
18
- */
19
- export declare const daysBetweenUTC: (a: string, b: string) => number;
20
- /**
21
- * Add a number of days to an ISO date string
22
- */
23
- export declare const addDateDays: (dateISO: string, days: number) => string;
24
- /**
25
- * Get the day of the week (0-6) from an ISO date string
26
- */
27
- export declare const getDayOfWeek: (dateISO: string) => number;
28
- /**
29
- * Get the date number (1-31) from an ISO date string
30
- */
31
- export declare const getDateNumber: (dateISO: string) => number;
32
- /**
33
- * Layout events with proper positioning to avoid overlaps
34
- * Returns positioned events and the total number of rows needed
35
- */
36
- export declare const layoutEvents: (events: CalendarWeekEvent[], weekStart: string) => {
37
- items: PositionedEvent[];
38
- rowCount: number;
39
- };
40
- /**
41
- * Day names array (Sunday to Saturday)
42
- */
43
- export declare const DAY_NAMES: string[];
44
- /**
45
- * Get the date ISO string for a specific day in the week
46
- */
47
- export declare const getDateForDay: (weekStart: string, dayIndex: number) => string;
48
- /**
49
- * Get the day index (0-6) from a clientX position within a week grid element
50
- */
51
- export declare const getDayFromX: (x: number, weekGridRect: DOMRect) => number;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { CalendarWeekProps } from './CalendarWeek.props';
3
- export declare const CalendarWeek: React.FC<CalendarWeekProps>;
@@ -1 +0,0 @@
1
- export { CalendarWeek } from './CalendarWeek/CalendarWeek.view';