moi-computer 0.11.1-next.0 → 0.11.1-next.2

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 (211) hide show
  1. package/client/AGENTS.md +2 -2
  2. package/client/components/ui/button.tsx +1 -53
  3. package/client/components/ui/collapsible.tsx +1 -15
  4. package/client/components/ui/dialog.tsx +1 -58
  5. package/client/components/ui/dropdown-menu.tsx +1 -254
  6. package/client/components/ui/hover-card.tsx +1 -44
  7. package/client/components/ui/input.tsx +1 -21
  8. package/client/components/ui/popover.tsx +1 -88
  9. package/client/components/ui/resizable.tsx +1 -40
  10. package/client/components/ui/skeleton.tsx +1 -13
  11. package/client/components/ui/slider.tsx +1 -70
  12. package/client/components/ui/spinner.tsx +1 -18
  13. package/client/components/ui/switch.tsx +1 -23
  14. package/client/components/ui/tabs.tsx +1 -0
  15. package/client/components/ui/textarea.tsx +1 -18
  16. package/client/components/ui/tooltip.tsx +1 -51
  17. package/client/features/chat/ChatPanel.tsx +6 -6
  18. package/client/features/chat/ChatPopup.tsx +3 -4
  19. package/client/features/chat/TurnView.tsx +5 -4
  20. package/client/features/chat/api.ts +5 -14
  21. package/client/features/chat/chat-frames.ts +9 -7
  22. package/client/features/chat/chat-send.ts +13 -2
  23. package/client/features/chat/chat-store.ts +1 -3
  24. package/client/features/chat/composer/ChatComposer.tsx +5 -1
  25. package/client/features/chat/composer/ModelPicker.tsx +44 -44
  26. package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
  27. package/client/features/chat/composer/model-order.ts +15 -0
  28. package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
  29. package/client/features/chat/group-turns.ts +12 -0
  30. package/client/features/chat/interleave-notices.ts +7 -11
  31. package/client/features/chat/session-view.ts +53 -0
  32. package/client/features/chat/tool-group/ToolCallGroup.tsx +1 -4
  33. package/client/features/chat/tool-group/format/codex.ts +4 -1
  34. package/client/features/chat/useChat.ts +10 -9
  35. package/client/features/dev/ChatStatesPage.tsx +3 -1
  36. package/client/features/dev/DevIndexPage.tsx +5 -0
  37. package/client/features/dev/DevRoutes.tsx +2 -0
  38. package/client/features/dev/HarnessDebugPage.tsx +1 -1
  39. package/client/features/dev/UiComponentPreviews.tsx +834 -0
  40. package/client/features/dev/UiComponentsPage.tsx +60 -0
  41. package/client/features/home/WorkspacePreview.tsx +1 -1
  42. package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
  43. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
  44. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
  45. package/client/features/settings/SettingsLayout.tsx +1 -1
  46. package/client/features/settings/WorkspaceSettings.tsx +4 -1
  47. package/client/features/views/ViewManager.tsx +14 -9
  48. package/client/features/widgets/WidgetFrame.tsx +1 -1
  49. package/client/features/widgets/Widgets.tsx +1 -3
  50. package/client/features/workspace/WorkspaceScreen.tsx +5 -1
  51. package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
  52. package/client/features/workspace/api.ts +2 -4
  53. package/client/index.css +22 -29
  54. package/dist/chunk-245wt82v.css +1 -0
  55. package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
  56. package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
  57. package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
  58. package/dist/chunk-a6jad1a6.js +1 -0
  59. package/dist/chunk-dghwstd2.js +9 -0
  60. package/dist/chunk-eg120aca.js +1 -0
  61. package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
  62. package/dist/chunk-j7hh2ab4.js +70 -0
  63. package/dist/chunk-w482ew2c.js +546 -0
  64. package/dist/chunk-y8eyahwx.js +1 -0
  65. package/dist/index.html +1 -1
  66. package/lib/format.ts +55 -6
  67. package/lib/themes.ts +6 -6
  68. package/lib/types.ts +10 -9
  69. package/package.json +12 -5
  70. package/registry.json +643 -0
  71. package/server/agent.ts +1 -1
  72. package/server/api.ts +26 -30
  73. package/server/applets.ts +30 -29
  74. package/server/bundler/applet-css.ts +7 -107
  75. package/server/bundler/build-applet.ts +5 -1
  76. package/server/bundler/build-worker.ts +178 -0
  77. package/server/cli-ui-components.ts +28 -33
  78. package/server/cli.ts +6 -11
  79. package/server/data-dir.ts +1 -1
  80. package/server/harness/README.md +41 -48
  81. package/server/harness/acp/NOTES.md +426 -0
  82. package/server/harness/acp/discovery.ts +27 -30
  83. package/server/harness/acp/model-state.ts +57 -0
  84. package/server/harness/acp/session.ts +18 -6
  85. package/server/harness/claude-code/NOTES.md +47 -12
  86. package/server/harness/claude-code/cli.ts +40 -0
  87. package/server/harness/claude-code/index.ts +11 -5
  88. package/server/harness/claude-code/models.ts +72 -19
  89. package/server/harness/claude-code/session.ts +408 -299
  90. package/server/harness/codex/NOTES.md +222 -350
  91. package/server/harness/codex/adapter.ts +94 -45
  92. package/server/harness/codex/auth.ts +1 -3
  93. package/server/harness/codex/client.ts +169 -249
  94. package/server/harness/codex/discovery.ts +9 -17
  95. package/server/harness/codex/index.ts +2 -1
  96. package/server/harness/codex/pagination.ts +24 -0
  97. package/server/harness/codex/permissions.ts +31 -7
  98. package/server/harness/codex/probe.ts +10 -13
  99. package/server/harness/codex/session.ts +549 -136
  100. package/server/harness/codex/transport.ts +184 -0
  101. package/server/harness/debug.ts +1 -1
  102. package/server/harness/hermes/NOTES.md +18 -0
  103. package/server/harness/hermes/discovery.ts +20 -0
  104. package/server/harness/hermes/index.ts +9 -0
  105. package/server/harness/hermes/models.ts +28 -8
  106. package/server/harness/types.ts +4 -2
  107. package/server/moi-scaffold.ts +1 -1
  108. package/server/preview.ts +3 -1
  109. package/server/registry.ts +63 -41
  110. package/server/tldraw-package.d.ts +4 -0
  111. package/server/ui-components.ts +101 -434
  112. package/server/view-builders.ts +2 -1
  113. package/server/web.ts +12 -5
  114. package/server/workspace-env.ts +3 -2
  115. package/tsconfig.json +0 -1
  116. package/ui-components/accordion.tsx +71 -0
  117. package/ui-components/alert-dialog.tsx +165 -0
  118. package/ui-components/alert.tsx +68 -0
  119. package/ui-components/attachment.tsx +195 -0
  120. package/ui-components/avatar.tsx +90 -0
  121. package/ui-components/badge.tsx +49 -0
  122. package/ui-components/button-group.tsx +78 -0
  123. package/ui-components/button.tsx +55 -0
  124. package/ui-components/calendar.tsx +180 -0
  125. package/ui-components/card.tsx +84 -0
  126. package/ui-components/carousel.tsx +235 -0
  127. package/ui-components/chart.tsx +338 -0
  128. package/ui-components/checkbox.tsx +28 -0
  129. package/ui-components/collapsible.tsx +15 -0
  130. package/ui-components/combobox.tsx +267 -0
  131. package/ui-components/context-menu.tsx +244 -0
  132. package/ui-components/dialog.tsx +138 -0
  133. package/ui-components/docs/accordion.md +463 -0
  134. package/ui-components/docs/alert-dialog.md +481 -0
  135. package/ui-components/docs/alert.md +301 -0
  136. package/ui-components/docs/attachment.md +689 -0
  137. package/ui-components/docs/avatar.md +495 -0
  138. package/ui-components/docs/badge.md +258 -0
  139. package/ui-components/docs/button-group.md +879 -0
  140. package/ui-components/docs/button.md +26 -0
  141. package/ui-components/docs/calendar.md +862 -0
  142. package/ui-components/docs/card.md +265 -0
  143. package/ui-components/docs/carousel.md +627 -0
  144. package/ui-components/docs/chart.md +1256 -0
  145. package/ui-components/docs/checkbox.md +477 -0
  146. package/ui-components/docs/collapsible.md +446 -0
  147. package/ui-components/docs/combobox.md +1003 -0
  148. package/ui-components/docs/context-menu.md +860 -0
  149. package/ui-components/docs/data-table.md +1580 -0
  150. package/ui-components/docs/date-picker.md +614 -0
  151. package/ui-components/docs/dialog.md +414 -0
  152. package/ui-components/docs/drawer.md +51 -0
  153. package/ui-components/docs/dropdown-menu.md +1000 -0
  154. package/ui-components/docs/field.md +1192 -0
  155. package/ui-components/docs/hover-card.md +275 -0
  156. package/ui-components/docs/input-group.md +866 -0
  157. package/ui-components/docs/input.md +456 -0
  158. package/ui-components/docs/label.md +295 -0
  159. package/ui-components/docs/pagination.md +416 -0
  160. package/ui-components/docs/popover.md +348 -0
  161. package/ui-components/docs/progress.md +214 -0
  162. package/ui-components/docs/radio-group.md +389 -0
  163. package/ui-components/docs/resizable.md +265 -0
  164. package/ui-components/docs/select.md +616 -0
  165. package/ui-components/docs/separator.md +216 -0
  166. package/ui-components/docs/skeleton.md +205 -0
  167. package/ui-components/docs/slider.md +226 -0
  168. package/ui-components/docs/spinner.md +332 -0
  169. package/ui-components/docs/switch.md +236 -0
  170. package/ui-components/docs/table.md +551 -0
  171. package/ui-components/docs/tabs.md +379 -0
  172. package/ui-components/docs/textarea.md +187 -0
  173. package/ui-components/docs/toggle-group.md +370 -0
  174. package/ui-components/docs/toggle.md +91 -0
  175. package/ui-components/docs/tooltip.md +290 -0
  176. package/ui-components/drawer.tsx +213 -0
  177. package/ui-components/dropdown-menu.tsx +263 -0
  178. package/ui-components/field.tsx +224 -0
  179. package/ui-components/hover-card.tsx +46 -0
  180. package/ui-components/input-group.tsx +146 -0
  181. package/ui-components/input.tsx +20 -0
  182. package/ui-components/label.tsx +17 -0
  183. package/ui-components/pagination.tsx +124 -0
  184. package/ui-components/popover.tsx +81 -0
  185. package/ui-components/progress.tsx +63 -0
  186. package/ui-components/radio-group.tsx +38 -0
  187. package/ui-components/resizable.tsx +40 -0
  188. package/ui-components/scoped-portal.tsx +31 -0
  189. package/ui-components/select.tsx +195 -0
  190. package/ui-components/separator.tsx +18 -0
  191. package/ui-components/skeleton.tsx +15 -0
  192. package/ui-components/slider.tsx +75 -0
  193. package/ui-components/spinner.tsx +20 -0
  194. package/ui-components/switch.tsx +27 -0
  195. package/ui-components/table.tsx +86 -0
  196. package/ui-components/tabs.tsx +75 -0
  197. package/ui-components/textarea.tsx +17 -0
  198. package/ui-components/toggle-group.tsx +85 -0
  199. package/ui-components/toggle.tsx +42 -0
  200. package/ui-components/tooltip.tsx +61 -0
  201. package/ui-components/utils.ts +8 -0
  202. package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
  203. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
  204. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
  205. package/dist/chunk-59zf0m6n.js +0 -1
  206. package/dist/chunk-bj3akjs2.js +0 -1
  207. package/dist/chunk-j2w2vak4.js +0 -546
  208. package/dist/chunk-k2r9c95m.js +0 -10
  209. package/dist/chunk-kmbxhgwv.js +0 -1
  210. package/dist/chunk-p1yqa71k.js +0 -83
  211. package/dist/chunk-r5xrenjy.css +0 -1
