@forgedevstack/bear 1.1.4 → 1.1.8

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 (146) hide show
  1. package/README.md +19 -0
  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/Button/Button.cjs +1 -1
  15. package/dist/components/Button/Button.constants.cjs +2 -2
  16. package/dist/components/Button/Button.constants.d.ts +1 -0
  17. package/dist/components/Button/Button.constants.js +12 -5
  18. package/dist/components/Button/Button.d.ts +0 -27
  19. package/dist/components/Button/Button.js +93 -105
  20. package/dist/components/Button/Button.types.d.ts +1 -0
  21. package/dist/components/Button/Button.utils.cjs +1 -0
  22. package/dist/components/Button/Button.utils.d.ts +2 -0
  23. package/dist/components/Button/Button.utils.js +5 -0
  24. package/dist/components/Button/useSpotlight.cjs +1 -0
  25. package/dist/components/Button/useSpotlight.d.ts +21 -0
  26. package/dist/components/Button/useSpotlight.js +28 -0
  27. package/dist/components/Chart/Chart.cjs +1 -1
  28. package/dist/components/Chart/Chart.const.cjs +1 -0
  29. package/dist/components/Chart/Chart.const.js +21 -0
  30. package/dist/components/Chart/Chart.js +55 -71
  31. package/dist/components/Chart/Chart.utils.cjs +1 -0
  32. package/dist/components/Chart/Chart.utils.js +5 -0
  33. package/dist/components/Confetti/Confetti.cjs +1 -1
  34. package/dist/components/Confetti/Confetti.js +37 -34
  35. package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
  36. package/dist/components/ContextMenu/ContextMenu.js +31 -30
  37. package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
  38. package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
  39. package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
  40. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  41. package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
  42. package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
  43. package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
  44. package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
  45. package/dist/components/Dock/Dock.cjs +1 -1
  46. package/dist/components/Dock/Dock.js +38 -43
  47. package/dist/components/Dock/Dock.utils.cjs +1 -0
  48. package/dist/components/Dock/Dock.utils.d.ts +1 -0
  49. package/dist/components/Dock/Dock.utils.js +10 -0
  50. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  51. package/dist/components/Dropdown/Dropdown.js +59 -60
  52. package/dist/components/FileTree/FileTree.cjs +1 -1
  53. package/dist/components/FileTree/FileTree.js +20 -32
  54. package/dist/components/FileTree/FileTree.utils.cjs +1 -0
  55. package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
  56. package/dist/components/FileTree/FileTree.utils.js +15 -0
  57. package/dist/components/GradientText/GradientText.cjs +1 -1
  58. package/dist/components/GradientText/GradientText.js +27 -29
  59. package/dist/components/Icon/icons/bear.cjs +1 -0
  60. package/dist/components/Icon/icons/bear.d.ts +12 -0
  61. package/dist/components/Icon/icons/bear.js +47 -0
  62. package/dist/components/Icon/index.cjs +1 -1
  63. package/dist/components/Icon/index.d.ts +18 -0
  64. package/dist/components/Icon/index.js +17 -15
  65. package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
  66. package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
  67. package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
  68. package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
  69. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  70. package/dist/components/MentionsInput/MentionsInput.js +64 -68
  71. package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
  72. package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
  73. package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
  74. package/dist/components/PageNav/PageNav.cjs +1 -0
  75. package/dist/components/PageNav/PageNav.const.cjs +1 -0
  76. package/dist/components/PageNav/PageNav.const.d.ts +22 -0
  77. package/dist/components/PageNav/PageNav.const.js +42 -0
  78. package/dist/components/PageNav/PageNav.d.ts +3 -0
  79. package/dist/components/PageNav/PageNav.js +81 -0
  80. package/dist/components/PageNav/PageNav.types.d.ts +17 -0
  81. package/dist/components/PageNav/index.d.ts +2 -0
  82. package/dist/components/Progress/Progress.cjs +1 -1
  83. package/dist/components/Progress/Progress.js +6 -6
  84. package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
  85. package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
  86. package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
  87. package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
  88. package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
  89. package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
  90. package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
  91. package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
  92. package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
  93. package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
  94. package/dist/components/PropsPlayground/index.d.ts +2 -0
  95. package/dist/components/Select/Select.cjs +1 -1
  96. package/dist/components/Select/Select.js +28 -30
  97. package/dist/components/SignPad/SignPad.cjs +1 -1
  98. package/dist/components/SignPad/SignPad.js +24 -24
  99. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  100. package/dist/components/Skeleton/Skeleton.js +89 -94
  101. package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
  102. package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
  103. package/dist/components/Skeleton/Skeleton.utils.js +10 -0
  104. package/dist/components/SliderRange/SliderRange.cjs +1 -1
  105. package/dist/components/SliderRange/SliderRange.js +61 -63
  106. package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
  107. package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
  108. package/dist/components/SliderRange/SliderRange.utils.js +7 -0
  109. package/dist/components/Spotlight/Spotlight.cjs +1 -1
  110. package/dist/components/Spotlight/Spotlight.js +62 -73
  111. package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
  112. package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
  113. package/dist/components/Spotlight/Spotlight.utils.js +18 -0
  114. package/dist/components/Tabs/Tabs.cjs +1 -1
  115. package/dist/components/Tabs/Tabs.js +39 -38
  116. package/dist/components/Tabs/Tabs.types.d.ts +3 -1
  117. package/dist/components/Toast/Toast.cjs +1 -1
  118. package/dist/components/Toast/Toast.js +18 -17
  119. package/dist/components/Toast/Toast.utils.cjs +1 -0
  120. package/dist/components/Toast/Toast.utils.d.ts +1 -0
  121. package/dist/components/Toast/Toast.utils.js +4 -0
  122. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  123. package/dist/components/Tooltip/Tooltip.js +10 -11
  124. package/dist/components/Tour/Tour.cjs +1 -1
  125. package/dist/components/Tour/Tour.js +1 -2
  126. package/dist/components/VirtualList/VirtualList.cjs +1 -1
  127. package/dist/components/VirtualList/VirtualList.js +38 -43
  128. package/dist/components/index.cjs +1 -1
  129. package/dist/components/index.d.ts +4 -0
  130. package/dist/components/index.js +66 -62
  131. package/dist/hooks/index.cjs +1 -1
  132. package/dist/hooks/index.d.ts +2 -0
  133. package/dist/hooks/index.js +60 -58
  134. package/dist/hooks/useResizeObserver/index.d.ts +2 -0
  135. package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
  136. package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
  137. package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
  138. package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
  139. package/dist/icons.cjs +1 -0
  140. package/dist/icons.d.ts +2 -0
  141. package/dist/icons.js +6 -0
  142. package/dist/index.cjs +1 -1
  143. package/dist/index.js +175 -169
  144. package/dist/styles/_base.css +7 -3
  145. package/dist/styles.css +1 -1
  146. package/package.json +6 -1
