@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,30 +1,14 @@
1
- import { jsx as t, jsxs as h } from "react/jsx-runtime";
2
- import { useMemo as C } from "react";
1
+ import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
+ import { useMemo as b } from "react";
3
3
  import { cn as d } from "../../utils/cn.js";
4
- const L = [
5
- "#ec4899",
6
- // pink
7
- "#8b5cf6",
8
- // purple
9
- "#3b82f6",
10
- // blue
11
- "#10b981",
12
- // emerald
13
- "#f59e0b",
14
- // amber
15
- "#ef4444",
16
- // red
17
- "#06b6d4",
18
- // cyan
19
- "#84cc16"
20
- // lime
21
- ], k = (l, o) => o || L[l % L.length], R = ({
4
+ import { getChartColor as k } from "./Chart.utils.js";
5
+ const R = ({
22
6
  data: l,
23
- height: o = 200,
7
+ height: i = 200,
24
8
  showLabels: p = !0,
25
9
  showValues: $ = !1,
26
- animated: f = !0,
27
- color: m,
10
+ animated: m = !0,
11
+ color: h,
28
12
  orientation: g = "vertical",
29
13
  barRadius: u = 4,
30
14
  barGap: v = 0.2,
@@ -32,15 +16,15 @@ const L = [
32
16
  ...N
33
17
  }) => {
34
18
  const n = Math.max(...l.map((s) => s.value));
35
- return /* @__PURE__ */ t("div", { className: d("w-full", y), style: { height: o }, ...N, children: g === "vertical" ? /* @__PURE__ */ t("div", { className: "flex items-end justify-between h-full gap-2", children: l.map((s, r) => {
36
- const e = s.value / n * 100, a = k(r, s.color || m);
37
- return /* @__PURE__ */ h("div", { className: "flex-1 flex flex-col items-center gap-1", children: [
19
+ return /* @__PURE__ */ t("div", { className: d("w-full", y), style: { height: i }, ...N, children: g === "vertical" ? /* @__PURE__ */ t("div", { className: "flex items-end justify-between h-full gap-2", children: l.map((s, r) => {
20
+ const e = s.value / n * 100, a = k(r, s.color || h);
21
+ return /* @__PURE__ */ f("div", { className: "flex-1 flex flex-col items-center gap-1", children: [
38
22
  /* @__PURE__ */ t("div", { className: "w-full flex-1 flex items-end", children: /* @__PURE__ */ t(
39
23
  "div",
40
24
  {
41
25
  className: d(
42
26
  "w-full transition-all duration-500 ease-out",
43
- f && "animate-grow-up"
27
+ m && "animate-grow-up"
44
28
  ),
45
29
  style: {
46
30
  height: `${e}%`,
@@ -54,15 +38,15 @@ const L = [
54
38
  p && /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300 truncate max-w-full", children: s.label })
55
39
  ] }, r);
56
40
  }) }) : /* @__PURE__ */ t("div", { className: "flex flex-col justify-between h-full gap-2", children: l.map((s, r) => {
57
- const e = s.value / n * 100, a = k(r, s.color || m);
58
- return /* @__PURE__ */ h("div", { className: "flex-1 flex items-center gap-2", children: [
41
+ const e = s.value / n * 100, a = k(r, s.color || h);
42
+ return /* @__PURE__ */ f("div", { className: "flex-1 flex items-center gap-2", children: [
59
43
  p && /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300 w-16 truncate", children: s.label }),
60
44
  /* @__PURE__ */ t("div", { className: "flex-1 h-full flex items-center", children: /* @__PURE__ */ t(
61
45
  "div",
62
46
  {
63
47
  className: d(
64
48
  "h-3/4 transition-all duration-500 ease-out",
65
- f && "animate-grow-right"
49
+ m && "animate-grow-right"
66
50
  ),
67
51
  style: {
68
52
  width: `${e}%`,
@@ -75,38 +59,38 @@ const L = [
75
59
  $ && /* @__PURE__ */ t("span", { className: "text-xs text-gray-500 dark:text-slate-400 w-10 text-right", children: s.value })
76
60
  ] }, r);
77
61
  }) }) });
78
- }, A = ({
62
+ }, j = ({
79
63
  data: l,
80
- height: o = 200,
64
+ height: i = 200,
81
65
  showLabels: p = !0,
82
66
  showDots: $ = !0,
83
- smooth: f = !0,
84
- fill: m = !1,
67
+ smooth: m = !0,
68
+ fill: h = !1,
85
69
  strokeWidth: g = 2,
86
70
  color: u = "#ec4899",
87
71
  animated: v = !0,
88
72
  className: y,
89
73
  ...N
90
74
  }) => {
91
- const n = C(() => {
92
- const e = Math.max(...l.map((c) => c.value)), a = Math.min(...l.map((c) => c.value)), i = e - a || 1;
75
+ const n = b(() => {
76
+ const e = Math.max(...l.map((c) => c.value)), a = Math.min(...l.map((c) => c.value)), o = e - a || 1;
93
77
  return l.map((c, x) => ({
94
78
  x: x / (l.length - 1 || 1) * 100,
95
- y: 100 - (c.value - a) / i * 80 - 10,
79
+ y: 100 - (c.value - a) / o * 80 - 10,
96
80
  ...c
97
81
  }));
98
- }, [l]), s = C(() => n.length === 0 ? "" : f ? n.reduce((e, a, i, c) => {
99
- if (i === 0) return `M ${a.x},${a.y}`;
100
- const x = c[i - 1], b = x.x + (a.x - x.x) / 3, w = a.x - (a.x - x.x) / 3;
101
- return `${e} C ${b},${x.y} ${w},${a.y} ${a.x},${a.y}`;
102
- }, "") : n.reduce((e, a, i) => `${e} ${i === 0 ? "M" : "L"} ${a.x},${a.y}`, ""), [n, f]), r = C(() => n.length === 0 ? "" : `${s} L 100,100 L 0,100 Z`, [s, n]);
103
- return /* @__PURE__ */ h("div", { className: d("w-full", y), style: { height: o }, ...N, children: [
104
- /* @__PURE__ */ h("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "w-full h-full", children: [
105
- /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ h("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
82
+ }, [l]), s = b(() => n.length === 0 ? "" : m ? n.reduce((e, a, o, c) => {
83
+ if (o === 0) return `M ${a.x},${a.y}`;
84
+ const x = c[o - 1], w = x.x + (a.x - x.x) / 3, C = a.x - (a.x - x.x) / 3;
85
+ return `${e} C ${w},${x.y} ${C},${a.y} ${a.x},${a.y}`;
86
+ }, "") : n.reduce((e, a, o) => `${e} ${o === 0 ? "M" : "L"} ${a.x},${a.y}`, ""), [n, m]), r = b(() => n.length === 0 ? "" : `${s} L 100,100 L 0,100 Z`, [s, n]);
87
+ return /* @__PURE__ */ f("div", { className: d("w-full", y), style: { height: i }, ...N, children: [
88
+ /* @__PURE__ */ f("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "w-full h-full", children: [
89
+ /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ f("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
106
90
  /* @__PURE__ */ t("stop", { offset: "0%", stopColor: u, stopOpacity: "0.3" }),
107
91
  /* @__PURE__ */ t("stop", { offset: "100%", stopColor: u, stopOpacity: "0" })
108
92
  ] }) }),
109
- m && /* @__PURE__ */ t(
93
+ h && /* @__PURE__ */ t(
110
94
  "path",
111
95
  {
112
96
  d: r,
@@ -141,40 +125,40 @@ const L = [
141
125
  ] }),
142
126
  p && /* @__PURE__ */ t("div", { className: "flex justify-between mt-2", children: l.map((e, a) => /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300", children: e.label }, a)) })
143
127
  ] });
144
- }, j = ({
128
+ }, L = ({
145
129
  data: l,
146
- height: o = 200,
130
+ height: i = 200,
147
131
  showLabels: p = !0,
148
132
  innerRadius: $ = 0,
149
- startAngle: f = -90,
150
- padAngle: m = 2,
133
+ startAngle: m = -90,
134
+ padAngle: h = 2,
151
135
  animated: g = !0,
152
136
  className: u,
153
137
  ...v
154
138
  }) => {
155
- const y = l.reduce((r, e) => r + e.value, 0), N = C(() => {
156
- let r = f;
139
+ const y = l.reduce((r, e) => r + e.value, 0), N = b(() => {
140
+ let r = m;
157
141
  return l.map((e, a) => {
158
- const i = e.value / y * 360 - m, c = {
142
+ const o = e.value / y * 360 - h, c = {
159
143
  startAngle: r,
160
- endAngle: r + i,
144
+ endAngle: r + o,
161
145
  color: k(a, e.color),
162
146
  ...e
163
147
  };
164
- return r += i + m, c;
148
+ return r += o + h, c;
165
149
  });
166
- }, [l, y, f, m]), n = (r, e) => {
150
+ }, [l, y, m, h]), n = (r, e) => {
167
151
  const a = r * Math.PI / 180;
168
152
  return {
169
153
  x: 50 + e * Math.cos(a),
170
154
  y: 50 + e * Math.sin(a)
171
155
  };
172
156
  }, s = (r, e) => {
173
- const i = $ * 45, c = n(r, 45), x = n(e, 45), b = n(r, i), w = n(e, i), M = e - r > 180 ? 1 : 0;
174
- return $ > 0 ? `M ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} L ${w.x},${w.y} A ${i},${i} 0 ${M},0 ${b.x},${b.y} Z` : `M 50,50 L ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} Z`;
157
+ const o = $ * 45, c = n(r, 45), x = n(e, 45), w = n(r, o), C = n(e, o), M = e - r > 180 ? 1 : 0;
158
+ return $ > 0 ? `M ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} L ${C.x},${C.y} A ${o},${o} 0 ${M},0 ${w.x},${w.y} Z` : `M 50,50 L ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} Z`;
175
159
  };
176
- return /* @__PURE__ */ h("div", { className: d("flex items-center gap-4", u), ...v, children: [
177
- /* @__PURE__ */ t("div", { style: { width: o, height: o }, children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 100", className: "w-full h-full", children: N.map((r, e) => /* @__PURE__ */ t(
160
+ return /* @__PURE__ */ f("div", { className: d("flex items-center gap-4", u), ...v, children: [
161
+ /* @__PURE__ */ t("div", { style: { width: i, height: i }, children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 100", className: "w-full h-full", children: N.map((r, e) => /* @__PURE__ */ t(
178
162
  "path",
179
163
  {
180
164
  d: s(r.startAngle, r.endAngle),
@@ -187,7 +171,7 @@ const L = [
187
171
  },
188
172
  e
189
173
  )) }) }),
190
- p && /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", children: l.map((r, e) => /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
174
+ p && /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", children: l.map((r, e) => /* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
191
175
  /* @__PURE__ */ t(
192
176
  "div",
193
177
  {
@@ -196,30 +180,30 @@ const L = [
196
180
  }
197
181
  ),
198
182
  /* @__PURE__ */ t("span", { className: "text-sm text-gray-600 dark:text-slate-300", children: r.label }),
199
- /* @__PURE__ */ h("span", { className: "text-sm text-gray-400 dark:text-slate-500", children: [
183
+ /* @__PURE__ */ f("span", { className: "text-sm text-gray-400 dark:text-slate-500", children: [
200
184
  Math.round(r.value / y * 100),
201
185
  "%"
202
186
  ] })
203
187
  ] }, e)) })
204
188
  ] });
205
- }, I = ({ type: l, ...o }) => {
189
+ }, P = ({ type: l, ...i }) => {
206
190
  switch (l) {
207
191
  case "bar":
208
- return /* @__PURE__ */ t(R, { ...o });
192
+ return /* @__PURE__ */ t(R, { ...i });
209
193
  case "line":
210
194
  case "area":
211
- return /* @__PURE__ */ t(A, { ...o, fill: l === "area" });
195
+ return /* @__PURE__ */ t(j, { ...i, fill: l === "area" });
212
196
  case "pie":
213
- return /* @__PURE__ */ t(j, { ...o });
197
+ return /* @__PURE__ */ t(L, { ...i });
214
198
  case "donut":
215
- return /* @__PURE__ */ t(j, { ...o, innerRadius: 0.6 });
199
+ return /* @__PURE__ */ t(L, { ...i, innerRadius: 0.6 });
216
200
  default:
217
- return /* @__PURE__ */ t(R, { ...o });
201
+ return /* @__PURE__ */ t(R, { ...i });
218
202
  }
219
203
  };
220
204
  export {
221
205
  R as BarChart,
222
- I as Chart,
223
- A as LineChart,
224
- j as PieChart
206
+ P as Chart,
207
+ j as LineChart,
208
+ L as PieChart
225
209
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./Chart.const.cjs"),o=(e,r)=>r||t.DEFAULT_COLORS[e%t.DEFAULT_COLORS.length];exports.getChartColor=o;
@@ -0,0 +1,5 @@
1
+ import { DEFAULT_COLORS as r } from "./Chart.const.js";
2
+ const n = (t, o) => o || r[t % r.length];
3
+ export {
4
+ n as getChartColor
5
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),n=require("react"),g=require("../../utils/cn.cjs"),r=require("./Confetti.const.cjs"),v=({active:E=!1,count:c=r.CONFETTI_DEFAULTS.COUNT,duration:h=r.CONFETTI_DEFAULTS.DURATION,colors:T=r.CONFETTI_COLORS,originX:I=r.CONFETTI_DEFAULTS.ORIGIN_X,originY:f=r.CONFETTI_DEFAULTS.ORIGIN_Y,spread:F=r.CONFETTI_DEFAULTS.SPREAD,velocity:S=r.CONFETTI_DEFAULTS.VELOCITY,gravity:O=r.CONFETTI_DEFAULTS.GRAVITY,autoHide:N=r.CONFETTI_DEFAULTS.AUTO_HIDE,onComplete:o,className:x,testId:y})=>{const[m,d]=n.useState([]),[b,A]=n.useState(!1),a=n.useRef(),i=n.useRef(0),_=n.useCallback(()=>{const t=[],l=F*Math.PI/180;for(let s=0;s<c;s++){const e=-Math.PI/2+(Math.random()-.5)*l,C=S*(.5+Math.random()*.5);t.push({id:s,x:I*100,y:f*100,rotation:Math.random()*360,color:T[Math.floor(Math.random()*T.length)],size:r.CONFETTI_SIZE_RANGE.min+Math.random()*(r.CONFETTI_SIZE_RANGE.max-r.CONFETTI_SIZE_RANGE.min),velocity:{x:Math.cos(e)*C,y:Math.sin(e)*C},rotationSpeed:(Math.random()-.5)*20,shape:r.CONFETTI_SHAPES[Math.floor(Math.random()*r.CONFETTI_SHAPES.length)]})}return t},[c,T,I,f,F,S]),u=n.useCallback(t=>{if(i.current||(i.current=t),t-i.current>=h&&N){A(!1),d([]),o==null||o();return}d(s=>s.map(e=>({...e,x:e.x+e.velocity.x*.1,y:e.y+e.velocity.y*.1,rotation:e.rotation+e.rotationSpeed,velocity:{x:e.velocity.x*.99,y:e.velocity.y+O}}))),a.current=requestAnimationFrame(u)},[h,O,N,o]);n.useEffect(()=>(E?(A(!0),d(_()),i.current=0,a.current=requestAnimationFrame(u)):a.current&&cancelAnimationFrame(a.current),()=>{a.current&&cancelAnimationFrame(a.current)}),[E,_,u]);const M=t=>{const l={position:"absolute",left:`${t.x}%`,top:`${t.y}%`,width:t.size,height:t.size,transform:`rotate(${t.rotation}deg)`,backgroundColor:t.shape!=="triangle"?t.color:"transparent",borderRadius:t.shape==="circle"?"50%":0,borderLeft:t.shape==="triangle"?`${t.size/2}px solid transparent`:void 0,borderRight:t.shape==="triangle"?`${t.size/2}px solid transparent`:void 0,borderBottom:t.shape==="triangle"?`${t.size}px solid ${t.color}`:void 0,opacity:.9};return R.jsx("div",{style:l},t.id)};return!b||m.length===0?null:R.jsx("div",{className:g.cn("Bear-Confetti","bear-fixed bear-inset-0 bear-pointer-events-none bear-overflow-hidden",x),style:{zIndex:99999},"data-testid":y,children:m.map(M)})};exports.Confetti=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),a=require("react"),R=require("../../utils/cn.cjs"),r=require("./Confetti.const.cjs"),v=({active:c=!1,count:E=r.CONFETTI_DEFAULTS.COUNT,duration:h=r.CONFETTI_DEFAULTS.DURATION,colors:T=r.CONFETTI_COLORS,originX:f=r.CONFETTI_DEFAULTS.ORIGIN_X,originY:I=r.CONFETTI_DEFAULTS.ORIGIN_Y,spread:F=r.CONFETTI_DEFAULTS.SPREAD,velocity:S=r.CONFETTI_DEFAULTS.VELOCITY,gravity:N=r.CONFETTI_DEFAULTS.GRAVITY,autoHide:O=r.CONFETTI_DEFAULTS.AUTO_HIDE,onComplete:o,className:x,testId:y})=>{const[m,d]=a.useState([]),[M,A]=a.useState(!1),n=a.useRef(),i=a.useRef(0),_=a.useCallback(()=>{const t=[],l=F*Math.PI/180;for(let s=0;s<E;s++){const e=-Math.PI/2+(Math.random()-.5)*l,b=S*(.5+Math.random()*.5);t.push({id:s,x:f*100,y:I*100,rotation:Math.random()*360,color:T[Math.floor(Math.random()*T.length)],size:r.CONFETTI_SIZE_RANGE.min+Math.random()*(r.CONFETTI_SIZE_RANGE.max-r.CONFETTI_SIZE_RANGE.min),velocity:{x:Math.cos(e)*b,y:Math.sin(e)*b},rotationSpeed:(Math.random()-.5)*20,shape:r.CONFETTI_SHAPES[Math.floor(Math.random()*r.CONFETTI_SHAPES.length)]})}return t},[E,T,f,I,F,S]),u=a.useCallback(t=>{if(i.current||(i.current=t),t-i.current>=h&&O){A(!1),d([]),o==null||o();return}d(s=>s.map(e=>({...e,x:e.x+e.velocity.x*.1,y:e.y+e.velocity.y*.1,rotation:e.rotation+e.rotationSpeed,velocity:{x:e.velocity.x*.99,y:e.velocity.y+N}}))),n.current=requestAnimationFrame(u)},[h,N,O,o]);a.useEffect(()=>(c?(A(!0),d(_()),i.current=0,n.current=requestAnimationFrame(u)):n.current&&cancelAnimationFrame(n.current),()=>{n.current&&cancelAnimationFrame(n.current)}),[c,_,u]);const g=t=>{const l={left:`${t.x}%`,top:`${t.y}%`,width:t.size,height:t.size,transform:`rotate(${t.rotation}deg)`,backgroundColor:t.shape!=="triangle"?t.color:"transparent",borderLeft:t.shape==="triangle"?`${t.size/2}px solid transparent`:void 0,borderRight:t.shape==="triangle"?`${t.size/2}px solid transparent`:void 0,borderBottom:t.shape==="triangle"?`${t.size}px solid ${t.color}`:void 0};return C.jsx("div",{className:R.cn("bear-absolute bear-opacity-90",t.shape==="circle"&&"bear-rounded-full"),style:l},t.id)};return!M||m.length===0?null:C.jsx("div",{className:R.cn("Bear-Confetti","bear-fixed bear-inset-0 bear-pointer-events-none bear-overflow-hidden bear-z-[99999]",x),"data-testid":y,children:m.map(g)})};exports.Confetti=v;
@@ -1,30 +1,30 @@
1
- import { jsx as g } from "react/jsx-runtime";
2
- import { useState as v, useRef as N, useCallback as S, useEffect as C } from "react";
3
- import { cn as D } from "../../utils/cn.js";
4
- import { CONFETTI_DEFAULTS as a, CONFETTI_SHAPES as F, CONFETTI_COLORS as G, CONFETTI_SIZE_RANGE as f } from "./Confetti.const.js";
1
+ import { jsx as N } from "react/jsx-runtime";
2
+ import { useState as g, useRef as v, useCallback as S, useEffect as D } from "react";
3
+ import { cn as F } from "../../utils/cn.js";
4
+ import { CONFETTI_DEFAULTS as a, CONFETTI_SHAPES as _, CONFETTI_COLORS as G, CONFETTI_SIZE_RANGE as f } from "./Confetti.const.js";
5
5
  const k = ({
6
6
  active: m = !1,
7
7
  count: u = a.COUNT,
8
8
  duration: c = a.DURATION,
9
9
  colors: l = G,
10
- originX: I = a.ORIGIN_X,
11
- originY: x = a.ORIGIN_Y,
12
- spread: y = a.SPREAD,
10
+ originX: b = a.ORIGIN_X,
11
+ originY: I = a.ORIGIN_Y,
12
+ spread: x = a.SPREAD,
13
13
  velocity: T = a.VELOCITY,
14
- gravity: b = a.GRAVITY,
14
+ gravity: y = a.GRAVITY,
15
15
  autoHide: M = a.AUTO_HIDE,
16
16
  onComplete: o,
17
- className: _,
18
- testId: z
17
+ className: z,
18
+ testId: P
19
19
  }) => {
20
- const [R, d] = v([]), [P, E] = v(!1), n = N(), s = N(0), O = S(() => {
21
- const t = [], i = y * Math.PI / 180;
20
+ const [E, d] = g([]), [$, O] = g(!1), n = v(), s = v(0), R = S(() => {
21
+ const t = [], i = x * Math.PI / 180;
22
22
  for (let e = 0; e < u; e++) {
23
23
  const r = -Math.PI / 2 + (Math.random() - 0.5) * i, A = T * (0.5 + Math.random() * 0.5);
24
24
  t.push({
25
25
  id: e,
26
- x: I * 100,
27
- y: x * 100,
26
+ x: b * 100,
27
+ y: I * 100,
28
28
  rotation: Math.random() * 360,
29
29
  color: l[Math.floor(Math.random() * l.length)],
30
30
  size: f.min + Math.random() * (f.max - f.min),
@@ -33,13 +33,13 @@ const k = ({
33
33
  y: Math.sin(r) * A
34
34
  },
35
35
  rotationSpeed: (Math.random() - 0.5) * 20,
36
- shape: F[Math.floor(Math.random() * F.length)]
36
+ shape: _[Math.floor(Math.random() * _.length)]
37
37
  });
38
38
  }
39
39
  return t;
40
- }, [u, l, I, x, y, T]), h = S((t) => {
40
+ }, [u, l, b, I, x, T]), h = S((t) => {
41
41
  if (s.current || (s.current = t), t - s.current >= c && M) {
42
- E(!1), d([]), o == null || o();
42
+ O(!1), d([]), o == null || o();
43
43
  return;
44
44
  }
45
45
  d(
@@ -50,42 +50,45 @@ const k = ({
50
50
  rotation: r.rotation + r.rotationSpeed,
51
51
  velocity: {
52
52
  x: r.velocity.x * 0.99,
53
- y: r.velocity.y + b
53
+ y: r.velocity.y + y
54
54
  }
55
55
  }))
56
56
  ), n.current = requestAnimationFrame(h);
57
- }, [c, b, M, o]);
58
- C(() => (m ? (E(!0), d(O()), s.current = 0, n.current = requestAnimationFrame(h)) : n.current && cancelAnimationFrame(n.current), () => {
57
+ }, [c, y, M, o]);
58
+ D(() => (m ? (O(!0), d(R()), s.current = 0, n.current = requestAnimationFrame(h)) : n.current && cancelAnimationFrame(n.current), () => {
59
59
  n.current && cancelAnimationFrame(n.current);
60
- }), [m, O, h]);
61
- const $ = (t) => {
60
+ }), [m, R, h]);
61
+ const C = (t) => {
62
62
  const i = {
63
- position: "absolute",
64
63
  left: `${t.x}%`,
65
64
  top: `${t.y}%`,
66
65
  width: t.size,
67
66
  height: t.size,
68
67
  transform: `rotate(${t.rotation}deg)`,
69
68
  backgroundColor: t.shape !== "triangle" ? t.color : "transparent",
70
- borderRadius: t.shape === "circle" ? "50%" : 0,
71
69
  borderLeft: t.shape === "triangle" ? `${t.size / 2}px solid transparent` : void 0,
72
70
  borderRight: t.shape === "triangle" ? `${t.size / 2}px solid transparent` : void 0,
73
- borderBottom: t.shape === "triangle" ? `${t.size}px solid ${t.color}` : void 0,
74
- opacity: 0.9
71
+ borderBottom: t.shape === "triangle" ? `${t.size}px solid ${t.color}` : void 0
75
72
  };
76
- return /* @__PURE__ */ g("div", { style: i }, t.id);
73
+ return /* @__PURE__ */ N(
74
+ "div",
75
+ {
76
+ className: F("bear-absolute bear-opacity-90", t.shape === "circle" && "bear-rounded-full"),
77
+ style: i
78
+ },
79
+ t.id
80
+ );
77
81
  };
78
- return !P || R.length === 0 ? null : /* @__PURE__ */ g(
82
+ return !$ || E.length === 0 ? null : /* @__PURE__ */ N(
79
83
  "div",
80
84
  {
81
- className: D(
85
+ className: F(
82
86
  "Bear-Confetti",
83
- "bear-fixed bear-inset-0 bear-pointer-events-none bear-overflow-hidden",
84
- _
87
+ "bear-fixed bear-inset-0 bear-pointer-events-none bear-overflow-hidden bear-z-[99999]",
88
+ z
85
89
  ),
86
- style: { zIndex: 99999 },
87
- "data-testid": z,
88
- children: R.map($)
90
+ "data-testid": P,
91
+ children: E.map(C)
89
92
  }
90
93
  );
91
94
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),j=require("../../utils/cn.cjs"),l=require("./ContextMenu.const.cjs"),L=i=>"type"in i&&i.type==="divider",b=({items:i,position:d,onClose:u})=>{const[c,o]=r.useState(null),[a,S]=r.useState({x:0,y:0}),x=r.useRef(null),E=r.useCallback(s=>{var e;s.disabled||s.children||((e=s.onClick)==null||e.call(s),u())},[u]),f=r.useCallback((s,e)=>{if(s.children){const n=e.currentTarget.getBoundingClientRect();S({x:n.right+l.SUB_MENU_OFFSET,y:n.top}),o(s.id)}else o(null)},[]);return t.jsx("div",{ref:x,className:l.MENU_CLASSES,style:{left:d.x,top:d.y},role:"menu",children:i.map(s=>{if(L(s))return t.jsx("div",{className:l.DIVIDER_CLASSES,role:"separator"},s.id);const e=s;return t.jsxs("div",{children:[t.jsxs("div",{className:j.cn(l.ITEM_CLASSES,e.disabled&&l.ITEM_DISABLED_CLASSES,e.danger&&l.ITEM_DANGER_CLASSES),onClick:()=>E(e),onMouseEnter:n=>f(e,n),role:"menuitem","aria-disabled":e.disabled,children:[t.jsxs("span",{className:"bear-flex bear-items-center",children:[e.icon&&t.jsx("span",{className:l.ICON_CLASSES,children:e.icon}),e.label]}),t.jsxs("span",{className:"bear-flex bear-items-center",children:[e.shortcut&&t.jsx("span",{className:l.SHORTCUT_CLASSES,children:e.shortcut}),e.children&&t.jsx("span",{className:l.SUB_INDICATOR_CLASSES,children:"▸"})]})]}),e.children&&c===e.id&&t.jsx(b,{items:e.children,position:a,onClose:u})]},e.id)})})},M=({items:i,children:d,disabled:u=!1,onOpenChange:c,testId:o})=>{const[a,S]=r.useState(!1),[x,E]=r.useState({x:0,y:0}),f=r.useRef(null),s=r.useCallback(()=>{S(!1),c==null||c(!1)},[c]),e=r.useCallback(n=>{u||(n.preventDefault(),E({x:n.clientX,y:n.clientY}),S(!0),c==null||c(!0))},[u,c]);return r.useEffect(()=>{if(!a)return;const n=()=>s(),m=v=>{v.key==="Escape"&&s()};return document.addEventListener("mousedown",n),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",m)}},[a,s]),t.jsxs("div",{ref:f,onContextMenu:e,"data-testid":o,children:[d,a&&t.jsx(b,{items:i,position:x,onClose:s})]})};exports.ContextMenu=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),_=require("../../utils/cn.cjs"),l=require("./ContextMenu.const.cjs"),j=require("./ContextMenu.utils.cjs"),b=({items:S,position:a,onClose:i})=>{const[c,o]=r.useState(null),[u,d]=r.useState({x:0,y:0}),x=r.useRef(null),E=r.useCallback(s=>{var e;s.disabled||s.children||((e=s.onClick)==null||e.call(s),i())},[i]),f=r.useCallback((s,e)=>{if(s.children){const n=e.currentTarget.getBoundingClientRect();d({x:n.right+l.SUB_MENU_OFFSET,y:n.top}),o(s.id)}else o(null)},[]);return t.jsx("div",{ref:x,className:l.MENU_CLASSES,style:{left:a.x,top:a.y},role:"menu",children:S.map(s=>{if(j.isDivider(s))return t.jsx("div",{className:l.DIVIDER_CLASSES,role:"separator"},s.id);const e=s;return t.jsxs("div",{children:[t.jsxs("div",{className:_.cn(l.ITEM_CLASSES,e.disabled&&l.ITEM_DISABLED_CLASSES,e.danger&&l.ITEM_DANGER_CLASSES),onClick:()=>E(e),onMouseEnter:n=>f(e,n),role:"menuitem","aria-disabled":e.disabled,children:[t.jsxs("span",{className:"bear-flex bear-items-center",children:[e.icon&&t.jsx("span",{className:l.ICON_CLASSES,children:e.icon}),e.label]}),t.jsxs("span",{className:"bear-flex bear-items-center",children:[e.shortcut&&t.jsx("span",{className:l.SHORTCUT_CLASSES,children:e.shortcut}),e.children&&t.jsx("span",{className:l.SUB_INDICATOR_CLASSES,children:"▸"})]})]}),e.children&&c===e.id&&t.jsx(b,{items:e.children,position:u,onClose:i})]},e.id)})})},v=({items:S,children:a,disabled:i=!1,onOpenChange:c,testId:o})=>{const[u,d]=r.useState(!1),[x,E]=r.useState({x:0,y:0}),f=r.useRef(null),s=r.useCallback(()=>{d(!1),c==null||c(!1)},[c]),e=r.useCallback(n=>{i||(n.preventDefault(),E({x:n.clientX,y:n.clientY}),d(!0),c==null||c(!0))},[i,c]);return r.useEffect(()=>{if(!u)return;const n=()=>s(),m=M=>{M.key==="Escape"&&s()};return document.addEventListener("mousedown",n),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",m)}},[u,s]),t.jsxs("div",{ref:f,onContextMenu:e,"data-testid":o,children:[a,u&&t.jsx(b,{items:S,position:x,onClose:s})]})};exports.ContextMenu=v;
@@ -1,23 +1,24 @@
1
- import { jsxs as d, jsx as n } from "react/jsx-runtime";
2
- import { useState as S, useRef as L, useCallback as m, useEffect as N } from "react";
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { useState as u, useRef as b, useCallback as S, useEffect as N } from "react";
3
3
  import { cn as _ } from "../../utils/cn.js";
4
- import { SUB_MENU_OFFSET as h, MENU_CLASSES as A, DIVIDER_CLASSES as I, ICON_CLASSES as M, SHORTCUT_CLASSES as y, SUB_INDICATOR_CLASSES as k, ITEM_DANGER_CLASSES as C, ITEM_DISABLED_CLASSES as D, ITEM_CLASSES as R } from "./ContextMenu.const.js";
5
- const T = (c) => "type" in c && c.type === "divider", b = ({ items: c, position: o, onClose: l }) => {
6
- const [r, a] = S(null), [i, u] = S({ x: 0, y: 0 }), f = L(null), E = m((s) => {
4
+ import { SUB_MENU_OFFSET as h, MENU_CLASSES as A, DIVIDER_CLASSES as I, ICON_CLASSES as M, SHORTCUT_CLASSES as k, SUB_INDICATOR_CLASSES as y, ITEM_DANGER_CLASSES as C, ITEM_DISABLED_CLASSES as D, ITEM_CLASSES as R } from "./ContextMenu.const.js";
5
+ import { isDivider as T } from "./ContextMenu.utils.js";
6
+ const v = ({ items: m, position: o, onClose: c }) => {
7
+ const [r, d] = u(null), [l, a] = u({ x: 0, y: 0 }), f = b(null), E = S((s) => {
7
8
  var e;
8
- s.disabled || s.children || ((e = s.onClick) == null || e.call(s), l());
9
- }, [l]), p = m((s, e) => {
9
+ s.disabled || s.children || ((e = s.onClick) == null || e.call(s), c());
10
+ }, [c]), p = S((s, e) => {
10
11
  if (s.children) {
11
12
  const t = e.currentTarget.getBoundingClientRect();
12
- u({ x: t.right + h, y: t.top }), a(s.id);
13
+ a({ x: t.right + h, y: t.top }), d(s.id);
13
14
  } else
14
- a(null);
15
+ d(null);
15
16
  }, []);
16
- return /* @__PURE__ */ n("div", { ref: f, className: A, style: { left: o.x, top: o.y }, role: "menu", children: c.map((s) => {
17
+ return /* @__PURE__ */ n("div", { ref: f, className: A, style: { left: o.x, top: o.y }, role: "menu", children: m.map((s) => {
17
18
  if (T(s)) return /* @__PURE__ */ n("div", { className: I, role: "separator" }, s.id);
18
19
  const e = s;
19
- return /* @__PURE__ */ d("div", { children: [
20
- /* @__PURE__ */ d(
20
+ return /* @__PURE__ */ i("div", { children: [
21
+ /* @__PURE__ */ i(
21
22
  "div",
22
23
  {
23
24
  className: _(R, e.disabled && D, e.danger && C),
@@ -26,39 +27,39 @@ const T = (c) => "type" in c && c.type === "divider", b = ({ items: c, position:
26
27
  role: "menuitem",
27
28
  "aria-disabled": e.disabled,
28
29
  children: [
29
- /* @__PURE__ */ d("span", { className: "bear-flex bear-items-center", children: [
30
+ /* @__PURE__ */ i("span", { className: "bear-flex bear-items-center", children: [
30
31
  e.icon && /* @__PURE__ */ n("span", { className: M, children: e.icon }),
31
32
  e.label
32
33
  ] }),
33
- /* @__PURE__ */ d("span", { className: "bear-flex bear-items-center", children: [
34
- e.shortcut && /* @__PURE__ */ n("span", { className: y, children: e.shortcut }),
35
- e.children && /* @__PURE__ */ n("span", { className: k, children: "▸" })
34
+ /* @__PURE__ */ i("span", { className: "bear-flex bear-items-center", children: [
35
+ e.shortcut && /* @__PURE__ */ n("span", { className: k, children: e.shortcut }),
36
+ e.children && /* @__PURE__ */ n("span", { className: y, children: "▸" })
36
37
  ] })
37
38
  ]
38
39
  }
39
40
  ),
40
- e.children && r === e.id && /* @__PURE__ */ n(b, { items: e.children, position: i, onClose: l })
41
+ e.children && r === e.id && /* @__PURE__ */ n(v, { items: e.children, position: l, onClose: c })
41
42
  ] }, e.id);
42
43
  }) });
43
- }, j = ({ items: c, children: o, disabled: l = !1, onOpenChange: r, testId: a }) => {
44
- const [i, u] = S(!1), [f, E] = S({ x: 0, y: 0 }), p = L(null), s = m(() => {
45
- u(!1), r == null || r(!1);
46
- }, [r]), e = m((t) => {
47
- l || (t.preventDefault(), E({ x: t.clientX, y: t.clientY }), u(!0), r == null || r(!0));
48
- }, [l, r]);
44
+ }, F = ({ items: m, children: o, disabled: c = !1, onOpenChange: r, testId: d }) => {
45
+ const [l, a] = u(!1), [f, E] = u({ x: 0, y: 0 }), p = b(null), s = S(() => {
46
+ a(!1), r == null || r(!1);
47
+ }, [r]), e = S((t) => {
48
+ c || (t.preventDefault(), E({ x: t.clientX, y: t.clientY }), a(!0), r == null || r(!0));
49
+ }, [c, r]);
49
50
  return N(() => {
50
- if (!i) return;
51
- const t = () => s(), v = (x) => {
51
+ if (!l) return;
52
+ const t = () => s(), L = (x) => {
52
53
  x.key === "Escape" && s();
53
54
  };
54
- return document.addEventListener("mousedown", t), document.addEventListener("keydown", v), () => {
55
- document.removeEventListener("mousedown", t), document.removeEventListener("keydown", v);
55
+ return document.addEventListener("mousedown", t), document.addEventListener("keydown", L), () => {
56
+ document.removeEventListener("mousedown", t), document.removeEventListener("keydown", L);
56
57
  };
57
- }, [i, s]), /* @__PURE__ */ d("div", { ref: p, onContextMenu: e, "data-testid": a, children: [
58
+ }, [l, s]), /* @__PURE__ */ i("div", { ref: p, onContextMenu: e, "data-testid": d, children: [
58
59
  o,
59
- i && /* @__PURE__ */ n(b, { items: c, position: f, onClose: s })
60
+ l && /* @__PURE__ */ n(v, { items: m, position: f, onClose: s })
60
61
  ] });
61
62
  };
62
63
  export {
63
- j as ContextMenu
64
+ F as ContextMenu
64
65
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=i=>"type"in i&&i.type==="divider";exports.isDivider=e;
@@ -0,0 +1,5 @@
1
+ import { ContextMenuEntry } from './ContextMenu.types';
2
+ export declare const isDivider: (entry: ContextMenuEntry) => entry is {
3
+ id: string;
4
+ type: "divider";
5
+ };
@@ -0,0 +1,4 @@
1
+ const e = (i) => "type" in i && i.type === "divider";
2
+ export {
3
+ e as isDivider
4
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),s=require("react"),b=require("../../utils/cn.cjs"),e=require("./CountdownTimer.const.cjs"),S=n=>String(n).padStart(e.PAD_LENGTH,"0"),y=(n,o)=>{const r=Math.max(0,n-o);return{days:Math.floor(r/e.MS_PER_DAY),hours:Math.floor(r%e.MS_PER_DAY/e.MS_PER_HOUR),minutes:Math.floor(r%e.MS_PER_HOUR/e.MS_PER_MINUTE),seconds:Math.floor(r%e.MS_PER_MINUTE/e.MS_PER_SECOND),totalSeconds:Math.floor(r/e.MS_PER_SECOND),isComplete:r<=0}},Z=n=>{const{targetDate:o,duration:r,variant:f="default",size:m="md",showDays:M=!0,showHours:R=!0,showMinutes:D=!0,showSeconds:I=!0,showLabels:L=!0,showSeparator:P=!0,separator:v=e.DEFAULT_SEPARATOR,labels:p,onComplete:d,onTick:u,paused:w=!1,render:C,className:N,style:j,testId:k}=n,c=s.useMemo(()=>({...e.DEFAULT_LABELS,...p}),[p]),x=s.useRef(!1),B=s.useCallback(()=>o?new Date(o).getTime():r?Date.now()+r*e.MS_PER_SECOND:Date.now(),[o,r]),[_]=s.useState(B),[i,O]=s.useState(()=>y(_,Date.now()));if(s.useEffect(()=>{if(w)return;const t=()=>{const h=y(_,Date.now());O(h),u==null||u(h),h.isComplete&&!x.current&&(x.current=!0,d==null||d())};t();const g=setInterval(t,e.UPDATE_INTERVAL);return()=>clearInterval(g)},[_,w,d,u]),C)return a.jsx(a.Fragment,{children:C(i)});const A=e.SIZE_DIGIT_CLASSES[m]??e.SIZE_DIGIT_CLASSES.md,U=e.SIZE_LABEL_CLASSES[m]??e.SIZE_LABEL_CLASSES.md,G=e.SIZE_GAP_CLASSES[m]??e.SIZE_GAP_CLASSES.md,l=[];M&&l.push({value:S(i.days),label:c.days}),R&&l.push({value:S(i.hours),label:c.hours}),D&&l.push({value:S(i.minutes),label:c.minutes}),I&&l.push({value:S(i.seconds),label:c.seconds});const E=f==="card",T=f==="flip";return a.jsx("div",{className:b.cn("Bear-CountdownTimer","bear-flex bear-items-center",G,N),style:j,"data-testid":k,role:"timer","aria-label":"Countdown timer",children:l.map((t,g)=>a.jsxs("div",{className:"Bear-CountdownTimer__segment bear-flex bear-items-center",children:[g>0&&P&&!E&&a.jsx("span",{className:b.cn("Bear-CountdownTimer__separator",A,e.SEPARATOR_MARGIN,"bear-text-gray-400 dark:bear-text-gray-500"),"aria-hidden":"true",children:v}),a.jsxs("div",{className:"Bear-CountdownTimer__unit bear-flex bear-flex-col bear-items-center",children:[a.jsx("div",{className:b.cn("Bear-CountdownTimer__digit",A,"bear-tabular-nums bear-tracking-wider",E&&["bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-100 dark:bear-bg-gray-800","bear-border bear-border-gray-200 dark:bear-border-gray-700"],T&&["bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-shadow-lg"],!E&&!T&&"bear-text-[var(--bear-text-primary)]"),children:t.value}),L&&a.jsx("span",{className:b.cn("Bear-CountdownTimer__label",U,"bear-mt-1 bear-uppercase bear-tracking-widest","bear-text-gray-500 dark:bear-text-gray-400"),children:t.label})]})]},t.label))})};exports.CountdownTimer=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),d=require("../../utils/cn.cjs"),e=require("./CountdownTimer.const.cjs"),s=require("./CountdownTimer.utils.cjs"),G=y=>{const{targetDate:c,duration:b,variant:w="default",size:m="md",showDays:A=!0,showHours:L=!0,showMinutes:v=!0,showSeconds:I=!0,showLabels:D=!0,showSeparator:R=!0,separator:N=e.DEFAULT_SEPARATOR,labels:E,onComplete:o,onTick:l,paused:C=!1,render:h,className:j,style:k,testId:B}=y,u=t.useMemo(()=>({...e.DEFAULT_LABELS,...E}),[E]),x=t.useRef(!1),P=t.useCallback(()=>c?new Date(c).getTime():b?Date.now()+b*e.MS_PER_SECOND:Date.now(),[c,b]),[S]=t.useState(P),[n,Z]=t.useState(()=>s.calcRemaining(S,Date.now()));if(t.useEffect(()=>{if(C)return;const a=()=>{const p=s.calcRemaining(S,Date.now());Z(p),l==null||l(p),p.isComplete&&!x.current&&(x.current=!0,o==null||o())};a();const _=setInterval(a,e.UPDATE_INTERVAL);return()=>clearInterval(_)},[S,C,o,l]),h)return r.jsx(r.Fragment,{children:h(n)});const f=e.SIZE_DIGIT_CLASSES[m]??e.SIZE_DIGIT_CLASSES.md,q=e.SIZE_LABEL_CLASSES[m]??e.SIZE_LABEL_CLASSES.md,F=e.SIZE_GAP_CLASSES[m]??e.SIZE_GAP_CLASSES.md,i=[];A&&i.push({value:s.pad(n.days),label:u.days}),L&&i.push({value:s.pad(n.hours),label:u.hours}),v&&i.push({value:s.pad(n.minutes),label:u.minutes}),I&&i.push({value:s.pad(n.seconds),label:u.seconds});const g=w==="card",T=w==="flip";return r.jsx("div",{className:d.cn("Bear-CountdownTimer","bear-flex bear-items-center",F,j),style:k,"data-testid":B,role:"timer","aria-label":"Countdown timer",children:i.map((a,_)=>r.jsxs("div",{className:"Bear-CountdownTimer__segment bear-flex bear-items-center",children:[_>0&&R&&!g&&r.jsx("span",{className:d.cn("Bear-CountdownTimer__separator",f,e.SEPARATOR_MARGIN,"bear-text-gray-400 dark:bear-text-gray-500"),"aria-hidden":"true",children:N}),r.jsxs("div",{className:"Bear-CountdownTimer__unit bear-flex bear-flex-col bear-items-center",children:[r.jsx("div",{className:d.cn("Bear-CountdownTimer__digit",f,"bear-tabular-nums bear-tracking-wider",g&&["bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-100 dark:bear-bg-gray-800","bear-border bear-border-gray-200 dark:bear-border-gray-700"],T&&["bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-shadow-lg"],!g&&!T&&"bear-text-[var(--bear-text-primary)]"),children:a.value}),D&&r.jsx("span",{className:d.cn("Bear-CountdownTimer__label",q,"bear-mt-1 bear-uppercase bear-tracking-widest","bear-text-gray-500 dark:bear-text-gray-400"),children:a.label})]})]},a.label))})};exports.CountdownTimer=G;