@codefast/ui 0.3.9 → 0.3.10

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 (245) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/accordion.cjs +97 -1
  3. package/dist/components/accordion.d.ts +4 -4
  4. package/dist/components/accordion.js +51 -1
  5. package/dist/components/alert-dialog.cjs +155 -1
  6. package/dist/components/alert-dialog.d.ts +11 -11
  7. package/dist/components/alert-dialog.js +94 -1
  8. package/dist/components/alert.cjs +84 -1
  9. package/dist/components/alert.d.ts +5 -5
  10. package/dist/components/alert.js +41 -1
  11. package/dist/components/aspect-ratio.cjs +43 -1
  12. package/dist/components/aspect-ratio.d.ts +2 -2
  13. package/dist/components/aspect-ratio.js +9 -1
  14. package/dist/components/avatar.cjs +65 -1
  15. package/dist/components/avatar.d.ts +2 -2
  16. package/dist/components/avatar.js +25 -1
  17. package/dist/components/badge.cjs +66 -1
  18. package/dist/components/badge.d.ts +3 -3
  19. package/dist/components/badge.js +29 -1
  20. package/dist/components/breadcrumb.cjs +126 -1
  21. package/dist/components/breadcrumb.d.ts +8 -8
  22. package/dist/components/breadcrumb.js +74 -1
  23. package/dist/components/button-group.cjs +86 -1
  24. package/dist/components/button-group.d.ts +5 -5
  25. package/dist/components/button-group.js +43 -1
  26. package/dist/components/button.cjs +92 -1
  27. package/dist/components/button.d.ts +6 -6
  28. package/dist/components/button.js +55 -1
  29. package/dist/components/calendar.cjs +150 -1
  30. package/dist/components/calendar.d.ts +12 -19
  31. package/dist/components/calendar.js +113 -1
  32. package/dist/components/card.cjs +105 -1
  33. package/dist/components/card.d.ts +8 -8
  34. package/dist/components/card.js +53 -1
  35. package/dist/components/carousel.cjs +210 -1
  36. package/dist/components/carousel.d.ts +10 -10
  37. package/dist/components/carousel.js +151 -1
  38. package/dist/components/chart.cjs +250 -3
  39. package/dist/components/chart.d.ts +9 -9
  40. package/dist/components/chart.js +198 -3
  41. package/dist/components/checkbox-cards.cjs +69 -1
  42. package/dist/components/checkbox-cards.d.ts +2 -2
  43. package/dist/components/checkbox-cards.js +32 -1
  44. package/dist/components/checkbox-group.cjs +63 -1
  45. package/dist/components/checkbox-group.d.ts +2 -2
  46. package/dist/components/checkbox-group.js +26 -1
  47. package/dist/components/checkbox.cjs +53 -1
  48. package/dist/components/checkbox.d.ts +2 -2
  49. package/dist/components/checkbox.js +19 -1
  50. package/dist/components/collapsible.cjs +61 -1
  51. package/dist/components/collapsible.d.ts +2 -2
  52. package/dist/components/collapsible.js +21 -1
  53. package/dist/components/command.cjs +167 -1
  54. package/dist/components/command.d.ts +4 -4
  55. package/dist/components/command.js +106 -1
  56. package/dist/components/context-menu.cjs +218 -1
  57. package/dist/components/context-menu.d.ts +4 -4
  58. package/dist/components/context-menu.js +142 -1
  59. package/dist/components/dialog.cjs +164 -1
  60. package/dist/components/dialog.d.ts +10 -10
  61. package/dist/components/dialog.js +106 -1
  62. package/dist/components/drawer.cjs +143 -1
  63. package/dist/components/drawer.d.ts +9 -9
  64. package/dist/components/drawer.js +85 -1
  65. package/dist/components/dropdown-menu.cjs +221 -1
  66. package/dist/components/dropdown-menu.d.ts +4 -4
  67. package/dist/components/dropdown-menu.js +145 -1
  68. package/dist/components/empty.cjs +113 -1
  69. package/dist/components/empty.d.ts +9 -9
  70. package/dist/components/empty.js +61 -1
  71. package/dist/components/field.cjs +193 -1
  72. package/dist/components/field.d.ts +14 -14
  73. package/dist/components/field.js +129 -1
  74. package/dist/components/form.cjs +151 -1
  75. package/dist/components/form.d.ts +10 -10
  76. package/dist/components/form.js +96 -1
  77. package/dist/components/hover-card.cjs +77 -1
  78. package/dist/components/hover-card.d.ts +2 -2
  79. package/dist/components/hover-card.js +34 -1
  80. package/dist/components/input-group.cjs +155 -1
  81. package/dist/components/input-group.d.ts +15 -15
  82. package/dist/components/input-group.js +97 -1
  83. package/dist/components/input-number.cjs +98 -1
  84. package/dist/components/input-number.d.ts +2 -2
  85. package/dist/components/input-number.js +64 -1
  86. package/dist/components/input-otp.cjs +101 -1
  87. package/dist/components/input-otp.d.ts +6 -6
  88. package/dist/components/input-otp.js +49 -1
  89. package/dist/components/input-password.cjs +71 -1
  90. package/dist/components/input-password.d.ts +3 -3
  91. package/dist/components/input-password.js +37 -1
  92. package/dist/components/input-search.cjs +80 -1
  93. package/dist/components/input-search.d.ts +3 -3
  94. package/dist/components/input-search.js +46 -1
  95. package/dist/components/input.cjs +45 -1
  96. package/dist/components/input.d.ts +2 -2
  97. package/dist/components/input.js +11 -1
  98. package/dist/components/item.cjs +186 -1
  99. package/dist/components/item.d.ts +12 -12
  100. package/dist/components/item.js +119 -1
  101. package/dist/components/kbd.cjs +54 -1
  102. package/dist/components/kbd.d.ts +3 -3
  103. package/dist/components/kbd.js +17 -1
  104. package/dist/components/label.cjs +45 -1
  105. package/dist/components/label.d.ts +2 -2
  106. package/dist/components/label.js +11 -1
  107. package/dist/components/menubar.cjs +232 -1
  108. package/dist/components/menubar.d.ts +4 -4
  109. package/dist/components/menubar.js +153 -1
  110. package/dist/components/native-select.cjs +75 -1
  111. package/dist/components/native-select.d.ts +4 -4
  112. package/dist/components/native-select.js +35 -1
  113. package/dist/components/navigation-menu.cjs +146 -2
  114. package/dist/components/navigation-menu.d.ts +2 -2
  115. package/dist/components/navigation-menu.js +94 -2
  116. package/dist/components/pagination.cjs +138 -1
  117. package/dist/components/pagination.d.ts +10 -10
  118. package/dist/components/pagination.js +86 -1
  119. package/dist/components/popover.cjs +86 -1
  120. package/dist/components/popover.d.ts +3 -3
  121. package/dist/components/popover.js +40 -1
  122. package/dist/components/progress-circle.cjs +184 -1
  123. package/dist/components/progress-circle.d.ts +5 -5
  124. package/dist/components/progress-circle.js +147 -1
  125. package/dist/components/progress.cjs +52 -1
  126. package/dist/components/progress.d.ts +2 -2
  127. package/dist/components/progress.js +18 -1
  128. package/dist/components/radio-cards.cjs +66 -1
  129. package/dist/components/radio-cards.d.ts +2 -2
  130. package/dist/components/radio-cards.js +29 -1
  131. package/dist/components/radio-group.cjs +59 -1
  132. package/dist/components/radio-group.d.ts +2 -2
  133. package/dist/components/radio-group.js +22 -1
  134. package/dist/components/radio.cjs +47 -1
  135. package/dist/components/radio.d.ts +2 -2
  136. package/dist/components/radio.js +13 -1
  137. package/dist/components/resizable.cjs +71 -1
  138. package/dist/components/resizable.d.ts +8 -8
  139. package/dist/components/resizable.js +31 -1
  140. package/dist/components/scroll-area.cjs +140 -1
  141. package/dist/components/scroll-area.d.ts +5 -5
  142. package/dist/components/scroll-area.js +100 -1
  143. package/dist/components/select.cjs +180 -1
  144. package/dist/components/select.d.ts +5 -5
  145. package/dist/components/select.js +119 -1
  146. package/dist/components/separator.cjs +82 -1
  147. package/dist/components/separator.d.ts +5 -5
  148. package/dist/components/separator.js +42 -1
  149. package/dist/components/sheet.cjs +184 -1
  150. package/dist/components/sheet.d.ts +9 -9
  151. package/dist/components/sheet.js +123 -1
  152. package/dist/components/sidebar.cjs +506 -1
  153. package/dist/components/sidebar.d.ts +31 -31
  154. package/dist/components/sidebar.js +400 -1
  155. package/dist/components/skeleton.cjs +44 -1
  156. package/dist/components/skeleton.d.ts +2 -2
  157. package/dist/components/skeleton.js +10 -1
  158. package/dist/components/slider.cjs +79 -1
  159. package/dist/components/slider.d.ts +2 -2
  160. package/dist/components/slider.js +45 -1
  161. package/dist/components/sonner.cjs +57 -1
  162. package/dist/components/sonner.d.ts +3 -3
  163. package/dist/components/sonner.js +17 -1
  164. package/dist/components/spinner.cjs +75 -1
  165. package/dist/components/spinner.d.ts +2 -2
  166. package/dist/components/spinner.js +41 -1
  167. package/dist/components/switch.cjs +49 -1
  168. package/dist/components/switch.d.ts +2 -2
  169. package/dist/components/switch.js +15 -1
  170. package/dist/components/table.cjs +118 -1
  171. package/dist/components/table.d.ts +9 -9
  172. package/dist/components/table.js +63 -1
  173. package/dist/components/tabs.cjs +75 -1
  174. package/dist/components/tabs.d.ts +3 -3
  175. package/dist/components/tabs.js +32 -1
  176. package/dist/components/textarea.cjs +44 -1
  177. package/dist/components/textarea.d.ts +2 -2
  178. package/dist/components/textarea.js +10 -1
  179. package/dist/components/toggle-group.cjs +90 -1
  180. package/dist/components/toggle-group.d.ts +10 -12
  181. package/dist/components/toggle-group.js +53 -1
  182. package/dist/components/toggle.cjs +71 -1
  183. package/dist/components/toggle.d.ts +10 -12
  184. package/dist/components/toggle.js +34 -1
  185. package/dist/components/tooltip.cjs +90 -1
  186. package/dist/components/tooltip.d.ts +3 -3
  187. package/dist/components/tooltip.js +44 -1
  188. package/dist/css/amber.css +95 -1
  189. package/dist/css/blue.css +95 -1
  190. package/dist/css/cyan.css +95 -1
  191. package/dist/css/emerald.css +95 -1
  192. package/dist/css/fuchsia.css +95 -1
  193. package/dist/css/gray.css +95 -1
  194. package/dist/css/green.css +95 -1
  195. package/dist/css/indigo.css +95 -1
  196. package/dist/css/lime.css +95 -1
  197. package/dist/css/neutral.css +95 -1
  198. package/dist/css/orange.css +95 -1
  199. package/dist/css/pink.css +95 -1
  200. package/dist/css/preset.css +118 -1
  201. package/dist/css/purple.css +95 -1
  202. package/dist/css/red.css +95 -1
  203. package/dist/css/rose.css +95 -1
  204. package/dist/css/sky.css +95 -1
  205. package/dist/css/slate.css +95 -1
  206. package/dist/css/stone.css +95 -1
  207. package/dist/css/style.css +3 -1
  208. package/dist/css/teal.css +95 -1
  209. package/dist/css/violet.css +95 -1
  210. package/dist/css/yellow.css +95 -1
  211. package/dist/css/zinc.css +95 -1
  212. package/dist/hooks/use-animated-value.cjs +74 -1
  213. package/dist/hooks/use-animated-value.d.ts +9 -10
  214. package/dist/hooks/use-animated-value.js +40 -1
  215. package/dist/hooks/use-copy-to-clipboard.cjs +57 -1
  216. package/dist/hooks/use-copy-to-clipboard.d.ts +18 -1
  217. package/dist/hooks/use-copy-to-clipboard.js +23 -1
  218. package/dist/hooks/use-is-mobile.cjs +39 -1
  219. package/dist/hooks/use-is-mobile.d.ts +15 -6
  220. package/dist/hooks/use-is-mobile.js +5 -1
  221. package/dist/hooks/use-media-query.cjs +56 -1
  222. package/dist/hooks/use-media-query.d.ts +11 -3
  223. package/dist/hooks/use-media-query.js +22 -1
  224. package/dist/hooks/use-mutation-observer.cjs +56 -1
  225. package/dist/hooks/use-mutation-observer.d.ts +8 -12
  226. package/dist/hooks/use-mutation-observer.js +22 -1
  227. package/dist/hooks/use-pagination.cjs +92 -1
  228. package/dist/hooks/use-pagination.d.ts +12 -10
  229. package/dist/hooks/use-pagination.js +55 -1
  230. package/dist/index.cjs +1081 -1
  231. package/dist/index.d.ts +130 -131
  232. package/dist/index.js +69 -1
  233. package/dist/primitives/checkbox-group.cjs +151 -1
  234. package/dist/primitives/checkbox-group.d.ts +11 -11
  235. package/dist/primitives/checkbox-group.js +99 -1
  236. package/dist/primitives/input-number.cjs +439 -1
  237. package/dist/primitives/input-number.d.ts +8 -8
  238. package/dist/primitives/input-number.js +381 -1
  239. package/dist/primitives/input.cjs +99 -1
  240. package/dist/primitives/input.d.ts +4 -4
  241. package/dist/primitives/input.js +53 -1
  242. package/dist/primitives/progress-circle.cjs +198 -1
  243. package/dist/primitives/progress-circle.d.ts +7 -7
  244. package/dist/primitives/progress-circle.js +128 -1
  245. package/package.json +385 -38
