@forgedevstack/bear 1.1.9 → 1.2.1
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.
- package/README.md +4 -0
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.d.ts +2 -2
- package/dist/components/AlertDialog/AlertDialog.const.js +4 -4
- package/dist/components/AlertDialog/AlertDialog.js +76 -62
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +3 -2
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/CloseButton/CloseButton.cjs +1 -0
- package/dist/components/CloseButton/CloseButton.d.ts +4 -0
- package/dist/components/CloseButton/CloseButton.js +60 -0
- package/dist/components/CloseButton/CloseButton.types.d.ts +15 -0
- package/dist/components/CloseButton/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +12 -11
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/commerce.cjs +1 -0
- package/dist/components/Icon/icons/commerce.d.ts +25 -0
- package/dist/components/Icon/icons/commerce.js +124 -0
- package/dist/components/Icon/icons/device.cjs +1 -0
- package/dist/components/Icon/icons/device.d.ts +27 -0
- package/dist/components/Icon/icons/device.js +122 -0
- package/dist/components/Icon/icons/file.cjs +1 -0
- package/dist/components/Icon/icons/file.d.ts +25 -0
- package/dist/components/Icon/icons/file.js +120 -0
- package/dist/components/Icon/icons/social.cjs +1 -0
- package/dist/components/Icon/icons/social.d.ts +24 -0
- package/dist/components/Icon/icons/social.js +89 -0
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +93 -56
- package/dist/components/Icon/index.js +38 -26
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/Overlay/Overlay.cjs +1 -0
- package/dist/components/Overlay/Overlay.d.ts +4 -0
- package/dist/components/Overlay/Overlay.js +38 -0
- package/dist/components/Overlay/Overlay.types.d.ts +23 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -0
- package/dist/components/Portal/Portal.d.ts +8 -0
- package/dist/components/Portal/Portal.js +6 -0
- package/dist/components/Portal/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +3 -2
- package/dist/components/Stepper/Stepper.const.js +15 -14
- package/dist/components/Stepper/Stepper.d.ts +0 -7
- package/dist/components/Stepper/Stepper.js +164 -117
- package/dist/components/Stepper/Stepper.types.d.ts +3 -0
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/ThemeIcon/ThemeIcon.cjs +1 -0
- package/dist/components/ThemeIcon/ThemeIcon.d.ts +4 -0
- package/dist/components/ThemeIcon/ThemeIcon.js +54 -0
- package/dist/components/ThemeIcon/ThemeIcon.types.d.ts +22 -0
- package/dist/components/ThemeIcon/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/VisuallyHidden/VisuallyHidden.cjs +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +6 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +22 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +15 -3
- package/dist/components/index.js +296 -280
- package/dist/hooks/bearStyled.cjs +1 -1
- package/dist/hooks/bearStyled.d.ts +31 -9
- package/dist/hooks/bearStyled.js +17 -12
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +9 -1
- package/dist/hooks/useResponsive.cjs +1 -1
- package/dist/hooks/useResponsive.d.ts +2 -17
- package/dist/hooks/useResponsive.js +47 -41
- package/dist/index.cjs +1 -1
- package/dist/index.js +383 -366
- package/dist/styles/_effects.css +26 -0
- package/dist/styles.css +1 -1
- package/dist/types/theme.types.d.ts +1 -0
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -1,96 +1,158 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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: () => !
|
|
39
|
-
disabled:
|
|
40
|
-
className:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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:
|
|
80
|
+
style: { backgroundColor: i },
|
|
46
81
|
"aria-label": "Pick color"
|
|
47
82
|
}
|
|
48
83
|
),
|
|
49
|
-
|
|
84
|
+
K && /* @__PURE__ */ a(
|
|
50
85
|
"input",
|
|
51
86
|
{
|
|
52
87
|
type: "text",
|
|
53
|
-
value:
|
|
54
|
-
onChange:
|
|
55
|
-
disabled:
|
|
88
|
+
value: k,
|
|
89
|
+
onChange: M,
|
|
90
|
+
disabled: l,
|
|
56
91
|
placeholder: "#000000",
|
|
57
|
-
className:
|
|
58
|
-
|
|
59
|
-
|
|
92
|
+
className: C(
|
|
93
|
+
X,
|
|
94
|
+
l && "bear-opacity-50 bear-cursor-not-allowed"
|
|
60
95
|
)
|
|
61
96
|
}
|
|
62
97
|
)
|
|
63
98
|
] }),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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:
|
|
10
|
-
variant:
|
|
11
|
-
size:
|
|
12
|
-
showDays:
|
|
13
|
-
showHours:
|
|
14
|
-
showMinutes:
|
|
15
|
-
showSeconds:
|
|
16
|
-
showLabels:
|
|
17
|
-
showSeparator:
|
|
18
|
-
separator:
|
|
19
|
-
labels:
|
|
20
|
-
onComplete:
|
|
21
|
-
onTick:
|
|
22
|
-
paused:
|
|
23
|
-
render:
|
|
24
|
-
className:
|
|
25
|
-
style:
|
|
26
|
-
testId:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
32
|
-
|
|
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,
|
|
40
|
+
const g = setInterval(e, xe);
|
|
36
41
|
return () => clearInterval(g);
|
|
37
|
-
}, [
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
return /* @__PURE__ */
|
|
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:
|
|
45
|
-
|
|
46
|
-
|
|
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:
|
|
50
|
-
g > 0 &&
|
|
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:
|
|
63
|
+
className: l(
|
|
54
64
|
"Bear-CountdownTimer__separator",
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
72
|
+
...le,
|
|
73
|
+
children: K
|
|
61
74
|
}
|
|
62
75
|
),
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
|
|
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
|
-
|
|
80
|
+
component: "div",
|
|
81
|
+
variant: re ?? "body2",
|
|
82
|
+
align: "center",
|
|
83
|
+
className: l(
|
|
68
84
|
"Bear-CountdownTimer__digit",
|
|
69
|
-
|
|
85
|
+
h,
|
|
86
|
+
S,
|
|
70
87
|
"bear-tabular-nums bear-tracking-wider",
|
|
71
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
88
|
-
|
|
111
|
+
M && /* @__PURE__ */ s(
|
|
112
|
+
v,
|
|
89
113
|
{
|
|
90
|
-
|
|
114
|
+
component: "span",
|
|
115
|
+
variant: ne ?? "caption",
|
|
116
|
+
align: "center",
|
|
117
|
+
className: l(
|
|
91
118
|
"Bear-CountdownTimer__label",
|
|
92
|
-
|
|
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
|
-
|
|
135
|
+
Ae as CountdownTimer
|
|
106
136
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
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;
|