@olympusoss/canvas 2.20.1 → 4.0.0

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 (208) hide show
  1. package/package.json +41 -177
  2. package/src/cn.ts +3 -0
  3. package/src/index.ts +12 -603
  4. package/src/theme.ts +41 -0
  5. package/src/tokens.ts +11 -0
  6. package/styles/base.css +17 -0
  7. package/styles/canvas.css +69 -52
  8. package/styles/components/alert.css +66 -0
  9. package/styles/components/app-shell.css +46 -0
  10. package/styles/components/avatar.css +15 -0
  11. package/styles/components/badge.css +83 -0
  12. package/styles/components/breadcrumb.css +35 -0
  13. package/styles/components/button-group.css +23 -0
  14. package/styles/components/button.css +107 -0
  15. package/styles/components/calendar.css +73 -0
  16. package/styles/components/card.css +58 -0
  17. package/styles/components/checkbox.css +55 -0
  18. package/styles/components/code-block.css +18 -0
  19. package/styles/components/combobox.css +75 -0
  20. package/styles/components/command.css +94 -0
  21. package/styles/components/data-table.css +142 -0
  22. package/styles/components/dialog.css +72 -0
  23. package/styles/components/dropdown.css +54 -0
  24. package/styles/components/empty-state.css +17 -0
  25. package/styles/components/field.css +27 -0
  26. package/styles/components/filter-panel.css +58 -0
  27. package/styles/components/form.css +27 -0
  28. package/styles/components/icon.css +8 -0
  29. package/styles/components/input-group.css +45 -0
  30. package/styles/components/input.css +56 -0
  31. package/styles/components/kbd.css +15 -0
  32. package/styles/components/page-header.css +52 -0
  33. package/styles/components/pagination.css +48 -0
  34. package/styles/components/popover.css +14 -0
  35. package/styles/components/radio.css +28 -0
  36. package/styles/components/row-menu.css +69 -0
  37. package/styles/components/section-card.css +49 -0
  38. package/styles/components/select.css +57 -0
  39. package/styles/components/separator.css +32 -0
  40. package/styles/components/sheet.css +70 -0
  41. package/styles/components/sidebar.css +146 -0
  42. package/styles/components/skeleton.css +32 -0
  43. package/styles/components/spinner.css +26 -0
  44. package/styles/components/stat-card.css +71 -0
  45. package/styles/components/stepper.css +63 -0
  46. package/styles/components/switch.css +45 -0
  47. package/styles/components/tabs.css +40 -0
  48. package/styles/components/textarea.css +31 -0
  49. package/styles/components/toast.css +95 -0
  50. package/styles/components/tooltip.css +53 -0
  51. package/styles/components/topbar.css +24 -0
  52. package/styles/components/typography.css +105 -0
  53. package/styles/patterns/backdrops.css +35 -0
  54. package/styles/patterns/density.css +66 -0
  55. package/styles/patterns/focus.css +38 -0
  56. package/styles/patterns/glass.css +85 -0
  57. package/styles/patterns/high-contrast.css +70 -0
  58. package/styles/patterns/reduced-motion.css +12 -0
  59. package/styles/patterns/scrollbar.css +10 -0
  60. package/styles/reset.css +89 -0
  61. package/styles/tokens/colors.css +106 -0
  62. package/styles/tokens/motion.css +33 -0
  63. package/styles/tokens/radius.css +10 -0
  64. package/styles/tokens/shadows.css +35 -0
  65. package/styles/tokens/spacing.css +19 -0
  66. package/styles/tokens/typography.css +6 -0
  67. package/styles/tokens/z-index.css +12 -0
  68. package/tsconfig.json +20 -21
  69. package/README.md +0 -60
  70. package/src/components/atoms/README.md +0 -11
  71. package/src/components/atoms/aspect-ratio.tsx +0 -32
  72. package/src/components/atoms/avatar.tsx +0 -98
  73. package/src/components/atoms/badge.tsx +0 -44
  74. package/src/components/atoms/brand-mark.tsx +0 -74
  75. package/src/components/atoms/button.tsx +0 -105
  76. package/src/components/atoms/checkbox.tsx +0 -63
  77. package/src/components/atoms/flex-box.tsx +0 -105
  78. package/src/components/atoms/icon.tsx +0 -34
  79. package/src/components/atoms/input.tsx +0 -92
  80. package/src/components/atoms/label.tsx +0 -41
  81. package/src/components/atoms/logo.tsx +0 -89
  82. package/src/components/atoms/progress.tsx +0 -55
  83. package/src/components/atoms/radio-group.tsx +0 -122
  84. package/src/components/atoms/scroll-area.tsx +0 -106
  85. package/src/components/atoms/section.tsx +0 -48
  86. package/src/components/atoms/separator.tsx +0 -45
  87. package/src/components/atoms/skeleton.tsx +0 -17
  88. package/src/components/atoms/slider.tsx +0 -93
  89. package/src/components/atoms/spinner.tsx +0 -47
  90. package/src/components/atoms/switch.tsx +0 -60
  91. package/src/components/atoms/textarea.tsx +0 -78
  92. package/src/components/atoms/toggle.tsx +0 -80
  93. package/src/components/charts/activity-heatmap.tsx +0 -186
  94. package/src/components/charts/axes.tsx +0 -21
  95. package/src/components/charts/chart-container.tsx +0 -254
  96. package/src/components/charts/chart-legend.tsx +0 -67
  97. package/src/components/charts/chart-tooltip.tsx +0 -161
  98. package/src/components/charts/chart-types.tsx +0 -49
  99. package/src/components/charts/containers.tsx +0 -11
  100. package/src/components/charts/data.tsx +0 -16
  101. package/src/components/charts/details.tsx +0 -25
  102. package/src/components/charts/dot-pulse.tsx +0 -61
  103. package/src/components/charts/gauge.tsx +0 -106
  104. package/src/components/charts/grids.tsx +0 -8
  105. package/src/components/charts/index.ts +0 -62
  106. package/src/components/charts/labeled-bar-list.tsx +0 -85
  107. package/src/components/charts/metric-breakdown.tsx +0 -316
  108. package/src/components/charts/references.tsx +0 -8
  109. package/src/components/charts/service-health-list.tsx +0 -85
  110. package/src/components/charts/sparkline-area.tsx +0 -80
  111. package/src/components/charts/sparkline.tsx +0 -52
  112. package/src/components/charts/stacked-bar.tsx +0 -104
  113. package/src/components/charts/text.tsx +0 -10
  114. package/src/components/charts/world-heat-map-inner.tsx +0 -317
  115. package/src/components/charts/world-heat-map.tsx +0 -184
  116. package/src/components/molecules/README.md +0 -12
  117. package/src/components/molecules/action-bar.tsx +0 -73
  118. package/src/components/molecules/activity-item.tsx +0 -74
  119. package/src/components/molecules/alert.tsx +0 -86
  120. package/src/components/molecules/animated-background.tsx +0 -92
  121. package/src/components/molecules/auth-shell.tsx +0 -95
  122. package/src/components/molecules/brand-lockup.tsx +0 -48
  123. package/src/components/molecules/breadcrumb.tsx +0 -157
  124. package/src/components/molecules/button-group.tsx +0 -104
  125. package/src/components/molecules/calendar.tsx +0 -217
  126. package/src/components/molecules/card.tsx +0 -102
  127. package/src/components/molecules/client-brand.tsx +0 -95
  128. package/src/components/molecules/code-block.tsx +0 -86
  129. package/src/components/molecules/countdown-button.tsx +0 -92
  130. package/src/components/molecules/empty-state.tsx +0 -56
  131. package/src/components/molecules/error-state.tsx +0 -42
  132. package/src/components/molecules/field-display.tsx +0 -35
  133. package/src/components/molecules/input-otp.tsx +0 -74
  134. package/src/components/molecules/launcher-card.tsx +0 -152
  135. package/src/components/molecules/loading-state.tsx +0 -36
  136. package/src/components/molecules/notification-item.tsx +0 -67
  137. package/src/components/molecules/notification-list.tsx +0 -45
  138. package/src/components/molecules/number-badge.tsx +0 -53
  139. package/src/components/molecules/or-separator.tsx +0 -38
  140. package/src/components/molecules/page-header.tsx +0 -88
  141. package/src/components/molecules/page-tabs.tsx +0 -94
  142. package/src/components/molecules/pagination.tsx +0 -150
  143. package/src/components/molecules/password-input.tsx +0 -83
  144. package/src/components/molecules/password-strength-meter.tsx +0 -104
  145. package/src/components/molecules/phone-input.tsx +0 -200
  146. package/src/components/molecules/search-bar.tsx +0 -64
  147. package/src/components/molecules/secret-field.tsx +0 -158
  148. package/src/components/molecules/section-card.tsx +0 -91
  149. package/src/components/molecules/social-buttons.tsx +0 -165
  150. package/src/components/molecules/stat-card.tsx +0 -100
  151. package/src/components/molecules/status-badge.tsx +0 -42
  152. package/src/components/molecules/stepper.tsx +0 -96
  153. package/src/components/molecules/table.tsx +0 -157
  154. package/src/components/molecules/terminal.tsx +0 -74
  155. package/src/components/molecules/toggle-group.tsx +0 -145
  156. package/src/components/molecules/tooltip.tsx +0 -155
  157. package/src/components/molecules/user-avatar-chip.tsx +0 -71
  158. package/src/components/organisms/README.md +0 -14
  159. package/src/components/organisms/accordion.tsx +0 -154
  160. package/src/components/organisms/alert-dialog.tsx +0 -277
  161. package/src/components/organisms/carousel.tsx +0 -244
  162. package/src/components/organisms/collapsible.tsx +0 -69
  163. package/src/components/organisms/command.tsx +0 -144
  164. package/src/components/organisms/context-menu.tsx +0 -339
  165. package/src/components/organisms/dashboard-grid.tsx +0 -369
  166. package/src/components/organisms/data-table.tsx +0 -330
  167. package/src/components/organisms/dialog.tsx +0 -312
  168. package/src/components/organisms/drawer.tsx +0 -123
  169. package/src/components/organisms/dropdown-menu.tsx +0 -440
  170. package/src/components/organisms/editors/code-editor.tsx +0 -144
  171. package/src/components/organisms/editors/index.ts +0 -4
  172. package/src/components/organisms/editors/markdown-editor.tsx +0 -153
  173. package/src/components/organisms/editors/markdown-renderer.ts +0 -27
  174. package/src/components/organisms/editors/prose-canvas-classes.ts +0 -45
  175. package/src/components/organisms/editors/rich-text-editor.tsx +0 -126
  176. package/src/components/organisms/editors/toolbar/md-toolbar.tsx +0 -129
  177. package/src/components/organisms/editors/toolbar/rte-toolbar.tsx +0 -211
  178. package/src/components/organisms/editors/toolbar/toolbar-shell.tsx +0 -45
  179. package/src/components/organisms/editors/use-codemirror-theme.ts +0 -61
  180. package/src/components/organisms/error-boundary.tsx +0 -61
  181. package/src/components/organisms/form.tsx +0 -174
  182. package/src/components/organisms/hover-card.tsx +0 -115
  183. package/src/components/organisms/menubar.tsx +0 -498
  184. package/src/components/organisms/navbar.tsx +0 -104
  185. package/src/components/organisms/navigation-menu.tsx +0 -235
  186. package/src/components/organisms/popover.tsx +0 -149
  187. package/src/components/organisms/resizable.tsx +0 -58
  188. package/src/components/organisms/schema-form.tsx +0 -232
  189. package/src/components/organisms/select.tsx +0 -309
  190. package/src/components/organisms/sheet.tsx +0 -265
  191. package/src/components/organisms/sidebar.tsx +0 -1040
  192. package/src/components/organisms/sonner.tsx +0 -96
  193. package/src/components/organisms/tabs.tsx +0 -133
  194. package/src/components/organisms/theme-provider.tsx +0 -101
  195. package/src/hooks/use-mobile.tsx +0 -19
  196. package/src/lib/portal-container.tsx +0 -35
  197. package/src/lib/utils.ts +0 -6
  198. package/src/native.ts +0 -23
  199. package/src/tokens/colors.ts +0 -91
  200. package/src/tokens/index.ts +0 -3
  201. package/src/tokens/spacing.ts +0 -55
  202. package/src/tokens/typography.ts +0 -27
  203. package/styles/dashboard-grid.css +0 -47
  204. package/styles/fonts/Roboto-VariableFont_wdth_wght.ttf +0 -0
  205. package/styles/glass.css +0 -171
  206. package/styles/leaflet.css +0 -13
  207. package/styles/tokens.css +0 -317
  208. package/tailwind.config.ts +0 -70