@@ -1,2 +1,199 @@
1
+ "use strict";
1
2
  "use client";
2
- "use strict";const __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,r)=>{for(var o in r)__webpack_require__.o(r,o)&&!__webpack_require__.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},__webpack_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{createProgressCircleScope:()=>createProgressCircleScope,ProgressCircleValue:()=>ProgressCircleValue,ProgressCircle:()=>ProgressCircle,Indicator:()=>ProgressCircleIndicator,ProgressCircleIndicator:()=>ProgressCircleIndicator,ProgressCircleProvider:()=>ProgressCircleProvider,Provider:()=>ProgressCircleProvider,ProgressCircleSVG:()=>ProgressCircleSVG,Root:()=>ProgressCircle,ProgressCircleTrack:()=>ProgressCircleTrack,SVG:()=>ProgressCircleSVG,Value:()=>ProgressCircleValue,Track:()=>ProgressCircleTrack});const jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_react_namespaceObject=require("react"),react_context_namespaceObject=require("@radix-ui/react-context"),PROGRESS_CIRCLE_PROVIDER_NAME="ProgressCircleProvider",[createProgressCircleContext,createProgressCircleScope]=(0,react_context_namespaceObject.createContextScope)(PROGRESS_CIRCLE_PROVIDER_NAME),[ProgressCircleContextProvider,useProgressCircleContext]=createProgressCircleContext(PROGRESS_CIRCLE_PROVIDER_NAME);function ProgressCircleProvider({__scopeProgressCircle:e,children:r,formatValue:o,id:s,max:t=100,min:c=0,size:_=48,startAngle:a=-90,strokeWidth:i=4,thresholds:l,value:n}){let p=(0,external_react_namespaceObject.useId)(),P=Math.max(0,_),u=Math.max(0,i),C=c,g=t;C>g&&([C,g]=[g,C]);let x=null==n?void 0:clamp(C,g,n),d=g-C,b=void 0!==x&&d>0?(x-C)/d*100:0,k=void 0!==x&&o?o(x):`${Math.round(b).toString()}%`,m=(0,external_react_namespaceObject.useMemo)(()=>l&&l.length>0?[...l].toSorted((e,r)=>e.value-r.value):[],[l]),S=(0,external_react_namespaceObject.useMemo)(()=>{if(void 0!==x){for(let e of m)if(x<=e.value)return e;return m.at(-1)}},[m,x]),v=P/2,f=Math.max(0,v-u/2),w=2*Math.PI*f,R=`rotate(${(a%360).toString()}, 0, 0)`;return(0,jsx_runtime_namespaceObject.jsx)(ProgressCircleContextProvider,{center:v,circumference:w,clampedValue:x,id:s??p,max:g,min:C,radius:f,rotationTransform:R,scope:e,size:P,strokeDashoffset:w-b/100*w,strokeWidth:u,threshold:S,value:n??0,valueText:k,children:r})}function ProgressCircle({__scopeProgressCircle:e,...r}){return(0,jsx_runtime_namespaceObject.jsx)("div",{...r})}const PROGRESS_CIRCLE_SVG_NAME="ProgressCircleSVG";function ProgressCircleSVG({__scopeProgressCircle:e,...r}){let{clampedValue:o,id:s,max:t,min:c,size:_,valueText:a}=useProgressCircleContext("ProgressCircleSVG",e);return(0,jsx_runtime_namespaceObject.jsx)("svg",{"aria-label":"Progress","aria-valuemax":t,"aria-valuemin":c,"aria-valuenow":o,"aria-valuetext":void 0===o?void 0:a,height:_,id:s,role:"progressbar",viewBox:`0 0 ${_.toString()} ${_.toString()}`,width:_,...r})}const PROGRESS_CIRCLE_TRACK_NAME="ProgressCircleTrack";function ProgressCircleTrack({__scopeProgressCircle:e,...r}){let{center:o,radius:s,strokeWidth:t,threshold:c}=useProgressCircleContext("ProgressCircleTrack",e);return(0,jsx_runtime_namespaceObject.jsx)("circle",{cx:o,cy:o,fill:"transparent",r:s,stroke:c?.background??"currentColor",strokeWidth:t,...r})}const PROGRESS_CIRCLE_INDICATOR_NAME="ProgressCircleIndicator";function ProgressCircleIndicator({__scopeProgressCircle:e,...r}){let{center:o,circumference:s,radius:t,rotationTransform:c,strokeDashoffset:_,strokeWidth:a,threshold:i}=useProgressCircleContext("ProgressCircleIndicator",e);return(0,jsx_runtime_namespaceObject.jsx)("circle",{cx:o,cy:o,fill:"transparent",r:t,stroke:i?.color??"currentColor",strokeDasharray:s,strokeDashoffset:_,strokeLinecap:"round",strokeWidth:a,transform:c,...r})}const PROGRESS_CIRCLE_VALUE_NAME="ProgressCircleValue";function ProgressCircleValue({__scopeProgressCircle:e,children:r,...o}){let{clampedValue:s,valueText:t}=useProgressCircleContext("ProgressCircleValue",e);return"function"==typeof r?r({value:s,valueText:t}):(0,jsx_runtime_namespaceObject.jsx)("div",{...o,children:r??t})}function clamp(e,r,o){return Math.min(r,Math.max(e,o))}for(var __webpack_i__ in exports.Indicator=__webpack_exports__.Indicator,exports.ProgressCircle=__webpack_exports__.ProgressCircle,exports.ProgressCircleIndicator=__webpack_exports__.ProgressCircleIndicator,exports.ProgressCircleProvider=__webpack_exports__.ProgressCircleProvider,exports.ProgressCircleSVG=__webpack_exports__.ProgressCircleSVG,exports.ProgressCircleTrack=__webpack_exports__.ProgressCircleTrack,exports.ProgressCircleValue=__webpack_exports__.ProgressCircleValue,exports.Provider=__webpack_exports__.Provider,exports.Root=__webpack_exports__.Root,exports.SVG=__webpack_exports__.SVG,exports.Track=__webpack_exports__.Track,exports.Value=__webpack_exports__.Value,exports.createProgressCircleScope=__webpack_exports__.createProgressCircleScope,__webpack_exports__)-1===["Indicator","ProgressCircle","ProgressCircleIndicator","ProgressCircleProvider","ProgressCircleSVG","ProgressCircleTrack","ProgressCircleValue","Provider","Root","SVG","Track","Value","createProgressCircleScope"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, definition)=>{
6
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ get: definition[key]
9
+ });
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.r = (exports1)=>{
17
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
18
+ value: 'Module'
19
+ });
20
+ Object.defineProperty(exports1, '__esModule', {
21
+ value: true
22
+ });
23
+ };
24
+ })();
25
+ var __webpack_exports__ = {};
26
+ __webpack_require__.r(__webpack_exports__);
27
+ __webpack_require__.d(__webpack_exports__, {
28
+ createProgressCircleScope: ()=>createProgressCircleScope,
29
+ ProgressCircleValue: ()=>ProgressCircleValue,
30
+ ProgressCircle: ()=>ProgressCircle,
31
+ Indicator: ()=>ProgressCircleIndicator,
32
+ ProgressCircleIndicator: ()=>ProgressCircleIndicator,
33
+ ProgressCircleProvider: ()=>ProgressCircleProvider,
34
+ Provider: ()=>ProgressCircleProvider,
35
+ ProgressCircleSVG: ()=>ProgressCircleSVG,
36
+ Root: ()=>ProgressCircle,
37
+ ProgressCircleTrack: ()=>ProgressCircleTrack,
38
+ SVG: ()=>ProgressCircleSVG,
39
+ Value: ()=>ProgressCircleValue,
40
+ Track: ()=>ProgressCircleTrack
41
+ });
42
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
43
+ const react_context_namespaceObject = require("@radix-ui/react-context");
44
+ const external_react_namespaceObject = require("react");
45
+ const PROGRESS_CIRCLE_PROVIDER_NAME = 'ProgressCircleProvider';
46
+ const [createProgressCircleContext, createProgressCircleScope] = (0, react_context_namespaceObject.createContextScope)(PROGRESS_CIRCLE_PROVIDER_NAME);
47
+ const [ProgressCircleContextProvider, useProgressCircleContext] = createProgressCircleContext(PROGRESS_CIRCLE_PROVIDER_NAME);
48
+ function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max = 100, min = 0, size = 48, startAngle = -90, strokeWidth = 4, thresholds, value }) {
49
+ const uniqueId = (0, external_react_namespaceObject.useId)();
50
+ const id = propertyId ?? uniqueId;
51
+ const validSize = Math.max(0, size);
52
+ const validStrokeWidth = Math.max(0, strokeWidth);
53
+ const validStartAngle = startAngle % 360;
54
+ let validMin = min;
55
+ let validMax = max;
56
+ if (validMin > validMax) [validMin, validMax] = [
57
+ validMax,
58
+ validMin
59
+ ];
60
+ const isIndeterminate = null == value;
61
+ const clampedValue = isIndeterminate ? void 0 : clamp(validMin, validMax, value);
62
+ const range = validMax - validMin;
63
+ const percentage = void 0 !== clampedValue && range > 0 ? (clampedValue - validMin) / range * 100 : 0;
64
+ const valueText = void 0 !== clampedValue && formatValue ? formatValue(clampedValue) : `${Math.round(percentage).toString()}%`;
65
+ const sortedThresholds = (0, external_react_namespaceObject.useMemo)(()=>thresholds && thresholds.length > 0 ? [
66
+ ...thresholds
67
+ ].toSorted((a, b)=>a.value - b.value) : [], [
68
+ thresholds
69
+ ]);
70
+ const threshold = (0, external_react_namespaceObject.useMemo)(()=>{
71
+ if (void 0 === clampedValue) return;
72
+ for (const sortedThreshold of sortedThresholds)if (clampedValue <= sortedThreshold.value) return sortedThreshold;
73
+ return sortedThresholds.at(-1);
74
+ }, [
75
+ sortedThresholds,
76
+ clampedValue
77
+ ]);
78
+ const center = validSize / 2;
79
+ const radius = Math.max(0, center - validStrokeWidth / 2);
80
+ const circumference = 2 * Math.PI * radius;
81
+ const strokeDashoffset = circumference - percentage / 100 * circumference;
82
+ const rotationTransform = `rotate(${validStartAngle.toString()}, 0, 0)`;
83
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ProgressCircleContextProvider, {
84
+ center: center,
85
+ circumference: circumference,
86
+ clampedValue: clampedValue,
87
+ id: id,
88
+ max: validMax,
89
+ min: validMin,
90
+ radius: radius,
91
+ rotationTransform: rotationTransform,
92
+ scope: __scopeProgressCircle,
93
+ size: validSize,
94
+ strokeDashoffset: strokeDashoffset,
95
+ strokeWidth: validStrokeWidth,
96
+ threshold: threshold,
97
+ value: value ?? 0,
98
+ valueText: valueText,
99
+ children: children
100
+ });
101
+ }
102
+ function ProgressCircle({ __scopeProgressCircle, ...props }) {
103
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
104
+ ...props
105
+ });
106
+ }
107
+ const PROGRESS_CIRCLE_SVG_NAME = 'ProgressCircleSVG';
108
+ function ProgressCircleSVG({ __scopeProgressCircle, ...props }) {
109
+ const { clampedValue, id, max, min, size, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_SVG_NAME, __scopeProgressCircle);
110
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("svg", {
111
+ "aria-label": "Progress",
112
+ "aria-valuemax": max,
113
+ "aria-valuemin": min,
114
+ "aria-valuenow": clampedValue,
115
+ "aria-valuetext": void 0 === clampedValue ? void 0 : valueText,
116
+ height: size,
117
+ id: id,
118
+ role: "progressbar",
119
+ viewBox: `0 0 ${size.toString()} ${size.toString()}`,
120
+ width: size,
121
+ ...props
122
+ });
123
+ }
124
+ const PROGRESS_CIRCLE_TRACK_NAME = 'ProgressCircleTrack';
125
+ function ProgressCircleTrack({ __scopeProgressCircle, ...props }) {
126
+ const { center, radius, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_TRACK_NAME, __scopeProgressCircle);
127
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("circle", {
128
+ cx: center,
129
+ cy: center,
130
+ fill: "transparent",
131
+ r: radius,
132
+ stroke: threshold?.background ?? 'currentColor',
133
+ strokeWidth: strokeWidth,
134
+ ...props
135
+ });
136
+ }
137
+ const PROGRESS_CIRCLE_INDICATOR_NAME = 'ProgressCircleIndicator';
138
+ function ProgressCircleIndicator({ __scopeProgressCircle, ...props }) {
139
+ const { center, circumference, radius, rotationTransform, strokeDashoffset, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_INDICATOR_NAME, __scopeProgressCircle);
140
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("circle", {
141
+ cx: center,
142
+ cy: center,
143
+ fill: "transparent",
144
+ r: radius,
145
+ stroke: threshold?.color ?? 'currentColor',
146
+ strokeDasharray: circumference,
147
+ strokeDashoffset: strokeDashoffset,
148
+ strokeLinecap: "round",
149
+ strokeWidth: strokeWidth,
150
+ transform: rotationTransform,
151
+ ...props
152
+ });
153
+ }
154
+ const PROGRESS_CIRCLE_VALUE_NAME = 'ProgressCircleValue';
155
+ function ProgressCircleValue({ __scopeProgressCircle, children, ...props }) {
156
+ const { clampedValue, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_VALUE_NAME, __scopeProgressCircle);
157
+ if ('function' == typeof children) return children({
158
+ value: clampedValue,
159
+ valueText
160
+ });
161
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
162
+ ...props,
163
+ children: children ?? valueText
164
+ });
165
+ }
166
+ function clamp(min, max, value) {
167
+ return Math.min(max, Math.max(min, value));
168
+ }
169
+ exports.Indicator = __webpack_exports__.Indicator;
170
+ exports.ProgressCircle = __webpack_exports__.ProgressCircle;
171
+ exports.ProgressCircleIndicator = __webpack_exports__.ProgressCircleIndicator;
172
+ exports.ProgressCircleProvider = __webpack_exports__.ProgressCircleProvider;
173
+ exports.ProgressCircleSVG = __webpack_exports__.ProgressCircleSVG;
174
+ exports.ProgressCircleTrack = __webpack_exports__.ProgressCircleTrack;
175
+ exports.ProgressCircleValue = __webpack_exports__.ProgressCircleValue;
176
+ exports.Provider = __webpack_exports__.Provider;
177
+ exports.Root = __webpack_exports__.Root;
178
+ exports.SVG = __webpack_exports__.SVG;
179
+ exports.Track = __webpack_exports__.Track;
180
+ exports.Value = __webpack_exports__.Value;
181
+ exports.createProgressCircleScope = __webpack_exports__.createProgressCircleScope;
182
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
183
+ "Indicator",
184
+ "ProgressCircle",
185
+ "ProgressCircleIndicator",
186
+ "ProgressCircleProvider",
187
+ "ProgressCircleSVG",
188
+ "ProgressCircleTrack",
189
+ "ProgressCircleValue",
190
+ "Provider",
191
+ "Root",
192
+ "SVG",
193
+ "Track",
194
+ "Value",
195
+ "createProgressCircleScope"
196
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
197
+ Object.defineProperty(exports, '__esModule', {
198
+ value: true
199
+ });
@@ -1,5 +1,5 @@
1
- import type { ComponentProps, ReactNode } from "react";
2
- import type { Scope } from "@radix-ui/react-context";
1
+ import type { Scope } from '@radix-ui/react-context';
2
+ import type { ComponentProps, ReactNode } from 'react';
3
3
  type ScopedProps<P> = P & {
4
4
  __scopeProgressCircle?: Scope;
5
5
  };
