@devalok/shilp-sutra 0.48.0 → 0.49.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 (261) hide show
  1. package/BREAKING.json +32 -0
  2. package/MIGRATION.md +891 -881
  3. package/dist/_chunks/badge-group.js +52 -65
  4. package/dist/_chunks/badge-group.js.map +1 -1
  5. package/dist/_chunks/block-shell.js +1 -1
  6. package/dist/_chunks/chart-container.js +1 -1
  7. package/dist/_chunks/chat.js +4 -4
  8. package/dist/_chunks/chat.js.map +1 -1
  9. package/dist/_chunks/colors.js +2 -2
  10. package/dist/_chunks/document-preview.js +4 -4
  11. package/dist/_chunks/emoji-suggestion.js +5 -5
  12. package/dist/_chunks/emoji-suggestion.js.map +1 -1
  13. package/dist/_chunks/emoji.js +1 -1
  14. package/dist/_chunks/field-state.js +8 -0
  15. package/dist/_chunks/field-state.js.map +1 -0
  16. package/dist/_chunks/grid-lines.js +1 -1
  17. package/dist/_chunks/image-preview.js +7 -7
  18. package/dist/_chunks/keybinding.js +1 -1
  19. package/dist/_chunks/link-context.js +1 -1
  20. package/dist/_chunks/mention-suggestion.js +2 -2
  21. package/dist/_chunks/mention.js +1 -1
  22. package/dist/_chunks/motion-provider.js +1 -1
  23. package/dist/_chunks/normalize-icon.js +1 -1
  24. package/dist/_chunks/oauth-button.js +2 -2
  25. package/dist/_chunks/popover.js +55 -52
  26. package/dist/_chunks/popover.js.map +1 -1
  27. package/dist/_chunks/primitives.js +155 -155
  28. package/dist/_chunks/primitives.js.map +1 -1
  29. package/dist/_chunks/shared.js +5 -5
  30. package/dist/_chunks/success.js +4 -4
  31. package/dist/_chunks/tiptap.js +8 -8
  32. package/dist/_chunks/tooltip.js +1 -1
  33. package/dist/_chunks/tree-view.js +2 -2
  34. package/dist/_chunks/use-calendar.js +2 -2
  35. package/dist/_chunks/use-calendar.js.map +1 -1
  36. package/dist/_chunks/use-controllable-open.js +15 -0
  37. package/dist/_chunks/use-controllable-open.js.map +1 -0
  38. package/dist/_chunks/vendor-client.js +1 -1
  39. package/dist/_chunks/vendor-utils.js +1 -1
  40. package/dist/ai/block-renderer.js +7 -7
  41. package/dist/ai/blocks/error.js +1 -1
  42. package/dist/ai/blocks/index.js +2 -2
  43. package/dist/ai/blocks/text.js +1 -1
  44. package/dist/ai/command-bar.js +6 -6
  45. package/dist/ai/conversation.js +2 -2
  46. package/dist/ai/index.js +3 -3
  47. package/dist/composed/avatar-group.js +1 -1
  48. package/dist/composed/bulk-action-bar.js +1 -1
  49. package/dist/composed/command-palette.js +9 -9
  50. package/dist/composed/command-palette.js.map +1 -1
  51. package/dist/composed/confirm-dialog.js +3 -3
  52. package/dist/composed/confirm-dialog.js.map +1 -1
  53. package/dist/composed/content-card.js +1 -1
  54. package/dist/composed/date-picker/index.js +13 -13
  55. package/dist/composed/date-picker/index.js.map +1 -1
  56. package/dist/composed/emoji-picker.js +4 -4
  57. package/dist/composed/empty-state.js +1 -1
  58. package/dist/composed/error-boundary.js +1 -1
  59. package/dist/composed/error-boundary.js.map +1 -1
  60. package/dist/composed/extensions/emoji-node.js +1 -1
  61. package/dist/composed/extensions/emoji-suggestion.js +1 -1
  62. package/dist/composed/file-preview.js +14 -14
  63. package/dist/composed/filter-bar.js +1 -1
  64. package/dist/composed/index.d.ts +3 -1
  65. package/dist/composed/index.d.ts.map +1 -1
  66. package/dist/composed/index.js +4 -3
  67. package/dist/composed/loading-skeleton.js +15 -15
  68. package/dist/composed/loading-skeleton.js.map +1 -1
  69. package/dist/composed/multi-select-popover.js +3 -3
  70. package/dist/composed/page-header.d.ts.map +1 -1
  71. package/dist/composed/page-header.js +32 -45
  72. package/dist/composed/page-header.js.map +1 -1
  73. package/dist/composed/page-skeletons.js +19 -19
  74. package/dist/composed/page-skeletons.js.map +1 -1
  75. package/dist/composed/priority-indicator.js +1 -1
  76. package/dist/composed/responsive-modal.d.ts +39 -0
  77. package/dist/composed/responsive-modal.d.ts.map +1 -0
  78. package/dist/composed/responsive-modal.js +212 -0
  79. package/dist/composed/responsive-modal.js.map +1 -0
  80. package/dist/composed/rich-chat-input.js +445 -445
  81. package/dist/composed/rich-chat-input.js.map +1 -1
  82. package/dist/composed/rich-text-editor.js +29 -29
  83. package/dist/composed/rich-text-editor.js.map +1 -1
  84. package/dist/composed/schedule-view.d.ts +1 -1
  85. package/dist/composed/schedule-view.d.ts.map +1 -1
  86. package/dist/composed/schedule-view.js +48 -54
  87. package/dist/composed/schedule-view.js.map +1 -1
  88. package/dist/composed/status-badge.d.ts +13 -11
  89. package/dist/composed/status-badge.d.ts.map +1 -1
  90. package/dist/composed/status-badge.js +54 -130
  91. package/dist/composed/status-badge.js.map +1 -1
  92. package/dist/motion/index.js +2 -2
  93. package/dist/shell/bottom-navbar.js +3 -3
  94. package/dist/shell/bottom-navbar.js.map +1 -1
  95. package/dist/shell/index.js +2 -2
  96. package/dist/shell/link-context.js +2 -2
  97. package/dist/shell/notification-center.js +3 -3
  98. package/dist/shell/sidebar.js +2 -2
  99. package/dist/shell/top-bar.js +2 -2
  100. package/dist/shell/top-bar.js.map +1 -1
  101. package/dist/tokens/semantic.css +8 -1
  102. package/dist/ui/accordion.js +11 -11
  103. package/dist/ui/alert-dialog.js +34 -34
  104. package/dist/ui/alert.js +1 -1
  105. package/dist/ui/aspect-ratio.js +1 -1
  106. package/dist/ui/autocomplete.js +7 -7
  107. package/dist/ui/avatar.d.ts.map +1 -1
  108. package/dist/ui/avatar.js +84 -79
  109. package/dist/ui/avatar.js.map +1 -1
  110. package/dist/ui/badge-group.js +1 -1
  111. package/dist/ui/badge.d.ts.map +1 -1
  112. package/dist/ui/badge.js +1 -1
  113. package/dist/ui/banner.js +1 -1
  114. package/dist/ui/breadcrumb.d.ts +0 -1
  115. package/dist/ui/breadcrumb.d.ts.map +1 -1
  116. package/dist/ui/breadcrumb.js +58 -35
  117. package/dist/ui/breadcrumb.js.map +1 -1
  118. package/dist/ui/button.js +3 -3
  119. package/dist/ui/card.js +1 -1
  120. package/dist/ui/charts/area-chart.js +6 -6
  121. package/dist/ui/charts/bar-chart.js +6 -6
  122. package/dist/ui/charts/chart-container.js +1 -1
  123. package/dist/ui/charts/gauge-chart.js +2 -2
  124. package/dist/ui/charts/index.js +2 -2
  125. package/dist/ui/charts/line-chart.js +6 -6
  126. package/dist/ui/charts/pie-chart.js +5 -5
  127. package/dist/ui/charts/radar-chart.js +5 -5
  128. package/dist/ui/charts/sparkline.js +2 -2
  129. package/dist/ui/chat/index.js +2 -2
  130. package/dist/ui/checkbox.d.ts +4 -2
  131. package/dist/ui/checkbox.d.ts.map +1 -1
  132. package/dist/ui/checkbox.js +33 -28
  133. package/dist/ui/checkbox.js.map +1 -1
  134. package/dist/ui/collapsible.js +5 -5
  135. package/dist/ui/color-input.js +4 -4
  136. package/dist/ui/combobox.d.ts +3 -0
  137. package/dist/ui/combobox.d.ts.map +1 -1
  138. package/dist/ui/combobox.js +137 -132
  139. package/dist/ui/combobox.js.map +1 -1
  140. package/dist/ui/context-menu.js +32 -32
  141. package/dist/ui/dialog.d.ts.map +1 -1
  142. package/dist/ui/dialog.js +49 -46
  143. package/dist/ui/dialog.js.map +1 -1
  144. package/dist/ui/dot.d.ts +38 -0
  145. package/dist/ui/dot.d.ts.map +1 -0
  146. package/dist/ui/dot.js +92 -0
  147. package/dist/ui/dot.js.map +1 -0
  148. package/dist/ui/dropdown-menu.d.ts.map +1 -1
  149. package/dist/ui/dropdown-menu.js +81 -76
  150. package/dist/ui/dropdown-menu.js.map +1 -1
  151. package/dist/ui/hover-card.js +6 -6
  152. package/dist/ui/icon-button.js +1 -1
  153. package/dist/ui/index.d.ts +3 -2
  154. package/dist/ui/index.d.ts.map +1 -1
  155. package/dist/ui/index.js +67 -67
  156. package/dist/ui/index.js.map +1 -1
  157. package/dist/ui/input-otp.js +1 -1
  158. package/dist/ui/input-otp.js.map +1 -1
  159. package/dist/ui/input.d.ts +4 -2
  160. package/dist/ui/input.d.ts.map +1 -1
  161. package/dist/ui/input.js +39 -38
  162. package/dist/ui/input.js.map +1 -1
  163. package/dist/ui/label.js +1 -1
  164. package/dist/ui/lib/field-state.d.ts +21 -0
  165. package/dist/ui/lib/field-state.d.ts.map +1 -0
  166. package/dist/ui/lib/use-controllable-open.d.ts +32 -0
  167. package/dist/ui/lib/use-controllable-open.d.ts.map +1 -0
  168. package/dist/ui/lib/utils.js +4 -4
  169. package/dist/ui/link.js +1 -1
  170. package/dist/ui/menubar.js +53 -53
  171. package/dist/ui/navigation-menu.js +27 -27
  172. package/dist/ui/number-input.d.ts +4 -2
  173. package/dist/ui/number-input.d.ts.map +1 -1
  174. package/dist/ui/number-input.js +52 -51
  175. package/dist/ui/number-input.js.map +1 -1
  176. package/dist/ui/oauth-button/index.js +2 -2
  177. package/dist/ui/pagination.js +1 -1
  178. package/dist/ui/popover.d.ts.map +1 -1
  179. package/dist/ui/popover.js +2 -2
  180. package/dist/ui/progress.d.ts +66 -42
  181. package/dist/ui/progress.d.ts.map +1 -1
  182. package/dist/ui/progress.js +144 -40
  183. package/dist/ui/progress.js.map +1 -1
  184. package/dist/ui/radio.d.ts +6 -2
  185. package/dist/ui/radio.d.ts.map +1 -1
  186. package/dist/ui/radio.js +44 -33
  187. package/dist/ui/radio.js.map +1 -1
  188. package/dist/ui/segmented-control.js +1 -1
  189. package/dist/ui/select.d.ts +1 -1
  190. package/dist/ui/select.d.ts.map +1 -1
  191. package/dist/ui/select.js +56 -55
  192. package/dist/ui/select.js.map +1 -1
  193. package/dist/ui/separator.js +2 -2
  194. package/dist/ui/separator.js.map +1 -1
  195. package/dist/ui/sheet.d.ts.map +1 -1
  196. package/dist/ui/sheet.js +56 -53
  197. package/dist/ui/sheet.js.map +1 -1
  198. package/dist/ui/sidebar.js +6 -6
  199. package/dist/ui/sidebar.js.map +1 -1
  200. package/dist/ui/skeleton.js +1 -1
  201. package/dist/ui/slider.js +8 -8
  202. package/dist/ui/slider.js.map +1 -1
  203. package/dist/ui/split-button.js +3 -3
  204. package/dist/ui/stat-card.d.ts.map +1 -1
  205. package/dist/ui/stat-card.js +123 -126
  206. package/dist/ui/stat-card.js.map +1 -1
  207. package/dist/ui/stat-flash.js +1 -1
  208. package/dist/ui/stepper.js +1 -1
  209. package/dist/ui/surface.js +2 -2
  210. package/dist/ui/switch.d.ts +3 -1
  211. package/dist/ui/switch.d.ts.map +1 -1
  212. package/dist/ui/switch.js +32 -27
  213. package/dist/ui/switch.js.map +1 -1
  214. package/dist/ui/table-row-link.js +1 -1
  215. package/dist/ui/tabs.js +13 -13
  216. package/dist/ui/text.js +1 -1
  217. package/dist/ui/textarea.d.ts +3 -3
  218. package/dist/ui/textarea.d.ts.map +1 -1
  219. package/dist/ui/textarea.js +19 -18
  220. package/dist/ui/textarea.js.map +1 -1
  221. package/dist/ui/toast.js +2 -2
  222. package/dist/ui/toast.js.map +1 -1
  223. package/dist/ui/toggle-group.js +1 -1
  224. package/dist/ui/toggle.js +2 -2
  225. package/dist/ui/tooltip.d.ts.map +1 -1
  226. package/dist/ui/tooltip.js +37 -34
  227. package/dist/ui/tooltip.js.map +1 -1
  228. package/dist/ui/tree-view/index.js +2 -2
  229. package/docs/components/ai/ai-command-provider.md +46 -0
  230. package/docs/components/ai/block-renderer.md +59 -0
  231. package/docs/components/ai/command-bar.md +78 -0
  232. package/docs/components/ai/conversation.md +59 -0
  233. package/docs/components/ai/devadoot-icon.md +41 -0
  234. package/docs/components/composed/page-header.md +1 -1
  235. package/docs/components/composed/responsive-modal.md +66 -0
  236. package/docs/components/composed/schedule-view.md +6 -2
  237. package/docs/components/ui/breadcrumb.md +1 -1
  238. package/docs/components/ui/checkbox.md +4 -1
  239. package/docs/components/ui/combobox.md +4 -0
  240. package/docs/components/ui/dot.md +61 -0
  241. package/docs/components/ui/progress.md +54 -16
  242. package/docs/components/ui/radio.md +6 -2
  243. package/docs/components/ui/select.md +9 -5
  244. package/docs/components/ui/switch.md +4 -1
  245. package/docs/components/ui/table.md +2 -1
  246. package/llms.txt +11 -3
  247. package/make-kit/components/form.md +2 -2
  248. package/make-kit/components/icon.md +2 -2
  249. package/make-kit/components/overview.md +2 -2
  250. package/make-kit/components/select.md +1 -1
  251. package/make-kit/components/table.md +1 -1
  252. package/mcp-manifest.json +2656 -1068
  253. package/mcp-manifest.schema.json +18 -0
  254. package/package.json +11 -6
  255. package/skill/SKILL.md +1 -1
  256. package/skill/references/components.md +11 -3
  257. package/dist/ui/status-dot.d.ts +0 -27
  258. package/dist/ui/status-dot.d.ts.map +0 -1
  259. package/dist/ui/status-dot.js +0 -68
  260. package/dist/ui/status-dot.js.map +0 -1
  261. package/docs/components/ui/status-dot.md +0 -35
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/ui/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAA;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,CA4BnF,CAAA;AAGD,QAAA,MAAM,cAAc,gHAA2B,CAAA;AAE/C,QAAA,MAAM,aAAa,4GAA0B,CAAA;AAE7C,QAAA,MAAM,cAAc,gKAiDlB,CAAA;AAGF,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAA;AAEjG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAC,cAAc,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/ui/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAA;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAkBnF,CAAA;AAGD,QAAA,MAAM,cAAc,gHAA2B,CAAA;AAE/C,QAAA,MAAM,aAAa,4GAA0B,CAAA;AAE7C,QAAA,MAAM,cAAc,gKAiDlB,CAAA;AAGF,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAA;AAEjG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAC,cAAc,EAAE,cAAc,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { i as e, n as t, r as n, t as r } from "../_chunks/popover.js";
3
- export { r as Popover, t as PopoverAnchor, n as PopoverContent, e as PopoverTrigger };
2
+ import { Popover as e, PopoverAnchor as t, PopoverContent as n, PopoverTrigger as r } from "../_chunks/popover.js";
3
+ export { e as Popover, t as PopoverAnchor, n as PopoverContent, r as PopoverTrigger };
@@ -2,51 +2,75 @@
2
2
  import { VariantProps } from 'class-variance-authority';
