@forgedevstack/bear 1.1.4 → 1.1.9

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 (179) hide show
  1. package/README.md +21 -2
  2. package/dist/components/Anchor/Anchor.cjs +1 -1
  3. package/dist/components/Anchor/Anchor.js +37 -45
  4. package/dist/components/Anchor/Anchor.utils.cjs +1 -0
  5. package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
  6. package/dist/components/Anchor/Anchor.utils.js +12 -0
  7. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.js +60 -67
  9. package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
  10. package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
  11. package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
  12. package/dist/components/BackTop/BackTop.cjs +1 -1
  13. package/dist/components/BackTop/BackTop.js +10 -11
  14. package/dist/components/BearLogo/BearLogo.d.ts +2 -7
  15. package/dist/components/BearLogo/BearLogo.types.d.ts +15 -0
  16. package/dist/components/BearLogo/EmberLogo.d.ts +1 -8
  17. package/dist/components/BearLogo/index.d.ts +1 -2
  18. package/dist/components/Biometric/Biometric.cjs +1 -0
  19. package/dist/components/Biometric/Biometric.d.ts +3 -0
  20. package/dist/components/Biometric/Biometric.js +123 -0
  21. package/dist/components/Biometric/Biometric.types.d.ts +35 -0
  22. package/dist/components/Biometric/BiometricIcon.cjs +1 -0
  23. package/dist/components/Biometric/BiometricIcon.d.ts +3 -0
  24. package/dist/components/Biometric/BiometricIcon.js +45 -0
  25. package/dist/components/Biometric/index.d.ts +3 -0
  26. package/dist/components/Biometric/useBiometric.cjs +1 -0
  27. package/dist/components/Biometric/useBiometric.d.ts +2 -0
  28. package/dist/components/Biometric/useBiometric.js +21 -0
  29. package/dist/components/Button/Button.cjs +1 -1
  30. package/dist/components/Button/Button.constants.cjs +2 -2
  31. package/dist/components/Button/Button.constants.d.ts +1 -0
  32. package/dist/components/Button/Button.constants.js +12 -5
  33. package/dist/components/Button/Button.d.ts +0 -27
  34. package/dist/components/Button/Button.js +93 -105
  35. package/dist/components/Button/Button.types.d.ts +1 -0
  36. package/dist/components/Button/Button.utils.cjs +1 -0
  37. package/dist/components/Button/Button.utils.d.ts +2 -0
  38. package/dist/components/Button/Button.utils.js +5 -0
  39. package/dist/components/Button/useSpotlight.cjs +1 -0
  40. package/dist/components/Button/useSpotlight.d.ts +21 -0
  41. package/dist/components/Button/useSpotlight.js +28 -0
  42. package/dist/components/Chart/Chart.cjs +1 -1
  43. package/dist/components/Chart/Chart.const.cjs +1 -0
  44. package/dist/components/Chart/Chart.const.js +21 -0
  45. package/dist/components/Chart/Chart.js +55 -71
  46. package/dist/components/Chart/Chart.utils.cjs +1 -0
  47. package/dist/components/Chart/Chart.utils.js +5 -0
  48. package/dist/components/Confetti/Confetti.cjs +1 -1
  49. package/dist/components/Confetti/Confetti.js +37 -34
  50. package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
  51. package/dist/components/ContextMenu/ContextMenu.js +31 -30
  52. package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
  53. package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
  54. package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
  55. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  56. package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
  57. package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
  58. package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
  59. package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
  60. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  61. package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -1
  62. package/dist/components/DateRangePicker/DateRangePicker.const.js +12 -13
  63. package/dist/components/DateRangePicker/DateRangePicker.js +107 -81
  64. package/dist/components/Dock/Dock.cjs +1 -1
  65. package/dist/components/Dock/Dock.js +38 -43
  66. package/dist/components/Dock/Dock.utils.cjs +1 -0
  67. package/dist/components/Dock/Dock.utils.d.ts +1 -0
  68. package/dist/components/Dock/Dock.utils.js +10 -0
  69. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  70. package/dist/components/Dropdown/Dropdown.js +77 -74
  71. package/dist/components/FileTree/FileTree.cjs +1 -1
  72. package/dist/components/FileTree/FileTree.js +20 -32
  73. package/dist/components/FileTree/FileTree.utils.cjs +1 -0
  74. package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
  75. package/dist/components/FileTree/FileTree.utils.js +15 -0
  76. package/dist/components/GradientText/GradientText.cjs +1 -1
  77. package/dist/components/GradientText/GradientText.js +27 -29
  78. package/dist/components/Icon/icons/bear.cjs +1 -0
  79. package/dist/components/Icon/icons/bear.d.ts +12 -0
  80. package/dist/components/Icon/icons/bear.js +47 -0
  81. package/dist/components/Icon/index.cjs +1 -1
  82. package/dist/components/Icon/index.d.ts +18 -0
  83. package/dist/components/Icon/index.js +17 -15
  84. package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
  85. package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
  86. package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
  87. package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
  88. package/dist/components/Input/Input.cjs +1 -1
  89. package/dist/components/Input/Input.js +153 -101
  90. package/dist/components/Input/Input.types.d.ts +8 -2
  91. package/dist/components/Input/index.d.ts +1 -1
  92. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  93. package/dist/components/MentionsInput/MentionsInput.js +64 -68
  94. package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
  95. package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
  96. package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
  97. package/dist/components/PageNav/PageNav.cjs +1 -0
  98. package/dist/components/PageNav/PageNav.const.cjs +1 -0
  99. package/dist/components/PageNav/PageNav.const.d.ts +22 -0
  100. package/dist/components/PageNav/PageNav.const.js +42 -0
  101. package/dist/components/PageNav/PageNav.d.ts +3 -0
  102. package/dist/components/PageNav/PageNav.js +81 -0
  103. package/dist/components/PageNav/PageNav.types.d.ts +17 -0
  104. package/dist/components/PageNav/index.d.ts +2 -0
  105. package/dist/components/Popover/Popover.cjs +1 -1
  106. package/dist/components/Popover/Popover.js +76 -76
  107. package/dist/components/Progress/Progress.cjs +1 -1
  108. package/dist/components/Progress/Progress.js +6 -6
  109. package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
  110. package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
  111. package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
  112. package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
  113. package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
  114. package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
  115. package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
  116. package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
  117. package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
  118. package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
  119. package/dist/components/PropsPlayground/index.d.ts +2 -0
  120. package/dist/components/Select/Select.cjs +1 -1
  121. package/dist/components/Select/Select.js +54 -53
  122. package/dist/components/SignPad/SignPad.cjs +1 -1
  123. package/dist/components/SignPad/SignPad.js +24 -24
  124. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  125. package/dist/components/Skeleton/Skeleton.js +89 -94
  126. package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
  127. package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
  128. package/dist/components/Skeleton/Skeleton.utils.js +10 -0
  129. package/dist/components/SliderRange/SliderRange.cjs +1 -1
  130. package/dist/components/SliderRange/SliderRange.js +61 -63
  131. package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
  132. package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
  133. package/dist/components/SliderRange/SliderRange.utils.js +7 -0
  134. package/dist/components/Spotlight/Spotlight.cjs +1 -1
  135. package/dist/components/Spotlight/Spotlight.js +62 -73
  136. package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
  137. package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
  138. package/dist/components/Spotlight/Spotlight.utils.js +18 -0
  139. package/dist/components/Tabs/TabList.cjs +1 -0
  140. package/dist/components/Tabs/TabList.d.ts +3 -0
  141. package/dist/components/Tabs/TabList.js +69 -0
  142. package/dist/components/Tabs/TabPanel.cjs +1 -0
  143. package/dist/components/Tabs/TabPanel.d.ts +3 -0
  144. package/dist/components/Tabs/TabPanel.js +13 -0
  145. package/dist/components/Tabs/Tabs.cjs +1 -1
  146. package/dist/components/Tabs/Tabs.d.ts +2 -27
  147. package/dist/components/Tabs/Tabs.js +43 -61
  148. package/dist/components/Tabs/Tabs.types.d.ts +7 -1
  149. package/dist/components/Tabs/index.d.ts +3 -1
  150. package/dist/components/Toast/Toast.cjs +1 -1
  151. package/dist/components/Toast/Toast.js +18 -17
  152. package/dist/components/Toast/Toast.utils.cjs +1 -0
  153. package/dist/components/Toast/Toast.utils.d.ts +1 -0
  154. package/dist/components/Toast/Toast.utils.js +4 -0
  155. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  156. package/dist/components/Tooltip/Tooltip.js +10 -11
  157. package/dist/components/Tour/Tour.cjs +1 -1
  158. package/dist/components/Tour/Tour.js +1 -2
  159. package/dist/components/VirtualList/VirtualList.cjs +1 -1
  160. package/dist/components/VirtualList/VirtualList.js +38 -43
  161. package/dist/components/index.cjs +1 -1
  162. package/dist/components/index.d.ts +9 -2
  163. package/dist/components/index.js +311 -300
  164. package/dist/hooks/index.cjs +1 -1
  165. package/dist/hooks/index.d.ts +2 -0
  166. package/dist/hooks/index.js +60 -58
  167. package/dist/hooks/useResizeObserver/index.d.ts +2 -0
  168. package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
  169. package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
  170. package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
  171. package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
  172. package/dist/icons.cjs +1 -0
  173. package/dist/icons.d.ts +2 -0
  174. package/dist/icons.js +6 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.js +397 -384
  177. package/dist/styles/_base.css +7 -3
  178. package/dist/styles.css +1 -1
  179. package/package.json +6 -1