@@ -71,35 +71,35 @@ interface ProgressCircleProviderProps {
71
71
  * ```
72
72
  */
73
73
  declare function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max, min, size, startAngle, strokeWidth, thresholds, value, }: ScopedProps<ProgressCircleProviderProps>): ReactNode;
74
- type ProgressCircleProps = ComponentProps<"div">;
74
+ type ProgressCircleProps = ComponentProps<'div'>;
75
75
  /**
76
76
  * Root component for the progress circle
77
77
  *
78
78
  * Serves as a wrapper for other progress circle components.
79
79
  */
80
80
  declare function ProgressCircle({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleProps>): ReactNode;
81
- type ProgressCircleSVGProps = ComponentProps<"svg">;
81
+ type ProgressCircleSVGProps = ComponentProps<'svg'>;
82
82
  /**
83
83
  * SVG container for the progress circle
84
84
  *
85
85
  * Renders the SVG with accessibility attributes and supports indeterminate state.
86
86
  */
87
87
  declare function ProgressCircleSVG({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleSVGProps>): ReactNode;
88
- type ProgressCircleTrackProps = ComponentProps<"circle">;
88
+ type ProgressCircleTrackProps = ComponentProps<'circle'>;
89
89
  /**
90
90
  * Background circle for the progress indicator
91
91
  *
92
92
  * Renders the static track of the progress circle.
93
93
  */
94
94
  declare function ProgressCircleTrack({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleTrackProps>): ReactNode;
95
- type ProgressCircleIndicatorProps = ComponentProps<"circle">;
95
+ type ProgressCircleIndicatorProps = ComponentProps<'circle'>;
96
96
  /**
97
97
  * Foreground circle showing progress
98
98
  *
99
99
  * Renders the dynamic progress indicator with stroke dash properties.
100
100
  */
101
101
  declare function ProgressCircleIndicator({ __scopeProgressCircle, ...props }: ScopedProps<ProgressCircleIndicatorProps>): ReactNode;
102
- interface ProgressCircleValueProps extends Omit<ComponentProps<"div">, "children"> {
102
+ interface ProgressCircleValueProps extends Omit<ComponentProps<'div'>, 'children'> {
103
103
  children?: ((context: {
104
104
  value: number | undefined;
105
105
  valueText: string;
@@ -1,2 +1,129 @@
1
1
  "use client";
2
- import{jsx as r}from"react/jsx-runtime";import{useId as e,useMemo as o}from"react";import{createContextScope as t}from"@radix-ui/react-context";let i="ProgressCircleProvider",[a,s]=t(i),[c,l]=a(i);function n({__scopeProgressCircle:t,children:i,formatValue:a,id:s,max:l=100,min:n=0,size:u=48,startAngle:d=-90,strokeWidth:g=4,thresholds:f,value:v}){let P=e(),h=Math.max(0,u),m=Math.max(0,g),C=n,x=l;C>x&&([C,x]=[x,C]);let k=null==v?void 0:Math.min(x,Math.max(C,v)),p=x-C,S=void 0!==k&&p>0?(k-C)/p*100:0,V=void 0!==k&&a?a(k):`${Math.round(S).toString()}%`,M=o(()=>f&&f.length>0?[...f].toSorted((r,e)=>r.value-e.value):[],[f]),T=o(()=>{if(void 0!==k){for(let r of M)if(k<=r.value)return r;return M.at(-1)}},[M,k]),I=h/2,y=Math.max(0,I-m/2),G=2*Math.PI*y;return r(c,{center:I,circumference:G,clampedValue:k,id:s??P,max:x,min:C,radius:y,rotationTransform:`rotate(${(d%360).toString()}, 0, 0)`,scope:t,size:h,strokeDashoffset:G-S/100*G,strokeWidth:m,threshold:T,value:v??0,valueText:V,children:i})}function u({__scopeProgressCircle:e,...o}){return r("div",{...o})}function d({__scopeProgressCircle:e,...o}){let{clampedValue:t,id:i,max:a,min:s,size:c,valueText:n}=l("ProgressCircleSVG",e);return r("svg",{"aria-label":"Progress","aria-valuemax":a,"aria-valuemin":s,"aria-valuenow":t,"aria-valuetext":void 0===t?void 0:n,height:c,id:i,role:"progressbar",viewBox:`0 0 ${c.toString()} ${c.toString()}`,width:c,...o})}function g({__scopeProgressCircle:e,...o}){let{center:t,radius:i,strokeWidth:a,threshold:s}=l("ProgressCircleTrack",e);return r("circle",{cx:t,cy:t,fill:"transparent",r:i,stroke:s?.background??"currentColor",strokeWidth:a,...o})}function f({__scopeProgressCircle:e,...o}){let{center:t,circumference:i,radius:a,rotationTransform:s,strokeDashoffset:c,strokeWidth:n,threshold:u}=l("ProgressCircleIndicator",e);return r("circle",{cx:t,cy:t,fill:"transparent",r:a,stroke:u?.color??"currentColor",strokeDasharray:i,strokeDashoffset:c,strokeLinecap:"round",strokeWidth:n,transform:s,...o})}function v({__scopeProgressCircle:e,children:o,...t}){let{clampedValue:i,valueText:a}=l("ProgressCircleValue",e);return"function"==typeof o?o({value:i,valueText:a}):r("div",{...t,children:o??a})}export{f as Indicator,u as ProgressCircle,f as ProgressCircleIndicator,n as ProgressCircleProvider,d as ProgressCircleSVG,g as ProgressCircleTrack,v as ProgressCircleValue,n as Provider,u as Root,d as SVG,g as Track,v as Value,s as createProgressCircleScope};
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { createContextScope } from "@radix-ui/react-context";
4
+ import { useId, useMemo } from "react";
5
+ const PROGRESS_CIRCLE_PROVIDER_NAME = 'ProgressCircleProvider';
6
+ const [createProgressCircleContext, createProgressCircleScope] = createContextScope(PROGRESS_CIRCLE_PROVIDER_NAME);
7
+ const [ProgressCircleContextProvider, useProgressCircleContext] = createProgressCircleContext(PROGRESS_CIRCLE_PROVIDER_NAME);
8
+ function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max = 100, min = 0, size = 48, startAngle = -90, strokeWidth = 4, thresholds, value }) {
9
+ const uniqueId = useId();
10
+ const id = propertyId ?? uniqueId;
11
+ const validSize = Math.max(0, size);
12
+ const validStrokeWidth = Math.max(0, strokeWidth);
13
+ const validStartAngle = startAngle % 360;
14
+ let validMin = min;
15
+ let validMax = max;
16
+ if (validMin > validMax) [validMin, validMax] = [
17
+ validMax,
18
+ validMin
19
+ ];
20
+ const isIndeterminate = null == value;
21
+ const clampedValue = isIndeterminate ? void 0 : clamp(validMin, validMax, value);
22
+ const range = validMax - validMin;
23
+ const percentage = void 0 !== clampedValue && range > 0 ? (clampedValue - validMin) / range * 100 : 0;
24
+ const valueText = void 0 !== clampedValue && formatValue ? formatValue(clampedValue) : `${Math.round(percentage).toString()}%`;
25
+ const sortedThresholds = useMemo(()=>thresholds && thresholds.length > 0 ? [
26
+ ...thresholds
27
+ ].toSorted((a, b)=>a.value - b.value) : [], [
28
+ thresholds
29
+ ]);
30
+ const threshold = useMemo(()=>{
31
+ if (void 0 === clampedValue) return;
32
+ for (const sortedThreshold of sortedThresholds)if (clampedValue <= sortedThreshold.value) return sortedThreshold;
33
+ return sortedThresholds.at(-1);
34
+ }, [
35
+ sortedThresholds,
36
+ clampedValue
37
+ ]);
38
+ const center = validSize / 2;
39
+ const radius = Math.max(0, center - validStrokeWidth / 2);
40
+ const circumference = 2 * Math.PI * radius;
41
+ const strokeDashoffset = circumference - percentage / 100 * circumference;
42
+ const rotationTransform = `rotate(${validStartAngle.toString()}, 0, 0)`;
43
+ return /*#__PURE__*/ jsx(ProgressCircleContextProvider, {
44
+ center: center,
45
+ circumference: circumference,
46
+ clampedValue: clampedValue,
47
+ id: id,
48
+ max: validMax,
49
+ min: validMin,
50
+ radius: radius,
51
+ rotationTransform: rotationTransform,
52
+ scope: __scopeProgressCircle,
53
+ size: validSize,
54
+ strokeDashoffset: strokeDashoffset,
55
+ strokeWidth: validStrokeWidth,
56
+ threshold: threshold,
57
+ value: value ?? 0,
58
+ valueText: valueText,
59
+ children: children
60
+ });
61
+ }
62
+ function ProgressCircle({ __scopeProgressCircle, ...props }) {
63
+ return /*#__PURE__*/ jsx("div", {
64
+ ...props
65
+ });
66
+ }
67
+ const PROGRESS_CIRCLE_SVG_NAME = 'ProgressCircleSVG';
68
+ function ProgressCircleSVG({ __scopeProgressCircle, ...props }) {
69
+ const { clampedValue, id, max, min, size, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_SVG_NAME, __scopeProgressCircle);
70
+ return /*#__PURE__*/ jsx("svg", {
71
+ "aria-label": "Progress",
72
+ "aria-valuemax": max,
73
+ "aria-valuemin": min,
74
+ "aria-valuenow": clampedValue,
75
+ "aria-valuetext": void 0 === clampedValue ? void 0 : valueText,
76
+ height: size,
77
+ id: id,
78
+ role: "progressbar",
79
+ viewBox: `0 0 ${size.toString()} ${size.toString()}`,
80
+ width: size,
81
+ ...props
82
+ });
83
+ }
84
+ const PROGRESS_CIRCLE_TRACK_NAME = 'ProgressCircleTrack';
85
+ function ProgressCircleTrack({ __scopeProgressCircle, ...props }) {
86
+ const { center, radius, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_TRACK_NAME, __scopeProgressCircle);
87
+ return /*#__PURE__*/ jsx("circle", {
88
+ cx: center,
89
+ cy: center,
90
+ fill: "transparent",
91
+ r: radius,
92
+ stroke: threshold?.background ?? 'currentColor',
93
+ strokeWidth: strokeWidth,
94
+ ...props
95
+ });
96
+ }
97
+ const PROGRESS_CIRCLE_INDICATOR_NAME = 'ProgressCircleIndicator';
98
+ function ProgressCircleIndicator({ __scopeProgressCircle, ...props }) {
99
+ const { center, circumference, radius, rotationTransform, strokeDashoffset, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_INDICATOR_NAME, __scopeProgressCircle);
100
+ return /*#__PURE__*/ jsx("circle", {
101
+ cx: center,
102
+ cy: center,
103
+ fill: "transparent",
104
+ r: radius,
105
+ stroke: threshold?.color ?? 'currentColor',
106
+ strokeDasharray: circumference,
107
+ strokeDashoffset: strokeDashoffset,
108
+ strokeLinecap: "round",
109
+ strokeWidth: strokeWidth,
110
+ transform: rotationTransform,
111
+ ...props
112
+ });
113
+ }
114
+ const PROGRESS_CIRCLE_VALUE_NAME = 'ProgressCircleValue';
115
+ function ProgressCircleValue({ __scopeProgressCircle, children, ...props }) {
116
+ const { clampedValue, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_VALUE_NAME, __scopeProgressCircle);
117
+ if ('function' == typeof children) return children({
118
+ value: clampedValue,
119
+ valueText
120
+ });
121
+ return /*#__PURE__*/ jsx("div", {
122
+ ...props,
123
+ children: children ?? valueText
124
+ });
125
+ }
126
+ function clamp(min, max, value) {
127
+ return Math.min(max, Math.max(min, value));
128
+ }
129
+ export { ProgressCircleIndicator as Indicator, ProgressCircle, ProgressCircleIndicator, ProgressCircleProvider, ProgressCircleSVG, ProgressCircleTrack, ProgressCircleValue, ProgressCircleProvider as Provider, ProgressCircle as Root, ProgressCircleSVG as SVG, ProgressCircleTrack as Track, ProgressCircleValue as Value, createProgressCircleScope };