@codefast/ui 0.3.11 → 0.3.12-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/CHANGELOG.md +15 -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 +10 -37
  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 +16 -69
  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 +22 -30
  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 +7 -18
  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 +23 -20
  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 +13 -49
  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 +22 -27
  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 +43 -51
  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 +75 -92
  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 +11 -39
  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 +82 -114
  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 +161 -150
  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 +8 -22
  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 +7 -19
  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 +6 -14
  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 +18 -69
  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 +21 -89
  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 +20 -72
  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 +16 -58
  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 +21 -96
  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 +24 -44
  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 +46 -89
  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 +50 -66
  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 +8 -23
  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 +59 -66
  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 +14 -55
  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 +13 -34
  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 +10 -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 +16 -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 +5 -9
  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 +47 -90
  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 +6 -13
  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 +5 -8
  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 +23 -99
  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 +7 -25
  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 +25 -61
  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 +13 -55
  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 +9 -27
  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 +70 -103
  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 +7 -13
  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 +7 -21
  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 +6 -17
  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 +5 -10
  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 +7 -21
  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 +64 -84
  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 +26 -78
  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 +27 -36
  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 +36 -80
  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 +166 -301
  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 +5 -8
  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 +12 -34
  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 +13 -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 +20 -33
  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 +5 -12
  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 +12 -47
  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 +8 -23
  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 +5 -8
  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 +20 -38
  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 +24 -29
  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 +9 -28
  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/primitives/checkbox-group.d.ts +84 -105
  211. package/dist/primitives/checkbox-group.d.ts.map +1 -0
  212. package/dist/primitives/checkbox-group.js +91 -105
  213. package/dist/primitives/input-number.d.ts +41 -51
  214. package/dist/primitives/input-number.d.ts.map +1 -0
  215. package/dist/primitives/input-number.js +417 -473
  216. package/dist/primitives/input.d.ts +43 -48
  217. package/dist/primitives/input.d.ts.map +1 -0
  218. package/dist/primitives/input.js +67 -66
  219. package/dist/primitives/progress-circle.d.ts +49 -79
  220. package/dist/primitives/progress-circle.d.ts.map +1 -0
  221. package/dist/primitives/progress-circle.js +134 -149
  222. package/package.json +17 -10
  223. package/{dist → src}/css/preset.css +1 -1
  224. /package/{dist → src}/css/amber.css +0 -0
  225. /package/{dist → src}/css/blue.css +0 -0
  226. /package/{dist → src}/css/cyan.css +0 -0
  227. /package/{dist → src}/css/emerald.css +0 -0
  228. /package/{dist → src}/css/fuchsia.css +0 -0
  229. /package/{dist → src}/css/gray.css +0 -0
  230. /package/{dist → src}/css/green.css +0 -0
  231. /package/{dist → src}/css/indigo.css +0 -0
  232. /package/{dist → src}/css/lime.css +0 -0
  233. /package/{dist → src}/css/neutral.css +0 -0
  234. /package/{dist → src}/css/orange.css +0 -0
  235. /package/{dist → src}/css/pink.css +0 -0
  236. /package/{dist → src}/css/purple.css +0 -0
  237. /package/{dist → src}/css/red.css +0 -0
  238. /package/{dist → src}/css/rose.css +0 -0
  239. /package/{dist → src}/css/sky.css +0 -0
  240. /package/{dist → src}/css/slate.css +0 -0
  241. /package/{dist → src}/css/stone.css +0 -0
  242. /package/{dist → src}/css/style.css +0 -0
  243. /package/{dist → src}/css/teal.css +0 -0
  244. /package/{dist → src}/css/violet.css +0 -0
  245. /package/{dist → src}/css/yellow.css +0 -0
  246. /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.0",
4
4
  "description": "Core UI components library built with React and Tailwind CSS",
5
5
  "keywords": [
6
6
  "components",
@@ -26,16 +26,24 @@
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
+ ]
46
+ },
39
47
  "exports": {
40
48
  ".": {
41
49
  "types": "./dist/index.d.ts",
@@ -329,7 +337,7 @@
329
337
  "types": "./dist/primitives/progress-circle.d.ts",
330
338
  "import": "./dist/primitives/progress-circle.js"
331
339
  },
332
- "./css/*": "./dist/css/*",
340
+ "./css/*": "./src/css/*",
333
341
  "./package.json": "./package.json"
334
342
  },
335
343
  "publishConfig": {
@@ -382,7 +390,7 @@
382
390
  "sonner": "^2.0.7",
383
391
  "tw-animate-css": "^1.4.0",
384
392
  "vaul": "^1.1.2",
385
- "@codefast/tailwind-variants": "0.3.11"
393
+ "@codefast/tailwind-variants": "0.3.12-canary.0"
386
394
  },
387
395
  "devDependencies": {
388
396
  "@swc/core": "^1.15.21",
@@ -401,9 +409,8 @@
401
409
  "postcss": "^8.5.8",
402
410
  "tailwindcss": "^4.2.2",
403
411
  "ts-node": "^10.9.2",
404
- "tsdown": "^0.21.7",
405
412
  "typescript": "^6.0.2",
406
- "@codefast/typescript-config": "0.3.11"
413
+ "@codefast/typescript-config": "0.3.12-canary.0"
407
414
  },
408
415
  "peerDependencies": {
409
416
  "@types/react": "^19.0",
@@ -420,13 +427,13 @@
420
427
  }
421
428
  },
422
429
  "scripts": {
423
- "build": "tsdown",
430
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
431
+ "check-types": "tsc --noEmit",
424
432
  "clean": "rm -rf dist",
425
- "dev": "tsdown --watch --no-clean",
433
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
426
434
  "test": "jest",
427
435
  "test:coverage": "jest --coverage",
428
436
  "test:coverage:ci": "jest --coverage --ci",
429
- "test:watch": "jest --watch",
430
- "typecheck": "tsc --noEmit"
437
+ "test:watch": "jest --watch"
431
438
  }
432
439
  }
@@ -1,6 +1,6 @@
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
 
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