@object-ui/components 3.3.0 → 3.3.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 (321) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +21 -1
  3. package/dist/index.css +6339 -2
  4. package/dist/index.js +17600 -17481
  5. package/dist/index.umd.cjs +36 -36
  6. package/dist/packages/components/src/custom/empty.d.ts +12 -1
  7. package/dist/packages/components/src/renderers/action/action-bar.d.ts +12 -1
  8. package/dist/packages/components/src/ui/chart.d.ts +10 -29
  9. package/package.json +65 -44
  10. package/.turbo/turbo-build.log +0 -84
  11. package/README_SHADCN_SYNC.md +0 -281
  12. package/TESTING.md +0 -335
  13. package/docs/FilterBuilder.md +0 -268
  14. package/metadata/Chart.component.yml +0 -30
  15. package/metadata/FilterBuilder.component.yml +0 -39
  16. package/metadata/GridLayout.component.yml +0 -27
  17. package/metadata/Menu.component.yml +0 -31
  18. package/metadata/ObjectForm.component.yml +0 -34
  19. package/metadata/ObjectGrid.component.yml +0 -72
  20. package/metadata/Page.component.yml +0 -24
  21. package/postcss.config.js +0 -14
  22. package/shadcn-components.json +0 -440
  23. package/src/SchemaRenderer.tsx +0 -28
  24. package/src/__tests__/PageRendererRegions.test.tsx +0 -668
  25. package/src/__tests__/README.md +0 -124
  26. package/src/__tests__/__snapshots__/snapshot-critical.test.tsx.snap +0 -811
  27. package/src/__tests__/__snapshots__/snapshot.test.tsx.snap +0 -327
  28. package/src/__tests__/accessibility.test.tsx +0 -137
  29. package/src/__tests__/action-bar.test.tsx +0 -206
  30. package/src/__tests__/api-consistency.test.tsx +0 -596
  31. package/src/__tests__/basic-renderers.test.tsx +0 -255
  32. package/src/__tests__/color-contrast.test.tsx +0 -212
  33. package/src/__tests__/complex-disclosure-renderers.test.tsx +0 -302
  34. package/src/__tests__/compliance.test.tsx +0 -72
  35. package/src/__tests__/config-field-renderer.test.tsx +0 -307
  36. package/src/__tests__/config-panel-renderer.test.tsx +0 -580
  37. package/src/__tests__/config-primitives.test.tsx +0 -106
  38. package/src/__tests__/edge-cases.test.tsx +0 -285
  39. package/src/__tests__/feedback-overlay-renderers.test.tsx +0 -349
  40. package/src/__tests__/filter-builder.test.tsx +0 -409
  41. package/src/__tests__/form-renderers.test.tsx +0 -364
  42. package/src/__tests__/layout-data-renderers.test.tsx +0 -340
  43. package/src/__tests__/mobile-accessibility.test.tsx +0 -120
  44. package/src/__tests__/navigation-overlay.test.tsx +0 -370
  45. package/src/__tests__/snapshot-critical.test.tsx +0 -317
  46. package/src/__tests__/snapshot.test.tsx +0 -205
  47. package/src/__tests__/test-utils.tsx +0 -190
  48. package/src/__tests__/use-config-draft.test.tsx +0 -295
  49. package/src/__tests__/view-compliance.test.tsx +0 -153
  50. package/src/__tests__/wcag-audit.test.tsx +0 -493
  51. package/src/custom/action-param-dialog.tsx +0 -264
  52. package/src/custom/button-group.tsx +0 -91
  53. package/src/custom/combobox.tsx +0 -104
  54. package/src/custom/config-field-renderer.tsx +0 -276
  55. package/src/custom/config-panel-renderer.tsx +0 -306
  56. package/src/custom/config-row.tsx +0 -50
  57. package/src/custom/date-picker.tsx +0 -61
  58. package/src/custom/empty.tsx +0 -112
  59. package/src/custom/field.tsx +0 -81
  60. package/src/custom/filter-builder.tsx +0 -418
  61. package/src/custom/index.ts +0 -21
  62. package/src/custom/input-group.tsx +0 -53
  63. package/src/custom/item.tsx +0 -201
  64. package/src/custom/kbd.tsx +0 -36
  65. package/src/custom/mobile-dialog-content.tsx +0 -67
  66. package/src/custom/native-select.tsx +0 -33
  67. package/src/custom/navigation-overlay.tsx +0 -334
  68. package/src/custom/section-header.tsx +0 -68
  69. package/src/custom/sort-builder.tsx +0 -129
  70. package/src/custom/spinner.tsx +0 -26
  71. package/src/custom/view-skeleton.tsx +0 -243
  72. package/src/custom/view-states.tsx +0 -153
  73. package/src/debug/DebugPanel.tsx +0 -313
  74. package/src/debug/__tests__/DebugPanel.test.tsx +0 -134
  75. package/src/debug/index.ts +0 -10
  76. package/src/hooks/use-config-draft.ts +0 -127
  77. package/src/hooks/use-mobile.tsx +0 -27
  78. package/src/index.css +0 -245
  79. package/src/index.ts +0 -47
  80. package/src/lib/use-sync-external-store-shim.ts +0 -10
  81. package/src/lib/use-sync-external-store-with-selector-shim.ts +0 -90
  82. package/src/lib/utils.tsx +0 -35
  83. package/src/new-components.test.ts +0 -73
  84. package/src/renderers/action/action-bar.tsx +0 -221
  85. package/src/renderers/action/action-button.tsx +0 -158
  86. package/src/renderers/action/action-group.tsx +0 -270
  87. package/src/renderers/action/action-icon.tsx +0 -150
  88. package/src/renderers/action/action-menu.tsx +0 -203
  89. package/src/renderers/action/index.ts +0 -19
  90. package/src/renderers/action/resolve-icon.ts +0 -35
  91. package/src/renderers/basic/button-group.tsx +0 -79
  92. package/src/renderers/basic/div.tsx +0 -60
  93. package/src/renderers/basic/html.tsx +0 -43
  94. package/src/renderers/basic/icon.tsx +0 -89
  95. package/src/renderers/basic/image.tsx +0 -49
  96. package/src/renderers/basic/index.ts +0 -18
  97. package/src/renderers/basic/navigation-menu.tsx +0 -81
  98. package/src/renderers/basic/pagination.tsx +0 -109
  99. package/src/renderers/basic/separator.tsx +0 -57
  100. package/src/renderers/basic/span.tsx +0 -63
  101. package/src/renderers/basic/text.tsx +0 -52
  102. package/src/renderers/complex/README-KANBAN.md +0 -208
  103. package/src/renderers/complex/TIMELINE.md +0 -353
  104. package/src/renderers/complex/__tests__/data-table-airtable-ux.test.tsx +0 -239
  105. package/src/renderers/complex/__tests__/data-table-batch-editing.test.tsx +0 -275
  106. package/src/renderers/complex/__tests__/data-table-cell-renderer.test.tsx +0 -120
  107. package/src/renderers/complex/__tests__/data-table-editing.test.tsx +0 -221
  108. package/src/renderers/complex/__tests__/data-table.test.ts +0 -76
  109. package/src/renderers/complex/carousel.tsx +0 -69
  110. package/src/renderers/complex/data-table.tsx +0 -1243
  111. package/src/renderers/complex/filter-builder.tsx +0 -77
  112. package/src/renderers/complex/index.ts +0 -16
  113. package/src/renderers/complex/resizable.tsx +0 -66
  114. package/src/renderers/complex/scroll-area.tsx +0 -58
  115. package/src/renderers/complex/table.tsx +0 -95
  116. package/src/renderers/data-display/alert.tsx +0 -46
  117. package/src/renderers/data-display/avatar.tsx +0 -38
  118. package/src/renderers/data-display/badge.tsx +0 -55
  119. package/src/renderers/data-display/breadcrumb.tsx +0 -61
  120. package/src/renderers/data-display/index.ts +0 -18
  121. package/src/renderers/data-display/kbd.tsx +0 -50
  122. package/src/renderers/data-display/list.tsx +0 -75
  123. package/src/renderers/data-display/statistic.tsx +0 -95
  124. package/src/renderers/data-display/table.tsx +0 -78
  125. package/src/renderers/data-display/tree-view.tsx +0 -176
  126. package/src/renderers/disclosure/accordion.tsx +0 -69
  127. package/src/renderers/disclosure/collapsible.tsx +0 -53
  128. package/src/renderers/disclosure/index.ts +0 -11
  129. package/src/renderers/disclosure/toggle-group.tsx +0 -79
  130. package/src/renderers/feedback/empty.tsx +0 -49
  131. package/src/renderers/feedback/index.ts +0 -16
  132. package/src/renderers/feedback/loading.tsx +0 -78
  133. package/src/renderers/feedback/progress.tsx +0 -29
  134. package/src/renderers/feedback/skeleton.tsx +0 -31
  135. package/src/renderers/feedback/sonner.tsx +0 -56
  136. package/src/renderers/feedback/spinner.tsx +0 -55
  137. package/src/renderers/feedback/toast.tsx +0 -59
  138. package/src/renderers/feedback/toaster.tsx +0 -23
  139. package/src/renderers/form/button.tsx +0 -103
  140. package/src/renderers/form/calendar.tsx +0 -34
  141. package/src/renderers/form/checkbox.tsx +0 -71
  142. package/src/renderers/form/combobox.tsx +0 -48
  143. package/src/renderers/form/command.tsx +0 -58
  144. package/src/renderers/form/date-picker.tsx +0 -84
  145. package/src/renderers/form/file-upload.tsx +0 -184
  146. package/src/renderers/form/form.tsx +0 -540
  147. package/src/renderers/form/index.ts +0 -26
  148. package/src/renderers/form/input-otp.tsx +0 -51
  149. package/src/renderers/form/input.tsx +0 -121
  150. package/src/renderers/form/label.tsx +0 -45
  151. package/src/renderers/form/radio-group.tsx +0 -63
  152. package/src/renderers/form/select.tsx +0 -94
  153. package/src/renderers/form/slider.tsx +0 -61
  154. package/src/renderers/form/switch.tsx +0 -48
  155. package/src/renderers/form/textarea.tsx +0 -76
  156. package/src/renderers/form/toggle.tsx +0 -42
  157. package/src/renderers/index.ts +0 -18
  158. package/src/renderers/layout/aspect-ratio.tsx +0 -51
  159. package/src/renderers/layout/card.tsx +0 -85
  160. package/src/renderers/layout/container.tsx +0 -122
  161. package/src/renderers/layout/flex.tsx +0 -132
  162. package/src/renderers/layout/grid.tsx +0 -178
  163. package/src/renderers/layout/index.ts +0 -19
  164. package/src/renderers/layout/page.tsx +0 -466
  165. package/src/renderers/layout/semantic.tsx +0 -48
  166. package/src/renderers/layout/stack.tsx +0 -132
  167. package/src/renderers/layout/tabs.tsx +0 -97
  168. package/src/renderers/navigation/header-bar.tsx +0 -118
  169. package/src/renderers/navigation/index.ts +0 -10
  170. package/src/renderers/navigation/sidebar.tsx +0 -208
  171. package/src/renderers/overlay/alert-dialog.tsx +0 -72
  172. package/src/renderers/overlay/context-menu.tsx +0 -100
  173. package/src/renderers/overlay/dialog.tsx +0 -77
  174. package/src/renderers/overlay/drawer.tsx +0 -77
  175. package/src/renderers/overlay/dropdown-menu.tsx +0 -99
  176. package/src/renderers/overlay/hover-card.tsx +0 -55
  177. package/src/renderers/overlay/index.ts +0 -18
  178. package/src/renderers/overlay/menubar.tsx +0 -76
  179. package/src/renderers/overlay/popover.tsx +0 -56
  180. package/src/renderers/overlay/sheet.tsx +0 -77
  181. package/src/renderers/overlay/tooltip.tsx +0 -67
  182. package/src/renderers/placeholders.tsx +0 -107
  183. package/src/stories/CRMApp.stories.tsx +0 -706
  184. package/src/stories/ConfigPanel.stories.tsx +0 -232
  185. package/src/stories/Guide.mdx +0 -55
  186. package/src/stories/MockedData.stories.tsx +0 -121
  187. package/src/stories/assets/accessibility.png +0 -0
  188. package/src/stories/assets/accessibility.svg +0 -1
  189. package/src/stories/assets/addon-library.png +0 -0
  190. package/src/stories/assets/assets.png +0 -0
  191. package/src/stories/assets/avif-test-image.avif +0 -0
  192. package/src/stories/assets/context.png +0 -0
  193. package/src/stories/assets/discord.svg +0 -1
  194. package/src/stories/assets/docs.png +0 -0
  195. package/src/stories/assets/figma-plugin.png +0 -0
  196. package/src/stories/assets/github.svg +0 -1
  197. package/src/stories/assets/share.png +0 -0
  198. package/src/stories/assets/styling.png +0 -0
  199. package/src/stories/assets/testing.png +0 -0
  200. package/src/stories/assets/theming.png +0 -0
  201. package/src/stories/assets/tutorials.svg +0 -1
  202. package/src/stories/assets/youtube.svg +0 -1
  203. package/src/stories/button.css +0 -30
  204. package/src/stories/header.css +0 -32
  205. package/src/stories/page.css +0 -68
  206. package/src/stories-json/Accessibility.mdx +0 -297
  207. package/src/stories-json/EdgeCases.stories.tsx +0 -160
  208. package/src/stories-json/GettingStarted.mdx +0 -89
  209. package/src/stories-json/Introduction.mdx +0 -127
  210. package/src/stories-json/accordion.stories.tsx +0 -43
  211. package/src/stories-json/aggrid.stories.tsx +0 -103
  212. package/src/stories-json/alert.stories.tsx +0 -39
  213. package/src/stories-json/aspect-ratio.stories.tsx +0 -34
  214. package/src/stories-json/avatar.stories.tsx +0 -38
  215. package/src/stories-json/badge.stories.tsx +0 -53
  216. package/src/stories-json/breadcrumb.stories.tsx +0 -30
  217. package/src/stories-json/button-group.stories.tsx +0 -43
  218. package/src/stories-json/button.stories.tsx +0 -73
  219. package/src/stories-json/calendar.stories.tsx +0 -85
  220. package/src/stories-json/card.stories.tsx +0 -48
  221. package/src/stories-json/carousel.stories.tsx +0 -33
  222. package/src/stories-json/charts.stories.tsx +0 -195
  223. package/src/stories-json/chatbot.stories.tsx +0 -349
  224. package/src/stories-json/code-editor.stories.tsx +0 -92
  225. package/src/stories-json/collapsible.stories.tsx +0 -40
  226. package/src/stories-json/controls.stories.tsx +0 -36
  227. package/src/stories-json/crm-live-data.stories.tsx +0 -154
  228. package/src/stories-json/dashboard.stories.tsx +0 -318
  229. package/src/stories-json/data-table.stories.tsx +0 -136
  230. package/src/stories-json/data_display_extras.stories.tsx +0 -102
  231. package/src/stories-json/date-picker.stories.tsx +0 -28
  232. package/src/stories-json/detail-view.stories.tsx +0 -258
  233. package/src/stories-json/dialog.stories.tsx +0 -43
  234. package/src/stories-json/feedback_extras.stories.tsx +0 -40
  235. package/src/stories-json/feedback_others.stories.tsx +0 -46
  236. package/src/stories-json/form-variants.stories.tsx +0 -210
  237. package/src/stories-json/form_advanced.stories.tsx +0 -117
  238. package/src/stories-json/form_extras.stories.tsx +0 -123
  239. package/src/stories-json/grid.stories.tsx +0 -56
  240. package/src/stories-json/icon.stories.tsx +0 -36
  241. package/src/stories-json/input.stories.tsx +0 -52
  242. package/src/stories-json/kanban.stories.tsx +0 -295
  243. package/src/stories-json/layout_extended.stories.tsx +0 -76
  244. package/src/stories-json/layout_flex.stories.tsx +0 -107
  245. package/src/stories-json/list-view.stories.tsx +0 -97
  246. package/src/stories-json/markdown.stories.tsx +0 -129
  247. package/src/stories-json/menus.stories.tsx +0 -63
  248. package/src/stories-json/metric-card.stories.tsx +0 -143
  249. package/src/stories-json/navigation-menu.stories.tsx +0 -37
  250. package/src/stories-json/object-aggrid-advanced.stories.tsx +0 -389
  251. package/src/stories-json/object-aggrid.stories.tsx +0 -252
  252. package/src/stories-json/object-form.stories.tsx +0 -130
  253. package/src/stories-json/object-gantt.stories.tsx +0 -114
  254. package/src/stories-json/object-grid.stories.tsx +0 -315
  255. package/src/stories-json/object-map.stories.tsx +0 -116
  256. package/src/stories-json/object-view.stories.tsx +0 -118
  257. package/src/stories-json/overlay_extras.stories.tsx +0 -113
  258. package/src/stories-json/overlay_others.stories.tsx +0 -76
  259. package/src/stories-json/page.stories.tsx +0 -55
  260. package/src/stories-json/reports.stories.tsx +0 -163
  261. package/src/stories-json/resizable.stories.tsx +0 -44
  262. package/src/stories-json/select.stories.tsx +0 -34
  263. package/src/stories-json/separator.stories.tsx +0 -41
  264. package/src/stories-json/sidebar.stories.tsx +0 -147
  265. package/src/stories-json/statistic.stories.tsx +0 -44
  266. package/src/stories-json/tabs.stories.tsx +0 -51
  267. package/src/stories-json/timeline.stories.tsx +0 -188
  268. package/src/stories-json/typography.stories.tsx +0 -45
  269. package/src/types/config-panel.ts +0 -101
  270. package/src/ui/accordion.tsx +0 -66
  271. package/src/ui/alert-dialog.tsx +0 -149
  272. package/src/ui/alert.tsx +0 -67
  273. package/src/ui/aspect-ratio.tsx +0 -15
  274. package/src/ui/avatar.tsx +0 -58
  275. package/src/ui/badge.tsx +0 -44
  276. package/src/ui/breadcrumb.tsx +0 -123
  277. package/src/ui/button.tsx +0 -64
  278. package/src/ui/calendar.tsx +0 -221
  279. package/src/ui/card.tsx +0 -87
  280. package/src/ui/carousel.tsx +0 -270
  281. package/src/ui/chart.tsx +0 -377
  282. package/src/ui/checkbox.tsx +0 -38
  283. package/src/ui/collapsible.tsx +0 -19
  284. package/src/ui/command.tsx +0 -161
  285. package/src/ui/context-menu.tsx +0 -208
  286. package/src/ui/dialog.tsx +0 -130
  287. package/src/ui/drawer.tsx +0 -126
  288. package/src/ui/dropdown-menu.tsx +0 -208
  289. package/src/ui/form.tsx +0 -186
  290. package/src/ui/hover-card.tsx +0 -37
  291. package/src/ui/index.ts +0 -56
  292. package/src/ui/input-otp.tsx +0 -79
  293. package/src/ui/input.tsx +0 -30
  294. package/src/ui/label.tsx +0 -34
  295. package/src/ui/menubar.tsx +0 -264
  296. package/src/ui/navigation-menu.tsx +0 -136
  297. package/src/ui/pagination.tsx +0 -125
  298. package/src/ui/popover.tsx +0 -39
  299. package/src/ui/progress.tsx +0 -36
  300. package/src/ui/radio-group.tsx +0 -52
  301. package/src/ui/resizable.tsx +0 -53
  302. package/src/ui/scroll-area.tsx +0 -56
  303. package/src/ui/select.tsx +0 -168
  304. package/src/ui/separator.tsx +0 -39
  305. package/src/ui/sheet.tsx +0 -150
  306. package/src/ui/sidebar.tsx +0 -781
  307. package/src/ui/skeleton.tsx +0 -23
  308. package/src/ui/slider.tsx +0 -39
  309. package/src/ui/sonner.tsx +0 -53
  310. package/src/ui/switch.tsx +0 -37
  311. package/src/ui/table.tsx +0 -125
  312. package/src/ui/tabs.tsx +0 -63
  313. package/src/ui/textarea.tsx +0 -30
  314. package/src/ui/toast.tsx +0 -137
  315. package/src/ui/toggle-group.tsx +0 -69
  316. package/src/ui/toggle.tsx +0 -53
  317. package/src/ui/tooltip.tsx +0 -38
  318. package/src/ui/typography.tsx +0 -85
  319. package/tsconfig.json +0 -19
  320. package/vite.config.ts +0 -71
  321. package/vitest.config.ts +0 -5
@@ -1,221 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- "use client"
10
-
11
- import * as React from "react"
12
- import {
13
- ChevronDownIcon,
14
- ChevronLeftIcon,
15
- ChevronRightIcon,
16
- } from "lucide-react"
17
- import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
18
-
19
- import { cn } from "../lib/utils"
20
- import { Button, buttonVariants } from "./button"
21
-
22
- function Calendar({
23
- className,
24
- classNames,
25
- showOutsideDays = true,
26
- captionLayout = "label",
27
- buttonVariant = "ghost",
28
- formatters,
29
- components,
30
- ...props
31
- }: React.ComponentProps<typeof DayPicker> & {
32
- buttonVariant?: React.ComponentProps<typeof Button>["variant"]
33
- }) {
34
- const defaultClassNames = getDefaultClassNames()
35
-
36
- return (
37
- <DayPicker
38
- showOutsideDays={showOutsideDays}
39
- className={cn(
40
- "bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
41
- String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
42
- String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
43
- className
44
- )}
45
- captionLayout={captionLayout}
46
- formatters={{
47
- formatMonthDropdown: (date) =>
48
- date.toLocaleString("default", { month: "short" }),
49
- ...formatters,
50
- }}
51
- classNames={{
52
- root: cn("w-fit", defaultClassNames.root),
53
- months: cn(
54
- "relative flex flex-col gap-4 md:flex-row",
55
- defaultClassNames.months
56
- ),
57
- month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
58
- nav: cn(
59
- "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
60
- defaultClassNames.nav
61
- ),
62
- button_previous: cn(
63
- buttonVariants({ variant: buttonVariant }),
64
- "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
65
- defaultClassNames.button_previous
66
- ),
67
- button_next: cn(
68
- buttonVariants({ variant: buttonVariant }),
69
- "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
70
- defaultClassNames.button_next
71
- ),
72
- month_caption: cn(
73
- "flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",
74
- defaultClassNames.month_caption
75
- ),
76
- dropdowns: cn(
77
- "flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",
78
- defaultClassNames.dropdowns
79
- ),
80
- dropdown_root: cn(
81
- "has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",
82
- defaultClassNames.dropdown_root
83
- ),
84
- dropdown: cn(
85
- "bg-popover absolute inset-0 opacity-0",
86
- defaultClassNames.dropdown
87
- ),
88
- caption_label: cn(
89
- "select-none font-medium",
90
- captionLayout === "label"
91
- ? "text-sm"
92
- : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",
93
- defaultClassNames.caption_label
94
- ),
95
- table: "w-full border-collapse",
96
- weekdays: cn("flex", defaultClassNames.weekdays),
97
- weekday: cn(
98
- "text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",
99
- defaultClassNames.weekday
100
- ),
101
- week: cn("mt-2 flex w-full", defaultClassNames.week),
102
- week_number_header: cn(
103
- "w-[--cell-size] select-none",
104
- defaultClassNames.week_number_header
105
- ),
106
- week_number: cn(
107
- "text-muted-foreground select-none text-[0.8rem]",
108
- defaultClassNames.week_number
109
- ),
110
- day: cn(
111
- "group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
112
- defaultClassNames.day
113
- ),
114
- range_start: cn(
115
- "bg-accent rounded-l-md",
116
- defaultClassNames.range_start
117
- ),
118
- range_middle: cn("rounded-none", defaultClassNames.range_middle),
119
- range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
120
- today: cn(
121
- "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
122
- defaultClassNames.today
123
- ),
124
- outside: cn(
125
- "text-muted-foreground aria-selected:text-muted-foreground",
126
- defaultClassNames.outside
127
- ),
128
- disabled: cn(
129
- "text-muted-foreground opacity-50",
130
- defaultClassNames.disabled
131
- ),
132
- hidden: cn("invisible", defaultClassNames.hidden),
133
- ...classNames,
134
- }}
135
- components={{
136
- Root: ({ className, rootRef, ...props }) => {
137
- return (
138
- <div
139
- data-slot="calendar"
140
- ref={rootRef}
141
- className={cn(className)}
142
- {...props}
143
- />
144
- )
145
- },
146
- Chevron: ({ className, orientation, ...props }) => {
147
- if (orientation === "left") {
148
- return (
149
- <ChevronLeftIcon className={cn("size-4", className)} {...props} />
150
- )
151
- }
152
-
153
- if (orientation === "right") {
154
- return (
155
- <ChevronRightIcon
156
- className={cn("size-4", className)}
157
- {...props}
158
- />
159
- )
160
- }
161
-
162
- return (
163
- <ChevronDownIcon className={cn("size-4", className)} {...props} />
164
- )
165
- },
166
- DayButton: CalendarDayButton,
167
- WeekNumber: ({ children, ...props }) => {
168
- return (
169
- <td {...props}>
170
- <div className="flex size-[--cell-size] items-center justify-center text-center">
171
- {children}
172
- </div>
173
- </td>
174
- )
175
- },
176
- ...components,
177
- }}
178
- {...props}
179
- />
180
- )
181
- }
182
-
183
- function CalendarDayButton({
184
- className,
185
- day,
186
- modifiers,
187
- ...props
188
- }: React.ComponentProps<typeof DayButton>) {
189
- const defaultClassNames = getDefaultClassNames()
190
-
191
- const ref = React.useRef<HTMLButtonElement>(null)
192
- React.useEffect(() => {
193
- if (modifiers.focused) ref.current?.focus()
194
- }, [modifiers.focused])
195
-
196
- return (
197
- <Button
198
- ref={ref}
199
- variant="ghost"
200
- size="icon"
201
- data-day={day.date.toLocaleDateString()}
202
- data-selected-single={
203
- modifiers.selected &&
204
- !modifiers.range_start &&
205
- !modifiers.range_end &&
206
- !modifiers.range_middle
207
- }
208
- data-range-start={modifiers.range_start}
209
- data-range-end={modifiers.range_end}
210
- data-range-middle={modifiers.range_middle}
211
- className={cn(
212
- "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",
213
- defaultClassNames.day,
214
- className
215
- )}
216
- {...props}
217
- />
218
- )
219
- }
220
-
221
- export { Calendar, CalendarDayButton }
package/src/ui/card.tsx DELETED
@@ -1,87 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import * as React from "react"
10
-
11
- import { cn } from "../lib/utils"
12
-
13
- const Card = React.forwardRef<
14
- HTMLDivElement,
15
- React.HTMLAttributes<HTMLDivElement>
16
- >(({ className, ...props }, ref) => (
17
- <div
18
- ref={ref}
19
- className={cn(
20
- "rounded-lg border bg-card text-card-foreground shadow-sm",
21
- className
22
- )}
23
- {...props}
24
- />
25
- ))
26
- Card.displayName = "Card"
27
-
28
- const CardHeader = React.forwardRef<
29
- HTMLDivElement,
30
- React.HTMLAttributes<HTMLDivElement>
31
- >(({ className, ...props }, ref) => (
32
- <div
33
- ref={ref}
34
- className={cn("flex flex-col space-y-1.5 p-6", className)}
35
- {...props}
36
- />
37
- ))
38
- CardHeader.displayName = "CardHeader"
39
-
40
- const CardTitle = React.forwardRef<
41
- HTMLDivElement,
42
- React.HTMLAttributes<HTMLDivElement>
43
- >(({ className, ...props }, ref) => (
44
- <div
45
- ref={ref}
46
- className={cn(
47
- "text-2xl font-semibold leading-none tracking-tight",
48
- className
49
- )}
50
- {...props}
51
- />
52
- ))
53
- CardTitle.displayName = "CardTitle"
54
-
55
- const CardDescription = React.forwardRef<
56
- HTMLDivElement,
57
- React.HTMLAttributes<HTMLDivElement>
58
- >(({ className, ...props }, ref) => (
59
- <div
60
- ref={ref}
61
- className={cn("text-sm text-muted-foreground", className)}
62
- {...props}
63
- />
64
- ))
65
- CardDescription.displayName = "CardDescription"
66
-
67
- const CardContent = React.forwardRef<
68
- HTMLDivElement,
69
- React.HTMLAttributes<HTMLDivElement>
70
- >(({ className, ...props }, ref) => (
71
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
72
- ))
73
- CardContent.displayName = "CardContent"
74
-
75
- const CardFooter = React.forwardRef<
76
- HTMLDivElement,
77
- React.HTMLAttributes<HTMLDivElement>
78
- >(({ className, ...props }, ref) => (
79
- <div
80
- ref={ref}
81
- className={cn("flex items-center p-6 pt-0", className)}
82
- {...props}
83
- />
84
- ))
85
- CardFooter.displayName = "CardFooter"
86
-
87
- export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
@@ -1,270 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- "use client"
10
-
11
- import * as React from "react"
12
- import useEmblaCarousel, {
13
- type UseEmblaCarouselType,
14
- } from "embla-carousel-react"
15
- import { ArrowLeft, ArrowRight } from "lucide-react"
16
-
17
- import { cn } from "../lib/utils"
18
- import { Button } from "./button"
19
-
20
- type CarouselApi = UseEmblaCarouselType[1]
21
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
22
- type CarouselOptions = UseCarouselParameters[0]
23
- type CarouselPlugin = UseCarouselParameters[1]
24
-
25
- type CarouselProps = {
26
- opts?: CarouselOptions
27
- plugins?: CarouselPlugin
28
- orientation?: "horizontal" | "vertical"
29
- setApi?: (api: CarouselApi) => void
30
- }
31
-
32
- type CarouselContextProps = {
33
- carouselRef: ReturnType<typeof useEmblaCarousel>[0]
34
- api: ReturnType<typeof useEmblaCarousel>[1]
35
- scrollPrev: () => void
36
- scrollNext: () => void
37
- canScrollPrev: boolean
38
- canScrollNext: boolean
39
- } & CarouselProps
40
-
41
- const CarouselContext = React.createContext<CarouselContextProps | null>(null)
42
-
43
- function useCarousel() {
44
- const context = React.useContext(CarouselContext)
45
-
46
- if (!context) {
47
- throw new Error("useCarousel must be used within a <Carousel />")
48
- }
49
-
50
- return context
51
- }
52
-
53
- const Carousel = React.forwardRef<
54
- HTMLDivElement,
55
- React.HTMLAttributes<HTMLDivElement> & CarouselProps
56
- >(
57
- (
58
- {
59
- orientation = "horizontal",
60
- opts,
61
- setApi,
62
- plugins,
63
- className,
64
- children,
65
- ...props
66
- },
67
- ref
68
- ) => {
69
- const [carouselRef, api] = useEmblaCarousel(
70
- {
71
- ...opts,
72
- axis: orientation === "horizontal" ? "x" : "y",
73
- },
74
- plugins
75
- )
76
- const [canScrollPrev, setCanScrollPrev] = React.useState(false)
77
- const [canScrollNext, setCanScrollNext] = React.useState(false)
78
-
79
- const onSelect = React.useCallback((api: CarouselApi) => {
80
- if (!api) {
81
- return
82
- }
83
-
84
- setCanScrollPrev(api.canScrollPrev())
85
- setCanScrollNext(api.canScrollNext())
86
- }, [])
87
-
88
- const scrollPrev = React.useCallback(() => {
89
- api?.scrollPrev()
90
- }, [api])
91
-
92
- const scrollNext = React.useCallback(() => {
93
- api?.scrollNext()
94
- }, [api])
95
-
96
- const handleKeyDown = React.useCallback(
97
- (event: React.KeyboardEvent<HTMLDivElement>) => {
98
- if (event.key === "ArrowLeft") {
99
- event.preventDefault()
100
- scrollPrev()
101
- } else if (event.key === "ArrowRight") {
102
- event.preventDefault()
103
- scrollNext()
104
- }
105
- },
106
- [scrollPrev, scrollNext]
107
- )
108
-
109
- React.useEffect(() => {
110
- if (!api || !setApi) {
111
- return
112
- }
113
-
114
- setApi(api)
115
- }, [api, setApi])
116
-
117
- React.useEffect(() => {
118
- if (!api) {
119
- return
120
- }
121
-
122
- onSelect(api)
123
- api.on("reInit", onSelect)
124
- api.on("select", onSelect)
125
-
126
- return () => {
127
- api?.off("select", onSelect)
128
- }
129
- }, [api, onSelect])
130
-
131
- return (
132
- <CarouselContext.Provider
133
- value={{
134
- carouselRef,
135
- api: api,
136
- opts,
137
- orientation:
138
- orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
139
- scrollPrev,
140
- scrollNext,
141
- canScrollPrev,
142
- canScrollNext,
143
- }}
144
- >
145
- <div
146
- ref={ref}
147
- onKeyDownCapture={handleKeyDown}
148
- className={cn("relative", className)}
149
- role="region"
150
- aria-roledescription="carousel"
151
- {...props}
152
- >
153
- {children}
154
- </div>
155
- </CarouselContext.Provider>
156
- )
157
- }
158
- )
159
- Carousel.displayName = "Carousel"
160
-
161
- const CarouselContent = React.forwardRef<
162
- HTMLDivElement,
163
- React.HTMLAttributes<HTMLDivElement>
164
- >(({ className, ...props }, ref) => {
165
- const { carouselRef, orientation } = useCarousel()
166
-
167
- return (
168
- <div ref={carouselRef} className="overflow-hidden">
169
- <div
170
- ref={ref}
171
- className={cn(
172
- "flex",
173
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
174
- className
175
- )}
176
- {...props}
177
- />
178
- </div>
179
- )
180
- })
181
- CarouselContent.displayName = "CarouselContent"
182
-
183
- const CarouselItem = React.forwardRef<
184
- HTMLDivElement,
185
- React.HTMLAttributes<HTMLDivElement>
186
- >(({ className, ...props }, ref) => {
187
- const { orientation } = useCarousel()
188
-
189
- return (
190
- <div
191
- ref={ref}
192
- role="group"
193
- aria-roledescription="slide"
194
- className={cn(
195
- "min-w-0 shrink-0 grow-0 basis-full",
196
- orientation === "horizontal" ? "pl-4" : "pt-4",
197
- className
198
- )}
199
- {...props}
200
- />
201
- )
202
- })
203
- CarouselItem.displayName = "CarouselItem"
204
-
205
- const CarouselPrevious = React.forwardRef<
206
- HTMLButtonElement,
207
- React.ComponentProps<typeof Button>
208
- >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
209
- const { orientation, scrollPrev, canScrollPrev } = useCarousel()
210
-
211
- return (
212
- <Button
213
- ref={ref}
214
- variant={variant}
215
- size={size}
216
- className={cn(
217
- "absolute h-8 w-8 rounded-full",
218
- orientation === "horizontal"
219
- ? "-left-12 top-1/2 -translate-y-1/2"
220
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
221
- className
222
- )}
223
- disabled={!canScrollPrev}
224
- onClick={scrollPrev}
225
- {...props}
226
- >
227
- <ArrowLeft className="h-4 w-4" />
228
- <span className="sr-only">Previous slide</span>
229
- </Button>
230
- )
231
- })
232
- CarouselPrevious.displayName = "CarouselPrevious"
233
-
234
- const CarouselNext = React.forwardRef<
235
- HTMLButtonElement,
236
- React.ComponentProps<typeof Button>
237
- >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
238
- const { orientation, scrollNext, canScrollNext } = useCarousel()
239
-
240
- return (
241
- <Button
242
- ref={ref}
243
- variant={variant}
244
- size={size}
245
- className={cn(
246
- "absolute h-8 w-8 rounded-full",
247
- orientation === "horizontal"
248
- ? "-right-12 top-1/2 -translate-y-1/2"
249
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
250
- className
251
- )}
252
- disabled={!canScrollNext}
253
- onClick={scrollNext}
254
- {...props}
255
- >
256
- <ArrowRight className="h-4 w-4" />
257
- <span className="sr-only">Next slide</span>
258
- </Button>
259
- )
260
- })
261
- CarouselNext.displayName = "CarouselNext"
262
-
263
- export {
264
- type CarouselApi,
265
- Carousel,
266
- CarouselContent,
267
- CarouselItem,
268
- CarouselPrevious,
269
- CarouselNext,
270
- }