@rebasepro/app 0.17.3 → 0.18.1

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 (185) hide show
  1. package/README.md +4 -1
  2. package/dist/components/index.d.ts +0 -3
  3. package/dist/contexts/AuthControllerContext.d.ts +2 -1
  4. package/dist/contexts/CustomizationControllerContext.d.ts +2 -1
  5. package/dist/contexts/DialogsProvider.d.ts +2 -1
  6. package/dist/contexts/RebaseDataContext.d.ts +10 -1
  7. package/dist/contexts/StorageSourceContext.d.ts +11 -1
  8. package/dist/core/RebaseProps.d.ts +2 -12
  9. package/dist/debug/index.d.ts +19 -0
  10. package/dist/debug.js +3631 -0
  11. package/dist/hooks/data/delete.d.ts +16 -7
  12. package/dist/hooks/data/save.d.ts +18 -4
  13. package/dist/hooks/index.d.ts +1 -0
  14. package/dist/hooks/useAdminModeController.d.ts +5 -4
  15. package/dist/hooks/useNavigationGroupLabel.d.ts +17 -0
  16. package/dist/hooks/useStudioBridge.d.ts +33 -0
  17. package/dist/index.es.js +2599 -6980
  18. package/dist/index.es.js.map +1 -1
  19. package/dist/vitePlugin.d.ts +22 -0
  20. package/dist/vitePlugin.js +40 -1
  21. package/package.json +42 -31
  22. package/src/auth/api.ts +0 -134
  23. package/src/auth/index.ts +0 -26
  24. package/src/auth/types.ts +0 -115
  25. package/src/auth/useRebaseAuthController.ts +0 -345
  26. package/src/collections/collection_view_config.ts +0 -76
  27. package/src/collections/entity-display-cache.ts +0 -195
  28. package/src/collections/entity-display.ts +0 -77
  29. package/src/collections/entity_image_preview.ts +0 -61
  30. package/src/collections/filter-operator-resolution.ts +0 -119
  31. package/src/collections/form-layout.ts +0 -394
  32. package/src/collections/index.ts +0 -13
  33. package/src/collections/navigation_from_path.ts +0 -123
  34. package/src/collections/navigation_utils.ts +0 -171
  35. package/src/collections/parent_references_from_path.ts +0 -59
  36. package/src/collections/property-path.ts +0 -30
  37. package/src/collections/property_presentation.ts +0 -264
  38. package/src/collections/summary-property.ts +0 -114
  39. package/src/collections/title-property.ts +0 -312
  40. package/src/components/AIIcon.tsx +0 -47
  41. package/src/components/AuthSimulationMenu.tsx +0 -0
  42. package/src/components/ConfirmationDialog.tsx +0 -48
  43. package/src/components/Debug/UIReferenceView.tsx +0 -1053
  44. package/src/components/Debug/UIStyleGuide.tsx +0 -159
  45. package/src/components/Debug/collection-views/CardViewDemo.tsx +0 -87
  46. package/src/components/Debug/collection-views/CollectionTableDemo.tsx +0 -107
  47. package/src/components/Debug/collection-views/KanbanBoardDemo.tsx +0 -89
  48. package/src/components/Debug/collection-views/index.ts +0 -3
  49. package/src/components/Debug/collection-views/sample_data.ts +0 -44
  50. package/src/components/Debug/crm-dashboard/CalendarWidget.tsx +0 -387
  51. package/src/components/Debug/crm-dashboard/CrmDashboardDemo.tsx +0 -1100
  52. package/src/components/Debug/crm-dashboard/DashboardMetrics.tsx +0 -131
  53. package/src/components/Debug/crm-dashboard/PipelineOverview.tsx +0 -288
  54. package/src/components/Debug/crm-dashboard/RecentActivity.tsx +0 -213
  55. package/src/components/Debug/crm-dashboard/TaskFilters.tsx +0 -182
  56. package/src/components/Debug/crm-dashboard/TaskTable.tsx +0 -425
  57. package/src/components/Debug/crm-dashboard/TasksView.tsx +0 -234
  58. package/src/components/ErrorTooltip.tsx +0 -12
  59. package/src/components/ErrorView.tsx +0 -94
  60. package/src/components/LanguageToggle.tsx +0 -59
  61. package/src/components/LoginView/LoginView.tsx +0 -1235
  62. package/src/components/LoginView/index.ts +0 -2
  63. package/src/components/LoginView/oauth-redirect-flow.ts +0 -184
  64. package/src/components/NotFoundPage.tsx +0 -27
  65. package/src/components/RebaseAuth.tsx +0 -27
  66. package/src/components/RebaseLogo.tsx +0 -88
  67. package/src/components/SchemaDriftBanner.tsx +0 -102
  68. package/src/components/UnsavedChangesDialog.tsx +0 -46
  69. package/src/components/UserDisplay.tsx +0 -54
  70. package/src/components/UserSelectPopover.tsx +0 -399
  71. package/src/components/UserSettingsView.tsx +0 -318
  72. package/src/components/common/index.ts +0 -6
  73. package/src/components/common/table_height.tsx +0 -21
  74. package/src/components/common/types.tsx +0 -66
  75. package/src/components/common/useColumnsIds.tsx +0 -261
  76. package/src/components/common/useDataTableController.tsx +0 -571
  77. package/src/components/common/useDebouncedData.ts +0 -49
  78. package/src/components/common/useScrollRestoration.tsx +0 -68
  79. package/src/components/index.tsx +0 -26
  80. package/src/contexts/AdminModeController.tsx +0 -11
  81. package/src/contexts/AnalyticsContext.tsx +0 -4
  82. package/src/contexts/AuthControllerContext.tsx +0 -4
  83. package/src/contexts/CollectionResolverContext.tsx +0 -24
  84. package/src/contexts/CollectionScopeContext.tsx +0 -68
  85. package/src/contexts/ComponentOverrideContext.tsx +0 -81
  86. package/src/contexts/CustomizationControllerContext.tsx +0 -4
  87. package/src/contexts/DataDriverContext.tsx +0 -4
  88. package/src/contexts/DataSourcesContext.tsx +0 -36
  89. package/src/contexts/DatabaseAdminContext.tsx +0 -4
  90. package/src/contexts/DialogsProvider.tsx +0 -56
  91. package/src/contexts/EffectiveRoleController.tsx +0 -12
  92. package/src/contexts/ModeController.tsx +0 -11
  93. package/src/contexts/RebaseClientInstanceContext.tsx +0 -7
  94. package/src/contexts/RebaseDataContext.tsx +0 -4
  95. package/src/contexts/SnackbarProvider.tsx +0 -15
  96. package/src/contexts/StorageSourceContext.tsx +0 -4
  97. package/src/contexts/StorageSourcesContext.tsx +0 -30
  98. package/src/contexts/UserConfigurationPersistenceContext.tsx +0 -4
  99. package/src/contexts/index.ts +0 -18
  100. package/src/core/PluginLifecycleManager.tsx +0 -96
  101. package/src/core/PluginProviderStack.tsx +0 -40
  102. package/src/core/Rebase.tsx +0 -488
  103. package/src/core/RebaseProps.tsx +0 -333
  104. package/src/core/RebaseRouter.tsx +0 -18
  105. package/src/core/RebaseRoutes.tsx +0 -24
  106. package/src/core/index.tsx +0 -5
  107. package/src/hooks/ApiConfigContext.tsx +0 -83
  108. package/src/hooks/data/collectionQuery.ts +0 -55
  109. package/src/hooks/data/delete.ts +0 -56
  110. package/src/hooks/data/save.ts +0 -78
  111. package/src/hooks/data/useCollection.tsx +0 -183
  112. package/src/hooks/data/useData.tsx +0 -18
  113. package/src/hooks/data/useDataOrder.ts +0 -26
  114. package/src/hooks/data/useFetch.tsx +0 -156
  115. package/src/hooks/data/useRelationSelector.tsx +0 -280
  116. package/src/hooks/index.tsx +0 -45
  117. package/src/hooks/useAdminModeController.tsx +0 -23
  118. package/src/hooks/useAnalyticsController.tsx +0 -8
  119. package/src/hooks/useAuthController.tsx +0 -15
  120. package/src/hooks/useAuthSubscription.ts +0 -130
  121. package/src/hooks/useBackendStorageSource.ts +0 -295
  122. package/src/hooks/useBridgeRegistration.tsx +0 -32
  123. package/src/hooks/useBrowserTitleAndIcon.tsx +0 -23
  124. package/src/hooks/useBuildAdminModeController.tsx +0 -29
  125. package/src/hooks/useBuildEffectiveRoleController.tsx +0 -30
  126. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +0 -83
  127. package/src/hooks/useBuildModeController.tsx +0 -73
  128. package/src/hooks/useClipboard.tsx +0 -158
  129. package/src/hooks/useCollapsedGroups.ts +0 -116
  130. package/src/hooks/useComponentOverride.tsx +0 -59
  131. package/src/hooks/useCustomizationController.tsx +0 -14
  132. package/src/hooks/useDialogsController.tsx +0 -15
  133. package/src/hooks/useEffectiveRoleController.tsx +0 -10
  134. package/src/hooks/useLargeLayout.tsx +0 -65
  135. package/src/hooks/useModeController.tsx +0 -23
  136. package/src/hooks/useNavigationBlocker.tsx +0 -108
  137. package/src/hooks/usePermissions.ts +0 -45
  138. package/src/hooks/useRebaseClient.tsx +0 -10
  139. package/src/hooks/useRebaseContext.tsx +0 -84
  140. package/src/hooks/useRebaseRegistry.tsx +0 -91
  141. package/src/hooks/useResolvedComponent.tsx +0 -195
  142. package/src/hooks/useSlot.tsx +0 -64
  143. package/src/hooks/useSnackbarController.tsx +0 -80
  144. package/src/hooks/useStorageSource.tsx +0 -11
  145. package/src/hooks/useStudioBridge.tsx +0 -258
  146. package/src/hooks/useTranslation.ts +0 -38
  147. package/src/hooks/useUnsavedChangesDialog.tsx +0 -67
  148. package/src/hooks/useUserConfigurationPersistence.tsx +0 -11
  149. package/src/i18n/RebaseI18nProvider.tsx +0 -159
  150. package/src/index.ts +0 -32
  151. package/src/internal/common.tsx +0 -28
  152. package/src/internal/useRestoreScroll.tsx +0 -69
  153. package/src/locales/de.ts +0 -941
  154. package/src/locales/en.ts +0 -1021
  155. package/src/locales/es.ts +0 -962
  156. package/src/locales/fr.ts +0 -941
  157. package/src/locales/hi.ts +0 -941
  158. package/src/locales/it.ts +0 -941
  159. package/src/locales/pt.ts +0 -949
  160. package/src/util/constants.ts +0 -7
  161. package/src/util/createFormexStub.tsx +0 -66
  162. package/src/util/entity_cache.ts +0 -242
  163. package/src/util/enums.ts +0 -34
  164. package/src/util/icon_list.ts +0 -22
  165. package/src/util/icons.tsx +0 -129
  166. package/src/util/index.ts +0 -13
  167. package/src/util/local_storage.ts +0 -66
  168. package/src/util/previews.ts +0 -127
  169. package/src/util/useStorageUploadController.tsx +0 -354
  170. package/src/vitePlugin.ts +0 -215
  171. /package/dist/{components/Debug → debug}/UIReferenceView.d.ts +0 -0
  172. /package/dist/{components/Debug → debug}/UIStyleGuide.d.ts +0 -0
  173. /package/dist/{components/Debug → debug}/collection-views/CardViewDemo.d.ts +0 -0
  174. /package/dist/{components/Debug → debug}/collection-views/CollectionTableDemo.d.ts +0 -0
  175. /package/dist/{components/Debug → debug}/collection-views/KanbanBoardDemo.d.ts +0 -0
  176. /package/dist/{components/Debug → debug}/collection-views/index.d.ts +0 -0
  177. /package/dist/{components/Debug → debug}/collection-views/sample_data.d.ts +0 -0
  178. /package/dist/{components/Debug → debug}/crm-dashboard/CalendarWidget.d.ts +0 -0
  179. /package/dist/{components/Debug → debug}/crm-dashboard/CrmDashboardDemo.d.ts +0 -0
  180. /package/dist/{components/Debug → debug}/crm-dashboard/DashboardMetrics.d.ts +0 -0
  181. /package/dist/{components/Debug → debug}/crm-dashboard/PipelineOverview.d.ts +0 -0
  182. /package/dist/{components/Debug → debug}/crm-dashboard/RecentActivity.d.ts +0 -0
  183. /package/dist/{components/Debug → debug}/crm-dashboard/TaskFilters.d.ts +0 -0
  184. /package/dist/{components/Debug → debug}/crm-dashboard/TaskTable.d.ts +0 -0
  185. /package/dist/{components/Debug → debug}/crm-dashboard/TasksView.d.ts +0 -0
