@codefast/ui 0.3.11 → 0.3.12-canary.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 (249) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +4 -0
  3. package/dist/components/accordion.d.ts +11 -29
  4. package/dist/components/accordion.d.ts.map +1 -0
  5. package/dist/components/accordion.js +11 -38
  6. package/dist/components/alert-dialog.d.ts +25 -60
  7. package/dist/components/alert-dialog.d.ts.map +1 -0
  8. package/dist/components/alert-dialog.js +17 -70
  9. package/dist/components/alert.d.ts +16 -27
  10. package/dist/components/alert.d.ts.map +1 -0
  11. package/dist/components/alert.js +33 -31
  12. package/dist/components/aspect-ratio.d.ts +5 -8
  13. package/dist/components/aspect-ratio.d.ts.map +1 -0
  14. package/dist/components/aspect-ratio.js +5 -7
  15. package/dist/components/avatar.d.ts +7 -17
  16. package/dist/components/avatar.d.ts.map +1 -0
  17. package/dist/components/avatar.js +8 -19
  18. package/dist/components/badge.d.ts +15 -21
  19. package/dist/components/badge.d.ts.map +1 -0
  20. package/dist/components/badge.js +53 -21
  21. package/dist/components/breadcrumb.d.ts +13 -35
  22. package/dist/components/breadcrumb.d.ts.map +1 -0
  23. package/dist/components/breadcrumb.js +14 -50
  24. package/dist/components/button-group.d.ts +15 -29
  25. package/dist/components/button-group.d.ts.map +1 -0
  26. package/dist/components/button-group.js +37 -28
  27. package/dist/components/button.d.ts +26 -35
  28. package/dist/components/button.d.ts.map +1 -0
  29. package/dist/components/button.js +87 -52
  30. package/dist/components/calendar.d.ts +10 -24
  31. package/dist/components/calendar.d.ts.map +1 -0
  32. package/dist/components/calendar.js +88 -93
  33. package/dist/components/card.d.ts +11 -34
  34. package/dist/components/card.d.ts.map +1 -0
  35. package/dist/components/card.js +12 -40
  36. package/dist/components/carousel.d.ts +25 -55
  37. package/dist/components/carousel.d.ts.map +1 -0
  38. package/dist/components/carousel.js +83 -115
  39. package/dist/components/chart.d.ts +37 -72
  40. package/dist/components/chart.d.ts.map +1 -0
  41. package/dist/components/chart.js +162 -151
  42. package/dist/components/checkbox-cards.d.ts +9 -15
  43. package/dist/components/checkbox-cards.d.ts.map +1 -0
  44. package/dist/components/checkbox-cards.js +9 -23
  45. package/dist/components/checkbox-group.d.ts +9 -16
  46. package/dist/components/checkbox-group.d.ts.map +1 -0
  47. package/dist/components/checkbox-group.js +8 -20
  48. package/dist/components/checkbox.d.ts +5 -9
  49. package/dist/components/checkbox.d.ts.map +1 -0
  50. package/dist/components/checkbox.js +7 -15
  51. package/dist/components/collapsible.d.ts +7 -14
  52. package/dist/components/collapsible.d.ts.map +1 -0
  53. package/dist/components/collapsible.js +7 -15
  54. package/dist/components/command.d.ts +24 -55
  55. package/dist/components/command.d.ts.map +1 -0
  56. package/dist/components/command.js +19 -70
  57. package/dist/components/context-menu.d.ts +23 -72
  58. package/dist/components/context-menu.d.ts.map +1 -0
  59. package/dist/components/context-menu.js +22 -90
  60. package/dist/components/dialog.d.ts +23 -53
  61. package/dist/components/dialog.d.ts.map +1 -0
  62. package/dist/components/dialog.js +21 -73
  63. package/dist/components/drawer.d.ts +29 -60
  64. package/dist/components/drawer.d.ts.map +1 -0
  65. package/dist/components/drawer.js +17 -59
  66. package/dist/components/dropdown-menu.d.ts +23 -73
  67. package/dist/components/dropdown-menu.d.ts.map +1 -0
  68. package/dist/components/dropdown-menu.js +22 -97
  69. package/dist/components/empty.d.ts +16 -37
  70. package/dist/components/empty.d.ts.map +1 -0
  71. package/dist/components/empty.js +33 -45
  72. package/dist/components/field.d.ts +26 -63
  73. package/dist/components/field.d.ts.map +1 -0
  74. package/dist/components/field.js +61 -90
  75. package/dist/components/form.d.ts +16 -37
  76. package/dist/components/form.d.ts.map +1 -0
  77. package/dist/components/form.js +51 -67
  78. package/dist/components/hover-card.d.ts +8 -21
  79. package/dist/components/hover-card.d.ts.map +1 -0
  80. package/dist/components/hover-card.js +9 -24
  81. package/dist/components/input-group.d.ts +29 -53
  82. package/dist/components/input-group.d.ts.map +1 -0
  83. package/dist/components/input-group.js +110 -67
  84. package/dist/components/input-number.d.ts +8 -28
  85. package/dist/components/input-number.d.ts.map +1 -0
  86. package/dist/components/input-number.js +15 -56
  87. package/dist/components/input-otp.d.ts +11 -24
  88. package/dist/components/input-otp.d.ts.map +1 -0
  89. package/dist/components/input-otp.js +14 -35
  90. package/dist/components/input-password.d.ts +6 -12
  91. package/dist/components/input-password.d.ts.map +1 -0
  92. package/dist/components/input-password.js +11 -31
  93. package/dist/components/input-search.d.ts +9 -18
  94. package/dist/components/input-search.d.ts.map +1 -0
  95. package/dist/components/input-search.js +17 -44
  96. package/dist/components/input.d.ts +5 -10
  97. package/dist/components/input.d.ts.map +1 -0
  98. package/dist/components/input.js +6 -10
  99. package/dist/components/item.d.ts +33 -69
  100. package/dist/components/item.d.ts.map +1 -0
  101. package/dist/components/item.js +69 -91
  102. package/dist/components/kbd.d.ts +6 -13
  103. package/dist/components/kbd.d.ts.map +1 -0
  104. package/dist/components/kbd.js +7 -14
  105. package/dist/components/label.d.ts +5 -9
  106. package/dist/components/label.d.ts.map +1 -0
  107. package/dist/components/label.js +6 -9
  108. package/dist/components/menubar.d.ts +24 -80
  109. package/dist/components/menubar.d.ts.map +1 -0
  110. package/dist/components/menubar.js +24 -100
  111. package/dist/components/native-select.d.ts +7 -16
  112. package/dist/components/native-select.d.ts.map +1 -0
  113. package/dist/components/native-select.js +8 -26
  114. package/dist/components/navigation-menu.d.ts +13 -36
  115. package/dist/components/navigation-menu.d.ts.map +1 -0
  116. package/dist/components/navigation-menu.js +26 -62
  117. package/dist/components/pagination.d.ts +15 -35
  118. package/dist/components/pagination.d.ts.map +1 -0
  119. package/dist/components/pagination.js +14 -56
  120. package/dist/components/popover.d.ts +9 -24
  121. package/dist/components/popover.d.ts.map +1 -0
  122. package/dist/components/popover.js +10 -28
  123. package/dist/components/progress-circle.d.ts +89 -106
  124. package/dist/components/progress-circle.d.ts.map +1 -0
  125. package/dist/components/progress-circle.js +71 -104
  126. package/dist/components/progress.d.ts +5 -10
  127. package/dist/components/progress.d.ts.map +1 -0
  128. package/dist/components/progress.js +8 -14
  129. package/dist/components/radio-cards.d.ts +5 -10
  130. package/dist/components/radio-cards.d.ts.map +1 -0
  131. package/dist/components/radio-cards.js +8 -22
  132. package/dist/components/radio-group.d.ts +6 -13
  133. package/dist/components/radio-group.d.ts.map +1 -0
  134. package/dist/components/radio-group.js +7 -18
  135. package/dist/components/radio.d.ts +6 -12
  136. package/dist/components/radio.d.ts.map +1 -0
  137. package/dist/components/radio.js +6 -11
  138. package/dist/components/resizable.d.ts +8 -18
  139. package/dist/components/resizable.d.ts.map +1 -0
  140. package/dist/components/resizable.js +8 -22
  141. package/dist/components/scroll-area.d.ts +21 -33
  142. package/dist/components/scroll-area.d.ts.map +1 -0
  143. package/dist/components/scroll-area.js +65 -85
  144. package/dist/components/select.d.ts +17 -50
  145. package/dist/components/select.d.ts.map +1 -0
  146. package/dist/components/select.js +27 -79
  147. package/dist/components/separator.d.ts +20 -29
  148. package/dist/components/separator.d.ts.map +1 -0
  149. package/dist/components/separator.js +28 -37
  150. package/dist/components/sheet.d.ts +30 -62
  151. package/dist/components/sheet.d.ts.map +1 -0
  152. package/dist/components/sheet.js +68 -81
  153. package/dist/components/sidebar.d.ts +67 -160
  154. package/dist/components/sidebar.d.ts.map +1 -0
  155. package/dist/components/sidebar.js +184 -302
  156. package/dist/components/skeleton.d.ts +5 -9
  157. package/dist/components/skeleton.d.ts.map +1 -0
  158. package/dist/components/skeleton.js +6 -9
  159. package/dist/components/slider.d.ts +5 -13
  160. package/dist/components/slider.d.ts.map +1 -0
  161. package/dist/components/slider.js +13 -35
  162. package/dist/components/sonner.d.ts +8 -10
  163. package/dist/components/sonner.d.ts.map +1 -0
  164. package/dist/components/sonner.js +14 -16
  165. package/dist/components/spinner.d.ts +6 -12
  166. package/dist/components/spinner.d.ts.map +1 -0
  167. package/dist/components/spinner.js +21 -34
  168. package/dist/components/switch.d.ts +5 -9
  169. package/dist/components/switch.d.ts.map +1 -0
  170. package/dist/components/switch.js +6 -13
  171. package/dist/components/table.d.ts +12 -37
  172. package/dist/components/table.d.ts.map +1 -0
  173. package/dist/components/table.js +13 -48
  174. package/dist/components/tabs.d.ts +8 -21
  175. package/dist/components/tabs.d.ts.map +1 -0
  176. package/dist/components/tabs.js +9 -24
  177. package/dist/components/textarea.d.ts +5 -9
  178. package/dist/components/textarea.d.ts.map +1 -0
  179. package/dist/components/textarea.js +6 -9
  180. package/dist/components/toggle-group.d.ts +10 -24
  181. package/dist/components/toggle-group.d.ts.map +1 -0
  182. package/dist/components/toggle-group.js +21 -39
  183. package/dist/components/toggle.d.ts +18 -25
  184. package/dist/components/toggle.d.ts.map +1 -0
  185. package/dist/components/toggle.js +42 -30
  186. package/dist/components/tooltip.d.ts +9 -24
  187. package/dist/components/tooltip.d.ts.map +1 -0
  188. package/dist/components/tooltip.js +10 -29
  189. package/dist/hooks/use-animated-value.d.ts +2 -4
  190. package/dist/hooks/use-animated-value.d.ts.map +1 -0
  191. package/dist/hooks/use-animated-value.js +67 -58
  192. package/dist/hooks/use-copy-to-clipboard.d.ts +6 -11
  193. package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
  194. package/dist/hooks/use-copy-to-clipboard.js +42 -39
  195. package/dist/hooks/use-is-mobile.d.ts +2 -4
  196. package/dist/hooks/use-is-mobile.d.ts.map +1 -0
  197. package/dist/hooks/use-is-mobile.js +20 -23
  198. package/dist/hooks/use-media-query.d.ts +2 -4
  199. package/dist/hooks/use-media-query.d.ts.map +1 -0
  200. package/dist/hooks/use-media-query.js +49 -46
  201. package/dist/hooks/use-mutation-observer.d.ts +3 -6
  202. package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
  203. package/dist/hooks/use-mutation-observer.js +33 -34
  204. package/dist/hooks/use-pagination.d.ts +15 -22
  205. package/dist/hooks/use-pagination.d.ts.map +1 -0
  206. package/dist/hooks/use-pagination.js +99 -99
  207. package/dist/index.d.ts +131 -69
  208. package/dist/index.d.ts.map +1 -0
  209. package/dist/index.js +68 -69
  210. package/dist/lib/utils.d.ts +10 -0
  211. package/dist/lib/utils.d.ts.map +1 -0
  212. package/dist/lib/utils.js +10 -0
  213. package/dist/primitives/checkbox-group.d.ts +84 -105
  214. package/dist/primitives/checkbox-group.d.ts.map +1 -0
  215. package/dist/primitives/checkbox-group.js +91 -105
  216. package/dist/primitives/input-number.d.ts +41 -51
  217. package/dist/primitives/input-number.d.ts.map +1 -0
  218. package/dist/primitives/input-number.js +417 -473
  219. package/dist/primitives/input.d.ts +43 -48
  220. package/dist/primitives/input.d.ts.map +1 -0
  221. package/dist/primitives/input.js +67 -66
  222. package/dist/primitives/progress-circle.d.ts +49 -79
  223. package/dist/primitives/progress-circle.d.ts.map +1 -0
  224. package/dist/primitives/progress-circle.js +134 -149
  225. package/package.json +33 -16
  226. package/{dist → src}/css/preset.css +86 -9
  227. /package/{dist → src}/css/amber.css +0 -0
  228. /package/{dist → src}/css/blue.css +0 -0
  229. /package/{dist → src}/css/cyan.css +0 -0
  230. /package/{dist → src}/css/emerald.css +0 -0
  231. /package/{dist → src}/css/fuchsia.css +0 -0
  232. /package/{dist → src}/css/gray.css +0 -0
  233. /package/{dist → src}/css/green.css +0 -0
  234. /package/{dist → src}/css/indigo.css +0 -0
  235. /package/{dist → src}/css/lime.css +0 -0
  236. /package/{dist → src}/css/neutral.css +0 -0
  237. /package/{dist → src}/css/orange.css +0 -0
  238. /package/{dist → src}/css/pink.css +0 -0
  239. /package/{dist → src}/css/purple.css +0 -0
  240. /package/{dist → src}/css/red.css +0 -0
  241. /package/{dist → src}/css/rose.css +0 -0
  242. /package/{dist → src}/css/sky.css +0 -0
  243. /package/{dist → src}/css/slate.css +0 -0
  244. /package/{dist → src}/css/stone.css +0 -0
  245. /package/{dist → src}/css/style.css +0 -0
  246. /package/{dist → src}/css/teal.css +0 -0
  247. /package/{dist → src}/css/violet.css +0 -0
  248. /package/{dist → src}/css/yellow.css +0 -0
  249. /package/{dist → src}/css/zinc.css +0 -0