@@ -0,0 +1,49 @@
1
+ import { mergeProps } from '@base-ui/react/merge-props'
2
+ import { useRender } from '@base-ui/react/use-render'
3
+ import { cva, type VariantProps } from 'class-variance-authority'
4
+ import { cn } from './utils'
5
+
6
+ const badgeVariants = cva(
7
+ 'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-sm border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!',
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
12
+ secondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',
13
+ destructive:
14
+ 'bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20',
15
+ outline:
16
+ 'border-border text-foreground [a]:hover:bg-accent [a]:hover:text-accent-foreground',
17
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
18
+ link: 'text-primary underline-offset-4 hover:underline'
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ variant: 'default'
23
+ }
24
+ }
25
+ )
26
+
27
+ function Badge({
28
+ className,
29
+ variant = 'default',
30
+ render,
31
+ ...props
32
+ }: useRender.ComponentProps<'span'> & VariantProps<typeof badgeVariants>) {
33
+ return useRender({
34
+ defaultTagName: 'span',
35
+ props: mergeProps<'span'>(
36
+ {
37
+ className: cn(badgeVariants({ variant }), className)
38
+ },
39
+ props
40
+ ),
41
+ render,
42
+ state: {
43
+ slot: 'badge',
44
+ variant
45
+ }
46
+ })
47
+ }
48
+
49
+ export { Badge, badgeVariants }
@@ -0,0 +1,78 @@
1
+ import { mergeProps } from '@base-ui/react/merge-props'
2
+ import { useRender } from '@base-ui/react/use-render'
3
+ import { cva, type VariantProps } from 'class-variance-authority'
4
+ import { cn } from './utils'
5
+
6
+ import { Separator } from './separator'
7
+
8
+ const buttonGroupVariants = cva(
9
+ "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
10
+ {
11
+ variants: {
12
+ orientation: {
13
+ horizontal:
14
+ '*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0',
15
+ vertical:
16
+ 'flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0'
17
+ }
18
+ },
19
+ defaultVariants: {
20
+ orientation: 'horizontal'
21
+ }
22
+ }
23
+ )
24
+
25
+ function ButtonGroup({
26
+ className,
27
+ orientation,
28
+ ...props
29
+ }: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>) {
30
+ return (
31
+ <div
32
+ role="group"
33
+ data-slot="button-group"
34
+ data-orientation={orientation}
35
+ className={cn(buttonGroupVariants({ orientation }), className)}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<'div'>) {
42
+ return useRender({
43
+ defaultTagName: 'div',
44
+ props: mergeProps<'div'>(
45
+ {
46
+ className: cn(
47
+ "flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
48
+ className
49
+ )
50
+ },
51
+ props
52
+ ),
53
+ render,
54
+ state: {
55
+ slot: 'button-group-text'
56
+ }
57
+ })
58
+ }
59
+
60
+ function ButtonGroupSeparator({
61
+ className,
62
+ orientation = 'vertical',
63
+ ...props
64
+ }: React.ComponentProps<typeof Separator>) {
65
+ return (
66
+ <Separator
67
+ data-slot="button-group-separator"
68
+ orientation={orientation}
69
+ className={cn(
70
+ 'relative self-stretch bg-border data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto',
71
+ className
72
+ )}
73
+ {...props}
74
+ />
75
+ )
76
+ }
77
+
78
+ export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants }
@@ -0,0 +1,55 @@
1
+ import { Button as ButtonPrimitive } from '@base-ui/react/button'
2
+ import { type VariantProps, cva } from 'class-variance-authority'
3
+
4
+ import { cn } from './utils'
5
+
6
+ const buttonVariants = cva(
7
+ 'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg text-sm font-medium whitespace-nowrap transition-all duration-100 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default:
12
+ 'bg-primary text-primary-foreground inset-shadow-[0_0_8px_color-mix(in_oklab,var(--color-white)_20%,transparent)] hover:bg-primary/90 disabled:bg-accent disabled:text-muted-foreground disabled:opacity-100 disabled:shadow-none',
13
+ secondary:
14
+ 'bg-accent text-accent-foreground hover:bg-[color-mix(in_oklch,var(--accent),var(--foreground)_3%)]',
15
+ outline:
16
+ 'border bg-background text-foreground hover:bg-[color-mix(in_oklch,var(--background),var(--foreground)_3%)]',
17
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
18
+ destructive:
19
+ 'bg-destructive text-white inset-shadow-[0_0_8px_color-mix(in_oklab,var(--color-white)_20%,transparent)] hover:bg-destructive/90 focus-visible:border-destructive/40 focus-visible:ring-destructive/20'
20
+ },
21
+ size: {
22
+ xs: 'h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg]:size-3',
23
+ sm: 'h-7 gap-1.5 rounded-md px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg]:size-4',
24
+ default:
25
+ 'h-8 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5 [&_svg]:size-5',
26
+ lg: 'h-10 rounded-xl px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg]:size-5',
27
+ 'icon-xs': 'size-6 rounded-md [&_svg]:size-3',
28
+ 'icon-sm': 'size-7 rounded-md [&_svg]:size-4',
29
+ icon: 'size-8 [&_svg]:size-5',
30
+ 'icon-lg': 'size-10 rounded-xl [&_svg]:size-5'
31
+ }
32
+ },
33
+ defaultVariants: {
34
+ variant: 'default',
35
+ size: 'default'
36
+ }
37
+ }
38
+ )
39
+
40
+ function Button({
41
+ className,
42
+ variant = 'default',
43
+ size = 'default',
44
+ ...props
45
+ }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
46
+ return (
47
+ <ButtonPrimitive
48
+ data-slot="button"
49
+ className={cn(buttonVariants({ variant, size, className }))}
50
+ {...props}
51
+ />
52
+ )
53
+ }
54
+
55
+ export { Button, buttonVariants }
@@ -0,0 +1,180 @@
1
+ import * as React from 'react'
2
+ import { cn } from './utils'
3
+ import { DayPicker, getDefaultClassNames, type DayButton, type Locale } from 'react-day-picker'
4
+
5
+ import { Button, buttonVariants } from './button'
6
+ import { IconChevronLeft, IconChevronRight, IconChevronDown } from '@tabler/icons-react'
7
+
8
+ function Calendar({
9
+ className,
10
+ classNames,
11
+ showOutsideDays = true,
12
+ captionLayout = 'label',
13
+ buttonVariant = 'ghost',
14
+ locale,
15
+ formatters,
16
+ components,
17
+ ...props
18
+ }: React.ComponentProps<typeof DayPicker> & {
19
+ buttonVariant?: React.ComponentProps<typeof Button>['variant']
20
+ }) {
21
+ const defaultClassNames = getDefaultClassNames()
22
+
23
+ return (
24
+ <DayPicker
25
+ showOutsideDays={showOutsideDays}
26
+ className={cn(
27
+ 'group/calendar p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',
28
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
29
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
30
+ className
31
+ )}
32
+ captionLayout={captionLayout}
33
+ locale={locale}
34
+ formatters={{
35
+ formatMonthDropdown: date => date.toLocaleString(locale?.code, { month: 'short' }),
36
+ ...formatters
37
+ }}
38
+ classNames={{
39
+ root: cn('w-fit', defaultClassNames.root),
40
+ months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),
41
+ month: cn('flex w-full flex-col gap-4', defaultClassNames.month),
42
+ nav: cn(
43
+ 'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',
44
+ defaultClassNames.nav
45
+ ),
46
+ button_previous: cn(
47
+ buttonVariants({ variant: buttonVariant }),
48
+ 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',
49
+ defaultClassNames.button_previous
50
+ ),
51
+ button_next: cn(
52
+ buttonVariants({ variant: buttonVariant }),
53
+ 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',
54
+ defaultClassNames.button_next
55
+ ),
56
+ month_caption: cn(
57
+ 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',
58
+ defaultClassNames.month_caption
59
+ ),
60
+ dropdowns: cn(
61
+ 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',
62
+ defaultClassNames.dropdowns
63
+ ),
64
+ dropdown_root: cn('relative rounded-(--cell-radius)', defaultClassNames.dropdown_root),
65
+ dropdown: cn('absolute inset-0 bg-popover opacity-0', defaultClassNames.dropdown),
66
+ caption_label: cn(
67
+ 'font-medium select-none',
68
+ captionLayout === 'label'
69
+ ? 'text-sm'
70
+ : 'flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-4 [&>svg]:text-muted-foreground',
71
+ defaultClassNames.caption_label
72
+ ),
73
+ month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),
74
+ weekdays: cn('flex', defaultClassNames.weekdays),
75
+ weekday: cn(
76
+ 'flex-1 rounded-(--cell-radius) text-xs font-normal text-muted-foreground select-none',
77
+ defaultClassNames.weekday
78
+ ),
79
+ week: cn('mt-2 flex w-full', defaultClassNames.week),
80
+ week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),
81
+ week_number: cn('text-xs text-muted-foreground select-none', defaultClassNames.week_number),
82
+ day: cn(
83
+ 'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)',
84
+ props.showWeekNumber
85
+ ? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)'
86
+ : '[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)',
87
+ defaultClassNames.day
88
+ ),
89
+ range_start: cn(
90
+ 'relative isolate z-0 rounded-l-(--cell-radius) bg-accent after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-accent',
91
+ defaultClassNames.range_start
92
+ ),
93
+ range_middle: cn('rounded-none', defaultClassNames.range_middle),
94
+ range_end: cn(
95
+ 'relative isolate z-0 rounded-r-(--cell-radius) bg-accent after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-accent',
96
+ defaultClassNames.range_end
97
+ ),
98
+ today: cn(
99
+ 'rounded-(--cell-radius) bg-accent text-foreground data-[selected=true]:rounded-none',
100
+ defaultClassNames.today
101
+ ),
102
+ outside: cn(
103
+ 'text-muted-foreground aria-selected:text-muted-foreground',
104
+ defaultClassNames.outside
105
+ ),
106
+ disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
107
+ hidden: cn('invisible', defaultClassNames.hidden),
108
+ ...classNames
109
+ }}
110
+ components={{
111
+ Root: ({ className, rootRef, ...props }) => {
112
+ return <div data-slot="calendar" ref={rootRef} className={cn(className)} {...props} />
113
+ },
114
+ Chevron: ({ className, orientation, ...props }) => {
115
+ if (orientation === 'left') {
116
+ return <IconChevronLeft stroke={1.75} className={cn('size-4', className)} {...props} />
117
+ }
118
+
119
+ if (orientation === 'right') {
120
+ return <IconChevronRight stroke={1.75} className={cn('size-4', className)} {...props} />
121
+ }
122
+
123
+ return <IconChevronDown stroke={1.75} className={cn('size-4', className)} {...props} />
124
+ },
125
+ DayButton: ({ ...props }) => <CalendarDayButton locale={locale} {...props} />,
126
+ WeekNumber: ({ children, ...props }) => {
127
+ return (
128
+ <td {...props}>
129
+ <div className="flex size-(--cell-size) items-center justify-center text-center">
130
+ {children}
131
+ </div>
132
+ </td>
133
+ )
134
+ },
135
+ ...components
136
+ }}
137
+ {...props}
138
+ />
139
+ )
140
+ }
141
+
142
+ function CalendarDayButton({
143
+ className,
144
+ day,
145
+ modifiers,
146
+ locale,
147
+ ...props
148
+ }: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {
149
+ const defaultClassNames = getDefaultClassNames()
150
+
151
+ const ref = React.useRef<HTMLButtonElement>(null)
152
+ React.useEffect(() => {
153
+ if (modifiers.focused) ref.current?.focus()
154
+ }, [modifiers.focused])
155
+
156
+ return (
157
+ <Button
158
+ variant="ghost"
159
+ size="icon"
160
+ data-day={day.date.toLocaleDateString(locale?.code)}
161
+ data-selected-single={
162
+ modifiers.selected &&
163
+ !modifiers.range_start &&
164
+ !modifiers.range_end &&
165
+ !modifiers.range_middle
166
+ }
167
+ data-range-start={modifiers.range_start}
168
+ data-range-end={modifiers.range_end}
169
+ data-range-middle={modifiers.range_middle}
170
+ className={cn(
171
+ 'relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70',
172
+ defaultClassNames.day,
173
+ className
174
+ )}
175
+ {...props}
176
+ />
177
+ )
178
+ }
179
+
180
+ export { Calendar, CalendarDayButton }
@@ -0,0 +1,84 @@
1
+ import * as React from 'react'
2
+ import { cn } from './utils'
3
+
4
+ function Card({
5
+ className,
6
+ size = 'default',
7
+ ...props
8
+ }: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {
9
+ return (
10
+ <div
11
+ data-slot="card"
12
+ data-size={size}
13
+ className={cn(
14
+ 'group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-border [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',
15
+ className
16
+ )}
17
+ {...props}
18
+ />
19
+ )
20
+ }
21
+
22
+ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
23
+ return (
24
+ <div
25
+ data-slot="card-header"
26
+ className={cn(
27
+ 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',
28
+ className
29
+ )}
30
+ {...props}
31
+ />
32
+ )
33
+ }
34
+
35
+ function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
36
+ return (
37
+ <div
38
+ data-slot="card-title"
39
+ className={cn(
40
+ 'text-base leading-snug font-medium group-data-[size=sm]/card:text-sm',
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ )
46
+ }
47
+
48
+ function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
49
+ return (
50
+ <div
51
+ data-slot="card-description"
52
+ className={cn('text-sm text-muted-foreground', className)}
53
+ {...props}
54
+ />
55
+ )
56
+ }
57
+
58
+ function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
59
+ return (
60
+ <div
61
+ data-slot="card-action"
62
+ className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}
63
+ {...props}
64
+ />
65
+ )
66
+ }
67
+
68
+ function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
69
+ return (
70
+ <div data-slot="card-content" className={cn('px-(--card-spacing)', className)} {...props} />
71
+ )
72
+ }
73
+
74
+ function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn('flex items-center rounded-b-xl border-t p-(--card-spacing)', className)}
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent }
@@ -0,0 +1,235 @@
1
+ 'use client'
2
+
3
+ import * as React from 'react'
4
+ import { cn } from './utils'
5
+ import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react'
6
+
7
+ import { Button } from './button'
8
+ import { IconChevronLeft, IconChevronRight } from '@tabler/icons-react'
9
+
10
+ type CarouselApi = UseEmblaCarouselType[1]
11
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
12
+ type CarouselOptions = UseCarouselParameters[0]
13
+ type CarouselPlugin = UseCarouselParameters[1]
14
+
15
+ type CarouselProps = {
16
+ opts?: CarouselOptions
17
+ plugins?: CarouselPlugin
18
+ orientation?: 'horizontal' | 'vertical'
19
+ setApi?: (api: CarouselApi) => void
20
+ }
21
+
22
+ type CarouselContextProps = {
23
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0]
24
+ api: ReturnType<typeof useEmblaCarousel>[1]
25
+ scrollPrev: () => void
26
+ scrollNext: () => void
27
+ canScrollPrev: boolean
28
+ canScrollNext: boolean
29
+ } & CarouselProps
30
+
31
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null)
32
+
33
+ function useCarousel() {
34
+ const context = React.useContext(CarouselContext)
35
+
36
+ if (!context) {
37
+ throw new Error('useCarousel must be used within a <Carousel />')
38
+ }
39
+
40
+ return context
41
+ }
42
+
43
+ function Carousel({
44
+ orientation = 'horizontal',
45
+ opts,
46
+ setApi,
47
+ plugins,
48
+ className,
49
+ children,
50
+ ...props
51
+ }: React.ComponentProps<'div'> & CarouselProps) {
52
+ const [carouselRef, api] = useEmblaCarousel(
53
+ {
54
+ ...opts,
55
+ axis: orientation === 'horizontal' ? 'x' : 'y'
56
+ },
57
+ plugins
58
+ )
59
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false)
60
+ const [canScrollNext, setCanScrollNext] = React.useState(false)
61
+
62
+ const onSelect = React.useCallback((api: CarouselApi) => {
63
+ if (!api) return
64
+ setCanScrollPrev(api.canScrollPrev())
65
+ setCanScrollNext(api.canScrollNext())
66
+ }, [])
67
+
68
+ const scrollPrev = React.useCallback(() => {
69
+ api?.scrollPrev()
70
+ }, [api])
71
+
72
+ const scrollNext = React.useCallback(() => {
73
+ api?.scrollNext()
74
+ }, [api])
75
+
76
+ const handleKeyDown = React.useCallback(
77
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
78
+ if (event.key === 'ArrowLeft') {
79
+ event.preventDefault()
80
+ scrollPrev()
81
+ } else if (event.key === 'ArrowRight') {
82
+ event.preventDefault()
83
+ scrollNext()
84
+ }
85
+ },
86
+ [scrollPrev, scrollNext]
87
+ )
88
+
89
+ React.useEffect(() => {
90
+ if (!api || !setApi) return
91
+ setApi(api)
92
+ }, [api, setApi])
93
+
94
+ React.useEffect(() => {
95
+ if (!api) return
96
+ onSelect(api)
97
+ api.on('reInit', onSelect)
98
+ api.on('select', onSelect)
99
+
100
+ return () => {
101
+ api?.off('select', onSelect)
102
+ }
103
+ }, [api, onSelect])
104
+
105
+ return (
106
+ <CarouselContext.Provider
107
+ value={{
108
+ carouselRef,
109
+ api: api,
110
+ opts,
111
+ orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
112
+ scrollPrev,
113
+ scrollNext,
114
+ canScrollPrev,
115
+ canScrollNext
116
+ }}
117
+ >
118
+ <div
119
+ onKeyDownCapture={handleKeyDown}
120
+ className={cn('relative', className)}
121
+ role="region"
122
+ aria-roledescription="carousel"
123
+ data-slot="carousel"
124
+ {...props}
125
+ >
126
+ {children}
127
+ </div>
128
+ </CarouselContext.Provider>
129
+ )
130
+ }
131
+
132
+ function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
133
+ const { carouselRef, orientation } = useCarousel()
134
+
135
+ return (
136
+ <div ref={carouselRef} className="overflow-hidden" data-slot="carousel-content">
137
+ <div
138
+ className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}
139
+ {...props}
140
+ />
141
+ </div>
142
+ )
143
+ }
144
+
145
+ function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
146
+ const { orientation } = useCarousel()
147
+
148
+ return (
149
+ <div
150
+ role="group"
151
+ aria-roledescription="slide"
152
+ data-slot="carousel-item"
153
+ className={cn(
154
+ 'min-w-0 shrink-0 grow-0 basis-full',
155
+ orientation === 'horizontal' ? 'pl-4' : 'pt-4',
156
+ className
157
+ )}
158
+ {...props}
159
+ />
160
+ )
161
+ }
162
+
163
+ function CarouselPrevious({
164
+ className,
165
+ variant = 'outline',
166
+ size = 'icon-sm',
167
+ ...props
168
+ }: React.ComponentProps<typeof Button>) {
169
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel()
170
+
171
+ return (
172
+ <Button
173
+ data-slot="carousel-previous"
174
+ variant={variant}
175
+ size={size}
176
+ className={cn(
177
+ 'absolute touch-manipulation rounded-full',
178
+ orientation === 'horizontal'
179
+ ? 'inset-y-0 -left-12 my-auto'
180
+ : '-top-12 left-1/2 -translate-x-1/2 rotate-90',
181
+ className
182
+ )}
183
+ disabled={!canScrollPrev}
184
+ onClick={scrollPrev}
185
+ {...props}
186
+ >
187
+ <IconChevronLeft
188
+ stroke={['xs', 'sm', 'icon-xs', 'icon-sm'].includes(size ?? '') ? 1.75 : 1.5}
189
+ />
190
+ <span className="sr-only">Previous slide</span>
191
+ </Button>
192
+ )
193
+ }
194
+
195
+ function CarouselNext({
196
+ className,
197
+ variant = 'outline',
198
+ size = 'icon-sm',
199
+ ...props
200
+ }: React.ComponentProps<typeof Button>) {
201
+ const { orientation, scrollNext, canScrollNext } = useCarousel()
202
+
203
+ return (
204
+ <Button
205
+ data-slot="carousel-next"
206
+ variant={variant}
207
+ size={size}
208
+ className={cn(
209
+ 'absolute touch-manipulation rounded-full',
210
+ orientation === 'horizontal'
211
+ ? 'inset-y-0 -right-12 my-auto'
212
+ : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
213
+ className
214
+ )}
215
+ disabled={!canScrollNext}
216
+ onClick={scrollNext}
217
+ {...props}
218
+ >
219
+ <IconChevronRight
220
+ stroke={['xs', 'sm', 'icon-xs', 'icon-sm'].includes(size ?? '') ? 1.75 : 1.5}
221
+ />
222
+ <span className="sr-only">Next slide</span>
223
+ </Button>
224
+ )
225
+ }
226
+
227
+ export {
228
+ type CarouselApi,
229
+ Carousel,
230
+ CarouselContent,
231
+ CarouselItem,
232
+ CarouselPrevious,
233
+ CarouselNext,
234
+ useCarousel
235
+ }