@@ -1,4 +1,4 @@
1
- import { jsxs as b, jsx as d } from "react/jsx-runtime";
1
+ import { jsxs as T, jsx as d } from "react/jsx-runtime";
2
2
  import { useRef as p, useState as B, useEffect as D, useCallback as l } from "react";
3
3
  import { cn as _ } from "../../utils/cn.js";
4
4
  import { Button as M } from "../Button/Button.js";
@@ -19,12 +19,12 @@ const ge = (U) => {
19
19
  clearText: W = "Clear",
20
20
  saveText: z = "Save",
21
21
  outputFormat: f = te,
22
- outputQuality: A = re,
22
+ outputQuality: v = re,
23
23
  className: X,
24
24
  testId: Y,
25
25
  id: V,
26
26
  ...j
27
- } = U, a = p(null), I = p(null), v = p(null), P = p(!1), [h, G] = B(!1), [E, Q] = B(!1);
27
+ } = U, a = p(null), I = p(null), A = p(null), P = p(!1), [h, G] = B(!1), [E, Q] = B(!1);
28
28
  D(() => {
29
29
  const e = () => {
30
30
  Q(document.documentElement.classList.contains("dark"));
@@ -33,10 +33,10 @@ const ge = (U) => {
33
33
  const t = new MutationObserver(e);
34
34
  return t.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => t.disconnect();
35
35
  }, []);
36
- const k = F || (E ? se : ae), N = H || (E ? ne : oe), u = l(() => {
36
+ const k = F || (E ? se : ae), b = H || (E ? ne : oe), u = l(() => {
37
37
  const e = a.current, t = e == null ? void 0 : e.getContext("2d");
38
- !e || !t || (t.fillStyle = N === "transparent" ? "rgba(0,0,0,0)" : N, t.fillRect(0, 0, e.width, e.height));
39
- }, [N]);
38
+ !e || !t || (t.fillStyle = b === "transparent" ? "rgba(0,0,0,0)" : b, t.fillRect(0, 0, e.width, e.height));
39
+ }, [b]);
40
40
  D(() => {
41
41
  const e = a.current, t = I.current;
42
42
  if (!e || !t) return;
@@ -75,32 +75,32 @@ const ge = (U) => {
75
75
  }, []), x = l((e) => {
76
76
  if (n || s) return;
77
77
  const t = g(e);
78
- P.current = !0, v.current = t;
78
+ P.current = !0, A.current = t;
79
79
  }, [n, s, g]), O = l((e) => {
80
80
  if (!P.current || n || s) return;
81
- const t = a.current, r = t == null ? void 0 : t.getContext("2d"), c = v.current;
81
+ const t = a.current, r = t == null ? void 0 : t.getContext("2d"), c = A.current;
82
82
  if (!t || !r || !c) return;
83
83
  const i = g(e);
84
- r.beginPath(), r.moveTo(c.x, c.y), r.lineTo(i.x, i.y), r.strokeStyle = k, r.lineWidth = C, r.lineCap = "round", r.lineJoin = "round", r.stroke(), v.current = i, G(!0);
85
- }, [n, s, k, C, g]), T = l(() => {
84
+ r.beginPath(), r.moveTo(c.x, c.y), r.lineTo(i.x, i.y), r.strokeStyle = k, r.lineWidth = C, r.lineCap = "round", r.lineJoin = "round", r.stroke(), A.current = i, G(!0);
85
+ }, [n, s, k, C, g]), N = l(() => {
86
86
  if (P.current) {
87
87
  const e = a.current;
88
88
  if (e && o) {
89
- const t = e.toDataURL(f, A);
89
+ const t = e.toDataURL(f, v);
90
90
  o(t);
91
91
  }
92
92
  }
93
- P.current = !1, v.current = null;
94
- }, [o, f, A]), J = l(() => {
93
+ P.current = !1, A.current = null;
94
+ }, [o, f, v]), J = l(() => {
95
95
  const e = a.current, t = e == null ? void 0 : e.getContext("2d");
96
96
  !e || !t || (t.clearRect(0, 0, e.width, e.height), u(), G(!1), o == null || o(null));
97
97
  }, [u, o]), q = l(() => {
98
98
  const e = a.current;
99
99
  if (!e || !h) return;
100
- const t = e.toDataURL(f, A);
100
+ const t = e.toDataURL(f, v);
101
101
  o == null || o(t);
102
- }, [h, o, f, A]);
103
- return /* @__PURE__ */ b(
102
+ }, [h, o, f, v]);
103
+ return /* @__PURE__ */ T(
104
104
  "div",
105
105
  {
106
106
  id: V,
@@ -114,13 +114,13 @@ const ge = (U) => {
114
114
  ),
115
115
  ...j,
116
116
  children: [
117
- /* @__PURE__ */ b(
117
+ /* @__PURE__ */ T(
118
118
  "div",
119
119
  {
120
120
  ref: I,
121
121
  className: _(
122
122
  "Bear-SignPad__canvas-wrapper bear-w-full bear-overflow-hidden",
123
- "touch-none",
123
+ "bear-touch-none",
124
124
  de,
125
125
  !n && !s && ue,
126
126
  n && "bear-cursor-not-allowed",
@@ -131,15 +131,15 @@ const ge = (U) => {
131
131
  "canvas",
132
132
  {
133
133
  ref: a,
134
- className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full touch-none",
135
- style: { height: m, touchAction: "none" },
134
+ className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full bear-touch-none",
135
+ style: { height: m },
136
136
  onMouseDown: x,
137
137
  onMouseMove: O,
138
- onMouseUp: T,
139
- onMouseLeave: T,
138
+ onMouseUp: N,
139
+ onMouseLeave: N,
140
140
  onTouchStart: x,
141
141
  onTouchMove: O,
142
- onTouchEnd: T
142
+ onTouchEnd: N
143
143
  }
144
144
  ),
145
145
  !h && /* @__PURE__ */ d("div", { className: _("Bear-SignPad__placeholder", ce), children: K }),
@@ -148,7 +148,7 @@ const ge = (U) => {
148
148
  ]
149
149
  }
150
150
  ),
151
- (L || R) && /* @__PURE__ */ b("div", { className: _("Bear-SignPad__actions", _e), children: [
151
+ (L || R) && /* @__PURE__ */ T("div", { className: _("Bear-SignPad__actions", _e), children: [
152
152
  L && /* @__PURE__ */ d(M, { size: "sm", variant: "ghost", onClick: J, disabled: n || !h, children: W }),
153
153
  R && /* @__PURE__ */ d(M, { size: "sm", variant: "primary", onClick: q, disabled: n || !h, children: z })
154
154
  ] })
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react"),T=require("../../utils/cn.cjs"),d=require("./Skeleton.const.cjs"),_=()=>{const e="bear-skeleton-styles";if(typeof document<"u"&&!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=d.SKELETON_WAVE_STYLES,document.head.appendChild(t)}},a=c.forwardRef(({variant:e="text",animation:t="pulse",width:l,height:s,borderRadius:n,count:i=1,gap:E=8,className:o,style:f,testId:y,...h},p)=>{c.useEffect(()=>{t==="wave"&&_()},[t]);const x=S=>{if(S!==void 0)return typeof S=="number"?`${S}px`:S},N={width:x(l),height:x(s)||(e==="text"?d.SKELETON_TEXT_HEIGHT:void 0),borderRadius:n?x(n):void 0,...f},k=T.cn(d.SKELETON_BASE_CLASSES,d.SKELETON_VARIANT_CLASSES[e],d.SKELETON_ANIMATION_CLASSES[t],d.SKELETON_BG_CLASSES,o);return i>1?r.jsx("div",{className:"Bear-Skeleton__group flex flex-col",style:{gap:x(E)},"data-testid":y,children:Array.from({length:i}).map((S,g)=>r.jsx("div",{ref:g===0?p:void 0,className:k,style:N,...h},g))}):r.jsx("div",{ref:p,className:k,style:N,"data-testid":y,...h})});a.displayName="Skeleton";const u=c.forwardRef(({lines:e=3,lastLineWidth:t="80%",gap:l=8,animation:s="pulse",...n},i)=>{c.useEffect(()=>{s==="wave"&&_()},[s]);const E=o=>{if(o!==void 0)return typeof o=="number"?`${o}px`:o};return r.jsx("div",{ref:i,className:"Bear-SkeletonText flex flex-col",style:{gap:E(l)},children:Array.from({length:e}).map((o,f)=>r.jsx(a,{variant:"text",animation:s,width:f===e-1?t:"100%",...n},f))})});u.displayName="SkeletonText";const m=c.forwardRef(({size:e="md",animation:t="pulse",...l},s)=>{const n=typeof e=="number"?e:d.SKELETON_AVATAR_SIZES[e];return r.jsx(a,{ref:s,variant:"circular",animation:t,width:n,height:n,...l})});m.displayName="SkeletonAvatar";const A=c.forwardRef(({animation:e="pulse",className:t,...l},s)=>r.jsxs("div",{ref:s,className:T.cn("Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",t),...l,children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx(m,{animation:e}),r.jsxs("div",{className:"flex-1",children:[r.jsx(a,{animation:e,width:"60%",height:16,className:"mb-2"}),r.jsx(a,{animation:e,width:"40%",height:12})]})]}),r.jsx(u,{animation:e,lines:3})]}));A.displayName="SkeletonCard";exports.Skeleton=a;exports.SkeletonAvatar=m;exports.SkeletonCard=A;exports.SkeletonText=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),S=require("react"),_=require("../../utils/cn.cjs"),d=require("./Skeleton.const.cjs"),j=require("./Skeleton.utils.cjs"),a=S.forwardRef(({variant:e="text",animation:r="pulse",width:l,height:s,borderRadius:o,count:i=1,gap:u=8,className:n,style:f,testId:k,...N},m)=>{S.useEffect(()=>{r==="wave"&&j.injectStyles()},[r]);const x=c=>{if(c!==void 0)return typeof c=="number"?`${c}px`:c},p={width:x(l),height:x(s)||(e==="text"?d.SKELETON_TEXT_HEIGHT:void 0),borderRadius:o?x(o):void 0,...f},y=_.cn(d.SKELETON_BASE_CLASSES,d.SKELETON_VARIANT_CLASSES[e],d.SKELETON_ANIMATION_CLASSES[r],d.SKELETON_BG_CLASSES,n);return i>1?t.jsx("div",{className:"Bear-Skeleton__group flex flex-col",style:{gap:x(u)},"data-testid":k,children:Array.from({length:i}).map((c,g)=>t.jsx("div",{ref:g===0?m:void 0,className:y,style:p,...N},g))}):t.jsx("div",{ref:m,className:y,style:p,"data-testid":k,...N})});a.displayName="Skeleton";const E=S.forwardRef(({lines:e=3,lastLineWidth:r="80%",gap:l=8,animation:s="pulse",...o},i)=>{S.useEffect(()=>{s==="wave"&&j.injectStyles()},[s]);const u=n=>{if(n!==void 0)return typeof n=="number"?`${n}px`:n};return t.jsx("div",{ref:i,className:"Bear-SkeletonText flex flex-col",style:{gap:u(l)},children:Array.from({length:e}).map((n,f)=>t.jsx(a,{variant:"text",animation:s,width:f===e-1?r:"100%",...o},f))})});E.displayName="SkeletonText";const h=S.forwardRef(({size:e="md",animation:r="pulse",...l},s)=>{const o=typeof e=="number"?e:d.SKELETON_AVATAR_SIZES[e];return t.jsx(a,{ref:s,variant:"circular",animation:r,width:o,height:o,...l})});h.displayName="SkeletonAvatar";const A=S.forwardRef(({animation:e="pulse",className:r,...l},s)=>t.jsxs("div",{ref:s,className:_.cn("Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",r),...l,children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsx(h,{animation:e}),t.jsxs("div",{className:"flex-1",children:[t.jsx(a,{animation:e,width:"60%",height:16,className:"mb-2"}),t.jsx(a,{animation:e,width:"40%",height:12})]})]}),t.jsx(E,{animation:e,lines:3})]}));A.displayName="SkeletonCard";exports.Skeleton=a;exports.SkeletonAvatar=h;exports.SkeletonCard=A;exports.SkeletonText=E;
@@ -1,145 +1,140 @@
1
- import { jsx as r, jsxs as f } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
2
  import { forwardRef as m, useEffect as _ } from "react";
3
- import { cn as A } from "../../utils/cn.js";
4
- import { SKELETON_BG_CLASSES as v, SKELETON_ANIMATION_CLASSES as L, SKELETON_VARIANT_CLASSES as b, SKELETON_BASE_CLASSES as C, SKELETON_TEXT_HEIGHT as w, SKELETON_AVATAR_SIZES as O, SKELETON_WAVE_STYLES as K } from "./Skeleton.const.js";
5
- const T = () => {
6
- const e = "bear-skeleton-styles";
7
- if (typeof document < "u" && !document.getElementById(e)) {
8
- const t = document.createElement("style");
9
- t.id = e, t.textContent = K, document.head.appendChild(t);
10
- }
11
- }, i = m(
3
+ import { cn as k } from "../../utils/cn.js";
4
+ import { SKELETON_BG_CLASSES as v, SKELETON_ANIMATION_CLASSES as b, SKELETON_VARIANT_CLASSES as L, SKELETON_BASE_CLASSES as w, SKELETON_TEXT_HEIGHT as C, SKELETON_AVATAR_SIZES as O } from "./Skeleton.const.js";
5
+ import { injectStyles as x } from "./Skeleton.utils.js";
6
+ const S = m(
12
7
  ({
13
8
  variant: e = "text",
14
- animation: t = "pulse",
15
- width: l,
16
- height: s,
17
- borderRadius: d,
18
- count: S = 1,
19
- gap: E = 8,
20
- className: o,
21
- style: a,
22
- testId: p,
23
- ...h
24
- }, y) => {
9
+ animation: r = "pulse",
10
+ width: s,
11
+ height: l,
12
+ borderRadius: o,
13
+ count: a = 1,
14
+ gap: p = 8,
15
+ className: d,
16
+ style: n,
17
+ testId: h,
18
+ ...E
19
+ }, N) => {
25
20
  _(() => {
26
- t === "wave" && T();
27
- }, [t]);
28
- const c = (n) => {
29
- if (n !== void 0)
30
- return typeof n == "number" ? `${n}px` : n;
31
- }, N = {
32
- width: c(l),
33
- height: c(s) || (e === "text" ? w : void 0),
34
- borderRadius: d ? c(d) : void 0,
35
- ...a
36
- }, g = A(
37
- C,
38
- b[e],
39
- L[t],
21
+ r === "wave" && x();
22
+ }, [r]);
23
+ const c = (i) => {
24
+ if (i !== void 0)
25
+ return typeof i == "number" ? `${i}px` : i;
26
+ }, g = {
27
+ width: c(s),
28
+ height: c(l) || (e === "text" ? C : void 0),
29
+ borderRadius: o ? c(o) : void 0,
30
+ ...n
31
+ }, y = k(
32
+ w,
33
+ L[e],
34
+ b[r],
40
35
  v,
41
- o
36
+ d
42
37
  );
43
- return S > 1 ? /* @__PURE__ */ r(
38
+ return a > 1 ? /* @__PURE__ */ t(
44
39
  "div",
45
40
  {
46
41
  className: "Bear-Skeleton__group flex flex-col",
47
- style: { gap: c(E) },
48
- "data-testid": p,
49
- children: Array.from({ length: S }).map((n, u) => /* @__PURE__ */ r(
42
+ style: { gap: c(p) },
43
+ "data-testid": h,
44
+ children: Array.from({ length: a }).map((i, A) => /* @__PURE__ */ t(
50
45
  "div",
51
46
  {
52
- ref: u === 0 ? y : void 0,
53
- className: g,
54
- style: N,
55
- ...h
47
+ ref: A === 0 ? N : void 0,
48
+ className: y,
49
+ style: g,
50
+ ...E
56
51
  },
57
- u
52
+ A
58
53
  ))
59
54
  }
60
- ) : /* @__PURE__ */ r(
55
+ ) : /* @__PURE__ */ t(
61
56
  "div",
62
57
  {
63
- ref: y,
64
- className: g,
65
- style: N,
66
- "data-testid": p,
67
- ...h
58
+ ref: N,
59
+ className: y,
60
+ style: g,
61
+ "data-testid": h,
62
+ ...E
68
63
  }
69
64
  );
70
65
  }
71
66
  );
72
- i.displayName = "Skeleton";
73
- const k = m(
74
- ({ lines: e = 3, lastLineWidth: t = "80%", gap: l = 8, animation: s = "pulse", ...d }, S) => (_(() => {
75
- s === "wave" && T();
76
- }, [s]), /* @__PURE__ */ r(
67
+ S.displayName = "Skeleton";
68
+ const T = m(
69
+ ({ lines: e = 3, lastLineWidth: r = "80%", gap: s = 8, animation: l = "pulse", ...o }, a) => (_(() => {
70
+ l === "wave" && x();
71
+ }, [l]), /* @__PURE__ */ t(
77
72
  "div",
78
73
  {
79
- ref: S,
74
+ ref: a,
80
75
  className: "Bear-SkeletonText flex flex-col",
81
- style: { gap: ((o) => {
82
- if (o !== void 0)
83
- return typeof o == "number" ? `${o}px` : o;
84
- })(l) },
85
- children: Array.from({ length: e }).map((o, a) => /* @__PURE__ */ r(
86
- i,
76
+ style: { gap: ((d) => {
77
+ if (d !== void 0)
78
+ return typeof d == "number" ? `${d}px` : d;
79
+ })(s) },
80
+ children: Array.from({ length: e }).map((d, n) => /* @__PURE__ */ t(
81
+ S,
87
82
  {
88
83
  variant: "text",
89
- animation: s,
90
- width: a === e - 1 ? t : "100%",
91
- ...d
84
+ animation: l,
85
+ width: n === e - 1 ? r : "100%",
86
+ ...o
92
87
  },
93
- a
88
+ n
94
89
  ))
95
90
  }
96
91
  ))
97
92
  );
98
- k.displayName = "SkeletonText";
99
- const x = m(
100
- ({ size: e = "md", animation: t = "pulse", ...l }, s) => {
101
- const d = typeof e == "number" ? e : O[e];
102
- return /* @__PURE__ */ r(
103
- i,
93
+ T.displayName = "SkeletonText";
94
+ const u = m(
95
+ ({ size: e = "md", animation: r = "pulse", ...s }, l) => {
96
+ const o = typeof e == "number" ? e : O[e];
97
+ return /* @__PURE__ */ t(
98
+ S,
104
99
  {
105
- ref: s,
100
+ ref: l,
106
101
  variant: "circular",
107
- animation: t,
108
- width: d,
109
- height: d,
110
- ...l
102
+ animation: r,
103
+ width: o,
104
+ height: o,
105
+ ...s
111
106
  }
112
107
  );
113
108
  }
114
109
  );
115
- x.displayName = "SkeletonAvatar";
116
- const B = m(
117
- ({ animation: e = "pulse", className: t, ...l }, s) => /* @__PURE__ */ f(
110
+ u.displayName = "SkeletonAvatar";
111
+ const K = m(
112
+ ({ animation: e = "pulse", className: r, ...s }, l) => /* @__PURE__ */ f(
118
113
  "div",
119
114
  {
120
- ref: s,
121
- className: A(
115
+ ref: l,
116
+ className: k(
122
117
  "Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",
123
- t
118
+ r
124
119
  ),
125
- ...l,
120
+ ...s,
126
121
  children: [
127
122
  /* @__PURE__ */ f("div", { className: "flex items-center gap-3 mb-4", children: [
128
- /* @__PURE__ */ r(x, { animation: e }),
123
+ /* @__PURE__ */ t(u, { animation: e }),
129
124
  /* @__PURE__ */ f("div", { className: "flex-1", children: [
130
- /* @__PURE__ */ r(i, { animation: e, width: "60%", height: 16, className: "mb-2" }),
131
- /* @__PURE__ */ r(i, { animation: e, width: "40%", height: 12 })
125
+ /* @__PURE__ */ t(S, { animation: e, width: "60%", height: 16, className: "mb-2" }),
126
+ /* @__PURE__ */ t(S, { animation: e, width: "40%", height: 12 })
132
127
  ] })
133
128
  ] }),
134
- /* @__PURE__ */ r(k, { animation: e, lines: 3 })
129
+ /* @__PURE__ */ t(T, { animation: e, lines: 3 })
135
130
  ]
136
131
  }
137
132
  )
138
133
  );
139
- B.displayName = "SkeletonCard";
134
+ K.displayName = "SkeletonCard";
140
135
  export {
141
- i as Skeleton,
142
- x as SkeletonAvatar,
143
- B as SkeletonCard,
144
- k as SkeletonText
136
+ S as Skeleton,
137
+ u as SkeletonAvatar,
138
+ K as SkeletonCard,
139
+ T as SkeletonText
145
140
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Skeleton.const.cjs"),t="bear-skeleton-styles",o=()=>{if(typeof document<"u"&&!document.getElementById(t)){const e=document.createElement("style");e.id=t,e.textContent=n.SKELETON_WAVE_STYLES,document.head.appendChild(e)}};exports.injectStyles=o;
@@ -0,0 +1 @@
1
+ export declare const injectStyles: () => void;
@@ -0,0 +1,10 @@
1
+ import { SKELETON_WAVE_STYLES as n } from "./Skeleton.const.js";
2
+ const t = "bear-skeleton-styles", d = () => {
3
+ if (typeof document < "u" && !document.getElementById(t)) {
4
+ const e = document.createElement("style");
5
+ e.id = t, e.textContent = n, document.head.appendChild(e);
6
+ }
7
+ };
8
+ export {
9
+ d as injectStyles
10
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),u=require("react"),d=require("../../utils/cn.cjs"),X={xs:{track:"bear-h-1",thumb:"bear-w-3 bear-h-3",height:"bear-h-6"},sm:{track:"bear-h-1.5",thumb:"bear-w-4 bear-h-4",height:"bear-h-8"},md:{track:"bear-h-2",thumb:"bear-w-5 bear-h-5",height:"bear-h-10"},lg:{track:"bear-h-2.5",thumb:"bear-w-6 bear-h-6",height:"bear-h-12"},xl:{track:"bear-h-3",thumb:"bear-w-7 bear-h-7",height:"bear-h-14"}},Y={primary:{track:"bear-bg-bear-500",thumb:"bear-bg-bear-500 bear-border-bear-600"},secondary:{track:"bear-bg-gray-500",thumb:"bear-bg-gray-500 bear-border-gray-600"},success:{track:"bear-bg-green-500",thumb:"bear-bg-green-500 bear-border-green-600"},warning:{track:"bear-bg-amber-500",thumb:"bear-bg-amber-500 bear-border-amber-600"},error:{track:"bear-bg-red-500",thumb:"bear-bg-red-500 bear-border-red-600"},danger:{track:"bear-bg-red-500",thumb:"bear-bg-red-500 bear-border-red-600"},info:{track:"bear-bg-blue-500",thumb:"bear-bg-blue-500 bear-border-blue-600"},ghost:{track:"bear-bg-gray-400",thumb:"bear-bg-gray-400 bear-border-gray-500"},outline:{track:"bear-bg-gray-600",thumb:"bear-bg-white dark:bear-bg-gray-200 bear-border-gray-600 dark:bear-border-gray-400"}},_=(c,f,e,r)=>{const l=Math.round(c/r)*r;return Math.max(f,Math.min(e,l))},A=({value:c,defaultValue:f=[20,80],min:e=0,max:r=100,step:l=1,size:$="md",color:q="primary",disabled:b=!1,onChange:s,onChangeCommitted:g,valueFormatter:B=w=>String(w),className:z,...O})=>{const[w,L]=u.useState(f),[t,E]=u.useState(null),y=u.useRef(null),k=c??w,[n,o]=k,x=(n-e)/(r-e)*100,j=(o-e)/(r-e)*100,m=X[$],M=Y[q],S=u.useCallback((a,v)=>{if(!y.current||b)return;const T=y.current.getBoundingClientRect(),P=Math.max(0,Math.min(1,(a-T.left)/T.width)),V=e+P*(r-e),D=_(V,e,r,l);if(v==="min"){const i=[Math.min(D,o-l),o];c===void 0&&L(i),s==null||s(i)}else{const I=Math.max(D,n+l),i=[n,I];c===void 0&&L(i),s==null||s(i)}},[e,r,l,n,o,b,c,s]),N=(a,v)=>{b||(a.preventDefault(),E(v),S(a.clientX,v))},p=u.useCallback(a=>{t&&S(a.clientX,t)},[t,S]),R=u.useCallback(()=>{t&&(E(null),g==null||g(k))},[t,k,g]);return u.useEffect(()=>{if(t)return document.addEventListener("mousemove",p),document.addEventListener("mouseup",R),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",R)}},[t,p,R]),h.jsx("div",{className:d.cn("bear-relative bear-w-full bear-flex bear-items-center",m.height,b&&"bear-opacity-50 bear-cursor-not-allowed",z),"data-testid":"slider-range",...O,children:h.jsxs("div",{ref:y,className:d.cn("bear-relative bear-w-full bear-rounded-full bear-bg-gray-200 dark:bear-bg-gray-700",m.track,!b&&"bear-cursor-pointer"),children:[h.jsx("div",{className:d.cn("bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full",M.track),style:{left:`${x}%`,width:`${j-x}%`}}),h.jsx("div",{role:"slider",tabIndex:b?-1:0,"aria-valuemin":e,"aria-valuemax":r,"aria-valuenow":n,"aria-label":"Range minimum",className:d.cn("bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",m.thumb,M.thumb,!b&&"bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",t==="min"&&"bear-scale-125 bear-z-10"),style:{left:`${x}%`},onMouseDown:a=>N(a,"min")}),h.jsx("div",{role:"slider",tabIndex:b?-1:0,"aria-valuemin":e,"aria-valuemax":r,"aria-valuenow":o,"aria-label":"Range maximum",className:d.cn("bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",m.thumb,M.thumb,!b&&"bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",t==="max"&&"bear-scale-125 bear-z-10"),style:{left:`${j}%`},onMouseDown:a=>N(a,"max")})]})})};exports.SliderRange=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),u=require("react"),i=require("../../utils/cn.cjs"),V=require("./SliderRange.utils.cjs"),X={xs:{track:"bear-h-1",thumb:"bear-w-3 bear-h-3",height:"bear-h-6"},sm:{track:"bear-h-1.5",thumb:"bear-w-4 bear-h-4",height:"bear-h-8"},md:{track:"bear-h-2",thumb:"bear-w-5 bear-h-5",height:"bear-h-10"},lg:{track:"bear-h-2.5",thumb:"bear-w-6 bear-h-6",height:"bear-h-12"},xl:{track:"bear-h-3",thumb:"bear-w-7 bear-h-7",height:"bear-h-14"}},Y={primary:{track:"bear-bg-bear-500",thumb:"bear-bg-bear-500 bear-border-bear-600"},secondary:{track:"bear-bg-gray-500",thumb:"bear-bg-gray-500 bear-border-gray-600"},success:{track:"bear-bg-green-500",thumb:"bear-bg-green-500 bear-border-green-600"},warning:{track:"bear-bg-amber-500",thumb:"bear-bg-amber-500 bear-border-amber-600"},error:{track:"bear-bg-red-500",thumb:"bear-bg-red-500 bear-border-red-600"},danger:{track:"bear-bg-red-500",thumb:"bear-bg-red-500 bear-border-red-600"},info:{track:"bear-bg-blue-500",thumb:"bear-bg-blue-500 bear-border-blue-600"},ghost:{track:"bear-bg-gray-400",thumb:"bear-bg-gray-400 bear-border-gray-500"},outline:{track:"bear-bg-gray-600",thumb:"bear-bg-white dark:bear-bg-gray-200 bear-border-gray-600 dark:bear-border-gray-400"}},A=({value:h,defaultValue:D=[20,80],min:e=0,max:t=100,step:d=1,size:I="md",color:$="primary",disabled:a=!1,onChange:s,onChangeCommitted:g,valueFormatter:B=f=>String(f),className:z,...O})=>{const[f,R]=u.useState(D),[b,L]=u.useState(null),w=u.useRef(null),y=h??f,[c,l]=y,k=(c-e)/(t-e)*100,E=(l-e)/(t-e)*100,m=X[I],x=Y[$],S=u.useCallback((r,v)=>{if(!w.current||a)return;const N=w.current.getBoundingClientRect(),P=Math.max(0,Math.min(1,(r-N.left)/N.width)),_=e+P*(t-e),T=V.stepValue(_,e,t,d);if(v==="min"){const n=[Math.min(T,l-d),l];h===void 0&&R(n),s==null||s(n)}else{const q=Math.max(T,c+d),n=[c,q];h===void 0&&R(n),s==null||s(n)}},[e,t,d,c,l,a,h,s]),j=(r,v)=>{a||(r.preventDefault(),L(v),S(r.clientX,v))},p=u.useCallback(r=>{b&&S(r.clientX,b)},[b,S]),M=u.useCallback(()=>{b&&(L(null),g==null||g(y))},[b,y,g]);return u.useEffect(()=>{if(b)return document.addEventListener("mousemove",p),document.addEventListener("mouseup",M),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",M)}},[b,p,M]),o.jsx("div",{className:i.cn("bear-relative bear-w-full bear-flex bear-items-center",m.height,a&&"bear-opacity-50 bear-cursor-not-allowed",z),"data-testid":"slider-range",...O,children:o.jsxs("div",{ref:w,className:i.cn("bear-relative bear-w-full bear-rounded-full bear-bg-gray-200 dark:bear-bg-gray-700",m.track,!a&&"bear-cursor-pointer"),children:[o.jsx("div",{className:i.cn("bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full",x.track),style:{left:`${k}%`,width:`${E-k}%`}}),o.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":c,"aria-label":"Range minimum",className:i.cn("bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",m.thumb,x.thumb,!a&&"bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",b==="min"&&"bear-scale-125 bear-z-10"),style:{left:`${k}%`},onMouseDown:r=>j(r,"min")}),o.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":l,"aria-label":"Range maximum",className:i.cn("bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",m.thumb,x.thumb,!a&&"bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",b==="max"&&"bear-scale-125 bear-z-10"),style:{left:`${E}%`},onMouseDown:r=>j(r,"max")})]})})};exports.SliderRange=A;
@@ -1,13 +1,14 @@
1
1
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
2
- import { useState as z, useRef as A, useCallback as L, useEffect as B } from "react";
3
- import { cn as i } from "../../utils/cn.js";
4
- const F = {
2
+ import { useState as $, useRef as A, useCallback as S, useEffect as B } from "react";
3
+ import { cn as l } from "../../utils/cn.js";
4
+ import { stepValue as F } from "./SliderRange.utils.js";
5
+ const H = {
5
6
  xs: { track: "bear-h-1", thumb: "bear-w-3 bear-h-3", height: "bear-h-6" },
6
7
  sm: { track: "bear-h-1.5", thumb: "bear-w-4 bear-h-4", height: "bear-h-8" },
7
8
  md: { track: "bear-h-2", thumb: "bear-w-5 bear-h-5", height: "bear-h-10" },
8
9
  lg: { track: "bear-h-2.5", thumb: "bear-w-6 bear-h-6", height: "bear-h-12" },
9
10
  xl: { track: "bear-h-3", thumb: "bear-w-7 bear-h-7", height: "bear-h-14" }
10
- }, H = {
11
+ }, U = {
11
12
  primary: { track: "bear-bg-bear-500", thumb: "bear-bg-bear-500 bear-border-bear-600" },
12
13
  secondary: { track: "bear-bg-gray-500", thumb: "bear-bg-gray-500 bear-border-gray-600" },
13
14
  success: { track: "bear-bg-green-500", thumb: "bear-bg-green-500 bear-border-green-600" },
@@ -17,59 +18,56 @@ const F = {
17
18
  info: { track: "bear-bg-blue-500", thumb: "bear-bg-blue-500 bear-border-blue-600" },
18
19
  ghost: { track: "bear-bg-gray-400", thumb: "bear-bg-gray-400 bear-border-gray-500" },
19
20
  outline: { track: "bear-bg-gray-600", thumb: "bear-bg-white dark:bear-bg-gray-200 bear-border-gray-600 dark:bear-border-gray-400" }
20
- }, U = (s, v, e, r) => {
21
- const o = Math.round(s / r) * r;
22
- return Math.max(v, Math.min(e, o));
23
- }, K = ({
24
- value: s,
25
- defaultValue: v = [20, 80],
21
+ }, Q = ({
22
+ value: n,
23
+ defaultValue: z = [20, 80],
26
24
  min: e = 0,
27
- max: r = 100,
28
- step: o = 1,
25
+ max: t = 100,
26
+ step: i = 1,
29
27
  size: j = "md",
30
28
  color: O = "primary",
31
- disabled: b = !1,
32
- onChange: u,
29
+ disabled: a = !1,
30
+ onChange: s,
33
31
  onChangeCommitted: h,
34
- valueFormatter: Z = (f) => String(f),
32
+ valueFormatter: Z = (v) => String(v),
35
33
  className: P,
36
34
  ...V
37
35
  }) => {
38
- const [f, E] = z(v), [t, R] = z(null), w = A(null), y = s ?? f, [c, l] = y, k = (c - e) / (r - e) * 100, N = (l - e) / (r - e) * 100, m = F[j], p = H[O], x = L(
39
- (a, d) => {
40
- if (!w.current || b) return;
41
- const I = w.current.getBoundingClientRect(), X = Math.max(0, Math.min(1, (a - I.left) / I.width)), Y = e + X * (r - e), T = U(Y, e, r, o);
36
+ const [v, L] = $(z), [b, E] = $(null), f = A(null), w = n ?? v, [u, o] = w, y = (u - e) / (t - e) * 100, R = (o - e) / (t - e) * 100, m = H[j], k = U[O], p = S(
37
+ (r, d) => {
38
+ if (!f.current || a) return;
39
+ const D = f.current.getBoundingClientRect(), X = Math.max(0, Math.min(1, (r - D.left) / D.width)), Y = e + X * (t - e), I = F(Y, e, t, i);
42
40
  if (d === "min") {
43
- const n = [Math.min(T, l - o), l];
44
- s === void 0 && E(n), u == null || u(n);
41
+ const c = [Math.min(I, o - i), o];
42
+ n === void 0 && L(c), s == null || s(c);
45
43
  } else {
46
- const $ = Math.max(T, c + o), n = [c, $];
47
- s === void 0 && E(n), u == null || u(n);
44
+ const T = Math.max(I, u + i), c = [u, T];
45
+ n === void 0 && L(c), s == null || s(c);
48
46
  }
49
47
  },
50
- [e, r, o, c, l, b, s, u]
51
- ), D = (a, d) => {
52
- b || (a.preventDefault(), R(d), x(a.clientX, d));
53
- }, M = L(
54
- (a) => {
55
- t && x(a.clientX, t);
48
+ [e, t, i, u, o, a, n, s]
49
+ ), N = (r, d) => {
50
+ a || (r.preventDefault(), E(d), p(r.clientX, d));
51
+ }, x = S(
52
+ (r) => {
53
+ b && p(r.clientX, b);
56
54
  },
57
- [t, x]
58
- ), S = L(() => {
59
- t && (R(null), h == null || h(y));
60
- }, [t, y, h]);
55
+ [b, p]
56
+ ), M = S(() => {
57
+ b && (E(null), h == null || h(w));
58
+ }, [b, w, h]);
61
59
  return B(() => {
62
- if (t)
63
- return document.addEventListener("mousemove", M), document.addEventListener("mouseup", S), () => {
64
- document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", S);
60
+ if (b)
61
+ return document.addEventListener("mousemove", x), document.addEventListener("mouseup", M), () => {
62
+ document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", M);
65
63
  };
66
- }, [t, M, S]), /* @__PURE__ */ g(
64
+ }, [b, x, M]), /* @__PURE__ */ g(
67
65
  "div",
68
66
  {
69
- className: i(
67
+ className: l(
70
68
  "bear-relative bear-w-full bear-flex bear-items-center",
71
69
  m.height,
72
- b && "bear-opacity-50 bear-cursor-not-allowed",
70
+ a && "bear-opacity-50 bear-cursor-not-allowed",
73
71
  P
74
72
  ),
75
73
  "data-testid": "slider-range",
@@ -77,58 +75,58 @@ const F = {
77
75
  children: /* @__PURE__ */ _(
78
76
  "div",
79
77
  {
80
- ref: w,
81
- className: i(
78
+ ref: f,
79
+ className: l(
82
80
  "bear-relative bear-w-full bear-rounded-full bear-bg-gray-200 dark:bear-bg-gray-700",
83
81
  m.track,
84
- !b && "bear-cursor-pointer"
82
+ !a && "bear-cursor-pointer"
85
83
  ),
86
84
  children: [
87
85
  /* @__PURE__ */ g(
88
86
  "div",
89
87
  {
90
- className: i("bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full", p.track),
91
- style: { left: `${k}%`, width: `${N - k}%` }
88
+ className: l("bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full", k.track),
89
+ style: { left: `${y}%`, width: `${R - y}%` }
92
90
  }
93
91
  ),
94
92
  /* @__PURE__ */ g(
95
93
  "div",
96
94
  {
97
95
  role: "slider",
98
- tabIndex: b ? -1 : 0,
96
+ tabIndex: a ? -1 : 0,
99
97
  "aria-valuemin": e,
100
- "aria-valuemax": r,
101
- "aria-valuenow": c,
98
+ "aria-valuemax": t,
99
+ "aria-valuenow": u,
102
100
  "aria-label": "Range minimum",
103
- className: i(
101
+ className: l(
104
102
  "bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",
105
103
  m.thumb,
106
- p.thumb,
107
- !b && "bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",
108
- t === "min" && "bear-scale-125 bear-z-10"
104
+ k.thumb,
105
+ !a && "bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",
106
+ b === "min" && "bear-scale-125 bear-z-10"
109
107
  ),
110
- style: { left: `${k}%` },
111
- onMouseDown: (a) => D(a, "min")
108
+ style: { left: `${y}%` },
109
+ onMouseDown: (r) => N(r, "min")
112
110
  }
113
111
  ),
114
112
  /* @__PURE__ */ g(
115
113
  "div",
116
114
  {
117
115
  role: "slider",
118
- tabIndex: b ? -1 : 0,
116
+ tabIndex: a ? -1 : 0,
119
117
  "aria-valuemin": e,
120
- "aria-valuemax": r,
121
- "aria-valuenow": l,
118
+ "aria-valuemax": t,
119
+ "aria-valuenow": o,
122
120
  "aria-label": "Range maximum",
123
- className: i(
121
+ className: l(
124
122
  "bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",
125
123
  m.thumb,
126
- p.thumb,
127
- !b && "bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",
128
- t === "max" && "bear-scale-125 bear-z-10"
124
+ k.thumb,
125
+ !a && "bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",
126
+ b === "max" && "bear-scale-125 bear-z-10"
129
127
  ),
130
- style: { left: `${N}%` },
131
- onMouseDown: (a) => D(a, "max")
128
+ style: { left: `${R}%` },
129
+ onMouseDown: (r) => N(r, "max")
132
130
  }
133
131
  )
134
132
  ]
@@ -138,5 +136,5 @@ const F = {
138
136
  );
139
137
  };
140
138
  export {
141
- K as SliderRange
139
+ Q as SliderRange
142
140
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(e,a,n,t)=>{const o=Math.round(e/t)*t;return Math.max(a,Math.min(n,o))};exports.stepValue=r;
@@ -0,0 +1 @@
1
+ export declare const stepValue: (raw: number, min: number, max: number, step: number) => number;
@@ -0,0 +1,7 @@
1
+ const e = (a, n, o, t) => {
2
+ const r = Math.round(a / t) * t;
3
+ return Math.max(n, Math.min(o, r));
4
+ };
5
+ export {
6
+ e as stepValue
7
+ };