@@ -1,178 +1,163 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useId, useMemo } from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
4
3
  import { createContextScope } from "@radix-ui/react-context";
5
- //#region src/primitives/progress-circle.tsx
4
+ import { useId, useMemo } from "react";
5
+ /* -----------------------------------------------------------------------------
6
+ * Context: ProgressCircleProvider
7
+ * --------------------------------------------------------------------------- */
6
8
  const PROGRESS_CIRCLE_PROVIDER_NAME = "ProgressCircleProvider";
7
9
  const [createProgressCircleContext, createProgressCircleScope] = createContextScope(PROGRESS_CIRCLE_PROVIDER_NAME);
8
10
  const [ProgressCircleContextProvider, useProgressCircleContext] = createProgressCircleContext(PROGRESS_CIRCLE_PROVIDER_NAME);
9
11
  /**
10
- * Provides context for the ProgressCircle component
11
- *
12
- * Manages calculations for rendering the circular progress indicator,
13
- * including value clamping, sizing, thresholds, and indeterminate state.
14
- *
15
- * @example
16
- * ```tsx
17
- * <ProgressCircleProvider
18
- * value={75}
19
- * min={0}
20
- * max={100}
21
- * size={64}
22
- * thresholds={[
23
- * { value: 30, color: 'red', background: 'pink' },
24
- * { value: 70, color: 'yellow', background: 'lightyellow' },
25
- * { value: 100, color: 'green', background: 'lightgreen' }
26
- * ]}
27
- * >
28
- * <ProgressCircleSVG>
29
- * <ProgressCircleIndicator />
30
- * <ProgressCircleTrack />
31
- * </ProgressCircleSVG>
32
- * <ProgressCircleValue />
33
- * </ProgressCircleProvider>
34
- * ```
35
- */
36
- function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max = 100, min = 0, size = 48, startAngle = -90, strokeWidth = 4, thresholds, value }) {
37
- const uniqueId = useId();
38
- const id = propertyId ?? uniqueId;
39
- const validSize = Math.max(0, size);
40
- const validStrokeWidth = Math.max(0, strokeWidth);
41
- const validStartAngle = startAngle % 360;
42
- let validMin = min;
43
- let validMax = max;
44
- if (validMin > validMax) [validMin, validMax] = [validMax, validMin];
45
- const clampedValue = value === null || value === void 0 ? void 0 : clamp(validMin, validMax, value);
46
- const range = validMax - validMin;
47
- const percentage = clampedValue !== void 0 && range > 0 ? (clampedValue - validMin) / range * 100 : 0;
48
- const valueText = clampedValue !== void 0 && formatValue ? formatValue(clampedValue) : `${Math.round(percentage).toString()}%`;
49
- const sortedThresholds = useMemo(() => thresholds && thresholds.length > 0 ? [...thresholds].toSorted((a, b) => a.value - b.value) : [], [thresholds]);
50
- const threshold = useMemo(() => {
51
- if (clampedValue === void 0) return;
52
- for (const sortedThreshold of sortedThresholds) if (clampedValue <= sortedThreshold.value) return sortedThreshold;
53
- return sortedThresholds.at(-1);
54
- }, [sortedThresholds, clampedValue]);
55
- const center = validSize / 2;
56
- const radius = Math.max(0, center - validStrokeWidth / 2);
57
- const circumference = 2 * Math.PI * radius;
58
- const strokeDashoffset = circumference - percentage / 100 * circumference;
59
- const rotationTransform = `rotate(${validStartAngle.toString()}, 0, 0)`;
60
- return /* @__PURE__ */ jsx(ProgressCircleContextProvider, {
61
- center,
62
- circumference,
63
- clampedValue,
64
- id,
65
- max: validMax,
66
- min: validMin,
67
- radius,
68
- rotationTransform,
69
- scope: __scopeProgressCircle,
70
- size: validSize,
71
- strokeDashoffset,
72
- strokeWidth: validStrokeWidth,
73
- threshold,
74
- value: value ?? 0,
75
- valueText,
76
- children
77
- });
12
+ * Provides context for the ProgressCircle component
13
+ *
14
+ * Manages calculations for rendering the circular progress indicator,
15
+ * including value clamping, sizing, thresholds, and indeterminate state.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <ProgressCircleProvider
20
+ * value={75}
21
+ * min={0}
22
+ * max={100}
23
+ * size={64}
24
+ * thresholds={[
25
+ * { value: 30, color: 'red', background: 'pink' },
26
+ * { value: 70, color: 'yellow', background: 'lightyellow' },
27
+ * { value: 100, color: 'green', background: 'lightgreen' }
28
+ * ]}
29
+ * >
30
+ * <ProgressCircleSVG>
31
+ * <ProgressCircleIndicator />
32
+ * <ProgressCircleTrack />
33
+ * </ProgressCircleSVG>
34
+ * <ProgressCircleValue />
35
+ * </ProgressCircleProvider>
36
+ * ```
37
+ */
38
+ function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max = 100, min = 0, size = 48, startAngle = -90, strokeWidth = 4, thresholds, value, }) {
39
+ const uniqueId = useId();
40
+ const id = propertyId ?? uniqueId;
41
+ // Ensure size and stroke width are non-negative
42
+ const validSize = Math.max(0, size);
43
+ const validStrokeWidth = Math.max(0, strokeWidth);
44
+ const validStartAngle = startAngle % 360;
45
+ // Validate min and max, swap if min > max
46
+ let validMin = min;
47
+ let validMax = max;
48
+ if (validMin > validMax) {
49
+ [validMin, validMax] = [validMax, validMin];
50
+ }
51
+ // Handle indeterminate state
52
+ const isIndeterminate = value === null || value === undefined;
53
+ const clampedValue = isIndeterminate ? undefined : clamp(validMin, validMax, value);
54
+ const range = validMax - validMin;
55
+ const percentage = clampedValue !== undefined && range > 0 ? ((clampedValue - validMin) / range) * 100 : 0;
56
+ const valueText = clampedValue !== undefined && formatValue
57
+ ? formatValue(clampedValue)
58
+ : `${Math.round(percentage).toString()}%`;
59
+ // Sort thresholds by value
60
+ const sortedThresholds = useMemo(() => thresholds && thresholds.length > 0
61
+ ? [...thresholds].toSorted((a, b) => a.value - b.value)
62
+ : [], [thresholds]);
63
+ // Determine an active threshold based on a clamped value
64
+ const threshold = useMemo(() => {
65
+ if (clampedValue === undefined) {
66
+ return;
67
+ }
68
+ for (const sortedThreshold of sortedThresholds) {
69
+ if (clampedValue <= sortedThreshold.value) {
70
+ return sortedThreshold;
71
+ }
72
+ }
73
+ return sortedThresholds.at(-1);
74
+ }, [sortedThresholds, clampedValue]);
75
+ // Calculate circle properties
76
+ const center = validSize / 2;
77
+ const radius = Math.max(0, center - validStrokeWidth / 2);
78
+ const circumference = 2 * Math.PI * radius;
79
+ const strokeDashoffset = circumference - (percentage / 100) * circumference;
80
+ const rotationTransform = `rotate(${validStartAngle.toString()}, 0, 0)`;
81
+ return (_jsx(ProgressCircleContextProvider, { center: center, circumference: circumference, clampedValue: clampedValue, id: id, max: validMax, min: validMin, radius: radius, rotationTransform: rotationTransform, scope: __scopeProgressCircle, size: validSize, strokeDashoffset: strokeDashoffset, strokeWidth: validStrokeWidth, threshold: threshold, value: value ?? 0, valueText: valueText, children: children }));
78
82
  }
79
83
  /**
80
- * Root component for the progress circle
81
- *
82
- * Serves as a wrapper for other progress circle components.
83
- */
84
+ * Root component for the progress circle
85
+ *
86
+ * Serves as a wrapper for other progress circle components.
87
+ */
84
88
  function ProgressCircle({ __scopeProgressCircle, ...props }) {
85
- return /* @__PURE__ */ jsx("div", { ...props });
89
+ return _jsx("div", { ...props });
86
90
  }
91
+ /* -----------------------------------------------------------------------------
92
+ * Component: ProgressCircleSVG
93
+ * --------------------------------------------------------------------------- */
87
94
  const PROGRESS_CIRCLE_SVG_NAME = "ProgressCircleSVG";
88
95
  /**
89
- * SVG container for the progress circle
90
- *
91
- * Renders the SVG with accessibility attributes and supports indeterminate state.
92
- */
96
+ * SVG container for the progress circle
97
+ *
98
+ * Renders the SVG with accessibility attributes and supports indeterminate state.
99
+ */
93
100
  function ProgressCircleSVG({ __scopeProgressCircle, ...props }) {
94
- const { clampedValue, id, max, min, size, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_SVG_NAME, __scopeProgressCircle);
95
- return /* @__PURE__ */ jsx("svg", {
96
- "aria-label": "Progress",
97
- "aria-valuemax": max,
98
- "aria-valuemin": min,
99
- "aria-valuenow": clampedValue,
100
- "aria-valuetext": clampedValue === void 0 ? void 0 : valueText,
101
- height: size,
102
- id,
103
- role: "progressbar",
104
- viewBox: `0 0 ${size.toString()} ${size.toString()}`,
105
- width: size,
106
- ...props
107
- });
101
+ const { clampedValue, id, max, min, size, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_SVG_NAME, __scopeProgressCircle);
102
+ return (_jsx("svg", { "aria-label": "Progress", "aria-valuemax": max, "aria-valuemin": min, "aria-valuenow": clampedValue, "aria-valuetext": clampedValue === undefined ? undefined : valueText, height: size, id: id, role: "progressbar", viewBox: `0 0 ${size.toString()} ${size.toString()}`, width: size, ...props }));
108
103
  }
104
+ /* -----------------------------------------------------------------------------
105
+ * Component: ProgressCircleTrack
106
+ * --------------------------------------------------------------------------- */
109
107
  const PROGRESS_CIRCLE_TRACK_NAME = "ProgressCircleTrack";
110
108
  /**
111
- * Background circle for the progress indicator
112
- *
113
- * Renders the static track of the progress circle.
114
- */
109
+ * Background circle for the progress indicator
110
+ *
111
+ * Renders the static track of the progress circle.
112
+ */
115
113
  function ProgressCircleTrack({ __scopeProgressCircle, ...props }) {
116
- const { center, radius, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_TRACK_NAME, __scopeProgressCircle);
117
- return /* @__PURE__ */ jsx("circle", {
118
- cx: center,
119
- cy: center,
120
- fill: "transparent",
121
- r: radius,
122
- stroke: threshold?.background ?? "currentColor",
123
- strokeWidth,
124
- ...props
125
- });
114
+ const { center, radius, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_TRACK_NAME, __scopeProgressCircle);
115
+ return (_jsx("circle", { cx: center, cy: center, fill: "transparent", r: radius, stroke: threshold?.background ?? "currentColor", strokeWidth: strokeWidth, ...props }));
126
116
  }
117
+ /* -----------------------------------------------------------------------------
118
+ * Component: ProgressCircleIndicator
119
+ * --------------------------------------------------------------------------- */
127
120
  const PROGRESS_CIRCLE_INDICATOR_NAME = "ProgressCircleIndicator";
128
121
  /**
129
- * Foreground circle showing progress
130
- *
131
- * Renders the dynamic progress indicator with stroke dash properties.
132
- */
122
+ * Foreground circle showing progress
123
+ *
124
+ * Renders the dynamic progress indicator with stroke dash properties.
125
+ */
133
126
  function ProgressCircleIndicator({ __scopeProgressCircle, ...props }) {
134
- const { center, circumference, radius, rotationTransform, strokeDashoffset, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_INDICATOR_NAME, __scopeProgressCircle);
135
- return /* @__PURE__ */ jsx("circle", {
136
- cx: center,
137
- cy: center,
138
- fill: "transparent",
139
- r: radius,
140
- stroke: threshold?.color ?? "currentColor",
141
- strokeDasharray: circumference,
142
- strokeDashoffset,
143
- strokeLinecap: "round",
144
- strokeWidth,
145
- transform: rotationTransform,
146
- ...props
147
- });
127
+ const { center, circumference, radius, rotationTransform, strokeDashoffset, strokeWidth, threshold, } = useProgressCircleContext(PROGRESS_CIRCLE_INDICATOR_NAME, __scopeProgressCircle);
128
+ return (_jsx("circle", { cx: center, cy: center, fill: "transparent", r: radius, stroke: threshold?.color ?? "currentColor", strokeDasharray: circumference, strokeDashoffset: strokeDashoffset, strokeLinecap: "round", strokeWidth: strokeWidth, transform: rotationTransform, ...props }));
148
129
  }
130
+ /* -----------------------------------------------------------------------------
131
+ * Component: ProgressCircleValue
132
+ * --------------------------------------------------------------------------- */
149
133
  const PROGRESS_CIRCLE_VALUE_NAME = "ProgressCircleValue";
150
134
  /**
151
- * Displays the current progress value
152
- *
153
- * Supports custom content or default value text rendering.
154
- */
135
+ * Displays the current progress value
136
+ *
137
+ * Supports custom content or default value text rendering.
138
+ */
155
139
  function ProgressCircleValue({ __scopeProgressCircle, children, ...props }) {
156
- const { clampedValue, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_VALUE_NAME, __scopeProgressCircle);
157
- if (typeof children === "function") return children({
158
- value: clampedValue,
159
- valueText
160
- });
161
- return /* @__PURE__ */ jsx("div", {
162
- ...props,
163
- children: children ?? valueText
164
- });
140
+ const { clampedValue, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_VALUE_NAME, __scopeProgressCircle);
141
+ if (typeof children === "function") {
142
+ return children({ value: clampedValue, valueText });
143
+ }
144
+ return _jsx("div", { ...props, children: children ?? valueText });
165
145
  }
146
+ /* -----------------------------------------------------------------------------
147
+ * Helpers
148
+ * -------------------------------------------------------------------------- */
166
149
  /**
167
- * Clamps a value within a specified min/max range
168
- *
169
- * @param min - Minimum value
170
- * @param max - Maximum value
171
- * @param value - Value to clamp
172
- * @returns Clamped value
173
- */
150
+ * Clamps a value within a specified min/max range
151
+ *
152
+ * @param min - Minimum value
153
+ * @param max - Maximum value
154
+ * @param value - Value to clamp
155
+ * @returns Clamped value
156
+ */
174
157
  function clamp(min, max, value) {
175
- return Math.min(max, Math.max(min, value));
158
+ return Math.min(max, Math.max(min, value));
176
159
  }
177
- //#endregion
178
- export { ProgressCircleIndicator as Indicator, ProgressCircleIndicator, ProgressCircle, ProgressCircle as Root, ProgressCircleProvider, ProgressCircleProvider as Provider, ProgressCircleSVG, ProgressCircleSVG as SVG, ProgressCircleTrack, ProgressCircleTrack as Track, ProgressCircleValue, ProgressCircleValue as Value, createProgressCircleScope };
160
+ /* -----------------------------------------------------------------------------
161
+ * Exports
162
+ * -------------------------------------------------------------------------- */
163
+ export { createProgressCircleScope, ProgressCircleIndicator as Indicator, ProgressCircle, ProgressCircleIndicator, ProgressCircleProvider, ProgressCircleSVG, ProgressCircleTrack, ProgressCircleValue, ProgressCircleProvider as Provider, ProgressCircle as Root, ProgressCircleSVG as SVG, ProgressCircleTrack as Track, ProgressCircleValue as Value, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/ui",
3
- "version": "0.3.11",
3
+ "version": "0.3.12-canary.1",
4
4
  "description": "Core UI components library built with React and Tailwind CSS",
5
5
  "keywords": [
6
6
  "components",
@@ -26,16 +26,29 @@
26
26
  },
27
27
  "files": [
28
28
  "dist",
29
+ "src/css",
29
30
  "CHANGELOG.md",
30
31
  "README.md",
31
32
  "LICENSE"
32
33
  ],
33
34
  "type": "module",
34
35
  "sideEffects": [
35
- "./dist/css/**/*.css"
36
+ "./src/css/**/*.css"
36
37
  ],
37
38
  "main": "./dist/index.js",
38
39
  "types": "./dist/index.d.ts",
40
+ "imports": {
41
+ "#*": [
42
+ "./dist/*",
43
+ "./dist/*.js",
44
+ "./dist/*/index.js",
45
+ "./src/*",
46
+ "./src/*.ts",
47
+ "./src/*.tsx",
48
+ "./src/*/index.ts",
49
+ "./src/*/index.tsx"
50
+ ]
51
+ },
39
52
  "exports": {
40
53
  ".": {
41
54
  "types": "./dist/index.d.ts",
@@ -329,7 +342,11 @@
329
342
  "types": "./dist/primitives/progress-circle.d.ts",
330
343
  "import": "./dist/primitives/progress-circle.js"
331
344
  },
332
- "./css/*": "./dist/css/*",
345
+ "./lib/utils": {
346
+ "types": "./dist/lib/utils.d.ts",
347
+ "import": "./dist/lib/utils.js"
348
+ },
349
+ "./css/*": "./src/css/*",
333
350
  "./package.json": "./package.json"
334
351
  },
335
352
  "publishConfig": {
@@ -373,19 +390,19 @@
373
390
  "date-fns": "^4.1.0",
374
391
  "embla-carousel-react": "^8.6.0",
375
392
  "input-otp": "^1.4.2",
376
- "lucide-react": "^1.7.0",
393
+ "lucide-react": "^1.8.0",
377
394
  "next-themes": "^0.4.6",
378
395
  "react-day-picker": "^9.14.0",
379
- "react-hook-form": "^7.72.0",
380
- "react-resizable-panels": "^4.7.6",
396
+ "react-hook-form": "^7.72.1",
397
+ "react-resizable-panels": "^4.10.0",
381
398
  "recharts": "^3.8.1",
382
399
  "sonner": "^2.0.7",
383
400
  "tw-animate-css": "^1.4.0",
384
401
  "vaul": "^1.1.2",
385
- "@codefast/tailwind-variants": "0.3.11"
402
+ "@codefast/tailwind-variants": "0.3.12-canary.1"
386
403
  },
387
404
  "devDependencies": {
388
- "@swc/core": "^1.15.21",
405
+ "@swc/core": "^1.15.24",
389
406
  "@swc/jest": "^0.2.39",
390
407
  "@tailwindcss/postcss": "^4.2.2",
391
408
  "@testing-library/dom": "^10.4.1",
@@ -394,16 +411,16 @@
394
411
  "@testing-library/user-event": "^14.6.1",
395
412
  "@types/jest": "^30.0.0",
396
413
  "@types/jest-axe": "^3.5.9",
397
- "@types/node": "^25.5.0",
414
+ "@types/node": "^25.6.0",
415
+ "@typescript/native-preview": "7.0.0-dev.20260411.1",
398
416
  "jest": "^30.3.0",
399
417
  "jest-axe": "^10.0.0",
400
418
  "jest-environment-jsdom": "^30.3.0",
401
- "postcss": "^8.5.8",
419
+ "postcss": "^8.5.9",
402
420
  "tailwindcss": "^4.2.2",
403
421
  "ts-node": "^10.9.2",
404
- "tsdown": "^0.21.7",
405
422
  "typescript": "^6.0.2",
406
- "@codefast/typescript-config": "0.3.11"
423
+ "@codefast/typescript-config": "0.3.12-canary.1"
407
424
  },
408
425
  "peerDependencies": {
409
426
  "@types/react": "^19.0",
@@ -420,13 +437,13 @@
420
437
  }
421
438
  },
422
439
  "scripts": {
423
- "build": "tsdown",
440
+ "build": "rm -rf dist && tsgo -p tsconfig.build.json",
441
+ "check-types": "tsgo --noEmit",
424
442
  "clean": "rm -rf dist",
425
- "dev": "tsdown --watch --no-clean",
443
+ "dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
426
444
  "test": "jest",
427
445
  "test:coverage": "jest --coverage",
428
446
  "test:coverage:ci": "jest --coverage --ci",
429
- "test:watch": "jest --watch",
430
- "typecheck": "tsc --noEmit"
447
+ "test:watch": "jest --watch"
431
448
  }
432
449
  }
@@ -1,9 +1,86 @@
1
1
  @import "tw-animate-css";
2
2
 
3
- @source "../**/*.js";
3
+ @source "../../dist/**/*.js";
4
4
 
5
5
  @custom-variant dark (&:where(.dark, .dark *));
6
6
 
7
+ @custom-variant data-horizontal (&:where([data-orientation="horizontal"]));
8
+
9
+ @custom-variant data-vertical (&:where([data-orientation="vertical"]));
10
+
11
+ @custom-variant data-side-top (&:where([data-side="top"]));
12
+
13
+ @custom-variant data-side-right (&:where([data-side="right"]));
14
+
15
+ @custom-variant data-side-bottom (&:where([data-side="bottom"]));
16
+
17
+ @custom-variant data-side-left (&:where([data-side="left"]));
18
+
19
+ @custom-variant data-open {
20
+ &:where([data-state="open"]),
21
+ &:where([data-open]:not([data-open="false"])) {
22
+ @slot;
23
+ }
24
+ }
25
+
26
+ @custom-variant data-closed {
27
+ &:where([data-state="closed"]),
28
+ &:where([data-closed]:not([data-closed="false"])) {
29
+ @slot;
30
+ }
31
+ }
32
+
33
+ @custom-variant data-checked {
34
+ &:where([data-state="checked"]),
35
+ &:where([data-checked]:not([data-checked="false"])) {
36
+ @slot;
37
+ }
38
+ }
39
+
40
+ @custom-variant data-unchecked {
41
+ &:where([data-state="unchecked"]),
42
+ &:where([data-unchecked]:not([data-unchecked="false"])) {
43
+ @slot;
44
+ }
45
+ }
46
+
47
+ @custom-variant data-selected {
48
+ &:where([data-state="selected"]),
49
+ &:where([data-selected="true"]) {
50
+ @slot;
51
+ }
52
+ }
53
+
54
+ @custom-variant data-active {
55
+ &:where([data-state="active"]),
56
+ &:where([data-active]:not([data-active="false"])) {
57
+ @slot;
58
+ }
59
+ }
60
+
61
+ @custom-variant data-disabled {
62
+ &:where([data-disabled="true"]),
63
+ &:where([data-disabled]:not([data-disabled="false"])) {
64
+ @slot;
65
+ }
66
+ }
67
+
68
+ @custom-variant data-focused {
69
+ &:where([data-focused="true"]),
70
+ &:where([data-focused]:not([data-focused="false"])) {
71
+ @slot;
72
+ }
73
+ }
74
+
75
+ @utility no-scrollbar {
76
+ -ms-overflow-style: none;
77
+ scrollbar-width: none;
78
+
79
+ &::-webkit-scrollbar {
80
+ display: none;
81
+ }
82
+ }
83
+
7
84
  :root {
8
85
  --radius: 0.375rem;
9
86
  }
@@ -52,14 +129,14 @@
52
129
  --color-chart-4: var(--chart-4);
53
130
  --color-chart-5: var(--chart-5);
54
131
 
55
- --radius-xs: max(0px, calc(var(--radius) - 4px));
56
- --radius-sm: max(0px, calc(var(--radius) - 2px));
132
+ --radius-xs: calc(var(--radius) * 2 / 6);
133
+ --radius-sm: calc(var(--radius) * 4 / 6);
57
134
  --radius-md: var(--radius);
58
- --radius-lg: calc(var(--radius) + 2px);
59
- --radius-xl: calc(var(--radius) + 4px);
60
- --radius-2xl: calc(var(--radius) + 6px);
61
- --radius-3xl: calc(var(--radius) + 8px);
62
- --radius-4xl: calc(var(--radius) + 10px);
135
+ --radius-lg: calc(var(--radius) * 8 / 6);
136
+ --radius-xl: calc(var(--radius) * 12 / 6);
137
+ --radius-2xl: calc(var(--radius) * 16 / 6);
138
+ --radius-3xl: calc(var(--radius) * 24 / 6);
139
+ --radius-4xl: calc(var(--radius) * 32 / 6);
63
140
  }
64
141
 
65
142
  @theme {
@@ -73,7 +150,7 @@
73
150
  ::backdrop,
74
151
  ::file-selector-button {
75
152
  border-color: var(--color-border);
76
- outline-color: color-mix(in oklab, var(--color-ring) 20%, transparent);
153
+ outline-color: --alpha(var(--color-ring) / 20%);
77
154
  }
78
155
 
79
156
  ::-webkit-scrollbar {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes