@forgedevstack/bear 1.2.0 → 1.2.2

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 (268) hide show
  1. package/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
  2. package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
  3. package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
  4. package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
  5. package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
  6. package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
  7. package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
  8. package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
  9. package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
  10. package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
  11. package/dist/components/AnimatedCounter/index.d.ts +2 -0
  12. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  13. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  14. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  15. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  16. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  17. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  18. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  19. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  20. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  21. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  22. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  23. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  24. package/dist/components/Cascader/Cascader.cjs +1 -1
  25. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  26. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  27. package/dist/components/Cascader/Cascader.const.js +1 -1
  28. package/dist/components/Cascader/Cascader.js +109 -146
  29. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  30. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  31. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  32. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  33. package/dist/components/Chart/BarChart.cjs +1 -0
  34. package/dist/components/Chart/BarChart.d.ts +3 -0
  35. package/dist/components/Chart/BarChart.js +65 -0
  36. package/dist/components/Chart/Chart.cjs +1 -1
  37. package/dist/components/Chart/Chart.const.cjs +1 -1
  38. package/dist/components/Chart/Chart.const.d.ts +7 -0
  39. package/dist/components/Chart/Chart.const.js +12 -2
  40. package/dist/components/Chart/Chart.d.ts +1 -13
  41. package/dist/components/Chart/Chart.js +18 -204
  42. package/dist/components/Chart/Chart.types.d.ts +7 -1
  43. package/dist/components/Chart/LineChart.cjs +1 -0
  44. package/dist/components/Chart/LineChart.d.ts +3 -0
  45. package/dist/components/Chart/LineChart.js +73 -0
  46. package/dist/components/Chart/PieChart.cjs +1 -0
  47. package/dist/components/Chart/PieChart.d.ts +3 -0
  48. package/dist/components/Chart/PieChart.js +110 -0
  49. package/dist/components/Chart/index.d.ts +4 -1
  50. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  51. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  52. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  53. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  54. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  55. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  56. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  57. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  58. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  59. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  60. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  61. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  62. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  63. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  64. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  65. package/dist/components/CreditInput/CreditInput.js +80 -78
  66. package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
  67. package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
  68. package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
  69. package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
  70. package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
  71. package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
  72. package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
  73. package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
  74. package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
  75. package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
  76. package/dist/components/CurrencyInput/index.d.ts +2 -0
  77. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  78. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  79. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  80. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  81. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  82. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  83. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  84. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  85. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  86. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  87. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  88. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  89. package/dist/components/DiffSquares/index.d.ts +2 -0
  90. package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
  91. package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
  92. package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
  93. package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
  94. package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
  95. package/dist/components/DiffViewer/DiffViewer.js +97 -105
  96. package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
  97. package/dist/components/DiffViewer/index.d.ts +1 -1
  98. package/dist/components/Drawer/Drawer.cjs +1 -1
  99. package/dist/components/Drawer/Drawer.js +41 -41
  100. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  101. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  102. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  103. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  104. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  105. package/dist/components/Dropdown/Dropdown.js +102 -92
  106. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  107. package/dist/components/Gauge/Gauge.cjs +1 -1
  108. package/dist/components/Gauge/Gauge.js +61 -50
  109. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  110. package/dist/components/GlowCard/GlowCard.cjs +1 -0
  111. package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
  112. package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
  113. package/dist/components/GlowCard/GlowCard.const.js +13 -0
  114. package/dist/components/GlowCard/GlowCard.d.ts +3 -0
  115. package/dist/components/GlowCard/GlowCard.js +185 -0
  116. package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
  117. package/dist/components/GlowCard/index.d.ts +2 -0
  118. package/dist/components/Heatmap/Heatmap.cjs +1 -0
  119. package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
  120. package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
  121. package/dist/components/Heatmap/Heatmap.const.js +11 -0
  122. package/dist/components/Heatmap/Heatmap.d.ts +3 -0
  123. package/dist/components/Heatmap/Heatmap.js +103 -0
  124. package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
  125. package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
  126. package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
  127. package/dist/components/Heatmap/Heatmap.utils.js +18 -0
  128. package/dist/components/Heatmap/index.d.ts +2 -0
  129. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  130. package/dist/components/HoverCard/HoverCard.js +72 -54
  131. package/dist/components/Icon/icons/status.js +1 -1
  132. package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
  133. package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
  134. package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
  135. package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
  136. package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
  137. package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
  138. package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
  139. package/dist/components/ImageAnnotation/index.d.ts +2 -0
  140. package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
  141. package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
  142. package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
  143. package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
  144. package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
  145. package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
  146. package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
  147. package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
  148. package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
  149. package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
  150. package/dist/components/MediaPlayer/index.d.ts +2 -0
  151. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  152. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  153. package/dist/components/Menu/Menu.cjs +1 -1
  154. package/dist/components/Menu/Menu.js +91 -80
  155. package/dist/components/Modal/Modal.cjs +1 -1
  156. package/dist/components/Modal/Modal.const.cjs +1 -1
  157. package/dist/components/Modal/Modal.const.d.ts +1 -1
  158. package/dist/components/Modal/Modal.const.js +1 -1
  159. package/dist/components/Modal/Modal.js +50 -44
  160. package/dist/components/Modal/Modal.types.d.ts +6 -0
  161. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  162. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  163. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  164. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  165. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  166. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  167. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  168. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  169. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  170. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  171. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  172. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  173. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  174. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  175. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  176. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  177. package/dist/components/OTPInput/OTPInput.js +99 -65
  178. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  179. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  180. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  181. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  182. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  183. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  184. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  185. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  186. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  187. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  188. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  189. package/dist/components/Popover/Popover.cjs +1 -1
  190. package/dist/components/Popover/Popover.js +36 -31
  191. package/dist/components/Portal/Portal.cjs +1 -1
  192. package/dist/components/Portal/Portal.d.ts +0 -3
  193. package/dist/components/Portal/Portal.js +4 -10
  194. package/dist/components/Select/Select.cjs +1 -1
  195. package/dist/components/Select/Select.js +71 -51
  196. package/dist/components/Stepper/Stepper.cjs +1 -1
  197. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  198. package/dist/components/Stepper/Stepper.const.d.ts +26 -4
  199. package/dist/components/Stepper/Stepper.const.js +39 -20
  200. package/dist/components/Stepper/Stepper.d.ts +3 -10
  201. package/dist/components/Stepper/Stepper.js +189 -130
  202. package/dist/components/Stepper/Stepper.types.d.ts +14 -0
  203. package/dist/components/Stepper/Stepper.utils.cjs +1 -0
  204. package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
  205. package/dist/components/Stepper/Stepper.utils.js +19 -0
  206. package/dist/components/Stepper/components/StepperControls.cjs +1 -0
  207. package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
  208. package/dist/components/Stepper/components/StepperControls.js +32 -0
  209. package/dist/components/Stepper/index.d.ts +2 -1
  210. package/dist/components/Tabs/TabList.cjs +1 -1
  211. package/dist/components/Tabs/TabList.js +72 -57
  212. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  213. package/dist/components/Tabs/index.d.ts +2 -2
  214. package/dist/components/TagCloud/TagCloud.cjs +1 -0
  215. package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
  216. package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
  217. package/dist/components/TagCloud/TagCloud.const.js +8 -0
  218. package/dist/components/TagCloud/TagCloud.d.ts +3 -0
  219. package/dist/components/TagCloud/TagCloud.js +76 -0
  220. package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
  221. package/dist/components/TagCloud/index.d.ts +2 -0
  222. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  223. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  224. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  225. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  226. package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
  227. package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
  228. package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
  229. package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
  230. package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
  231. package/dist/components/TimelineChart/TimelineChart.js +65 -0
  232. package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
  233. package/dist/components/TimelineChart/index.d.ts +2 -0
  234. package/dist/components/Toast/Toast.cjs +1 -1
  235. package/dist/components/Toast/Toast.js +86 -82
  236. package/dist/components/Toast/Toast.types.d.ts +2 -0
  237. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  238. package/dist/components/Tooltip/Tooltip.js +52 -44
  239. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  240. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  241. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  242. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  243. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  244. package/dist/components/Watermark/Watermark.cjs +1 -1
  245. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  246. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  247. package/dist/components/Watermark/Watermark.const.js +13 -11
  248. package/dist/components/Watermark/Watermark.js +87 -61
  249. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  250. package/dist/components/index.cjs +1 -1
  251. package/dist/components/index.d.ts +22 -4
  252. package/dist/components/index.js +319 -296
  253. package/dist/hooks/index.cjs +1 -1
  254. package/dist/hooks/index.d.ts +1 -1
  255. package/dist/hooks/index.js +55 -54
  256. package/dist/hooks/useClickOutside.cjs +1 -1
  257. package/dist/hooks/useClickOutside.d.ts +4 -11
  258. package/dist/hooks/useClickOutside.js +26 -7
  259. package/dist/index.cjs +1 -1
  260. package/dist/index.js +412 -388
  261. package/dist/styles/_effects.css +32 -0
  262. package/dist/styles.css +1 -1
  263. package/dist/utils/maxVisible.utils.cjs +1 -0
  264. package/dist/utils/maxVisible.utils.d.ts +12 -0
  265. package/dist/utils/maxVisible.utils.js +15 -0
  266. package/package.json +1 -1
  267. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  268. package/dist/components/HoverCard/HoverCard.utils.js +0 -23
