@alexgorbatchev/shadcn 0.0.20 → 0.0.21

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.
Files changed (138) hide show
  1. package/README.md +24 -14
  2. package/THIRD_PARTY_NOTICES.md +60 -0
  3. package/dist/{chunk-s46hvhjw.js → chunk-0w6rxpr5.js} +1 -1
  4. package/dist/{chunk-gabqzfq0.js → chunk-1p7pend8.js} +3 -3
  5. package/dist/chunk-21wbz345.js +65 -0
  6. package/dist/{chunk-84ca0dpc.js → chunk-67dkgsm3.js} +1 -1
  7. package/dist/{chunk-p8qtk151.js → chunk-72qr0gqe.js} +1 -1
  8. package/dist/{chunk-4drqqqz1.js → chunk-83cckb23.js} +1 -1
  9. package/dist/{chunk-ztcbee24.js → chunk-9dqspkha.js} +1 -1
  10. package/dist/{chunk-eq88qk1d.js → chunk-d3ad53et.js} +8 -8
  11. package/dist/{chunk-h979cxnh.js → chunk-dq7kr5y0.js} +2 -1
  12. package/dist/{chunk-mrrbycgx.js → chunk-e0gcczqk.js} +1 -1
  13. package/dist/{chunk-553bzh59.js → chunk-f4c0tg2x.js} +1 -1
  14. package/dist/{chunk-14qj6w54.js → chunk-f9ha76ap.js} +4 -4
  15. package/dist/{chunk-ykt5sv7n.js → chunk-gkkbg7rq.js} +1 -1
  16. package/dist/{chunk-qv19jhdk.js → chunk-k8v9y2dw.js} +1 -1
  17. package/dist/chunk-kbg2e95b.js +434 -0
  18. package/dist/chunk-r9qrb6b6.js +54 -0
  19. package/dist/{chunk-ecmk3vgd.js → chunk-seeed8a2.js} +1 -1
  20. package/dist/{chunk-d9jbqd99.js → chunk-tynbgc30.js} +1 -1
  21. package/dist/{chunk-1qhf8gh8.js → chunk-wwyzwptb.js} +1 -1
  22. package/dist/components/AccountMenu.d.ts +12 -0
  23. package/dist/components/AppShell.d.ts +23 -0
  24. package/dist/components/AuthForm.d.ts +18 -0
  25. package/dist/components/BarList.d.ts +16 -0
  26. package/dist/components/BillingUsage.d.ts +20 -0
  27. package/dist/components/Combobox.d.ts +2 -1
  28. package/dist/components/DashboardLayout.d.ts +18 -0
  29. package/dist/components/FilterBar.d.ts +20 -0
  30. package/dist/components/Kanban.d.ts +23 -0
  31. package/dist/components/Meter.d.ts +9 -0
  32. package/dist/components/NumberField.d.ts +11 -0
  33. package/dist/components/PageHeader.d.ts +11 -0
  34. package/dist/components/SettingsSection.d.ts +16 -0
  35. package/dist/components/Sidebar.d.ts +2 -1
  36. package/dist/components/StatCard.d.ts +14 -0
  37. package/dist/components/StatusTracker.d.ts +16 -0
  38. package/dist/components/Stepper.d.ts +12 -0
  39. package/dist/components/TagInput.d.ts +16 -0
  40. package/dist/components/Toolbar.d.ts +10 -0
  41. package/dist/components/WorkspaceSwitcher.d.ts +14 -0
  42. package/dist/components/assistant-ui/elements/ApprovalCard.d.ts +1 -1
  43. package/dist/components/assistant-ui/elements/CommandPalette.js +3 -3
  44. package/dist/components/assistant-ui/elements/MessageTiming.d.ts +1 -1
  45. package/dist/components/assistant-ui/elements/ModelSelector.js +9 -9
  46. package/dist/components/assistant-ui/elements/ModelSelectorContent.js +8 -8
  47. package/dist/components/assistant-ui/elements/ModelSelectorEmpty.js +3 -3
  48. package/dist/components/assistant-ui/elements/ModelSelectorFocusAnchor.js +3 -3
  49. package/dist/components/assistant-ui/elements/ModelSelectorGroup.js +3 -3
  50. package/dist/components/assistant-ui/elements/ModelSelectorItem.js +3 -3
  51. package/dist/components/assistant-ui/elements/ModelSelectorList.js +5 -5
  52. package/dist/components/assistant-ui/elements/ModelSelectorSearch.js +3 -3
  53. package/dist/components/assistant-ui/elements/ModelSelectorSeparator.js +3 -3
  54. package/dist/components/assistant-ui/elements/types.d.ts +0 -4
  55. package/dist/components/assistant-ui/index.js +11 -11
  56. package/dist/components/assistant-ui/native/AssistantModal.js +3 -3
  57. package/dist/components/assistant-ui/native/AssistantSidebar.js +3 -3
  58. package/dist/components/assistant-ui/native/ModelSelector.js +11 -11
  59. package/dist/components/assistant-ui/native/TaskCard.js +2 -2
  60. package/dist/components/assistant-ui/native/TaskGroup.js +3 -3
  61. package/dist/components/assistant-ui/native/Thread.js +2 -2
  62. package/dist/components/assistant-ui/native/ThreadListSidebar.js +2 -2
  63. package/dist/components/assistant-ui/native/index.js +17 -17
  64. package/dist/components/calendar/DatePicker.d.ts +27 -0
  65. package/dist/components/calendar/index.d.ts +2 -0
  66. package/dist/components/calendar/index.js +175 -2
  67. package/dist/components/chart/AnalyticsChart.d.ts +24 -0
  68. package/dist/components/chart/index.d.ts +2 -0
  69. package/dist/components/chart/index.js +88 -0
  70. package/dist/components/color-picker/ColorPicker.d.ts +14 -0
  71. package/dist/components/color-picker/index.d.ts +2 -0
  72. package/dist/components/color-picker/index.js +52 -0
  73. package/dist/components/command/index.js +1 -1
  74. package/dist/components/data-grid/DataGrid.d.ts +44 -0
  75. package/dist/components/data-grid/index.d.ts +2 -0
  76. package/dist/components/data-grid/index.js +228 -0
  77. package/dist/components/editor/RichTextEditor.d.ts +14 -0
  78. package/dist/components/editor/index.d.ts +2 -0
  79. package/dist/components/editor/index.js +108 -0
  80. package/dist/components/event-calendar/EventCalendar.d.ts +16 -0
  81. package/dist/components/event-calendar/EventForm.d.ts +18 -0
  82. package/dist/components/event-calendar/index.d.ts +4 -0
  83. package/dist/components/event-calendar/index.js +266 -0
  84. package/dist/components/file-upload/FileUpload.d.ts +14 -0
  85. package/dist/components/file-upload/index.d.ts +2 -0
  86. package/dist/components/file-upload/index.js +80 -0
  87. package/dist/components/gantt/Gantt.d.ts +22 -0
  88. package/dist/components/gantt/Roadmap.d.ts +18 -0
  89. package/dist/components/gantt/index.d.ts +4 -0
  90. package/dist/components/gantt/index.js +357 -0
  91. package/dist/components/image-crop/ImageCrop.d.ts +10 -0
  92. package/dist/components/image-crop/index.d.ts +2 -0
  93. package/dist/components/image-crop/index.js +35 -0
  94. package/dist/components/tree/Tree.d.ts +16 -0
  95. package/dist/components/tree/index.d.ts +2 -0
  96. package/dist/components/tree/index.js +57 -0
  97. package/dist/event-calendar.css +83 -0
  98. package/dist/index.d.ts +33 -0
  99. package/dist/index.js +1411 -708
  100. package/dist/options/types.d.ts +5 -0
  101. package/llms/components/actions/Toolbar.md +89 -0
  102. package/llms/components/data-display/AnalyticsChart.md +48 -0
  103. package/llms/components/data-display/BarList.md +50 -0
  104. package/llms/components/data-display/DataGrid.md +51 -0
  105. package/llms/components/data-display/Meter.md +74 -0
  106. package/llms/components/data-display/Sparkline.md +50 -0
  107. package/llms/components/data-display/StatCard.md +65 -0
  108. package/llms/components/data-display/StatusTracker.md +51 -0
  109. package/llms/components/dates/DatePicker.md +97 -0
  110. package/llms/components/forms/AuthForm.md +70 -0
  111. package/llms/components/forms/ColorPicker.md +70 -0
  112. package/llms/components/forms/EventForm.md +66 -0
  113. package/llms/components/forms/FileUpload.md +55 -0
  114. package/llms/components/forms/FilterBar.md +34 -0
  115. package/llms/components/forms/ImageCrop.md +88 -0
  116. package/llms/components/forms/NumberField.md +94 -0
  117. package/llms/components/forms/Questionnaire.md +12 -0
  118. package/llms/components/forms/RichTextEditor.md +62 -0
  119. package/llms/components/forms/SettingsSection.md +65 -0
  120. package/llms/components/forms/Stepper.md +85 -0
  121. package/llms/components/forms/TagInput.md +47 -0
  122. package/llms/components/layout/AppShell.md +63 -0
  123. package/llms/components/layout/BillingUsage.md +51 -0
  124. package/llms/components/layout/DashboardLayout.md +78 -0
  125. package/llms/components/layout/PageHeader.md +49 -0
  126. package/llms/components/navigation/AccountMenu.md +42 -0
  127. package/llms/components/navigation/Tree.md +28 -0
  128. package/llms/components/navigation/WorkspaceSwitcher.md +48 -0
  129. package/llms/components/planning/EventCalendar.md +67 -0
  130. package/llms/components/planning/Gantt.md +66 -0
  131. package/llms/components/planning/Kanban.md +50 -0
  132. package/llms/components/planning/Roadmap.md +34 -0
  133. package/llms/setup.md +24 -14
  134. package/llms.txt +34 -0
  135. package/package.json +105 -3
  136. /package/dist/{chunk-8fcjx3he.js → chunk-az81pc04.js} +0 -0
  137. /package/dist/{chunk-7pyt4e5t.js → chunk-ghmkxqn5.js} +0 -0
  138. /package/dist/{chunk-5pvyxayg.js → chunk-m9zsppp2.js} +0 -0