3
3
  import * as ProgressPrimitive from '../primitives/react-progress';
4
4
  import * as React from 'react';
5
- declare const progressTrackVariants: (props?: ({
5
+ export type ProgressSize = 'sm' | 'md' | 'lg';
6
+ export type ProgressColor = 'accent' | 'success' | 'warning' | 'error';
7
+ export declare const progressTrackVariants: (props?: ({
6
8
  size?: "sm" | "md" | "lg" | null | undefined;
7
9
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
- declare const progressIndicatorVariants: (props?: ({
9
- color?: "default" | "success" | "error" | "warning" | null | undefined;
10
+ export declare const progressIndicatorVariants: (props?: ({
11
+ color?: ProgressColor | null | undefined;
10
12
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
11
- /**
12
- * Props for Progress a horizontal progress bar with size and color variants, an optional
13
- * percentage label, and an indeterminate animation when `value` is undefined/null.
14
- *
15
- * **Track size:** `sm` (4px) | `md` (8px, default) | `lg` (12px)
16
- *
17
- * **Indicator color:** `default` (brand interactive) | `success` | `warning` | `error`
18
- *
19
- * **Indeterminate:** Omit `value` (or pass `undefined`) to show an animated indeterminate bar.
20
- * When `value` is provided, it should be a number between 0–100.
21
- *
22
- * **`showLabel`:** Renders the percentage value next to the bar (only when `value` is set).
23
- *
24
- * @example
25
- * // Determinate upload progress:
26
- * <Progress value={uploadPercent} color="default" showLabel />
27
- *
28
- * @example
29
- * // Indeterminate loading bar (while waiting for an async operation):
30
- * <Progress size="sm" />
31
- *
32
- * @example
33
- * // Success-colored completion bar (e.g. after all tasks done):
34
- * <Progress value={100} color="success" size="md" />
35
- *
36
- * @example
37
- * // Warning threshold indicator (disk usage at 80%):
38
- * <Progress value={80} color="warning" showLabel size="lg" />
39
- * // These are just a few ways — feel free to combine props creatively!
40
- */
41
- interface ProgressProps extends Omit<React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>, 'color'>, VariantProps<typeof progressTrackVariants>, VariantProps<typeof progressIndicatorVariants> {
42
- /** Additional class names for the indicator element */
43
- indicatorClassName?: string;
44
- /** Display the percentage label next to the progress bar */
45
- showLabel?: boolean;
46
- /** When true, color auto-shifts by value: 0-59 = default (accent), 60-84 = warning, 85-100 = success, >100 = error. @default false */
13
+ export interface ProgressRootProps extends React.HTMLAttributes<HTMLDivElement> {
14
+ /** 0–max. Omit (or null) for an indeterminate bar. */
15
+ value?: number | null;
16
+ /** Scale maximum. @default 100 */
17
+ max?: number;
18
+ /** Track thickness. @default 'md' */
19
+ size?: ProgressSize;
20
+ }
21
+ declare const ProgressRoot: React.ForwardRefExoticComponent<ProgressRootProps & React.RefAttributes<HTMLDivElement>>;
22
+ export type ProgressTrackProps = React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>;
23
+ declare const ProgressTrack: React.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
24
+ export interface ProgressIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
25
+ /** Fill colour. Omit to auto-colour by value. */
26
+ color?: ProgressColor;
27
+ /** Force auto-colour even when `color` is unset. @default true when color unset */
47
28
  autoColor?: boolean;
48
29
  }
49
- declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
50
- export { Progress, progressIndicatorVariants, progressTrackVariants };
51
- export type { ProgressProps };
30
+ declare const ProgressIndicator: React.ForwardRefExoticComponent<ProgressIndicatorProps & React.RefAttributes<HTMLDivElement>>;
31
+ export interface ProgressSegmentProps extends React.HTMLAttributes<HTMLDivElement> {
32
+ /** This segment's portion of `max`. */
33
+ value: number;
34
+ color?: ProgressColor;
35
+ }
36
+ declare const ProgressSegment: React.ForwardRefExoticComponent<ProgressSegmentProps & React.RefAttributes<HTMLDivElement>>;
37
+ export type ProgressLabelProps = React.HTMLAttributes<HTMLSpanElement>;
38
+ declare const ProgressLabel: React.ForwardRefExoticComponent<ProgressLabelProps & React.RefAttributes<HTMLSpanElement>>;
39
+ export interface ProgressValueProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
40
+ /** Format the percentage. Default: `${round(pct)}%`. */
41
+ format?: (pct: number, value: number | null, max: number) => React.ReactNode;
42
+ children?: React.ReactNode;
43
+ }
44
+ declare const ProgressValue: React.ForwardRefExoticComponent<ProgressValueProps & React.RefAttributes<HTMLSpanElement>>;
45
+ export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, VariantProps<typeof progressTrackVariants> {
46
+ /** 0–max. Omit (or null) for an indeterminate bar. */
47
+ value?: number | null;
48
+ max?: number;
49
+ /** Fill colour. Omit + set `autoColor` to colour by value. */
50
+ color?: ProgressColor;
51
+ /** Auto-colour the fill by value (0–59 accent · 60–84 warning · 85–100 success · >100 error). @default false */
52
+ autoColor?: boolean;
53
+ /** Descriptive label rendered before the bar. */
54
+ label?: React.ReactNode;
55
+ /** Show the `{n}%` readout after the bar. */
56
+ showValue?: boolean;
57
+ /** Multi-segment bar: each slice is `value` (portion of max) + `color`. Overrides the single indicator. */
58
+ segments?: Array<{
59
+ value: number;
60
+ color?: ProgressColor;
61
+ }>;
62
+ /** Class for the Track element. */
63
+ trackClassName?: string;
64
+ /** Class for the single Indicator (ignored when `segments` is set). */
65
+ indicatorClassName?: string;
66
+ }
67
+ declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>> & {
68
+ Root: React.ForwardRefExoticComponent<ProgressRootProps & React.RefAttributes<HTMLDivElement>>;
69
+ Track: React.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
70
+ Indicator: React.ForwardRefExoticComponent<ProgressIndicatorProps & React.RefAttributes<HTMLDivElement>>;
71
+ Segment: React.ForwardRefExoticComponent<ProgressSegmentProps & React.RefAttributes<HTMLDivElement>>;
72
+ Label: React.ForwardRefExoticComponent<ProgressLabelProps & React.RefAttributes<HTMLSpanElement>>;
73
+ Value: React.ForwardRefExoticComponent<ProgressValueProps & React.RefAttributes<HTMLSpanElement>>;
74
+ };
75
+ export { Progress, ProgressIndicator, ProgressLabel, ProgressRoot, ProgressSegment, ProgressTrack, ProgressValue, };
52
76
  //# sourceMappingURL=progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/ui/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,QAAA,MAAM,qBAAqB;;8EAY1B,CAAA;AAED,QAAA,MAAM,yBAAyB;;8EAa9B,CAAA;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,UAAU,aACR,SAAQ,IAAI,CACR,KAAK,CAAC,wBAAwB,CAAC,OAAO,iBAAiB,CAAC,IAAI,CA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C,EAAE,OAAO,CAAA;IACnB,iDAAiD;IACjD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,aAAa,CAAA;KAAE,CAAC,CAAA;IAC1D,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAgCD,QAAA,MAAM,QAAQ;;;;;;;CAOZ,CAAA;AAEF,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,GACd,CAAA"}
@@ -1,52 +1,156 @@
1
1
  "use client";
2
- import { A as e, k as t } from "../_chunks/primitives.js";
3
- import { springs as n } from "./lib/motion.js";
4
- import { t as r } from "../_chunks/vendor-utils.js";
5
- import { cn as i } from "./lib/utils.js";
6
- import * as a from "react";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
- import { motion as c } from "framer-motion";
2
+ import { Root as e } from "../_chunks/primitives.js";
3
+ import { springs as t } from "./lib/motion.js";
4
+ import { cva as n } from "../_chunks/vendor-utils.js";
5
+ import { cn as r } from "./lib/utils.js";
6
+ import * as i from "react";
7
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
+ import { motion as s } from "framer-motion";
9
9
  //#region src/ui/progress.tsx
10
- var l = r("relative w-full overflow-hidden rounded-pill bg-surface-raised", {
10
+ var c = n("relative w-full overflow-hidden rounded-pill bg-surface-raised", {
11
11
  variants: { size: {
12
12
  sm: "h-1",
13
13
  md: "h-2",
14
14
  lg: "h-3"
15
15
  } },
16
16
  defaultVariants: { size: "md" }
17
- }), u = r("h-full w-full flex-1 transition-[width] duration-moderate-02 ease-expressive-standard", {
18
- variants: { color: {
19
- default: "bg-accent-9",
20
- success: "bg-success-9",
21
- warning: "bg-warning-9",
22
- error: "bg-error-9"
23
- } },
24
- defaultVariants: { color: "default" }
25
- }), d = a.forwardRef(({ className: r, value: a, size: d, color: f, indicatorClassName: p, showLabel: m, autoColor: h, ...g }, _) => {
26
- let v = a == null, y = h && a != null ? a > 100 ? "error" : a >= 85 ? "success" : a >= 60 ? "warning" : "default" : f;
27
- return /* @__PURE__ */ s("div", {
28
- className: i("flex items-center gap-ds-03", m && "w-full"),
29
- children: [/* @__PURE__ */ o(e, {
30
- ref: _,
31
- value: v ? null : a,
32
- className: i(l({ size: d }), r),
33
- ...g,
34
- children: v ? /* @__PURE__ */ o(t, { className: i(u({ color: y }), "w-2/5 animate-progress-indeterminate motion-reduce:animate-none", p) }) : /* @__PURE__ */ o(t, {
35
- className: i("h-full", p),
36
- asChild: !0,
37
- children: /* @__PURE__ */ o(c.div, {
38
- className: i(u({ color: y }), "transition-colors duration-moderate-01 ease-productive-standard"),
39
- initial: !1,
40
- animate: { width: `${a || 0}%` },
41
- transition: n.smooth
17
+ }), l = {
18
+ accent: "bg-accent-9",
19
+ success: "bg-success-9",
20
+ warning: "bg-warning-9",
21
+ error: "bg-error-9"
22
+ }, u = n("h-full transition-[width] duration-moderate-02 ease-expressive-standard", {
23
+ variants: { color: l },
24
+ defaultVariants: { color: "accent" }
25
+ });
26
+ function d(e) {
27
+ return e == null ? "accent" : e > 100 ? "error" : e >= 85 ? "success" : e >= 60 ? "warning" : "accent";
28
+ }
29
+ var f = (e, t) => Math.max(0, Math.min(100, e / t * 100)), p = i.createContext(null);
30
+ function m(e) {
31
+ let t = i.useContext(p);
32
+ if (!t) throw Error(`<Progress.${e}> must be rendered inside <Progress.Root>.`);
33
+ return t;
34
+ }
35
+ var h = i.forwardRef(({ value: e = null, max: t = 100, size: n = "md", className: o, children: s, ...c }, l) => {
36
+ let u = i.useMemo(() => ({
37
+ value: e,
38
+ max: t,
39
+ size: n,
40
+ indeterminate: e == null
41
+ }), [
42
+ e,
43
+ t,
44
+ n
45
+ ]);
46
+ return /* @__PURE__ */ a(p.Provider, {
47
+ value: u,
48
+ children: /* @__PURE__ */ a("div", {
49
+ ref: l,
50
+ className: r("flex w-full items-center gap-ds-03", o),
51
+ ...c,
52
+ children: s
53
+ })
54
+ });
55
+ });
56
+ h.displayName = "Progress.Root";
57
+ var g = i.forwardRef(({ className: t, children: n, ...i }, o) => {
58
+ let { value: s, max: l, size: u, indeterminate: d } = m("Track");
59
+ return /* @__PURE__ */ a(e, {
60
+ ref: o,
61
+ value: d ? null : s,
62
+ max: l,
63
+ className: r(c({ size: u }), "flex-1", t),
64
+ ...i,
65
+ children: n
66
+ });
67
+ });
68
+ g.displayName = "Progress.Track";
69
+ var _ = i.forwardRef(({ color: e, autoColor: n, className: i, ...o }, c) => {
70
+ let { value: l, max: p, indeterminate: h } = m("Indicator"), g = e ?? (n === !1 ? "accent" : d(l));
71
+ return h ? /* @__PURE__ */ a("div", {
72
+ ref: c,
73
+ className: r(u({ color: g }), "w-2/5 animate-progress-indeterminate motion-reduce:animate-none", i),
74
+ ...o
75
+ }) : /* @__PURE__ */ a(s.div, {
76
+ ref: c,
77
+ className: r(u({ color: g }), "transition-colors", i),
78
+ initial: !1,
79
+ animate: { width: `${f(l ?? 0, p)}%` },
80
+ transition: t.smooth,
81
+ ...o
82
+ });
83
+ });
84
+ _.displayName = "Progress.Indicator";
85
+ var v = i.forwardRef(({ value: e, color: t = "accent", className: n, style: i, ...o }, s) => {
86
+ let { max: c } = m("Segment");
87
+ return /* @__PURE__ */ a("div", {
88
+ ref: s,
89
+ "aria-hidden": "true",
90
+ className: r("h-full first:rounded-l-pill last:rounded-r-pill", l[t], n),
91
+ style: {
92
+ width: `${f(e, c)}%`,
93
+ ...i
94
+ },
95
+ ...o
96
+ });
97
+ });
98
+ v.displayName = "Progress.Segment";
99
+ var y = i.forwardRef(({ className: e, ...t }, n) => (m("Label"), /* @__PURE__ */ a("span", {
100
+ ref: n,
101
+ className: r("shrink-0 text-ds-sm font-medium text-surface-fg", e),
102
+ ...t
103
+ })));
104
+ y.displayName = "Progress.Label";
105
+ var b = i.forwardRef(({ className: e, format: t, children: n, ...i }, o) => {
106
+ let { value: s, max: c, indeterminate: l } = m("Value"), u = l ? 0 : f(s ?? 0, c);
107
+ return /* @__PURE__ */ a("span", {
108
+ ref: o,
109
+ className: r("shrink-0 text-ds-xs text-surface-fg-muted tabular-nums", e),
110
+ ...i,
111
+ children: n ?? (l ? "" : t ? t(u, s, c) : `${Math.round(u)}%`)
112
+ });
113
+ });
114
+ b.displayName = "Progress.Value";
115
+ var x = i.forwardRef(({ value: e = null, max: t = 100, size: n, color: s, autoColor: c, label: l, showValue: u, segments: d, trackClassName: f, indicatorClassName: p, className: m, "aria-label": x, "aria-labelledby": S, ...C }, w) => {
116
+ let T = i.useId(), E = l != null;
117
+ return /* @__PURE__ */ o(h, {
118
+ ref: w,
119
+ value: e,
120
+ max: t,
121
+ size: n ?? "md",
122
+ className: m,
123
+ ...C,
124
+ children: [
125
+ E && /* @__PURE__ */ a(y, {
126
+ id: T,
127
+ children: l
128
+ }),
129
+ /* @__PURE__ */ a(g, {
130
+ "aria-label": x,
131
+ "aria-labelledby": S ?? (E ? T : void 0),
132
+ className: r(d && "flex", f),
133
+ children: d ? d.map((e, t) => /* @__PURE__ */ a(v, {
134
+ value: e.value,
135
+ color: e.color
136
+ }, t)) : /* @__PURE__ */ a(_, {
137
+ color: s,
138
+ autoColor: c,
139
+ className: p
42
140
  })
43
- })
44
- }), m && !v && /* @__PURE__ */ s("span", {
45
- className: "shrink-0 text-ds-xs text-surface-fg-muted tabular-nums",
46
- children: [a, "%"]
47
- })]
141
+ }),
142
+ u && e != null && /* @__PURE__ */ a(b, {})
143
+ ]
48
144
  });
49
145
  });
50
- d.displayName = e.displayName;
146
+ x.displayName = "Progress";
147
+ var S = Object.assign(x, {
148
+ Root: h,
149
+ Track: g,
150
+ Indicator: _,
151
+ Segment: v,
152
+ Label: y,
153
+ Value: b
154
+ });
51
155
  //#endregion
52
- export { d as Progress, u as progressIndicatorVariants, l as progressTrackVariants };
156
+ export { S as Progress, _ as ProgressIndicator, y as ProgressLabel, h as ProgressRoot, v as ProgressSegment, g as ProgressTrack, b as ProgressValue, u as progressIndicatorVariants, c as progressTrackVariants };
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","names":[],"sources":["../../src/ui/progress.tsx"],"sourcesContent":["'use client'\n\nimport * as ProgressPrimitive from '@primitives/react-progress'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { springs } from './lib/motion'\nimport { cn } from './lib/utils'\n\n/* ---------------------------------------------------------------------------\n * CVA Variants\n * ------------------------------------------------------------------------ */\n\nconst progressTrackVariants = cva(\n 'relative w-full overflow-hidden rounded-pill bg-surface-raised',\n {\n variants: {\n size: {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n },\n },\n defaultVariants: { size: 'md' },\n },\n)\n\nconst progressIndicatorVariants = cva(\n 'h-full w-full flex-1 transition-[width] duration-moderate-02 ease-expressive-standard',\n {\n variants: {\n color: {\n default: 'bg-accent-9',\n success: 'bg-success-9',\n warning: 'bg-warning-9',\n error: 'bg-error-9',\n },\n },\n defaultVariants: { color: 'default' },\n },\n)\n\n/* ---------------------------------------------------------------------------\n * Types\n * ------------------------------------------------------------------------ */\n\n/**\n * Props for Progress — a horizontal progress bar with size and color variants, an optional\n * percentage label, and an indeterminate animation when `value` is undefined/null.\n *\n * **Track size:** `sm` (4px) | `md` (8px, default) | `lg` (12px)\n *\n * **Indicator color:** `default` (brand interactive) | `success` | `warning` | `error`\n *\n * **Indeterminate:** Omit `value` (or pass `undefined`) to show an animated indeterminate bar.\n * When `value` is provided, it should be a number between 0–100.\n *\n * **`showLabel`:** Renders the percentage value next to the bar (only when `value` is set).\n *\n * @example\n * // Determinate upload progress:\n * <Progress value={uploadPercent} color=\"default\" showLabel />\n *\n * @example\n * // Indeterminate loading bar (while waiting for an async operation):\n * <Progress size=\"sm\" />\n *\n * @example\n * // Success-colored completion bar (e.g. after all tasks done):\n * <Progress value={100} color=\"success\" size=\"md\" />\n *\n * @example\n * // Warning threshold indicator (disk usage at 80%):\n * <Progress value={80} color=\"warning\" showLabel size=\"lg\" />\n * // These are just a few ways — feel free to combine props creatively!\n */\ninterface ProgressProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>,\n 'color'\n >,\n VariantProps<typeof progressTrackVariants>,\n VariantProps<typeof progressIndicatorVariants> {\n /** Additional class names for the indicator element */\n indicatorClassName?: string\n /** Display the percentage label next to the progress bar */\n showLabel?: boolean\n /** When true, color auto-shifts by value: 0-59 = default (accent), 60-84 = warning, 85-100 = success, >100 = error. @default false */\n autoColor?: boolean\n}\n\n/* ---------------------------------------------------------------------------\n * Component\n * ------------------------------------------------------------------------ */\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n ProgressProps\n>(\n (\n {\n className,\n value,\n size,\n color,\n indicatorClassName,\n showLabel,\n autoColor,\n ...props\n },\n ref,\n ) => {\n const isIndeterminate = value === undefined || value === null\n\n const effectiveColor =\n autoColor && value != null\n ? value > 100\n ? 'error'\n : value >= 85\n ? 'success'\n : value >= 60\n ? 'warning'\n : 'default'\n : color\n\n return (\n <div className={cn('flex items-center gap-ds-03', showLabel && 'w-full')}>\n <ProgressPrimitive.Root\n ref={ref}\n value={isIndeterminate ? null : value}\n className={cn(progressTrackVariants({ size }), className)}\n {...props}\n >\n {isIndeterminate ? (\n <ProgressPrimitive.Indicator\n className={cn(\n progressIndicatorVariants({ color: effectiveColor }),\n 'w-2/5 animate-progress-indeterminate motion-reduce:animate-none',\n indicatorClassName,\n )}\n />\n ) : (\n <ProgressPrimitive.Indicator\n className={cn('h-full', indicatorClassName)}\n asChild\n >\n <motion.div\n className={cn(\n progressIndicatorVariants({ color: effectiveColor }),\n 'transition-colors duration-moderate-01 ease-productive-standard',\n )}\n initial={false}\n animate={{ width: `${value || 0}%` }}\n transition={springs.smooth}\n />\n </ProgressPrimitive.Indicator>\n )}\n </ProgressPrimitive.Root>\n\n {showLabel && !isIndeterminate && (\n <span className=\"shrink-0 text-ds-xs text-surface-fg-muted tabular-nums\">\n {value}%\n </span>\n )}\n </div>\n )\n },\n)\nProgress.displayName = ProgressPrimitive.Root.displayName\n\nexport { Progress, progressIndicatorVariants,progressTrackVariants }\nexport type { ProgressProps }\n"],"mappings":";;;;;;;;;AAcA,IAAM,IAAwB,EAC5B,kEACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACL,EACF;CACD,iBAAiB,EAAE,MAAM,MAAM;CAChC,CACF,EAEK,IAA4B,EAChC,yFACA;CACE,UAAU,EACR,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,OAAO;EACR,EACF;CACD,iBAAiB,EAAE,OAAO,WAAW;CACtC,CACF,EAuDK,IAAW,EAAM,YAKnB,EACE,cACA,UACA,SACA,UACA,uBACA,cACA,cACA,GAAG,KAEL,MACG;CACH,IAAM,IAAkB,KAAiC,MAEnD,IACJ,KAAa,KAAS,OAClB,IAAQ,MACN,UACA,KAAS,KACP,YACA,KAAS,KACP,YACA,YACN;AAEN,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,+BAA+B,KAAa,SAAS;YAAxE,CACE,kBAAC,GAAD;GACO;GACL,OAAO,IAAkB,OAAO;GAChC,WAAW,EAAG,EAAsB,EAAE,SAAM,CAAC,EAAE,EAAU;GACzD,GAAI;aAEH,IACC,kBAAC,GAAD,EACE,WAAW,EACT,EAA0B,EAAE,OAAO,GAAgB,CAAC,EACpD,mEACA,EACD,EACD,CAAA,GAEF,kBAAC,GAAD;IACE,WAAW,EAAG,UAAU,EAAmB;IAC3C,SAAA;cAEA,kBAAC,EAAO,KAAR;KACE,WAAW,EACT,EAA0B,EAAE,OAAO,GAAgB,CAAC,EACpD,kEACD;KACD,SAAS;KACT,SAAS,EAAE,OAAO,GAAG,KAAS,EAAE,IAAI;KACpC,YAAY,EAAQ;KACpB,CAAA;IAC0B,CAAA;GAET,CAAA,EAExB,KAAa,CAAC,KACb,kBAAC,QAAD;GAAM,WAAU;aAAhB,CACG,GAAM,IACF;KAEL;;EAGX;AACD,EAAS,cAAA,EAAqC"}
1
+ {"version":3,"file":"progress.js","names":[],"sources":["../../src/ui/progress.tsx"],"sourcesContent":["'use client'\n\nimport * as ProgressPrimitive from '@primitives/react-progress'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { springs } from './lib/motion'\nimport { cn } from './lib/utils'\n\n/* ---------------------------------------------------------------------------\n * Progress — a linear progress bar.\n *\n * Two ways to use it:\n * 1. Smart all-in-one `<Progress value={70} />` — covers the common cases\n * (value, size, color, label, %-value, auto-color, indeterminate, segments).\n * 2. Compound parts `<Progress.Root>/<Progress.Track>/<Progress.Indicator>` etc.\n * — full layout control, borrowed from Ark UI / Chakra's structure, with\n * Mantine-style `<Progress.Segment>` for multi-colour bars.\n *\n * The compound parts share a context so `value`/`max`/`size` are set once on\n * `Root` and read by Track/Indicator/Segment/Value.\n * ------------------------------------------------------------------------ */\n\nexport type ProgressSize = 'sm' | 'md' | 'lg'\nexport type ProgressColor = 'accent' | 'success' | 'warning' | 'error'\n\nexport const progressTrackVariants = cva(\n 'relative w-full overflow-hidden rounded-pill bg-surface-raised',\n {\n variants: { size: { sm: 'h-1', md: 'h-2', lg: 'h-3' } },\n defaultVariants: { size: 'md' },\n },\n)\n\nconst COLOR_FILL: Record<ProgressColor, string> = {\n accent: 'bg-accent-9',\n success: 'bg-success-9',\n warning: 'bg-warning-9',\n error: 'bg-error-9',\n}\n\nexport const progressIndicatorVariants = cva(\n 'h-full transition-[width] duration-moderate-02 ease-expressive-standard',\n {\n variants: { color: COLOR_FILL },\n defaultVariants: { color: 'accent' },\n },\n)\n\n/** Auto-color by value: 0–59 accent, 60–84 warning, 85–100 success, >100 error. */\nfunction autoColorFor(value: number | null | undefined): ProgressColor {\n if (value == null) return 'accent'\n if (value > 100) return 'error'\n if (value >= 85) return 'success'\n if (value >= 60) return 'warning'\n return 'accent'\n}\n\nconst clampPct = (value: number, max: number) =>\n Math.max(0, Math.min(100, (value / max) * 100))\n\n/* ---------------------------------------------------------------------------\n * Context — set once on Root, read by Track / Indicator / Segment / Value.\n * ------------------------------------------------------------------------ */\n\ninterface ProgressContextValue {\n value: number | null\n max: number\n size: ProgressSize\n indeterminate: boolean\n}\n\nconst ProgressContext = React.createContext<ProgressContextValue | null>(null)\n\nfunction useProgressContext(part: string): ProgressContextValue {\n const ctx = React.useContext(ProgressContext)\n if (!ctx) {\n throw new Error(`<Progress.${part}> must be rendered inside <Progress.Root>.`)\n }\n return ctx\n}\n\n/* ---------------------------------------------------------------------------\n * Progress.Root — layout container + context. NOT the progressbar itself\n * (that's Track) so labels/value can sit outside the bar (Ark UI model).\n * ------------------------------------------------------------------------ */\n\nexport interface ProgressRootProps extends React.HTMLAttributes<HTMLDivElement> {\n /** 0–max. Omit (or null) for an indeterminate bar. */\n value?: number | null\n /** Scale maximum. @default 100 */\n max?: number\n /** Track thickness. @default 'md' */\n size?: ProgressSize\n}\n\nconst ProgressRoot = React.forwardRef<HTMLDivElement, ProgressRootProps>(\n ({ value = null, max = 100, size = 'md', className, children, ...props }, ref) => {\n const ctx = React.useMemo<ProgressContextValue>(\n () => ({ value, max, size, indeterminate: value == null }),\n [value, max, size],\n )\n return (\n <ProgressContext.Provider value={ctx}>\n <div ref={ref} className={cn('flex w-full items-center gap-ds-03', className)} {...props}>\n {children}\n </div>\n </ProgressContext.Provider>\n )\n },\n)\nProgressRoot.displayName = 'Progress.Root'\n\n/* ---------------------------------------------------------------------------\n * Progress.Track — the aria progressbar + track visual. Holds Indicator/Segment.\n * ------------------------------------------------------------------------ */\n\nexport type ProgressTrackProps = React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>\n\nconst ProgressTrack = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n ProgressTrackProps\n>(({ className, children, ...props }, ref) => {\n const { value, max, size, indeterminate } = useProgressContext('Track')\n // Accessible name comes from the consumer's aria-label / aria-labelledby (spread\n // via ...props) — no auto-wiring, so a Track never carries a dangling reference.\n return (\n <ProgressPrimitive.Root\n ref={ref}\n value={indeterminate ? null : value}\n max={max}\n className={cn(progressTrackVariants({ size }), 'flex-1', className)}\n {...props}\n >\n {children}\n </ProgressPrimitive.Root>\n )\n})\nProgressTrack.displayName = 'Progress.Track'\n\n/* ---------------------------------------------------------------------------\n * Progress.Indicator — single fill. Determinate width from context, or the\n * indeterminate sweep animation when Root has no value.\n * ------------------------------------------------------------------------ */\n\nexport interface ProgressIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Fill colour. Omit to auto-colour by value. */\n color?: ProgressColor\n /** Force auto-colour even when `color` is unset. @default true when color unset */\n autoColor?: boolean\n}\n\nconst ProgressIndicator = React.forwardRef<HTMLDivElement, ProgressIndicatorProps>(\n ({ color, autoColor, className, ...props }, ref) => {\n const { value, max, indeterminate } = useProgressContext('Indicator')\n const resolved = color ?? (autoColor !== false ? autoColorFor(value) : 'accent')\n\n if (indeterminate) {\n return (\n <div\n ref={ref}\n className={cn(\n progressIndicatorVariants({ color: resolved }),\n 'w-2/5 animate-progress-indeterminate motion-reduce:animate-none',\n className,\n )}\n {...props}\n />\n )\n }\n return (\n <motion.div\n ref={ref}\n className={cn(progressIndicatorVariants({ color: resolved }), 'transition-colors', className)}\n initial={false}\n animate={{ width: `${clampPct(value ?? 0, max)}%` }}\n transition={springs.smooth}\n {...(props as React.ComponentProps<typeof motion.div>)}\n />\n )\n },\n)\nProgressIndicator.displayName = 'Progress.Indicator'\n\n/* ---------------------------------------------------------------------------\n * Progress.Segment — one slice of a multi-segment bar (Mantine-style). Place\n * several inside a Track. Widths are each segment's value as a % of max.\n * ------------------------------------------------------------------------ */\n\nexport interface ProgressSegmentProps extends React.HTMLAttributes<HTMLDivElement> {\n /** This segment's portion of `max`. */\n value: number\n color?: ProgressColor\n}\n\nconst ProgressSegment = React.forwardRef<HTMLDivElement, ProgressSegmentProps>(\n ({ value, color = 'accent', className, style, ...props }, ref) => {\n const { max } = useProgressContext('Segment')\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={cn('h-full first:rounded-l-pill last:rounded-r-pill', COLOR_FILL[color], className)}\n style={{ width: `${clampPct(value, max)}%`, ...style }}\n {...props}\n />\n )\n },\n)\nProgressSegment.displayName = 'Progress.Segment'\n\n/* ---------------------------------------------------------------------------\n * Progress.Label — descriptive text, associated with the bar via aria.\n * ------------------------------------------------------------------------ */\n\nexport type ProgressLabelProps = React.HTMLAttributes<HTMLSpanElement>\n\nconst ProgressLabel = React.forwardRef<HTMLSpanElement, ProgressLabelProps>(\n ({ className, ...props }, ref) => {\n useProgressContext('Label')\n return (\n <span\n ref={ref}\n className={cn('shrink-0 text-ds-sm font-medium text-surface-fg', className)}\n {...props}\n />\n )\n },\n)\nProgressLabel.displayName = 'Progress.Label'\n\n/* ---------------------------------------------------------------------------\n * Progress.Value — the \"{n}%\" readout. Custom content via children or `format`.\n * ------------------------------------------------------------------------ */\n\nexport interface ProgressValueProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {\n /** Format the percentage. Default: `${round(pct)}%`. */\n format?: (pct: number, value: number | null, max: number) => React.ReactNode\n children?: React.ReactNode\n}\n\nconst ProgressValue = React.forwardRef<HTMLSpanElement, ProgressValueProps>(\n ({ className, format, children, ...props }, ref) => {\n const { value, max, indeterminate } = useProgressContext('Value')\n const pct = indeterminate ? 0 : clampPct(value ?? 0, max)\n return (\n <span\n ref={ref}\n className={cn('shrink-0 text-ds-xs text-surface-fg-muted tabular-nums', className)}\n {...props}\n >\n {children ?? (indeterminate ? '' : format ? format(pct, value, max) : `${Math.round(pct)}%`)}\n </span>\n )\n },\n)\nProgressValue.displayName = 'Progress.Value'\n\n/* ---------------------------------------------------------------------------\n * Progress — smart all-in-one. Composes the parts for the common cases.\n * ------------------------------------------------------------------------ */\n\nexport interface ProgressProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n VariantProps<typeof progressTrackVariants> {\n /** 0–max. Omit (or null) for an indeterminate bar. */\n value?: number | null\n max?: number\n /** Fill colour. Omit + set `autoColor` to colour by value. */\n color?: ProgressColor\n /** Auto-colour the fill by value (0–59 accent · 60–84 warning · 85–100 success · >100 error). @default false */\n autoColor?: boolean\n /** Descriptive label rendered before the bar. */\n label?: React.ReactNode\n /** Show the `{n}%` readout after the bar. */\n showValue?: boolean\n /** Multi-segment bar: each slice is `value` (portion of max) + `color`. Overrides the single indicator. */\n segments?: Array<{ value: number; color?: ProgressColor }>\n /** Class for the Track element. */\n trackClassName?: string\n /** Class for the single Indicator (ignored when `segments` is set). */\n indicatorClassName?: string\n}\n\nconst ProgressBase = React.forwardRef<HTMLDivElement, ProgressProps>(\n (\n {\n value = null, max = 100, size, color, autoColor, label, showValue, segments,\n trackClassName, indicatorClassName, className,\n 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...props\n },\n ref,\n ) => {\n const labelId = React.useId()\n const hasLabel = label != null\n return (\n <ProgressRoot ref={ref} value={value} max={max} size={size ?? 'md'} className={className} {...props}>\n {hasLabel && <ProgressLabel id={labelId}>{label}</ProgressLabel>}\n <ProgressTrack\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby ?? (hasLabel ? labelId : undefined)}\n className={cn(segments && 'flex', trackClassName)}\n >\n {segments\n ? segments.map((s, i) => <ProgressSegment key={i} value={s.value} color={s.color} />)\n : <ProgressIndicator color={color} autoColor={autoColor} className={indicatorClassName} />}\n </ProgressTrack>\n {showValue && value != null && <ProgressValue />}\n </ProgressRoot>\n )\n },\n)\nProgressBase.displayName = 'Progress'\n\nconst Progress = Object.assign(ProgressBase, {\n Root: ProgressRoot,\n Track: ProgressTrack,\n Indicator: ProgressIndicator,\n Segment: ProgressSegment,\n Label: ProgressLabel,\n Value: ProgressValue,\n})\n\nexport {\n Progress,\n ProgressIndicator,\n ProgressLabel,\n ProgressRoot,\n ProgressSegment,\n ProgressTrack,\n ProgressValue,\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAa,IAAwB,EACnC,kEACA;CACE,UAAU,EAAE,MAAM;EAAE,IAAI;EAAO,IAAI;EAAO,IAAI;EAAO,EAAE;CACvD,iBAAiB,EAAE,MAAM,MAAM;CAChC,CACF,EAEK,IAA4C;CAChD,QAAQ;CACR,SAAS;CACT,SAAS;CACT,OAAO;CACR,EAEY,IAA4B,EACvC,2EACA;CACE,UAAU,EAAE,OAAO,GAAY;CAC/B,iBAAiB,EAAE,OAAO,UAAU;CACrC,CACF;AAGD,SAAS,EAAa,GAAiD;AAKrE,QAJI,KAAS,OAAa,WACtB,IAAQ,MAAY,UACpB,KAAS,KAAW,YACpB,KAAS,KAAW,YACjB;;AAGT,IAAM,KAAY,GAAe,MAC/B,KAAK,IAAI,GAAG,KAAK,IAAI,KAAM,IAAQ,IAAO,IAAI,CAAC,EAa3C,IAAkB,EAAM,cAA2C,KAAK;AAE9E,SAAS,EAAmB,GAAoC;CAC9D,IAAM,IAAM,EAAM,WAAW,EAAgB;AAC7C,KAAI,CAAC,EACH,OAAU,MAAM,aAAa,EAAK,4CAA4C;AAEhF,QAAO;;AAiBT,IAAM,IAAe,EAAM,YACxB,EAAE,WAAQ,MAAM,SAAM,KAAK,UAAO,MAAM,cAAW,aAAU,GAAG,KAAS,MAAQ;CAChF,IAAM,IAAM,EAAM,eACT;EAAE;EAAO;EAAK;EAAM,eAAe,KAAS;EAAM,GACzD;EAAC;EAAO;EAAK;EAAK,CACnB;AACD,QACE,kBAAC,EAAgB,UAAjB;EAA0B,OAAO;YAC/B,kBAAC,OAAD;GAAU;GAAK,WAAW,EAAG,sCAAsC,EAAU;GAAE,GAAI;GAChF;GACG,CAAA;EACmB,CAAA;EAGhC;AACD,EAAa,cAAc;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EAGpB;AACD,EAAa,cAAc;AAE3B,IAAM,IAAW,OAAO,OAAO,GAAc;CAC3C,MAAM;CACN,OAAO;CACP,WAAW;CACX,SAAS;CACT,OAAO;CACP,OAAO;CACR,CAAC"}
@@ -1,12 +1,16 @@
1
1
  "use client";
2
+ import { FieldState } from './lib/field-state';
2
3
  import * as RadioGroupPrimitive from '../primitives/react-radio-group';
3
4
  import * as React from 'react';
4
- declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ export interface RadioGroupProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {
6
+ /** Validation/feedback state for the whole group. `'error'` also sets `aria-invalid`. Inherited from `FormField` when omitted. */
7
+ state?: FieldState;
8
+ }
9
+ declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
5
10
  export interface RadioGroupItemProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {
6
11
  /** Control size — `sm` (20px), `md` (24px, default, WCAG compliant), `lg` (28px). */
7
12
  size?: 'sm' | 'md' | 'lg';
8
13
  }
9
14
  declare const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
10
- export type RadioGroupProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>;
11
15
  export { RadioGroup, RadioGroupItem };
12
16
  //# sourceMappingURL=radio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/ui/radio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,mBAAmB,MAAM,+BAA+B,CAAA;AAGpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,QAAA,MAAM,UAAU,+JAmBd,CAAA;AAGF,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC;IAC1G,qFAAqF;IACrF,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B;AAcD,QAAA,MAAM,cAAc,+FAgClB,CAAA;AAGF,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAA;AAE7F,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/ui/radio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,mBAAmB,MAAM,+BAA+B,CAAA;AAGpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AActE,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACtG,kIAAkI;IAClI,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB;AAED,QAAA,MAAM,UAAU,wFAqBd,CAAA;AAGF,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC;IAC1G,qFAAqF;IACrF,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B;AAcD,QAAA,MAAM,cAAc,+FAkClB,CAAA;AAGF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAA"}
package/dist/ui/radio.js CHANGED
@@ -1,49 +1,60 @@
1
1
  "use client";
2
- import { ct as e, ot as t, st as n } from "../_chunks/primitives.js";
2
+ import { Indicator$1 as e, Item2$1 as t, Root2$4 as n } from "../_chunks/primitives.js";
3
3
  import { springs as r } from "./lib/motion.js";
4
4
  import { cn as i } from "./lib/utils.js";
5
5
  import { useFormField as a } from "./form.js";
6
- import * as o from "react";
7
- import { jsx as s } from "react/jsx-runtime";
8
- import { IconCircle as c } from "@tabler/icons-react";
9
- import { motion as l } from "framer-motion";
6
+ import { resolveFieldState as o } from "../_chunks/field-state.js";
7
+ import * as s from "react";
8
+ import { jsx as c } from "react/jsx-runtime";
9
+ import { IconCircle as l } from "@tabler/icons-react";
10
+ import { motion as u } from "framer-motion";
10
11
  //#region src/ui/radio.tsx
11
- var u = o.forwardRef(({ className: t, ...n }, r) => {
12
- let o = a(), c = o.state === "error", l = n["aria-describedby"] ?? o.helperTextId, u = n["aria-required"] ?? o.required;
13
- return /* @__PURE__ */ s(e, {
14
- className: i("grid gap-ds-03", t),
15
- "aria-invalid": c || void 0,
16
- "aria-describedby": l,
17
- "aria-required": u || void 0,
18
- ...n,
19
- ref: r
12
+ var d = s.createContext(void 0), f = {
13
+ error: "border-error-7",
14
+ warning: "border-warning-7",
15
+ success: "border-success-7"
16
+ }, p = s.forwardRef(({ className: e, state: t, ...r }, s) => {
17
+ let l = a(), u = o(t, l.state), f = r["aria-describedby"] ?? l.helperTextId, p = r["aria-required"] ?? l.required;
18
+ return /* @__PURE__ */ c(d.Provider, {
19
+ value: u,
20
+ children: /* @__PURE__ */ c(n, {
21
+ className: i("grid gap-ds-03", e),
22
+ "aria-invalid": u === "error" || void 0,
23
+ "aria-describedby": f,
24
+ "aria-required": p || void 0,
25
+ ...r,
26
+ ref: s
27
+ })
20
28
  });
21
29
  });
22
- u.displayName = e.displayName;
23
- var d = {
30
+ p.displayName = n.displayName;
31
+ var m = {
24
32
  sm: "h-5 w-5",
25
33
  md: "h-6 w-6",
26
34
  lg: "h-7 w-7"
27
- }, f = {
35
+ }, h = {
28
36
  sm: "h-1.5 w-1.5",
29
37
  md: "h-ds-03 w-ds-03",
30
38
  lg: "h-2.5 w-2.5"
31
- }, p = o.forwardRef(({ className: e, size: a = "md", ...o }, u) => /* @__PURE__ */ s(n, {
32
- ref: u,
33
- className: i("touch-target aspect-square rounded-pill", d[a], "border border-surface-border-strong bg-surface-raised-hover", "transition-colors duration-fast-01", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:opacity-action-disabled", "hover:border-accent-7 hover:bg-surface-raised-active", "data-[state=checked]:border-accent-7", e),
34
- ...o,
35
- children: /* @__PURE__ */ s(t, {
36
- asChild: !0,
37
- className: "flex items-center justify-center",
38
- children: /* @__PURE__ */ s(l.span, {
39
+ }, g = s.forwardRef(({ className: n, size: a = "md", ...o }, p) => {
40
+ let g = s.useContext(d);
41
+ return /* @__PURE__ */ c(t, {
42
+ ref: p,
43
+ className: i("touch-target aspect-square rounded-pill", m[a], "border border-surface-border-strong bg-surface-raised-hover", "transition-colors duration-fast-01", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:opacity-action-disabled", "hover:border-accent-7 hover:bg-surface-raised-active", "data-[state=checked]:border-accent-7", g && f[g], n),
44
+ ...o,
45
+ children: /* @__PURE__ */ c(e, {
46
+ asChild: !0,
39
47
  className: "flex items-center justify-center",
40
- initial: { scale: 0 },
41
- animate: { scale: 1 },
42
- transition: r.snappy,
43
- children: /* @__PURE__ */ s(c, { className: i(f[a], "fill-accent-9 text-accent-11") })
48
+ children: /* @__PURE__ */ c(u.span, {
49
+ className: "flex items-center justify-center",
50
+ initial: { scale: 0 },
51
+ animate: { scale: 1 },
52
+ transition: r.snappy,
53
+ children: /* @__PURE__ */ c(l, { className: i(h[a], "fill-accent-9 text-accent-11") })
54
+ })
44
55
  })
45
- })
46
- }));
47
- p.displayName = n.displayName;
56
+ });
57
+ });
58
+ g.displayName = t.displayName;
48
59
  //#endregion
49
- export { u as RadioGroup, p as RadioGroupItem };
60
+ export { p as RadioGroup, g as RadioGroupItem };
@@ -1 +1 @@
1
- {"version":3,"file":"radio.js","names":[],"sources":["../../src/ui/radio.tsx"],"sourcesContent":["'use client'\n\nimport * as RadioGroupPrimitive from '@primitives/react-radio-group'\nimport { IconCircle } from '@tabler/icons-react'\nimport { AnimatePresence, motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { springs } from './lib/motion'\nimport { cn } from './lib/utils'\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const fieldCtx = useFormField()\n const isError = fieldCtx.state === 'error'\n const ariaDescribedBy = props['aria-describedby'] ?? fieldCtx.helperTextId\n const ariaRequired = props['aria-required'] ?? fieldCtx.required\n\n return (\n <RadioGroupPrimitive.Root\n className={cn('grid gap-ds-03', className)}\n aria-invalid={isError || undefined}\n aria-describedby={ariaDescribedBy}\n aria-required={ariaRequired || undefined}\n {...props}\n ref={ref}\n />\n )\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nexport interface RadioGroupItemProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {\n /** Control size — `sm` (20px), `md` (24px, default, WCAG compliant), `lg` (28px). */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst radioSizeClasses = {\n sm: 'h-5 w-5',\n md: 'h-6 w-6',\n lg: 'h-7 w-7',\n} as const\n\nconst radioIndicatorClasses = {\n sm: 'h-1.5 w-1.5',\n md: 'h-ds-03 w-ds-03',\n lg: 'h-2.5 w-2.5',\n} as const\n\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, size = 'md', ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n 'touch-target aspect-square rounded-pill',\n radioSizeClasses[size],\n 'border border-surface-border-strong bg-surface-raised-hover',\n 'transition-colors duration-fast-01',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2',\n 'disabled:cursor-not-allowed disabled:opacity-action-disabled',\n 'hover:border-accent-7 hover:bg-surface-raised-active',\n 'data-[state=checked]:border-accent-7',\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator asChild className=\"flex items-center justify-center\">\n <motion.span\n className=\"flex items-center justify-center\"\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n transition={springs.snappy}\n >\n <IconCircle className={cn(radioIndicatorClasses[size], 'fill-accent-9 text-accent-11')} />\n </motion.span>\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport type RadioGroupProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n\nexport { RadioGroup, RadioGroupItem }\n"],"mappings":";;;;;;;;;;AAWA,IAAM,IAAa,EAAM,YAGtB,EAAE,cAAW,GAAG,KAAS,MAAQ;CAClC,IAAM,IAAW,GAAc,EACzB,IAAU,EAAS,UAAU,SAC7B,IAAkB,EAAM,uBAAuB,EAAS,cACxD,IAAe,EAAM,oBAAoB,EAAS;AAExD,QACE,kBAAC,GAAD;EACE,WAAW,EAAG,kBAAkB,EAAU;EAC1C,gBAAc,KAAW,KAAA;EACzB,oBAAkB;EAClB,iBAAe,KAAgB,KAAA;EAC/B,GAAI;EACC;EACL,CAAA;EAEJ;AACF,EAAW,cAAA,EAAuC;AAOlD,IAAM,IAAmB;CACvB,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAEK,IAAwB;CAC5B,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAEK,IAAiB,EAAM,YAG1B,EAAE,cAAW,UAAO,MAAM,GAAG,KAAS,MAErC,kBAAC,GAAD;CACO;CACL,WAAW,EACT,2CACA,EAAiB,IACjB,+DACA,sCACA,6GACA,gEACA,wDACA,wCACA,EACD;CACD,GAAI;WAEJ,kBAAC,GAAD;EAA+B,SAAA;EAAQ,WAAU;YAC/C,kBAAC,EAAO,MAAR;GACE,WAAU;GACV,SAAS,EAAE,OAAO,GAAG;GACrB,SAAS,EAAE,OAAO,GAAG;GACrB,YAAY,EAAQ;aAEpB,kBAAC,GAAD,EAAY,WAAW,EAAG,EAAsB,IAAO,+BAA+B,EAAI,CAAA;GAC9E,CAAA;EACgB,CAAA;CACP,CAAA,CAE7B;AACF,EAAe,cAAA,EAAuC"}
1
+ {"version":3,"file":"radio.js","names":[],"sources":["../../src/ui/radio.tsx"],"sourcesContent":["'use client'\n\nimport * as RadioGroupPrimitive from '@primitives/react-radio-group'\nimport { IconCircle } from '@tabler/icons-react'\nimport { motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { type FieldState, resolveFieldState } from './lib/field-state'\nimport { springs } from './lib/motion'\nimport { cn } from './lib/utils'\n\n// Thread the group's resolved state to items so they show the matching border tint.\nconst RadioStateContext = React.createContext<Exclude<FieldState, 'default'> | undefined>(undefined)\n\n/** Border tint per validation state, applied to each item. */\nconst stateBorderClasses: Record<Exclude<FieldState, 'default'>, string> = {\n error: 'border-error-7',\n warning: 'border-warning-7',\n success: 'border-success-7',\n}\n\nexport interface RadioGroupProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {\n /** Validation/feedback state for the whole group. `'error'` also sets `aria-invalid`. Inherited from `FormField` when omitted. */\n state?: FieldState\n}\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n RadioGroupProps\n>(({ className, state: stateProp, ...props }, ref) => {\n const fieldCtx = useFormField()\n const state = resolveFieldState(stateProp, fieldCtx.state)\n const ariaDescribedBy = props['aria-describedby'] ?? fieldCtx.helperTextId\n const ariaRequired = props['aria-required'] ?? fieldCtx.required\n\n return (\n <RadioStateContext.Provider value={state}>\n <RadioGroupPrimitive.Root\n className={cn('grid gap-ds-03', className)}\n aria-invalid={state === 'error' || undefined}\n aria-describedby={ariaDescribedBy}\n aria-required={ariaRequired || undefined}\n {...props}\n ref={ref}\n />\n </RadioStateContext.Provider>\n )\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nexport interface RadioGroupItemProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {\n /** Control size — `sm` (20px), `md` (24px, default, WCAG compliant), `lg` (28px). */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst radioSizeClasses = {\n sm: 'h-5 w-5',\n md: 'h-6 w-6',\n lg: 'h-7 w-7',\n} as const\n\nconst radioIndicatorClasses = {\n sm: 'h-1.5 w-1.5',\n md: 'h-ds-03 w-ds-03',\n lg: 'h-2.5 w-2.5',\n} as const\n\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, size = 'md', ...props }, ref) => {\n const state = React.useContext(RadioStateContext)\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n 'touch-target aspect-square rounded-pill',\n radioSizeClasses[size],\n 'border border-surface-border-strong bg-surface-raised-hover',\n 'transition-colors duration-fast-01',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2',\n 'disabled:cursor-not-allowed disabled:opacity-action-disabled',\n 'hover:border-accent-7 hover:bg-surface-raised-active',\n 'data-[state=checked]:border-accent-7',\n state && stateBorderClasses[state],\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator asChild className=\"flex items-center justify-center\">\n <motion.span\n className=\"flex items-center justify-center\"\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n transition={springs.snappy}\n >\n <IconCircle className={cn(radioIndicatorClasses[size], 'fill-accent-9 text-accent-11')} />\n </motion.span>\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport { RadioGroup, RadioGroupItem }\n"],"mappings":";;;;;;;;;;;AAaA,IAAM,IAAoB,EAAM,cAA0D,KAAA,EAAU,EAG9F,IAAqE;CACzE,OAAO;CACP,SAAS;CACT,SAAS;CACV,EAOK,IAAa,EAAM,YAGtB,EAAE,cAAW,OAAO,GAAW,GAAG,KAAS,MAAQ;CACpD,IAAM,IAAW,GAAc,EACzB,IAAQ,EAAkB,GAAW,EAAS,MAAM,EACpD,IAAkB,EAAM,uBAAuB,EAAS,cACxD,IAAe,EAAM,oBAAoB,EAAS;AAExD,QACE,kBAAC,EAAkB,UAAnB;EAA4B,OAAO;YACjC,kBAAC,GAAD;GACE,WAAW,EAAG,kBAAkB,EAAU;GAC1C,gBAAc,MAAU,WAAW,KAAA;GACnC,oBAAkB;GAClB,iBAAe,KAAgB,KAAA;GAC/B,GAAI;GACC;GACL,CAAA;EACyB,CAAA;EAE/B;AACF,EAAW,cAAA,EAAuC;AAOlD,IAAM,IAAmB;CACvB,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAEK,IAAwB;CAC5B,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAEK,IAAiB,EAAM,YAG1B,EAAE,cAAW,UAAO,MAAM,GAAG,KAAS,MAAQ;CAC/C,IAAM,IAAQ,EAAM,WAAW,EAAkB;AACjD,QACE,kBAAC,GAAD;EACO;EACL,WAAW,EACT,2CACA,EAAiB,IACjB,+DACA,sCACA,6GACA,gEACA,wDACA,wCACA,KAAS,EAAmB,IAC5B,EACD;EACD,GAAI;YAEJ,kBAAC,GAAD;GAA+B,SAAA;GAAQ,WAAU;aAC/C,kBAAC,EAAO,MAAR;IACE,WAAU;IACV,SAAS,EAAE,OAAO,GAAG;IACrB,SAAS,EAAE,OAAO,GAAG;IACrB,YAAY,EAAQ;cAEpB,kBAAC,GAAD,EAAY,WAAW,EAAG,EAAsB,IAAO,+BAA+B,EAAI,CAAA;IAC9E,CAAA;GACgB,CAAA;EACP,CAAA;EAE7B;AACF,EAAe,cAAA,EAAuC"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { IconProvider as e } from "./icon-context.js";
3
3
  import { cn as t } from "./lib/utils.js";
4
- import { t as n } from "../_chunks/normalize-icon.js";
4
+ import { normalizeIcon as n } from "../_chunks/normalize-icon.js";
5
5
  import * as r from "react";
6
6
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
7
  import { LayoutGroup as o, motion as s } from "framer-motion";
@@ -28,7 +28,7 @@ declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.Selec
28
28
  declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
29
29
  export declare const selectTriggerVariants: (props?: ({
30
30
  variant?: "outline" | "default" | "ghost" | null | undefined;
31
- color?: "default" | "success" | "error" | "warning" | null | undefined;
31
+ state?: "default" | "success" | "error" | "warning" | null | undefined;
32
32
  size?: "xs" | "sm" | "md" | "lg" | null | undefined;
33
33
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
34
34
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/ui/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,MAAM,uCAAuB,CAAA;AAEnC,QAAA,MAAM,WAAW,yGAAwB,CAAA;AAEzC,QAAA,MAAM,WAAW,0GAAwB,CAAA;AAEzC,eAAO,MAAM,qBAAqB;;;;8EA2BjC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EACnF,YAAY,CAAC,OAAO,qBAAqB,CAAC;CAAG;AAEjD,QAAA,MAAM,aAAa,8FA0BjB,CAAA;AAGF,QAAA,MAAM,oBAAoB,qKAcxB,CAAA;AAGF,QAAA,M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