@@ -1,96 +1,158 @@
1
- import { jsxs as S, jsx as s } from "react/jsx-runtime";
2
- import { useState as n, useRef as T, useEffect as O } from "react";
3
- import { cn as _ } from "../../utils/cn.js";
4
- import { COLOR_PICKER_DEFAULT_VALUE as f, COLOR_PICKER_LABEL_CLASSES as b, COLOR_PICKER_SWATCH_SIZE as N, COLOR_PICKER_SWATCH_CLASSES as K, COLOR_PICKER_INPUT_CLASSES as k, COLOR_PICKER_POPUP_CLASSES as v, COLOR_PICKER_NATIVE_INPUT_CLASSES as y, COLOR_PICKER_GRID_CLASSES as w, COLOR_PICKER_DEFAULT_PRESETS as U, COLOR_PICKER_PRESET_ACTIVE_CLASSES as V, COLOR_PICKER_PRESET_INACTIVE_CLASSES as x, COLOR_PICKER_PRESET_ITEM_CLASSES as D, COLOR_PICKER_HEX_PATTERN as H } from "./ColorPicker.const.js";
5
- const B = ({
6
- value: r = f,
7
- onChange: t,
8
- presets: u = U,
9
- showInput: L = !0,
10
- showPresets: P = !0,
11
- disabled: a = !1,
12
- label: C,
13
- size: m = "md",
14
- className: I
1
+ import { jsxs as b, jsx as a } from "react/jsx-runtime";
2
+ import { useState as p, useRef as R, useEffect as m } from "react";
3
+ import { cn as C } from "../../utils/cn.js";
4
+ import { Portal as D } from "../Portal/Portal.js";
5
+ import { COLOR_PICKER_DEFAULT_VALUE as z, COLOR_PICKER_LABEL_CLASSES as V, COLOR_PICKER_SWATCH_SIZE as B, COLOR_PICKER_SWATCH_CLASSES as W, COLOR_PICKER_INPUT_CLASSES as X, COLOR_PICKER_POPUP_Z_INDEX as j, COLOR_PICKER_POPUP_CLASSES as F, COLOR_PICKER_HUE_BACKGROUND as G, COLOR_PICKER_HUE_STRIP_CLASSES as Z, COLOR_PICKER_GRID_CLASSES as $, COLOR_PICKER_DEFAULT_PRESETS as Y, COLOR_PICKER_PRESET_ACTIVE_CLASSES as q, COLOR_PICKER_PRESET_INACTIVE_CLASSES as J, COLOR_PICKER_PRESET_ITEM_CLASSES as Q, COLOR_PICKER_HEX_PATTERN as ee } from "./ColorPicker.const.js";
6
+ import { hexToRgb as f, rgbToHsv as P, hsvToHex as te } from "./ColorPicker.utils.js";
7
+ const ce = ({
8
+ value: i = z,
9
+ onChange: o,
10
+ presets: g = Y,
11
+ showInput: K = !0,
12
+ showPresets: N = !0,
13
+ disabled: l = !1,
14
+ label: S,
15
+ size: x = "md",
16
+ className: y
15
17
  }) => {
16
- const [i, o] = n(!1), [p, E] = n(r), l = T(null);
17
- O(() => {
18
- E(r);
19
- }, [r]), O(() => {
20
- const e = (c) => {
21
- l.current && !l.current.contains(c.target) && o(!1);
18
+ const [s, O] = p(!1), [k, u] = p(i), [c, E] = p({ h: 330, s: 80, v: 90 }), [L, H] = p({ top: 0, left: 0 }), _ = R(null), I = R(null), h = R(null), v = R(c);
19
+ v.current = c, m(() => {
20
+ u(i);
21
+ }, [i]), m(() => {
22
+ if (!s || !_.current) return;
23
+ const e = () => {
24
+ const t = _.current.getBoundingClientRect(), r = 256;
25
+ let n = t.left;
26
+ n = Math.max(8, Math.min(n, window.innerWidth - r - 8)), H({ top: t.bottom + 8, left: n });
27
+ };
28
+ return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
29
+ window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
30
+ };
31
+ }, [s]), m(() => {
32
+ if (s) {
33
+ const e = f(i);
34
+ e && E(P(e.r, e.g, e.b));
35
+ }
36
+ }, [s, i]), m(() => {
37
+ if (!s) return;
38
+ const e = (t) => {
39
+ var n, d;
40
+ const r = t.target;
41
+ (n = _.current) != null && n.contains(r) || (d = I.current) != null && d.contains(r) || O(!1);
22
42
  };
23
43
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
24
- }, []);
25
- const A = (e) => {
26
- const c = e.target.value;
27
- E(c), H.test(c) && (t == null || t(c));
28
- }, d = (e) => {
29
- E(e), t == null || t(e);
30
- }, R = N[m];
31
- return /* @__PURE__ */ S("div", { ref: l, className: _("bear-relative bear-inline-block", I), children: [
32
- C && /* @__PURE__ */ s("label", { className: b, children: C }),
33
- /* @__PURE__ */ S("div", { className: "bear-flex bear-items-center bear-gap-2", children: [
34
- /* @__PURE__ */ s(
44
+ }, [s]);
45
+ const w = (e, t, r) => {
46
+ E({ h: e, s: t, v: r });
47
+ const n = te(e, t, r);
48
+ o == null || o(n), u(n);
49
+ }, A = (e) => {
50
+ const t = h.current;
51
+ if (!t) return;
52
+ const r = t.getBoundingClientRect(), n = Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)), d = Math.max(0, Math.min(1, (e.clientY - r.top) / r.height));
53
+ w(v.current.h, n * 100, (1 - d) * 100);
54
+ }, M = (e) => {
55
+ const t = e.target.value;
56
+ if (u(t), ee.test(t)) {
57
+ o == null || o(t);
58
+ const r = f(t);
59
+ r && E(P(r.r, r.g, r.b));
60
+ }
61
+ }, U = (e) => {
62
+ u(e), o == null || o(e);
63
+ const t = f(e);
64
+ t && E(P(t.r, t.g, t.b));
65
+ }, T = B[x];
66
+ return /* @__PURE__ */ b("div", { ref: _, className: C("bear-relative bear-inline-block", y), children: [
67
+ S && /* @__PURE__ */ a("label", { className: V, children: S }),
68
+ /* @__PURE__ */ b("div", { className: "bear-flex bear-items-center bear-gap-2", children: [
69
+ /* @__PURE__ */ a(
35
70
  "button",
36
71
  {
37
72
  type: "button",
38
- onClick: () => !a && o(!i),
39
- disabled: a,
40
- className: _(
41
- K,
42
- R.swatch,
43
- a && "bear-opacity-50 bear-cursor-not-allowed"
73
+ onClick: () => !l && O(!s),
74
+ disabled: l,
75
+ className: C(
76
+ W,
77
+ T.swatch,
78
+ l && "bear-opacity-50 bear-cursor-not-allowed"
44
79
  ),
45
- style: { backgroundColor: r },
80
+ style: { backgroundColor: i },
46
81
  "aria-label": "Pick color"
47
82
  }
48
83
  ),
49
- L && /* @__PURE__ */ s(
84
+ K && /* @__PURE__ */ a(
50
85
  "input",
51
86
  {
52
87
  type: "text",
53
- value: p,
54
- onChange: A,
55
- disabled: a,
88
+ value: k,
89
+ onChange: M,
90
+ disabled: l,
56
91
  placeholder: "#000000",
57
- className: _(
58
- k,
59
- a && "bear-opacity-50 bear-cursor-not-allowed"
92
+ className: C(
93
+ X,
94
+ l && "bear-opacity-50 bear-cursor-not-allowed"
60
95
  )
61
96
  }
62
97
  )
63
98
  ] }),
64
- i && /* @__PURE__ */ S("div", { className: v, children: [
65
- /* @__PURE__ */ s(
66
- "input",
67
- {
68
- type: "color",
69
- value: r,
70
- onChange: (e) => {
71
- t == null || t(e.target.value), E(e.target.value);
72
- },
73
- className: y
74
- }
75
- ),
76
- P && /* @__PURE__ */ s("div", { className: w, children: u.map((e) => /* @__PURE__ */ s(
77
- "button",
78
- {
79
- type: "button",
80
- onClick: () => d(e),
81
- className: _(
82
- D,
83
- R.presetSwatch,
84
- r === e ? V : x
99
+ s && /* @__PURE__ */ a(D, { children: /* @__PURE__ */ b(
100
+ "div",
101
+ {
102
+ ref: I,
103
+ className: F,
104
+ style: { position: "fixed", top: L.top, left: L.left, zIndex: j },
105
+ children: [
106
+ /* @__PURE__ */ a(
107
+ "div",
108
+ {
109
+ ref: h,
110
+ role: "presentation",
111
+ className: "bear-relative bear-mb-3 bear-h-28 bear-w-full bear-cursor-crosshair bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-touch-none",
112
+ style: {
113
+ backgroundImage: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${Math.round(c.h)}, 100%, 50%))`
114
+ },
115
+ onPointerDown: (e) => {
116
+ A(e), e.currentTarget.setPointerCapture(e.pointerId);
117
+ },
118
+ onPointerMove: (e) => {
119
+ (e.pressure > 0 || e.buttons > 0) && A(e);
120
+ }
121
+ }
122
+ ),
123
+ /* @__PURE__ */ a(
124
+ "input",
125
+ {
126
+ type: "range",
127
+ min: 0,
128
+ max: 359,
129
+ value: Math.round(c.h),
130
+ "aria-label": "Hue",
131
+ onChange: (e) => w(Number(e.target.value), c.s, c.v),
132
+ className: Z,
133
+ style: { background: G }
134
+ }
85
135
  ),
86
- style: { backgroundColor: e },
87
- "aria-label": `Color ${e}`
88
- },
89
- e
90
- )) })
91
- ] })
136
+ N && /* @__PURE__ */ a("div", { className: $, children: g.map((e) => /* @__PURE__ */ a(
137
+ "button",
138
+ {
139
+ type: "button",
140
+ onClick: () => U(e),
141
+ className: C(
142
+ Q,
143
+ T.presetSwatch,
144
+ i === e ? q : J
145
+ ),
146
+ style: { backgroundColor: e },
147
+ "aria-label": `Color ${e}`
148
+ },
149
+ e
150
+ )) })
151
+ ]
152
+ }
153
+ ) })
92
154
  ] });
93
155
  };
94
156
  export {
95
- B as ColorPicker
157
+ ce as ColorPicker
96
158
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(n){const e=n.replace("#","");return/^[0-9A-Fa-f]{6}$/.test(e)?{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}:null}function l(n,e,o){const t=r=>Math.max(0,Math.min(255,Math.round(r))).toString(16).padStart(2,"0");return`#${t(n)}${t(e)}${t(o)}`}function T(n,e,o){n/=255,e/=255,o/=255;const t=Math.max(n,e,o),r=Math.min(n,e,o),s=t-r;let c=0;s!==0&&(t===n?c=((e-o)/s+(e<o?6:0))/6:t===e?c=((o-n)/s+2)/6:c=((n-e)/s+4)/6);const i=t===0?0:s/t,a=t;return{h:c*360,s:i*100,v:a*100}}function u(n,e,o){e/=100,o/=100;const t=o*e,r=(n%360+360)%360/60,s=t*(1-Math.abs(r%2-1));let c=0,i=0,a=0;r>=0&&r<1?[c,i,a]=[t,s,0]:r<2?[c,i,a]=[s,t,0]:r<3?[c,i,a]=[0,t,s]:r<4?[c,i,a]=[0,s,t]:r<5?[c,i,a]=[s,0,t]:[c,i,a]=[t,0,s];const h=o-t;return{r:Math.round((c+h)*255),g:Math.round((i+h)*255),b:Math.round((a+h)*255)}}function b(n,e,o){const{r:t,g:r,b:s}=u(n,e,o);return l(t,r,s)}exports.hexToRgb=f;exports.hsvToHex=b;exports.hsvToRgb=u;exports.rgbToHex=l;exports.rgbToHsv=T;
@@ -0,0 +1,17 @@
1
+ export declare function hexToRgb(hex: string): {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ } | null;
6
+ export declare function rgbToHex(r: number, g: number, b: number): string;
7
+ export declare function rgbToHsv(r: number, g: number, b: number): {
8
+ h: number;
9
+ s: number;
10
+ v: number;
11
+ };
12
+ export declare function hsvToRgb(h: number, s: number, v: number): {
13
+ r: number;
14
+ g: number;
15
+ b: number;
16
+ };
17
+ export declare function hsvToHex(h: number, s: number, v: number): string;
@@ -0,0 +1,43 @@
1
+ function f(e) {
2
+ const n = e.replace("#", "");
3
+ return /^[0-9A-Fa-f]{6}$/.test(n) ? {
4
+ r: parseInt(n.slice(0, 2), 16),
5
+ g: parseInt(n.slice(2, 4), 16),
6
+ b: parseInt(n.slice(4, 6), 16)
7
+ } : null;
8
+ }
9
+ function l(e, n, s) {
10
+ const t = (r) => Math.max(0, Math.min(255, Math.round(r))).toString(16).padStart(2, "0");
11
+ return `#${t(e)}${t(n)}${t(s)}`;
12
+ }
13
+ function M(e, n, s) {
14
+ e /= 255, n /= 255, s /= 255;
15
+ const t = Math.max(e, n, s), r = Math.min(e, n, s), o = t - r;
16
+ let c = 0;
17
+ o !== 0 && (t === e ? c = ((n - s) / o + (n < s ? 6 : 0)) / 6 : t === n ? c = ((s - e) / o + 2) / 6 : c = ((e - n) / o + 4) / 6);
18
+ const i = t === 0 ? 0 : o / t, a = t;
19
+ return { h: c * 360, s: i * 100, v: a * 100 };
20
+ }
21
+ function u(e, n, s) {
22
+ n /= 100, s /= 100;
23
+ const t = s * n, r = (e % 360 + 360) % 360 / 60, o = t * (1 - Math.abs(r % 2 - 1));
24
+ let c = 0, i = 0, a = 0;
25
+ r >= 0 && r < 1 ? [c, i, a] = [t, o, 0] : r < 2 ? [c, i, a] = [o, t, 0] : r < 3 ? [c, i, a] = [0, t, o] : r < 4 ? [c, i, a] = [0, o, t] : r < 5 ? [c, i, a] = [o, 0, t] : [c, i, a] = [t, 0, o];
26
+ const h = s - t;
27
+ return {
28
+ r: Math.round((c + h) * 255),
29
+ g: Math.round((i + h) * 255),
30
+ b: Math.round((a + h) * 255)
31
+ };
32
+ }
33
+ function x(e, n, s) {
34
+ const { r: t, g: r, b: o } = u(e, n, s);
35
+ return l(t, r, o);
36
+ }
37
+ export {
38
+ f as hexToRgb,
39
+ x as hsvToHex,
40
+ u as hsvToRgb,
41
+ l as rgbToHex,
42
+ M as rgbToHsv
43
+ };
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("react"),d=require("../../utils/cn.cjs"),f=require("../Typography/Typography.cjs"),e=require("./CountdownTimer.const.cjs"),s=require("./CountdownTimer.utils.cjs"),te=L=>{const{targetDate:u,duration:m,variant:p="default",size:I="md",showDays:N=!0,showHours:v=!0,showMinutes:D=!0,showSeconds:B=!0,showLabels:P=!0,showSeparator:k=!0,separator:O=e.DEFAULT_SEPARATOR,labels:T,onComplete:l,onTick:b,paused:x=!1,render:w,className:j,style:G,testId:q,digitTypographyProps:Z,labelTypographyProps:F,separatorTypographyProps:K,narrowLayout:A=!0}=L,c=t.useMemo(()=>({...e.DEFAULT_LABELS,...T}),[T]),E=t.useRef(!1),M=t.useCallback(()=>u?new Date(u).getTime():m?Date.now()+m*e.MS_PER_SECOND:Date.now(),[u,m]),[g]=t.useState(M),[n,W]=t.useState(()=>s.calcRemaining(g,Date.now()));if(t.useEffect(()=>{if(x)return;const r=()=>{const _=s.calcRemaining(g,Date.now());W(_),b==null||b(_),_.isComplete&&!E.current&&(E.current=!0,l==null||l())};r();const y=setInterval(r,e.UPDATE_INTERVAL);return()=>clearInterval(y)},[g,x,l,b]),w)return a.jsx(a.Fragment,{children:w(n)});const i=I,C=e.SIZE_DIGIT_CLASSES[i]??e.SIZE_DIGIT_CLASSES.md,z=e.SIZE_LABEL_CLASSES[i]??e.SIZE_LABEL_CLASSES.md,U=e.SIZE_GAP_CLASSES[i]??e.SIZE_GAP_CLASSES.md,h=A?e.NARROW_DIGIT_BREAKPOINT_CLASSES[i]??e.NARROW_DIGIT_BREAKPOINT_CLASSES.md:"",V=A?e.NARROW_LABEL_BREAKPOINT_CLASSES[i]??e.NARROW_LABEL_BREAKPOINT_CLASSES.md:"",o=[];N&&o.push({value:s.pad(n.days),label:c.days}),v&&o.push({value:s.pad(n.hours),label:c.hours}),D&&o.push({value:s.pad(n.minutes),label:c.minutes}),B&&o.push({value:s.pad(n.seconds),label:c.seconds});const S=p==="card",R=p==="flip",H=p==="digital",{className:J,variant:Q,...X}=Z??{},{className:Y,variant:$,...ee}=F??{},{className:ae,...re}=K??{};return a.jsx("div",{className:d.cn("Bear-CountdownTimer","bear-flex bear-max-w-full bear-min-w-0 bear-flex-wrap bear-items-center bear-justify-center",U,j),style:G,"data-testid":q,role:"timer","aria-label":"Countdown timer",children:o.map((r,y)=>a.jsxs("div",{className:"Bear-CountdownTimer__segment bear-flex bear-min-w-0 bear-items-center bear-justify-center",children:[y>0&&k&&!S&&a.jsx("span",{className:d.cn("Bear-CountdownTimer__separator",C,h,e.SEPARATOR_MARGIN,"bear-text-gray-400 dark:bear-text-gray-500",ae),"aria-hidden":"true",...re,children:O}),a.jsxs("div",{className:"Bear-CountdownTimer__unit bear-flex bear-min-w-0 bear-flex-col bear-items-center",children:[a.jsx(f.Typography,{component:"div",variant:Q??"body2",align:"center",className:d.cn("Bear-CountdownTimer__digit",C,h,"bear-tabular-nums bear-tracking-wider",S&&["bear-px-3 bear-py-2 max-[480px]:bear-px-2 max-[480px]:bear-py-1.5 bear-rounded-lg","bear-bg-gray-100 dark:bear-bg-gray-800","bear-border bear-border-gray-200 dark:bear-border-gray-700"],R&&["bear-px-3 bear-py-2 max-[480px]:bear-px-2 max-[480px]:bear-py-1.5 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-shadow-lg"],H&&["bear-rounded-md bear-px-2 bear-py-1","bear-bg-black bear-text-emerald-400 dark:bear-bg-zinc-900 dark:bear-text-emerald-300","bear-font-mono"],!S&&!R&&"bear-text-[var(--bear-text-primary)]",J),...X,children:r.value}),P&&a.jsx(f.Typography,{component:"span",variant:$??"caption",align:"center",className:d.cn("Bear-CountdownTimer__label",z,V,"bear-mt-1 bear-uppercase bear-tracking-widest","bear-text-gray-500 dark:bear-text-gray-400",Y),...ee,children:r.label})]})]},r.label))})};exports.CountdownTimer=te;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=1e3,E=60*S,t=60*E,e=24*t,_={days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},A=":",s=2,o={sm:"bear-text-lg bear-font-bold",md:"bear-text-3xl bear-font-bold",lg:"bear-text-5xl bear-font-bold",xl:"bear-text-7xl bear-font-bold"},a={sm:"bear-text-[10px]",md:"bear-text-xs",lg:"bear-text-sm",xl:"bear-text-base"},b={sm:"bear-gap-2",md:"bear-gap-3",lg:"bear-gap-4",xl:"bear-gap-5"},r="bear-mx-1",n=1e3;exports.DEFAULT_LABELS=_;exports.DEFAULT_SEPARATOR=A;exports.MS_PER_DAY=e;exports.MS_PER_HOUR=t;exports.MS_PER_MINUTE=E;exports.MS_PER_SECOND=S;exports.PAD_LENGTH=s;exports.SEPARATOR_MARGIN=r;exports.SIZE_DIGIT_CLASSES=o;exports.SIZE_GAP_CLASSES=b;exports.SIZE_LABEL_CLASSES=a;exports.UPDATE_INTERVAL=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=1e3,t=60*e,x=60*t,S=24*x,a={days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},E=":",_=2,A={sm:"bear-text-lg bear-font-bold",md:"bear-text-3xl bear-font-bold",lg:"bear-text-5xl bear-font-bold",xl:"bear-text-7xl bear-font-bold"},b={sm:"bear-text-[10px]",md:"bear-text-xs",lg:"bear-text-sm",xl:"bear-text-base"},s={sm:"bear-gap-2",md:"bear-gap-3",lg:"bear-gap-4",xl:"bear-gap-5"},r={sm:"max-[480px]:bear-text-base",md:"max-[480px]:bear-text-2xl max-[480px]:bear-leading-none",lg:"max-[480px]:bear-text-3xl max-[480px]:bear-leading-tight",xl:"max-[480px]:bear-text-4xl max-[480px]:bear-leading-tight"},R={sm:"max-[480px]:bear-text-[9px]",md:"max-[480px]:bear-text-[10px]",lg:"max-[480px]:bear-text-xs",xl:"max-[480px]:bear-text-sm"},o="bear-mx-1",L=1e3;exports.DEFAULT_LABELS=a;exports.DEFAULT_SEPARATOR=E;exports.MS_PER_DAY=S;exports.MS_PER_HOUR=x;exports.MS_PER_MINUTE=t;exports.MS_PER_SECOND=e;exports.NARROW_DIGIT_BREAKPOINT_CLASSES=r;exports.NARROW_LABEL_BREAKPOINT_CLASSES=R;exports.PAD_LENGTH=_;exports.SEPARATOR_MARGIN=o;exports.SIZE_DIGIT_CLASSES=A;exports.SIZE_GAP_CLASSES=s;exports.SIZE_LABEL_CLASSES=b;exports.UPDATE_INTERVAL=L;
@@ -21,6 +21,8 @@ export declare const SIZE_DIGIT_CLASSES: Record<CountdownTimerSize, string>;
21
21
  export declare const SIZE_LABEL_CLASSES: Record<CountdownTimerSize, string>;
22
22
  /** Gap classes per size */
23
23
  export declare const SIZE_GAP_CLASSES: Record<CountdownTimerSize, string>;
24
+ export declare const NARROW_DIGIT_BREAKPOINT_CLASSES: Record<CountdownTimerSize, string>;
25
+ export declare const NARROW_LABEL_BREAKPOINT_CLASSES: Record<CountdownTimerSize, string>;
24
26
  /** Separator horizontal margin */
25
27
  export declare const SEPARATOR_MARGIN = "bear-mx-1";
26
28
  /** Update interval in ms */
@@ -1,35 +1,47 @@
1
- const t = 1e3, e = 6e4, s = 36e5, E = 864e5, o = {
1
+ const e = 1e3, t = 6e4, x = 36e5, a = 864e5, b = {
2
2
  days: "Days",
3
3
  hours: "Hours",
4
4
  minutes: "Minutes",
5
5
  seconds: "Seconds"
6
- }, S = ":", _ = 2, a = {
6
+ }, s = ":", r = 2, E = {
7
7
  sm: "bear-text-lg bear-font-bold",
8
8
  md: "bear-text-3xl bear-font-bold",
9
9
  lg: "bear-text-5xl bear-font-bold",
10
10
  xl: "bear-text-7xl bear-font-bold"
11
- }, b = {
11
+ }, S = {
12
12
  sm: "bear-text-[10px]",
13
13
  md: "bear-text-xs",
14
14
  lg: "bear-text-sm",
15
15
  xl: "bear-text-base"
16
- }, n = {
16
+ }, _ = {
17
17
  sm: "bear-gap-2",
18
18
  md: "bear-gap-3",
19
19
  lg: "bear-gap-4",
20
20
  xl: "bear-gap-5"
21
- }, r = "bear-mx-1", x = 1e3;
21
+ }, o = {
22
+ sm: "max-[480px]:bear-text-base",
23
+ md: "max-[480px]:bear-text-2xl max-[480px]:bear-leading-none",
24
+ lg: "max-[480px]:bear-text-3xl max-[480px]:bear-leading-tight",
25
+ xl: "max-[480px]:bear-text-4xl max-[480px]:bear-leading-tight"
26
+ }, n = {
27
+ sm: "max-[480px]:bear-text-[9px]",
28
+ md: "max-[480px]:bear-text-[10px]",
29
+ lg: "max-[480px]:bear-text-xs",
30
+ xl: "max-[480px]:bear-text-sm"
31
+ }, m = "bear-mx-1", l = 1e3;
22
32
  export {
23
- o as DEFAULT_LABELS,
24
- S as DEFAULT_SEPARATOR,
25
- E as MS_PER_DAY,
26
- s as MS_PER_HOUR,
27
- e as MS_PER_MINUTE,
28
- t as MS_PER_SECOND,
29
- _ as PAD_LENGTH,
30
- r as SEPARATOR_MARGIN,
31
- a as SIZE_DIGIT_CLASSES,
32
- n as SIZE_GAP_CLASSES,
33
- b as SIZE_LABEL_CLASSES,
34
- x as UPDATE_INTERVAL
33
+ b as DEFAULT_LABELS,
34
+ s as DEFAULT_SEPARATOR,
35
+ a as MS_PER_DAY,
36
+ x as MS_PER_HOUR,
37
+ t as MS_PER_MINUTE,
38
+ e as MS_PER_SECOND,
39
+ o as NARROW_DIGIT_BREAKPOINT_CLASSES,
40
+ n as NARROW_LABEL_BREAKPOINT_CLASSES,
41
+ r as PAD_LENGTH,
42
+ m as SEPARATOR_MARGIN,
43
+ E as SIZE_DIGIT_CLASSES,
44
+ _ as SIZE_GAP_CLASSES,
45
+ S as SIZE_LABEL_CLASSES,
46
+ l as UPDATE_INTERVAL
35
47
  };
@@ -1,98 +1,128 @@
1
- import { jsx as t, Fragment as H, jsxs as C } from "react/jsx-runtime";
2
- import { useMemo as V, useRef as q, useCallback as J, useState as E, useEffect as K } from "react";
3
- import { cn as o } from "../../utils/cn.js";
4
- import { DEFAULT_SEPARATOR as Q, DEFAULT_LABELS as W, MS_PER_SECOND as X, UPDATE_INTERVAL as Y, SEPARATOR_MARGIN as $, SIZE_DIGIT_CLASSES as T, SIZE_LABEL_CLASSES as A, SIZE_GAP_CLASSES as v } from "./CountdownTimer.const.js";
5
- import { calcRemaining as D, pad as l } from "./CountdownTimer.utils.js";
6
- const ne = (L) => {
1
+ import { jsx as s, Fragment as be, jsxs as A } from "react/jsx-runtime";
2
+ import { useMemo as de, useRef as me, useCallback as ce, useState as E, useEffect as ue } from "react";
3
+ import { cn as l } from "../../utils/cn.js";
4
+ import { Typography as v } from "../Typography/Typography.js";
5
+ import { DEFAULT_SEPARATOR as pe, DEFAULT_LABELS as ge, MS_PER_SECOND as ye, UPDATE_INTERVAL as xe, SEPARATOR_MARGIN as fe, NARROW_DIGIT_BREAKPOINT_CLASSES as R, SIZE_DIGIT_CLASSES as L, NARROW_LABEL_BREAKPOINT_CLASSES as N, SIZE_LABEL_CLASSES as D, SIZE_GAP_CLASSES as I } from "./CountdownTimer.const.js";
6
+ import { calcRemaining as k, pad as b } from "./CountdownTimer.utils.js";
7
+ const Ae = (B) => {
7
8
  const {
8
9
  targetDate: d,
9
- duration: b,
10
- variant: f = "default",
11
- size: u = "md",
12
- showDays: I = !0,
13
- showHours: N = !0,
14
- showMinutes: k = !0,
15
- showSeconds: R = !0,
16
- showLabels: B = !0,
17
- showSeparator: P = !0,
18
- separator: F = Q,
19
- labels: w,
20
- onComplete: s,
21
- onTick: n,
22
- paused: h = !1,
23
- render: _,
24
- className: M,
25
- style: G,
26
- testId: O
27
- } = L, i = V(() => ({ ...W, ...w }), [w]), S = q(!1), U = J(() => d ? new Date(d).getTime() : b ? Date.now() + b * X : Date.now(), [d, b]), [c] = E(U), [r, Z] = E(() => D(c, Date.now()));
28
- if (K(() => {
29
- if (h) return;
10
+ duration: m,
11
+ variant: c = "default",
12
+ size: P = "md",
13
+ showDays: O = !0,
14
+ showHours: F = !0,
15
+ showMinutes: j = !0,
16
+ showSeconds: G = !0,
17
+ showLabels: M = !0,
18
+ showSeparator: z = !0,
19
+ separator: K = pe,
20
+ labels: x,
21
+ onComplete: n,
22
+ onTick: o,
23
+ paused: f = !1,
24
+ render: w,
25
+ className: U,
26
+ style: V,
27
+ testId: Z,
28
+ digitTypographyProps: W,
29
+ labelTypographyProps: H,
30
+ separatorTypographyProps: q,
31
+ narrowLayout: T = !0
32
+ } = B, i = de(() => ({ ...ge, ...x }), [x]), _ = me(!1), J = ce(() => d ? new Date(d).getTime() : m ? Date.now() + m * ye : Date.now(), [d, m]), [u] = E(J), [a, Q] = E(() => k(u, Date.now()));
33
+ if (ue(() => {
34
+ if (f) return;
30
35
  const e = () => {
31
- const p = D(c, Date.now());
32
- Z(p), n == null || n(p), p.isComplete && !S.current && (S.current = !0, s == null || s());
36
+ const y = k(u, Date.now());
37
+ Q(y), o == null || o(y), y.isComplete && !_.current && (_.current = !0, n == null || n());
33
38
  };
34
39
  e();
35
- const g = setInterval(e, Y);
40
+ const g = setInterval(e, xe);
36
41
  return () => clearInterval(g);
37
- }, [c, h, s, n]), _) return /* @__PURE__ */ t(H, { children: _(r) });
38
- const y = T[u] ?? T.md, j = A[u] ?? A.md, z = v[u] ?? v.md, a = [];
39
- I && a.push({ value: l(r.days), label: i.days }), N && a.push({ value: l(r.hours), label: i.hours }), k && a.push({ value: l(r.minutes), label: i.minutes }), R && a.push({ value: l(r.seconds), label: i.seconds });
40
- const m = f === "card", x = f === "flip";
41
- return /* @__PURE__ */ t(
42
+ }, [u, f, n, o]), w) return /* @__PURE__ */ s(be, { children: w(a) });
43
+ const r = P, h = L[r] ?? L.md, X = D[r] ?? D.md, Y = I[r] ?? I.md, S = T ? R[r] ?? R.md : "", $ = T ? N[r] ?? N.md : "", t = [];
44
+ O && t.push({ value: b(a.days), label: i.days }), F && t.push({ value: b(a.hours), label: i.hours }), j && t.push({ value: b(a.minutes), label: i.minutes }), G && t.push({ value: b(a.seconds), label: i.seconds });
45
+ const p = c === "card", C = c === "flip", ee = c === "digital", { className: ae, variant: re, ...te } = W ?? {}, { className: se, variant: ne, ...oe } = H ?? {}, { className: ie, ...le } = q ?? {};
46
+ return /* @__PURE__ */ s(
42
47
  "div",
43
48
  {
44
- className: o("Bear-CountdownTimer", "bear-flex bear-items-center", z, M),
45
- style: G,
46
- "data-testid": O,
49
+ className: l(
50
+ "Bear-CountdownTimer",
51
+ "bear-flex bear-max-w-full bear-min-w-0 bear-flex-wrap bear-items-center bear-justify-center",
52
+ Y,
53
+ U
54
+ ),
55
+ style: V,
56
+ "data-testid": Z,
47
57
  role: "timer",
48
58
  "aria-label": "Countdown timer",
49
- children: a.map((e, g) => /* @__PURE__ */ C("div", { className: "Bear-CountdownTimer__segment bear-flex bear-items-center", children: [
50
- g > 0 && P && !m && /* @__PURE__ */ t(
59
+ children: t.map((e, g) => /* @__PURE__ */ A("div", { className: "Bear-CountdownTimer__segment bear-flex bear-min-w-0 bear-items-center bear-justify-center", children: [
60
+ g > 0 && z && !p && /* @__PURE__ */ s(
51
61
  "span",
52
62
  {
53
- className: o(
63
+ className: l(
54
64
  "Bear-CountdownTimer__separator",
55
- y,
56
- $,
57
- "bear-text-gray-400 dark:bear-text-gray-500"
65
+ h,
66
+ S,
67
+ fe,
68
+ "bear-text-gray-400 dark:bear-text-gray-500",
69
+ ie
58
70
  ),
59
71
  "aria-hidden": "true",
60
- children: F
72
+ ...le,
73
+ children: K
61
74
  }
62
75
  ),
63
- /* @__PURE__ */ C("div", { className: "Bear-CountdownTimer__unit bear-flex bear-flex-col bear-items-center", children: [
64
- /* @__PURE__ */ t(
65
- "div",
76
+ /* @__PURE__ */ A("div", { className: "Bear-CountdownTimer__unit bear-flex bear-min-w-0 bear-flex-col bear-items-center", children: [
77
+ /* @__PURE__ */ s(
78
+ v,
66
79
  {
67
- className: o(
80
+ component: "div",
81
+ variant: re ?? "body2",
82
+ align: "center",
83
+ className: l(
68
84
  "Bear-CountdownTimer__digit",
69
- y,
85
+ h,
86
+ S,
70
87
  "bear-tabular-nums bear-tracking-wider",
71
- m && [
72
- "bear-px-3 bear-py-2 bear-rounded-lg",
88
+ p && [
89
+ "bear-px-3 bear-py-2 max-[480px]:bear-px-2 max-[480px]:bear-py-1.5 bear-rounded-lg",
73
90
  "bear-bg-gray-100 dark:bear-bg-gray-800",
74
91
  "bear-border bear-border-gray-200 dark:bear-border-gray-700"
75
92
  ],
76
- x && [
77
- "bear-px-3 bear-py-2 bear-rounded-lg",
93
+ C && [
94
+ "bear-px-3 bear-py-2 max-[480px]:bear-px-2 max-[480px]:bear-py-1.5 bear-rounded-lg",
78
95
  "bear-bg-gray-900 dark:bear-bg-gray-100",
79
96
  "bear-text-white dark:bear-text-gray-900",
80
97
  "bear-shadow-lg"
81
98
  ],
82
- !m && !x && "bear-text-[var(--bear-text-primary)]"
99
+ ee && [
100
+ "bear-rounded-md bear-px-2 bear-py-1",
101
+ "bear-bg-black bear-text-emerald-400 dark:bear-bg-zinc-900 dark:bear-text-emerald-300",
102
+ "bear-font-mono"
103
+ ],
104
+ !p && !C && "bear-text-[var(--bear-text-primary)]",
105
+ ae
83
106
  ),
107
+ ...te,
84
108
  children: e.value
85
109
  }
86
110
  ),
87
- B && /* @__PURE__ */ t(
88
- "span",
111
+ M && /* @__PURE__ */ s(
112
+ v,
89
113
  {
90
- className: o(
114
+ component: "span",
115
+ variant: ne ?? "caption",
116
+ align: "center",
117
+ className: l(
91
118
  "Bear-CountdownTimer__label",
92
- j,
119
+ X,
120
+ $,
93
121
  "bear-mt-1 bear-uppercase bear-tracking-widest",
94
- "bear-text-gray-500 dark:bear-text-gray-400"
122
+ "bear-text-gray-500 dark:bear-text-gray-400",
123
+ se
95
124
  ),
125
+ ...oe,
96
126
  children: e.label
97
127
  }
98
128
  )
@@ -102,5 +132,5 @@ const ne = (L) => {
102
132
  );
103
133
  };
104
134
  export {
105
- ne as CountdownTimer
135
+ Ae as CountdownTimer
106
136
  };
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- export type CountdownTimerVariant = 'default' | 'card' | 'minimal' | 'flip';
2
+ import { TypographyProps } from '../Typography/Typography.types';
3
+ export type CountdownTimerVariant = 'default' | 'card' | 'minimal' | 'flip' | 'digital';
3
4
  export type CountdownTimerSize = 'sm' | 'md' | 'lg' | 'xl';
4
5
  export interface CountdownTimerProps {
5
6
  /** Target date/time to count down to */
@@ -23,7 +24,7 @@ export interface CountdownTimerProps {
23
24
  /** Whether to show separator */
24
25
  showSeparator?: boolean;
25
26
  /** Separator character */
26
- separator?: string;
27
+ separator?: string | number;
27
28
  /** Custom labels */
28
29
  labels?: {
29
30
  days?: string;
@@ -45,6 +46,14 @@ export interface CountdownTimerProps {
45
46
  style?: React.CSSProperties;
46
47
  /** Test ID */
47
48
  testId?: string;
49
+ /** Typography props for digit blocks (merged with size presets). */
50
+ digitTypographyProps?: Partial<TypographyProps>;
51
+ /** Typography props for unit labels. */
52
+ labelTypographyProps?: Partial<TypographyProps>;
53
+ /** Typography props for separators (e.g., ":" size/style). */
54
+ separatorTypographyProps?: Partial<TypographyProps>;
55
+ /** When true (default), use smaller digits and wrapping on narrow widths. */
56
+ narrowLayout?: boolean;
48
57
  }
49
58
  export interface CountdownTime {
50
59
  days: number;