@@ -1,55 +0,0 @@
1
- "use client";
2
-
3
- import * as ProgressPrimitive from "@radix-ui/react-progress";
4
- import * as React from "react";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export interface ProgressProps
9
- extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {
10
- /**
11
- * Current progress as a number between `0` and `max`. When `null` the
12
- * indicator renders in indeterminate mode (Radix's default
13
- * loading-spinner-style fill).
14
- * @default null
15
- */
16
- value?: number | null;
17
- /**
18
- * Maximum value the progress can reach. The fill width is
19
- * `value / max * 100%`.
20
- * @default 100
21
- */
22
- max?: number;
23
- /**
24
- * Function that returns the accessible label announcing the current
25
- * value to screen readers. Defaults to `"X%"`.
26
- */
27
- getValueLabel?: (value: number, max: number) => string;
28
- /**
29
- * Render as a Radix Slot — forwards props onto the immediate child
30
- * element instead of rendering a wrapper `<div>`.
31
- * @default false
32
- */
33
- asChild?: boolean;
34
- /** Tailwind / CSS classes merged onto the track via `cn()`. */
35
- className?: string;
36
- }
37
-
38
- const Progress = React.forwardRef<React.ElementRef<typeof ProgressPrimitive.Root>, ProgressProps>(
39
- ({ className, value, ...props }, ref) => (
40
- <ProgressPrimitive.Root
41
- ref={ref}
42
- className={cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className)}
43
- value={value}
44
- {...props}
45
- >
46
- <ProgressPrimitive.Indicator
47
- className="h-full w-full flex-1 bg-primary transition-all"
48
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
49
- />
50
- </ProgressPrimitive.Root>
51
- ),
52
- );
53
- Progress.displayName = ProgressPrimitive.Root.displayName;
54
-
55
- export { Progress };
@@ -1,122 +0,0 @@
1
- "use client";
2
-
3
- import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
4
- import { Circle } from "lucide-react";
5
- import * as React from "react";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- export interface RadioGroupProps
10
- extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {
11
- /**
12
- * Controlled selected value. Pair with `onValueChange`. Match the
13
- * `value` of one of the child `<RadioGroupItem>`s.
14
- */
15
- value?: string;
16
- /**
17
- * Initial selected value for uncontrolled usage. Ignored if `value` is
18
- * also passed.
19
- */
20
- defaultValue?: string;
21
- /** Fires when the user picks a different option. */
22
- onValueChange?: (value: string) => void;
23
- /**
24
- * Disables every radio in the group.
25
- * @default false
26
- */
27
- disabled?: boolean;
28
- /**
29
- * Required for native form submission — at least one option must be
30
- * selected.
31
- * @default false
32
- */
33
- required?: boolean;
34
- /** Form field name. Required when relying on uncontrolled native form submission. */
35
- name?: string;
36
- /**
37
- * Layout direction of the radios.
38
- * @default "vertical"
39
- */
40
- orientation?: "horizontal" | "vertical";
41
- /**
42
- * Reading direction of the group. Affects keyboard arrow navigation.
43
- * @default "ltr"
44
- */
45
- dir?: "ltr" | "rtl";
46
- /**
47
- * When true, arrow-key navigation wraps from the last item back to the
48
- * first.
49
- * @default true
50
- */
51
- loop?: boolean;
52
- /**
53
- * Render as a Radix Slot — forwards props onto the immediate child
54
- * element instead of rendering a wrapper `<div>`.
55
- * @default false
56
- */
57
- asChild?: boolean;
58
- /** A flat list of `<RadioGroupItem>`s. */
59
- children?: React.ReactNode;
60
- /** Tailwind / CSS classes merged onto the group via `cn()`. */
61
- className?: string;
62
- }
63
-
64
- const RadioGroup = React.forwardRef<
65
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
66
- RadioGroupProps
67
- >(({ className, ...props }, ref) => {
68
- return <RadioGroupPrimitive.Root className={cn("grid gap-2", className)} {...props} ref={ref} />;
69
- });
70
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
71
-
72
- export interface RadioGroupItemProps
73
- extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {
74
- /**
75
- * Value reported when this radio is selected. Required — must match
76
- * the parent `<RadioGroup>`'s `value` for selection to register.
77
- */
78
- value: string;
79
- /**
80
- * Disables only this radio.
81
- * @default false
82
- */
83
- disabled?: boolean;
84
- /**
85
- * Required for native form submission.
86
- * @default false
87
- */
88
- required?: boolean;
89
- /**
90
- * Render as a Radix Slot — forwards props onto the immediate child
91
- * element instead of rendering a wrapper `<button>`.
92
- * @default false
93
- */
94
- asChild?: boolean;
95
- /** Optional inner content (visual only — Radix provides the indicator). */
96
- children?: React.ReactNode;
97
- /** Tailwind / CSS classes merged onto the radio button via `cn()`. */
98
- className?: string;
99
- }
100
-
101
- const RadioGroupItem = React.forwardRef<
102
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
103
- RadioGroupItemProps
104
- >(({ className, ...props }, ref) => {
105
- return (
106
- <RadioGroupPrimitive.Item
107
- ref={ref}
108
- className={cn(
109
- "aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
110
- className,
111
- )}
112
- {...props}
113
- >
114
- <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
115
- <Circle className="h-3.5 w-3.5 fill-primary" />
116
- </RadioGroupPrimitive.Indicator>
117
- </RadioGroupPrimitive.Item>
118
- );
119
- });
120
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
121
-
122
- export { RadioGroup, RadioGroupItem };
@@ -1,106 +0,0 @@
1
- "use client";
2
-
3
- import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
4
- import * as React from "react";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export interface ScrollAreaProps
9
- extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {
10
- /**
11
- * When the scrollbar is shown:
12
- * - `"hover"` reveals on hover and 600ms after scroll
13
- * - `"scroll"` reveals only while scrolling
14
- * - `"auto"` defers to OS conventions (always-visible on Linux/Win)
15
- * - `"always"` keeps the scrollbar visible at all times
16
- * @default "hover"
17
- */
18
- type?: "auto" | "always" | "scroll" | "hover";
19
- /**
20
- * How long the scrollbar lingers after scroll/hover ends, in ms. Only
21
- * applies when `type` is `"hover"` or `"scroll"`.
22
- * @default 600
23
- */
24
- scrollHideDelay?: number;
25
- /**
26
- * Reading direction. Affects which side the vertical scrollbar lives on.
27
- * @default "ltr"
28
- */
29
- dir?: "ltr" | "rtl";
30
- /**
31
- * Render as a Radix Slot — forwards props onto the immediate child
32
- * element instead of rendering a wrapper `<div>`.
33
- * @default false
34
- */
35
- asChild?: boolean;
36
- /** Scrollable content. */
37
- children?: React.ReactNode;
38
- /**
39
- * Tailwind / CSS classes merged onto the root via `cn()`. Set the
40
- * height/max-height here so the scroll area knows when to scroll.
41
- */
42
- className?: string;
43
- }
44
-
45
- const ScrollArea = React.forwardRef<
46
- React.ElementRef<typeof ScrollAreaPrimitive.Root>,
47
- ScrollAreaProps
48
- >(({ className, children, ...props }, ref) => (
49
- <ScrollAreaPrimitive.Root
50
- ref={ref}
51
- className={cn("relative overflow-hidden", className)}
52
- {...props}
53
- >
54
- <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
55
- {children}
56
- </ScrollAreaPrimitive.Viewport>
57
- <ScrollBar />
58
- <ScrollAreaPrimitive.Corner />
59
- </ScrollAreaPrimitive.Root>
60
- ));
61
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
62
-
63
- export interface ScrollBarProps
64
- extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar> {
65
- /**
66
- * Which axis the scrollbar controls.
67
- * @default "vertical"
68
- */
69
- orientation?: "horizontal" | "vertical";
70
- /**
71
- * Force the scrollbar to mount even when it's not needed (no overflow).
72
- * Pair with a CSS animation that fades in/out based on `data-state`.
73
- * @default false
74
- */
75
- forceMount?: true;
76
- /**
77
- * Render as a Radix Slot — forwards props onto the immediate child
78
- * element instead of rendering a wrapper `<div>`.
79
- * @default false
80
- */
81
- asChild?: boolean;
82
- /** Tailwind / CSS classes merged onto the scrollbar via `cn()`. */
83
- className?: string;
84
- }
85
-
86
- const ScrollBar = React.forwardRef<
87
- React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
88
- ScrollBarProps
89
- >(({ className, orientation = "vertical", ...props }, ref) => (
90
- <ScrollAreaPrimitive.ScrollAreaScrollbar
91
- ref={ref}
92
- orientation={orientation}
93
- className={cn(
94
- "flex touch-none select-none transition-colors",
95
- orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
96
- orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
97
- className,
98
- )}
99
- {...props}
100
- >
101
- <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
102
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
103
- ));
104
- ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
105
-
106
- export { ScrollArea, ScrollBar };
@@ -1,48 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { cn } from "../../lib/utils";
4
-
5
- export interface SectionProps extends React.HTMLAttributes<HTMLDivElement> {
6
- /**
7
- * Vertical-rhythm step applied as `space-y-*` between immediate children.
8
- * Maps to Tailwind's spacing scale: `0` = 0, `1` = 8px, `2` = 16px,
9
- * `3` = 24px, `4` = 32px, `5` = 40px, `6` = 48px.
10
- * @default 3
11
- */
12
- spacing?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
13
- /** Section content — typically a heading + body, or stacked cards. */
14
- children?: React.ReactNode;
15
- /** Tailwind / CSS classes merged onto the root `<div>` via `cn()`. */
16
- className?: string;
17
- /** DOM id, useful when linked to from a `<Label>` or anchor `#hash`. */
18
- id?: string;
19
- /**
20
- * ARIA role override. Pass `"region"` (paired with `aria-label` /
21
- * `aria-labelledby`) when the section should be a navigable landmark
22
- * for screen-reader users.
23
- */
24
- role?: React.AriaRole;
25
- /** Accessible label for landmark-role sections. */
26
- "aria-label"?: string;
27
- /** ID of an element that labels the section (e.g. its heading). */
28
- "aria-labelledby"?: string;
29
- /** ID of an element that describes the section. */
30
- "aria-describedby"?: string;
31
- }
32
-
33
- const SPACING: Record<number, string> = {
34
- 0: "space-y-0",
35
- 1: "space-y-2",
36
- 2: "space-y-4",
37
- 3: "space-y-6",
38
- 4: "space-y-8",
39
- 5: "space-y-10",
40
- 6: "space-y-12",
41
- };
42
-
43
- export const Section = React.forwardRef<HTMLDivElement, SectionProps>(
44
- ({ spacing = 3, className, ...rest }, ref) => (
45
- <div ref={ref} className={cn(SPACING[spacing] ?? "space-y-6", className)} {...rest} />
46
- ),
47
- );
48
- Section.displayName = "Section";
@@ -1,45 +0,0 @@
1
- "use client";
2
-
3
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
4
- import * as React from "react";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export interface SeparatorProps
9
- extends React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root> {
10
- /**
11
- * Layout direction. `horizontal` is a 1px row spanning width;
12
- * `vertical` is a 1px column spanning height.
13
- * @default "horizontal"
14
- */
15
- orientation?: "horizontal" | "vertical";
16
- /**
17
- * When true (default), the separator is hidden from screen readers. Set
18
- * to false for separators that have semantic meaning.
19
- * @default true
20
- */
21
- decorative?: boolean;
22
- asChild?: boolean;
23
- className?: string;
24
- }
25
-
26
- /** Thin divider line — horizontal (default) or vertical. */
27
- const Separator = React.forwardRef<
28
- React.ElementRef<typeof SeparatorPrimitive.Root>,
29
- SeparatorProps
30
- >(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
31
- <SeparatorPrimitive.Root
32
- ref={ref}
33
- decorative={decorative}
34
- orientation={orientation}
35
- className={cn(
36
- "shrink-0 bg-border",
37
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
38
- className,
39
- )}
40
- {...props}
41
- />
42
- ));
43
- Separator.displayName = SeparatorPrimitive.Root.displayName;
44
-
45
- export { Separator };
@@ -1,17 +0,0 @@
1
- import type * as React from "react";
2
-
3
- import { cn } from "../../lib/utils";
4
-
5
- export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
6
- className?: string;
7
- }
8
-
9
- /**
10
- * Animated placeholder for content that's loading. Set width/height via
11
- * className; Skeleton fills with a pulsing tinted block.
12
- */
13
- function Skeleton({ className, ...props }: SkeletonProps) {
14
- return <div className={cn("animate-pulse rounded-md bg-primary/10", className)} {...props} />;
15
- }
16
-
17
- export { Skeleton };
@@ -1,93 +0,0 @@
1
- "use client";
2
-
3
- import * as SliderPrimitive from "@radix-ui/react-slider";
4
- import * as React from "react";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export interface SliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
9
- /**
10
- * Controlled value. Pass an array — single-thumb sliders use a length-1
11
- * tuple (`[40]`), range sliders use length-2 (`[20, 80]`). Pair with
12
- * `onValueChange`.
13
- */
14
- value?: number[];
15
- /**
16
- * Initial value for uncontrolled usage. Same array shape as `value`.
17
- * @default [0]
18
- */
19
- defaultValue?: number[];
20
- /** Fires on every move. Use this for live previews. */
21
- onValueChange?: (value: number[]) => void;
22
- /** Fires when the user releases the thumb (commit handler). */
23
- onValueCommit?: (value: number[]) => void;
24
- /**
25
- * Minimum value the slider can reach.
26
- * @default 0
27
- */
28
- min?: number;
29
- /**
30
- * Maximum value the slider can reach.
31
- * @default 100
32
- */
33
- max?: number;
34
- /**
35
- * Quantum the slider snaps to. Set to `1` for integer-only values.
36
- * @default 1
37
- */
38
- step?: number;
39
- /**
40
- * Minimum gap between two thumbs in a range slider. Ignored for
41
- * single-thumb sliders.
42
- * @default 0
43
- */
44
- minStepsBetweenThumbs?: number;
45
- /**
46
- * Layout direction.
47
- * @default "horizontal"
48
- */
49
- orientation?: "horizontal" | "vertical";
50
- /**
51
- * Reading direction. Affects which end is "min" on the visual axis.
52
- * @default "ltr"
53
- */
54
- dir?: "ltr" | "rtl";
55
- /**
56
- * Whether the slider is inverted — flips which end is "min".
57
- * @default false
58
- */
59
- inverted?: boolean;
60
- /**
61
- * Disable the slider.
62
- * @default false
63
- */
64
- disabled?: boolean;
65
- /** Form field name. Required when relying on uncontrolled native form submission. */
66
- name?: string;
67
- /**
68
- * Render as a Radix Slot — forwards props onto the immediate child
69
- * element instead of rendering a wrapper `<span>`.
70
- * @default false
71
- */
72
- asChild?: boolean;
73
- /** Tailwind / CSS classes merged onto the slider via `cn()`. */
74
- className?: string;
75
- }
76
-
77
- const Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, SliderProps>(
78
- ({ className, ...props }, ref) => (
79
- <SliderPrimitive.Root
80
- ref={ref}
81
- className={cn("relative flex w-full touch-none select-none items-center", className)}
82
- {...props}
83
- >
84
- <SliderPrimitive.Track className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20">
85
- <SliderPrimitive.Range className="absolute h-full bg-primary" />
86
- </SliderPrimitive.Track>
87
- <SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" />
88
- </SliderPrimitive.Root>
89
- ),
90
- );
91
- Slider.displayName = SliderPrimitive.Root.displayName;
92
-
93
- export { Slider };
@@ -1,47 +0,0 @@
1
- "use client";
2
-
3
- import { Loader2 } from "lucide-react";
4
- import * as React from "react";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export interface SpinnerProps extends React.SVGAttributes<SVGSVGElement> {
9
- /**
10
- * Pixel size of the rendered SVG.
11
- * @default 16
12
- */
13
- size?: number;
14
- /** Tailwind / CSS classes merged via `cn()`. */
15
- className?: string;
16
- /**
17
- * Accessible label announced by screen readers. Defaults to `"Loading"`.
18
- * Pass an empty string to mark as purely decorative when the surrounding
19
- * label already announces the loading state.
20
- */
21
- label?: string;
22
- }
23
-
24
- /**
25
- * Inline loading indicator. Wraps `Loader2` from lucide-react with the
26
- * canvas `animate-spin` keyframe and an accessible label.
27
- *
28
- * Use inside buttons (`{loading ? <Spinner/> : 'Submit'}`), next to inline
29
- * labels, or anywhere a small spinning indicator is appropriate. For a
30
- * full-section loader with a message, use `LoadingState` (molecule).
31
- */
32
- const Spinner = React.forwardRef<SVGSVGElement, SpinnerProps>(
33
- ({ size = 16, className, label = "Loading", ...props }, ref) => (
34
- <Loader2
35
- ref={ref}
36
- size={size}
37
- className={cn("animate-spin shrink-0", className)}
38
- role={label ? "status" : undefined}
39
- aria-label={label || undefined}
40
- aria-hidden={label ? undefined : true}
41
- {...props}
42
- />
43
- ),
44
- );
45
- Spinner.displayName = "Spinner";
46
-
47
- export { Spinner };
@@ -1,60 +0,0 @@
1
- "use client";
2
-
3
- import * as SwitchPrimitives from "@radix-ui/react-switch";
4
- import * as React from "react";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
9
- /** Controlled state. */
10
- checked?: boolean;
11
- /**
12
- * Initial state for uncontrolled usage.
13
- * @default false
14
- */
15
- defaultChecked?: boolean;
16
- /** Fires when the user flips the switch. */
17
- onCheckedChange?: (checked: boolean) => void;
18
- /**
19
- * Dims and blocks input.
20
- * @default false
21
- */
22
- disabled?: boolean;
23
- /**
24
- * Block native form submit unless the switch is on.
25
- * @default false
26
- */
27
- required?: boolean;
28
- /** Form field name for native form submission. */
29
- name?: string;
30
- /** Form field value when submitted. */
31
- value?: string;
32
- asChild?: boolean;
33
- className?: string;
34
- }
35
-
36
- /**
37
- * Wraps Radix's `Switch.Root` — a binary on/off toggle. Pair with `<Label>`
38
- * for accessibility.
39
- */
40
- const Switch = React.forwardRef<React.ElementRef<typeof SwitchPrimitives.Root>, SwitchProps>(
41
- ({ className, ...props }, ref) => (
42
- <SwitchPrimitives.Root
43
- className={cn(
44
- "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
45
- className,
46
- )}
47
- {...props}
48
- ref={ref}
49
- >
50
- <SwitchPrimitives.Thumb
51
- className={cn(
52
- "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",
53
- )}
54
- />
55
- </SwitchPrimitives.Root>
56
- ),
57
- );
58
- Switch.displayName = SwitchPrimitives.Root.displayName;
59
-
60
- export { Switch };
@@ -1,78 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { cn } from "../../lib/utils";
4
-
5
- export interface TextareaProps extends React.ComponentProps<"textarea"> {
6
- /** Controlled value. Pair with `onChange`. */
7
- value?: string | number | readonly string[];
8
- /** Uncontrolled initial value. */
9
- defaultValue?: string | number | readonly string[];
10
- /** Hint text shown when empty. */
11
- placeholder?: string;
12
- /**
13
- * Visible row count. Canvas's default min-height is 60px regardless;
14
- * `rows` overrides.
15
- */
16
- rows?: number;
17
- /** Visible column count (width). Canvas overrides this with `w-full`. */
18
- cols?: number;
19
- /**
20
- * Dim and block input.
21
- * @default false
22
- */
23
- disabled?: boolean;
24
- /**
25
- * Selectable but not editable.
26
- * @default false
27
- */
28
- readOnly?: boolean;
29
- /**
30
- * Block native form submit unless the textarea has a value.
31
- * @default false
32
- */
33
- required?: boolean;
34
- /** Form field name for native form submission. */
35
- name?: string;
36
- /** DOM id for `<Label htmlFor>` association. */
37
- id?: string;
38
- /** Browser autofill hint. */
39
- autoComplete?: string;
40
- /**
41
- * Focus on mount.
42
- * @default false
43
- */
44
- autoFocus?: boolean;
45
- /** Character count upper limit. */
46
- maxLength?: number;
47
- /** Character count lower limit. */
48
- minLength?: number;
49
- /** Fires on every keystroke. */
50
- onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
51
- /** Fires on focus. */
52
- onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
53
- /** Fires on blur. */
54
- onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
55
- className?: string;
56
- }
57
-
58
- /**
59
- * Styled wrapper around the native `<textarea>`. 60px min-height, rounded-md,
60
- * 1px border, transparent background.
61
- */
62
- const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
63
- ({ className, ...props }, ref) => {
64
- return (
65
- <textarea
66
- className={cn(
67
- "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
68
- className,
69
- )}
70
- ref={ref}
71
- {...props}
72
- />
73
- );
74
- },
75
- );
76
- Textarea.displayName = "Textarea";
77
-
78
- export { Textarea };