@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,100 +1,89 @@
1
- import { jsxs as b, jsx as t, Fragment as G } from "react/jsx-runtime";
2
- import { useState as w, useRef as E, useCallback as D, useEffect as v, useMemo as T } from "react";
3
- import { cn as m } from "../../utils/cn.js";
4
- import { DEFAULT_PLACEHOLDER as P, DEFAULT_SHORTCUT_KEY as Y, DEFAULT_NOTHING_FOUND as z, DEFAULT_LIMIT as Q, FOCUS_DELAY as V, SPOTLIGHT_Z_INDEX as W } from "./Spotlight.const.js";
5
- const X = (l, s) => {
6
- var o, u;
7
- const i = s.toLowerCase();
8
- return !!(l.label.toLowerCase().includes(i) || (o = l.description) != null && o.toLowerCase().includes(i) || (u = l.keywords) != null && u.some((y) => y.toLowerCase().includes(i)));
9
- }, I = (l, s) => {
10
- if (!s) return l;
11
- const i = l.toLowerCase().indexOf(s.toLowerCase());
12
- return i === -1 ? l : /* @__PURE__ */ b(G, { children: [
13
- l.slice(0, i),
14
- /* @__PURE__ */ t("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: l.slice(i, i + s.length) }),
15
- l.slice(i + s.length)
16
- ] });
17
- }, ee = (l) => {
1
+ import { jsxs as b, jsx as t } from "react/jsx-runtime";
2
+ import { useState as u, useRef as B, useCallback as E, useEffect as f, useMemo as D } from "react";
3
+ import { cn as h } from "../../utils/cn.js";
4
+ import { DEFAULT_PLACEHOLDER as q, DEFAULT_SHORTCUT_KEY as G, DEFAULT_NOTHING_FOUND as P, DEFAULT_LIMIT as Y, FOCUS_DELAY as z, SPOTLIGHT_Z_INDEX as Q } from "./Spotlight.const.js";
5
+ import { matchAction as V, highlightText as T } from "./Spotlight.utils.js";
6
+ const ee = (I) => {
18
7
  const {
19
- actions: s,
20
- open: i,
21
- onOpenChange: o,
22
- placeholder: u = P,
23
- shortcutKey: y = Y,
24
- shortcutMod: N = !0,
25
- nothingFoundMessage: A = z,
26
- highlightMatches: S = !0,
27
- limit: x = Q,
28
- filter: f,
8
+ actions: c,
9
+ open: L,
10
+ onOpenChange: g,
11
+ placeholder: A = q,
12
+ shortcutKey: k = G,
13
+ shortcutMod: _ = !0,
14
+ nothingFoundMessage: C = P,
15
+ highlightMatches: v = !0,
16
+ limit: p = Y,
17
+ filter: y,
29
18
  className: O,
30
19
  style: M,
31
- testId: F
32
- } = l, [U, K] = w(!1), [n, L] = w(""), [p, h] = w(0), B = E(null), C = E(null), g = i ?? U, d = D(
20
+ testId: U
21
+ } = I, [F, K] = u(!1), [l, w] = u(""), [n, d] = u(0), N = B(null), S = B(null), o = L ?? F, s = E(
33
22
  (e) => {
34
- K(e), o == null || o(e), e || (L(""), h(0));
23
+ K(e), g == null || g(e), e || (w(""), d(0));
35
24
  },
36
- [o]
25
+ [g]
37
26
  );
38
- v(() => {
27
+ f(() => {
39
28
  const e = (r) => {
40
- (N ? r.metaKey || r.ctrlKey : !0) && r.key.toLowerCase() === y.toLowerCase() && (r.preventDefault(), d(!g)), r.key === "Escape" && g && d(!1);
29
+ (_ ? r.metaKey || r.ctrlKey : !0) && r.key.toLowerCase() === k.toLowerCase() && (r.preventDefault(), s(!o)), r.key === "Escape" && o && s(!1);
41
30
  };
42
31
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
43
- }, [y, N, g, d]), v(() => {
44
- g && setTimeout(() => {
32
+ }, [k, _, o, s]), f(() => {
33
+ o && setTimeout(() => {
45
34
  var e;
46
- return (e = B.current) == null ? void 0 : e.focus();
47
- }, V);
48
- }, [g]);
49
- const c = T(() => f ? f(n, s).slice(0, x) : n ? s.filter((e) => X(e, n)).slice(0, x) : s.slice(0, x), [s, n, f, x]), R = T(() => {
35
+ return (e = N.current) == null ? void 0 : e.focus();
36
+ }, z);
37
+ }, [o]);
38
+ const i = D(() => y ? y(l, c).slice(0, p) : l ? c.filter((e) => V(e, l)).slice(0, p) : c.slice(0, p), [c, l, y, p]), R = D(() => {
50
39
  const e = /* @__PURE__ */ new Map();
51
- return c.forEach((r) => {
40
+ return i.forEach((r) => {
52
41
  const a = r.group || "";
53
42
  e.has(a) || e.set(a, []), e.get(a).push(r);
54
43
  }), e;
55
- }, [c]), H = D(
44
+ }, [i]), H = E(
56
45
  (e) => {
57
46
  if (e.key === "ArrowDown")
58
- e.preventDefault(), h((r) => Math.min(r + 1, c.length - 1));
47
+ e.preventDefault(), d((r) => Math.min(r + 1, i.length - 1));
59
48
  else if (e.key === "ArrowUp")
60
- e.preventDefault(), h((r) => Math.max(r - 1, 0));
61
- else if (e.key === "Enter" && c[p]) {
49
+ e.preventDefault(), d((r) => Math.max(r - 1, 0));
50
+ else if (e.key === "Enter" && i[n]) {
62
51
  e.preventDefault();
63
- const r = c[p];
64
- r.disabled || (r.onTrigger(), d(!1));
52
+ const r = i[n];
53
+ r.disabled || (r.onTrigger(), s(!1));
65
54
  }
66
55
  },
67
- [c, p, d]
56
+ [i, n, s]
68
57
  );
69
- if (v(() => {
70
- const e = C.current;
58
+ if (f(() => {
59
+ const e = S.current;
71
60
  if (!e) return;
72
61
  const r = e.querySelector('[data-active="true"]');
73
62
  r == null || r.scrollIntoView({ block: "nearest" });
74
- }, [p]), !g) return null;
75
- let k = -1;
63
+ }, [n]), !o) return null;
64
+ let x = -1;
76
65
  return /* @__PURE__ */ b(
77
66
  "div",
78
67
  {
79
- className: m(
68
+ className: h(
80
69
  "Bear-Spotlight",
81
70
  "bear-fixed bear-inset-0 bear-flex bear-items-start bear-justify-center bear-pt-[15vh]"
82
71
  ),
83
- style: { zIndex: W },
84
- "data-testid": F,
72
+ style: { zIndex: Q },
73
+ "data-testid": U,
85
74
  children: [
86
75
  /* @__PURE__ */ t(
87
76
  "div",
88
77
  {
89
78
  className: "Bear-Spotlight__backdrop bear-absolute bear-inset-0 bear-bg-black/50 dark:bear-bg-black/70 bear-backdrop-blur-sm",
90
- onClick: () => d(!1),
79
+ onClick: () => s(!1),
91
80
  "aria-hidden": "true"
92
81
  }
93
82
  ),
94
83
  /* @__PURE__ */ b(
95
84
  "div",
96
85
  {
97
- className: m(
86
+ className: h(
98
87
  "Bear-Spotlight__dialog",
99
88
  "bear-relative bear-w-full bear-max-w-[560px] bear-mx-4",
100
89
  "bear-bg-white dark:bear-bg-gray-900",
@@ -127,15 +116,15 @@ const X = (l, s) => {
127
116
  /* @__PURE__ */ t(
128
117
  "input",
129
118
  {
130
- ref: B,
119
+ ref: N,
131
120
  type: "text",
132
- value: n,
121
+ value: l,
133
122
  onChange: (e) => {
134
- L(e.target.value), h(0);
123
+ w(e.target.value), d(0);
135
124
  },
136
125
  onKeyDown: H,
137
- placeholder: u,
138
- className: m(
126
+ placeholder: A,
127
+ className: h(
139
128
  "Bear-Spotlight__input",
140
129
  "bear-flex-1 bear-bg-transparent bear-outline-none bear-text-base",
141
130
  "bear-text-gray-900 dark:bear-text-white",
@@ -150,39 +139,39 @@ const X = (l, s) => {
150
139
  /* @__PURE__ */ b(
151
140
  "div",
152
141
  {
153
- ref: C,
142
+ ref: S,
154
143
  className: "Bear-Spotlight__results bear-max-h-[400px] bear-overflow-y-auto bear-py-2",
155
144
  role: "listbox",
156
145
  children: [
157
- c.length === 0 && /* @__PURE__ */ t("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: A }),
146
+ i.length === 0 && /* @__PURE__ */ t("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: C }),
158
147
  Array.from(R.entries()).map(([e, r]) => /* @__PURE__ */ b("div", { className: "Bear-Spotlight__group", children: [
159
148
  e && /* @__PURE__ */ t("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 }),
160
149
  r.map((a) => {
161
- k++;
162
- const _ = k === p, j = k;
150
+ x++;
151
+ const m = x === n, j = x;
163
152
  return /* @__PURE__ */ b(
164
153
  "button",
165
154
  {
166
- className: m(
155
+ className: h(
167
156
  "Bear-Spotlight__action",
168
157
  "bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2.5 bear-text-left bear-cursor-pointer",
169
158
  "bear-transition-colors bear-duration-100",
170
- _ ? "bear-bg-gray-100 dark:bear-bg-gray-800" : "hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",
159
+ m ? "bear-bg-gray-100 dark:bear-bg-gray-800" : "hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",
171
160
  a.disabled && "bear-opacity-50 bear-cursor-not-allowed"
172
161
  ),
173
- "data-active": _,
174
- onMouseEnter: () => h(j),
162
+ "data-active": m,
163
+ onMouseEnter: () => d(j),
175
164
  onClick: () => {
176
- a.disabled || (a.onTrigger(), d(!1));
165
+ a.disabled || (a.onTrigger(), s(!1));
177
166
  },
178
167
  role: "option",
179
- "aria-selected": _,
168
+ "aria-selected": m,
180
169
  "aria-disabled": a.disabled,
181
170
  children: [
182
171
  a.icon && /* @__PURE__ */ t("span", { className: "Bear-Spotlight__action-icon bear-text-gray-500 dark:bear-text-gray-400 bear-shrink-0", children: a.icon }),
183
172
  /* @__PURE__ */ b("div", { className: "Bear-Spotlight__action-body bear-flex-1 bear-min-w-0", children: [
184
- /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate", children: S ? I(a.label, n) : a.label }),
185
- a.description && /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate", children: S ? I(a.description, n) : a.description })
173
+ /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate", children: v ? T(a.label, l) : a.label }),
174
+ a.description && /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate", children: v ? T(a.description, l) : a.description })
186
175
  ] }),
187
176
  a.rightSection && /* @__PURE__ */ t("span", { className: "Bear-Spotlight__action-right bear-shrink-0", children: a.rightSection })
188
177
  ]
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=(e,t)=>{var s,o;const r=t.toLowerCase();return!!(e.label.toLowerCase().includes(r)||(s=e.description)!=null&&s.toLowerCase().includes(r)||(o=e.keywords)!=null&&o.some(n=>n.toLowerCase().includes(r)))},a=(e,t)=>{if(!t)return e;const r=e.toLowerCase().indexOf(t.toLowerCase());return r===-1?e:i.jsxs(i.Fragment,{children:[e.slice(0,r),i.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:e.slice(r,r+t.length)}),e.slice(r+t.length)]})};exports.highlightText=a;exports.matchAction=l;
@@ -0,0 +1,3 @@
1
+ import { SpotlightAction } from './Spotlight.types';
2
+ export declare const matchAction: (action: SpotlightAction, query: string) => boolean;
3
+ export declare const highlightText: (text: string, query: string) => React.ReactNode;
@@ -0,0 +1,18 @@
1
+ import { jsxs as n, Fragment as l, jsx as a } from "react/jsx-runtime";
2
+ const h = (e, s) => {
3
+ var o, i;
4
+ const r = s.toLowerCase();
5
+ return !!(e.label.toLowerCase().includes(r) || (o = e.description) != null && o.toLowerCase().includes(r) || (i = e.keywords) != null && i.some((t) => t.toLowerCase().includes(r)));
6
+ }, d = (e, s) => {
7
+ if (!s) return e;
8
+ const r = e.toLowerCase().indexOf(s.toLowerCase());
9
+ return r === -1 ? e : /* @__PURE__ */ n(l, { children: [
10
+ e.slice(0, r),
11
+ /* @__PURE__ */ a("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: e.slice(r, r + s.length) }),
12
+ e.slice(r + s.length)
13
+ ] });
14
+ };
15
+ export {
16
+ d as highlightText,
17
+ h as matchAction
18
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),s=require("../../utils/cn.cjs"),d=i.createContext(null),T=({children:a,defaultTab:t,variant:r="line",onChange:e,className:o,testId:l})=>{const[x,g]=i.useState(t),b=c=>{g(c),e==null||e(c)};return n.jsx(d.Provider,{value:{activeTab:x,setActiveTab:b,variant:r},children:n.jsx("div",{className:s.cn("Bear-Tabs",o),"data-testid":l,children:a})})},y=({children:a,className:t})=>{const r=i.useContext(d);if(!r)throw new Error("TabList must be used within Tabs");const{variant:e}=r;return n.jsx("div",{role:"tablist",className:s.cn("Bear-Tabs__list",`Bear-Tabs__list--${e}`,"bear-flex bear-gap-1",e==="line"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",e==="pills"&&"bear-bg-gray-100 dark:bear-bg-gray-800 bear-p-1 bear-rounded-lg",e==="enclosed"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",t),children:a})},v=({id:a,children:t,disabled:r=!1,icon:e})=>{const o=i.useContext(d);if(!o)throw new Error("Tab must be used within Tabs");const{activeTab:l,setActiveTab:x,variant:g}=o,b=l===a,c="bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors",u={line:s.cn("bear-border-b-2 bear--mb-px",b?"bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400":"bear-border-transparent bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-border-gray-300"),pills:s.cn("bear-rounded-md",b?"bear-bg-white dark:bear-bg-gray-700 bear-text-gray-900 dark:bear-text-white bear-shadow-sm":"bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"),enclosed:s.cn("bear-rounded-t-lg bear-border bear-border-transparent",b?"bear-bg-white dark:bear-bg-gray-900 bear-border-gray-200 dark:bear-border-gray-700 bear-border-b-white dark:bear-border-b-gray-900 bear--mb-px bear-text-gray-900 dark:bear-text-white":"bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white")};return n.jsxs("button",{role:"tab","aria-selected":b,disabled:r,onClick:()=>!r&&x(a),className:s.cn("Bear-Tabs__tab",b&&"Bear-Tabs__tab--active",c,u[g],r&&"Bear-Tabs__tab--disabled bear-opacity-50 bear-cursor-not-allowed"),children:[e&&n.jsx("span",{className:"Bear-Tabs__tab-icon",children:e}),n.jsx("span",{className:"Bear-Tabs__tab-label",children:t})]})},h=({tabId:a,children:t,className:r})=>{const e=i.useContext(d);if(!e)throw new Error("TabPanel must be used within Tabs");const{activeTab:o}=e;return o!==a?null:n.jsx("div",{role:"tabpanel",className:s.cn("Bear-Tabs__panel bear-py-4",r),children:t})};exports.Tab=v;exports.TabList=y;exports.TabPanel=h;exports.Tabs=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),n=require("../../utils/cn.cjs"),d=i.createContext(null),v=({children:a,value:t,defaultTab:r,variant:e="line",onChange:b,className:l,testId:x})=>{const[T,s]=i.useState(r),c=t!==void 0,g=c?t:T,y=u=>{c||s(u),b==null||b(u)};return o.jsx(d.Provider,{value:{activeTab:g,setActiveTab:y,variant:e},children:o.jsx("div",{className:n.cn("Bear-Tabs",l),"data-testid":x,children:a})})},h=({children:a,className:t})=>{const r=i.useContext(d);if(!r)throw new Error("TabList must be used within Tabs");const{variant:e}=r;return o.jsx("div",{role:"tablist",className:n.cn("Bear-Tabs__list",`Bear-Tabs__list--${e}`,"bear-flex bear-gap-1",e==="line"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",e==="pills"&&"bear-bg-gray-100 dark:bear-bg-gray-800 bear-p-1 bear-rounded-lg",e==="enclosed"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",t),children:a})},p=({id:a,children:t,disabled:r=!1,icon:e})=>{const b=i.useContext(d);if(!b)throw new Error("Tab must be used within Tabs");const{activeTab:l,setActiveTab:x,variant:T}=b,s=l===a,c="bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors",g={line:n.cn("bear-border-b-2 bear--mb-px",s?"bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400":"bear-border-transparent bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-border-gray-300"),pills:n.cn("bear-rounded-md",s?"bear-bg-white dark:bear-bg-gray-700 bear-text-gray-900 dark:bear-text-white bear-shadow-sm":"bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"),enclosed:n.cn("bear-rounded-t-lg bear-border bear-border-transparent",s?"bear-bg-white dark:bear-bg-gray-900 bear-border-gray-200 dark:bear-border-gray-700 bear-border-b-white dark:bear-border-b-gray-900 bear--mb-px bear-text-gray-900 dark:bear-text-white":"bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white")};return o.jsxs("button",{role:"tab","aria-selected":s,disabled:r,onClick:()=>!r&&x(a),className:n.cn("Bear-Tabs__tab",s&&"Bear-Tabs__tab--active",c,g[T],r&&"Bear-Tabs__tab--disabled bear-opacity-50 bear-cursor-not-allowed"),children:[e&&o.jsx("span",{className:"Bear-Tabs__tab-icon",children:e}),o.jsx("span",{className:"Bear-Tabs__tab-label",children:t})]})},k=({tabId:a,children:t,className:r})=>{const e=i.useContext(d);if(!e)throw new Error("TabPanel must be used within Tabs");const{activeTab:b}=e;return b!==a?null:o.jsx("div",{role:"tabpanel",className:n.cn("Bear-Tabs__panel bear-py-4",r),children:t})};exports.Tab=p;exports.TabList=h;exports.TabPanel=k;exports.Tabs=v;
@@ -1,27 +1,28 @@
1
- import { jsxs as T, jsx as n } from "react/jsx-runtime";
2
- import { createContext as p, useContext as g, useState as m } from "react";
3
- import { cn as s } from "../../utils/cn.js";
4
- const d = p(null), k = ({
1
+ import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
+ import { createContext as v, useContext as T, useState as h } from "react";
3
+ import { cn as o } from "../../utils/cn.js";
4
+ const d = v(null), _ = ({
5
5
  children: a,
6
- defaultTab: t,
7
- variant: e = "line",
8
- onChange: r,
9
- className: o,
6
+ value: t,
7
+ defaultTab: e,
8
+ variant: r = "line",
9
+ onChange: b,
10
+ className: l,
10
11
  testId: c
11
12
  }) => {
12
- const [l, x] = m(t), b = (i) => {
13
- x(i), r == null || r(i);
13
+ const [x, s] = h(e), i = t !== void 0, g = i ? t : x, p = (y) => {
14
+ i || s(y), b == null || b(y);
14
15
  };
15
- return /* @__PURE__ */ n(d.Provider, { value: { activeTab: l, setActiveTab: b, variant: e }, children: /* @__PURE__ */ n("div", { className: s("Bear-Tabs", o), "data-testid": c, children: a }) });
16
- }, w = ({ children: a, className: t }) => {
17
- const e = g(d);
16
+ return /* @__PURE__ */ n(d.Provider, { value: { activeTab: g, setActiveTab: p, variant: r }, children: /* @__PURE__ */ n("div", { className: o("Bear-Tabs", l), "data-testid": c, children: a }) });
17
+ }, f = ({ children: a, className: t }) => {
18
+ const e = T(d);
18
19
  if (!e) throw new Error("TabList must be used within Tabs");
19
20
  const { variant: r } = e;
20
21
  return /* @__PURE__ */ n(
21
22
  "div",
22
23
  {
23
24
  role: "tablist",
24
- className: s(
25
+ className: o(
25
26
  "Bear-Tabs__list",
26
27
  `Bear-Tabs__list--${r}`,
27
28
  "bear-flex bear-gap-1",
@@ -33,35 +34,35 @@ const d = p(null), k = ({
33
34
  children: a
34
35
  }
35
36
  );
36
- }, _ = ({ id: a, children: t, disabled: e = !1, icon: r }) => {
37
- const o = g(d);
38
- if (!o) throw new Error("Tab must be used within Tabs");
39
- const { activeTab: c, setActiveTab: l, variant: x } = o, b = c === a, i = "bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors", y = {
40
- line: s(
37
+ }, B = ({ id: a, children: t, disabled: e = !1, icon: r }) => {
38
+ const b = T(d);
39
+ if (!b) throw new Error("Tab must be used within Tabs");
40
+ const { activeTab: l, setActiveTab: c, variant: x } = b, s = l === a, i = "bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors", g = {
41
+ line: o(
41
42
  "bear-border-b-2 bear--mb-px",
42
- b ? "bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400" : "bear-border-transparent bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-border-gray-300"
43
+ s ? "bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400" : "bear-border-transparent bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-border-gray-300"
43
44
  ),
44
- pills: s(
45
+ pills: o(
45
46
  "bear-rounded-md",
46
- b ? "bear-bg-white dark:bear-bg-gray-700 bear-text-gray-900 dark:bear-text-white bear-shadow-sm" : "bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"
47
+ s ? "bear-bg-white dark:bear-bg-gray-700 bear-text-gray-900 dark:bear-text-white bear-shadow-sm" : "bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"
47
48
  ),
48
- enclosed: s(
49
+ enclosed: o(
49
50
  "bear-rounded-t-lg bear-border bear-border-transparent",
50
- b ? "bear-bg-white dark:bear-bg-gray-900 bear-border-gray-200 dark:bear-border-gray-700 bear-border-b-white dark:bear-border-b-gray-900 bear--mb-px bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"
51
+ s ? "bear-bg-white dark:bear-bg-gray-900 bear-border-gray-200 dark:bear-border-gray-700 bear-border-b-white dark:bear-border-b-gray-900 bear--mb-px bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"
51
52
  )
52
53
  };
53
- return /* @__PURE__ */ T(
54
+ return /* @__PURE__ */ m(
54
55
  "button",
55
56
  {
56
57
  role: "tab",
57
- "aria-selected": b,
58
+ "aria-selected": s,
58
59
  disabled: e,
59
- onClick: () => !e && l(a),
60
- className: s(
60
+ onClick: () => !e && c(a),
61
+ className: o(
61
62
  "Bear-Tabs__tab",
62
- b && "Bear-Tabs__tab--active",
63
+ s && "Bear-Tabs__tab--active",
63
64
  i,
64
- y[x],
65
+ g[x],
65
66
  e && "Bear-Tabs__tab--disabled bear-opacity-50 bear-cursor-not-allowed"
66
67
  ),
67
68
  children: [
@@ -70,15 +71,15 @@ const d = p(null), k = ({
70
71
  ]
71
72
  }
72
73
  );
73
- }, f = ({ tabId: a, children: t, className: e }) => {
74
- const r = g(d);
74
+ }, N = ({ tabId: a, children: t, className: e }) => {
75
+ const r = T(d);
75
76
  if (!r) throw new Error("TabPanel must be used within Tabs");
76
- const { activeTab: o } = r;
77
- return o !== a ? null : /* @__PURE__ */ n("div", { role: "tabpanel", className: s("Bear-Tabs__panel bear-py-4", e), children: t });
77
+ const { activeTab: b } = r;
78
+ return b !== a ? null : /* @__PURE__ */ n("div", { role: "tabpanel", className: o("Bear-Tabs__panel bear-py-4", e), children: t });
78
79
  };
79
80
  export {
80
- _ as Tab,
81
- w as TabList,
82
- f as TabPanel,
83
- k as Tabs
81
+ B as Tab,
82
+ f as TabList,
83
+ N as TabPanel,
84
+ _ as Tabs
84
85
  };
@@ -7,7 +7,9 @@ export interface TabsContextValue {
7
7
  export interface TabsProps {
8
8
  /** Tab panels */
9
9
  children: ReactNode;
10
- /** Default active tab */
10
+ /** Controlled active tab (when set, defaultTab is ignored) */
11
+ value?: string;
12
+ /** Default active tab (uncontrolled) */
11
13
  defaultTab: string;
12
14
  /** Visual variant */
13
15
  variant?: 'line' | 'pills' | 'enclosed';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),y=require("../../utils/cn.cjs"),T=()=>`toast-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,p={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},k=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),C={success:"bear-bg-green-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",warning:"bear-bg-amber-500 bear-text-white",error:"bear-bg-red-500 bear-text-white"},S={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},v=s.createContext(null),I=()=>{const i=s.useContext(v);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},N=({message:i,title:c,severity:b="info",duration:n=5e3,closable:l=!0,icon:r,action:x,onClose:a,onRemove:u,className:m})=>{const[f,d]=s.useState(!1);s.useEffect(()=>{if(n>0){const t=setTimeout(()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},n);return()=>clearTimeout(t)}},[n,u,a]);const g=()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},h=()=>r===!1?null:r||p[b];return e.jsxs("div",{role:"alert",className:y.cn("bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]","bear-transition-all bear-duration-200",f?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",C[b],m),children:[h()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:h()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[c&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:c}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:i})]}),x&&e.jsx("div",{className:"bear-flex-shrink-0",children:x}),l&&e.jsx("button",{type:"button",onClick:g,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(k,{})})]})},w=({position:i="top-right",maxToasts:c=5,className:b})=>{const n=s.useContext(v);if(!n)return null;const{_toasts:l,_removeToast:r}=n,x=l.slice(0,c);return e.jsx("div",{className:y.cn("bear-fixed bear-z-50 bear-flex bear-flex-col bear-gap-2",S[i],b),children:x.map(a=>e.jsx(N,{...a,onRemove:()=>r(a.id)},a.id))})},E=({children:i,position:c="top-right"})=>{const[b,n]=s.useState([]),l=s.useCallback(t=>{n(o=>o.filter(j=>j.id!==t))},[]),r=s.useCallback(t=>{const o=t.id||T();return n(j=>[...j,{...t,id:o}]),o},[]),x=s.useCallback(t=>r(t),[r]),a=s.useCallback((t,o)=>r({message:t,severity:"success",...o}),[r]),u=s.useCallback((t,o)=>r({message:t,severity:"info",...o}),[r]),m=s.useCallback((t,o)=>r({message:t,severity:"warning",...o}),[r]),f=s.useCallback((t,o)=>r({message:t,severity:"error",...o}),[r]),d=s.useCallback(t=>l(t),[l]),g=s.useCallback(()=>n([]),[]),h={toast:x,success:a,info:u,warning:m,error:f,dismiss:d,dismissAll:g,_toasts:b,_removeToast:l};return e.jsxs(v.Provider,{value:h,children:[i,e.jsx(w,{position:c})]})};exports.ToastContainer=w;exports.ToastProvider=E;exports.useToast=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),y=require("../../utils/cn.cjs"),w=require("./Toast.utils.cjs"),p={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},k=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),C={success:"bear-bg-green-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",warning:"bear-bg-amber-500 bear-text-white",error:"bear-bg-red-500 bear-text-white"},S={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},v=s.createContext(null),I=()=>{const i=s.useContext(v);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},N=({message:i,title:c,severity:b="info",duration:n=5e3,closable:l=!0,icon:r,action:x,onClose:a,onRemove:u,className:m})=>{const[f,d]=s.useState(!1);s.useEffect(()=>{if(n>0){const t=setTimeout(()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},n);return()=>clearTimeout(t)}},[n,u,a]);const g=()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},h=()=>r===!1?null:r||p[b];return e.jsxs("div",{role:"alert",className:y.cn("bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]","bear-transition-all bear-duration-200",f?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",C[b],m),children:[h()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:h()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[c&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:c}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:i})]}),x&&e.jsx("div",{className:"bear-flex-shrink-0",children:x}),l&&e.jsx("button",{type:"button",onClick:g,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(k,{})})]})},T=({position:i="top-right",maxToasts:c=5,className:b})=>{const n=s.useContext(v);if(!n)return null;const{_toasts:l,_removeToast:r}=n,x=l.slice(0,c);return e.jsx("div",{className:y.cn("bear-fixed bear-z-50 bear-flex bear-flex-col bear-gap-2",S[i],b),children:x.map(a=>e.jsx(N,{...a,onRemove:()=>r(a.id)},a.id))})},E=({children:i,position:c="top-right"})=>{const[b,n]=s.useState([]),l=s.useCallback(t=>{n(o=>o.filter(j=>j.id!==t))},[]),r=s.useCallback(t=>{const o=t.id||w.generateId();return n(j=>[...j,{...t,id:o}]),o},[]),x=s.useCallback(t=>r(t),[r]),a=s.useCallback((t,o)=>r({message:t,severity:"success",...o}),[r]),u=s.useCallback((t,o)=>r({message:t,severity:"info",...o}),[r]),m=s.useCallback((t,o)=>r({message:t,severity:"warning",...o}),[r]),f=s.useCallback((t,o)=>r({message:t,severity:"error",...o}),[r]),d=s.useCallback(t=>l(t),[l]),g=s.useCallback(()=>n([]),[]),h={toast:x,success:a,info:u,warning:m,error:f,dismiss:d,dismissAll:g,_toasts:b,_removeToast:l};return e.jsxs(v.Provider,{value:h,children:[i,e.jsx(T,{position:c})]})};exports.ToastContainer=T;exports.ToastProvider=E;exports.useToast=I;
@@ -1,7 +1,8 @@
1
1
  import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
2
  import { createContext as I, useContext as y, useState as T, useCallback as i, useEffect as N } from "react";
3
3
  import { cn as k } from "../../utils/cn.js";
4
- const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, S = {
4
+ import { generateId as E } from "./Toast.utils.js";
5
+ const S = {
5
6
  success: /* @__PURE__ */ c("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
6
7
  /* @__PURE__ */ e("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
7
8
  /* @__PURE__ */ e("polyline", { points: "22 4 12 14.01 9 11.01" })
@@ -36,7 +37,7 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
36
37
  "bottom-left": "bear-bottom-4 bear-left-4",
37
38
  "bottom-center": "bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
38
39
  "bottom-right": "bear-bottom-4 bear-right-4"
39
- }, w = I(null), Y = () => {
40
+ }, w = I(null), z = () => {
40
41
  const n = y(w);
41
42
  if (!n)
42
43
  throw new Error("useToast must be used within a ToastProvider");
@@ -47,7 +48,7 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
47
48
  severity: d = "info",
48
49
  duration: o = 5e3,
49
50
  closable: l = !0,
50
- icon: r,
51
+ icon: t,
51
52
  action: h,
52
53
  onClose: a,
53
54
  onRemove: x,
@@ -56,19 +57,19 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
56
57
  const [g, m] = T(!1);
57
58
  N(() => {
58
59
  if (o > 0) {
59
- const t = setTimeout(() => {
60
+ const r = setTimeout(() => {
60
61
  m(!0), setTimeout(() => {
61
62
  x(), a == null || a();
62
63
  }, 200);
63
64
  }, o);
64
- return () => clearTimeout(t);
65
+ return () => clearTimeout(r);
65
66
  }
66
67
  }, [o, x, a]);
67
68
  const p = () => {
68
69
  m(!0), setTimeout(() => {
69
70
  x(), a == null || a();
70
71
  }, 200);
71
- }, u = () => r === !1 ? null : r || S[d];
72
+ }, u = () => t === !1 ? null : t || S[d];
72
73
  return /* @__PURE__ */ c(
73
74
  "div",
74
75
  {
@@ -107,7 +108,7 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
107
108
  }) => {
108
109
  const o = y(w);
109
110
  if (!o) return null;
110
- const { _toasts: l, _removeToast: r } = o, h = l.slice(0, b);
111
+ const { _toasts: l, _removeToast: t } = o, h = l.slice(0, b);
111
112
  return /* @__PURE__ */ e(
112
113
  "div",
113
114
  {
@@ -120,22 +121,22 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
120
121
  C,
121
122
  {
122
123
  ...a,
123
- onRemove: () => r(a.id)
124
+ onRemove: () => t(a.id)
124
125
  },
125
126
  a.id
126
127
  ))
127
128
  }
128
129
  );
129
- }, j = ({
130
+ }, M = ({
130
131
  children: n,
131
132
  position: b = "top-right"
132
133
  }) => {
133
- const [d, o] = T([]), l = i((t) => {
134
- o((s) => s.filter((v) => v.id !== t));
135
- }, []), r = i((t) => {
136
- const s = t.id || E();
137
- return o((v) => [...v, { ...t, id: s }]), s;
138
- }, []), h = i((t) => r(t), [r]), a = i((t, s) => r({ message: t, severity: "success", ...s }), [r]), x = i((t, s) => r({ message: t, severity: "info", ...s }), [r]), f = i((t, s) => r({ message: t, severity: "warning", ...s }), [r]), g = i((t, s) => r({ message: t, severity: "error", ...s }), [r]), m = i((t) => l(t), [l]), p = i(() => o([]), []), u = {
134
+ const [d, o] = T([]), l = i((r) => {
135
+ o((s) => s.filter((v) => v.id !== r));
136
+ }, []), t = i((r) => {
137
+ const s = r.id || E();
138
+ return o((v) => [...v, { ...r, id: s }]), s;
139
+ }, []), h = i((r) => t(r), [t]), a = i((r, s) => t({ message: r, severity: "success", ...s }), [t]), x = i((r, s) => t({ message: r, severity: "info", ...s }), [t]), f = i((r, s) => t({ message: r, severity: "warning", ...s }), [t]), g = i((r, s) => t({ message: r, severity: "error", ...s }), [t]), m = i((r) => l(r), [l]), p = i(() => o([]), []), u = {
139
140
  toast: h,
140
141
  success: a,
141
142
  info: x,
@@ -153,6 +154,6 @@ const E = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
153
154
  };
154
155
  export {
155
156
  L as ToastContainer,
156
- j as ToastProvider,
157
- Y as useToast
157
+ M as ToastProvider,
158
+ z as useToast
158
159
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=()=>`toast-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;exports.generateId=e;
@@ -0,0 +1 @@
1
+ export declare const generateId: () => string;
@@ -0,0 +1,4 @@
1
+ const t = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
2
+ export {
3
+ t as generateId
4
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("react"),j=require("react-dom"),k=require("../../utils/cn.cjs"),v=({content:m,children:x,position:w,placement:R,delay:y=200,className:T,disabled:M=!1})=>{const c=R||w||"top",[l,h]=r.useState(!1),[b,B]=r.useState({x:0,y:0}),u=r.useRef(null),d=r.useRef(null),n=r.useRef(),f=r.useCallback(()=>{if(!u.current||!d.current)return;const e=u.current.getBoundingClientRect(),t=d.current.getBoundingClientRect(),a=8;let o=0,i=0;switch(c){case"top":o=e.left+(e.width-t.width)/2,i=e.top-t.height-a;break;case"bottom":o=e.left+(e.width-t.width)/2,i=e.bottom+a;break;case"left":o=e.left-t.width-a,i=e.top+(e.height-t.height)/2;break;case"right":o=e.right+a,i=e.top+(e.height-t.height)/2;break}o=Math.max(8,Math.min(o,window.innerWidth-t.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-t.height-8)),B({x:o,y:i})},[c]),g=()=>{M||(n.current=setTimeout(()=>{h(!0)},y))},p=()=>{n.current&&clearTimeout(n.current),h(!1)};return r.useEffect(()=>{l&&f()},[l,f]),r.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:u,onMouseEnter:g,onMouseLeave:p,onFocus:g,onBlur:p,className:"Bear-Tooltip__trigger bear-inline-block",children:x}),l&&j.createPortal(s.jsx("div",{ref:d,role:"tooltip",style:{position:"fixed",left:b.x,top:b.y,zIndex:9999},className:k.cn("Bear-Tooltip",`Bear-Tooltip--${c}`,"bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-800 bear-text-white bear-text-sm","bear-border bear-border-gray-700","bear-shadow-lg","bear-animate-in bear-fade-in bear-duration-150",T),children:s.jsx("span",{className:"Bear-Tooltip__content",children:m})}),document.body)]})};exports.Tooltip=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),r=require("react"),j=require("react-dom"),k=require("../../utils/cn.cjs"),v=({content:m,children:x,position:w,placement:R,delay:y=200,className:T,disabled:M=!1})=>{const c=R||w||"top",[l,d]=r.useState(!1),[b,B]=r.useState({x:0,y:0}),u=r.useRef(null),h=r.useRef(null),n=r.useRef(),f=r.useCallback(()=>{if(!u.current||!h.current)return;const e=u.current.getBoundingClientRect(),t=h.current.getBoundingClientRect(),s=8;let o=0,i=0;switch(c){case"top":o=e.left+(e.width-t.width)/2,i=e.top-t.height-s;break;case"bottom":o=e.left+(e.width-t.width)/2,i=e.bottom+s;break;case"left":o=e.left-t.width-s,i=e.top+(e.height-t.height)/2;break;case"right":o=e.right+s,i=e.top+(e.height-t.height)/2;break}o=Math.max(8,Math.min(o,window.innerWidth-t.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-t.height-8)),B({x:o,y:i})},[c]),g=()=>{M||(n.current=setTimeout(()=>{d(!0)},y))},p=()=>{n.current&&clearTimeout(n.current),d(!1)};return r.useEffect(()=>{l&&f()},[l,f]),r.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:u,onMouseEnter:g,onMouseLeave:p,onFocus:g,onBlur:p,className:"Bear-Tooltip__trigger bear-inline-block",children:x}),l&&j.createPortal(a.jsx("div",{ref:h,role:"tooltip",style:{left:b.x,top:b.y},className:k.cn("bear-fixed bear-z-[9999]","Bear-Tooltip",`Bear-Tooltip--${c}`,"bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-800 bear-text-white bear-text-sm","bear-border bear-border-gray-700","bear-shadow-lg","bear-animate-in bear-fade-in bear-duration-150",T),children:a.jsx("span",{className:"Bear-Tooltip__content",children:m})}),document.body)]})};exports.Tooltip=v;
@@ -2,7 +2,7 @@ import { jsxs as C, Fragment as _, jsx as u } from "react/jsx-runtime";
2
2
  import { useState as m, useRef as h, useCallback as E, useEffect as w } from "react";
3
3
  import { createPortal as N } from "react-dom";
4
4
  import { cn as j } from "../../utils/cn.js";
5
- const V = ({
5
+ const z = ({
6
6
  content: x,
7
7
  children: y,
8
8
  position: M,
@@ -30,11 +30,11 @@ const V = ({
30
30
  break;
31
31
  }
32
32
  r = Math.max(8, Math.min(r, window.innerWidth - t.width - 8)), o = Math.max(8, Math.min(o, window.innerHeight - t.height - 8)), v({ x: r, y: o });
33
- }, [a]), p = () => {
33
+ }, [a]), g = () => {
34
34
  k || (i.current = setTimeout(() => {
35
35
  d(!0);
36
36
  }, T));
37
- }, g = () => {
37
+ }, p = () => {
38
38
  i.current && clearTimeout(i.current), d(!1);
39
39
  };
40
40
  return w(() => {
@@ -46,10 +46,10 @@ const V = ({
46
46
  "div",
47
47
  {
48
48
  ref: c,
49
- onMouseEnter: p,
50
- onMouseLeave: g,
51
- onFocus: p,
52
- onBlur: g,
49
+ onMouseEnter: g,
50
+ onMouseLeave: p,
51
+ onFocus: g,
52
+ onBlur: p,
53
53
  className: "Bear-Tooltip__trigger bear-inline-block",
54
54
  children: y
55
55
  }
@@ -61,12 +61,11 @@ const V = ({
61
61
  ref: l,
62
62
  role: "tooltip",
63
63
  style: {
64
- position: "fixed",
65
64
  left: b.x,
66
- top: b.y,
67
- zIndex: 9999
65
+ top: b.y
68
66
  },
69
67
  className: j(
68
+ "bear-fixed bear-z-[9999]",
70
69
  "Bear-Tooltip",
71
70
  `Bear-Tooltip--${a}`,
72
71
  "bear-px-3 bear-py-2 bear-rounded-lg",
@@ -84,5 +83,5 @@ const V = ({
84
83
  ] });
85
84
  };
86
85
  export {
87
- V as Tooltip
86
+ z as Tooltip
88
87
  };