@@ -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
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),m=require("../../utils/cn.cjs"),x=require("./Spotlight.const.cjs"),R=(s,l)=>{var i,p;const n=l.toLowerCase();return!!(s.label.toLowerCase().includes(n)||(i=s.description)!=null&&i.toLowerCase().includes(n)||(p=s.keywords)!=null&&p.some(y=>y.toLowerCase().includes(n)))},E=(s,l)=>{if(!l)return s;const n=s.toLowerCase().indexOf(l.toLowerCase());return n===-1?s:r.jsxs(r.Fragment,{children:[s.slice(0,n),r.jsx("mark",{className:"Bear-Spotlight__highlight bear-bg-yellow-200 dark:bear-bg-yellow-800 bear-text-inherit bear-rounded-sm bear-px-0.5",children:s.slice(n,n+l.length)}),s.slice(n+l.length)]})},U=s=>{const{actions:l,open:n,onOpenChange:i,placeholder:p=x.DEFAULT_PLACEHOLDER,shortcutKey:y=x.DEFAULT_SHORTCUT_KEY,shortcutMod:v=!0,nothingFoundMessage:L=x.DEFAULT_NOTHING_FOUND,highlightMatches:S=!0,limit:f=x.DEFAULT_LIMIT,filter:k,className:B,style:D,testId:T}=s,[I,A]=b.useState(!1),[o,j]=b.useState(""),[h,u]=b.useState(0),N=b.useRef(null),C=b.useRef(null),g=n??I,d=b.useCallback(e=>{A(e),i==null||i(e),e||(j(""),u(0))},[i]);b.useEffect(()=>{const e=a=>{(v?a.metaKey||a.ctrlKey:!0)&&a.key.toLowerCase()===y.toLowerCase()&&(a.preventDefault(),d(!g)),a.key==="Escape"&&g&&d(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y,v,g,d]),b.useEffect(()=>{g&&setTimeout(()=>{var e;return(e=N.current)==null?void 0:e.focus()},x.FOCUS_DELAY)},[g]);const c=b.useMemo(()=>k?k(o,l).slice(0,f):o?l.filter(e=>R(e,o)).slice(0,f):l.slice(0,f),[l,o,k,f]),O=b.useMemo(()=>{const e=new Map;return c.forEach(a=>{const t=a.group||"";e.has(t)||e.set(t,[]),e.get(t).push(a)}),e},[c]),M=b.useCallback(e=>{if(e.key==="ArrowDown")e.preventDefault(),u(a=>Math.min(a+1,c.length-1));else if(e.key==="ArrowUp")e.preventDefault(),u(a=>Math.max(a-1,0));else if(e.key==="Enter"&&c[h]){e.preventDefault();const a=c[h];a.disabled||(a.onTrigger(),d(!1))}},[c,h,d]);if(b.useEffect(()=>{const e=C.current;if(!e)return;const a=e.querySelector('[data-active="true"]');a==null||a.scrollIntoView({block:"nearest"})},[h]),!g)return null;let _=-1;return r.jsxs("div",{className:m.cn("Bear-Spotlight","bear-fixed bear-inset-0 bear-flex bear-items-start bear-justify-center bear-pt-[15vh]"),style:{zIndex:x.SPOTLIGHT_Z_INDEX},"data-testid":T,children:[r.jsx("div",{className:"Bear-Spotlight__backdrop bear-absolute bear-inset-0 bear-bg-black/50 dark:bear-bg-black/70 bear-backdrop-blur-sm",onClick:()=>d(!1),"aria-hidden":"true"}),r.jsxs("div",{className:m.cn("Bear-Spotlight__dialog","bear-relative bear-w-full bear-max-w-[560px] bear-mx-4","bear-bg-white dark:bear-bg-gray-900","bear-rounded-xl bear-shadow-2xl","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-overflow-hidden",B),style:D,role:"dialog","aria-label":"Search",children:[r.jsxs("div",{className:"Bear-Spotlight__search bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",children:[r.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"bear-text-gray-400 dark:bear-text-gray-500 bear-shrink-0",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("input",{ref:N,type:"text",value:o,onChange:e=>{j(e.target.value),u(0)},onKeyDown:M,placeholder:p,className:m.cn("Bear-Spotlight__input","bear-flex-1 bear-bg-transparent bear-outline-none bear-text-base","bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500"),autoComplete:"off",spellCheck:!1}),r.jsx("kbd",{className:"bear-hidden sm:bear-inline-flex bear-items-center bear-px-1.5 bear-py-0.5 bear-rounded bear-text-[10px] bear-font-mono bear-text-gray-400 dark:bear-text-gray-500 bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"ESC"})]}),r.jsxs("div",{ref:C,className:"Bear-Spotlight__results bear-max-h-[400px] bear-overflow-y-auto bear-py-2",role:"listbox",children:[c.length===0&&r.jsx("div",{className:"Bear-Spotlight__empty bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm",children:L}),Array.from(O.entries()).map(([e,a])=>r.jsxs("div",{className:"Bear-Spotlight__group",children:[e&&r.jsx("div",{className:"Bear-Spotlight__group-title bear-px-4 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500",children:e}),a.map(t=>{_++;const w=_===h,F=_;return r.jsxs("button",{className:m.cn("Bear-Spotlight__action","bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2.5 bear-text-left bear-cursor-pointer","bear-transition-colors bear-duration-100",w?"bear-bg-gray-100 dark:bear-bg-gray-800":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",t.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),"data-active":w,onMouseEnter:()=>u(F),onClick:()=>{t.disabled||(t.onTrigger(),d(!1))},role:"option","aria-selected":w,"aria-disabled":t.disabled,children:[t.icon&&r.jsx("span",{className:"Bear-Spotlight__action-icon bear-text-gray-500 dark:bear-text-gray-400 bear-shrink-0",children:t.icon}),r.jsxs("div",{className:"Bear-Spotlight__action-body bear-flex-1 bear-min-w-0",children:[r.jsx("div",{className:"Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate",children:S?E(t.label,o):t.label}),t.description&&r.jsx("div",{className:"Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:S?E(t.description,o):t.description})]}),t.rightSection&&r.jsx("span",{className:"Bear-Spotlight__action-right bear-shrink-0",children:t.rightSection})]},t.id)})]},e))]}),r.jsxs("div",{className:"Bear-Spotlight__footer bear-border-t bear-border-gray-200 dark:bear-border-gray-700 bear-px-4 bear-py-2 bear-flex bear-items-center bear-gap-4 bear-text-[11px] bear-text-gray-400 dark:bear-text-gray-500",children:[r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↑↓"}),"navigate"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↵"}),"select"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"esc"}),"close"]})]})]})]})};exports.Spotlight=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),h=require("../../utils/cn.cjs"),o=require("./Spotlight.const.cjs"),m=require("./Spotlight.utils.cjs"),U=N=>{const{actions:g,open:E,onOpenChange:x,placeholder:B=o.DEFAULT_PLACEHOLDER,shortcutKey:k=o.DEFAULT_SHORTCUT_KEY,shortcutMod:_=!0,nothingFoundMessage:T=o.DEFAULT_NOTHING_FOUND,highlightMatches:v=!0,limit:p=o.DEFAULT_LIMIT,filter:u,className:D,style:C,testId:I}=N,[L,A]=s.useState(!1),[b,S]=s.useState(""),[d,c]=s.useState(0),j=s.useRef(null),w=s.useRef(null),n=E??L,l=s.useCallback(e=>{A(e),x==null||x(e),e||(S(""),c(0))},[x]);s.useEffect(()=>{const e=a=>{(_?a.metaKey||a.ctrlKey:!0)&&a.key.toLowerCase()===k.toLowerCase()&&(a.preventDefault(),l(!n)),a.key==="Escape"&&n&&l(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[k,_,n,l]),s.useEffect(()=>{n&&setTimeout(()=>{var e;return(e=j.current)==null?void 0:e.focus()},o.FOCUS_DELAY)},[n]);const i=s.useMemo(()=>u?u(b,g).slice(0,p):b?g.filter(e=>m.matchAction(e,b)).slice(0,p):g.slice(0,p),[g,b,u,p]),M=s.useMemo(()=>{const e=new Map;return i.forEach(a=>{const t=a.group||"";e.has(t)||e.set(t,[]),e.get(t).push(a)}),e},[i]),O=s.useCallback(e=>{if(e.key==="ArrowDown")e.preventDefault(),c(a=>Math.min(a+1,i.length-1));else if(e.key==="ArrowUp")e.preventDefault(),c(a=>Math.max(a-1,0));else if(e.key==="Enter"&&i[d]){e.preventDefault();const a=i[d];a.disabled||(a.onTrigger(),l(!1))}},[i,d,l]);if(s.useEffect(()=>{const e=w.current;if(!e)return;const a=e.querySelector('[data-active="true"]');a==null||a.scrollIntoView({block:"nearest"})},[d]),!n)return null;let y=-1;return r.jsxs("div",{className:h.cn("Bear-Spotlight","bear-fixed bear-inset-0 bear-flex bear-items-start bear-justify-center bear-pt-[15vh]"),style:{zIndex:o.SPOTLIGHT_Z_INDEX},"data-testid":I,children:[r.jsx("div",{className:"Bear-Spotlight__backdrop bear-absolute bear-inset-0 bear-bg-black/50 dark:bear-bg-black/70 bear-backdrop-blur-sm",onClick:()=>l(!1),"aria-hidden":"true"}),r.jsxs("div",{className:h.cn("Bear-Spotlight__dialog","bear-relative bear-w-full bear-max-w-[560px] bear-mx-4","bear-bg-white dark:bear-bg-gray-900","bear-rounded-xl bear-shadow-2xl","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-overflow-hidden",D),style:C,role:"dialog","aria-label":"Search",children:[r.jsxs("div",{className:"Bear-Spotlight__search bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",children:[r.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"bear-text-gray-400 dark:bear-text-gray-500 bear-shrink-0",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("input",{ref:j,type:"text",value:b,onChange:e=>{S(e.target.value),c(0)},onKeyDown:O,placeholder:B,className:h.cn("Bear-Spotlight__input","bear-flex-1 bear-bg-transparent bear-outline-none bear-text-base","bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500"),autoComplete:"off",spellCheck:!1}),r.jsx("kbd",{className:"bear-hidden sm:bear-inline-flex bear-items-center bear-px-1.5 bear-py-0.5 bear-rounded bear-text-[10px] bear-font-mono bear-text-gray-400 dark:bear-text-gray-500 bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"ESC"})]}),r.jsxs("div",{ref:w,className:"Bear-Spotlight__results bear-max-h-[400px] bear-overflow-y-auto bear-py-2",role:"listbox",children:[i.length===0&&r.jsx("div",{className:"Bear-Spotlight__empty bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm",children:T}),Array.from(M.entries()).map(([e,a])=>r.jsxs("div",{className:"Bear-Spotlight__group",children:[e&&r.jsx("div",{className:"Bear-Spotlight__group-title bear-px-4 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500",children:e}),a.map(t=>{y++;const f=y===d,R=y;return r.jsxs("button",{className:h.cn("Bear-Spotlight__action","bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2.5 bear-text-left bear-cursor-pointer","bear-transition-colors bear-duration-100",f?"bear-bg-gray-100 dark:bear-bg-gray-800":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",t.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),"data-active":f,onMouseEnter:()=>c(R),onClick:()=>{t.disabled||(t.onTrigger(),l(!1))},role:"option","aria-selected":f,"aria-disabled":t.disabled,children:[t.icon&&r.jsx("span",{className:"Bear-Spotlight__action-icon bear-text-gray-500 dark:bear-text-gray-400 bear-shrink-0",children:t.icon}),r.jsxs("div",{className:"Bear-Spotlight__action-body bear-flex-1 bear-min-w-0",children:[r.jsx("div",{className:"Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate",children:v?m.highlightText(t.label,b):t.label}),t.description&&r.jsx("div",{className:"Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:v?m.highlightText(t.description,b):t.description})]}),t.rightSection&&r.jsx("span",{className:"Bear-Spotlight__action-right bear-shrink-0",children:t.rightSection})]},t.id)})]},e))]}),r.jsxs("div",{className:"Bear-Spotlight__footer bear-border-t bear-border-gray-200 dark:bear-border-gray-700 bear-px-4 bear-py-2 bear-flex bear-items-center bear-gap-4 bear-text-[11px] bear-text-gray-400 dark:bear-text-gray-500",children:[r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↑↓"}),"navigate"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↵"}),"select"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"esc"}),"close"]})]})]})]})};exports.Spotlight=U;