@@ -0,0 +1,228 @@
1
+ import"../../chunk-cp2m7y7v.js";
2
+ import {
3
+ Button2
4
+ } from "../../chunk-73rkr9ct.js";
5
+ import {
6
+ Table2,
7
+ TableHeader2,
8
+ TableBody2,
9
+ TableRow2,
10
+ TableHead2,
11
+ TableCell2
12
+ } from "../../chunk-0y0kqaqj.js";
13
+ import {
14
+ NativeSelect2,
15
+ NativeSelectOption2
16
+ } from "../../chunk-r9qrb6b6.js";
17
+ import {
18
+ Input2
19
+ } from "../../chunk-59p19t57.js";
20
+
21
+ // src/components/data-grid/DataGrid.tsx
22
+ import {
23
+ columnFilteringFeature,
24
+ columnVisibilityFeature,
25
+ createFilteredRowModel,
26
+ createPaginatedRowModel,
27
+ createSortedRowModel,
28
+ filterFn_includesString,
29
+ rowPaginationFeature,
30
+ rowSelectionFeature,
31
+ rowSortingFeature,
32
+ sortFn_alphanumeric,
33
+ sortFn_basic,
34
+ tableFeatures
35
+ } from "@tanstack/react-table";
36
+ import { ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon } from "lucide-react";
37
+ import { jsx, jsxs } from "react/jsx-runtime";
38
+ var dataGridFeatures = tableFeatures({
39
+ columnFilteringFeature,
40
+ columnVisibilityFeature,
41
+ rowPaginationFeature,
42
+ rowSelectionFeature,
43
+ rowSortingFeature,
44
+ filteredRowModel: createFilteredRowModel(),
45
+ sortedRowModel: createSortedRowModel(),
46
+ paginatedRowModel: createPaginatedRowModel(),
47
+ filterFns: { includesString: filterFn_includesString },
48
+ sortFns: { alphanumeric: sortFn_alphanumeric, basic: sortFn_basic }
49
+ });
50
+ function DataGrid({
51
+ table,
52
+ label,
53
+ toolbar,
54
+ empty = "No results.",
55
+ loading = false,
56
+ pagination = true,
57
+ density
58
+ }) {
59
+ const rows = table.getRowModel().rows;
60
+ return /* @__PURE__ */ jsxs("div", {
61
+ "data-density": density,
62
+ "data-scroll": "none",
63
+ className: "grid min-w-0 gap-3",
64
+ "aria-busy": loading,
65
+ children: [
66
+ toolbar,
67
+ /* @__PURE__ */ jsx("div", {
68
+ className: "min-w-0 rounded-sm border border-border",
69
+ children: /* @__PURE__ */ jsxs(Table2, {
70
+ "aria-label": label,
71
+ children: [
72
+ /* @__PURE__ */ jsx(TableHeader2, {
73
+ children: table.getHeaderGroups().map((group) => /* @__PURE__ */ jsx(TableRow2, {
74
+ children: group.headers.map((header) => /* @__PURE__ */ jsx(TableHead2, {
75
+ colSpan: header.colSpan,
76
+ "aria-sort": header.column.getCanSort() ? header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : "none" : undefined,
77
+ children: header.isPlaceholder ? null : /* @__PURE__ */ jsx(table.FlexRender, {
78
+ header
79
+ })
80
+ }, header.id))
81
+ }, group.id))
82
+ }),
83
+ /* @__PURE__ */ jsx(TableBody2, {
84
+ children: loading ? /* @__PURE__ */ jsx(TableRow2, {
85
+ children: /* @__PURE__ */ jsx(TableCell2, {
86
+ colSpan: table.getVisibleLeafColumns().length,
87
+ children: /* @__PURE__ */ jsxs("p", {
88
+ role: "status",
89
+ children: [
90
+ "Loading ",
91
+ label,
92
+ "…"
93
+ ]
94
+ })
95
+ })
96
+ }) : rows.length ? rows.map((row) => /* @__PURE__ */ jsx(TableRow2, {
97
+ "data-state": row.getIsSelected() ? "selected" : undefined,
98
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell2, {
99
+ children: /* @__PURE__ */ jsx(table.FlexRender, {
100
+ cell
101
+ })
102
+ }, cell.id))
103
+ }, row.id)) : /* @__PURE__ */ jsx(TableRow2, {
104
+ children: /* @__PURE__ */ jsx(TableCell2, {
105
+ colSpan: table.getVisibleLeafColumns().length,
106
+ children: /* @__PURE__ */ jsx("p", {
107
+ role: "status",
108
+ children: empty
109
+ })
110
+ })
111
+ })
112
+ })
113
+ ]
114
+ })
115
+ }),
116
+ pagination && /* @__PURE__ */ jsx(DataGridPagination, {
117
+ table
118
+ })
119
+ ]
120
+ });
121
+ }
122
+ function DataGridColumnHeader({
123
+ column,
124
+ children
125
+ }) {
126
+ const sorted = column.getIsSorted();
127
+ return column.getCanSort() ? /* @__PURE__ */ jsxs(Button2, {
128
+ type: "button",
129
+ variant: "ghost",
130
+ size: "sm",
131
+ onClick: column.getToggleSortingHandler(),
132
+ children: [
133
+ children,
134
+ sorted === "asc" ? /* @__PURE__ */ jsx(ArrowUpIcon, {
135
+ "aria-hidden": "true"
136
+ }) : sorted === "desc" ? /* @__PURE__ */ jsx(ArrowDownIcon, {
137
+ "aria-hidden": "true"
138
+ }) : /* @__PURE__ */ jsx(ChevronsUpDownIcon, {
139
+ "aria-hidden": "true"
140
+ })
141
+ ]
142
+ }) : /* @__PURE__ */ jsx("span", {
143
+ children
144
+ });
145
+ }
146
+ function DataGridFilter({
147
+ table,
148
+ columnId,
149
+ label
150
+ }) {
151
+ const column = table.getColumn(columnId);
152
+ if (!column)
153
+ throw new Error(`Unknown filter column: ${columnId}`);
154
+ const value = column.getFilterValue();
155
+ return /* @__PURE__ */ jsx(Input2, {
156
+ "aria-label": label,
157
+ placeholder: label,
158
+ value: typeof value === "string" ? value : "",
159
+ onChange: (event) => column.setFilterValue(event.target.value)
160
+ });
161
+ }
162
+ function DataGridPagination({ table }) {
163
+ return /* @__PURE__ */ jsxs("div", {
164
+ className: "flex flex-wrap items-center justify-between gap-3 text-sm",
165
+ children: [
166
+ /* @__PURE__ */ jsxs("span", {
167
+ role: "status",
168
+ children: [
169
+ table.getSelectedRowModel().rows.length,
170
+ " selected · Page ",
171
+ table.state.pagination.pageIndex + 1,
172
+ " of",
173
+ " ",
174
+ Math.max(1, table.getPageCount())
175
+ ]
176
+ }),
177
+ /* @__PURE__ */ jsxs("div", {
178
+ className: "flex items-center gap-2",
179
+ children: [
180
+ /* @__PURE__ */ jsxs(NativeSelect2, {
181
+ "aria-label": "Rows per page",
182
+ value: table.state.pagination.pageSize,
183
+ onChange: (event) => table.setPageSize(Number(event.target.value)),
184
+ children: [
185
+ [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsxs(NativeSelectOption2, {
186
+ value: size,
187
+ children: [
188
+ size,
189
+ " rows"
190
+ ]
191
+ }, size)),
192
+ ![10, 20, 50, 100].includes(table.state.pagination.pageSize) && /* @__PURE__ */ jsxs(NativeSelectOption2, {
193
+ value: table.state.pagination.pageSize,
194
+ children: [
195
+ table.state.pagination.pageSize,
196
+ " rows"
197
+ ]
198
+ })
199
+ ]
200
+ }),
201
+ /* @__PURE__ */ jsx(Button2, {
202
+ type: "button",
203
+ variant: "outline",
204
+ size: "sm",
205
+ disabled: !table.getCanPreviousPage(),
206
+ onClick: () => table.previousPage(),
207
+ children: "Previous"
208
+ }),
209
+ /* @__PURE__ */ jsx(Button2, {
210
+ type: "button",
211
+ variant: "outline",
212
+ size: "sm",
213
+ disabled: !table.getCanNextPage(),
214
+ onClick: () => table.nextPage(),
215
+ children: "Next"
216
+ })
217
+ ]
218
+ })
219
+ ]
220
+ });
221
+ }
222
+ export {
223
+ DataGrid,
224
+ DataGridColumnHeader,
225
+ DataGridFilter,
226
+ DataGridPagination,
227
+ dataGridFeatures
228
+ };
@@ -0,0 +1,14 @@
1
+ import { type Editor } from "@tiptap/react";
2
+ import type { ReactElement } from "react";
3
+ import type { IDensityProps } from "../../density/types.js";
4
+ type RichTextEditorProps = IDensityProps & {
5
+ editor: Editor | null;
6
+ label: string;
7
+ };
8
+ /** The caller owns a native Tiptap editor and its extensions, content, and persistence. */
9
+ declare function RichTextEditor({ editor, label, density }: RichTextEditorProps): ReactElement;
10
+ export { RichTextEditor };
11
+ export type { RichTextEditorProps };
12
+ export { useEditor, useEditorState, EditorContent } from "@tiptap/react";
13
+ export type { Editor, JSONContent, Content, Extensions } from "@tiptap/core";
14
+ export { default as StarterKit } from "@tiptap/starter-kit";
@@ -0,0 +1,2 @@
1
+ export { RichTextEditor, useEditor, useEditorState, EditorContent, StarterKit } from "./RichTextEditor.js";
2
+ export type { RichTextEditorProps, Editor, JSONContent, Content, Extensions } from "./RichTextEditor.js";
@@ -0,0 +1,108 @@
1
+ import"../../chunk-cp2m7y7v.js";
2
+ import"../../chunk-73rkr9ct.js";
3
+ import {
4
+ Toolbar2,
5
+ ToolbarButton2,
6
+ ToolbarGroup2,
7
+ ToolbarSeparator2
8
+ } from "../../chunk-21wbz345.js";
9
+
10
+ // src/components/editor/RichTextEditor.tsx
11
+ import { EditorContent, useEditorState } from "@tiptap/react";
12
+ import { BoldIcon, ItalicIcon, ListIcon, ListOrderedIcon, RedoIcon, UndoIcon } from "lucide-react";
13
+ import { useEditor, useEditorState as useEditorState2, EditorContent as EditorContent2 } from "@tiptap/react";
14
+ import { default as default2 } from "@tiptap/starter-kit";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ function RichTextEditor({ editor, label, density }) {
17
+ const state = useEditorState({
18
+ editor,
19
+ selector: ({ editor: current }) => ({
20
+ bold: current?.isActive("bold") ?? false,
21
+ italic: current?.isActive("italic") ?? false,
22
+ bulletList: current?.isActive("bulletList") ?? false,
23
+ orderedList: current?.isActive("orderedList") ?? false,
24
+ undo: current?.can().undo() ?? false,
25
+ redo: current?.can().redo() ?? false,
26
+ editable: current?.isEditable ?? false
27
+ })
28
+ });
29
+ return /* @__PURE__ */ jsxs("div", {
30
+ "data-density": density,
31
+ "data-scroll": "none",
32
+ className: "min-w-0 rounded-sm border border-input bg-background",
33
+ children: [
34
+ /* @__PURE__ */ jsxs(Toolbar2, {
35
+ "aria-label": `${label} formatting`,
36
+ className: "rounded-b-none border-0 border-b border-border",
37
+ children: [
38
+ /* @__PURE__ */ jsxs(ToolbarGroup2, {
39
+ children: [
40
+ /* @__PURE__ */ jsx(ToolbarButton2, {
41
+ "aria-label": "Bold",
42
+ "aria-pressed": state?.bold,
43
+ disabled: !state?.editable,
44
+ onClick: () => editor?.chain().focus().toggleBold().run(),
45
+ children: /* @__PURE__ */ jsx(BoldIcon, {})
46
+ }),
47
+ /* @__PURE__ */ jsx(ToolbarButton2, {
48
+ "aria-label": "Italic",
49
+ "aria-pressed": state?.italic,
50
+ disabled: !state?.editable,
51
+ onClick: () => editor?.chain().focus().toggleItalic().run(),
52
+ children: /* @__PURE__ */ jsx(ItalicIcon, {})
53
+ })
54
+ ]
55
+ }),
56
+ /* @__PURE__ */ jsx(ToolbarSeparator2, {}),
57
+ /* @__PURE__ */ jsxs(ToolbarGroup2, {
58
+ children: [
59
+ /* @__PURE__ */ jsx(ToolbarButton2, {
60
+ "aria-label": "Bullet list",
61
+ "aria-pressed": state?.bulletList,
62
+ disabled: !state?.editable,
63
+ onClick: () => editor?.chain().focus().toggleBulletList().run(),
64
+ children: /* @__PURE__ */ jsx(ListIcon, {})
65
+ }),
66
+ /* @__PURE__ */ jsx(ToolbarButton2, {
67
+ "aria-label": "Numbered list",
68
+ "aria-pressed": state?.orderedList,
69
+ disabled: !state?.editable,
70
+ onClick: () => editor?.chain().focus().toggleOrderedList().run(),
71
+ children: /* @__PURE__ */ jsx(ListOrderedIcon, {})
72
+ })
73
+ ]
74
+ }),
75
+ /* @__PURE__ */ jsx(ToolbarSeparator2, {}),
76
+ /* @__PURE__ */ jsxs(ToolbarGroup2, {
77
+ children: [
78
+ /* @__PURE__ */ jsx(ToolbarButton2, {
79
+ "aria-label": "Undo",
80
+ disabled: !state?.editable || !state.undo,
81
+ onClick: () => editor?.chain().focus().undo().run(),
82
+ children: /* @__PURE__ */ jsx(UndoIcon, {})
83
+ }),
84
+ /* @__PURE__ */ jsx(ToolbarButton2, {
85
+ "aria-label": "Redo",
86
+ disabled: !state?.editable || !state.redo,
87
+ onClick: () => editor?.chain().focus().redo().run(),
88
+ children: /* @__PURE__ */ jsx(RedoIcon, {})
89
+ })
90
+ ]
91
+ })
92
+ ]
93
+ }),
94
+ /* @__PURE__ */ jsx(EditorContent, {
95
+ editor,
96
+ "aria-label": label,
97
+ className: "max-h-96 overflow-auto p-3 [&_.tiptap]:min-h-32 [&_.tiptap]:outline-none [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3"
98
+ })
99
+ ]
100
+ });
101
+ }
102
+ export {
103
+ EditorContent2 as EditorContent,
104
+ RichTextEditor,
105
+ default2 as StarterKit,
106
+ useEditor,
107
+ useEditorState2 as useEditorState
108
+ };
@@ -0,0 +1,16 @@
1
+ import { type CalendarProps, type ToolbarProps } from "react-big-calendar";
2
+ import { type ReactElement } from "react";
3
+ import type { IDensityProps } from "../../density/types.js";
4
+ declare const eventCalendarLocalizer: import("react-big-calendar").DateLocalizer;
5
+ declare function EventCalendarToolbar<T extends object, R extends object>({ label, view, views, onNavigate, onView, localizer, }: ToolbarProps<T, R>): ReactElement;
6
+ type EventCalendarProps<T extends object, R extends object = object> = Omit<CalendarProps<T, R>, "className" | "style" | "popup" | "popupOffset" | "localizer"> & IDensityProps & {
7
+ label: string;
8
+ height?: number | string;
9
+ localizer?: CalendarProps<T, R>["localizer"];
10
+ };
11
+ /** Import @alexgorbatchev/shadcn/event-calendar.css. Native localizer and event APIs are preserved. */
12
+ declare function EventCalendar<T extends object, R extends object = object>({ label, height, density, components, localizer, ...props }: EventCalendarProps<T, R>): ReactElement;
13
+ export { EventCalendar, EventCalendarToolbar, eventCalendarLocalizer };
14
+ export type { EventCalendarProps };
15
+ export { dateFnsLocalizer } from "react-big-calendar";
16
+ export type { Event, View, SlotInfo, DateLocalizer, CalendarProps, ToolbarProps } from "react-big-calendar";
@@ -0,0 +1,18 @@
1
+ import { type ReactElement } from "react";
2
+ import type { IDensityProps } from "../../density/types.js";
3
+ type EventDraft = {
4
+ title: string;
5
+ start: Date;
6
+ end: Date;
7
+ allDay: boolean;
8
+ };
9
+ type EventFormProps = IDensityProps & {
10
+ label: string;
11
+ initialValue: EventDraft;
12
+ onSave: (value: EventDraft) => void | Promise<void>;
13
+ onCancel?: () => void;
14
+ disabled?: boolean;
15
+ };
16
+ declare function EventForm({ label, initialValue, onSave, onCancel, disabled, density }: EventFormProps): ReactElement;
17
+ export { EventForm };
18
+ export type { EventFormProps, EventDraft };
@@ -0,0 +1,4 @@
1
+ export { EventCalendar, EventCalendarToolbar, eventCalendarLocalizer, dateFnsLocalizer } from "./EventCalendar.js";
2
+ export type { EventCalendarProps, Event, View, SlotInfo, DateLocalizer, CalendarProps, ToolbarProps, } from "./EventCalendar.js";
3
+ export { EventForm } from "./EventForm.js";
4
+ export type { EventFormProps, EventDraft } from "./EventForm.js";
@@ -0,0 +1,266 @@
1
+ import {
2
+ cn2
3
+ } from "../../chunk-cp2m7y7v.js";
4
+ import {
5
+ Button2
6
+ } from "../../chunk-73rkr9ct.js";
7
+ import"../../chunk-jcxxjkqx.js";
8
+ import"../../chunk-rajgnfbr.js";
9
+ import {
10
+ FieldGroup2,
11
+ Field2,
12
+ FieldLabel2
13
+ } from "../../chunk-6jpz5geq.js";
14
+ import {
15
+ Input2
16
+ } from "../../chunk-59p19t57.js";
17
+ import {
18
+ Checkbox2,
19
+ Spinner2
20
+ } from "../../chunk-eehfrrdz.js";
21
+
22
+ // src/components/event-calendar/EventCalendar.tsx
23
+ import {
24
+ Calendar as NativeCalendar,
25
+ dateFnsLocalizer
26
+ } from "react-big-calendar";
27
+ import { format, parse, startOfWeek, getDay } from "date-fns";
28
+ import { enUS } from "date-fns/locale";
29
+ import { createElement, isValidElement } from "react";
30
+ import { dateFnsLocalizer as dateFnsLocalizer2 } from "react-big-calendar";
31
+ import { jsx, jsxs } from "react/jsx-runtime";
32
+ var eventCalendarLocalizer = dateFnsLocalizer({ format, parse, startOfWeek, getDay, locales: { "en-US": enUS } });
33
+ function EventCalendarToolbar({
34
+ label,
35
+ view,
36
+ views,
37
+ onNavigate,
38
+ onView,
39
+ localizer
40
+ }) {
41
+ const names = Array.isArray(views) ? views : Object.keys(views ?? {});
42
+ return /* @__PURE__ */ jsxs("div", {
43
+ className: "mb-3 flex flex-wrap items-center justify-between gap-2",
44
+ children: [
45
+ /* @__PURE__ */ jsxs("div", {
46
+ className: "flex gap-1",
47
+ children: [
48
+ /* @__PURE__ */ jsx(Button2, {
49
+ type: "button",
50
+ variant: "outline",
51
+ size: "sm",
52
+ onClick: () => onNavigate("PREV"),
53
+ children: localizer.messages.previous
54
+ }),
55
+ /* @__PURE__ */ jsx(Button2, {
56
+ type: "button",
57
+ variant: "outline",
58
+ size: "sm",
59
+ onClick: () => onNavigate("TODAY"),
60
+ children: localizer.messages.today
61
+ }),
62
+ /* @__PURE__ */ jsx(Button2, {
63
+ type: "button",
64
+ variant: "outline",
65
+ size: "sm",
66
+ onClick: () => onNavigate("NEXT"),
67
+ children: localizer.messages.next
68
+ })
69
+ ]
70
+ }),
71
+ /* @__PURE__ */ jsx("h2", {
72
+ "aria-live": "polite",
73
+ className: "text-sm font-semibold",
74
+ children: label
75
+ }),
76
+ /* @__PURE__ */ jsx("div", {
77
+ className: "flex flex-wrap gap-1",
78
+ "aria-label": "Calendar views",
79
+ role: "group",
80
+ children: names.map((name) => {
81
+ if (name !== "month" && name !== "week" && name !== "work_week" && name !== "day" && name !== "agenda")
82
+ return null;
83
+ return /* @__PURE__ */ jsx(Button2, {
84
+ type: "button",
85
+ size: "sm",
86
+ variant: view === name ? "default" : "outline",
87
+ "aria-pressed": view === name,
88
+ onClick: () => onView(name),
89
+ children: localizer.messages[name] ?? name
90
+ }, name);
91
+ })
92
+ })
93
+ ]
94
+ });
95
+ }
96
+ function EventButton({ children }) {
97
+ if (!isValidElement(children))
98
+ throw new Error("An event wrapper requires one event element.");
99
+ return createElement("button", { ...children.props, type: "button" }, children.props.children);
100
+ }
101
+ function EventCalendar({
102
+ label,
103
+ height = 640,
104
+ density,
105
+ components,
106
+ localizer = eventCalendarLocalizer,
107
+ ...props
108
+ }) {
109
+ return /* @__PURE__ */ jsx("section", {
110
+ "aria-label": label,
111
+ "data-density": density,
112
+ "data-scroll": "none",
113
+ className: "min-w-0 rounded-sm border border-border bg-card p-3",
114
+ children: /* @__PURE__ */ jsx(NativeCalendar, {
115
+ ...props,
116
+ localizer,
117
+ popup: false,
118
+ className: cn2("ag-event-calendar"),
119
+ style: { height },
120
+ components: { toolbar: EventCalendarToolbar, eventWrapper: EventButton, ...components }
121
+ })
122
+ });
123
+ }
124
+ // src/components/event-calendar/EventForm.tsx
125
+ import { useId, useState } from "react";
126
+ import { format as format2 } from "date-fns";
127
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
128
+ function EventForm({ label, initialValue, onSave, onCancel, disabled, density }) {
129
+ const id = useId();
130
+ const [start, setStart] = useState(format2(initialValue.start, "yyyy-MM-dd'T'HH:mm"));
131
+ const [pending, setPending] = useState(false);
132
+ const [error, setError] = useState("");
133
+ return /* @__PURE__ */ jsx2("form", {
134
+ "aria-label": label,
135
+ "data-density": density,
136
+ "aria-busy": pending,
137
+ onSubmit: async (event) => {
138
+ event.preventDefault();
139
+ const data = new FormData(event.currentTarget);
140
+ const value = {
141
+ title: String(data.get("title")),
142
+ start: new Date(String(data.get("start"))),
143
+ end: new Date(String(data.get("end"))),
144
+ allDay: data.has("allDay")
145
+ };
146
+ setPending(true);
147
+ setError("");
148
+ try {
149
+ await onSave(value);
150
+ } catch (error) {
151
+ setError(error instanceof Error ? error.message : "Unable to save the event.");
152
+ } finally {
153
+ setPending(false);
154
+ }
155
+ },
156
+ children: /* @__PURE__ */ jsxs2("fieldset", {
157
+ disabled: disabled || pending,
158
+ className: "min-w-0",
159
+ children: [
160
+ /* @__PURE__ */ jsx2("legend", {
161
+ className: "sr-only",
162
+ children: label
163
+ }),
164
+ /* @__PURE__ */ jsxs2(FieldGroup2, {
165
+ children: [
166
+ /* @__PURE__ */ jsxs2(Field2, {
167
+ children: [
168
+ /* @__PURE__ */ jsx2(FieldLabel2, {
169
+ htmlFor: `${id}-title`,
170
+ children: "Title"
171
+ }),
172
+ /* @__PURE__ */ jsx2(Input2, {
173
+ id: `${id}-title`,
174
+ name: "title",
175
+ required: true,
176
+ defaultValue: initialValue.title
177
+ })
178
+ ]
179
+ }),
180
+ /* @__PURE__ */ jsxs2("div", {
181
+ className: "grid gap-3 sm:grid-cols-2",
182
+ children: [
183
+ /* @__PURE__ */ jsxs2(Field2, {
184
+ children: [
185
+ /* @__PURE__ */ jsx2(FieldLabel2, {
186
+ htmlFor: `${id}-start`,
187
+ children: "Start"
188
+ }),
189
+ /* @__PURE__ */ jsx2(Input2, {
190
+ id: `${id}-start`,
191
+ name: "start",
192
+ type: "datetime-local",
193
+ required: true,
194
+ value: start,
195
+ onChange: (event) => setStart(event.target.value)
196
+ })
197
+ ]
198
+ }),
199
+ /* @__PURE__ */ jsxs2(Field2, {
200
+ children: [
201
+ /* @__PURE__ */ jsx2(FieldLabel2, {
202
+ htmlFor: `${id}-end`,
203
+ children: "End"
204
+ }),
205
+ /* @__PURE__ */ jsx2(Input2, {
206
+ id: `${id}-end`,
207
+ name: "end",
208
+ type: "datetime-local",
209
+ required: true,
210
+ min: start,
211
+ defaultValue: format2(initialValue.end, "yyyy-MM-dd'T'HH:mm")
212
+ })
213
+ ]
214
+ })
215
+ ]
216
+ }),
217
+ /* @__PURE__ */ jsxs2(Field2, {
218
+ orientation: "horizontal",
219
+ children: [
220
+ /* @__PURE__ */ jsx2(Checkbox2, {
221
+ id: `${id}-all-day`,
222
+ name: "allDay",
223
+ defaultChecked: initialValue.allDay
224
+ }),
225
+ /* @__PURE__ */ jsx2(FieldLabel2, {
226
+ htmlFor: `${id}-all-day`,
227
+ children: "All day"
228
+ })
229
+ ]
230
+ }),
231
+ error && /* @__PURE__ */ jsx2("p", {
232
+ role: "alert",
233
+ className: "text-sm text-destructive",
234
+ children: error
235
+ }),
236
+ /* @__PURE__ */ jsxs2("div", {
237
+ className: "flex flex-wrap justify-end gap-2",
238
+ children: [
239
+ onCancel && /* @__PURE__ */ jsx2(Button2, {
240
+ type: "button",
241
+ variant: "outline",
242
+ onClick: onCancel,
243
+ children: "Cancel"
244
+ }),
245
+ /* @__PURE__ */ jsxs2(Button2, {
246
+ type: "submit",
247
+ children: [
248
+ pending && /* @__PURE__ */ jsx2(Spinner2, {}),
249
+ "Save event"
250
+ ]
251
+ })
252
+ ]
253
+ })
254
+ ]
255
+ })
256
+ ]
257
+ })
258
+ });
259
+ }
260
+ export {
261
+ EventCalendar,
262
+ EventCalendarToolbar,
263
+ EventForm,
264
+ dateFnsLocalizer2 as dateFnsLocalizer,
265
+ eventCalendarLocalizer
266
+ };
@@ -0,0 +1,14 @@
1
+ import { type ReactElement, type ReactNode } from "react";
2
+ import { type DropzoneOptions } from "react-dropzone";
3
+ import type { IDensityProps } from "../../density/types.js";
4
+ type FileUploadProps = IDensityProps & Pick<DropzoneOptions, "accept" | "maxSize" | "minSize" | "maxFiles" | "multiple" | "disabled" | "validator" | "onDrop" | "onDropRejected" | "onError"> & {
5
+ label: string;
6
+ description?: ReactNode;
7
+ children?: ReactNode;
8
+ name?: string;
9
+ };
10
+ /** Native file selection and validation. Consumers own storage and upload requests. */
11
+ declare function FileUpload({ label, description, children, name, density, ...options }: FileUploadProps): ReactElement;
12
+ export { FileUpload };
13
+ export type { FileUploadProps };
14
+ export type { FileRejection, FileError, DropEvent, Accept } from "react-dropzone";
@@ -0,0 +1,2 @@
1
+ export { FileUpload } from "./FileUpload.js";
2
+ export type { FileUploadProps, FileRejection, FileError, DropEvent, Accept } from "./FileUpload.js";