package/dist/debug.js ADDED
@@ -0,0 +1,3631 @@
1
+ // src/debug/UIStyleGuide.tsx
2
+ import { Button, Container, IconButton, Paper, Trash2Icon, Typography } from "@rebasepro/ui";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var UIStyleGuide = () => {
5
+ const typographyVariants = [
6
+ "h1",
7
+ "h2",
8
+ "h3",
9
+ "h4",
10
+ "h5",
11
+ "h6",
12
+ "subtitle1",
13
+ "subtitle2",
14
+ "body1",
15
+ "body2",
16
+ "caption",
17
+ "label",
18
+ "button"
19
+ ];
20
+ const colors = ["primary", "secondary", "disabled", "error"];
21
+ const buttonVariants = ["filled", "text"];
22
+ const buttonColors = ["primary", "secondary", "text", "error", "neutral"];
23
+ const buttonSizes = ["small", "medium", "large", "xl", "2xl"];
24
+ const IconExample = () => /* @__PURE__ */ jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 6v6m0 0v6m0-6h6m-6 0H6" }) });
25
+ return /* @__PURE__ */ jsxs(Container, { className: "py-10 max-w-5xl", children: [
26
+ /* @__PURE__ */ jsx(Typography, { variant: "h2", gutterBottom: true, children: "Rebase UI Style Guide" }),
27
+ /* @__PURE__ */ jsx(Typography, { variant: "body1", color: "secondary", className: "mb-8", children: "A showcase of all typography and button variants available in the @rebasepro/ui library." }),
28
+ /* @__PURE__ */ jsxs("section", { className: "mb-12", children: [
29
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, className: "border-b pb-2 mb-6", children: "Typography Variants" }),
30
+ /* @__PURE__ */ jsx(Paper, { className: "p-6 space-y-6", children: typographyVariants.map((variant) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 border-b border-surface-100 dark:border-surface-950 pb-4 last:border-0", children: [
31
+ /* @__PURE__ */ jsx("span", { className: "w-24 text-[10px] uppercase tracking-wider text-text-disabled font-mono", children: variant }),
32
+ /* @__PURE__ */ jsxs(Typography, { variant, component: "p", children: [
33
+ "The quick brown fox jumps over the lazy dog (",
34
+ variant,
35
+ ")"
36
+ ] })
37
+ ] }, variant)) })
38
+ ] }),
39
+ /* @__PURE__ */ jsxs("section", { className: "mb-12", children: [
40
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, className: "border-b pb-2 mb-6", children: "Typography Colors" }),
41
+ /* @__PURE__ */ jsx(Paper, { className: "p-6 space-y-4", children: colors.map((color) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
42
+ /* @__PURE__ */ jsx("span", { className: "w-24 text-[10px] uppercase tracking-wider text-text-disabled font-mono", children: color }),
43
+ /* @__PURE__ */ jsxs(Typography, { color, children: [
44
+ 'This text is rendered with color="',
45
+ color,
46
+ '"'
47
+ ] })
48
+ ] }, color)) })
49
+ ] }),
50
+ /* @__PURE__ */ jsxs("section", { className: "mb-12", children: [
51
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, className: "border-b pb-2 mb-6", children: "Button Discovery" }),
52
+ /* @__PURE__ */ jsx("div", { className: "space-y-8", children: buttonVariants.map((variant) => /* @__PURE__ */ jsxs("div", { children: [
53
+ /* @__PURE__ */ jsxs(Typography, { variant: "h6", gutterBottom: true, className: "capitalize mb-4", children: [
54
+ variant,
55
+ " Buttons"
56
+ ] }),
57
+ /* @__PURE__ */ jsx(Paper, { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-4", children: [
58
+ buttonColors.map((color) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
59
+ /* @__PURE__ */ jsx(Button, { variant, color, children: color }),
60
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: color })
61
+ ] }, color)),
62
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
63
+ /* @__PURE__ */ jsx(Button, { variant, color: "primary", disabled: true, children: "Disabled" }),
64
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: "disabled" })
65
+ ] })
66
+ ] }) })
67
+ ] }, variant)) })
68
+ ] }),
69
+ /* @__PURE__ */ jsxs("section", { className: "mb-12", children: [
70
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, className: "border-b pb-2 mb-6", children: "Button Sizes" }),
71
+ /* @__PURE__ */ jsx(Paper, { className: "p-6", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-end gap-6 text-center", children: buttonSizes.map((size) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
72
+ /* @__PURE__ */ jsx(Button, { size, color: "primary", children: size }),
73
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: size })
74
+ ] }, size)) }) })
75
+ ] }),
76
+ /* @__PURE__ */ jsxs("section", { className: "mb-12", children: [
77
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, className: "border-b pb-2 mb-6", children: "Icon Buttons" }),
78
+ /* @__PURE__ */ jsx(Paper, { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-8 items-center", children: [
79
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
80
+ /* @__PURE__ */ jsx(IconButton, { color: "primary", children: /* @__PURE__ */ jsx(IconExample, {}) }),
81
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: "primary" })
82
+ ] }),
83
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
84
+ /* @__PURE__ */ jsx(IconButton, { color: "secondary", children: /* @__PURE__ */ jsx(IconExample, {}) }),
85
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: "secondary" })
86
+ ] }),
87
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
88
+ /* @__PURE__ */ jsx(IconButton, { size: "small", children: /* @__PURE__ */ jsx(IconExample, {}) }),
89
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: "small" })
90
+ ] }),
91
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
92
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, children: /* @__PURE__ */ jsx(IconExample, {}) }),
93
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: "disabled" })
94
+ ] }),
95
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
96
+ /* @__PURE__ */ jsx(IconButton, { size: "small", color: "error", children: /* @__PURE__ */ jsx(Trash2Icon, {}) }),
97
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-text-disabled font-mono", children: "delete" })
98
+ ] })
99
+ ] }) })
100
+ ] }),
101
+ /* @__PURE__ */ jsx("section", { className: "mb-12", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center bg-surface-100 dark:bg-surface-950 p-8 rounded-xl border border-dashed border-surface-400", children: [
102
+ /* @__PURE__ */ jsxs("div", { children: [
103
+ /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Dark Mode Check" }),
104
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "secondary", children: "Typography and buttons should adapt automatically." })
105
+ ] }),
106
+ /* @__PURE__ */ jsx(Button, { variant: "filled", color: "neutral", startIcon: /* @__PURE__ */ jsx(IconExample, {}), children: "Sample Action" })
107
+ ] }) })
108
+ ] });
109
+ };
110
+
111
+ // src/debug/UIReferenceView.tsx
112
+ import React10, { useState as useState8 } from "react";
113
+ import {
114
+ Alert as Alert3,
115
+ AlertCircleIcon,
116
+ Avatar,
117
+ AppWindow,
118
+ BooleanSwitch,
119
+ Button as Button8,
120
+ Checkbox as Checkbox3,
121
+ ChevronDownIcon,
122
+ ChevronsLeftIcon,
123
+ ChevronsRightIcon,
124
+ Chip as Chip7,
125
+ CircleUserIcon,
126
+ CircularProgress,
127
+ cls as cls10,
128
+ ColumnsIcon,
129
+ defaultBorderMixin as defaultBorderMixin5,
130
+ FileIcon,
131
+ FileTextIcon as FileTextIcon2,
132
+ FilterChip as FilterChip2,
133
+ FilterIcon,
134
+ FolderIcon,
135
+ IconButton as IconButton4,
136
+ iconSize as iconSize2,
137
+ KanbanIcon,
138
+ LayoutGridIcon as LayoutGridIcon2,
139
+ ListIcon as ListIcon2,
140
+ LoadingButton,
141
+ LogOutIcon,
142
+ Menu,
143
+ MenuItem,
144
+ MoonIcon,
145
+ MultiSelect,
146
+ MultiSelectItem,
147
+ PanelLeftIcon,
148
+ PencilIcon as PencilIcon2,
149
+ PlusIcon,
150
+ SearchBar as SearchBar4,
151
+ Select as Select5,
152
+ SelectItem as SelectItem5,
153
+ Separator as Separator5,
154
+ SettingsIcon as SettingsIcon2,
155
+ Skeleton as Skeleton6,
156
+ SunIcon,
157
+ SunMoonIcon,
158
+ Tab,
159
+ Table as Table2,
160
+ TableBody as TableBody2,
161
+ TableCell as TableCell2,
162
+ TableHeader as TableHeader2,
163
+ TableRow as TableRow2,
164
+ Tabs,
165
+ TagIcon,
166
+ TextField as TextField2,
167
+ Tooltip as Tooltip3,
168
+ Trash2Icon as Trash2Icon3,
169
+ TypeIcon,
170
+ Typography as Typography12,
171
+ UserIcon
172
+ } from "@rebasepro/ui";
173
+
174
+ // src/components/RebaseLogo.tsx
175
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
176
+ function RebaseLogo({
177
+ width,
178
+ height,
179
+ className,
180
+ style
181
+ }) {
182
+ return /* @__PURE__ */ jsxs2(
183
+ "svg",
184
+ {
185
+ width: width ?? "100%",
186
+ height: height ?? "100%",
187
+ version: "1.1",
188
+ style,
189
+ className,
190
+ viewBox: "112.1405 1079.711 306.058 306.058",
191
+ fill: "none",
192
+ xmlns: "http://www.w3.org/2000/svg",
193
+ children: [
194
+ /* @__PURE__ */ jsx2("path", { fill: "#34b6d9", d: "M237.01 1087.234a56 56 0 0 1 56.07 0l83.819 48.473a56 56 0 0 1 27.965 48.477v97.108a56 56 0 0 1-27.965 48.477l-83.819 48.473a56 56 0 0 1-56.07 0l-83.818-48.473a56 56 0 0 1-27.965-48.477v-97.108a56 56 0 0 1 27.965-48.477Z" }),
195
+ /* @__PURE__ */ jsx2("path", { fill: "#358fd8", d: "M264.64 1286.718c27.352 0 49.525 22.173 49.525 49.526 0 27.352-22.173 49.525-49.525 49.525-27.353 0-49.526-22.173-49.526-49.525Z" }),
196
+ /* @__PURE__ */ jsx2("path", { fill: "#ff9197", d: "M174.941 1131.547c27.352 0 49.526 22.174 49.526 49.526s-22.174 49.526-49.526 49.526-49.526-22.174-49.526-49.526Z" }),
197
+ /* @__PURE__ */ jsx2("path", { fill: "#358fd8", d: "M355.338 1131.547c27.352 0 49.526 22.174 49.526 49.526s-22.174 49.526-49.526 49.526-49.526-22.174-49.526-49.526Z" }),
198
+ /* @__PURE__ */ jsx2("path", { fill: "#fe9197", d: "M125.227 1196.44v-14.661c0-13.35 7.55-20.303 17.99-18.168l56.424 31.13 2.72 1.572 27.643 31.545 35.193 30.52q.173 1.522.229 3.013l-54.046-11.395-28.464-26.045Z" }),
199
+ /* @__PURE__ */ jsx2("path", { fill: "#013afd", d: "M151.207 1328.696c-14.348-8.285-25.98-28.432-25.98-45v-35.214l11.299-.401c.614.866 34.062 48.973 34.606 49.656.394.495 22.156 40.224 34.409 62.328Z" }),
200
+ /* @__PURE__ */ jsx2("path", { fill: "#2c09d1", d: "m211.38 1249.996 30.436 6.417 9.53 9.1-2.926 15.797 16.939 30.08-14.049 6.672-35.072-10.288-33.83-61.32 9.09-.323Z" }),
201
+ /* @__PURE__ */ jsx2("path", { fill: "#2ac1cf", d: "M240.774 1380.37a34 34 0 0 1-1.304-.716l-16.141-9.319-49.383-74.238 29.211 7.839Z" }),
202
+ /* @__PURE__ */ jsx2("path", { fill: "#2c42d0", d: "m173.359 1219.393 9.557 4.558 28.464 26.045-19.883-3.865-12.782.453-31.643-13.936-15.11-11.819Z" }),
203
+ /* @__PURE__ */ jsx2("path", { fill: "#8b66ed", d: "M257.113 1381.863c-4.336 2.13-10.043 1.783-16.34-1.493l-37.616-76.434 13.081 3.838Z" }),
204
+ /* @__PURE__ */ jsx2("path", { fill: "#2c09d1", d: "m145.888 1247.749 7.224-.257 23.615 41.804 11.98 1.728-24.421-43.544-.014-.383 10.725-.38 28.16 57.219-29.211-7.839-7.37-11.08Z" }),
205
+ /* @__PURE__ */ jsx2("path", { fill: "#2ac1cf", d: "M265.451 1311.554v53.1q0 .255-.004.505l-.25-.26-29.148-38.794-6.308-14.37 21.57 6.328 14.048-6.672Z" }),
206
+ /* @__PURE__ */ jsx2("path", { fill: "#fd485f", d: "m223.329 1370.335-17.788-10.27c-12.253-22.104-34.015-61.833-34.41-62.328-.543-.683-33.991-48.79-34.605-49.656l9.362-.332 20.688 37.269Z" }),
207
+ /* @__PURE__ */ jsx2("path", { fill: "#2d42d0", d: "m202.362 1196.313 37.108 21.424c13.11 7.57 23.953 25.043 25.727 40.641l-35.193-30.52Z" }),
208
+ /* @__PURE__ */ jsx2("path", { fill: "#2b0ad1", d: "M265.447 1365.16c-.095 6.58-2.056 11.56-5.304 14.604l-39.936-70.826 9.534 2.797 6.308 14.37 29.148 38.794Z" }),
209
+ /* @__PURE__ */ jsx2("path", { fill: "#fe9196", d: "M125.227 1240.59v-16.4l21.845 8.458 31.643 13.936-35.367 1.255Z" }),
210
+ /* @__PURE__ */ jsx2("path", { fill: "#8b66ed", d: "m174.997 1246.716 7.411-.263 33.83 61.32-13.08-3.837Z" }),
211
+ /* @__PURE__ */ jsx2("path", { fill: "#2cc5d2", d: "m153.112 1247.492 11.16-.395.014.383 24.421 43.544-11.98-1.728Z" }),
212
+ /* @__PURE__ */ jsx2("path", { fill: "#fc4962", d: "M125.227 1224.19v-8.878l30.211-4.464 17.92 8.545-41.396 1.436 15.11 11.82Z" }),
213
+ /* @__PURE__ */ jsx2("path", { fill: "#fe475f", d: "M265.451 1292.508v18.84l-.092.043-16.939-30.08 2.927-15.799.214.206Z" }),
214
+ /* @__PURE__ */ jsx2("path", { fill: "#2d43cd", d: "M125.227 1215.312v-18.871l30.211 14.407Z" }),
215
+ /* @__PURE__ */ jsx2("path", { fill: "#2ac4d1", d: "M260.143 1379.764a12.5 12.5 0 0 1-3.03 2.099l-40.875-74.09 3.969 1.165Z" }),
216
+ /* @__PURE__ */ jsx2("path", { fill: "#fe475f", d: "M265.426 1261.391q.025.677.025 1.346v16.241l-13.89-13.26-.186-.36-.028.154-9.53-9.099Z" }),
217
+ /* @__PURE__ */ jsx2("path", { fill: "#40b6d9", d: "M265.451 1278.978v13.53c-4.95-9.535-12.604-24.31-13.89-26.79Z" }),
218
+ /* @__PURE__ */ jsx2("path", { fill: "#013afd", d: "M125.227 1248.482v-7.892l18.12 7.249Z" }),
219
+ /* @__PURE__ */ jsx2("path", { fill: "#fe9197", d: "M143.217 1163.611c2.517.515 5.203 1.558 7.99 3.168l48.434 27.963Z" }),
220
+ /* @__PURE__ */ jsx2("path", { fill: "#fec404", d: "m251.347 1265.512.028-.154.186.36Z" }),
221
+ /* @__PURE__ */ jsx2("path", { fill: "#ccc", d: "M265.451 1311.347v.207l-.092-.163Z" }),
222
+ /* @__PURE__ */ jsx2("path", { fill: "#2fc7d5", d: "M383.274 1164.17a31 31 0 0 1-3.887 2.64l-2.59 1.495-95.242 18.988-50.727-18.022 25.55-32.892 63.642 26.919-61.075-31.394Z" }),
223
+ /* @__PURE__ */ jsx2("path", { fill: "#320fdd", d: "m215.866 1112.967 18.535-16.15 5.766 32.704 16.212 6.858-25.551 32.892-57.218-19.484Z" }),
224
+ /* @__PURE__ */ jsx2("path", { fill: "#fd4a61", d: "m305.806 1094.328 73.58 42.482c7.16 4.134 10.748 9.55 10.757 14.968l-40.264-5.624-25.491-7.867-33.1-30.491-18.842-4.065Z" }),
225
+ /* @__PURE__ */ jsx2("path", { fill: "#fec504", d: "M388.516 1158.077c-1.145 2.145-2.892 4.205-5.242 6.093l-124.33-32.266 6.47-29.689 25.874 5.58 33.1 30.492Z" }),
226
+ /* @__PURE__ */ jsx2("path", { fill: "#320fdd", d: "m179.744 1183.464-26.935-15.551 18.147-15.813 55.184 23.206-15.732 20.252Z" }),
227
+ /* @__PURE__ */ jsx2("path", { fill: "#33b6d9", d: "m358.403 1178.925-52.998 30.599-44.794-17.995 89.572-18.117Z" }),
228
+ /* @__PURE__ */ jsx2("path", { fill: "#fd4a63", d: "m234.401 1096.817 12.723-11.087 19.395 11.42-7.574 34.754 61.075 31.394-79.853-33.777Z" }),
229
+ /* @__PURE__ */ jsx2("path", { fill: "#fe9197", d: "m152.809 1167.913-1.91-1.103c-10.42-6.016-13.273-14.747-8.558-22.25l56.907-27.791 15.854-3.136Z" }),
230
+ /* @__PURE__ */ jsx2("path", { fill: "#8b69f1", d: "m305.405 1209.524-14.281 8.245c-5.252 3.032-11.697 4.954-18.462 5.767l-43.574-25.631 31.523-6.376Z" }),
231
+ /* @__PURE__ */ jsx2("path", { fill: "#3015d8", d: "M252.294 1080.973c13.06-2.81 28.331-1.183 38.83 4.879l14.682 8.476-33.36 9.403-7.031-1.516 1.104-5.064-19.395-11.42Z" }),
232
+ /* @__PURE__ */ jsx2("path", { fill: "#2c0ace", d: "M239.162 1085.852c3.85-2.223 8.342-3.85 13.132-4.88l-37.192 32.66-15.854 3.137-56.907 27.791c1.777-2.828 4.63-5.482 8.559-7.75Z" }),
233
+ /* @__PURE__ */ jsx2("path", { fill: "#2fc7d5", d: "m229.088 1197.905-8.773 1.774-9.907-4.121 15.732-20.252 37.462 15.618Z" }),
234
+ /* @__PURE__ */ jsx2("path", { fill: "#33b6d9", d: "M272.662 1223.536c-11.721 1.407-24.402-.515-33.5-5.767l-28.093-16.22 18.019-3.644Z" }),
235
+ /* @__PURE__ */ jsx2("path", { fill: "#fe9197", d: "m264.078 1190.828-.476.096-37.462-15.618 4.688-6.035 50.727 18.022ZM170.956 1152.1l2.654-2.313 57.218 19.484-4.688 6.035Z" }),
236
+ /* @__PURE__ */ jsx2("path", { fill: "#30c3d9", d: "M390.143 1151.778c.01 2.125-.533 4.25-1.627 6.3l-38.637-11.924Z" }),
237
+ /* @__PURE__ */ jsx2("path", { fill: "#ff4c60", d: "m211.07 1201.55-31.326-18.086 40.57 16.215Z" }),
238
+ /* @__PURE__ */ jsx2("path", { fill: "#2d08d0", d: "m376.798 1168.305-18.395 10.62-8.22-5.513Z" }),
239
+ /* @__PURE__ */ jsx2("path", { fill: "#2fc7d5", d: "M264.887 1262.737c0-16.568 11.632-36.715 25.98-45l40.425-23.339 11.932 35.4-25.718 46.274-26.284-2.855-1.382.145-1.411-.146-23.542.675Z" }),
240
+ /* @__PURE__ */ jsx2("path", { fill: "#32abd6", d: "M383.486 1164.684c2.376-.909 4.642-1.382 6.752-1.446l-7.859 43.045-.292 5.18 8.911 13.519 5.344-41.78 4.102-15.889c2.942 3.164 4.667 8.084 4.667 14.466v91.585h-1.324c-1.104 3.308-34.555 60.887-34.486 61.007l-21.13 12.2 8.305-32.902-10.115 14.693 10.115-20.342 47.315-78.499-7.45 6.694-15.674 18.243 2.62-89.698.155-.059Z" }),
241
+ /* @__PURE__ */ jsx2("path", { fill: "#2eabd6", d: "m324.54 1360.214-33.672 19.44c-13.695 7.907-24.915 2.15-25.91-12.796l8.385-12.077 47.855-71.354 7.12-26.81 5.119-9.209.57 31.212-13.987 50.442 6.42-5.847-2.408 22.126.459 8.254Z" }),
242
+ /* @__PURE__ */ jsx2("path", { fill: "#8b65f0", d: "M264.959 1366.858a33 33 0 0 1-.072-2.204v-88.582l24.953-2.71 26.235 2.554 1.43.156 10.813-19.454-7.12 26.81-47.855 71.353Z" }),
243
+ /* @__PURE__ */ jsx2("path", { fill: "#fd4861", d: "m378.764 1192.394 3.89-5.923c-1.987-.058-4.42 64.146-4.402 65.055.019.91-5.901 22.365-5.901 22.365l-17.658 29.778-14.983 14.696 9.72-45.149.036-1.115 6.455-7.894Z" }),
244
+ /* @__PURE__ */ jsx2("path", { fill: "#32abd6", d: "m377.832 1167.529.229-.133.703 24.998-22.843 71.813-6.455 7.894.572-17.63-3.443-30.74Z" }),
245
+ /* @__PURE__ */ jsx2("path", { fill: "#8c66ef", d: "m328.775 1297.488.034-.126 20.657-25.261-.036 1.115-9.72 45.15 14.983-14.697-13.8 22.045-16.86 19.627 2.407-22.126-6.42 5.847Z" }),
246
+ /* @__PURE__ */ jsx2("path", { fill: "#2c08d3", d: "m331.292 1194.398 27.203-15.705 5.51 13.714-20.781 37.391Z" }),
247
+ /* @__PURE__ */ jsx2("path", { fill: "#300bd2", d: "m324.491 1353.595-.459-8.254 16.861-19.627 13.8-22.045 17.658-29.778 20.08-31.948 3.91-5.728 7.45-6.694-47.315 78.5-10.115 20.341-21.821 31.852Z" }),
248
+ /* @__PURE__ */ jsx2("path", { fill: "#2c08d3", d: "m333.437 1247.408 13.158-23.676 3.443 30.738-4.056 14.678-14.316 17.914 2.34-8.442Z" }),
249
+ /* @__PURE__ */ jsx2("path", { fill: "#8b68ef", d: "M405.111 1273.364v10.332c0 16.568-11.632 36.715-25.98 45l-9.83 5.675c-.07-.12 33.382-57.7 34.486-61.007Z" }),
250
+ /* @__PURE__ */ jsx2("path", { fill: "#fec504", d: "M390.238 1163.238c4.109-.125 7.625 1.3 10.206 4.075l-4.102 15.89-5.344 41.779-8.91-13.518.291-5.18Z" }),
251
+ /* @__PURE__ */ jsx2("path", { fill: "#300bd2", d: "m348.171 1346.57-23.631 13.644 31.936-46.545Z" }),
252
+ /* @__PURE__ */ jsx2("path", { fill: "#348fd8", d: "M372.35 1273.891s5.921-21.455 5.902-22.365 2.415-65.113 4.402-65.055l-1.987 67.987 15.675-18.243-3.91 5.728Z" }),
253
+ /* @__PURE__ */ jsx2("path", { fill: "#32abd6", d: "m358.495 1178.693 19.337-11.164-13.827 24.878Z" }),
254
+ /* @__PURE__ */ jsx2("path", { fill: "#fd4861", d: "m331.391 1288.05.275-.988 14.316-17.914 4.056-14.678-.572 17.63-20.657 25.262Z" }),
255
+ /* @__PURE__ */ jsx2("path", { fill: "#ccc", fillOpacity: ".579", d: "m378.06 1167.396 1.07-.617a31 31 0 0 1 4.158-2.019l-.634 21.71-3.89 5.924Z" }),
256
+ /* @__PURE__ */ jsx2("path", { fill: "#2fc7d5", d: "M264.887 1276.072v-2.18l23.542-.676 1.411.146Z" }),
257
+ /* @__PURE__ */ jsx2("path", { fill: "#8b65f0", d: "m291.193 1273.502-1.353-.14 1.382-.145 24.853 2.7Z" })
258
+ ]
259
+ }
260
+ );
261
+ }
262
+
263
+ // src/debug/crm-dashboard/CrmDashboardDemo.tsx
264
+ import { useState as useState4, useEffect, useMemo as useMemo3, useCallback as useCallback4 } from "react";
265
+ import {
266
+ Typography as Typography8,
267
+ Button as Button7,
268
+ cls as cls6,
269
+ Card as Card5,
270
+ TextField,
271
+ Select as Select3,
272
+ SelectItem as SelectItem3,
273
+ RefreshCwIcon,
274
+ UserPlus,
275
+ XIcon as XIcon2,
276
+ CheckIcon,
277
+ MailIcon as MailIcon2,
278
+ PhoneIcon,
279
+ CalendarIcon as CalendarIcon2
280
+ } from "@rebasepro/ui";
281
+
282
+ // src/debug/crm-dashboard/DashboardMetrics.tsx
283
+ import {
284
+ Typography as Typography2,
285
+ cls as cls2,
286
+ Card,
287
+ Skeleton,
288
+ UsersIcon,
289
+ DollarSignIcon,
290
+ AlertTriangleIcon,
291
+ TrendingUpIcon
292
+ } from "@rebasepro/ui";
293
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
294
+ function DashboardMetrics({
295
+ loading,
296
+ insights,
297
+ totalInPipeline,
298
+ totalRevenue
299
+ }) {
300
+ return /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6", children: [
301
+ /* @__PURE__ */ jsx3(Card, { className: "p-4", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
302
+ /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500", children: /* @__PURE__ */ jsx3(UsersIcon, { className: "h-4 w-4" }) }),
303
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1 min-w-0", children: [
304
+ /* @__PURE__ */ jsx3(Typography2, { variant: "caption", color: "secondary", className: "uppercase tracking-[0.05em] text-[10px]", children: "In Pipeline" }),
305
+ loading ? /* @__PURE__ */ jsx3(Skeleton, { className: "h-7 w-12 mt-0.5" }) : /* @__PURE__ */ jsx3(Typography2, { variant: "h5", className: "tabular-nums mt-0.5", children: totalInPipeline })
306
+ ] })
307
+ ] }) }),
308
+ /* @__PURE__ */ jsx3(Card, { className: "p-4", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
309
+ /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500", children: /* @__PURE__ */ jsx3(TrendingUpIcon, { className: "h-4 w-4" }) }),
310
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1 min-w-0", children: [
311
+ /* @__PURE__ */ jsx3(Typography2, { variant: "caption", color: "secondary", className: "uppercase tracking-[0.05em] text-[10px]", children: "Active Clients" }),
312
+ loading ? /* @__PURE__ */ jsx3(Skeleton, { className: "h-7 w-12 mt-0.5" }) : /* @__PURE__ */ jsx3(Typography2, { variant: "h5", className: "tabular-nums mt-0.5", children: insights?.activeClients ?? 0 })
313
+ ] })
314
+ ] }) }),
315
+ /* @__PURE__ */ jsx3(Card, { className: "p-4", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
316
+ /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500", children: /* @__PURE__ */ jsx3(DollarSignIcon, { className: "h-4 w-4" }) }),
317
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1 min-w-0", children: [
318
+ /* @__PURE__ */ jsx3(Typography2, { variant: "caption", color: "secondary", className: "uppercase tracking-[0.05em] text-[10px]", children: "Revenue" }),
319
+ loading ? /* @__PURE__ */ jsx3(Skeleton, { className: "h-7 w-20 mt-0.5" }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col sm:flex-row sm:items-baseline gap-1 sm:gap-2 mt-0.5", children: [
320
+ /* @__PURE__ */ jsxs3(Typography2, { variant: "h5", className: "tabular-nums", children: [
321
+ "$",
322
+ totalRevenue.toLocaleString()
323
+ ] }),
324
+ insights && insights.contractedRevenue > 0 && /* @__PURE__ */ jsxs3(Typography2, { variant: "caption", color: "secondary", className: "text-[10px]", children: [
325
+ "($",
326
+ insights.contractedRevenue.toLocaleString(),
327
+ " confirmed)"
328
+ ] })
329
+ ] })
330
+ ] })
331
+ ] }) }),
332
+ /* @__PURE__ */ jsx3(Card, { className: "p-4", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
333
+ /* @__PURE__ */ jsx3("div", { className: cls2(
334
+ "flex items-center justify-center w-5 h-5",
335
+ insights && insights.overdueTaskCount > 0 ? "text-red-500" : "text-surface-400 dark:text-surface-500"
336
+ ), children: /* @__PURE__ */ jsx3(AlertTriangleIcon, { className: "h-4 w-4" }) }),
337
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1 min-w-0", children: [
338
+ /* @__PURE__ */ jsx3(Typography2, { variant: "caption", color: "secondary", className: "uppercase tracking-[0.05em] text-[10px]", children: "Overdue Tasks" }),
339
+ loading ? /* @__PURE__ */ jsx3(Skeleton, { className: "h-7 w-8 mt-0.5" }) : /* @__PURE__ */ jsx3(Typography2, { variant: "h5", className: cls2(
340
+ "tabular-nums mt-0.5",
341
+ insights && insights.overdueTaskCount > 0 && "text-red-600 dark:text-red-400"
342
+ ), children: insights?.overdueTaskCount ?? 0 })
343
+ ] })
344
+ ] }) })
345
+ ] });
346
+ }
347
+
348
+ // src/debug/crm-dashboard/PipelineOverview.tsx
349
+ import React from "react";
350
+ import {
351
+ Typography as Typography3,
352
+ cls as cls3,
353
+ Card as Card2,
354
+ Button as Button2,
355
+ Skeleton as Skeleton2,
356
+ Tooltip,
357
+ Select,
358
+ SelectItem,
359
+ UsersIcon as UsersIcon2,
360
+ ChevronRightIcon,
361
+ SettingsIcon
362
+ } from "@rebasepro/ui";
363
+ import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
364
+ function PipelineOverview({
365
+ loading,
366
+ insights,
367
+ selectedPipelineId,
368
+ onPipelineChange,
369
+ onNavigate,
370
+ sortedStages,
371
+ activeStages,
372
+ closedStages,
373
+ totalInPipeline,
374
+ resolveColor: resolveColor2
375
+ }) {
376
+ const useShortLabels = sortedStages.length > 6;
377
+ const needsScroll = sortedStages.length > 10;
378
+ return /* @__PURE__ */ jsxs4(Card2, { className: "p-4 mb-6", children: [
379
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mb-4", children: [
380
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
381
+ /* @__PURE__ */ jsxs4(Typography3, { variant: "subtitle1", children: [
382
+ "Pipeline",
383
+ !loading && totalInPipeline > 0 ? ` (${totalInPipeline} clients)` : ""
384
+ ] }),
385
+ insights && insights.pipelines.length > 1 && /* @__PURE__ */ jsx4(
386
+ Select,
387
+ {
388
+ value: selectedPipelineId ?? "",
389
+ onValueChange: (v) => onPipelineChange(v),
390
+ size: "smallest",
391
+ renderValue: (v) => {
392
+ const selected = insights.pipelines.find((p) => p.id === v);
393
+ return selected ? selected.name : "Pipeline";
394
+ },
395
+ position: "popper",
396
+ children: insights.pipelines.map((p) => /* @__PURE__ */ jsx4(SelectItem, { value: p.id, children: p.name }, p.id))
397
+ }
398
+ )
399
+ ] }),
400
+ /* @__PURE__ */ jsx4(
401
+ Button2,
402
+ {
403
+ variant: "text",
404
+ size: "small",
405
+ onClick: () => {
406
+ onNavigate("/c/engagements");
407
+ },
408
+ endIcon: /* @__PURE__ */ jsx4(ChevronRightIcon, { className: "h-4 w-4" }),
409
+ children: "View All"
410
+ }
411
+ )
412
+ ] }),
413
+ loading ? /* @__PURE__ */ jsx4(Skeleton2, { className: "h-20 w-full rounded-lg" }) : insights && sortedStages.length === 0 ? (
414
+ /* No stages configured */
415
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center py-8", children: [
416
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 mb-3", children: /* @__PURE__ */ jsx4(SettingsIcon, { className: "h-4 w-4" }) }),
417
+ /* @__PURE__ */ jsx4(Typography3, { variant: "body2", color: "secondary", className: "mb-1", children: "No pipeline stages configured" }),
418
+ /* @__PURE__ */ jsx4(Typography3, { variant: "caption", color: "disabled", className: "mb-4 text-center", children: "Set up your pipeline stages in Settings \u2192 Pipeline Stages" }),
419
+ /* @__PURE__ */ jsx4(
420
+ Button2,
421
+ {
422
+ variant: "outlined",
423
+ size: "small",
424
+ onClick: () => onNavigate("/pipeline-builder"),
425
+ children: "Configure Stages"
426
+ }
427
+ )
428
+ ] })
429
+ ) : insights && totalInPipeline === 0 ? (
430
+ /* No clients in pipeline */
431
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center py-8", children: [
432
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 mb-3", children: /* @__PURE__ */ jsx4(UsersIcon2, { className: "h-4 w-4" }) }),
433
+ /* @__PURE__ */ jsx4(Typography3, { variant: "body2", color: "secondary", className: "mb-1", children: "No clients in pipeline yet" }),
434
+ /* @__PURE__ */ jsx4(Typography3, { variant: "caption", color: "disabled", className: "mb-4", children: "Create your first client to get started." })
435
+ ] })
436
+ ) : insights ? (
437
+ /* Pipeline bar */
438
+ /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
439
+ needsScroll && /* @__PURE__ */ jsxs4(Fragment, { children: [
440
+ /* @__PURE__ */ jsx4("div", { className: "absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-white dark:from-surface-900 to-transparent z-10 pointer-events-none rounded-l-lg" }),
441
+ /* @__PURE__ */ jsx4("div", { className: "absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-white dark:from-surface-900 to-transparent z-10 pointer-events-none rounded-r-lg" })
442
+ ] }),
443
+ /* @__PURE__ */ jsxs4("div", { className: cls3(
444
+ "flex items-stretch gap-0",
445
+ needsScroll && "overflow-x-auto"
446
+ ), children: [
447
+ activeStages.map((stage, idx) => {
448
+ const isEmpty = stage.count === 0;
449
+ const widthPercent = totalInPipeline > 0 ? Math.max(8, stage.count / totalInPipeline * 100) : 100 / Math.max(activeStages.length, 1);
450
+ const stageColor = resolveColor2(stage.color);
451
+ const displayLabel = useShortLabels ? stage.shortLabel : stage.label;
452
+ return /* @__PURE__ */ jsxs4(React.Fragment, { children: [
453
+ idx > 0 && /* @__PURE__ */ jsx4("div", { className: "flex items-center shrink-0 text-surface-300 dark:text-surface-600 -mx-0.5", children: /* @__PURE__ */ jsx4(ChevronRightIcon, { className: "h-4 w-4" }) }),
454
+ /* @__PURE__ */ jsx4(Tooltip, { title: `${stage.label} \u2014 ${stage.count} client${stage.count !== 1 ? "s" : ""}`, children: /* @__PURE__ */ jsxs4(
455
+ "div",
456
+ {
457
+ className: cls3(
458
+ "flex flex-col items-center justify-center rounded-lg px-3 py-3 min-w-[72px] transition-colors duration-150 cursor-pointer",
459
+ "hover:bg-surface-accent-100 dark:hover:bg-surface-800",
460
+ isEmpty ? "bg-surface-50 dark:bg-surface-900/20" : "bg-surface-100/50 dark:bg-surface-900/60"
461
+ ),
462
+ style: { flex: `${widthPercent} 1 0%` },
463
+ onClick: () => onNavigate(`/c/engagements?stage=${stage.stageKey}`),
464
+ children: [
465
+ /* @__PURE__ */ jsx4(
466
+ Typography3,
467
+ {
468
+ variant: "h6",
469
+ className: cls3(
470
+ "tabular-nums leading-none font-semibold",
471
+ isEmpty && "opacity-25"
472
+ ),
473
+ children: stage.count
474
+ }
475
+ ),
476
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5 mt-1.5", children: [
477
+ /* @__PURE__ */ jsx4(
478
+ "span",
479
+ {
480
+ className: "w-1.5 h-1.5 rounded-full shrink-0",
481
+ style: {
482
+ backgroundColor: stageColor,
483
+ opacity: isEmpty ? 0.25 : 1
484
+ }
485
+ }
486
+ ),
487
+ /* @__PURE__ */ jsx4(
488
+ Typography3,
489
+ {
490
+ variant: "caption",
491
+ color: "secondary",
492
+ className: cls3(
493
+ "whitespace-nowrap text-[11px]",
494
+ isEmpty && "opacity-35"
495
+ ),
496
+ children: displayLabel
497
+ }
498
+ )
499
+ ] })
500
+ ]
501
+ }
502
+ ) })
503
+ ] }, stage.stageKey);
504
+ }),
505
+ activeStages.length > 0 && closedStages.length > 0 && /* @__PURE__ */ jsx4("div", { className: "flex items-center shrink-0 mx-2", children: /* @__PURE__ */ jsx4("div", { className: "w-px h-8 bg-surface-200 dark:bg-surface-700" }) }),
506
+ closedStages.map((stage, idx) => {
507
+ const isEmpty = stage.count === 0;
508
+ const stageColor = resolveColor2(stage.color);
509
+ const displayLabel = useShortLabels ? stage.shortLabel : stage.label;
510
+ return /* @__PURE__ */ jsxs4(React.Fragment, { children: [
511
+ idx > 0 && /* @__PURE__ */ jsx4("div", { className: "flex items-center shrink-0 text-surface-300 dark:text-surface-600 -mx-0.5", children: /* @__PURE__ */ jsx4(ChevronRightIcon, { className: "h-4 w-4" }) }),
512
+ /* @__PURE__ */ jsx4(Tooltip, { title: `${stage.label} \u2014 ${stage.count} client${stage.count !== 1 ? "s" : ""}`, children: /* @__PURE__ */ jsxs4(
513
+ "div",
514
+ {
515
+ className: cls3(
516
+ "flex flex-col items-center justify-center rounded-lg px-3 py-3 min-w-[72px] transition-colors duration-150 cursor-pointer",
517
+ "hover:bg-surface-accent-100 dark:hover:bg-surface-800",
518
+ "opacity-60",
519
+ isEmpty ? "bg-surface-50 dark:bg-surface-900/10" : "bg-surface-100/30 dark:bg-surface-900/30"
520
+ ),
521
+ style: { flex: "0 0 auto" },
522
+ onClick: () => onNavigate(`/c/engagements?stage=${stage.stageKey}`),
523
+ children: [
524
+ /* @__PURE__ */ jsx4(
525
+ Typography3,
526
+ {
527
+ variant: "h6",
528
+ className: cls3(
529
+ "tabular-nums leading-none font-semibold",
530
+ isEmpty && "opacity-25"
531
+ ),
532
+ children: stage.count
533
+ }
534
+ ),
535
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5 mt-1.5", children: [
536
+ /* @__PURE__ */ jsx4(
537
+ "span",
538
+ {
539
+ className: "w-1.5 h-1.5 rounded-full shrink-0",
540
+ style: {
541
+ backgroundColor: stageColor,
542
+ opacity: isEmpty ? 0.25 : 1
543
+ }
544
+ }
545
+ ),
546
+ /* @__PURE__ */ jsx4(
547
+ Typography3,
548
+ {
549
+ variant: "caption",
550
+ color: "secondary",
551
+ className: cls3(
552
+ "whitespace-nowrap text-[11px]",
553
+ isEmpty && "opacity-35"
554
+ ),
555
+ children: displayLabel
556
+ }
557
+ )
558
+ ] })
559
+ ]
560
+ }
561
+ ) })
562
+ ] }, stage.stageKey);
563
+ })
564
+ ] })
565
+ ] })
566
+ ) : null
567
+ ] });
568
+ }
569
+
570
+ // src/debug/crm-dashboard/RecentActivity.tsx
571
+ import React2 from "react";
572
+ import {
573
+ Typography as Typography4,
574
+ Card as Card3,
575
+ Skeleton as Skeleton3,
576
+ Separator as Separator2,
577
+ Dialog,
578
+ DialogTitle,
579
+ DialogContent,
580
+ DialogActions,
581
+ Button as Button3,
582
+ CircleDotIcon,
583
+ ArrowRightLeftIcon,
584
+ MailIcon,
585
+ FileTextIcon,
586
+ PenLineIcon,
587
+ VideoIcon,
588
+ MessageCircleIcon,
589
+ StickyNoteIcon,
590
+ ListPlusIcon,
591
+ CheckCircle2Icon,
592
+ WrenchIcon,
593
+ PinIcon
594
+ } from "@rebasepro/ui";
595
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
596
+ var ACTIVITY_ICONS = {
597
+ incoming: /* @__PURE__ */ jsx5(CircleDotIcon, { className: "h-4 w-4 text-blue-500" }),
598
+ status_changed: /* @__PURE__ */ jsx5(ArrowRightLeftIcon, { className: "h-4 w-4 text-violet-500" }),
599
+ email_sent: /* @__PURE__ */ jsx5(MailIcon, { className: "h-4 w-4 text-sky-500" }),
600
+ agreements_sent: /* @__PURE__ */ jsx5(FileTextIcon, { className: "h-4 w-4 text-amber-500" }),
601
+ agreements_signed: /* @__PURE__ */ jsx5(PenLineIcon, { className: "h-4 w-4 text-emerald-500" }),
602
+ zoom_setup: /* @__PURE__ */ jsx5(VideoIcon, { className: "h-4 w-4 text-blue-600" }),
603
+ whatsapp_setup: /* @__PURE__ */ jsx5(MessageCircleIcon, { className: "h-4 w-4 text-green-500" }),
604
+ note: /* @__PURE__ */ jsx5(StickyNoteIcon, { className: "h-4 w-4 text-yellow-500" }),
605
+ task_created: /* @__PURE__ */ jsx5(ListPlusIcon, { className: "h-4 w-4 text-teal-500" }),
606
+ task_completed: /* @__PURE__ */ jsx5(CheckCircle2Icon, { className: "h-4 w-4 text-emerald-500" }),
607
+ manual_action: /* @__PURE__ */ jsx5(WrenchIcon, { className: "h-4 w-4 text-orange-500" })
608
+ };
609
+ function relativeTime(dateStr) {
610
+ const now = Date.now();
611
+ const then = new Date(dateStr).getTime();
612
+ const diffSec = Math.round((now - then) / 1e3);
613
+ if (diffSec < 60) return "just now";
614
+ const diffMin = Math.floor(diffSec / 60);
615
+ if (diffMin < 60) return `${diffMin}m ago`;
616
+ const diffHr = Math.floor(diffMin / 60);
617
+ if (diffHr < 24) return `${diffHr}h ago`;
618
+ const diffDay = Math.floor(diffHr / 24);
619
+ if (diffDay < 7) return `${diffDay}d ago`;
620
+ return new Date(dateStr).toLocaleDateString("en-US", { month: "short", day: "numeric" });
621
+ }
622
+ function RecentActivity({
623
+ activities,
624
+ activitiesLoading,
625
+ tasksMap,
626
+ onCompleteTask,
627
+ onViewEmail,
628
+ onOpenTask,
629
+ emailViewerOpen,
630
+ onEmailViewerOpenChange,
631
+ selectedEmail
632
+ }) {
633
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
634
+ /* @__PURE__ */ jsxs5(Card3, { className: "p-4 flex-1", children: [
635
+ /* @__PURE__ */ jsx5(Typography4, { variant: "subtitle1", className: "mb-3", children: "Recent Activity" }),
636
+ activitiesLoading ? /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-3", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
637
+ /* @__PURE__ */ jsx5(Skeleton3, { className: "h-5 w-5 rounded-full shrink-0" }),
638
+ /* @__PURE__ */ jsx5(Skeleton3, { className: "h-4 flex-1" })
639
+ ] }, i)) }) : activities.length === 0 ? /* @__PURE__ */ jsx5("div", { className: "flex flex-col items-center py-6", children: /* @__PURE__ */ jsx5(Typography4, { variant: "body2", color: "secondary", children: "No recent activity" }) }) : /* @__PURE__ */ jsx5("div", { className: "flex flex-col", children: activities.map((activity, idx) => {
640
+ const actType = activity.values?.type;
641
+ const taskId = activity.values?.metadata?.taskId;
642
+ const relatedTask = taskId ? tasksMap.get(taskId) : null;
643
+ const isTaskActivity = actType === "task_created" || actType === "task_completed";
644
+ const isEmailActivity = actType === "email_sent";
645
+ return /* @__PURE__ */ jsxs5(React2.Fragment, { children: [
646
+ idx > 0 && /* @__PURE__ */ jsx5(Separator2, { orientation: "horizontal", className: "my-0" }),
647
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-2.5 py-2.5", children: [
648
+ /* @__PURE__ */ jsx5("span", { className: "shrink-0 mt-0.5 flex items-center", children: ACTIVITY_ICONS[actType] ?? /* @__PURE__ */ jsx5(PinIcon, { className: "h-4 w-4 text-surface-400 dark:text-surface-500" }) }),
649
+ /* @__PURE__ */ jsxs5("div", { className: "flex-1 min-w-0", children: [
650
+ /* @__PURE__ */ jsx5(Typography4, { variant: "body2", className: "truncate leading-snug", children: activity.values?.description || actType || "Activity" }),
651
+ activity.values?.createdAt && /* @__PURE__ */ jsx5(Typography4, { variant: "caption", color: "secondary", className: "text-[10px]", children: relativeTime(activity.values.createdAt) }),
652
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 mt-1 flex-wrap", children: [
653
+ isTaskActivity && relatedTask && relatedTask.values?.status !== "completed" && /* @__PURE__ */ jsx5(
654
+ Button3,
655
+ {
656
+ variant: "text",
657
+ size: "small",
658
+ color: "primary",
659
+ className: "text-emerald-600 dark:text-emerald-400 font-medium hover:underline p-0 h-auto min-w-0",
660
+ onClick: () => onCompleteTask(activity),
661
+ children: "Complete Task"
662
+ }
663
+ ),
664
+ isEmailActivity && /* @__PURE__ */ jsx5(
665
+ Button3,
666
+ {
667
+ variant: "text",
668
+ size: "small",
669
+ color: "primary",
670
+ className: "font-medium hover:underline p-0 h-auto min-w-0",
671
+ onClick: () => onViewEmail(activity),
672
+ children: "View Sent Email"
673
+ }
674
+ ),
675
+ isTaskActivity && taskId && /* @__PURE__ */ jsx5(
676
+ Button3,
677
+ {
678
+ variant: "text",
679
+ size: "small",
680
+ color: "neutral",
681
+ className: "font-medium hover:underline p-0 h-auto min-w-0 text-surface-500 hover:text-surface-700 dark:text-surface-400 dark:hover:text-surface-300",
682
+ onClick: () => onOpenTask(activity),
683
+ children: "Open Task"
684
+ }
685
+ )
686
+ ] })
687
+ ] })
688
+ ] })
689
+ ] }, activity.id);
690
+ }) })
691
+ ] }),
692
+ /* @__PURE__ */ jsxs5(
693
+ Dialog,
694
+ {
695
+ open: emailViewerOpen,
696
+ onOpenChange: onEmailViewerOpenChange,
697
+ maxWidth: "xl",
698
+ children: [
699
+ /* @__PURE__ */ jsx5(DialogTitle, { children: selectedEmail?.subject || "Email" }),
700
+ /* @__PURE__ */ jsx5(DialogContent, { children: selectedEmail && /* @__PURE__ */ jsxs5("div", { className: "space-y-3", children: [
701
+ /* @__PURE__ */ jsxs5(Typography4, { variant: "caption", color: "secondary", children: [
702
+ "To: ",
703
+ selectedEmail.to
704
+ ] }),
705
+ selectedEmail.html ? /* @__PURE__ */ jsx5(
706
+ "div",
707
+ {
708
+ className: "prose prose-sm dark:prose-invert max-w-none text-text-primary dark:text-text-primary-dark",
709
+ dangerouslySetInnerHTML: { __html: selectedEmail.html }
710
+ }
711
+ ) : /* @__PURE__ */ jsx5(Typography4, { variant: "body2", className: "whitespace-pre-wrap", children: selectedEmail.body }),
712
+ selectedEmail.mode === "simulated" && /* @__PURE__ */ jsx5(Typography4, { variant: "caption", color: "secondary", className: "italic mt-2 block", children: "Simulated \u2014 email was not actually sent." })
713
+ ] }) }),
714
+ /* @__PURE__ */ jsx5(DialogActions, { children: /* @__PURE__ */ jsx5(Button3, { variant: "text", onClick: () => onEmailViewerOpenChange(false), children: "Close" }) })
715
+ ]
716
+ }
717
+ )
718
+ ] });
719
+ }
720
+
721
+ // src/debug/crm-dashboard/TasksView.tsx
722
+ import { useState as useState2, useMemo, useCallback as useCallback2 } from "react";
723
+
724
+ // src/debug/crm-dashboard/TaskFilters.tsx
725
+ import {
726
+ Chip,
727
+ FilterChip,
728
+ SearchBar,
729
+ Select as Select2,
730
+ SelectItem as SelectItem2,
731
+ Typography as Typography5,
732
+ Button as Button4,
733
+ AlertTriangleIcon as AlertTriangleIcon2,
734
+ ListTodoIcon,
735
+ XIcon
736
+ } from "@rebasepro/ui";
737
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
738
+ function TaskFilters({
739
+ quickFilter,
740
+ onQuickFilterChange,
741
+ stageFilter,
742
+ onStageFilterChange,
743
+ clientFilter,
744
+ onClientFilterChange,
745
+ searchText,
746
+ onSearchTextChange,
747
+ hasActiveFilter,
748
+ onClearAllFilters,
749
+ overdueTasks,
750
+ pendingTasks,
751
+ stageLabels: stageLabels2,
752
+ stageFilterOrder,
753
+ stageCounts,
754
+ activeClientIds,
755
+ clientsMap
756
+ }) {
757
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
758
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between mb-2", children: [
759
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
760
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500", children: /* @__PURE__ */ jsx6(ListTodoIcon, { className: "h-4 w-4" }) }),
761
+ /* @__PURE__ */ jsx6(Typography5, { variant: "subtitle1", children: "Tasks" }),
762
+ pendingTasks.length > 0 && /* @__PURE__ */ jsxs6(Chip, { size: "smallest", colorScheme: "blue", children: [
763
+ pendingTasks.length,
764
+ hasActiveFilter ? " shown" : " pending"
765
+ ] })
766
+ ] }),
767
+ overdueTasks.length > 0 && /* @__PURE__ */ jsxs6(Chip, { size: "smallest", colorScheme: "red", children: [
768
+ overdueTasks.length,
769
+ " overdue"
770
+ ] })
771
+ ] }),
772
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2 mb-3", children: [
773
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
774
+ /* @__PURE__ */ jsx6(
775
+ FilterChip,
776
+ {
777
+ active: quickFilter === "all" && !stageFilter && !clientFilter,
778
+ onClick: () => {
779
+ onQuickFilterChange("all");
780
+ onStageFilterChange(null);
781
+ onClientFilterChange(null);
782
+ },
783
+ size: "small",
784
+ children: "All"
785
+ }
786
+ ),
787
+ /* @__PURE__ */ jsxs6(
788
+ FilterChip,
789
+ {
790
+ active: quickFilter === "overdue",
791
+ onClick: () => {
792
+ onQuickFilterChange(quickFilter === "overdue" ? "all" : "overdue");
793
+ },
794
+ size: "small",
795
+ icon: /* @__PURE__ */ jsx6(AlertTriangleIcon2, { className: "h-3 w-3" }),
796
+ children: [
797
+ "Overdue",
798
+ overdueTasks.length > 0 ? ` (${overdueTasks.length})` : ""
799
+ ]
800
+ }
801
+ ),
802
+ hasActiveFilter && /* @__PURE__ */ jsx6(
803
+ Button4,
804
+ {
805
+ variant: "text",
806
+ size: "small",
807
+ color: "neutral",
808
+ className: "p-0 h-auto min-w-0 text-xs text-text-secondary dark:text-text-secondary-dark hover:text-primary dark:hover:text-primary-light",
809
+ onClick: onClearAllFilters,
810
+ startIcon: /* @__PURE__ */ jsx6(XIcon, { className: "h-3 w-3" }),
811
+ children: "Clear"
812
+ }
813
+ )
814
+ ] }),
815
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
816
+ /* @__PURE__ */ jsx6("div", { className: "flex-1", children: /* @__PURE__ */ jsx6(
817
+ SearchBar,
818
+ {
819
+ onTextSearch: (v) => {
820
+ onSearchTextChange(v || "");
821
+ },
822
+ placeholder: "Search tasks...",
823
+ size: "smallest",
824
+ className: "w-full"
825
+ }
826
+ ) }),
827
+ /* @__PURE__ */ jsxs6(
828
+ Select2,
829
+ {
830
+ value: stageFilter || "__all__",
831
+ onValueChange: (v) => {
832
+ onStageFilterChange(v === "__all__" ? null : v);
833
+ },
834
+ placeholder: "Stage",
835
+ size: "smallest",
836
+ renderValue: (v) => {
837
+ if (!v || v === "__all__") return "Stage";
838
+ return stageLabels2[v] || "Stage";
839
+ },
840
+ position: "popper",
841
+ children: [
842
+ /* @__PURE__ */ jsx6(SelectItem2, { value: "__all__", children: "All stages" }),
843
+ stageFilterOrder.filter((stageId) => stageCounts[stageId] > 0).map((stageId) => /* @__PURE__ */ jsxs6(SelectItem2, { value: stageId, children: [
844
+ stageLabels2[stageId] || stageId,
845
+ stageCounts[stageId] > 0 ? ` (${stageCounts[stageId]})` : ""
846
+ ] }, stageId))
847
+ ]
848
+ }
849
+ ),
850
+ activeClientIds.length > 1 && /* @__PURE__ */ jsxs6(
851
+ Select2,
852
+ {
853
+ value: clientFilter || "__all__",
854
+ onValueChange: (v) => {
855
+ onClientFilterChange(v === "__all__" ? null : v);
856
+ },
857
+ placeholder: "All clients",
858
+ size: "smallest",
859
+ renderValue: (v) => {
860
+ if (!v || v === "__all__") return "Client";
861
+ const info = clientsMap.get(v);
862
+ return info?.name || "Client";
863
+ },
864
+ position: "popper",
865
+ children: [
866
+ /* @__PURE__ */ jsx6(SelectItem2, { value: "__all__", children: "All clients" }),
867
+ activeClientIds.map((cId) => {
868
+ const info = clientsMap.get(cId);
869
+ if (!info) return null;
870
+ return /* @__PURE__ */ jsx6(SelectItem2, { value: cId, children: info.name }, cId);
871
+ })
872
+ ]
873
+ }
874
+ )
875
+ ] })
876
+ ] })
877
+ ] });
878
+ }
879
+
880
+ // src/debug/crm-dashboard/TaskTable.tsx
881
+ import { useState, useCallback } from "react";
882
+ import {
883
+ Typography as Typography6,
884
+ cls as cls4,
885
+ Card as Card4,
886
+ Chip as Chip2,
887
+ Skeleton as Skeleton4,
888
+ Checkbox,
889
+ Button as Button5,
890
+ CalendarIcon,
891
+ AlertTriangleIcon as AlertTriangleIcon3,
892
+ CheckCircle2Icon as CheckCircle2Icon2
893
+ } from "@rebasepro/ui";
894
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
895
+ var resolutionDisplay = {
896
+ verified: { label: "Verified", colorScheme: "green" },
897
+ needs_followup: { label: "Needs Follow-up", colorScheme: "amber" },
898
+ suitable: { label: "Suitable", colorScheme: "green" },
899
+ not_a_fit: { label: "Not a Fit", colorScheme: "red" },
900
+ response_received: { label: "Response Received", colorScheme: "green" },
901
+ followup_sent: { label: "Follow-up Sent", colorScheme: "blue" },
902
+ prepared: { label: "Prepared", colorScheme: "green" },
903
+ invite_sent: { label: "Invite Sent", colorScheme: "green" },
904
+ agreement_ready: { label: "Agreement Ready", colorScheme: "green" },
905
+ signed: { label: "Signed", colorScheme: "green" },
906
+ reminder_sent: { label: "Reminder Sent", colorScheme: "blue" },
907
+ payment_confirmed: { label: "Payment Confirmed", colorScheme: "green" },
908
+ not_yet_received: { label: "Not Yet Received", colorScheme: "amber" },
909
+ sent: { label: "Sent", colorScheme: "green" },
910
+ confirmed: { label: "Confirmed", colorScheme: "green" },
911
+ not_yet: { label: "Not Yet", colorScheme: "amber" },
912
+ scheduled: { label: "Scheduled", colorScheme: "green" },
913
+ feedback_received: { label: "Feedback Received", colorScheme: "green" },
914
+ awaiting_response: { label: "Awaiting Response", colorScheme: "amber" },
915
+ archived: { label: "Archived", colorScheme: "green" },
916
+ done: { label: "Done", colorScheme: "green" }
917
+ };
918
+ function formatDueDate(dateStr) {
919
+ if (!dateStr) return null;
920
+ const d = new Date(dateStr);
921
+ if (isNaN(d.getTime())) return null;
922
+ const now = /* @__PURE__ */ new Date();
923
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
924
+ const target = new Date(d.getFullYear(), d.getMonth(), d.getDate());
925
+ const diffMs = target.getTime() - today.getTime();
926
+ const diffDays = Math.round(diffMs / (1e3 * 60 * 60 * 24));
927
+ if (diffDays === 0) return "Today";
928
+ if (diffDays === 1) return "Tomorrow";
929
+ if (diffDays === -1) return "Yesterday";
930
+ if (diffDays < 0) return `${Math.abs(diffDays)}d overdue`;
931
+ if (diffDays <= 7) return `In ${diffDays}d`;
932
+ return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
933
+ }
934
+ function isDueDateOverdue(dateStr) {
935
+ if (!dateStr) return false;
936
+ const d = new Date(dateStr);
937
+ if (isNaN(d.getTime())) return false;
938
+ const now = /* @__PURE__ */ new Date();
939
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
940
+ return d < today;
941
+ }
942
+ function isDueDateSoon(dateStr) {
943
+ if (!dateStr) return false;
944
+ const d = new Date(dateStr);
945
+ if (isNaN(d.getTime())) return false;
946
+ const now = /* @__PURE__ */ new Date();
947
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
948
+ const diffMs = d.getTime() - today.getTime();
949
+ const diffDays = Math.round(diffMs / (1e3 * 60 * 60 * 24));
950
+ return diffDays >= 0 && diffDays <= 2;
951
+ }
952
+ function TaskTable({
953
+ tasks,
954
+ loading,
955
+ pendingTasks,
956
+ visiblePendingTasks,
957
+ hasMorePending,
958
+ onLoadMorePending,
959
+ pendingCount,
960
+ togglingIds,
961
+ onToggleTask,
962
+ onOpenTask,
963
+ onOpenClient,
964
+ clientsMap,
965
+ stageLabels: stageLabels2,
966
+ recentlyToggledIds,
967
+ completedTasks,
968
+ completedLoaded,
969
+ loadingCompleted,
970
+ completedHasMore,
971
+ onExpandCompleted,
972
+ onLoadMoreCompleted
973
+ }) {
974
+ const renderTaskRow = useCallback((task) => {
975
+ const isCompleted = task.values?.status === "completed";
976
+ const isToggling = togglingIds.has(task.id);
977
+ const dueLabel = formatDueDate(task.values?.dueDate);
978
+ const overdue = !isCompleted && isDueDateOverdue(task.values?.dueDate);
979
+ const soon = !isCompleted && isDueDateSoon(task.values?.dueDate);
980
+ const stageName = task.values?.stageId ? stageLabels2[task.values.stageId] : null;
981
+ const clientInfo = task.values?.clientId ? clientsMap.get(task.values.clientId) : null;
982
+ const clientName = clientInfo?.name || null;
983
+ return /* @__PURE__ */ jsxs7(
984
+ "div",
985
+ {
986
+ className: cls4(
987
+ "group flex items-start gap-3 py-2.5 px-3 rounded-md transition-colors duration-150 cursor-pointer",
988
+ "hover:bg-surface-accent-100 dark:hover:bg-surface-800",
989
+ isCompleted && "opacity-60",
990
+ overdue && "border-l-2 border-l-red-500 rounded-l-none",
991
+ soon && !overdue && "border-l-2 border-l-amber-450 rounded-l-none"
992
+ ),
993
+ onClick: () => onOpenTask(task.id),
994
+ children: [
995
+ /* @__PURE__ */ jsx7(
996
+ "div",
997
+ {
998
+ className: "pt-0.5 shrink-0",
999
+ onClick: (e) => e.stopPropagation(),
1000
+ children: /* @__PURE__ */ jsx7(
1001
+ Checkbox,
1002
+ {
1003
+ checked: isCompleted,
1004
+ size: "small",
1005
+ onCheckedChange: () => {
1006
+ if (!isToggling) onToggleTask(task.id, task.values?.status);
1007
+ }
1008
+ }
1009
+ )
1010
+ }
1011
+ ),
1012
+ /* @__PURE__ */ jsxs7("div", { className: "flex-1 min-w-0", children: [
1013
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
1014
+ /* @__PURE__ */ jsx7(
1015
+ Typography6,
1016
+ {
1017
+ variant: "body2",
1018
+ className: cls4(
1019
+ "leading-snug",
1020
+ isCompleted && "line-through text-text-disabled dark:text-text-disabled-dark"
1021
+ ),
1022
+ children: task.values?.title || "Untitled Task"
1023
+ }
1024
+ ),
1025
+ task.values?.priority === "high" && /* @__PURE__ */ jsx7(Chip2, { colorScheme: "red", size: "smallest", children: "High" })
1026
+ ] }),
1027
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 mt-1 flex-wrap", children: [
1028
+ dueLabel && /* @__PURE__ */ jsxs7("span", { className: cls4(
1029
+ "inline-flex items-center gap-1 text-[11px]",
1030
+ overdue && "text-red-600 dark:text-red-400 font-medium",
1031
+ soon && !overdue && "text-amber-600 dark:text-amber-400 font-medium",
1032
+ !overdue && !soon && "text-text-secondary dark:text-text-secondary-dark"
1033
+ ), children: [
1034
+ overdue ? /* @__PURE__ */ jsx7(AlertTriangleIcon3, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx7(CalendarIcon, { className: "h-3 w-3" }),
1035
+ dueLabel
1036
+ ] }),
1037
+ clientName && task.values?.clientId && /* @__PURE__ */ jsxs7(
1038
+ Typography6,
1039
+ {
1040
+ variant: "body2",
1041
+ className: cls4(
1042
+ "inline-flex items-center gap-1 text-primary hover:text-primary-dark",
1043
+ "dark:text-primary-light dark:hover:text-primary",
1044
+ "hover:underline cursor-pointer text-[11px]"
1045
+ ),
1046
+ onClick: (e) => {
1047
+ e.stopPropagation();
1048
+ onOpenClient(task.values.clientId);
1049
+ },
1050
+ children: [
1051
+ (() => {
1052
+ const clientPic = clientInfo?.picture;
1053
+ const clientInitial = (clientName || "?")[0].toUpperCase();
1054
+ return clientPic ? /* @__PURE__ */ jsx7("img", { src: clientPic, alt: "", className: "w-4 h-4 rounded-full object-cover shrink-0" }) : /* @__PURE__ */ jsx7("div", { className: "w-4 h-4 rounded-full bg-surface-200 dark:bg-surface-700 text-surface-500 dark:text-surface-400 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx7("span", { className: "text-[9px] font-semibold", children: clientInitial }) });
1055
+ })(),
1056
+ clientName
1057
+ ]
1058
+ }
1059
+ ),
1060
+ stageName && /* @__PURE__ */ jsx7(Chip2, { size: "smallest", colorScheme: "cyan", outlined: true, children: stageName }),
1061
+ isCompleted && task.values?.resolution && resolutionDisplay[task.values.resolution] && /* @__PURE__ */ jsx7(
1062
+ Chip2,
1063
+ {
1064
+ size: "smallest",
1065
+ colorScheme: resolutionDisplay[task.values.resolution].colorScheme,
1066
+ children: resolutionDisplay[task.values.resolution].label
1067
+ }
1068
+ )
1069
+ ] })
1070
+ ] })
1071
+ ]
1072
+ },
1073
+ task.id
1074
+ );
1075
+ }, [togglingIds, onToggleTask, onOpenTask, onOpenClient, clientsMap, recentlyToggledIds, stageLabels2]);
1076
+ if (loading) {
1077
+ return /* @__PURE__ */ jsx7("div", { className: "flex flex-col gap-3", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3 py-2 px-3", children: [
1078
+ /* @__PURE__ */ jsx7(Skeleton4, { width: 18, height: 18 }),
1079
+ /* @__PURE__ */ jsxs7("div", { className: "flex-1 space-y-1", children: [
1080
+ /* @__PURE__ */ jsx7(Skeleton4, { width: 200, height: 16 }),
1081
+ /* @__PURE__ */ jsx7(Skeleton4, { width: 120, height: 12 })
1082
+ ] })
1083
+ ] }, i)) });
1084
+ }
1085
+ return /* @__PURE__ */ jsx7("div", { className: "flex-1 overflow-y-auto", children: tasks.length === 0 ? /* @__PURE__ */ jsxs7(Card4, { className: "flex flex-col items-center justify-center py-10 px-6 text-center mt-2 border-dashed", children: [
1086
+ /* @__PURE__ */ jsx7("div", { className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 mb-3", children: /* @__PURE__ */ jsx7(CheckCircle2Icon2, { className: "h-4 w-4" }) }),
1087
+ /* @__PURE__ */ jsx7(Typography6, { variant: "subtitle2", className: "mb-1", children: "All clear!" }),
1088
+ /* @__PURE__ */ jsx7(Typography6, { variant: "body2", color: "secondary", children: "No tasks at the moment. New tasks will show up here automatically." })
1089
+ ] }) : /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
1090
+ pendingTasks.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "space-y-0.5", children: [
1091
+ visiblePendingTasks.map(renderTaskRow),
1092
+ hasMorePending && /* @__PURE__ */ jsx7("div", { className: "pt-2", children: /* @__PURE__ */ jsxs7(
1093
+ Button5,
1094
+ {
1095
+ variant: "text",
1096
+ size: "small",
1097
+ color: "primary",
1098
+ className: "w-full justify-center",
1099
+ onClick: onLoadMorePending,
1100
+ children: [
1101
+ "Load more (",
1102
+ pendingCount - visiblePendingTasks.length,
1103
+ " remaining)"
1104
+ ]
1105
+ }
1106
+ ) })
1107
+ ] }),
1108
+ /* @__PURE__ */ jsx7(
1109
+ CompletedSection,
1110
+ {
1111
+ tasks: completedTasks,
1112
+ renderTaskRow,
1113
+ onExpand: onExpandCompleted,
1114
+ onLoadMore: onLoadMoreCompleted,
1115
+ loading: loadingCompleted,
1116
+ hasMore: completedHasMore
1117
+ }
1118
+ )
1119
+ ] }) });
1120
+ }
1121
+ function CompletedSection({
1122
+ tasks,
1123
+ renderTaskRow,
1124
+ onExpand,
1125
+ onLoadMore,
1126
+ loading,
1127
+ hasMore
1128
+ }) {
1129
+ const [expanded, setExpanded] = useState(false);
1130
+ const handleToggle = () => {
1131
+ const willExpand = !expanded;
1132
+ setExpanded(willExpand);
1133
+ if (willExpand) onExpand();
1134
+ };
1135
+ return /* @__PURE__ */ jsxs7("div", { children: [
1136
+ /* @__PURE__ */ jsx7(
1137
+ Button5,
1138
+ {
1139
+ variant: "text",
1140
+ size: "small",
1141
+ color: "neutral",
1142
+ className: "w-full justify-between hover:bg-surface-accent-100 dark:hover:bg-surface-800 px-3 py-1.5 h-auto text-left",
1143
+ onClick: handleToggle,
1144
+ endIcon: /* @__PURE__ */ jsx7(
1145
+ "svg",
1146
+ {
1147
+ className: cls4(
1148
+ "h-3 w-3 text-text-secondary dark:text-text-secondary-dark transition-transform duration-150",
1149
+ expanded && "rotate-90"
1150
+ ),
1151
+ viewBox: "0 0 24 24",
1152
+ fill: "none",
1153
+ stroke: "currentColor",
1154
+ strokeWidth: 2,
1155
+ strokeLinecap: "round",
1156
+ strokeLinejoin: "round",
1157
+ children: /* @__PURE__ */ jsx7("polyline", { points: "9 18 15 12 9 6" })
1158
+ }
1159
+ ),
1160
+ children: /* @__PURE__ */ jsxs7(
1161
+ Typography6,
1162
+ {
1163
+ variant: "caption",
1164
+ color: "secondary",
1165
+ className: "font-semibold uppercase tracking-wider text-[10px]",
1166
+ children: [
1167
+ "Completed",
1168
+ tasks.length > 0 ? ` (${tasks.length}${hasMore ? "+" : ""})` : ""
1169
+ ]
1170
+ }
1171
+ )
1172
+ }
1173
+ ),
1174
+ expanded && /* @__PURE__ */ jsx7("div", { className: "mt-1 space-y-0.5", children: loading && tasks.length === 0 ? /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 px-3 py-3", children: [
1175
+ /* @__PURE__ */ jsx7(Skeleton4, { width: 18, height: 18 }),
1176
+ /* @__PURE__ */ jsx7(Skeleton4, { width: 200, height: 16 })
1177
+ ] }) : /* @__PURE__ */ jsxs7(Fragment4, { children: [
1178
+ tasks.map(renderTaskRow),
1179
+ hasMore && /* @__PURE__ */ jsx7("div", { className: "pt-2", children: /* @__PURE__ */ jsx7(
1180
+ Button5,
1181
+ {
1182
+ variant: "text",
1183
+ size: "small",
1184
+ color: "primary",
1185
+ className: "w-full justify-center",
1186
+ onClick: onLoadMore,
1187
+ disabled: loading,
1188
+ children: loading ? "Loading..." : "Load more completed"
1189
+ }
1190
+ ) })
1191
+ ] }) })
1192
+ ] });
1193
+ }
1194
+
1195
+ // src/debug/crm-dashboard/TasksView.tsx
1196
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1197
+ var PENDING_PAGE_SIZE = 50;
1198
+ function isDueDateOverdue2(dateStr) {
1199
+ if (!dateStr) return false;
1200
+ const d = new Date(dateStr);
1201
+ if (isNaN(d.getTime())) return false;
1202
+ const now = /* @__PURE__ */ new Date();
1203
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
1204
+ return d < today;
1205
+ }
1206
+ function TasksView({
1207
+ loading,
1208
+ tasks,
1209
+ togglingIds,
1210
+ onToggleTask,
1211
+ onOpenTask,
1212
+ onOpenClient,
1213
+ clientsMap,
1214
+ pipelineStages,
1215
+ recentlyToggledIds,
1216
+ completedTasks,
1217
+ completedLoaded,
1218
+ loadingCompleted,
1219
+ completedHasMore,
1220
+ onExpandCompleted,
1221
+ onLoadMoreCompleted
1222
+ }) {
1223
+ const stageLabels2 = useMemo(
1224
+ () => Object.fromEntries(
1225
+ pipelineStages.map((s) => [s.values?.stageKey, s.values?.label])
1226
+ ),
1227
+ [pipelineStages]
1228
+ );
1229
+ const stageFilterOrder = useMemo(
1230
+ () => pipelineStages.map((s) => s.values?.stageKey).filter(Boolean),
1231
+ [pipelineStages]
1232
+ );
1233
+ const [quickFilter, setQuickFilter] = useState2("all");
1234
+ const [stageFilter, setStageFilter] = useState2(null);
1235
+ const [clientFilter, setClientFilter] = useState2(null);
1236
+ const [searchText, setSearchText] = useState2("");
1237
+ const [visiblePendingCount, setVisiblePendingCount] = useState2(PENDING_PAGE_SIZE);
1238
+ const overdueTasks = useMemo(
1239
+ () => tasks.filter(
1240
+ (t) => t.values?.status === "pending" && !recentlyToggledIds.has(t.id) && isDueDateOverdue2(t.values?.dueDate)
1241
+ ),
1242
+ [tasks, recentlyToggledIds]
1243
+ );
1244
+ const activeClientIds = useMemo(() => {
1245
+ const ids = /* @__PURE__ */ new Set();
1246
+ tasks.forEach((t) => {
1247
+ if (t.values?.clientId) ids.add(t.values.clientId);
1248
+ });
1249
+ return Array.from(ids).sort((a, b) => {
1250
+ const na = clientsMap.get(a)?.name || "";
1251
+ const nb = clientsMap.get(b)?.name || "";
1252
+ return na.localeCompare(nb);
1253
+ });
1254
+ }, [tasks, clientsMap]);
1255
+ const stageCounts = useMemo(() => {
1256
+ const counts = {};
1257
+ tasks.forEach((t) => {
1258
+ if (t.values?.status === "pending" && t.values?.stageId) {
1259
+ counts[t.values.stageId] = (counts[t.values.stageId] || 0) + 1;
1260
+ }
1261
+ });
1262
+ return counts;
1263
+ }, [tasks]);
1264
+ const filteredPendingTasks = useMemo(() => {
1265
+ let filtered = tasks.filter(
1266
+ (t) => t.values?.status === "pending" || t.values?.status === "completed" && recentlyToggledIds.has(t.id)
1267
+ );
1268
+ if (quickFilter === "overdue") {
1269
+ filtered = filtered.filter(
1270
+ (t) => isDueDateOverdue2(t.values?.dueDate) || recentlyToggledIds.has(t.id)
1271
+ );
1272
+ }
1273
+ if (stageFilter) {
1274
+ filtered = filtered.filter(
1275
+ (t) => t.values?.stageId === stageFilter || recentlyToggledIds.has(t.id)
1276
+ );
1277
+ }
1278
+ if (clientFilter) {
1279
+ filtered = filtered.filter(
1280
+ (t) => t.values?.clientId === clientFilter || recentlyToggledIds.has(t.id)
1281
+ );
1282
+ }
1283
+ if (searchText.trim()) {
1284
+ const q = searchText.trim().toLowerCase();
1285
+ filtered = filtered.filter((t) => {
1286
+ const title = (t.values?.title || "").toLowerCase();
1287
+ const desc = (t.values?.description || "").toLowerCase();
1288
+ const clientName = t.values?.clientId ? (clientsMap.get(t.values.clientId)?.name || "").toLowerCase() : "";
1289
+ return title.includes(q) || desc.includes(q) || clientName.includes(q);
1290
+ });
1291
+ }
1292
+ return filtered;
1293
+ }, [tasks, recentlyToggledIds, quickFilter, stageFilter, clientFilter, searchText, clientsMap]);
1294
+ const visiblePendingTasks = useMemo(
1295
+ () => filteredPendingTasks.slice(0, visiblePendingCount),
1296
+ [filteredPendingTasks, visiblePendingCount]
1297
+ );
1298
+ const hasMorePending = filteredPendingTasks.length > visiblePendingCount;
1299
+ const pendingCount = filteredPendingTasks.length;
1300
+ const handleClearAllFilters = useCallback2(() => {
1301
+ setQuickFilter("all");
1302
+ setStageFilter(null);
1303
+ setClientFilter(null);
1304
+ setSearchText("");
1305
+ }, []);
1306
+ const hasActiveFilter = quickFilter !== "all" || stageFilter !== null || clientFilter !== null || searchText !== "";
1307
+ return /* @__PURE__ */ jsx8("div", { className: "flex flex-col h-full bg-white dark:bg-surface-900", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-4 overflow-y-auto flex-1", children: [
1308
+ /* @__PURE__ */ jsx8(
1309
+ TaskFilters,
1310
+ {
1311
+ quickFilter,
1312
+ onQuickFilterChange: setQuickFilter,
1313
+ stageFilter,
1314
+ onStageFilterChange: setStageFilter,
1315
+ clientFilter,
1316
+ onClientFilterChange: setClientFilter,
1317
+ searchText,
1318
+ onSearchTextChange: setSearchText,
1319
+ hasActiveFilter,
1320
+ onClearAllFilters: handleClearAllFilters,
1321
+ overdueTasks,
1322
+ pendingTasks: tasks.filter((t) => t.values?.status === "pending" && !recentlyToggledIds.has(t.id)),
1323
+ stageLabels: stageLabels2,
1324
+ stageFilterOrder,
1325
+ stageCounts,
1326
+ activeClientIds,
1327
+ clientsMap
1328
+ }
1329
+ ),
1330
+ /* @__PURE__ */ jsx8(
1331
+ TaskTable,
1332
+ {
1333
+ tasks,
1334
+ loading,
1335
+ pendingTasks: filteredPendingTasks,
1336
+ visiblePendingTasks,
1337
+ hasMorePending,
1338
+ onLoadMorePending: () => setVisiblePendingCount((prev) => prev + PENDING_PAGE_SIZE),
1339
+ pendingCount,
1340
+ togglingIds,
1341
+ onToggleTask,
1342
+ onOpenTask,
1343
+ onOpenClient,
1344
+ clientsMap,
1345
+ stageLabels: stageLabels2,
1346
+ recentlyToggledIds,
1347
+ completedTasks,
1348
+ completedLoaded,
1349
+ loadingCompleted,
1350
+ completedHasMore,
1351
+ onExpandCompleted,
1352
+ onLoadMoreCompleted
1353
+ }
1354
+ )
1355
+ ] }) });
1356
+ }
1357
+
1358
+ // src/debug/crm-dashboard/CalendarWidget.tsx
1359
+ import { useState as useState3, useMemo as useMemo2, useCallback as useCallback3 } from "react";
1360
+ import {
1361
+ Typography as Typography7,
1362
+ cls as cls5,
1363
+ Chip as Chip3,
1364
+ Skeleton as Skeleton5,
1365
+ IconButton as IconButton2,
1366
+ Separator as Separator3,
1367
+ Button as Button6,
1368
+ ChevronLeftIcon,
1369
+ ChevronRightIcon as ChevronRightIcon2
1370
+ } from "@rebasepro/ui";
1371
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1372
+ function startOfMonth(date) {
1373
+ return new Date(date.getFullYear(), date.getMonth(), 1);
1374
+ }
1375
+ function endOfMonth(date) {
1376
+ return new Date(date.getFullYear(), date.getMonth() + 1, 0);
1377
+ }
1378
+ function isSameDay(a, b) {
1379
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
1380
+ }
1381
+ function toDateKey(date) {
1382
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
1383
+ }
1384
+ function isBeforeToday(date) {
1385
+ const today = /* @__PURE__ */ new Date();
1386
+ today.setHours(0, 0, 0, 0);
1387
+ const d = new Date(date);
1388
+ d.setHours(0, 0, 0, 0);
1389
+ return d < today;
1390
+ }
1391
+ var stageLabels = {
1392
+ incoming: "Incoming",
1393
+ email_sent: "Intro Email",
1394
+ discovery_call: "Discovery",
1395
+ agreements: "Agreements",
1396
+ onboarding: "Onboarding",
1397
+ active: "Active",
1398
+ delivered: "Delivered",
1399
+ completed: "Done"
1400
+ };
1401
+ function buildCalendarGrid(viewDate) {
1402
+ const today = /* @__PURE__ */ new Date();
1403
+ const first = startOfMonth(viewDate);
1404
+ const last = endOfMonth(viewDate);
1405
+ let startDay = first.getDay() - 1;
1406
+ if (startDay < 0) startDay = 6;
1407
+ const days = [];
1408
+ for (let i = startDay - 1; i >= 0; i--) {
1409
+ const d = new Date(first);
1410
+ d.setDate(d.getDate() - (i + 1));
1411
+ days.push({
1412
+ date: d,
1413
+ isCurrentMonth: false,
1414
+ isToday: isSameDay(d, today),
1415
+ dateKey: toDateKey(d)
1416
+ });
1417
+ }
1418
+ for (let d = 1; d <= last.getDate(); d++) {
1419
+ const date = new Date(viewDate.getFullYear(), viewDate.getMonth(), d);
1420
+ days.push({
1421
+ date,
1422
+ isCurrentMonth: true,
1423
+ isToday: isSameDay(date, today),
1424
+ dateKey: toDateKey(date)
1425
+ });
1426
+ }
1427
+ while (days.length % 7 !== 0) {
1428
+ const d = new Date(last);
1429
+ d.setDate(d.getDate() + (days.length - (startDay + last.getDate())) + 1);
1430
+ days.push({
1431
+ date: d,
1432
+ isCurrentMonth: false,
1433
+ isToday: isSameDay(d, today),
1434
+ dateKey: toDateKey(d)
1435
+ });
1436
+ }
1437
+ return days;
1438
+ }
1439
+ var DAY_HEADERS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
1440
+ var MONTH_NAMES = [
1441
+ "January",
1442
+ "February",
1443
+ "March",
1444
+ "April",
1445
+ "May",
1446
+ "June",
1447
+ "July",
1448
+ "August",
1449
+ "September",
1450
+ "October",
1451
+ "November",
1452
+ "December"
1453
+ ];
1454
+ function CalendarWidget({ loading, tasks, onOpenTask }) {
1455
+ const [viewDate, setViewDate] = useState3(() => /* @__PURE__ */ new Date());
1456
+ const [selectedDay, setSelectedDay] = useState3(null);
1457
+ const tasksByDate = useMemo2(() => {
1458
+ const map = /* @__PURE__ */ new Map();
1459
+ for (const task of tasks) {
1460
+ if (!task.values?.dueDate) continue;
1461
+ const d = new Date(task.values.dueDate);
1462
+ const key = toDateKey(d);
1463
+ if (!map.has(key)) map.set(key, []);
1464
+ map.get(key).push(task);
1465
+ }
1466
+ return map;
1467
+ }, [tasks]);
1468
+ const calendarDays = useMemo2(() => buildCalendarGrid(viewDate), [viewDate]);
1469
+ const goToPrevMonth = useCallback3(() => {
1470
+ setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() - 1, 1));
1471
+ setSelectedDay(null);
1472
+ }, []);
1473
+ const goToNextMonth = useCallback3(() => {
1474
+ setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() + 1, 1));
1475
+ setSelectedDay(null);
1476
+ }, []);
1477
+ const goToToday = useCallback3(() => {
1478
+ const today = /* @__PURE__ */ new Date();
1479
+ setViewDate(new Date(today.getFullYear(), today.getMonth(), 1));
1480
+ setSelectedDay(toDateKey(today));
1481
+ }, []);
1482
+ const selectedDayTasks = useMemo2(() => {
1483
+ if (!selectedDay) return [];
1484
+ return tasksByDate.get(selectedDay) || [];
1485
+ }, [selectedDay, tasksByDate]);
1486
+ return /* @__PURE__ */ jsxs9("div", { children: [
1487
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between mb-3", children: [
1488
+ /* @__PURE__ */ jsx9(Typography7, { variant: "subtitle1", children: "Calendar" }),
1489
+ /* @__PURE__ */ jsx9(
1490
+ Button6,
1491
+ {
1492
+ variant: "text",
1493
+ size: "small",
1494
+ color: "primary",
1495
+ className: "p-0 h-auto min-w-0",
1496
+ onClick: goToToday,
1497
+ children: "Today"
1498
+ }
1499
+ )
1500
+ ] }),
1501
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between mb-2", children: [
1502
+ /* @__PURE__ */ jsx9(
1503
+ IconButton2,
1504
+ {
1505
+ size: "smallest",
1506
+ "aria-label": "Previous month",
1507
+ onClick: goToPrevMonth,
1508
+ children: /* @__PURE__ */ jsx9(ChevronLeftIcon, { className: "h-4 w-4" })
1509
+ }
1510
+ ),
1511
+ /* @__PURE__ */ jsxs9(Typography7, { variant: "body2", className: "font-semibold", children: [
1512
+ MONTH_NAMES[viewDate.getMonth()],
1513
+ " ",
1514
+ viewDate.getFullYear()
1515
+ ] }),
1516
+ /* @__PURE__ */ jsx9(
1517
+ IconButton2,
1518
+ {
1519
+ size: "smallest",
1520
+ "aria-label": "Next month",
1521
+ onClick: goToNextMonth,
1522
+ children: /* @__PURE__ */ jsx9(ChevronRightIcon2, { className: "h-4 w-4" })
1523
+ }
1524
+ )
1525
+ ] }),
1526
+ loading ? /* @__PURE__ */ jsx9(Skeleton5, { className: "h-48 w-full rounded-lg" }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
1527
+ /* @__PURE__ */ jsx9("div", { className: "grid grid-cols-7 mb-1", children: DAY_HEADERS.map((d) => /* @__PURE__ */ jsx9("div", { className: "text-center py-1", children: /* @__PURE__ */ jsx9(Typography7, { variant: "caption", color: "secondary", className: "text-[10px] font-semibold uppercase tracking-wider", children: d }) }, d)) }),
1528
+ /* @__PURE__ */ jsx9("div", { className: "grid grid-cols-7 gap-0.5", children: calendarDays.map((day) => {
1529
+ const dayTasks = tasksByDate.get(day.dateKey) || [];
1530
+ const hasTasks = dayTasks.length > 0;
1531
+ const isSelected = selectedDay === day.dateKey;
1532
+ const pendingCount = dayTasks.filter((t) => t.values.status === "pending").length;
1533
+ const completedCount = dayTasks.filter((t) => t.values.status === "completed").length;
1534
+ const hasOverdue = dayTasks.some(
1535
+ (t) => t.values.status === "pending" && isBeforeToday(new Date(t.values.dueDate))
1536
+ );
1537
+ return /* @__PURE__ */ jsxs9(
1538
+ "button",
1539
+ {
1540
+ onClick: () => setSelectedDay(isSelected ? null : day.dateKey),
1541
+ className: cls5(
1542
+ "flex flex-col items-center justify-center py-1.5 rounded-md transition-colors duration-100 focus:outline-none",
1543
+ day.isCurrentMonth ? "text-text-primary dark:text-text-primary-dark" : "text-surface-300 dark:text-surface-650",
1544
+ day.isToday && !isSelected && "ring-1 ring-primary/50",
1545
+ isSelected ? "bg-primary/10 dark:bg-primary/15 ring-1 ring-primary/60" : "hover:bg-surface-100 dark:hover:bg-surface-800",
1546
+ hasTasks && "cursor-pointer"
1547
+ ),
1548
+ children: [
1549
+ /* @__PURE__ */ jsx9(
1550
+ Typography7,
1551
+ {
1552
+ variant: "caption",
1553
+ color: "inherit",
1554
+ className: cls5(
1555
+ "leading-none tabular-nums text-[11px]",
1556
+ day.isToday && "font-semibold text-primary dark:text-primary-light"
1557
+ ),
1558
+ children: day.date.getDate()
1559
+ }
1560
+ ),
1561
+ hasTasks ? /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-0.5 mt-1 h-[5px]", children: [
1562
+ hasOverdue && /* @__PURE__ */ jsx9("span", { className: "w-[5px] h-[5px] rounded-full bg-red-500" }),
1563
+ pendingCount > 0 && !hasOverdue && /* @__PURE__ */ jsx9("span", { className: "w-[5px] h-[5px] rounded-full bg-primary" }),
1564
+ completedCount > 0 && /* @__PURE__ */ jsx9("span", { className: "w-[5px] h-[5px] rounded-full bg-emerald-500" })
1565
+ ] }) : /* @__PURE__ */ jsx9("div", { className: "h-[5px] mt-1" })
1566
+ ]
1567
+ },
1568
+ day.dateKey
1569
+ );
1570
+ }) }),
1571
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3 mt-3 mb-1 px-1", children: [
1572
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1573
+ /* @__PURE__ */ jsx9("span", { className: "w-[5px] h-[5px] rounded-full bg-primary" }),
1574
+ /* @__PURE__ */ jsx9(Typography7, { variant: "caption", color: "secondary", className: "text-[10px]", children: "Pending" })
1575
+ ] }),
1576
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1577
+ /* @__PURE__ */ jsx9("span", { className: "w-[5px] h-[5px] rounded-full bg-red-500" }),
1578
+ /* @__PURE__ */ jsx9(Typography7, { variant: "caption", color: "secondary", className: "text-[10px]", children: "Overdue" })
1579
+ ] }),
1580
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1581
+ /* @__PURE__ */ jsx9("span", { className: "w-[5px] h-[5px] rounded-full bg-emerald-500" }),
1582
+ /* @__PURE__ */ jsx9(Typography7, { variant: "caption", color: "secondary", className: "text-[10px]", children: "Done" })
1583
+ ] })
1584
+ ] }),
1585
+ selectedDay && /* @__PURE__ */ jsxs9("div", { className: "mt-2", children: [
1586
+ /* @__PURE__ */ jsx9(Separator3, { orientation: "horizontal", className: "mb-2" }),
1587
+ selectedDayTasks.length === 0 ? /* @__PURE__ */ jsx9("div", { className: "py-3 text-center", children: /* @__PURE__ */ jsx9(Typography7, { variant: "caption", color: "secondary", children: "No tasks on this day" }) }) : /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-0.5", children: [
1588
+ /* @__PURE__ */ jsxs9(Typography7, { variant: "caption", color: "secondary", className: "mb-1 px-1", children: [
1589
+ selectedDayTasks.length,
1590
+ " task",
1591
+ selectedDayTasks.length !== 1 ? "s" : "",
1592
+ " \u2014 ",
1593
+ (/* @__PURE__ */ new Date(selectedDay + "T00:00:00")).toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" })
1594
+ ] }),
1595
+ selectedDayTasks.map((task) => {
1596
+ const isPending = task.values.status === "pending";
1597
+ const isOverdue = isPending && isBeforeToday(new Date(task.values.dueDate));
1598
+ return /* @__PURE__ */ jsxs9(
1599
+ "button",
1600
+ {
1601
+ onClick: () => onOpenTask(task.id),
1602
+ className: cls5(
1603
+ "flex items-start gap-2 px-2 py-1.5 rounded-md text-left w-full",
1604
+ "hover:bg-surface-100 dark:hover:bg-surface-800 transition-colors duration-100 focus:outline-none"
1605
+ ),
1606
+ children: [
1607
+ /* @__PURE__ */ jsx9(
1608
+ "span",
1609
+ {
1610
+ className: cls5(
1611
+ "w-1.5 h-1.5 rounded-full mt-1.5 shrink-0",
1612
+ isOverdue ? "bg-red-500" : isPending ? "bg-primary" : "bg-emerald-500"
1613
+ )
1614
+ }
1615
+ ),
1616
+ /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
1617
+ /* @__PURE__ */ jsx9(Typography7, { variant: "body2", className: "truncate leading-snug", children: task.values.title }),
1618
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
1619
+ task.values.client?.name && /* @__PURE__ */ jsx9(Typography7, { variant: "caption", color: "secondary", className: "truncate text-[10px]", children: task.values.client.name }),
1620
+ task.values.stageId && /* @__PURE__ */ jsx9(Typography7, { variant: "caption", color: "disabled", className: "truncate text-[10px]", children: stageLabels[task.values.stageId] || task.values.stageId })
1621
+ ] })
1622
+ ] }),
1623
+ task.values.priority === "high" && /* @__PURE__ */ jsx9(Chip3, { colorScheme: "red", size: "smallest", children: "High" })
1624
+ ]
1625
+ },
1626
+ task.id
1627
+ );
1628
+ })
1629
+ ] })
1630
+ ] })
1631
+ ] })
1632
+ ] });
1633
+ }
1634
+
1635
+ // src/debug/crm-dashboard/CrmDashboardDemo.tsx
1636
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1637
+ var COLOR_MAP = {
1638
+ blue: "#3b82f6",
1639
+ indigo: "#6366f1",
1640
+ purple: "#8b5cf6",
1641
+ yellow: "#eab308",
1642
+ teal: "#14b8a6",
1643
+ green: "#22c55e",
1644
+ orange: "#f97316",
1645
+ gray: "#6b7280",
1646
+ red: "#ef4444",
1647
+ pink: "#ec4899",
1648
+ sky: "#0ea5e9",
1649
+ amber: "#f59e0b"
1650
+ };
1651
+ function resolveColor(colorName) {
1652
+ return COLOR_MAP[colorName] ?? COLOR_MAP.gray;
1653
+ }
1654
+ var STAGE_LABELS = {
1655
+ incoming: "Incoming",
1656
+ email_sent: "Intro Email",
1657
+ discovery_call: "Discovery",
1658
+ agreements: "Agreements",
1659
+ onboarding: "Onboarding",
1660
+ active: "Active",
1661
+ delivered: "Delivered",
1662
+ completed: "Done"
1663
+ };
1664
+ var PIPELINES = [
1665
+ { id: "main", name: "Main Sales Pipeline", isDefault: true, color: "blue" },
1666
+ { id: "partnerships", name: "Partnerships Funnel", isDefault: false, color: "indigo" }
1667
+ ];
1668
+ var INITIAL_STAGES = {
1669
+ main: [
1670
+ { stageKey: "incoming", label: "Incoming", shortLabel: "Inbound", color: "blue", icon: "inbox", sortOrder: 1, isTerminal: false, isLostStage: false },
1671
+ { stageKey: "email_sent", label: "Intro Email", shortLabel: "Intro", color: "indigo", icon: "mail", sortOrder: 2, isTerminal: false, isLostStage: false },
1672
+ { stageKey: "discovery_call", label: "Discovery", shortLabel: "Disco", color: "purple", icon: "phone", sortOrder: 3, isTerminal: false, isLostStage: false },
1673
+ { stageKey: "agreements", label: "Agreements", shortLabel: "Contracts", color: "yellow", icon: "file-text", sortOrder: 4, isTerminal: false, isLostStage: false },
1674
+ { stageKey: "onboarding", label: "Onboarding", shortLabel: "Onboard", color: "teal", icon: "user-check", sortOrder: 5, isTerminal: false, isLostStage: false },
1675
+ { stageKey: "active", label: "Active", shortLabel: "Active", color: "green", icon: "activity", sortOrder: 6, isTerminal: false, isLostStage: false },
1676
+ { stageKey: "delivered", label: "Delivered", shortLabel: "Done", color: "orange", icon: "check-circle", sortOrder: 7, isTerminal: true, isLostStage: false },
1677
+ { stageKey: "completed", label: "Done", shortLabel: "Closed", color: "red", icon: "archive", sortOrder: 8, isTerminal: true, isLostStage: true }
1678
+ ],
1679
+ partnerships: [
1680
+ { stageKey: "incoming", label: "Outreach", shortLabel: "Outbound", color: "blue", icon: "send", sortOrder: 1, isTerminal: false, isLostStage: false },
1681
+ { stageKey: "discovery_call", label: "First Meeting", shortLabel: "Meet", color: "purple", icon: "users", sortOrder: 2, isTerminal: false, isLostStage: false },
1682
+ { stageKey: "agreements", label: "Proposal", shortLabel: "Prop", color: "yellow", icon: "file", sortOrder: 3, isTerminal: false, isLostStage: false },
1683
+ { stageKey: "active", label: "Partnered", shortLabel: "Live", color: "green", icon: "handshake", sortOrder: 4, isTerminal: true, isLostStage: false }
1684
+ ]
1685
+ };
1686
+ var INITIAL_CLIENTS = [
1687
+ { id: "client-1", name: "Alice Johnson", email: "alice@johnson.com", phone: "+1 (555) 0192", stage: "discovery_call" },
1688
+ { id: "client-2", name: "Bob Smith", email: "bob@smith.co", phone: "+1 (555) 0143", stage: "email_sent" },
1689
+ { id: "client-3", name: "Carol White", email: "carol@whitecorp.com", phone: "+1 (555) 0188", stage: "agreements" },
1690
+ { id: "client-4", name: "David Brown", email: "david.b@brown.net", phone: "+1 (555) 0177", stage: "onboarding" },
1691
+ { id: "client-5", name: "Eva Green", email: "eva@greenllc.com", phone: "+1 (555) 0165", stage: "active" },
1692
+ { id: "client-6", name: "Frank Miller", email: "frank@miller.org", phone: "+1 (555) 0112", stage: "completed" }
1693
+ ];
1694
+ var INITIAL_TASKS = [
1695
+ {
1696
+ id: "task-1",
1697
+ values: {
1698
+ title: "Schedule discovery call",
1699
+ status: "pending",
1700
+ resolution: null,
1701
+ dueDate: new Date(Date.now() + 864e5).toISOString().split("T")[0],
1702
+ stageId: "discovery_call",
1703
+ clientId: "client-1",
1704
+ priority: "high",
1705
+ description: "Set up a 30-min Zoom call to discuss requirements and partnership scope.",
1706
+ notes: "Alice is in EST timezone, prefers morning slots.",
1707
+ createdAt: new Date(Date.now() - 1728e5).toISOString()
1708
+ }
1709
+ },
1710
+ {
1711
+ id: "task-2",
1712
+ values: {
1713
+ title: "Draft partnership agreement",
1714
+ status: "pending",
1715
+ resolution: null,
1716
+ dueDate: new Date(Date.now() - 1728e5).toISOString().split("T")[0],
1717
+ // overdue
1718
+ stageId: "agreements",
1719
+ clientId: "client-3",
1720
+ priority: "high",
1721
+ description: "Draft enterprise contract incorporating customized SLA definitions.",
1722
+ notes: "Carol requested special uptime guarantees in Appendix A.",
1723
+ createdAt: new Date(Date.now() - 3456e5).toISOString()
1724
+ }
1725
+ },
1726
+ {
1727
+ id: "task-3",
1728
+ values: {
1729
+ title: "Send onboarding checklist",
1730
+ status: "pending",
1731
+ resolution: null,
1732
+ dueDate: new Date(Date.now() + 1728e5).toISOString().split("T")[0],
1733
+ stageId: "onboarding",
1734
+ clientId: "client-4",
1735
+ priority: "medium",
1736
+ description: "Assemble welcome packet, Slack community invite link, and environment setup guidelines.",
1737
+ notes: "Must carbon copy David's CTO on all setup emails.",
1738
+ createdAt: new Date(Date.now() - 864e5).toISOString()
1739
+ }
1740
+ },
1741
+ {
1742
+ id: "task-4",
1743
+ values: {
1744
+ title: "Follow up on intro email",
1745
+ status: "pending",
1746
+ resolution: null,
1747
+ dueDate: new Date(Date.now() - 864e5).toISOString().split("T")[0],
1748
+ // overdue
1749
+ stageId: "email_sent",
1750
+ clientId: "client-2",
1751
+ priority: "medium",
1752
+ description: "Check if Bob had time to review the technical proposal sent last week.",
1753
+ notes: "Call if no email response by Friday.",
1754
+ createdAt: new Date(Date.now() - 2592e5).toISOString()
1755
+ }
1756
+ },
1757
+ {
1758
+ id: "task-5",
1759
+ values: {
1760
+ title: "Review deliverables and request feedback",
1761
+ status: "pending",
1762
+ resolution: null,
1763
+ dueDate: new Date(Date.now() + 432e6).toISOString().split("T")[0],
1764
+ stageId: "active",
1765
+ clientId: "client-5",
1766
+ priority: "low",
1767
+ description: "Schedule final demo review, submit deliverables reports, and email feedback questionnaire.",
1768
+ notes: "",
1769
+ createdAt: new Date(Date.now() - 864e5).toISOString()
1770
+ }
1771
+ }
1772
+ ];
1773
+ var INITIAL_COMPLETED_TASKS = [
1774
+ {
1775
+ id: "task-comp-1",
1776
+ values: {
1777
+ title: "Review inbound request form",
1778
+ status: "completed",
1779
+ resolution: "verified",
1780
+ dueDate: new Date(Date.now() - 2592e5).toISOString().split("T")[0],
1781
+ stageId: "incoming",
1782
+ clientId: "client-1",
1783
+ priority: "medium",
1784
+ description: "Analyze initial request details submitted via web form.",
1785
+ notes: "",
1786
+ createdAt: new Date(Date.now() - 3456e5).toISOString()
1787
+ }
1788
+ },
1789
+ {
1790
+ id: "task-comp-2",
1791
+ values: {
1792
+ title: "Send pricing brochure",
1793
+ status: "completed",
1794
+ resolution: "sent",
1795
+ dueDate: new Date(Date.now() - 1728e5).toISOString().split("T")[0],
1796
+ stageId: "email_sent",
1797
+ clientId: "client-2",
1798
+ priority: "medium",
1799
+ description: "Send standard PDF booklet outlining custom packages and service tiers.",
1800
+ notes: "",
1801
+ createdAt: new Date(Date.now() - 2592e5).toISOString()
1802
+ }
1803
+ }
1804
+ ];
1805
+ var INITIAL_ACTIVITIES = [
1806
+ {
1807
+ id: "act-1",
1808
+ values: {
1809
+ type: "email_sent",
1810
+ description: "Intro Email sent to Bob Smith",
1811
+ createdAt: new Date(Date.now() - 36e5).toISOString(),
1812
+ metadata: {
1813
+ subject: "Welcome to Rebase \u2014 Pricing Tiers & Guidelines",
1814
+ body: "Hi Bob,\n\nThanks for your interest in Rebase! I have attached our standard pricing sheet and product documentation for your review.\n\nLet's schedule a brief 15-minute call next week to answer any questions you might have.\n\nBest regards,\nFrancesco",
1815
+ to: "bob@smith.co",
1816
+ mode: "simulated"
1817
+ }
1818
+ }
1819
+ },
1820
+ {
1821
+ id: "act-2",
1822
+ values: {
1823
+ type: "agreements_sent",
1824
+ description: "Agreements sent to Carol White",
1825
+ createdAt: new Date(Date.now() - 144e5).toISOString(),
1826
+ metadata: {
1827
+ taskId: "task-2",
1828
+ taskTitle: "Draft partnership agreement"
1829
+ }
1830
+ }
1831
+ },
1832
+ {
1833
+ id: "act-3",
1834
+ values: {
1835
+ type: "incoming",
1836
+ description: "Incoming lead Alice Johnson created",
1837
+ createdAt: new Date(Date.now() - 864e5).toISOString()
1838
+ }
1839
+ },
1840
+ {
1841
+ id: "act-4",
1842
+ values: {
1843
+ type: "note",
1844
+ description: "Added a note for David Brown: 'Prefers Slack for communications'",
1845
+ createdAt: new Date(Date.now() - 1728e5).toISOString()
1846
+ }
1847
+ }
1848
+ ];
1849
+ function getGreeting() {
1850
+ const hour = (/* @__PURE__ */ new Date()).getHours();
1851
+ if (hour < 12) return "Good morning";
1852
+ if (hour < 18) return "Good afternoon";
1853
+ return "Good evening";
1854
+ }
1855
+ function getFormattedDate() {
1856
+ return (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
1857
+ weekday: "long",
1858
+ month: "long",
1859
+ day: "numeric"
1860
+ });
1861
+ }
1862
+ function CrmDashboardDemo() {
1863
+ const [loading, setLoading] = useState4(true);
1864
+ const [activitiesLoading, setActivitiesLoading] = useState4(true);
1865
+ const [clients, setClients] = useState4(INITIAL_CLIENTS);
1866
+ const [tasks, setTasks] = useState4(INITIAL_TASKS);
1867
+ const [completedTasks, setCompletedTasks] = useState4(INITIAL_COMPLETED_TASKS);
1868
+ const [activities, setActivities] = useState4(INITIAL_ACTIVITIES);
1869
+ const [selectedPipelineId, setSelectedPipelineId] = useState4("main");
1870
+ const [toastMessage, setToastMessage] = useState4(null);
1871
+ const [activeSideEntity, setActiveSideEntity] = useState4(null);
1872
+ const [emailViewerOpen, setEmailViewerOpen] = useState4(false);
1873
+ const [selectedEmail, setSelectedEmail] = useState4(null);
1874
+ const [newClientName, setNewClientName] = useState4("");
1875
+ const [newClientEmail, setNewClientEmail] = useState4("");
1876
+ const [newClientPhone, setNewClientPhone] = useState4("");
1877
+ const [newClientStage, setNewClientStage] = useState4("incoming");
1878
+ const [togglingIds, setTogglingIds] = useState4(/* @__PURE__ */ new Set());
1879
+ const [recentlyToggledIds, setRecentlyToggledIds] = useState4(/* @__PURE__ */ new Set());
1880
+ const [completedLoaded, setCompletedLoaded] = useState4(false);
1881
+ const [loadingCompleted, setLoadingCompleted] = useState4(false);
1882
+ useEffect(() => {
1883
+ const timer1 = setTimeout(() => setLoading(false), 450);
1884
+ const timer2 = setTimeout(() => setActivitiesLoading(false), 600);
1885
+ return () => {
1886
+ clearTimeout(timer1);
1887
+ clearTimeout(timer2);
1888
+ };
1889
+ }, []);
1890
+ const showToast = useCallback4((msg) => {
1891
+ setToastMessage(msg);
1892
+ const timer = setTimeout(() => setToastMessage(null), 3e3);
1893
+ return () => clearTimeout(timer);
1894
+ }, []);
1895
+ const handleExpandCompleted = useCallback4(() => {
1896
+ if (completedLoaded) return;
1897
+ setLoadingCompleted(true);
1898
+ setTimeout(() => {
1899
+ setCompletedLoaded(true);
1900
+ setLoadingCompleted(false);
1901
+ }, 300);
1902
+ }, [completedLoaded]);
1903
+ const handleLoadMoreCompleted = useCallback4(() => {
1904
+ setLoadingCompleted(true);
1905
+ setTimeout(() => {
1906
+ setLoadingCompleted(false);
1907
+ showToast("Loaded additional completed tasks.");
1908
+ }, 300);
1909
+ }, [showToast]);
1910
+ const handlePipelineChange = useCallback4((pipelineId) => {
1911
+ setSelectedPipelineId(pipelineId);
1912
+ setLoading(true);
1913
+ setTimeout(() => {
1914
+ setLoading(false);
1915
+ showToast(`Switched to ${PIPELINES.find((p) => p.id === pipelineId)?.name}`);
1916
+ }, 200);
1917
+ }, [showToast]);
1918
+ const clientsMap = useMemo3(() => {
1919
+ const map = /* @__PURE__ */ new Map();
1920
+ clients.forEach((c) => map.set(c.id, { name: c.name }));
1921
+ return map;
1922
+ }, [clients]);
1923
+ const tasksMap = useMemo3(() => {
1924
+ const map = /* @__PURE__ */ new Map();
1925
+ tasks.forEach((t) => map.set(t.id, t));
1926
+ completedTasks.forEach((t) => map.set(t.id, t));
1927
+ return map;
1928
+ }, [tasks, completedTasks]);
1929
+ const handleToggleTask = useCallback4((taskId, currentStatus) => {
1930
+ setTogglingIds((prev) => new Set(prev).add(taskId));
1931
+ setTimeout(() => {
1932
+ if (currentStatus === "pending") {
1933
+ const task = tasks.find((t) => t.id === taskId);
1934
+ if (task) {
1935
+ setTasks((prev) => prev.filter((t) => t.id !== taskId));
1936
+ const completedTask = {
1937
+ ...task,
1938
+ values: { ...task.values, status: "completed", resolution: "done" }
1939
+ };
1940
+ setCompletedTasks((prev) => [completedTask, ...prev]);
1941
+ const newAct = {
1942
+ id: `act-${Date.now()}`,
1943
+ values: {
1944
+ type: "task_completed",
1945
+ description: `Task completed: "${task.values.title}"`,
1946
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1947
+ metadata: {
1948
+ taskId: task.id,
1949
+ taskTitle: task.values.title
1950
+ }
1951
+ }
1952
+ };
1953
+ setActivities((prev) => [newAct, ...prev]);
1954
+ showToast(`Completed task: "${task.values.title}"`);
1955
+ }
1956
+ } else {
1957
+ const task = completedTasks.find((t) => t.id === taskId);
1958
+ if (task) {
1959
+ setCompletedTasks((prev) => prev.filter((t) => t.id !== taskId));
1960
+ const pendingTask = {
1961
+ ...task,
1962
+ values: { ...task.values, status: "pending", resolution: null }
1963
+ };
1964
+ setTasks((prev) => [pendingTask, ...prev]);
1965
+ const newAct = {
1966
+ id: `act-${Date.now()}`,
1967
+ values: {
1968
+ type: "task_created",
1969
+ description: `Task re-opened: "${task.values.title}"`,
1970
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1971
+ metadata: {
1972
+ taskId: task.id,
1973
+ taskTitle: task.values.title
1974
+ }
1975
+ }
1976
+ };
1977
+ setActivities((prev) => [newAct, ...prev]);
1978
+ showToast(`Re-opened task: "${task.values.title}"`);
1979
+ }
1980
+ }
1981
+ setTogglingIds((prev) => {
1982
+ const next = new Set(prev);
1983
+ next.delete(taskId);
1984
+ return next;
1985
+ });
1986
+ }, 200);
1987
+ }, [tasks, completedTasks, showToast]);
1988
+ const handleCompleteTaskFromActivity = useCallback4((activity) => {
1989
+ const taskId = activity.values?.metadata?.taskId;
1990
+ if (taskId) {
1991
+ handleToggleTask(taskId, "pending");
1992
+ }
1993
+ }, [handleToggleTask]);
1994
+ const handleViewEmail = useCallback4((activity) => {
1995
+ if (activity.values?.metadata?.subject) {
1996
+ setSelectedEmail({
1997
+ to: activity.values.metadata.to || "",
1998
+ subject: activity.values.metadata.subject,
1999
+ body: activity.values.metadata.body || "",
2000
+ html: activity.values.metadata.html || "",
2001
+ mode: activity.values.metadata.mode || "simulated"
2002
+ });
2003
+ setEmailViewerOpen(true);
2004
+ }
2005
+ }, []);
2006
+ const handleOpenTask = useCallback4((activity) => {
2007
+ const taskId = activity.values?.metadata?.taskId;
2008
+ if (taskId) {
2009
+ setActiveSideEntity({ type: "task", id: taskId });
2010
+ }
2011
+ }, []);
2012
+ const openTaskDrawer = useCallback4((taskId) => {
2013
+ setActiveSideEntity({ type: "task", id: taskId });
2014
+ }, []);
2015
+ const openClientDrawer = useCallback4((clientId) => {
2016
+ setActiveSideEntity({ type: "client", id: clientId });
2017
+ }, []);
2018
+ const openNewClientDrawer = useCallback4(() => {
2019
+ setActiveSideEntity({ type: "new_client" });
2020
+ }, []);
2021
+ const handleCreateClient = () => {
2022
+ if (!newClientName.trim()) return;
2023
+ const newId = `client-${Date.now()}`;
2024
+ const newClient = {
2025
+ id: newId,
2026
+ name: newClientName,
2027
+ email: newClientEmail || `${newClientName.toLowerCase().replace(/\s+/g, ".")}@example.com`,
2028
+ phone: newClientPhone || "+1 (555) 0100",
2029
+ stage: newClientStage
2030
+ };
2031
+ setClients((prev) => [...prev, newClient]);
2032
+ const newTask = {
2033
+ id: `task-${Date.now()}`,
2034
+ values: {
2035
+ title: `Complete discovery onboarding for ${newClientName}`,
2036
+ status: "pending",
2037
+ resolution: null,
2038
+ dueDate: new Date(Date.now() + 2592e5).toISOString().split("T")[0],
2039
+ // 3 days from now
2040
+ stageId: newClientStage,
2041
+ clientId: newId,
2042
+ priority: "medium",
2043
+ description: `Initial welcome packet and service review task for ${newClientName}.`,
2044
+ notes: "",
2045
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
2046
+ }
2047
+ };
2048
+ setTasks((prev) => [newTask, ...prev]);
2049
+ const newAct = {
2050
+ id: `act-${Date.now()}`,
2051
+ values: {
2052
+ type: "incoming",
2053
+ description: `New client "${newClientName}" registered in "${STAGE_LABELS[newClientStage] || newClientStage}"`,
2054
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
2055
+ }
2056
+ };
2057
+ setActivities((prev) => [newAct, ...prev]);
2058
+ showToast(`Created client "${newClientName}"`);
2059
+ setNewClientName("");
2060
+ setNewClientEmail("");
2061
+ setNewClientPhone("");
2062
+ setNewClientStage("incoming");
2063
+ setActiveSideEntity(null);
2064
+ };
2065
+ const handleNavigate = useCallback4((path) => {
2066
+ if (path.includes("stage=")) {
2067
+ showToast(`Stage link clicked: simulated filtering.`);
2068
+ } else {
2069
+ showToast(`Simulated navigation to: ${path}`);
2070
+ }
2071
+ }, [showToast]);
2072
+ const activeStagesData = useMemo3(() => {
2073
+ const stagesList = INITIAL_STAGES[selectedPipelineId] || [];
2074
+ return stagesList.map((s) => {
2075
+ const count = clients.filter((c) => c.stage === s.stageKey).length;
2076
+ return { ...s, count };
2077
+ });
2078
+ }, [clients, selectedPipelineId]);
2079
+ const sortedStages = useMemo3(() => {
2080
+ return [...activeStagesData].sort((a, b) => a.sortOrder - b.sortOrder);
2081
+ }, [activeStagesData]);
2082
+ const activeStagesList = useMemo3(
2083
+ () => sortedStages.filter((s) => !s.isTerminal && !s.isLostStage),
2084
+ [sortedStages]
2085
+ );
2086
+ const closedStagesList = useMemo3(
2087
+ () => sortedStages.filter((s) => s.isTerminal || s.isLostStage),
2088
+ [sortedStages]
2089
+ );
2090
+ const totalInPipeline = useMemo3(() => {
2091
+ return clients.filter((c) => c.stage !== "completed").length;
2092
+ }, [clients]);
2093
+ const insights = useMemo3(() => {
2094
+ const activeClients = clients.filter((c) => c.stage !== "completed" && c.stage !== "delivered").length;
2095
+ const overdueTaskCount = tasks.filter((t) => {
2096
+ if (t.values.status !== "pending") return false;
2097
+ if (!t.values.dueDate) return false;
2098
+ return new Date(t.values.dueDate) < new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate());
2099
+ }).length;
2100
+ return {
2101
+ pipelines: PIPELINES,
2102
+ activeClients,
2103
+ potentialRevenue: activeClients * 2500,
2104
+ contractedRevenue: clients.filter((c) => c.stage === "completed" || c.stage === "active").length * 8e3,
2105
+ overdueTaskCount
2106
+ };
2107
+ }, [clients, tasks]);
2108
+ const totalRevenue = insights.contractedRevenue + insights.potentialRevenue;
2109
+ const renderDrawerTask = (taskId) => {
2110
+ const task = tasksMap.get(taskId || "");
2111
+ if (!task) return /* @__PURE__ */ jsx10(Typography8, { variant: "body2", color: "secondary", children: "Task not found." });
2112
+ const isCompleted = task.values.status === "completed";
2113
+ const clientInfo = task.values.clientId ? clients.find((c) => c.id === task.values.clientId) : null;
2114
+ const stageName = task.values.stageId ? STAGE_LABELS[task.values.stageId] : "None";
2115
+ return /* @__PURE__ */ jsxs10("div", { className: "flex-1 space-y-4", children: [
2116
+ /* @__PURE__ */ jsxs10("div", { children: [
2117
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider font-semibold block mb-1", children: "Task Title" }),
2118
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-start gap-2.5", children: [
2119
+ /* @__PURE__ */ jsx10("span", { className: "pt-1", children: /* @__PURE__ */ jsx10(
2120
+ "input",
2121
+ {
2122
+ type: "checkbox",
2123
+ checked: isCompleted,
2124
+ onChange: () => handleToggleTask(task.id, task.values.status),
2125
+ className: "h-4 w-4 rounded border-surface-300 text-primary focus:ring-primary"
2126
+ }
2127
+ ) }),
2128
+ /* @__PURE__ */ jsx10(Typography8, { variant: "h6", className: isCompleted ? "line-through text-text-disabled dark:text-text-disabled-dark" : "text-text-primary dark:text-text-primary-dark", children: task.values.title })
2129
+ ] })
2130
+ ] }),
2131
+ /* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-2 gap-4 py-2 border-y border-surface-200 dark:border-surface-700", children: [
2132
+ /* @__PURE__ */ jsxs10("div", { children: [
2133
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider block", children: "Due Date" }),
2134
+ /* @__PURE__ */ jsxs10(Typography8, { variant: "body2", className: "font-medium mt-0.5 inline-flex items-center gap-1", children: [
2135
+ /* @__PURE__ */ jsx10(CalendarIcon2, { className: "h-3.5 w-3.5 text-surface-400" }),
2136
+ task.values.dueDate || "No due date"
2137
+ ] })
2138
+ ] }),
2139
+ /* @__PURE__ */ jsxs10("div", { children: [
2140
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider block", children: "Priority" }),
2141
+ /* @__PURE__ */ jsx10(Typography8, { variant: "body2", className: "font-medium mt-0.5", children: task.values.priority === "high" ? /* @__PURE__ */ jsx10("span", { className: "text-red-500 font-semibold uppercase text-xs", children: "High" }) : task.values.priority === "medium" ? /* @__PURE__ */ jsx10("span", { className: "text-amber-500 font-semibold uppercase text-xs", children: "Medium" }) : /* @__PURE__ */ jsx10("span", { className: "text-surface-450 dark:text-surface-500 uppercase text-xs", children: "Low" }) })
2142
+ ] })
2143
+ ] }),
2144
+ clientInfo && /* @__PURE__ */ jsxs10("div", { children: [
2145
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider font-semibold block mb-1", children: "Related Client" }),
2146
+ /* @__PURE__ */ jsx10(
2147
+ Card5,
2148
+ {
2149
+ className: "p-3 hover:bg-surface-accent-100 dark:hover:bg-surface-800 cursor-pointer transition-colors duration-150",
2150
+ onClick: () => openClientDrawer(clientInfo.id),
2151
+ children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2.5", children: [
2152
+ /* @__PURE__ */ jsx10("div", { className: "w-8 h-8 rounded-full bg-surface-200 dark:bg-surface-700 text-surface-500 flex items-center justify-center font-semibold", children: clientInfo.name[0].toUpperCase() }),
2153
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2154
+ /* @__PURE__ */ jsx10(Typography8, { variant: "body2", className: "font-medium truncate", children: clientInfo.name }),
2155
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "truncate text-[11px] block", children: clientInfo.email })
2156
+ ] })
2157
+ ] })
2158
+ }
2159
+ )
2160
+ ] }),
2161
+ /* @__PURE__ */ jsxs10("div", { children: [
2162
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider block mb-0.5", children: "Pipeline Stage" }),
2163
+ /* @__PURE__ */ jsx10(Typography8, { variant: "body2", className: "font-medium", children: stageName })
2164
+ ] }),
2165
+ task.values.description && /* @__PURE__ */ jsxs10("div", { children: [
2166
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider block mb-0.5", children: "Description" }),
2167
+ /* @__PURE__ */ jsx10("div", { className: "p-3 bg-surface-50 dark:bg-surface-900 rounded-md border border-surface-200 dark:border-surface-700", children: /* @__PURE__ */ jsx10(Typography8, { variant: "body2", className: "whitespace-pre-wrap text-text-primary dark:text-text-primary-dark", children: task.values.description }) })
2168
+ ] }),
2169
+ task.values.notes && /* @__PURE__ */ jsxs10("div", { children: [
2170
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider block mb-0.5", children: "Notes" }),
2171
+ /* @__PURE__ */ jsxs10(Typography8, { variant: "body2", color: "secondary", className: "italic whitespace-pre-wrap", children: [
2172
+ "\u201C",
2173
+ task.values.notes,
2174
+ "\u201D"
2175
+ ] })
2176
+ ] })
2177
+ ] });
2178
+ };
2179
+ const renderDrawerClient = (clientId) => {
2180
+ const client = clients.find((c) => c.id === clientId);
2181
+ if (!client) return /* @__PURE__ */ jsx10(Typography8, { variant: "body2", color: "secondary", children: "Client not found." });
2182
+ const clientTasks = tasks.filter((t) => t.values.clientId === client.id);
2183
+ const stageName = STAGE_LABELS[client.stage] || client.stage;
2184
+ return /* @__PURE__ */ jsxs10("div", { className: "flex-1 space-y-4", children: [
2185
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3", children: [
2186
+ /* @__PURE__ */ jsx10("div", { className: "w-12 h-12 rounded-full bg-primary/10 text-primary dark:text-primary-light flex items-center justify-center text-xl font-semibold", children: client.name[0].toUpperCase() }),
2187
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2188
+ /* @__PURE__ */ jsx10(Typography8, { variant: "h6", className: "truncate", children: client.name }),
2189
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1.5 mt-0.5", children: [
2190
+ /* @__PURE__ */ jsx10("span", { className: "w-2 h-2 rounded-full bg-green-500" }),
2191
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", children: stageName })
2192
+ ] })
2193
+ ] })
2194
+ ] }),
2195
+ /* @__PURE__ */ jsxs10("div", { className: "space-y-2.5 py-3 border-y border-surface-200 dark:border-surface-700", children: [
2196
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-surface-600 dark:text-surface-300", children: [
2197
+ /* @__PURE__ */ jsx10(MailIcon2, { className: "h-4 w-4 text-surface-400" }),
2198
+ /* @__PURE__ */ jsx10(Typography8, { variant: "body2", children: client.email })
2199
+ ] }),
2200
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-surface-600 dark:text-surface-300", children: [
2201
+ /* @__PURE__ */ jsx10(PhoneIcon, { className: "h-4 w-4 text-surface-400" }),
2202
+ /* @__PURE__ */ jsx10(Typography8, { variant: "body2", children: client.phone })
2203
+ ] })
2204
+ ] }),
2205
+ /* @__PURE__ */ jsxs10("div", { children: [
2206
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider font-semibold block mb-2", children: "Pending Client Tasks" }),
2207
+ clientTasks.length === 0 ? /* @__PURE__ */ jsx10(Typography8, { variant: "body2", color: "secondary", className: "italic", children: "No pending tasks for this client." }) : /* @__PURE__ */ jsx10("div", { className: "space-y-1.5", children: clientTasks.map((t) => /* @__PURE__ */ jsx10(
2208
+ Card5,
2209
+ {
2210
+ className: "p-2.5 hover:bg-surface-accent-100 dark:hover:bg-surface-800 cursor-pointer transition-colors duration-150",
2211
+ onClick: () => openTaskDrawer(t.id),
2212
+ children: /* @__PURE__ */ jsxs10("div", { className: "flex items-start gap-2", children: [
2213
+ /* @__PURE__ */ jsx10(
2214
+ "input",
2215
+ {
2216
+ type: "checkbox",
2217
+ checked: t.values.status === "completed",
2218
+ onChange: (e) => {
2219
+ e.stopPropagation();
2220
+ handleToggleTask(t.id, t.values.status);
2221
+ },
2222
+ className: "h-3.5 w-3.5 mt-0.5 rounded border-surface-300 text-primary"
2223
+ }
2224
+ ),
2225
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2226
+ /* @__PURE__ */ jsx10(Typography8, { variant: "body2", className: "truncate font-medium leading-snug", children: t.values.title }),
2227
+ t.values.dueDate && /* @__PURE__ */ jsxs10(Typography8, { variant: "caption", color: "secondary", className: "text-[10px] block mt-0.5", children: [
2228
+ "Due: ",
2229
+ t.values.dueDate
2230
+ ] })
2231
+ ] })
2232
+ ] })
2233
+ },
2234
+ t.id
2235
+ )) })
2236
+ ] }),
2237
+ /* @__PURE__ */ jsxs10("div", { className: "pt-2", children: [
2238
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider font-semibold block mb-2", children: "Quick Actions" }),
2239
+ /* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-2 gap-2", children: [
2240
+ /* @__PURE__ */ jsx10(
2241
+ Button7,
2242
+ {
2243
+ variant: "outlined",
2244
+ size: "small",
2245
+ onClick: () => {
2246
+ const newAct = {
2247
+ id: `act-${Date.now()}`,
2248
+ values: {
2249
+ type: "zoom_setup",
2250
+ description: `Scheduled discovery meeting with ${client.name}`,
2251
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
2252
+ }
2253
+ };
2254
+ setActivities((prev) => [newAct, ...prev]);
2255
+ showToast("Simulated action: Call scheduled");
2256
+ },
2257
+ children: "Schedule Call"
2258
+ }
2259
+ ),
2260
+ /* @__PURE__ */ jsx10(
2261
+ Button7,
2262
+ {
2263
+ variant: "outlined",
2264
+ size: "small",
2265
+ onClick: () => {
2266
+ const newAct = {
2267
+ id: `act-${Date.now()}`,
2268
+ values: {
2269
+ type: "email_sent",
2270
+ description: `Email sent to ${client.name}`,
2271
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2272
+ metadata: {
2273
+ subject: "Following up on discovery call",
2274
+ body: `Hi ${client.name.split(" ")[0]},
2275
+
2276
+ Just wanted to follow up and see if you had any questions on the brochure.
2277
+
2278
+ Best,
2279
+ Francesco`,
2280
+ to: client.email,
2281
+ mode: "simulated"
2282
+ }
2283
+ }
2284
+ };
2285
+ setActivities((prev) => [newAct, ...prev]);
2286
+ showToast("Simulated action: Email sent");
2287
+ },
2288
+ children: "Send Email"
2289
+ }
2290
+ )
2291
+ ] })
2292
+ ] })
2293
+ ] });
2294
+ };
2295
+ const renderDrawerNewClient = () => {
2296
+ return /* @__PURE__ */ jsxs10("div", { className: "flex-1 flex flex-col justify-between", children: [
2297
+ /* @__PURE__ */ jsxs10("div", { className: "space-y-4", children: [
2298
+ /* @__PURE__ */ jsx10(Typography8, { variant: "subtitle1", className: "mb-2", children: "New Lead Details" }),
2299
+ /* @__PURE__ */ jsx10(
2300
+ TextField,
2301
+ {
2302
+ label: "Client Name",
2303
+ required: true,
2304
+ value: newClientName,
2305
+ onChange: (e) => setNewClientName(e.target.value),
2306
+ placeholder: "e.g. George Clark"
2307
+ }
2308
+ ),
2309
+ /* @__PURE__ */ jsx10(
2310
+ TextField,
2311
+ {
2312
+ label: "Email Address",
2313
+ value: newClientEmail,
2314
+ onChange: (e) => setNewClientEmail(e.target.value),
2315
+ placeholder: "e.g. george@clark.com"
2316
+ }
2317
+ ),
2318
+ /* @__PURE__ */ jsx10(
2319
+ TextField,
2320
+ {
2321
+ label: "Phone Number",
2322
+ value: newClientPhone,
2323
+ onChange: (e) => setNewClientPhone(e.target.value),
2324
+ placeholder: "e.g. +1 (555) 0122"
2325
+ }
2326
+ ),
2327
+ /* @__PURE__ */ jsxs10("div", { children: [
2328
+ /* @__PURE__ */ jsx10(Typography8, { variant: "caption", color: "secondary", className: "uppercase text-[9px] tracking-wider block mb-1", children: "Pipeline Stage" }),
2329
+ /* @__PURE__ */ jsx10(
2330
+ Select3,
2331
+ {
2332
+ value: newClientStage,
2333
+ onValueChange: (v) => setNewClientStage(v),
2334
+ size: "small",
2335
+ renderValue: (v) => STAGE_LABELS[v] || v,
2336
+ position: "popper",
2337
+ children: Object.entries(STAGE_LABELS).map(([key, val]) => /* @__PURE__ */ jsx10(SelectItem3, { value: key, children: val }, key))
2338
+ }
2339
+ )
2340
+ ] })
2341
+ ] }),
2342
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 pt-6 border-t border-surface-200 dark:border-surface-700 mt-6", children: [
2343
+ /* @__PURE__ */ jsx10(
2344
+ Button7,
2345
+ {
2346
+ variant: "outlined",
2347
+ color: "neutral",
2348
+ className: "flex-1",
2349
+ onClick: () => setActiveSideEntity(null),
2350
+ children: "Cancel"
2351
+ }
2352
+ ),
2353
+ /* @__PURE__ */ jsx10(
2354
+ Button7,
2355
+ {
2356
+ variant: "filled",
2357
+ color: "primary",
2358
+ className: "flex-1",
2359
+ onClick: handleCreateClient,
2360
+ disabled: !newClientName.trim(),
2361
+ children: "Create"
2362
+ }
2363
+ )
2364
+ ] })
2365
+ ] });
2366
+ };
2367
+ return /* @__PURE__ */ jsxs10("div", { className: "relative w-full border rounded-xl bg-surface-50 dark:bg-surface-800 border-surface-200 dark:border-surface-700 shadow-sm flex flex-row", children: [
2368
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 flex flex-col p-4 md:p-6 transition-all duration-300", children: [
2369
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-col sm:flex-row sm:items-end justify-between mb-6 gap-4", children: [
2370
+ /* @__PURE__ */ jsxs10("div", { children: [
2371
+ /* @__PURE__ */ jsx10(Typography8, { variant: "h4", className: "tracking-tight", children: getGreeting() }),
2372
+ /* @__PURE__ */ jsxs10(Typography8, { variant: "body2", color: "secondary", className: "mt-0.5", children: [
2373
+ getFormattedDate(),
2374
+ " \u2014 here's your crm overview."
2375
+ ] })
2376
+ ] }),
2377
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
2378
+ /* @__PURE__ */ jsx10(
2379
+ Button7,
2380
+ {
2381
+ variant: "text",
2382
+ color: "primary",
2383
+ size: "small",
2384
+ onClick: () => {
2385
+ setLoading(true);
2386
+ setActivitiesLoading(true);
2387
+ setTimeout(() => {
2388
+ setLoading(false);
2389
+ setActivitiesLoading(false);
2390
+ showToast("Data refreshed.");
2391
+ }, 300);
2392
+ },
2393
+ disabled: loading,
2394
+ startIcon: /* @__PURE__ */ jsx10(RefreshCwIcon, { className: cls6("h-4 w-4", loading && "animate-spin") }),
2395
+ children: "Refresh"
2396
+ }
2397
+ ),
2398
+ /* @__PURE__ */ jsx10(
2399
+ Button7,
2400
+ {
2401
+ variant: "filled",
2402
+ color: "primary",
2403
+ size: "small",
2404
+ onClick: openNewClientDrawer,
2405
+ startIcon: /* @__PURE__ */ jsx10(UserPlus, { className: "h-4 w-4" }),
2406
+ children: "New Client"
2407
+ }
2408
+ )
2409
+ ] })
2410
+ ] }),
2411
+ /* @__PURE__ */ jsx10(
2412
+ DashboardMetrics,
2413
+ {
2414
+ loading,
2415
+ insights,
2416
+ totalInPipeline,
2417
+ totalRevenue
2418
+ }
2419
+ ),
2420
+ /* @__PURE__ */ jsx10(
2421
+ PipelineOverview,
2422
+ {
2423
+ loading,
2424
+ insights,
2425
+ selectedPipelineId,
2426
+ onPipelineChange: handlePipelineChange,
2427
+ onNavigate: handleNavigate,
2428
+ sortedStages,
2429
+ activeStages: activeStagesList,
2430
+ closedStages: closedStagesList,
2431
+ totalInPipeline,
2432
+ resolveColor
2433
+ }
2434
+ ),
2435
+ /* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_360px] gap-6 mt-2", children: [
2436
+ /* @__PURE__ */ jsx10(Card5, { className: "p-4 flex flex-col h-[400px]", children: /* @__PURE__ */ jsx10(
2437
+ TasksView,
2438
+ {
2439
+ loading,
2440
+ tasks,
2441
+ togglingIds,
2442
+ onToggleTask: handleToggleTask,
2443
+ onOpenTask: openTaskDrawer,
2444
+ onOpenClient: openClientDrawer,
2445
+ clientsMap,
2446
+ pipelineStages: sortedStages,
2447
+ recentlyToggledIds,
2448
+ completedTasks,
2449
+ completedLoaded,
2450
+ loadingCompleted,
2451
+ completedHasMore: false,
2452
+ onExpandCompleted: handleExpandCompleted,
2453
+ onLoadMoreCompleted: handleLoadMoreCompleted
2454
+ }
2455
+ ) }),
2456
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-6", children: [
2457
+ /* @__PURE__ */ jsx10(Card5, { className: "p-4 h-auto", children: /* @__PURE__ */ jsx10(
2458
+ CalendarWidget,
2459
+ {
2460
+ loading,
2461
+ tasks: tasks.concat(completedTasks),
2462
+ onOpenTask: openTaskDrawer
2463
+ }
2464
+ ) }),
2465
+ /* @__PURE__ */ jsx10(
2466
+ RecentActivity,
2467
+ {
2468
+ activities,
2469
+ activitiesLoading,
2470
+ tasksMap,
2471
+ onCompleteTask: handleCompleteTaskFromActivity,
2472
+ onViewEmail: handleViewEmail,
2473
+ onOpenTask: handleOpenTask,
2474
+ emailViewerOpen,
2475
+ onEmailViewerOpenChange: setEmailViewerOpen,
2476
+ selectedEmail
2477
+ }
2478
+ )
2479
+ ] })
2480
+ ] })
2481
+ ] }),
2482
+ /* @__PURE__ */ jsxs10("div", { className: cls6(
2483
+ "fixed top-0 right-0 bottom-0 w-full sm:w-[420px] bg-white dark:bg-surface-900 border-l border-surface-200 dark:border-surface-700 shadow-2xl z-40 transition-transform duration-300 ease-in-out flex flex-col",
2484
+ activeSideEntity ? "translate-x-0" : "translate-x-full"
2485
+ ), children: [
2486
+ /* @__PURE__ */ jsxs10("div", { className: "p-4 flex items-center justify-between border-b border-surface-200 dark:border-surface-800", children: [
2487
+ /* @__PURE__ */ jsx10(Typography8, { variant: "subtitle1", className: "font-semibold uppercase tracking-wider text-[10px] color-secondary", children: activeSideEntity?.type === "task" ? "Task Details" : activeSideEntity?.type === "client" ? "Client profile" : "Create Lead" }),
2488
+ /* @__PURE__ */ jsx10(
2489
+ "button",
2490
+ {
2491
+ onClick: () => setActiveSideEntity(null),
2492
+ className: "p-1 rounded-md text-surface-400 hover:text-surface-700 hover:bg-surface-100 dark:hover:bg-surface-800 focus:outline-none",
2493
+ children: /* @__PURE__ */ jsx10(XIcon2, { className: "h-4 w-4" })
2494
+ }
2495
+ )
2496
+ ] }),
2497
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 overflow-y-auto p-5 flex flex-col", children: [
2498
+ activeSideEntity?.type === "task" && renderDrawerTask(activeSideEntity.id),
2499
+ activeSideEntity?.type === "client" && renderDrawerClient(activeSideEntity.id),
2500
+ activeSideEntity?.type === "new_client" && renderDrawerNewClient()
2501
+ ] })
2502
+ ] }),
2503
+ activeSideEntity && /* @__PURE__ */ jsx10(
2504
+ "div",
2505
+ {
2506
+ onClick: () => setActiveSideEntity(null),
2507
+ className: "fixed inset-0 bg-black/20 dark:bg-black/50 z-30 transition-opacity duration-300"
2508
+ }
2509
+ ),
2510
+ /* @__PURE__ */ jsx10("div", { className: cls6(
2511
+ "absolute bottom-4 left-4 z-50 transition-all duration-300 transform",
2512
+ toastMessage ? "translate-y-0 opacity-100" : "translate-y-2 opacity-0 pointer-events-none"
2513
+ ), children: toastMessage && /* @__PURE__ */ jsxs10("div", { className: "px-4 py-3 bg-surface-900 dark:bg-surface-50 text-white dark:text-surface-900 text-xs font-medium rounded-lg shadow-lg flex items-center gap-2 border border-surface-800 dark:border-surface-200", children: [
2514
+ /* @__PURE__ */ jsx10(CheckIcon, { className: "h-4 w-4 text-green-500" }),
2515
+ /* @__PURE__ */ jsx10("span", { children: toastMessage })
2516
+ ] }) })
2517
+ ] });
2518
+ }
2519
+
2520
+ // src/debug/collection-views/CollectionTableDemo.tsx
2521
+ import { useState as useState5, useMemo as useMemo4 } from "react";
2522
+ import {
2523
+ Typography as Typography9,
2524
+ Chip as Chip4,
2525
+ cls as cls7,
2526
+ defaultBorderMixin as defaultBorderMixin2,
2527
+ Table,
2528
+ TableHeader,
2529
+ TableBody,
2530
+ TableRow,
2531
+ TableCell,
2532
+ SearchBar as SearchBar2,
2533
+ IconButton as IconButton3,
2534
+ Tooltip as Tooltip2,
2535
+ Checkbox as Checkbox2,
2536
+ iconSize,
2537
+ Select as Select4,
2538
+ SelectItem as SelectItem4,
2539
+ Trash2Icon as Trash2Icon2,
2540
+ PencilIcon,
2541
+ ArrowUpDownIcon,
2542
+ ArrowUpIcon,
2543
+ ArrowDownIcon
2544
+ } from "@rebasepro/ui";
2545
+
2546
+ // src/debug/collection-views/sample_data.ts
2547
+ var STATUS_CONFIG = {
2548
+ backlog: { label: "Backlog", color: "gray" },
2549
+ in_progress: { label: "In Progress", color: "blue" },
2550
+ in_review: { label: "In Review", color: "purple" },
2551
+ done: { label: "Done", color: "green" }
2552
+ };
2553
+ var PRIORITY_CONFIG = {
2554
+ low: { label: "Low", color: "gray" },
2555
+ medium: { label: "Medium", color: "yellow" },
2556
+ high: { label: "High", color: "orange" },
2557
+ critical: { label: "Critical", color: "red" }
2558
+ };
2559
+ var SAMPLE_PROJECTS = [
2560
+ { id: "proj-1", name: "Website Redesign", description: "Complete overhaul of the marketing website with new brand guidelines", status: "in_progress", priority: "high", assignee: "Alice Johnson", tags: ["frontend", "design"], dueDate: new Date(Date.now() + 7 * 864e5).toISOString().split("T")[0], progress: 65, createdAt: new Date(Date.now() - 14 * 864e5).toISOString() },
2561
+ { id: "proj-2", name: "API Rate Limiting", description: "Implement token-bucket rate limiting across all public endpoints", status: "in_review", priority: "critical", assignee: "Bob Smith", tags: ["backend", "security"], dueDate: new Date(Date.now() + 2 * 864e5).toISOString().split("T")[0], progress: 90, createdAt: new Date(Date.now() - 10 * 864e5).toISOString() },
2562
+ { id: "proj-3", name: "Mobile Push Notifications", description: "Add support for push notifications on iOS and Android clients", status: "backlog", priority: "medium", assignee: "Carol White", tags: ["mobile", "backend"], dueDate: new Date(Date.now() + 21 * 864e5).toISOString().split("T")[0], progress: 0, createdAt: new Date(Date.now() - 3 * 864e5).toISOString() },
2563
+ { id: "proj-4", name: "Dashboard Analytics", description: "Build real-time analytics dashboard with charts and KPI widgets", status: "in_progress", priority: "high", assignee: "David Brown", tags: ["frontend", "data"], dueDate: new Date(Date.now() + 5 * 864e5).toISOString().split("T")[0], progress: 40, createdAt: new Date(Date.now() - 7 * 864e5).toISOString() },
2564
+ { id: "proj-5", name: "User Onboarding Flow", description: "Multi-step onboarding wizard with progress tracking and email triggers", status: "done", priority: "medium", assignee: "Eva Green", tags: ["frontend", "ux"], dueDate: new Date(Date.now() - 2 * 864e5).toISOString().split("T")[0], progress: 100, createdAt: new Date(Date.now() - 21 * 864e5).toISOString() },
2565
+ { id: "proj-6", name: "Database Migration v3", description: "Migrate from PostgreSQL 14 to 16 with zero-downtime strategy", status: "backlog", priority: "low", assignee: "Frank Miller", tags: ["backend", "infrastructure"], dueDate: new Date(Date.now() + 30 * 864e5).toISOString().split("T")[0], progress: 0, createdAt: new Date(Date.now() - 1 * 864e5).toISOString() },
2566
+ { id: "proj-7", name: "SSO Integration", description: "SAML 2.0 and OIDC single sign-on for enterprise customers", status: "in_progress", priority: "critical", assignee: "Alice Johnson", tags: ["backend", "security", "enterprise"], dueDate: new Date(Date.now() + 3 * 864e5).toISOString().split("T")[0], progress: 75, createdAt: new Date(Date.now() - 12 * 864e5).toISOString() },
2567
+ { id: "proj-8", name: "E2E Test Suite", description: "Playwright-based end-to-end tests covering critical user journeys", status: "in_review", priority: "medium", assignee: "Bob Smith", tags: ["testing", "devops"], dueDate: new Date(Date.now() + 1 * 864e5).toISOString().split("T")[0], progress: 85, createdAt: new Date(Date.now() - 8 * 864e5).toISOString() },
2568
+ { id: "proj-9", name: "Billing System Upgrade", description: "Stripe integration upgrade with metered billing and invoice PDF generation", status: "done", priority: "high", assignee: "Carol White", tags: ["backend", "payments"], dueDate: new Date(Date.now() - 5 * 864e5).toISOString().split("T")[0], progress: 100, createdAt: new Date(Date.now() - 28 * 864e5).toISOString() },
2569
+ { id: "proj-10", name: "Dark Mode Polish", description: "Audit and fix all remaining dark mode inconsistencies across the app", status: "backlog", priority: "low", assignee: "David Brown", tags: ["frontend", "design"], dueDate: new Date(Date.now() + 14 * 864e5).toISOString().split("T")[0], progress: 0, createdAt: new Date(Date.now() - 2 * 864e5).toISOString() }
2570
+ ];
2571
+
2572
+ // src/debug/collection-views/CollectionTableDemo.tsx
2573
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
2574
+ function CollectionTableDemo() {
2575
+ const [searchTerm, setSearchTerm] = useState5("");
2576
+ const [sortField, setSortField] = useState5("name");
2577
+ const [sortDirection, setSortDirection] = useState5("asc");
2578
+ const [selectedIds, setSelectedIds] = useState5(/* @__PURE__ */ new Set());
2579
+ const [statusFilter, setStatusFilter] = useState5("all");
2580
+ const filteredAndSorted = useMemo4(() => {
2581
+ let results = SAMPLE_PROJECTS.filter((p) => {
2582
+ const matchesSearch = !searchTerm || p.name.toLowerCase().includes(searchTerm.toLowerCase()) || p.assignee.toLowerCase().includes(searchTerm.toLowerCase());
2583
+ const matchesStatus = statusFilter === "all" || p.status === statusFilter;
2584
+ return matchesSearch && matchesStatus;
2585
+ });
2586
+ results = [...results].sort((a, b) => {
2587
+ const cmp = String(a[sortField]).localeCompare(String(b[sortField]));
2588
+ return sortDirection === "asc" ? cmp : -cmp;
2589
+ });
2590
+ return results;
2591
+ }, [searchTerm, sortField, sortDirection, statusFilter]);
2592
+ const toggleSort = (field) => {
2593
+ if (sortField === field) setSortDirection((d) => d === "asc" ? "desc" : "asc");
2594
+ else {
2595
+ setSortField(field);
2596
+ setSortDirection("asc");
2597
+ }
2598
+ };
2599
+ const toggleSelect = (id) => {
2600
+ setSelectedIds((prev) => {
2601
+ const next = new Set(prev);
2602
+ if (next.has(id)) next.delete(id);
2603
+ else next.add(id);
2604
+ return next;
2605
+ });
2606
+ };
2607
+ const toggleSelectAll = (checked) => {
2608
+ setSelectedIds(checked ? new Set(filteredAndSorted.map((p) => p.id)) : /* @__PURE__ */ new Set());
2609
+ };
2610
+ const allSelected = filteredAndSorted.length > 0 && filteredAndSorted.every((p) => selectedIds.has(p.id));
2611
+ const SortIcon = ({ field }) => {
2612
+ if (sortField !== field) return /* @__PURE__ */ jsx11(ArrowUpDownIcon, { size: 12, className: "text-surface-400" });
2613
+ return sortDirection === "asc" ? /* @__PURE__ */ jsx11(ArrowUpIcon, { size: 12, className: "text-primary" }) : /* @__PURE__ */ jsx11(ArrowDownIcon, { size: 12, className: "text-primary" });
2614
+ };
2615
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-3", children: [
2616
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3 flex-wrap", children: [
2617
+ /* @__PURE__ */ jsx11(SearchBar2, { onTextSearch: (term) => setSearchTerm(term ?? ""), placeholder: "Search projects\u2026", size: "small" }),
2618
+ /* @__PURE__ */ jsxs11(Select4, { value: statusFilter, onValueChange: setStatusFilter, size: "small", placeholder: "Status", children: [
2619
+ /* @__PURE__ */ jsx11(SelectItem4, { value: "all", children: "All Statuses" }),
2620
+ Object.entries(STATUS_CONFIG).map(([key, { label }]) => /* @__PURE__ */ jsx11(SelectItem4, { value: key, children: label }, key))
2621
+ ] }),
2622
+ selectedIds.size > 0 && /* @__PURE__ */ jsxs11(Typography9, { variant: "caption", color: "secondary", children: [
2623
+ selectedIds.size,
2624
+ " selected"
2625
+ ] })
2626
+ ] }),
2627
+ /* @__PURE__ */ jsxs11("div", { className: cls7("rounded-lg border overflow-hidden", defaultBorderMixin2), children: [
2628
+ /* @__PURE__ */ jsxs11(Table, { className: "w-full", children: [
2629
+ /* @__PURE__ */ jsxs11(TableHeader, { children: [
2630
+ /* @__PURE__ */ jsx11(TableCell, { header: true, style: { width: "40px" }, children: /* @__PURE__ */ jsx11(Checkbox2, { checked: allSelected, onCheckedChange: toggleSelectAll, size: "small" }) }),
2631
+ /* @__PURE__ */ jsx11(TableCell, { header: true, children: /* @__PURE__ */ jsxs11("button", { onClick: () => toggleSort("name"), className: "flex items-center gap-1 cursor-pointer", children: [
2632
+ /* @__PURE__ */ jsx11(Typography9, { variant: "caption", className: "font-semibold", children: "Name" }),
2633
+ /* @__PURE__ */ jsx11(SortIcon, { field: "name" })
2634
+ ] }) }),
2635
+ /* @__PURE__ */ jsx11(TableCell, { header: true, children: /* @__PURE__ */ jsxs11("button", { onClick: () => toggleSort("status"), className: "flex items-center gap-1 cursor-pointer", children: [
2636
+ /* @__PURE__ */ jsx11(Typography9, { variant: "caption", className: "font-semibold", children: "Status" }),
2637
+ /* @__PURE__ */ jsx11(SortIcon, { field: "status" })
2638
+ ] }) }),
2639
+ /* @__PURE__ */ jsx11(TableCell, { header: true, children: /* @__PURE__ */ jsxs11("button", { onClick: () => toggleSort("priority"), className: "flex items-center gap-1 cursor-pointer", children: [
2640
+ /* @__PURE__ */ jsx11(Typography9, { variant: "caption", className: "font-semibold", children: "Priority" }),
2641
+ /* @__PURE__ */ jsx11(SortIcon, { field: "priority" })
2642
+ ] }) }),
2643
+ /* @__PURE__ */ jsx11(TableCell, { header: true, children: /* @__PURE__ */ jsx11(Typography9, { variant: "caption", className: "font-semibold", children: "Assignee" }) }),
2644
+ /* @__PURE__ */ jsx11(TableCell, { header: true, children: /* @__PURE__ */ jsx11(Typography9, { variant: "caption", className: "font-semibold", children: "Tags" }) }),
2645
+ /* @__PURE__ */ jsx11(TableCell, { header: true, children: /* @__PURE__ */ jsxs11("button", { onClick: () => toggleSort("dueDate"), className: "flex items-center gap-1 cursor-pointer", children: [
2646
+ /* @__PURE__ */ jsx11(Typography9, { variant: "caption", className: "font-semibold", children: "Due Date" }),
2647
+ /* @__PURE__ */ jsx11(SortIcon, { field: "dueDate" })
2648
+ ] }) }),
2649
+ /* @__PURE__ */ jsx11(TableCell, { header: true, style: { width: "80px" }, children: /* @__PURE__ */ jsx11(Typography9, { variant: "caption", className: "font-semibold", children: "Actions" }) })
2650
+ ] }),
2651
+ /* @__PURE__ */ jsx11(TableBody, { children: filteredAndSorted.map((project) => /* @__PURE__ */ jsxs11(TableRow, { className: cls7(selectedIds.has(project.id) && "bg-primary/[0.03] dark:bg-primary/[0.06]"), children: [
2652
+ /* @__PURE__ */ jsx11(TableCell, { style: { width: "40px" }, children: /* @__PURE__ */ jsx11(Checkbox2, { checked: selectedIds.has(project.id), onCheckedChange: () => toggleSelect(project.id), size: "small" }) }),
2653
+ /* @__PURE__ */ jsx11(TableCell, { children: /* @__PURE__ */ jsxs11("div", { children: [
2654
+ /* @__PURE__ */ jsx11(Typography9, { variant: "body2", className: "font-medium", children: project.name }),
2655
+ /* @__PURE__ */ jsx11(Typography9, { variant: "caption", color: "secondary", className: "line-clamp-1", children: project.description })
2656
+ ] }) }),
2657
+ /* @__PURE__ */ jsx11(TableCell, { children: /* @__PURE__ */ jsx11(Chip4, { colorScheme: STATUS_CONFIG[project.status].color, size: "small", children: STATUS_CONFIG[project.status].label }) }),
2658
+ /* @__PURE__ */ jsx11(TableCell, { children: /* @__PURE__ */ jsx11(Chip4, { colorScheme: PRIORITY_CONFIG[project.priority].color, size: "smallest", outlined: true, children: PRIORITY_CONFIG[project.priority].label }) }),
2659
+ /* @__PURE__ */ jsx11(TableCell, { children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
2660
+ /* @__PURE__ */ jsx11("div", { className: "w-6 h-6 rounded-full bg-surface-200 dark:bg-surface-700 text-surface-500 flex items-center justify-center text-[10px] font-semibold shrink-0", children: project.assignee[0] }),
2661
+ /* @__PURE__ */ jsx11(Typography9, { variant: "body2", className: "truncate", children: project.assignee })
2662
+ ] }) }),
2663
+ /* @__PURE__ */ jsx11(TableCell, { children: /* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-1", children: project.tags.map((tag) => /* @__PURE__ */ jsx11(Chip4, { size: "smallest", colorScheme: "cyan", children: tag }, tag)) }) }),
2664
+ /* @__PURE__ */ jsx11(TableCell, { children: /* @__PURE__ */ jsx11(Typography9, { variant: "body2", className: "font-mono text-xs", children: project.dueDate }) }),
2665
+ /* @__PURE__ */ jsx11(TableCell, { style: { width: "80px" }, children: /* @__PURE__ */ jsxs11("div", { className: "flex gap-1", children: [
2666
+ /* @__PURE__ */ jsx11(Tooltip2, { title: "Edit", asChild: true, children: /* @__PURE__ */ jsx11(IconButton3, { size: "smallest", children: /* @__PURE__ */ jsx11(PencilIcon, { size: iconSize.smallest }) }) }),
2667
+ /* @__PURE__ */ jsx11(Tooltip2, { title: "Delete", asChild: true, children: /* @__PURE__ */ jsx11(IconButton3, { size: "smallest", children: /* @__PURE__ */ jsx11(Trash2Icon2, { size: iconSize.smallest }) }) })
2668
+ ] }) })
2669
+ ] }, project.id)) })
2670
+ ] }),
2671
+ filteredAndSorted.length === 0 && /* @__PURE__ */ jsx11("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx11(Typography9, { variant: "label", color: "secondary", children: "No projects match your filters" }) })
2672
+ ] }),
2673
+ /* @__PURE__ */ jsxs11(Typography9, { variant: "caption", color: "secondary", children: [
2674
+ filteredAndSorted.length,
2675
+ " of ",
2676
+ SAMPLE_PROJECTS.length,
2677
+ " projects"
2678
+ ] })
2679
+ ] });
2680
+ }
2681
+
2682
+ // src/debug/collection-views/CardViewDemo.tsx
2683
+ import { useState as useState6, useMemo as useMemo5 } from "react";
2684
+ import {
2685
+ Card as Card6,
2686
+ Typography as Typography10,
2687
+ Chip as Chip5,
2688
+ cls as cls8,
2689
+ defaultBorderMixin as defaultBorderMixin3,
2690
+ SearchBar as SearchBar3,
2691
+ ToggleButtonGroup,
2692
+ LayoutGridIcon,
2693
+ ListIcon,
2694
+ FolderKanbanIcon
2695
+ } from "@rebasepro/ui";
2696
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
2697
+ function CardViewDemo() {
2698
+ const [searchTerm, setSearchTerm] = useState6("");
2699
+ const [cardSize, setCardSize] = useState6("md");
2700
+ const filtered = useMemo5(() => {
2701
+ if (!searchTerm) return SAMPLE_PROJECTS;
2702
+ const lower = searchTerm.toLowerCase();
2703
+ return SAMPLE_PROJECTS.filter(
2704
+ (p) => p.name.toLowerCase().includes(lower) || p.assignee.toLowerCase().includes(lower) || p.tags.some((t) => t.toLowerCase().includes(lower))
2705
+ );
2706
+ }, [searchTerm]);
2707
+ const gridClass = useMemo5(() => {
2708
+ switch (cardSize) {
2709
+ case "sm":
2710
+ return "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5";
2711
+ case "md":
2712
+ return "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4";
2713
+ case "lg":
2714
+ return "grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3";
2715
+ }
2716
+ }, [cardSize]);
2717
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-3", children: [
2718
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3 flex-wrap", children: [
2719
+ /* @__PURE__ */ jsx12(SearchBar3, { onTextSearch: (term) => setSearchTerm(term ?? ""), placeholder: "Search cards\u2026", size: "small" }),
2720
+ /* @__PURE__ */ jsx12(ToggleButtonGroup, { value: cardSize, onValueChange: setCardSize, options: [
2721
+ { value: "sm", label: "Small", icon: /* @__PURE__ */ jsx12(LayoutGridIcon, { size: 14 }) },
2722
+ { value: "md", label: "Medium", icon: /* @__PURE__ */ jsx12(ListIcon, { size: 14 }) },
2723
+ { value: "lg", label: "Large", icon: /* @__PURE__ */ jsx12(FolderKanbanIcon, { size: 14 }) }
2724
+ ] }),
2725
+ /* @__PURE__ */ jsxs12(Typography10, { variant: "caption", color: "secondary", className: "ml-auto", children: [
2726
+ filtered.length,
2727
+ " projects"
2728
+ ] })
2729
+ ] }),
2730
+ /* @__PURE__ */ jsx12("div", { className: cls8("grid gap-4", gridClass), children: filtered.map((project) => /* @__PURE__ */ jsx12(ProjectCard, { project, compact: cardSize === "sm" }, project.id)) }),
2731
+ filtered.length === 0 && /* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx12(Typography10, { variant: "label", color: "secondary", children: "No projects match your search" }) })
2732
+ ] });
2733
+ }
2734
+ function ProjectCard({ project, compact }) {
2735
+ const statusCfg = STATUS_CONFIG[project.status];
2736
+ const priorityCfg = PRIORITY_CONFIG[project.priority];
2737
+ const isOverdue = new Date(project.dueDate) < /* @__PURE__ */ new Date() && project.status !== "done";
2738
+ return /* @__PURE__ */ jsxs12(Card6, { className: cls8("cursor-pointer overflow-hidden group relative", "transition-all duration-200", "hover:shadow-lg hover:-translate-y-0.5"), children: [
2739
+ /* @__PURE__ */ jsxs12("div", { className: cls8("relative overflow-hidden bg-surface-100 dark:bg-surface-900", compact ? "h-20" : "aspect-[5/2]"), children: [
2740
+ /* @__PURE__ */ jsx12("div", { className: "absolute inset-0 opacity-20 transition-all duration-300", style: { background: `linear-gradient(90deg, var(--color-primary) ${project.progress}%, transparent ${project.progress}%)` } }),
2741
+ /* @__PURE__ */ jsxs12("div", { className: "absolute inset-0 flex flex-col items-center justify-center gap-1", children: [
2742
+ /* @__PURE__ */ jsx12(FolderKanbanIcon, { size: compact ? 20 : 28, className: "text-surface-400 dark:text-surface-500" }),
2743
+ !compact && /* @__PURE__ */ jsxs12(Typography10, { variant: "caption", color: "secondary", className: "font-mono text-[10px]", children: [
2744
+ project.progress,
2745
+ "% complete"
2746
+ ] })
2747
+ ] }),
2748
+ /* @__PURE__ */ jsx12("div", { className: "absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors duration-200" }),
2749
+ /* @__PURE__ */ jsx12("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ jsx12(Chip5, { colorScheme: priorityCfg.color, size: "smallest", outlined: true, children: priorityCfg.label }) })
2750
+ ] }),
2751
+ /* @__PURE__ */ jsxs12("div", { className: compact ? "p-2" : "p-3", children: [
2752
+ /* @__PURE__ */ jsx12(Typography10, { variant: "caption", color: "disabled", className: "font-mono truncate block text-[10px]", children: project.id }),
2753
+ /* @__PURE__ */ jsx12("div", { className: "truncate my-1", children: /* @__PURE__ */ jsx12(Typography10, { variant: compact ? "caption" : "body2", className: "font-medium", children: project.name }) }),
2754
+ !compact && /* @__PURE__ */ jsx12(Typography10, { variant: "caption", color: "secondary", className: "line-clamp-2 mb-2", children: project.description }),
2755
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
2756
+ /* @__PURE__ */ jsx12(Chip5, { colorScheme: statusCfg.color, size: "smallest", children: statusCfg.label }),
2757
+ !compact && project.tags.slice(0, 2).map((tag) => /* @__PURE__ */ jsx12(Chip5, { size: "smallest", colorScheme: "cyan", className: "!text-[10px]", children: tag }, tag)),
2758
+ !compact && project.tags.length > 2 && /* @__PURE__ */ jsxs12("span", { className: "text-[10px] text-surface-400", children: [
2759
+ "+",
2760
+ project.tags.length - 2
2761
+ ] })
2762
+ ] }),
2763
+ !compact && /* @__PURE__ */ jsxs12("div", { className: cls8("flex items-center justify-between mt-2 pt-2 border-t", defaultBorderMixin3), children: [
2764
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5", children: [
2765
+ /* @__PURE__ */ jsx12("div", { className: "w-5 h-5 rounded-full bg-surface-200 dark:bg-surface-700 text-surface-500 flex items-center justify-center text-[9px] font-semibold", children: project.assignee[0] }),
2766
+ /* @__PURE__ */ jsx12(Typography10, { variant: "caption", color: "secondary", className: "truncate max-w-[100px]", children: project.assignee })
2767
+ ] }),
2768
+ /* @__PURE__ */ jsx12(Typography10, { variant: "caption", className: cls8("font-mono text-[10px]", isOverdue ? "text-red-500 font-semibold" : "text-surface-400"), children: project.dueDate })
2769
+ ] })
2770
+ ] })
2771
+ ] });
2772
+ }
2773
+
2774
+ // src/debug/collection-views/KanbanBoardDemo.tsx
2775
+ import { useState as useState7, useCallback as useCallback5, useMemo as useMemo6 } from "react";
2776
+ import { Typography as Typography11, Chip as Chip6, cls as cls9, defaultBorderMixin as defaultBorderMixin4, KanbanView, Alert as Alert2, FolderKanbanIcon as FolderKanbanIcon2 } from "@rebasepro/ui";
2777
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
2778
+ var STATUS_COLUMNS = ["backlog", "in_progress", "in_review", "done"];
2779
+ var COLUMN_LABELS = { backlog: "Backlog", in_progress: "In Progress", in_review: "In Review", done: "Done" };
2780
+ var COLUMN_COLORS = { backlog: "#6b7280", in_progress: "#3b82f6", in_review: "#8b5cf6", done: "#22c55e" };
2781
+ function KanbanProjectCard({ item, isDragging, isGroupedOver, style }) {
2782
+ const project = item.data;
2783
+ const priorityCfg = PRIORITY_CONFIG[project.priority];
2784
+ const isOverdue = new Date(project.dueDate) < /* @__PURE__ */ new Date() && project.status !== "done";
2785
+ const backgroundColor = useMemo6(() => {
2786
+ if (isDragging) return "bg-surface-100 dark:bg-surface-800";
2787
+ if (isGroupedOver) return "bg-surface-200 dark:bg-surface-700";
2788
+ return "bg-white dark:bg-surface-800 hover:bg-surface-50 dark:hover:bg-surface-700";
2789
+ }, [isDragging, isGroupedOver]);
2790
+ const borderColor = useMemo6(() => isDragging ? "ring-2 ring-primary" : "", [isDragging]);
2791
+ return /* @__PURE__ */ jsx13("div", { style, className: "py-1", "data-testid": item.id, children: /* @__PURE__ */ jsxs13("div", { className: cls9("group/card p-2 flex items-start border rounded-lg cursor-pointer transition-all duration-200", defaultBorderMixin4, borderColor, backgroundColor, "hover:shadow-sm"), children: [
2792
+ /* @__PURE__ */ jsx13("div", { className: "w-10 h-10 rounded-md shrink-0 mr-2 bg-surface-100 dark:bg-surface-900 flex items-center justify-center", children: /* @__PURE__ */ jsx13(FolderKanbanIcon2, { size: 16, className: "text-surface-400" }) }),
2793
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
2794
+ /* @__PURE__ */ jsx13("div", { className: "line-clamp-2 text-sm font-medium", children: project.name }),
2795
+ /* @__PURE__ */ jsx13("div", { className: "text-xs text-surface-500 mt-1 line-clamp-2 opacity-80", children: project.description }),
2796
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1 mt-1.5 flex-wrap", children: [
2797
+ /* @__PURE__ */ jsx13(Chip6, { colorScheme: priorityCfg.color, size: "smallest", outlined: true, className: "!text-[10px] !leading-tight !py-0", children: priorityCfg.label }),
2798
+ project.tags.slice(0, 2).map((tag) => /* @__PURE__ */ jsx13(Chip6, { size: "smallest", colorScheme: "cyan", className: "!text-[10px] !leading-tight !py-0 max-w-[80px] truncate", children: tag }, tag))
2799
+ ] }),
2800
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between mt-1.5", children: [
2801
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
2802
+ /* @__PURE__ */ jsx13("div", { className: "w-4 h-4 rounded-full bg-surface-200 dark:bg-surface-700 text-surface-500 flex items-center justify-center text-[8px] font-semibold", children: project.assignee[0] }),
2803
+ /* @__PURE__ */ jsx13(Typography11, { variant: "caption", color: "secondary", className: "truncate max-w-[80px] text-[10px]", children: project.assignee })
2804
+ ] }),
2805
+ /* @__PURE__ */ jsx13(Typography11, { variant: "caption", className: cls9("font-mono text-[10px]", isOverdue ? "text-red-500 font-semibold" : "text-surface-400"), children: project.dueDate })
2806
+ ] })
2807
+ ] })
2808
+ ] }) });
2809
+ }
2810
+ function KanbanBoardDemo() {
2811
+ const [boardData, setBoardData] = useState7(() => SAMPLE_PROJECTS.map((p) => ({ id: p.id, data: p })));
2812
+ const [columns, setColumns] = useState7(STATUS_COLUMNS);
2813
+ const assignColumn = useCallback5((item) => item.data.status, []);
2814
+ const handleItemsReorder = useCallback5((items, moveInfo) => {
2815
+ const updatedItems = items.map((item) => {
2816
+ if (moveInfo && item.id === moveInfo.itemId && moveInfo.sourceColumn !== moveInfo.targetColumn) {
2817
+ return { ...item, data: { ...item.data, status: moveInfo.targetColumn, progress: moveInfo.targetColumn === "done" ? 100 : item.data.progress } };
2818
+ }
2819
+ return item;
2820
+ });
2821
+ setBoardData(updatedItems);
2822
+ }, []);
2823
+ const handleColumnReorder = useCallback5((reordered) => setColumns(reordered), []);
2824
+ const columnLoadingState = useMemo6(() => {
2825
+ const state = {};
2826
+ for (const col of columns) {
2827
+ const count = boardData.filter((item) => item.data.status === col).length;
2828
+ state[col] = { loading: false, hasMore: false, itemCount: count, totalCount: count };
2829
+ }
2830
+ return state;
2831
+ }, [boardData, columns]);
2832
+ return /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
2833
+ /* @__PURE__ */ jsx13(Alert2, { color: "info", size: "small", children: "Drag and drop cards between columns to change status. Columns are also reorderable." }),
2834
+ /* @__PURE__ */ jsx13("div", { className: cls9("rounded-lg border overflow-hidden", defaultBorderMixin4), style: { height: 520 }, children: /* @__PURE__ */ jsx13(
2835
+ KanbanView,
2836
+ {
2837
+ data: boardData,
2838
+ columns,
2839
+ columnLabels: COLUMN_LABELS,
2840
+ columnColors: COLUMN_COLORS,
2841
+ assignColumn,
2842
+ allowColumnReorder: true,
2843
+ onColumnReorder: handleColumnReorder,
2844
+ onItemsReorder: handleItemsReorder,
2845
+ ItemComponent: KanbanProjectCard,
2846
+ columnLoadingState
2847
+ }
2848
+ ) })
2849
+ ] });
2850
+ }
2851
+
2852
+ // src/debug/UIReferenceView.tsx
2853
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
2854
+ var SECTIONS = [
2855
+ { id: "drawer", label: "Drawer", icon: PanelLeftIcon },
2856
+ { id: "appbar", label: "App Bar", icon: AppWindow },
2857
+ { id: "tabs", label: "Tabs", icon: ListIcon2 },
2858
+ { id: "editor-sidebar", label: "Editor Sidebar", icon: ColumnsIcon },
2859
+ { id: "empty-states", label: "Empty States", icon: FileIcon },
2860
+ { id: "typography", label: "Typography", icon: TypeIcon },
2861
+ { id: "buttons", label: "Buttons", icon: PlusIcon },
2862
+ { id: "inputs", label: "Form Inputs", icon: FileTextIcon2 },
2863
+ { id: "chips-alerts", label: "Chips & Alerts", icon: AlertCircleIcon },
2864
+ { id: "users", label: "Management", icon: UserIcon },
2865
+ { id: "user-dialog", label: "Form Dialog", icon: CircleUserIcon },
2866
+ { id: "crm-dashboard", label: "CRM Dashboard", icon: LayoutGridIcon2 },
2867
+ { id: "collection-table", label: "Collection Table", icon: ListIcon2 },
2868
+ { id: "card-view", label: "Card View", icon: LayoutGridIcon2 },
2869
+ { id: "kanban-board", label: "Kanban Board", icon: KanbanIcon }
2870
+ ];
2871
+ function UIReferenceView() {
2872
+ const [activeSection, setActiveSection] = useState8("drawer");
2873
+ const scrollContainerRef = React10.useRef(null);
2874
+ const scrollTo = (id) => {
2875
+ const el = document.getElementById(id);
2876
+ const container = scrollContainerRef.current;
2877
+ if (el && container) {
2878
+ const offsetTop = el.offsetTop - container.offsetTop;
2879
+ container.scrollTo({ top: offsetTop, behavior: "smooth" });
2880
+ }
2881
+ setActiveSection(id);
2882
+ };
2883
+ return /* @__PURE__ */ jsxs14("div", { className: "flex w-full", children: [
2884
+ /* @__PURE__ */ jsxs14("div", { className: cls10("flex flex-col sticky top-0 h-screen grow-0 shrink-0 w-[232px] border-r", defaultBorderMixin5), children: [
2885
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center shrink-0 pt-4 pb-2 px-2", children: [
2886
+ /* @__PURE__ */ jsx14("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[40px]", children: /* @__PURE__ */ jsx14(RebaseLogo, { width: "28px", height: "28px" }) }),
2887
+ /* @__PURE__ */ jsx14(Typography12, { variant: "subtitle1", noWrap: true, className: "truncate", children: "UI Ref" })
2888
+ ] }),
2889
+ /* @__PURE__ */ jsx14("div", { className: "mt-3 flex-grow overflow-scroll no-scrollbar", children: /* @__PURE__ */ jsxs14("div", { className: "my-2 mx-2 flex flex-col", children: [
2890
+ /* @__PURE__ */ jsxs14("div", { className: cls10("pl-4 pr-2 py-1 flex flex-row items-center transition-colors cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-700/50 rounded-t-lg bg-surface-50 dark:bg-surface-950/30"), children: [
2891
+ /* @__PURE__ */ jsx14(ChevronDownIcon, { size: iconSize2.smallest, className: "text-surface-500 dark:text-surface-400 transition-transform duration-200 mr-1" }),
2892
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "font-medium flex-grow line-clamp-1", children: "SECTIONS" })
2893
+ ] }),
2894
+ /* @__PURE__ */ jsx14("div", { className: "overflow-hidden bg-surface-50 dark:bg-surface-950/30 rounded-b-lg", children: SECTIONS.map((s) => {
2895
+ const IconComponent = s.icon;
2896
+ return /* @__PURE__ */ jsx14("div", { children: /* @__PURE__ */ jsxs14(
2897
+ "div",
2898
+ {
2899
+ onClick: () => scrollTo(s.id),
2900
+ className: cls10(
2901
+ "rounded-lg truncate group/nav",
2902
+ "hover:bg-primary/5 dark:hover:bg-primary/5 text-text-primary dark:text-surface-200 hover:text-surface-900 dark:hover:text-white",
2903
+ "flex flex-row items-center",
2904
+ "pr-4 h-10",
2905
+ "font-medium text-xs cursor-pointer",
2906
+ activeSection === s.id ? "bg-primary/8 dark:bg-primary/10 text-primary dark:text-primary" : ""
2907
+ ),
2908
+ children: [
2909
+ /* @__PURE__ */ jsx14("div", { className: cls10("shrink-0 flex items-center justify-center w-[56px] h-[40px] text-surface-500 dark:text-text-secondary-dark transition-colors duration-150 group-hover/nav:text-primary", activeSection === s.id && "text-primary dark:text-primary"), children: /* @__PURE__ */ jsx14(IconComponent, { size: iconSize2.small }) }),
2910
+ /* @__PURE__ */ jsx14("div", { className: "text-text-primary dark:text-surface-200 opacity-100 font-inherit truncate space-x-2", children: s.label.toUpperCase() })
2911
+ ]
2912
+ }
2913
+ ) }, s.id);
2914
+ }) })
2915
+ ] }) }),
2916
+ /* @__PURE__ */ jsx14("div", { className: cls10("shrink-0 mt-auto border-t px-2 py-2", defaultBorderMixin5), children: /* @__PURE__ */ jsxs14("div", { className: cls10(
2917
+ "flex flex-row items-center rounded-lg cursor-pointer",
2918
+ "hover:bg-surface-accent-100 dark:hover:bg-surface-800",
2919
+ "transition-colors duration-150",
2920
+ "py-2"
2921
+ ), children: [
2922
+ /* @__PURE__ */ jsx14("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[24px] text-surface-500 dark:text-surface-400", children: /* @__PURE__ */ jsx14(ChevronsLeftIcon, { size: iconSize2.small }) }),
2923
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", className: "text-surface-500 dark:text-surface-400 select-none whitespace-nowrap", children: "Collapse" })
2924
+ ] }) })
2925
+ ] }),
2926
+ /* @__PURE__ */ jsxs14("div", { ref: scrollContainerRef, className: "flex-1 min-w-0", children: [
2927
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "drawer", title: "Drawer \u2014 DefaultDrawer.tsx", children: [
2928
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
2929
+ "The drawer wraps ",
2930
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "DrawerLogo" }),
2931
+ ", scrollable ",
2932
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "DrawerNavigationGroup" }),
2933
+ "s, and ",
2934
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "DrawerToggle" }),
2935
+ ". Two visual states: collapsed (icon only, 72px) and expanded (280px)."
2936
+ ] }),
2937
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-6 flex-wrap", children: [
2938
+ /* @__PURE__ */ jsxs14("div", { children: [
2939
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "Collapsed (72px)" }),
2940
+ /* @__PURE__ */ jsxs14("div", { className: cls10("flex flex-col h-72 relative w-[72px] border rounded-lg overflow-hidden bg-white dark:bg-surface-900", defaultBorderMixin5), children: [
2941
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-row items-center shrink-0 pt-4 pb-2 px-2", children: /* @__PURE__ */ jsx14("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[40px]", children: /* @__PURE__ */ jsx14(RebaseLogo, { width: "28px", height: "28px" }) }) }),
2942
+ /* @__PURE__ */ jsx14("div", { className: "mt-3 flex-grow overflow-hidden", children: /* @__PURE__ */ jsx14("div", { className: "my-2 mx-2 flex flex-col", children: /* @__PURE__ */ jsx14("div", { className: "overflow-hidden rounded-lg bg-surface-50 dark:bg-surface-950/30", children: [/* @__PURE__ */ jsx14(FolderIcon, { size: iconSize2.small }, "folder"), /* @__PURE__ */ jsx14(UserIcon, { size: iconSize2.small }, "user"), /* @__PURE__ */ jsx14(TagIcon, { size: iconSize2.small }, "tag")].map((icon, i) => /* @__PURE__ */ jsx14("div", { className: "rounded-lg truncate hover:bg-primary/5 dark:hover:bg-primary/5 flex flex-row items-center h-10", children: /* @__PURE__ */ jsx14("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[40px] text-text-secondary dark:text-text-secondary-dark", children: icon }) }, i)) }) }) }),
2943
+ /* @__PURE__ */ jsx14("div", { className: cls10("shrink-0 mt-auto border-t px-2 py-2", defaultBorderMixin5), children: /* @__PURE__ */ jsx14("div", { className: "flex flex-row items-center rounded-lg cursor-pointer hover:bg-surface-accent-100 dark:hover:bg-surface-800 transition-colors duration-150 py-2", children: /* @__PURE__ */ jsx14("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[24px] text-surface-500 dark:text-surface-400", children: /* @__PURE__ */ jsx14(ChevronsRightIcon, { size: iconSize2.small }) }) }) })
2944
+ ] })
2945
+ ] }),
2946
+ /* @__PURE__ */ jsxs14("div", { children: [
2947
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "Expanded (280px)" }),
2948
+ /* @__PURE__ */ jsxs14("div", { className: cls10("flex flex-col h-72 relative w-[280px] border rounded-lg overflow-hidden bg-white dark:bg-surface-900", defaultBorderMixin5), children: [
2949
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center shrink-0 pt-4 pb-2 px-2", children: [
2950
+ /* @__PURE__ */ jsx14("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[40px]", children: /* @__PURE__ */ jsx14(RebaseLogo, { width: "28px", height: "28px" }) }),
2951
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-row items-center overflow-hidden transition-all duration-200 ease-in-out opacity-100 w-full ml-1", children: /* @__PURE__ */ jsx14(Typography12, { variant: "subtitle1", noWrap: true, className: "truncate", children: "Rebase" }) })
2952
+ ] }),
2953
+ /* @__PURE__ */ jsx14("div", { className: "mt-3 flex-grow overflow-hidden", children: /* @__PURE__ */ jsxs14("div", { className: "my-2 mx-2 flex flex-col", children: [
2954
+ /* @__PURE__ */ jsxs14("div", { className: "pl-4 pr-2 py-1 flex flex-row items-center transition-colors cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-700/50 rounded-t-lg bg-surface-50 dark:bg-surface-950/30", children: [
2955
+ /* @__PURE__ */ jsx14(ChevronDownIcon, { size: iconSize2.smallest, className: "text-surface-500 dark:text-surface-400 mr-1" }),
2956
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "font-medium flex-grow line-clamp-1", children: "CONTENT" })
2957
+ ] }),
2958
+ /* @__PURE__ */ jsx14("div", { className: "overflow-hidden bg-surface-50 dark:bg-surface-950/30 rounded-b-lg", children: [
2959
+ {
2960
+ label: "Posts",
2961
+ icon: /* @__PURE__ */ jsx14(FolderIcon, { size: iconSize2.small }),
2962
+ active: true
2963
+ },
2964
+ {
2965
+ label: "Authors",
2966
+ icon: /* @__PURE__ */ jsx14(UserIcon, { size: iconSize2.small }),
2967
+ active: false
2968
+ },
2969
+ {
2970
+ label: "Tags",
2971
+ icon: /* @__PURE__ */ jsx14(TagIcon, { size: iconSize2.small }),
2972
+ active: false
2973
+ }
2974
+ ].map(({ label, icon, active }) => /* @__PURE__ */ jsxs14("div", { className: cls10(
2975
+ "rounded-lg truncate hover:bg-primary/5 dark:hover:bg-primary/5 text-text-primary dark:text-surface-200 hover:text-surface-900 dark:hover:text-white flex flex-row items-center pr-4 h-10 font-medium text-xs cursor-pointer",
2976
+ active ? "bg-primary/8 dark:bg-primary/10 text-primary dark:text-primary" : ""
2977
+ ), children: [
2978
+ /* @__PURE__ */ jsx14("div", { className: cls10("shrink-0 flex items-center justify-center w-[56px] h-[40px] transition-colors duration-150", active ? "text-primary dark:text-primary" : "text-surface-500 dark:text-text-secondary-dark"), children: icon }),
2979
+ /* @__PURE__ */ jsx14("div", { className: "text-text-primary dark:text-surface-200 font-inherit truncate", children: label.toUpperCase() })
2980
+ ] }, label)) })
2981
+ ] }) }),
2982
+ /* @__PURE__ */ jsx14("div", { className: cls10("shrink-0 mt-auto border-t px-2 py-2", defaultBorderMixin5), children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center rounded-lg cursor-pointer hover:bg-surface-accent-100 dark:hover:bg-surface-800 transition-colors duration-150 py-2", children: [
2983
+ /* @__PURE__ */ jsx14("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[24px] text-surface-500 dark:text-surface-400", children: /* @__PURE__ */ jsx14(ChevronsLeftIcon, { size: iconSize2.small }) }),
2984
+ /* @__PURE__ */ jsx14("div", { className: "overflow-hidden transition-all duration-200 ease-in-out opacity-100 w-auto", children: /* @__PURE__ */ jsx14(Typography12, { variant: "body2", className: "text-surface-500 dark:text-surface-400 select-none whitespace-nowrap", children: "Collapse" }) })
2985
+ ] }) })
2986
+ ] })
2987
+ ] })
2988
+ ] })
2989
+ ] }),
2990
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "appbar", title: "App Bar \u2014 DefaultAppBar.tsx", children: [
2991
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
2992
+ "Fixed at top (",
2993
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "h-16 absolute top-0" }),
2994
+ "). Contains breadcrumbs (caption + body2), Content/Studio pill toggle, theme menu, and user avatar menu via ",
2995
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Menu" }),
2996
+ "."
2997
+ ] }),
2998
+ /* @__PURE__ */ jsxs14("div", { className: cls10("w-full h-16 flex flex-row gap-2 px-4 items-center border rounded-lg relative", defaultBorderMixin5), children: [
2999
+ /* @__PURE__ */ jsx14("div", { className: "mr-8 hidden lg:block", children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-row gap-2 items-center", children: [
3000
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", children: "/" }),
3001
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center gap-2 whitespace-nowrap", children: [
3002
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", children: "Posts" }),
3003
+ /* @__PURE__ */ jsx14("span", { className: "text-xs text-surface-accent-500 dark:text-surface-accent-400 bg-surface-100 dark:bg-surface-700 px-1 py-0 rounded", children: "42" })
3004
+ ] }),
3005
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", children: "/" }),
3006
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-row items-center gap-2 whitespace-nowrap", children: /* @__PURE__ */ jsx14(Typography12, { variant: "body2", children: "My Post" }) })
3007
+ ] }) }),
3008
+ /* @__PURE__ */ jsx14("div", { className: "grow" }),
3009
+ /* @__PURE__ */ jsxs14("div", { className: cls10("mr-2 hidden sm:flex bg-surface-100 dark:bg-surface-950 rounded-lg p-0.5 border", defaultBorderMixin5), children: [
3010
+ /* @__PURE__ */ jsx14("button", { className: cls10("px-3 py-1 text-xs font-semibold rounded-md transition-all", "bg-white dark:bg-surface-900 shadow-sm text-primary dark:text-primary-400"), children: "Content" }),
3011
+ /* @__PURE__ */ jsx14("button", { className: cls10("px-3 py-1 text-xs font-semibold rounded-md transition-all", "text-surface-500 hover:text-surface-900 dark:hover:text-white"), children: "Studio" })
3012
+ ] }),
3013
+ /* @__PURE__ */ jsxs14(Menu, { trigger: /* @__PURE__ */ jsx14(IconButton4, { color: "inherit", children: /* @__PURE__ */ jsx14(MoonIcon, {}) }), children: [
3014
+ /* @__PURE__ */ jsxs14(MenuItem, { children: [
3015
+ /* @__PURE__ */ jsx14(MoonIcon, { size: iconSize2.smallest }),
3016
+ " Dark"
3017
+ ] }),
3018
+ /* @__PURE__ */ jsxs14(MenuItem, { children: [
3019
+ /* @__PURE__ */ jsx14(SunIcon, { size: iconSize2.smallest }),
3020
+ " Light"
3021
+ ] }),
3022
+ /* @__PURE__ */ jsxs14(MenuItem, { children: [
3023
+ /* @__PURE__ */ jsx14(SunMoonIcon, { size: iconSize2.smallest }),
3024
+ " System"
3025
+ ] })
3026
+ ] }),
3027
+ /* @__PURE__ */ jsxs14(Menu, { trigger: /* @__PURE__ */ jsx14(Avatar, { children: "A" }), children: [
3028
+ /* @__PURE__ */ jsxs14("div", { className: "px-4 py-2 mb-2", children: [
3029
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body1", color: "secondary", children: "Alice Johnson" }),
3030
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", color: "secondary", children: "alice@example.com" })
3031
+ ] }),
3032
+ /* @__PURE__ */ jsxs14(MenuItem, { children: [
3033
+ /* @__PURE__ */ jsx14(SettingsIcon2, {}),
3034
+ " Account Settings"
3035
+ ] }),
3036
+ /* @__PURE__ */ jsxs14(MenuItem, { children: [
3037
+ /* @__PURE__ */ jsx14(LogOutIcon, {}),
3038
+ " Log Out"
3039
+ ] })
3040
+ ] })
3041
+ ] })
3042
+ ] }),
3043
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "tabs", title: "Tabs \u2014 Tabs.tsx", children: [
3044
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3045
+ "All editor components use ",
3046
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: 'variant="boxy"' }),
3047
+ " tabs for sidebar navigation. The boxy variant provides a segmented, flat tab bar that integrates tightly with editor chrome."
3048
+ ] }),
3049
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-6", children: [
3050
+ /* @__PURE__ */ jsxs14("div", { children: [
3051
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: 'variant="default"' }),
3052
+ /* @__PURE__ */ jsxs14(Tabs, { value: "tab1", onValueChange: () => {
3053
+ }, children: [
3054
+ /* @__PURE__ */ jsx14(Tab, { value: "tab1", children: "Schema" }),
3055
+ /* @__PURE__ */ jsx14(Tab, { value: "tab2", children: "Snippets" }),
3056
+ /* @__PURE__ */ jsx14(Tab, { value: "tab3", children: "History" })
3057
+ ] })
3058
+ ] }),
3059
+ /* @__PURE__ */ jsxs14("div", { children: [
3060
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: 'variant="boxy" (Editor Standard)' }),
3061
+ /* @__PURE__ */ jsxs14("div", { className: cls10("border rounded-lg overflow-hidden w-[320px]", defaultBorderMixin5), children: [
3062
+ /* @__PURE__ */ jsxs14(Tabs, { value: "schema", onValueChange: () => {
3063
+ }, variant: "boxy", className: "border-b border-surface-200 dark:border-surface-950", children: [
3064
+ /* @__PURE__ */ jsx14(Tab, { value: "schema", children: "Schema" }),
3065
+ /* @__PURE__ */ jsx14(Tab, { value: "snippets", children: "Snippets" }),
3066
+ /* @__PURE__ */ jsx14(Tab, { value: "history", children: "History" })
3067
+ ] }),
3068
+ /* @__PURE__ */ jsxs14("div", { className: cls10("p-3 border-b flex justify-between items-center bg-surface-50 dark:bg-surface-900", defaultBorderMixin5), children: [
3069
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", className: "font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark", children: "TABLES" }),
3070
+ /* @__PURE__ */ jsx14(IconButton4, { size: "small", children: /* @__PURE__ */ jsx14(SettingsIcon2, { size: iconSize2.smallest }) })
3071
+ ] }),
3072
+ /* @__PURE__ */ jsx14("div", { className: "p-2 h-24", children: /* @__PURE__ */ jsx14(Typography12, { variant: "caption", className: "text-text-disabled dark:text-text-disabled-dark italic p-2", children: "Tab content area\u2026" }) })
3073
+ ] })
3074
+ ] }),
3075
+ /* @__PURE__ */ jsxs14("div", { children: [
3076
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Toolbar Tabs (boxy, inline with controls)" }),
3077
+ /* @__PURE__ */ jsxs14("div", { className: cls10("border rounded-lg overflow-hidden flex items-center justify-between pr-2 bg-white dark:bg-surface-950", defaultBorderMixin5), children: [
3078
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center", children: [
3079
+ /* @__PURE__ */ jsxs14(Tabs, { value: "query1", onValueChange: () => {
3080
+ }, variant: "boxy", className: "w-[unset] flex-shrink-0", children: [
3081
+ /* @__PURE__ */ jsxs14(Tab, { value: "query1", className: "flex items-center gap-1.5", children: [
3082
+ /* @__PURE__ */ jsx14("svg", { className: "w-3.5 h-3.5 text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4" }) }),
3083
+ "Query 1"
3084
+ ] }),
3085
+ /* @__PURE__ */ jsxs14(Tab, { value: "query2", className: "flex items-center gap-1.5", children: [
3086
+ /* @__PURE__ */ jsx14("svg", { className: "w-3.5 h-3.5 text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4" }) }),
3087
+ "Query 2"
3088
+ ] })
3089
+ ] }),
3090
+ /* @__PURE__ */ jsx14(IconButton4, { size: "small", className: "ml-2 flex-shrink-0", children: /* @__PURE__ */ jsx14(PlusIcon, {}) })
3091
+ ] }),
3092
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1.5", children: [
3093
+ /* @__PURE__ */ jsx14(Button8, { variant: "text", size: "small", children: "Explain" }),
3094
+ /* @__PURE__ */ jsx14("div", { className: "h-4 w-px bg-surface-200 dark:bg-surface-950" }),
3095
+ /* @__PURE__ */ jsx14(Button8, { size: "small", color: "primary", children: "Run" })
3096
+ ] })
3097
+ ] })
3098
+ ] })
3099
+ ] })
3100
+ ] }),
3101
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "editor-sidebar", title: "Editor Sidebar \u2014 Harmonized Pattern", children: [
3102
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3103
+ "All studio editor components (SQL, JS, RLS, Collection) share the same underlying sidebar foundation:",
3104
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: 'Tabs variant="boxy"' }),
3105
+ " at top (optional) \u2192 section header with uppercase label \u2192 scrollable list. While SQL/JS/RLS use dense tree entries, the Collection Schema Editor uses larger items (",
3106
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "px-3 py-2" }),
3107
+ ", ",
3108
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "text-sm" }),
3109
+ ") suitable for primary navigation."
3110
+ ] }),
3111
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-6 flex-wrap", children: [
3112
+ /* @__PURE__ */ jsxs14("div", { children: [
3113
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "SQL Editor Sidebar" }),
3114
+ /* @__PURE__ */ jsxs14("div", { className: cls10("flex flex-col h-72 w-[240px] border rounded-lg overflow-hidden", defaultBorderMixin5), children: [
3115
+ /* @__PURE__ */ jsxs14(Tabs, { value: "schema", onValueChange: () => {
3116
+ }, variant: "boxy", className: "border-b border-surface-200 dark:border-surface-950", children: [
3117
+ /* @__PURE__ */ jsx14(Tab, { value: "schema", children: "Schema" }),
3118
+ /* @__PURE__ */ jsx14(Tab, { value: "snippets", children: "Snippets" }),
3119
+ /* @__PURE__ */ jsx14(Tab, { value: "history", children: "History" })
3120
+ ] }),
3121
+ /* @__PURE__ */ jsxs14("div", { className: cls10("p-3 border-b flex justify-between items-center bg-surface-50 dark:bg-surface-900", defaultBorderMixin5), children: [
3122
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", className: "font-semibold uppercase tracking-wider text-text-secondary dark:text-text-secondary-dark", children: "TABLES" }),
3123
+ /* @__PURE__ */ jsx14(IconButton4, { size: "small", children: /* @__PURE__ */ jsx14(SettingsIcon2, { size: iconSize2.smallest }) })
3124
+ ] }),
3125
+ /* @__PURE__ */ jsx14("div", { className: "flex-grow overflow-y-auto no-scrollbar p-1", children: /* @__PURE__ */ jsxs14("div", { className: "mb-2", children: [
3126
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-900 rounded transition-colors", children: [
3127
+ /* @__PURE__ */ jsx14("svg", { className: "w-3 h-3 mr-1 rotate-90", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx14("path", { d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" }) }),
3128
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", className: "text-text-primary dark:text-text-primary-dark font-medium text-xs", children: "public" })
3129
+ ] }),
3130
+ /* @__PURE__ */ jsx14("div", { className: "ml-3 mt-1 space-y-1", children: ["users", "posts", "comments"].map((t) => /* @__PURE__ */ jsxs14("div", { className: "flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-900 rounded transition-colors group", children: [
3131
+ /* @__PURE__ */ jsx14("svg", { className: "w-3.5 h-3.5 mr-1 shrink-0 text-text-disabled dark:text-text-disabled-dark", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" }) }),
3132
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark text-xs truncate", children: t })
3133
+ ] }, t)) })
3134
+ ] }) })
3135
+ ] })
3136
+ ] }),
3137
+ /* @__PURE__ */ jsxs14("div", { children: [
3138
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "RLS Editor Sidebar" }),
3139
+ /* @__PURE__ */ jsxs14("div", { className: cls10("flex flex-col h-72 w-[240px] border rounded-lg overflow-hidden", defaultBorderMixin5), children: [
3140
+ /* @__PURE__ */ jsxs14(Tabs, { value: "tables", onValueChange: () => {
3141
+ }, variant: "boxy", className: "border-b border-surface-200 dark:border-surface-950", children: [
3142
+ /* @__PURE__ */ jsx14(Tab, { value: "tables", children: "Tables" }),
3143
+ /* @__PURE__ */ jsx14(Tab, { value: "info", children: "Info" })
3144
+ ] }),
3145
+ /* @__PURE__ */ jsxs14("div", { className: cls10("p-3 border-b flex justify-between items-center bg-surface-50 dark:bg-surface-900", defaultBorderMixin5), children: [
3146
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", className: "font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark", children: "RLS" }),
3147
+ /* @__PURE__ */ jsx14(IconButton4, { size: "small", children: /* @__PURE__ */ jsx14(SettingsIcon2, { size: iconSize2.smallest }) })
3148
+ ] }),
3149
+ /* @__PURE__ */ jsx14("div", { className: "flex-grow overflow-y-auto no-scrollbar p-1", children: /* @__PURE__ */ jsxs14("div", { className: "mb-2", children: [
3150
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-900 rounded transition-colors", children: [
3151
+ /* @__PURE__ */ jsx14("svg", { className: "w-3 h-3 mr-1 rotate-90", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx14("path", { d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" }) }),
3152
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", className: "text-text-primary dark:text-text-primary-dark font-medium text-xs", children: "public" })
3153
+ ] }),
3154
+ /* @__PURE__ */ jsx14("div", { className: "ml-3 mt-1 space-y-0.5", children: [{
3155
+ name: "users",
3156
+ enabled: true
3157
+ }, {
3158
+ name: "posts",
3159
+ enabled: true
3160
+ }, {
3161
+ name: "sessions",
3162
+ enabled: false
3163
+ }].map((t) => /* @__PURE__ */ jsxs14("div", { className: cls10("flex items-center p-1 cursor-pointer rounded transition-colors", t.name === "users" ? "bg-primary/10 text-primary dark:bg-primary/20" : "hover:bg-surface-100 dark:hover:bg-surface-900 text-text-secondary"), children: [
3164
+ /* @__PURE__ */ jsx14("svg", { className: "w-3.5 h-3.5 mr-1 shrink-0 text-text-disabled", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" }) }),
3165
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", className: "text-xs truncate flex-1", children: t.name }),
3166
+ /* @__PURE__ */ jsx14("div", { className: cls10("w-1.5 h-1.5 rounded-full shrink-0", t.enabled ? "bg-green-500" : "bg-orange-400 opacity-50") })
3167
+ ] }, t.name)) })
3168
+ ] }) })
3169
+ ] })
3170
+ ] }),
3171
+ /* @__PURE__ */ jsxs14("div", { children: [
3172
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "Collection Editor Sidebar" }),
3173
+ /* @__PURE__ */ jsxs14("div", { className: cls10("flex flex-col h-72 w-[240px] border rounded-lg overflow-hidden bg-white dark:bg-surface-950", defaultBorderMixin5), children: [
3174
+ /* @__PURE__ */ jsxs14("div", { className: cls10("p-3 border-b flex justify-between items-center bg-surface-50 dark:bg-surface-900", defaultBorderMixin5), children: [
3175
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", className: "font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark", children: "COLLECTIONS" }),
3176
+ /* @__PURE__ */ jsx14(IconButton4, { size: "small", children: /* @__PURE__ */ jsx14(PlusIcon, { size: iconSize2.smallest }) })
3177
+ ] }),
3178
+ /* @__PURE__ */ jsx14("div", { className: "flex-grow overflow-y-auto no-scrollbar p-2 space-y-0.5", children: [{ name: "Authors" }, {
3179
+ name: "Posts",
3180
+ selected: true
3181
+ }, { name: "Tags" }].map((c) => /* @__PURE__ */ jsxs14("div", { className: cls10("flex items-center gap-3 px-3 py-2 cursor-pointer rounded-md text-sm transition-colors", c.selected ? "bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light" : "hover:bg-surface-100 dark:hover:bg-surface-900 text-text-secondary dark:text-text-secondary-dark"), children: [
3182
+ /* @__PURE__ */ jsx14(FolderIcon, { size: iconSize2.small, className: cls10(c.selected ? "text-primary dark:text-primary-light" : "text-text-secondary dark:text-text-secondary-dark") }),
3183
+ /* @__PURE__ */ jsx14("span", { className: "truncate flex-1", children: c.name })
3184
+ ] }, c.name)) })
3185
+ ] })
3186
+ ] })
3187
+ ] })
3188
+ ] }),
3189
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "empty-states", title: "Empty States \u2014 Canonical Pattern", children: [
3190
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3191
+ "All empty / placeholder states share the same layout: a centered ",
3192
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "flex-col" }),
3193
+ " container with ",
3194
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: 'Typography variant="label"' }),
3195
+ " for the message and a ",
3196
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Button" }),
3197
+ " with ",
3198
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "AddIcon" }),
3199
+ " for the primary action. Sources: ",
3200
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "CollectionPropertiesEditorForm" }),
3201
+ ", ",
3202
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "CollectionsStudioView" }),
3203
+ ", ",
3204
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "CollectionStudioView" }),
3205
+ "."
3206
+ ] }),
3207
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-6 flex-wrap", children: [
3208
+ /* @__PURE__ */ jsxs14("div", { children: [
3209
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "Property Editor (no selection)" }),
3210
+ /* @__PURE__ */ jsx14("div", { className: cls10("flex flex-col items-center justify-center h-48 w-[320px] border rounded-lg", defaultBorderMixin5), children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center h-full gap-4", children: [
3211
+ /* @__PURE__ */ jsx14(Typography12, { variant: "label", className: "text-center px-4", children: "Select a property to edit it" }),
3212
+ /* @__PURE__ */ jsxs14(Button8, { children: [
3213
+ /* @__PURE__ */ jsx14(PlusIcon, {}),
3214
+ "Add new property"
3215
+ ] })
3216
+ ] }) })
3217
+ ] }),
3218
+ /* @__PURE__ */ jsxs14("div", { children: [
3219
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "Property Editor (empty collection)" }),
3220
+ /* @__PURE__ */ jsx14("div", { className: cls10("flex flex-col items-center justify-center h-48 w-[320px] border rounded-lg", defaultBorderMixin5), children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center h-full gap-4", children: [
3221
+ /* @__PURE__ */ jsx14(Typography12, { variant: "label", className: "text-center px-4", children: "Now you can add your first property" }),
3222
+ /* @__PURE__ */ jsxs14(Button8, { children: [
3223
+ /* @__PURE__ */ jsx14(PlusIcon, {}),
3224
+ "Add new property"
3225
+ ] })
3226
+ ] }) })
3227
+ ] }),
3228
+ /* @__PURE__ */ jsxs14("div", { children: [
3229
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-1", children: "Collection ListIcon (no selection)" }),
3230
+ /* @__PURE__ */ jsx14("div", { className: cls10("flex flex-col items-center justify-center h-48 w-[320px] border rounded-lg", defaultBorderMixin5), children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center h-full gap-4", children: [
3231
+ /* @__PURE__ */ jsx14(Typography12, { variant: "label", className: "text-center px-4", children: "Select a collection or create a new one to start editing" }),
3232
+ /* @__PURE__ */ jsxs14(Button8, { children: [
3233
+ /* @__PURE__ */ jsx14(PlusIcon, {}),
3234
+ "Add new collection"
3235
+ ] })
3236
+ ] }) })
3237
+ ] })
3238
+ ] })
3239
+ ] }),
3240
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "typography", title: "Typography", children: [
3241
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3242
+ "All variants from ",
3243
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Typography" }),
3244
+ ". Colors: primary (default), secondary, disabled, error."
3245
+ ] }),
3246
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-3", children: ["h1", "h2", "h3", "h4", "h5", "h6", "lead", "subtitle1", "subtitle2", "body1", "body2", "caption", "label", "button"].map((v) => /* @__PURE__ */ jsxs14("div", { className: cls10("flex items-baseline gap-4 border-b pb-3 last:border-0", defaultBorderMixin5), children: [
3247
+ /* @__PURE__ */ jsx14("span", { className: "w-24 shrink-0 text-xs text-surface-400 font-mono", children: v }),
3248
+ /* @__PURE__ */ jsx14(Typography12, { variant: v, component: "p", children: "The quick brown fox jumps over the lazy dog" })
3249
+ ] }, v)) }),
3250
+ /* @__PURE__ */ jsx14("div", { className: "flex gap-4 flex-wrap mt-4", children: ["primary", "secondary", "disabled", "error"].map((c) => /* @__PURE__ */ jsxs14(Typography12, { color: c, children: [
3251
+ 'color="',
3252
+ c,
3253
+ '"'
3254
+ ] }, c)) }),
3255
+ /* @__PURE__ */ jsxs14("div", { className: cls10("mt-8 pt-6 border-t", defaultBorderMixin5), children: [
3256
+ /* @__PURE__ */ jsx14(Typography12, { variant: "subtitle2", className: "block mb-1", children: "Data tiers" }),
3257
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "block mb-5 max-w-[65ch]", children: [
3258
+ "For values that are looked up rather than read: a field name, a measurement, a headline figure. ",
3259
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "mono" }),
3260
+ " and",
3261
+ " ",
3262
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "stat" }),
3263
+ " both carry",
3264
+ " ",
3265
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "tabular-nums" }),
3266
+ ", so a column of them keeps its decimal points aligned and a live counter does not jitter as its digits change width."
3267
+ ] }),
3268
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap items-start gap-x-12 gap-y-5", children: [
3269
+ ["Region", "europe-west1"],
3270
+ ["Took", "32.2s"],
3271
+ ["Last run", "16/08/2026, 05:30:32"]
3272
+ ].map(([label, value]) => /* @__PURE__ */ jsxs14("div", { children: [
3273
+ /* @__PURE__ */ jsx14(Typography12, { variant: "micro", component: "div", color: "secondary", className: "block", children: label }),
3274
+ /* @__PURE__ */ jsx14(Typography12, { variant: "mono", component: "div", className: "block mt-1 text-sm", children: value })
3275
+ ] }, label)) }),
3276
+ /* @__PURE__ */ jsxs14("div", { className: "mt-6", children: [
3277
+ /* @__PURE__ */ jsx14("span", { className: "text-xs text-surface-400 font-mono", children: "stat" }),
3278
+ /* @__PURE__ */ jsx14(Typography12, { variant: "stat", component: "div", className: "block mt-1", children: "1,284" })
3279
+ ] })
3280
+ ] })
3281
+ ] }),
3282
+ /* @__PURE__ */ jsx14(SectionBlock, { id: "buttons", title: "Buttons", children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-6", children: [
3283
+ ["filled", "text"].map((variant) => /* @__PURE__ */ jsxs14("div", { children: [
3284
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: [
3285
+ 'variant="',
3286
+ variant,
3287
+ '"'
3288
+ ] }),
3289
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-3 items-center", children: [
3290
+ ["primary", "secondary", "text", "error", "neutral"].map((color) => /* @__PURE__ */ jsx14(Button8, { variant, color, children: color.charAt(0).toUpperCase() + color.slice(1) }, color)),
3291
+ /* @__PURE__ */ jsx14(Button8, { variant, disabled: true, children: "Disabled" })
3292
+ ] })
3293
+ ] }, variant)),
3294
+ /* @__PURE__ */ jsxs14("div", { children: [
3295
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "sizes" }),
3296
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap items-end gap-3", children: ["small", "medium", "large", "xl", "2xl"].map((s) => /* @__PURE__ */ jsx14(Button8, { size: s, children: s.charAt(0).toUpperCase() + s.slice(1) }, s)) })
3297
+ ] }),
3298
+ /* @__PURE__ */ jsxs14("div", { children: [
3299
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "IconButton \u2014 sizes" }),
3300
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-3 items-end", children: [
3301
+ [
3302
+ { s: "smallest", icon: /* @__PURE__ */ jsx14(PencilIcon2, { size: 14 }) },
3303
+ { s: "small", icon: /* @__PURE__ */ jsx14(PencilIcon2, { size: 16 }) },
3304
+ { s: "medium", icon: /* @__PURE__ */ jsx14(PencilIcon2, { size: 20 }) },
3305
+ { s: "large", icon: /* @__PURE__ */ jsx14(PencilIcon2, { size: 24 }) }
3306
+ ].map(({ s, icon }) => /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-1", children: [
3307
+ /* @__PURE__ */ jsx14(IconButton4, { size: s, children: icon }),
3308
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", children: s.charAt(0).toUpperCase() + s.slice(1) })
3309
+ ] }, s)),
3310
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-1", children: [
3311
+ /* @__PURE__ */ jsx14(IconButton4, { disabled: true, children: /* @__PURE__ */ jsx14(Trash2Icon3, { size: 20 }) }),
3312
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", children: "Disabled" })
3313
+ ] }),
3314
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-1", children: [
3315
+ /* @__PURE__ */ jsx14(IconButton4, { variant: "filled", children: /* @__PURE__ */ jsx14(PlusIcon, { size: 20 }) }),
3316
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", children: "Filled" })
3317
+ ] }),
3318
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-1", children: [
3319
+ /* @__PURE__ */ jsx14(IconButton4, { shape: "square", children: /* @__PURE__ */ jsx14(SettingsIcon2, { size: 20 }) }),
3320
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", children: "Square" })
3321
+ ] })
3322
+ ] })
3323
+ ] }),
3324
+ /* @__PURE__ */ jsxs14("div", { children: [
3325
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "LoadingButton" }),
3326
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-3", children: [
3327
+ /* @__PURE__ */ jsx14(LoadingButton, { loading: true, children: "Saving\u2026" }),
3328
+ /* @__PURE__ */ jsx14(LoadingButton, { loading: false, children: "Idle" })
3329
+ ] })
3330
+ ] })
3331
+ ] }) }),
3332
+ /* @__PURE__ */ jsx14(SectionBlock, { id: "inputs", title: "Form Inputs", children: /* @__PURE__ */ jsxs14("div", { className: "grid grid-cols-12 gap-4", children: [
3333
+ /* @__PURE__ */ jsxs14("div", { className: "col-span-12 sm:col-span-6", children: [
3334
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "TextField" }),
3335
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-3", children: [
3336
+ /* @__PURE__ */ jsx14(TextField2, { label: "Default", placeholder: "Type something\u2026" }),
3337
+ /* @__PURE__ */ jsx14(TextField2, { label: "With value", value: "Filled value", onChange: () => {
3338
+ } }),
3339
+ /* @__PURE__ */ jsx14(TextField2, { label: "Error state", error: true, value: "Bad value", onChange: () => {
3340
+ } }),
3341
+ /* @__PURE__ */ jsx14(TextField2, { label: "Disabled", disabled: true, value: "Read only", onChange: () => {
3342
+ } }),
3343
+ /* @__PURE__ */ jsx14(TextField2, { size: "medium", label: "Medium", placeholder: "Placeholder under the label" }),
3344
+ /* @__PURE__ */ jsx14(TextField2, { size: "small", label: "Small", placeholder: "Placeholder under the label" }),
3345
+ /* @__PURE__ */ jsx14(TextField2, { size: "smallest", label: "Smallest", value: "Filled value", onChange: () => {
3346
+ } })
3347
+ ] })
3348
+ ] }),
3349
+ /* @__PURE__ */ jsxs14("div", { className: "col-span-12 sm:col-span-6 flex flex-col gap-4", children: [
3350
+ /* @__PURE__ */ jsxs14("div", { children: [
3351
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Select" }),
3352
+ /* @__PURE__ */ jsxs14(Select5, { label: "Status", value: "published", onValueChange: () => {
3353
+ }, children: [
3354
+ /* @__PURE__ */ jsx14(SelectItem5, { value: "draft", children: "Draft" }),
3355
+ /* @__PURE__ */ jsx14(SelectItem5, { value: "published", children: "Published" }),
3356
+ /* @__PURE__ */ jsx14(SelectItem5, { value: "archived", children: "Archived" })
3357
+ ] })
3358
+ ] }),
3359
+ /* @__PURE__ */ jsxs14("div", { children: [
3360
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "MultiSelect" }),
3361
+ /* @__PURE__ */ jsxs14(MultiSelect, { label: "Roles", value: ["admin", "editor"], onValueChange: () => {
3362
+ }, children: [
3363
+ /* @__PURE__ */ jsx14(MultiSelectItem, { value: "admin", children: "Admin" }),
3364
+ /* @__PURE__ */ jsx14(MultiSelectItem, { value: "editor", children: "Editor" }),
3365
+ /* @__PURE__ */ jsx14(MultiSelectItem, { value: "viewer", children: "Viewer" })
3366
+ ] })
3367
+ ] })
3368
+ ] }),
3369
+ /* @__PURE__ */ jsxs14("div", { className: "col-span-12 sm:col-span-6 flex flex-col gap-3", children: [
3370
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block font-mono", children: "Checkbox" }),
3371
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 cursor-pointer", children: [
3372
+ /* @__PURE__ */ jsx14(Checkbox3, { checked: true, onCheckedChange: () => {
3373
+ } }),
3374
+ /* @__PURE__ */ jsx14("span", { children: "Checked" })
3375
+ ] }),
3376
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 cursor-pointer", children: [
3377
+ /* @__PURE__ */ jsx14(Checkbox3, { checked: false, onCheckedChange: () => {
3378
+ } }),
3379
+ /* @__PURE__ */ jsx14("span", { children: "Unchecked" })
3380
+ ] }),
3381
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3382
+ /* @__PURE__ */ jsx14(Checkbox3, { checked: true, disabled: true }),
3383
+ /* @__PURE__ */ jsx14("span", { children: "Disabled" })
3384
+ ] })
3385
+ ] }),
3386
+ /* @__PURE__ */ jsxs14("div", { className: "col-span-12 sm:col-span-6 flex flex-col gap-3", children: [
3387
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block font-mono", children: "BooleanSwitch" }),
3388
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
3389
+ /* @__PURE__ */ jsx14(BooleanSwitch, { value: true, onValueChange: () => {
3390
+ } }),
3391
+ /* @__PURE__ */ jsx14("span", { children: "On" })
3392
+ ] }),
3393
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
3394
+ /* @__PURE__ */ jsx14(BooleanSwitch, { value: false, onValueChange: () => {
3395
+ } }),
3396
+ /* @__PURE__ */ jsx14("span", { children: "Off" })
3397
+ ] })
3398
+ ] }),
3399
+ /* @__PURE__ */ jsxs14("div", { className: "col-span-12", children: [
3400
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "SearchBar" }),
3401
+ /* @__PURE__ */ jsx14(SearchBar4, { placeholder: "Search entities\u2026" })
3402
+ ] }),
3403
+ /* @__PURE__ */ jsxs14("div", { className: "col-span-12", children: [
3404
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Skeleton" }),
3405
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-4 items-center flex-wrap", children: [
3406
+ /* @__PURE__ */ jsx14(Skeleton6, { className: "w-10 h-10 rounded-full" }),
3407
+ /* @__PURE__ */ jsx14(Skeleton6, { className: "w-48 h-4 rounded" }),
3408
+ /* @__PURE__ */ jsx14(Skeleton6, { className: "w-32 h-8 rounded-md" })
3409
+ ] })
3410
+ ] })
3411
+ ] }) }),
3412
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "chips-alerts", title: "Chips & Alerts", children: [
3413
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Chip \u2014 colorScheme" }),
3414
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-2 mb-4", children: ["blue", "teal", "red", "green", "yellow", "orange", "purple", "pink", "cyan", "indigo", "violet", "fuchsia", "rose", "emerald", "gray"].map((s) => /* @__PURE__ */ jsx14(Chip7, { colorScheme: s, children: s }, s)) }),
3415
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Chip \u2014 sizes" }),
3416
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-2 items-center mb-4", children: ["smallest", "small", "medium", "large"].map((sz) => /* @__PURE__ */ jsx14(Chip7, { colorScheme: "blue", size: sz, children: sz }, sz)) }),
3417
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Chip \u2014 outlined, error, clickable, icon" }),
3418
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-2 items-center mb-4", children: [
3419
+ /* @__PURE__ */ jsx14(Chip7, { colorScheme: "red", outlined: true, children: "Outlined Red" }),
3420
+ /* @__PURE__ */ jsx14(Chip7, { colorScheme: "blue", outlined: true, children: "Outlined Blue" }),
3421
+ /* @__PURE__ */ jsx14(Chip7, { error: true, children: "Error" }),
3422
+ /* @__PURE__ */ jsx14(Chip7, { error: true, outlined: true, children: "Error Outlined" }),
3423
+ /* @__PURE__ */ jsx14(Chip7, { onClick: () => {
3424
+ }, children: "Clickable" }),
3425
+ /* @__PURE__ */ jsx14(Chip7, { icon: /* @__PURE__ */ jsx14(TagIcon, { size: 12 }), colorScheme: "teal", children: "With Icon" }),
3426
+ /* @__PURE__ */ jsx14(Chip7, { children: "Default (no scheme)" }),
3427
+ /* @__PURE__ */ jsx14(Chip7, { outlined: true, children: "Default Outlined" })
3428
+ ] }),
3429
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "FilterChip" }),
3430
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-2 items-center mb-6", children: [
3431
+ /* @__PURE__ */ jsx14(FilterChip2, { active: true, children: "Active" }),
3432
+ /* @__PURE__ */ jsx14(FilterChip2, { children: "Inactive" }),
3433
+ /* @__PURE__ */ jsx14(FilterChip2, { icon: /* @__PURE__ */ jsx14(FilterIcon, { size: 12 }), active: true, children: "With Icon" }),
3434
+ /* @__PURE__ */ jsx14(FilterChip2, { size: "small", children: "Small" }),
3435
+ /* @__PURE__ */ jsx14(FilterChip2, { disabled: true, children: "Disabled" })
3436
+ ] }),
3437
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Alert \u2014 color variants" }),
3438
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
3439
+ /* @__PURE__ */ jsx14(Alert3, { color: "info", children: "Info \u2014 informational message" }),
3440
+ /* @__PURE__ */ jsx14(Alert3, { color: "success", children: "Success \u2014 operation completed" }),
3441
+ /* @__PURE__ */ jsx14(Alert3, { color: "warning", children: "Warning \u2014 attention required" }),
3442
+ /* @__PURE__ */ jsx14(Alert3, { color: "error", children: "Error \u2014 something went wrong" })
3443
+ ] }),
3444
+ /* @__PURE__ */ jsxs14("div", { className: "mt-4", children: [
3445
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "Separator" }),
3446
+ /* @__PURE__ */ jsx14("div", { children: "Above" }),
3447
+ /* @__PURE__ */ jsx14(Separator5, { orientation: "horizontal" }),
3448
+ /* @__PURE__ */ jsx14("div", { children: "Below" })
3449
+ ] }),
3450
+ /* @__PURE__ */ jsxs14("div", { className: "mt-4", children: [
3451
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", className: "block mb-2 font-mono", children: "CircularProgress" }),
3452
+ /* @__PURE__ */ jsx14("div", { className: "flex gap-6 items-center", children: ["small", "medium", "large"].map((s) => /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-1", children: [
3453
+ /* @__PURE__ */ jsx14(CircularProgress, { size: s }),
3454
+ /* @__PURE__ */ jsx14(Typography12, { variant: "caption", color: "secondary", children: s })
3455
+ ] }, s)) })
3456
+ ] })
3457
+ ] }),
3458
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "users", title: "Management Screen \u2014 Alert + Table + Chip", children: [
3459
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3460
+ "Canonical layout for an admin management screen: an ",
3461
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Alert" }),
3462
+ " with an ",
3463
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "action" }),
3464
+ ", a header row, and a plain ",
3465
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Table" }),
3466
+ " with ",
3467
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Chip" }),
3468
+ "s. Illustrative mock \u2014 not tied to a specific screen."
3469
+ ] }),
3470
+ /* @__PURE__ */ jsx14(
3471
+ Alert3,
3472
+ {
3473
+ color: "warning",
3474
+ outerClassName: "mb-4",
3475
+ action: /* @__PURE__ */ jsx14(Button8, { children: "Make me admin" }),
3476
+ children: "No admin users exist. You can make yourself an admin."
3477
+ }
3478
+ ),
3479
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center mt-12", children: [
3480
+ /* @__PURE__ */ jsx14(Typography12, { gutterBottom: true, variant: "h4", className: "grow", component: "h4", children: "Users" }),
3481
+ /* @__PURE__ */ jsx14(Button8, { startIcon: /* @__PURE__ */ jsx14(PlusIcon, {}), children: "Add user" })
3482
+ ] }),
3483
+ /* @__PURE__ */ jsx14("div", { className: "overflow-auto", children: /* @__PURE__ */ jsxs14(Table2, { className: "w-full", children: [
3484
+ /* @__PURE__ */ jsxs14(TableHeader2, { children: [
3485
+ /* @__PURE__ */ jsx14(TableCell2, { header: true, className: "truncate w-16" }),
3486
+ /* @__PURE__ */ jsx14(TableCell2, { header: true, children: "Email" }),
3487
+ /* @__PURE__ */ jsx14(TableCell2, { header: true, children: "Name" }),
3488
+ /* @__PURE__ */ jsx14(TableCell2, { header: true, children: "Roles" })
3489
+ ] }),
3490
+ /* @__PURE__ */ jsx14(TableBody2, { children: [
3491
+ {
3492
+ uid: "1",
3493
+ email: "alice@example.com",
3494
+ displayName: "Alice Johnson",
3495
+ roles: [{
3496
+ id: "admin",
3497
+ name: "Admin",
3498
+ isAdmin: true
3499
+ }]
3500
+ },
3501
+ {
3502
+ uid: "2",
3503
+ email: "bob@example.com",
3504
+ displayName: "Bob Smith",
3505
+ roles: [{
3506
+ id: "editor",
3507
+ name: "Editor",
3508
+ isAdmin: false
3509
+ }]
3510
+ },
3511
+ {
3512
+ uid: "3",
3513
+ email: "carol@example.com",
3514
+ displayName: "Carol White",
3515
+ roles: []
3516
+ }
3517
+ ].map((user) => /* @__PURE__ */ jsxs14(TableRow2, { children: [
3518
+ /* @__PURE__ */ jsx14(TableCell2, { style: { width: "64px" }, children: /* @__PURE__ */ jsx14(Tooltip3, { asChild: true, title: "Delete this user", children: /* @__PURE__ */ jsx14(IconButton4, { size: "small", children: /* @__PURE__ */ jsx14(Trash2Icon3, {}) }) }) }),
3519
+ /* @__PURE__ */ jsx14(TableCell2, { children: user.email }),
3520
+ /* @__PURE__ */ jsx14(TableCell2, { className: "font-medium", children: user.displayName }),
3521
+ /* @__PURE__ */ jsx14(TableCell2, { children: /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-2", children: user.roles.map((role) => /* @__PURE__ */ jsx14(Chip7, { colorScheme: role.isAdmin ? "purple" : "blue", size: "small", children: role.name }, role.id)) }) })
3522
+ ] }, user.uid)) })
3523
+ ] }) })
3524
+ ] }),
3525
+ /* @__PURE__ */ jsxs14(SectionBlock, { id: "user-dialog", title: "Form Dialog \u2014 grid + MultiSelect + LoadingButton", children: [
3526
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3527
+ "Canonical form-in-a-card layout: ",
3528
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "grid grid-cols-12 gap-4" }),
3529
+ " for the fields, a ",
3530
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "MultiSelect" }),
3531
+ ", and a ",
3532
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "LoadingButton" }),
3533
+ " to submit. Illustrative mock \u2014 not tied to a specific screen."
3534
+ ] }),
3535
+ /* @__PURE__ */ jsxs14("div", { className: `rounded-lg border w-full max-w-xl ${defaultBorderMixin5}`, children: [
3536
+ /* @__PURE__ */ jsx14("div", { className: "px-6 pt-6 pb-2", children: /* @__PURE__ */ jsx14(Typography12, { variant: "h4", children: "User" }) }),
3537
+ /* @__PURE__ */ jsx14("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs14("div", { className: "grid grid-cols-12 gap-4", children: [
3538
+ /* @__PURE__ */ jsx14("div", { className: "col-span-12", children: /* @__PURE__ */ jsx14(TextField2, { name: "displayName", required: true, value: "Alice Johnson", onChange: () => {
3539
+ }, label: "Name" }) }),
3540
+ /* @__PURE__ */ jsx14("div", { className: "col-span-12", children: /* @__PURE__ */ jsx14(TextField2, { required: true, name: "email", value: "alice@example.com", onChange: () => {
3541
+ }, label: "Email", disabled: true }) }),
3542
+ /* @__PURE__ */ jsx14("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs14(MultiSelect, { className: "w-full", label: "Roles", value: ["admin"], onValueChange: () => {
3543
+ }, children: [
3544
+ /* @__PURE__ */ jsx14(MultiSelectItem, { value: "admin", children: "Admin" }),
3545
+ /* @__PURE__ */ jsx14(MultiSelectItem, { value: "editor", children: "Editor" }),
3546
+ /* @__PURE__ */ jsx14(MultiSelectItem, { value: "viewer", children: "Viewer" })
3547
+ ] }) })
3548
+ ] }) }),
3549
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-end gap-2 px-6 pb-6", children: [
3550
+ /* @__PURE__ */ jsx14(Button8, { variant: "text", children: "Cancel" }),
3551
+ /* @__PURE__ */ jsx14(LoadingButton, { variant: "filled", loading: false, children: "Update" })
3552
+ ] })
3553
+ ] })
3554
+ ] }),
3555
+ /* @__PURE__ */ jsxs14(SectionBlock, { wide: true, id: "crm-dashboard", title: "CRM Dashboard \u2014 CrmDashboardDemo", children: [
3556
+ /* @__PURE__ */ jsx14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: "A real-world showcase of a complex dashboard home page incorporating Rebase design language." }),
3557
+ /* @__PURE__ */ jsx14("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ jsx14(CrmDashboardDemo, {}) })
3558
+ ] }),
3559
+ /* @__PURE__ */ jsxs14(SectionBlock, { wide: true, id: "collection-table", title: "Collection Table", children: [
3560
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3561
+ "Sample data collection rendered as a sortable, searchable, filterable table with row selection. Uses ",
3562
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Table" }),
3563
+ ", ",
3564
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Chip" }),
3565
+ ",",
3566
+ " ",
3567
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "SearchBar" }),
3568
+ ", ",
3569
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Select" }),
3570
+ ",",
3571
+ " ",
3572
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Checkbox" }),
3573
+ "."
3574
+ ] }),
3575
+ /* @__PURE__ */ jsx14("div", { className: "w-full", children: /* @__PURE__ */ jsx14(CollectionTableDemo, {}) })
3576
+ ] }),
3577
+ /* @__PURE__ */ jsxs14(SectionBlock, { wide: true, id: "card-view", title: "Card View", children: [
3578
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3579
+ "Grid of entity cards with thumbnail area, progress bar, status/priority chips, and assignee. Uses ",
3580
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Card" }),
3581
+ ", ",
3582
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "Chip" }),
3583
+ ",",
3584
+ " ",
3585
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "ToggleButtonGroup" }),
3586
+ ", ",
3587
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "SearchBar" }),
3588
+ "."
3589
+ ] }),
3590
+ /* @__PURE__ */ jsx14("div", { className: "w-full", children: /* @__PURE__ */ jsx14(CardViewDemo, {}) })
3591
+ ] }),
3592
+ /* @__PURE__ */ jsxs14(SectionBlock, { wide: true, id: "kanban-board", title: "Kanban Board", children: [
3593
+ /* @__PURE__ */ jsxs14(Typography12, { variant: "body2", color: "secondary", className: "mb-4", children: [
3594
+ "Drag-and-drop kanban board with four status columns. Uses ",
3595
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "KanbanView" }),
3596
+ ", ",
3597
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "BoardItem" }),
3598
+ ",",
3599
+ " ",
3600
+ /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: "BoardItemViewProps" }),
3601
+ "."
3602
+ ] }),
3603
+ /* @__PURE__ */ jsx14("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ jsx14(KanbanBoardDemo, {}) })
3604
+ ] })
3605
+ ] })
3606
+ ] });
3607
+ }
3608
+ function SectionBlock({ id, title, wide, children }) {
3609
+ return (
3610
+ // `max-w-5xl` and `border-b` used to share this element, and they cannot.
3611
+ // Several mocks here are app-scale and intrinsically wider than 64rem
3612
+ // (the CRM dashboard reaches 1483px), so the section's own rule stopped
3613
+ // at 1264px while its content ran past it — every such section read as a
3614
+ // broken edge.
3615
+ //
3616
+ // Split instead: the SECTION spans the column, so its rule always
3617
+ // reaches its own edges; the CONTENT keeps a measure, so a form column
3618
+ // never stretches to 700px on a wide monitor. `wide` opts the app-scale
3619
+ // mocks out of the measure — they pair it with `overflow-x-auto` so they
3620
+ // scroll inside themselves rather than pushing the page.
3621
+ /* @__PURE__ */ jsx14("section", { id, className: cls10("px-6 py-8 border-b scroll-mt-0", defaultBorderMixin5), children: /* @__PURE__ */ jsxs14("div", { className: wide ? void 0 : "max-w-5xl", children: [
3622
+ /* @__PURE__ */ jsx14(Typography12, { variant: "h5", className: "mb-1", children: title }),
3623
+ /* @__PURE__ */ jsx14("div", { className: "mt-4", children })
3624
+ ] }) })
3625
+ );
3626
+ }
3627
+ export {
3628
+ CrmDashboardDemo,
3629
+ UIReferenceView,
3630
+ UIStyleGuide
3631
+ };