@forgedevstack/bear 1.1.3 → 1.1.4
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/dist/components/ActionIcon/ActionIcon.cjs +1 -0
- package/dist/components/ActionIcon/ActionIcon.const.cjs +1 -0
- package/dist/components/ActionIcon/ActionIcon.const.d.ts +7 -0
- package/dist/components/ActionIcon/ActionIcon.const.js +68 -0
- package/dist/components/ActionIcon/ActionIcon.d.ts +4 -0
- package/dist/components/ActionIcon/ActionIcon.js +42 -0
- package/dist/components/ActionIcon/ActionIcon.types.d.ts +11 -0
- package/dist/components/ActionIcon/index.d.ts +2 -0
- package/dist/components/Affix/Affix.cjs +1 -0
- package/dist/components/Affix/Affix.const.cjs +1 -0
- package/dist/components/Affix/Affix.const.d.ts +6 -0
- package/dist/components/Affix/Affix.const.js +9 -0
- package/dist/components/Affix/Affix.d.ts +4 -0
- package/dist/components/Affix/Affix.js +69 -0
- package/dist/components/Affix/Affix.types.d.ts +10 -0
- package/dist/components/Affix/index.d.ts +2 -0
- package/dist/components/Anchor/Anchor.cjs +1 -0
- package/dist/components/Anchor/Anchor.const.cjs +1 -0
- package/dist/components/Anchor/Anchor.const.d.ts +9 -0
- package/dist/components/Anchor/Anchor.const.js +11 -0
- package/dist/components/Anchor/Anchor.d.ts +4 -0
- package/dist/components/Anchor/Anchor.js +91 -0
- package/dist/components/Anchor/Anchor.types.d.ts +16 -0
- package/dist/components/Anchor/index.d.ts +2 -0
- package/dist/components/Blockquote/Blockquote.cjs +1 -0
- package/dist/components/Blockquote/Blockquote.const.cjs +1 -0
- package/dist/components/Blockquote/Blockquote.const.d.ts +5 -0
- package/dist/components/Blockquote/Blockquote.const.js +19 -0
- package/dist/components/Blockquote/Blockquote.d.ts +4 -0
- package/dist/components/Blockquote/Blockquote.js +56 -0
- package/dist/components/Blockquote/Blockquote.types.d.ts +9 -0
- package/dist/components/Blockquote/index.d.ts +2 -0
- package/dist/components/CheckboxCard/CheckboxCard.cjs +1 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.cjs +1 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.d.ts +7 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.js +22 -0
- package/dist/components/CheckboxCard/CheckboxCard.d.ts +5 -0
- package/dist/components/CheckboxCard/CheckboxCard.js +132 -0
- package/dist/components/CheckboxCard/CheckboxCard.types.d.ts +21 -0
- package/dist/components/CheckboxCard/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +26 -0
- package/dist/components/ColorPicker/ColorPicker.const.js +38 -0
- package/dist/components/ColorPicker/ColorPicker.js +61 -78
- package/dist/components/ColorSwatch/ColorSwatch.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.d.ts +16 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.js +19 -0
- package/dist/components/ColorSwatch/ColorSwatch.d.ts +5 -0
- package/dist/components/ColorSwatch/ColorSwatch.js +92 -0
- package/dist/components/ColorSwatch/ColorSwatch.types.d.ts +23 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.d.ts +6 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.js +14 -0
- package/dist/components/ColorSwatch/index.d.ts +2 -0
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.const.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.const.d.ts +9 -0
- package/dist/components/ContextMenu/ContextMenu.const.js +12 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +4 -0
- package/dist/components/ContextMenu/ContextMenu.js +64 -0
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +23 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.d.ts +27 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.js +74 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +115 -0
- package/dist/components/DateRangePicker/DateRangePicker.types.d.ts +26 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.js +22 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/Descriptions/Descriptions.cjs +1 -0
- package/dist/components/Descriptions/Descriptions.const.cjs +1 -0
- package/dist/components/Descriptions/Descriptions.const.d.ts +24 -0
- package/dist/components/Descriptions/Descriptions.const.js +27 -0
- package/dist/components/Descriptions/Descriptions.d.ts +4 -0
- package/dist/components/Descriptions/Descriptions.js +65 -0
- package/dist/components/Descriptions/Descriptions.types.d.ts +16 -0
- package/dist/components/Descriptions/index.d.ts +2 -0
- package/dist/components/Fieldset/Fieldset.cjs +1 -0
- package/dist/components/Fieldset/Fieldset.const.cjs +1 -0
- package/dist/components/Fieldset/Fieldset.const.d.ts +5 -0
- package/dist/components/Fieldset/Fieldset.const.js +16 -0
- package/dist/components/Fieldset/Fieldset.d.ts +4 -0
- package/dist/components/Fieldset/Fieldset.js +47 -0
- package/dist/components/Fieldset/Fieldset.types.d.ts +10 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/ImageGallery/ImageGallery.cjs +1 -0
- package/dist/components/ImageGallery/ImageGallery.const.cjs +1 -0
- package/dist/components/ImageGallery/ImageGallery.const.d.ts +13 -0
- package/dist/components/ImageGallery/ImageGallery.const.js +16 -0
- package/dist/components/ImageGallery/ImageGallery.d.ts +4 -0
- package/dist/components/ImageGallery/ImageGallery.js +61 -0
- package/dist/components/ImageGallery/ImageGallery.types.d.ts +22 -0
- package/dist/components/ImageGallery/index.d.ts +2 -0
- package/dist/components/Indicator/Indicator.cjs +1 -0
- package/dist/components/Indicator/Indicator.const.cjs +1 -0
- package/dist/components/Indicator/Indicator.const.d.ts +15 -0
- package/dist/components/Indicator/Indicator.const.js +26 -0
- package/dist/components/Indicator/Indicator.d.ts +4 -0
- package/dist/components/Indicator/Indicator.js +56 -0
- package/dist/components/Indicator/Indicator.types.d.ts +16 -0
- package/dist/components/Indicator/index.d.ts +2 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.d.ts +7 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.js +10 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.d.ts +4 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.js +51 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.types.d.ts +13 -0
- package/dist/components/InfiniteScroll/index.d.ts +2 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +99 -66
- package/dist/components/Input/Input.types.d.ts +10 -0
- package/dist/components/Input/Input.utils.cjs +1 -0
- package/dist/components/Input/Input.utils.d.ts +2 -0
- package/dist/components/Input/Input.utils.js +15 -0
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/LoadingOverlay/LoadingOverlay.cjs +1 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.cjs +1 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.d.ts +6 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.js +9 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.d.ts +4 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.js +42 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.types.d.ts +11 -0
- package/dist/components/LoadingOverlay/index.d.ts +2 -0
- package/dist/components/NumberFormatter/NumberFormatter.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.d.ts +5 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.js +8 -0
- package/dist/components/NumberFormatter/NumberFormatter.d.ts +4 -0
- package/dist/components/NumberFormatter/NumberFormatter.js +53 -0
- package/dist/components/NumberFormatter/NumberFormatter.types.d.ts +20 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.d.ts +2 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.js +19 -0
- package/dist/components/NumberFormatter/index.d.ts +2 -0
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -0
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -0
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +13 -0
- package/dist/components/Popconfirm/Popconfirm.const.js +20 -0
- package/dist/components/Popconfirm/Popconfirm.d.ts +4 -0
- package/dist/components/Popconfirm/Popconfirm.js +65 -0
- package/dist/components/Popconfirm/Popconfirm.types.d.ts +16 -0
- package/dist/components/Popconfirm/index.d.ts +2 -0
- package/dist/components/RadioCard/RadioCard.cjs +1 -0
- package/dist/components/RadioCard/RadioCard.const.cjs +1 -0
- package/dist/components/RadioCard/RadioCard.const.d.ts +7 -0
- package/dist/components/RadioCard/RadioCard.const.js +22 -0
- package/dist/components/RadioCard/RadioCard.d.ts +5 -0
- package/dist/components/RadioCard/RadioCard.js +111 -0
- package/dist/components/RadioCard/RadioCard.types.d.ts +22 -0
- package/dist/components/RadioCard/index.d.ts +2 -0
- package/dist/components/Result/Result.cjs +1 -0
- package/dist/components/Result/Result.const.cjs +1 -0
- package/dist/components/Result/Result.const.d.ts +10 -0
- package/dist/components/Result/Result.const.js +20 -0
- package/dist/components/Result/Result.d.ts +4 -0
- package/dist/components/Result/Result.icons.cjs +1 -0
- package/dist/components/Result/Result.icons.d.ts +3 -0
- package/dist/components/Result/Result.icons.js +31 -0
- package/dist/components/Result/Result.js +35 -0
- package/dist/components/Result/Result.types.d.ts +10 -0
- package/dist/components/Result/index.d.ts +2 -0
- package/dist/components/RingProgress/RingProgress.cjs +1 -0
- package/dist/components/RingProgress/RingProgress.const.cjs +1 -0
- package/dist/components/RingProgress/RingProgress.const.d.ts +4 -0
- package/dist/components/RingProgress/RingProgress.const.js +7 -0
- package/dist/components/RingProgress/RingProgress.d.ts +4 -0
- package/dist/components/RingProgress/RingProgress.js +67 -0
- package/dist/components/RingProgress/RingProgress.types.d.ts +15 -0
- package/dist/components/RingProgress/index.d.ts +2 -0
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.js +10 -11
- package/dist/components/SignPad/SignPad.d.ts +4 -6
- package/dist/components/SignPad/SignPad.js +108 -116
- package/dist/components/SignPad/SignPad.types.d.ts +2 -2
- package/dist/components/SplitButton/SplitButton.cjs +1 -0
- package/dist/components/SplitButton/SplitButton.const.cjs +1 -0
- package/dist/components/SplitButton/SplitButton.const.d.ts +25 -0
- package/dist/components/SplitButton/SplitButton.const.js +27 -0
- package/dist/components/SplitButton/SplitButton.d.ts +4 -0
- package/dist/components/SplitButton/SplitButton.js +73 -0
- package/dist/components/SplitButton/SplitButton.types.d.ts +21 -0
- package/dist/components/SplitButton/index.d.ts +2 -0
- package/dist/components/Spoiler/Spoiler.cjs +1 -0
- package/dist/components/Spoiler/Spoiler.const.cjs +1 -0
- package/dist/components/Spoiler/Spoiler.const.d.ts +6 -0
- package/dist/components/Spoiler/Spoiler.const.js +9 -0
- package/dist/components/Spoiler/Spoiler.d.ts +4 -0
- package/dist/components/Spoiler/Spoiler.js +59 -0
- package/dist/components/Spoiler/Spoiler.types.d.ts +10 -0
- package/dist/components/Spoiler/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +63 -57
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.d.ts +0 -7
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +32 -31
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +19 -0
- package/dist/components/TreeSelect/TreeSelect.const.js +22 -0
- package/dist/components/TreeSelect/TreeSelect.d.ts +4 -0
- package/dist/components/TreeSelect/TreeSelect.js +128 -0
- package/dist/components/TreeSelect/TreeSelect.types.d.ts +25 -0
- package/dist/components/TreeSelect/TreeSelect.utils.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.utils.d.ts +5 -0
- package/dist/components/TreeSelect/TreeSelect.utils.js +25 -0
- package/dist/components/TreeSelect/index.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +44 -0
- package/dist/components/index.js +353 -306
- package/dist/index.cjs +1 -1
- package/dist/index.js +439 -392
- package/dist/postcss/bear-plugin.cjs +86 -0
- package/dist/styles/_alerts.css +14 -0
- package/dist/styles/_base.css +56 -0
- package/dist/styles/_buttons.css +108 -0
- package/dist/styles/_effects.css +90 -0
- package/dist/styles/_marquee.css +25 -0
- package/dist/styles/main.css +5 -0
- package/dist/styles.css +1 -1
- package/package.json +10 -3
|
@@ -1,169 +1,161 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as b, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useState as B, useEffect as D, useCallback as l } from "react";
|
|
3
|
+
import { cn as _ } from "../../utils/cn.js";
|
|
4
|
+
import { Button as M } from "../Button/Button.js";
|
|
5
|
+
import { SIGN_PAD_DEFAULT_HEIGHT as Z, SIGN_PAD_DEFAULT_STROKE_WIDTH as $, SIGN_PAD_DEFAULT_PLACEHOLDER as ee, SIGN_PAD_DEFAULT_OUTPUT_FORMAT as te, SIGN_PAD_DEFAULT_OUTPUT_QUALITY as re, SIGN_PAD_BG_DARK as ne, SIGN_PAD_BG_LIGHT as oe, SIGN_PAD_STROKE_DARK as se, SIGN_PAD_STROKE_LIGHT as ae, SIGN_PAD_PLACEHOLDER_CLASSES as ce, SIGN_PAD_LINE_CLASSES as ie, SIGN_PAD_X_MARK_CLASSES as le, SIGN_PAD_CANVAS_WRAPPER_HOVER as ue, SIGN_PAD_CANVAS_WRAPPER_CLASSES as de, SIGN_PAD_ACTIONS_CLASSES as _e, SIGN_PAD_ROOT_CLASSES as he } from "./SignPad.const.js";
|
|
6
|
+
const ge = (U) => {
|
|
7
7
|
const {
|
|
8
8
|
onChange: o,
|
|
9
|
-
width:
|
|
10
|
-
height:
|
|
11
|
-
strokeColor:
|
|
12
|
-
strokeWidth:
|
|
13
|
-
backgroundColor:
|
|
14
|
-
placeholder:
|
|
15
|
-
disabled:
|
|
16
|
-
readOnly:
|
|
17
|
-
showClear:
|
|
18
|
-
showSave:
|
|
19
|
-
clearText:
|
|
20
|
-
saveText:
|
|
9
|
+
width: w,
|
|
10
|
+
height: m = Z,
|
|
11
|
+
strokeColor: F,
|
|
12
|
+
strokeWidth: C = $,
|
|
13
|
+
backgroundColor: H,
|
|
14
|
+
placeholder: K = ee,
|
|
15
|
+
disabled: n = !1,
|
|
16
|
+
readOnly: s = !1,
|
|
17
|
+
showClear: L = !0,
|
|
18
|
+
showSave: R = !1,
|
|
19
|
+
clearText: W = "Clear",
|
|
20
|
+
saveText: z = "Save",
|
|
21
21
|
outputFormat: f = te,
|
|
22
|
-
outputQuality: A =
|
|
23
|
-
className:
|
|
24
|
-
testId:
|
|
25
|
-
id:
|
|
26
|
-
...
|
|
27
|
-
} = U,
|
|
28
|
-
|
|
22
|
+
outputQuality: A = re,
|
|
23
|
+
className: X,
|
|
24
|
+
testId: Y,
|
|
25
|
+
id: V,
|
|
26
|
+
...j
|
|
27
|
+
} = U, a = p(null), I = p(null), v = p(null), P = p(!1), [h, G] = B(!1), [E, Q] = B(!1);
|
|
28
|
+
D(() => {
|
|
29
29
|
const e = () => {
|
|
30
|
-
|
|
31
|
-
j(n);
|
|
30
|
+
Q(document.documentElement.classList.contains("dark"));
|
|
32
31
|
};
|
|
33
32
|
e();
|
|
34
33
|
const t = new MutationObserver(e);
|
|
35
34
|
return t.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => t.disconnect();
|
|
36
35
|
}, []);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
const k = F || (E ? se : ae), N = H || (E ? ne : oe), u = l(() => {
|
|
37
|
+
const e = a.current, t = e == null ? void 0 : e.getContext("2d");
|
|
38
|
+
!e || !t || (t.fillStyle = N === "transparent" ? "rgba(0,0,0,0)" : N, t.fillRect(0, 0, e.width, e.height));
|
|
39
|
+
}, [N]);
|
|
40
|
+
D(() => {
|
|
41
|
+
const e = a.current, t = I.current;
|
|
42
|
+
if (!e || !t) return;
|
|
43
|
+
const r = () => {
|
|
44
|
+
const i = t.getBoundingClientRect(), S = w ?? Math.round(i.width), y = m;
|
|
45
|
+
(e.width !== S || e.height !== y) && (e.width = S, e.height = y, u());
|
|
46
|
+
};
|
|
47
|
+
r();
|
|
48
|
+
const c = new ResizeObserver(r);
|
|
49
|
+
return c.observe(t), () => c.disconnect();
|
|
50
|
+
}, [w, m, u]), D(() => {
|
|
51
|
+
u();
|
|
52
|
+
}, [u, E]), D(() => {
|
|
53
|
+
const e = a.current;
|
|
54
|
+
if (!e || n || s) return;
|
|
55
|
+
const t = (r) => r.preventDefault();
|
|
47
56
|
return e.addEventListener("touchstart", t, { passive: !1 }), e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
48
57
|
e.removeEventListener("touchstart", t), e.removeEventListener("touchmove", t);
|
|
49
58
|
};
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
const t =
|
|
59
|
+
}, [n, s]);
|
|
60
|
+
const g = l((e) => {
|
|
61
|
+
const t = a.current;
|
|
53
62
|
if (!t) return { x: 0, y: 0 };
|
|
54
|
-
const
|
|
63
|
+
const r = t.getBoundingClientRect(), c = t.width / r.width, i = t.height / r.height;
|
|
55
64
|
if ("touches" in e) {
|
|
56
|
-
const
|
|
65
|
+
const S = e.touches[0];
|
|
57
66
|
return {
|
|
58
|
-
x: (
|
|
59
|
-
y: (
|
|
67
|
+
x: (S.clientX - r.left) * c,
|
|
68
|
+
y: (S.clientY - r.top) * i
|
|
60
69
|
};
|
|
61
70
|
}
|
|
62
71
|
return {
|
|
63
|
-
x: (e.clientX -
|
|
64
|
-
y: (e.clientY -
|
|
72
|
+
x: (e.clientX - r.left) * c,
|
|
73
|
+
y: (e.clientY - r.top) * i
|
|
65
74
|
};
|
|
66
|
-
}, []),
|
|
67
|
-
if (
|
|
68
|
-
const t =
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
if (!
|
|
72
|
-
const t =
|
|
73
|
-
if (!t || !
|
|
74
|
-
const i =
|
|
75
|
-
|
|
76
|
-
}, [
|
|
77
|
-
if (
|
|
78
|
-
const e =
|
|
75
|
+
}, []), x = l((e) => {
|
|
76
|
+
if (n || s) return;
|
|
77
|
+
const t = g(e);
|
|
78
|
+
P.current = !0, v.current = t;
|
|
79
|
+
}, [n, s, g]), O = l((e) => {
|
|
80
|
+
if (!P.current || n || s) return;
|
|
81
|
+
const t = a.current, r = t == null ? void 0 : t.getContext("2d"), c = v.current;
|
|
82
|
+
if (!t || !r || !c) return;
|
|
83
|
+
const i = g(e);
|
|
84
|
+
r.beginPath(), r.moveTo(c.x, c.y), r.lineTo(i.x, i.y), r.strokeStyle = k, r.lineWidth = C, r.lineCap = "round", r.lineJoin = "round", r.stroke(), v.current = i, G(!0);
|
|
85
|
+
}, [n, s, k, C, g]), T = l(() => {
|
|
86
|
+
if (P.current) {
|
|
87
|
+
const e = a.current;
|
|
79
88
|
if (e && o) {
|
|
80
89
|
const t = e.toDataURL(f, A);
|
|
81
90
|
o(t);
|
|
82
91
|
}
|
|
83
92
|
}
|
|
84
|
-
|
|
85
|
-
}, [
|
|
86
|
-
const e =
|
|
87
|
-
!e || !t || (t.
|
|
88
|
-
}, [
|
|
89
|
-
const e =
|
|
90
|
-
if (!e || !
|
|
93
|
+
P.current = !1, v.current = null;
|
|
94
|
+
}, [o, f, A]), J = l(() => {
|
|
95
|
+
const e = a.current, t = e == null ? void 0 : e.getContext("2d");
|
|
96
|
+
!e || !t || (t.clearRect(0, 0, e.width, e.height), u(), G(!1), o == null || o(null));
|
|
97
|
+
}, [u, o]), q = l(() => {
|
|
98
|
+
const e = a.current;
|
|
99
|
+
if (!e || !h) return;
|
|
91
100
|
const t = e.toDataURL(f, A);
|
|
92
101
|
o == null || o(t);
|
|
93
|
-
}, [
|
|
94
|
-
return /* @__PURE__ */
|
|
102
|
+
}, [h, o, f, A]);
|
|
103
|
+
return /* @__PURE__ */ b(
|
|
95
104
|
"div",
|
|
96
105
|
{
|
|
97
|
-
id:
|
|
98
|
-
"data-testid":
|
|
99
|
-
className:
|
|
100
|
-
"Bear-SignPad bear-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
id: V,
|
|
107
|
+
"data-testid": Y,
|
|
108
|
+
className: _(
|
|
109
|
+
"Bear-SignPad bear-w-full",
|
|
110
|
+
he,
|
|
111
|
+
n && "Bear-SignPad--disabled bear-opacity-50",
|
|
112
|
+
s && "Bear-SignPad--readonly",
|
|
113
|
+
X
|
|
105
114
|
),
|
|
106
|
-
...
|
|
115
|
+
...j,
|
|
107
116
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ b(
|
|
109
118
|
"div",
|
|
110
119
|
{
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
ref: I,
|
|
121
|
+
className: _(
|
|
122
|
+
"Bear-SignPad__canvas-wrapper bear-w-full bear-overflow-hidden",
|
|
113
123
|
"touch-none",
|
|
114
124
|
de,
|
|
115
|
-
!
|
|
116
|
-
|
|
117
|
-
!
|
|
125
|
+
!n && !s && ue,
|
|
126
|
+
n && "bear-cursor-not-allowed",
|
|
127
|
+
!n && !s && "bear-cursor-crosshair"
|
|
118
128
|
),
|
|
119
129
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ d(
|
|
121
131
|
"canvas",
|
|
122
132
|
{
|
|
123
|
-
ref:
|
|
124
|
-
className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-
|
|
125
|
-
style: {
|
|
126
|
-
onMouseDown:
|
|
127
|
-
onMouseMove:
|
|
133
|
+
ref: a,
|
|
134
|
+
className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full touch-none",
|
|
135
|
+
style: { height: m, touchAction: "none" },
|
|
136
|
+
onMouseDown: x,
|
|
137
|
+
onMouseMove: O,
|
|
128
138
|
onMouseUp: T,
|
|
129
139
|
onMouseLeave: T,
|
|
130
|
-
onTouchStart:
|
|
131
|
-
onTouchMove:
|
|
140
|
+
onTouchStart: x,
|
|
141
|
+
onTouchMove: O,
|
|
132
142
|
onTouchEnd: T
|
|
133
143
|
}
|
|
134
144
|
),
|
|
135
|
-
!
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
145
|
+
!h && /* @__PURE__ */ d("div", { className: _("Bear-SignPad__placeholder", ce), children: K }),
|
|
146
|
+
/* @__PURE__ */ d("div", { className: _("Bear-SignPad__line", ie) }),
|
|
147
|
+
/* @__PURE__ */ d("span", { className: _("Bear-SignPad__x-mark", le), children: "×" })
|
|
138
148
|
]
|
|
139
149
|
}
|
|
140
150
|
),
|
|
141
|
-
(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{
|
|
145
|
-
size: "sm",
|
|
146
|
-
variant: "ghost",
|
|
147
|
-
onClick: z,
|
|
148
|
-
disabled: r || !c,
|
|
149
|
-
children: H
|
|
150
|
-
}
|
|
151
|
-
),
|
|
152
|
-
b && /* @__PURE__ */ l(
|
|
153
|
-
O,
|
|
154
|
-
{
|
|
155
|
-
size: "sm",
|
|
156
|
-
variant: "primary",
|
|
157
|
-
onClick: Q,
|
|
158
|
-
disabled: r || !c,
|
|
159
|
-
children: K
|
|
160
|
-
}
|
|
161
|
-
)
|
|
151
|
+
(L || R) && /* @__PURE__ */ b("div", { className: _("Bear-SignPad__actions", _e), children: [
|
|
152
|
+
L && /* @__PURE__ */ d(M, { size: "sm", variant: "ghost", onClick: J, disabled: n || !h, children: W }),
|
|
153
|
+
R && /* @__PURE__ */ d(M, { size: "sm", variant: "primary", onClick: q, disabled: n || !h, children: z })
|
|
162
154
|
] })
|
|
163
155
|
]
|
|
164
156
|
}
|
|
165
157
|
);
|
|
166
158
|
};
|
|
167
159
|
export {
|
|
168
|
-
|
|
160
|
+
ge as SignPad
|
|
169
161
|
};
|
|
@@ -2,9 +2,9 @@ import { HTMLAttributes } from 'react';
|
|
|
2
2
|
export interface SignPadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
3
3
|
/** Callback when signature changes - receives base64 image data */
|
|
4
4
|
onChange?: (signature: string | null) => void;
|
|
5
|
-
/**
|
|
5
|
+
/** Canvas resolution width (internal pixels). CSS width is always 100% of container. */
|
|
6
6
|
width?: number;
|
|
7
|
-
/**
|
|
7
|
+
/** Canvas resolution height (internal pixels). Also sets the CSS height. */
|
|
8
8
|
height?: number;
|
|
9
9
|
/** Stroke color */
|
|
10
10
|
strokeColor?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),t=require("../../utils/cn.cjs"),n=require("./SplitButton.const.cjs"),j=u=>{const{label:b,icon:m,options:C,variant:N="primary",size:c="md",disabled:f=!1,loading:d=!1,onClick:A,dropdownAlign:E="left",className:_,testId:h,...L}=u,[r,l]=i.useState(!1),o=i.useRef(null);i.useEffect(()=>{const e=R=>{o.current&&!o.current.contains(R.target)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const O=i.useCallback(e=>{e.disabled||(e.onClick(),l(!1))},[]),S=n.VARIANT_CLASSES[N],p=n.SIZE_CLASSES[c],x=n.ARROW_SIZE_CLASSES[c],a=f||d;return s.jsxs("div",{ref:o,className:t.cn(n.ROOT_CLASSES,_),"data-testid":h,children:[s.jsxs("button",{type:"button",className:t.cn(n.MAIN_BTN_CLASSES,S,p,a&&"bear-opacity-50 bear-cursor-not-allowed"),onClick:A,disabled:a,...L,children:[d?s.jsx("span",{className:n.SPINNER_CLASSES}):m,b]}),s.jsx("button",{type:"button",className:t.cn(n.ARROW_BTN_CLASSES,S,x,a&&"bear-opacity-50 bear-cursor-not-allowed"),onClick:()=>!a&&l(!r),disabled:a,"aria-label":"More options","aria-expanded":r,children:s.jsx("svg",{className:t.cn("bear-w-4 bear-h-4 bear-transition-transform",r&&"bear-rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),r&&s.jsx("div",{className:t.cn(n.DROPDOWN_CLASSES,E==="right"?"bear-right-0":"bear-left-0","bear-top-full"),children:C.map(e=>s.jsxs("div",{className:t.cn(n.OPTION_CLASSES,e.danger&&n.OPTION_DANGER_CLASSES,e.disabled&&n.OPTION_DISABLED_CLASSES),onClick:()=>O(e),role:"menuitem",children:[e.icon&&s.jsx("span",{className:"bear-w-4 bear-h-4 bear-flex-shrink-0",children:e.icon}),e.label]},e.id))})]})};exports.SplitButton=j;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r={primary:"bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600",secondary:"bear-bg-gray-600 bear-text-white hover:bear-bg-gray-700",outline:"bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700",danger:"bear-bg-red-500 bear-text-white hover:bear-bg-red-600"},e={sm:"bear-text-sm bear-py-1.5 bear-px-3",md:"bear-text-sm bear-py-2 bear-px-4",lg:"bear-text-base bear-py-2.5 bear-px-5"},a={sm:"bear-py-1.5 bear-px-2",md:"bear-py-2 bear-px-2.5",lg:"bear-py-2.5 bear-px-3"},b="Bear-SplitButton bear-relative bear-inline-flex",t="bear-font-medium bear-transition-colors bear-rounded-l-lg bear-flex bear-items-center bear-gap-1.5",S="bear-rounded-r-lg bear-border-l bear-border-white/20 bear-transition-colors bear-flex bear-items-center bear-justify-center",o="bear-absolute bear-z-[9999] bear-mt-1 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-py-1 bear-min-w-[160px] bear-animate-in",n="bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-1.5 bear-text-sm bear-cursor-pointer bear-transition-colors bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700",d="bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20",i="bear-opacity-40 bear-cursor-not-allowed",A="bear-w-4 bear-h-4 bear-border-2 bear-border-current/30 bear-border-t-current bear-rounded-full bear-animate-spin";exports.ARROW_BTN_CLASSES=S;exports.ARROW_SIZE_CLASSES=a;exports.DROPDOWN_CLASSES=o;exports.MAIN_BTN_CLASSES=t;exports.OPTION_CLASSES=n;exports.OPTION_DANGER_CLASSES=d;exports.OPTION_DISABLED_CLASSES=i;exports.ROOT_CLASSES=b;exports.SIZE_CLASSES=e;exports.SPINNER_CLASSES=A;exports.VARIANT_CLASSES=r;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const VARIANT_CLASSES: {
|
|
2
|
+
readonly primary: "bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600";
|
|
3
|
+
readonly secondary: "bear-bg-gray-600 bear-text-white hover:bear-bg-gray-700";
|
|
4
|
+
readonly outline: "bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700";
|
|
5
|
+
readonly danger: "bear-bg-red-500 bear-text-white hover:bear-bg-red-600";
|
|
6
|
+
};
|
|
7
|
+
export declare const SIZE_CLASSES: {
|
|
8
|
+
readonly sm: "bear-text-sm bear-py-1.5 bear-px-3";
|
|
9
|
+
readonly md: "bear-text-sm bear-py-2 bear-px-4";
|
|
10
|
+
readonly lg: "bear-text-base bear-py-2.5 bear-px-5";
|
|
11
|
+
};
|
|
12
|
+
export declare const ARROW_SIZE_CLASSES: {
|
|
13
|
+
readonly sm: "bear-py-1.5 bear-px-2";
|
|
14
|
+
readonly md: "bear-py-2 bear-px-2.5";
|
|
15
|
+
readonly lg: "bear-py-2.5 bear-px-3";
|
|
16
|
+
};
|
|
17
|
+
export declare const ROOT_CLASSES = "Bear-SplitButton bear-relative bear-inline-flex";
|
|
18
|
+
export declare const MAIN_BTN_CLASSES = "bear-font-medium bear-transition-colors bear-rounded-l-lg bear-flex bear-items-center bear-gap-1.5";
|
|
19
|
+
export declare const ARROW_BTN_CLASSES = "bear-rounded-r-lg bear-border-l bear-border-white/20 bear-transition-colors bear-flex bear-items-center bear-justify-center";
|
|
20
|
+
export declare const DROPDOWN_CLASSES = "bear-absolute bear-z-[9999] bear-mt-1 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-py-1 bear-min-w-[160px] bear-animate-in";
|
|
21
|
+
export declare const OPTION_CLASSES = "bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-1.5 bear-text-sm bear-cursor-pointer bear-transition-colors bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700";
|
|
22
|
+
export declare const OPTION_DANGER_CLASSES = "bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20";
|
|
23
|
+
export declare const OPTION_DISABLED_CLASSES = "bear-opacity-40 bear-cursor-not-allowed";
|
|
24
|
+
export declare const DIVIDER_CLASSES = "bear-border-l bear-border-white/30";
|
|
25
|
+
export declare const SPINNER_CLASSES = "bear-w-4 bear-h-4 bear-border-2 bear-border-current/30 bear-border-t-current bear-rounded-full bear-animate-spin";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const r = {
|
|
2
|
+
primary: "bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600",
|
|
3
|
+
secondary: "bear-bg-gray-600 bear-text-white hover:bear-bg-gray-700",
|
|
4
|
+
outline: "bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700",
|
|
5
|
+
danger: "bear-bg-red-500 bear-text-white hover:bear-bg-red-600"
|
|
6
|
+
}, e = {
|
|
7
|
+
sm: "bear-text-sm bear-py-1.5 bear-px-3",
|
|
8
|
+
md: "bear-text-sm bear-py-2 bear-px-4",
|
|
9
|
+
lg: "bear-text-base bear-py-2.5 bear-px-5"
|
|
10
|
+
}, a = {
|
|
11
|
+
sm: "bear-py-1.5 bear-px-2",
|
|
12
|
+
md: "bear-py-2 bear-px-2.5",
|
|
13
|
+
lg: "bear-py-2.5 bear-px-3"
|
|
14
|
+
}, b = "Bear-SplitButton bear-relative bear-inline-flex", t = "bear-font-medium bear-transition-colors bear-rounded-l-lg bear-flex bear-items-center bear-gap-1.5", o = "bear-rounded-r-lg bear-border-l bear-border-white/20 bear-transition-colors bear-flex bear-items-center bear-justify-center", n = "bear-absolute bear-z-[9999] bear-mt-1 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-py-1 bear-min-w-[160px] bear-animate-in", d = "bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-1.5 bear-text-sm bear-cursor-pointer bear-transition-colors bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-700", i = "bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20", S = "bear-opacity-40 bear-cursor-not-allowed", s = "bear-w-4 bear-h-4 bear-border-2 bear-border-current/30 bear-border-t-current bear-rounded-full bear-animate-spin";
|
|
15
|
+
export {
|
|
16
|
+
o as ARROW_BTN_CLASSES,
|
|
17
|
+
a as ARROW_SIZE_CLASSES,
|
|
18
|
+
n as DROPDOWN_CLASSES,
|
|
19
|
+
t as MAIN_BTN_CLASSES,
|
|
20
|
+
d as OPTION_CLASSES,
|
|
21
|
+
i as OPTION_DANGER_CLASSES,
|
|
22
|
+
S as OPTION_DISABLED_CLASSES,
|
|
23
|
+
b as ROOT_CLASSES,
|
|
24
|
+
e as SIZE_CLASSES,
|
|
25
|
+
s as SPINNER_CLASSES,
|
|
26
|
+
r as VARIANT_CLASSES
|
|
27
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs as o, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as I, useRef as R, useEffect as v, useCallback as w } from "react";
|
|
3
|
+
import { cn as n } from "../../utils/cn.js";
|
|
4
|
+
import { SPINNER_CLASSES as g, SIZE_CLASSES as T, VARIANT_CLASSES as x, MAIN_BTN_CLASSES as D, ARROW_SIZE_CLASSES as y, ARROW_BTN_CLASSES as B, OPTION_DISABLED_CLASSES as P, OPTION_DANGER_CLASSES as W, OPTION_CLASSES as j, DROPDOWN_CLASSES as z, ROOT_CLASSES as M } from "./SplitButton.const.js";
|
|
5
|
+
const F = (S) => {
|
|
6
|
+
const {
|
|
7
|
+
label: b,
|
|
8
|
+
icon: m,
|
|
9
|
+
options: u,
|
|
10
|
+
variant: f = "primary",
|
|
11
|
+
size: l = "md",
|
|
12
|
+
disabled: C = !1,
|
|
13
|
+
loading: c = !1,
|
|
14
|
+
onClick: N,
|
|
15
|
+
dropdownAlign: A = "left",
|
|
16
|
+
className: E,
|
|
17
|
+
testId: p,
|
|
18
|
+
...h
|
|
19
|
+
} = S, [s, t] = I(!1), i = R(null);
|
|
20
|
+
v(() => {
|
|
21
|
+
const e = (k) => {
|
|
22
|
+
i.current && !i.current.contains(k.target) && t(!1);
|
|
23
|
+
};
|
|
24
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
25
|
+
}, []);
|
|
26
|
+
const L = w((e) => {
|
|
27
|
+
e.disabled || (e.onClick(), t(!1));
|
|
28
|
+
}, []), d = x[f], _ = T[l], O = y[l], r = C || c;
|
|
29
|
+
return /* @__PURE__ */ o("div", { ref: i, className: n(M, E), "data-testid": p, children: [
|
|
30
|
+
/* @__PURE__ */ o(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
type: "button",
|
|
34
|
+
className: n(D, d, _, r && "bear-opacity-50 bear-cursor-not-allowed"),
|
|
35
|
+
onClick: N,
|
|
36
|
+
disabled: r,
|
|
37
|
+
...h,
|
|
38
|
+
children: [
|
|
39
|
+
c ? /* @__PURE__ */ a("span", { className: g }) : m,
|
|
40
|
+
b
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ a(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
className: n(B, d, O, r && "bear-opacity-50 bear-cursor-not-allowed"),
|
|
49
|
+
onClick: () => !r && t(!s),
|
|
50
|
+
disabled: r,
|
|
51
|
+
"aria-label": "More options",
|
|
52
|
+
"aria-expanded": s,
|
|
53
|
+
children: /* @__PURE__ */ a("svg", { className: n("bear-w-4 bear-h-4 bear-transition-transform", s && "bear-rotate-180"), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
s && /* @__PURE__ */ a("div", { className: n(z, A === "right" ? "bear-right-0" : "bear-left-0", "bear-top-full"), children: u.map((e) => /* @__PURE__ */ o(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: n(j, e.danger && W, e.disabled && P),
|
|
60
|
+
onClick: () => L(e),
|
|
61
|
+
role: "menuitem",
|
|
62
|
+
children: [
|
|
63
|
+
e.icon && /* @__PURE__ */ a("span", { className: "bear-w-4 bear-h-4 bear-flex-shrink-0", children: e.icon }),
|
|
64
|
+
e.label
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
e.id
|
|
68
|
+
)) })
|
|
69
|
+
] });
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
F as SplitButton
|
|
73
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export interface SplitButtonOption {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
danger?: boolean;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface SplitButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
11
|
+
label: string;
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
options: SplitButtonOption[];
|
|
14
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'danger';
|
|
15
|
+
size?: 'sm' | 'md' | 'lg';
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
dropdownAlign?: 'left' | 'right';
|
|
20
|
+
testId?: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("react"),_=require("../../utils/cn.cjs"),b=require("../Typography/Typography.cjs"),t=require("./Spoiler.const.cjs"),v=({maxHeight:o,showLabel:T=t.DEFAULT_SHOW_LABEL,hideLabel:p=t.DEFAULT_HIDE_LABEL,children:i,initialExpanded:g=!1,transitionDuration:f=t.TRANSITION_DURATION,className:h,testId:y,...L})=>{var a;const[s,A]=e.useState(g),[u,E]=e.useState(!1),[N,l]=e.useState(null),n=e.useRef(null);e.useEffect(()=>{const r=n.current;if(!r)return;const d=()=>{E(r.scrollHeight>o)};d();const S=new ResizeObserver(d);return S.observe(r),()=>S.disconnect()},[o,i]),e.useLayoutEffect(()=>{s&&n.current?l(n.current.scrollHeight):l(null)},[s,i]);const O=u?s?N??((a=n.current)==null?void 0:a.scrollHeight)??o:o:void 0;return c.jsxs("div",{className:_.cn(t.ROOT_CLASS,h),"data-testid":y,...L,children:[c.jsx("div",{ref:n,className:t.CONTENT_CLASS,style:{maxHeight:O,transitionDuration:`${f}ms`},children:i}),u&&c.jsx("button",{type:"button",className:t.BUTTON_CLASS,onClick:()=>A(r=>!r),"aria-expanded":s,children:c.jsx(b.Typography,{variant:"body2",component:"span",children:s?p:T})})]})};exports.Spoiler=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Show more",r="Show less",t=300,o="Bear-Spoiler",S="Bear-Spoiler__content bear-overflow-hidden bear-transition-[max-height]",a="Bear-Spoiler__toggle bear-mt-2 bear-text-primary dark:bear-text-zinc-200 bear-font-medium hover:bear-underline bear-cursor-pointer bear-bg-transparent bear-border-0 bear-p-0";exports.BUTTON_CLASS=a;exports.CONTENT_CLASS=S;exports.DEFAULT_HIDE_LABEL=r;exports.DEFAULT_SHOW_LABEL=e;exports.ROOT_CLASS=o;exports.TRANSITION_DURATION=t;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DEFAULT_SHOW_LABEL = "Show more";
|
|
2
|
+
export declare const DEFAULT_HIDE_LABEL = "Show less";
|
|
3
|
+
export declare const TRANSITION_DURATION = 300;
|
|
4
|
+
export declare const ROOT_CLASS = "Bear-Spoiler";
|
|
5
|
+
export declare const CONTENT_CLASS = "Bear-Spoiler__content bear-overflow-hidden bear-transition-[max-height]";
|
|
6
|
+
export declare const BUTTON_CLASS = "Bear-Spoiler__toggle bear-mt-2 bear-text-primary dark:bear-text-zinc-200 bear-font-medium hover:bear-underline bear-cursor-pointer bear-bg-transparent bear-border-0 bear-p-0";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const e = "Show more", r = "Show less", o = 300, t = "Bear-Spoiler", a = "Bear-Spoiler__content bear-overflow-hidden bear-transition-[max-height]", n = "Bear-Spoiler__toggle bear-mt-2 bear-text-primary dark:bear-text-zinc-200 bear-font-medium hover:bear-underline bear-cursor-pointer bear-bg-transparent bear-border-0 bear-p-0";
|
|
2
|
+
export {
|
|
3
|
+
n as BUTTON_CLASS,
|
|
4
|
+
a as CONTENT_CLASS,
|
|
5
|
+
r as DEFAULT_HIDE_LABEL,
|
|
6
|
+
e as DEFAULT_SHOW_LABEL,
|
|
7
|
+
t as ROOT_CLASS,
|
|
8
|
+
o as TRANSITION_DURATION
|
|
9
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsxs as O, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useRef as _, useEffect as v, useLayoutEffect as H } from "react";
|
|
3
|
+
import { cn as b } from "../../utils/cn.js";
|
|
4
|
+
import { Typography as y } from "../Typography/Typography.js";
|
|
5
|
+
import { TRANSITION_DURATION as R, CONTENT_CLASS as C, BUTTON_CLASS as D, DEFAULT_HIDE_LABEL as x, DEFAULT_SHOW_LABEL as I, ROOT_CLASS as U } from "./Spoiler.const.js";
|
|
6
|
+
const z = ({
|
|
7
|
+
maxHeight: s,
|
|
8
|
+
showLabel: f = I,
|
|
9
|
+
hideLabel: p = x,
|
|
10
|
+
children: r,
|
|
11
|
+
initialExpanded: m = !1,
|
|
12
|
+
transitionDuration: T = R,
|
|
13
|
+
className: S,
|
|
14
|
+
testId: g,
|
|
15
|
+
...h
|
|
16
|
+
}) => {
|
|
17
|
+
var a;
|
|
18
|
+
const [e, L] = c(m), [i, A] = c(!1), [E, l] = c(null), t = _(null);
|
|
19
|
+
v(() => {
|
|
20
|
+
const o = t.current;
|
|
21
|
+
if (!o) return;
|
|
22
|
+
const u = () => {
|
|
23
|
+
A(o.scrollHeight > s);
|
|
24
|
+
};
|
|
25
|
+
u();
|
|
26
|
+
const d = new ResizeObserver(u);
|
|
27
|
+
return d.observe(o), () => d.disconnect();
|
|
28
|
+
}, [s, r]), H(() => {
|
|
29
|
+
e && t.current ? l(t.current.scrollHeight) : l(null);
|
|
30
|
+
}, [e, r]);
|
|
31
|
+
const N = i ? e ? E ?? ((a = t.current) == null ? void 0 : a.scrollHeight) ?? s : s : void 0;
|
|
32
|
+
return /* @__PURE__ */ O("div", { className: b(U, S), "data-testid": g, ...h, children: [
|
|
33
|
+
/* @__PURE__ */ n(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: t,
|
|
37
|
+
className: C,
|
|
38
|
+
style: {
|
|
39
|
+
maxHeight: N,
|
|
40
|
+
transitionDuration: `${T}ms`
|
|
41
|
+
},
|
|
42
|
+
children: r
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
i && /* @__PURE__ */ n(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
className: D,
|
|
50
|
+
onClick: () => L((o) => !o),
|
|
51
|
+
"aria-expanded": e,
|
|
52
|
+
children: /* @__PURE__ */ n(y, { variant: "body2", component: "span", children: e ? p : f })
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] });
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
z as Spoiler
|
|
59
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export interface SpoilerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
maxHeight: number;
|
|
4
|
+
showLabel?: string;
|
|
5
|
+
hideLabel?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
initialExpanded?: boolean;
|
|
8
|
+
transitionDuration?: number;
|
|
9
|
+
testId?: string;
|
|
10
|
+
}
|
package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),n=require("../../../../utils/cn.cjs"),i=require("../../TimePicker.constants.cjs"),v=require("../../helpers/ClockFaceSvg.cjs"),m="bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blue-50 dark:bear-bg-blue-900/30 bear-rounded bear-px-1",_="bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-300 bear-cursor-pointer bear-px-1",D=({selectedHour:c,setSelectedHour:o,selectedMinute:d,setSelectedMinute:x,period:k,setPeriod:T,format:a,hours:S,minutes:h,timeValue:p,clearable:E,onChange:l,onConfirm:C,onClose:N,translations:P})=>{const[I,s]=u.useState("hour"),b={...i.TIMEPICKER_DEFAULT_TRANSLATIONS,...P},j=a==="12h"?c===12?12:c%12:c,y=d,g=j.toString().padStart(2,"0"),A=y.toString().padStart(2,"0"),M=a==="12h"?[...i.CLOCK_HOURS_12]:S,t=I==="hour",O=t?M:h,R=u.useCallback(r=>{t?(o(a==="12h"&&r===0?12:r),s("minute")):x(r)},[t,a,o,x]);return e.jsxs("div",{className:n.cn(i.TIMEPICKER_DROPDOWN_CLASSES,"Bear-TimePicker__dial bear-w-72"),children:[e.jsx("div",{className:"Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2",children:b.selectTime}),e.jsxs("div",{className:"Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-1 bear-mb-4",children:[e.jsx("button",{type:"button",onClick:()=>s("hour"),className:n.cn("Bear-TimePicker__dial-hour-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",t?m:_),"aria-label":b.hour,children:g}),e.jsx("span",{className:"bear-text-2xl bear-font-bold bear-text-gray-900 dark:bear-text-white",children:":"}),e.jsx("button",{type:"button",onClick:()=>s("minute"),className:n.cn("Bear-TimePicker__dial-minute-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",t?_:m),"aria-label":b.minute,children:A}),a==="12h"&&e.jsx("div",{className:"Bear-TimePicker__dial-period bear-flex bear-flex-col bear-gap-0.5 bear-ml-2",children:["AM","PM"].map(r=>e.jsx("button",{onClick:()=>T(r),className:n.cn("Bear-TimePicker__dial-period-btn bear-px-2 bear-py-0.5 bear-rounded bear-text-sm bear-transition-colors",k===r?"bear-text-blue-600 dark:bear-text-blue-400 bear-font-medium":"bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"),children:r},r))})]}),e.jsx("div",{className:"Bear-TimePicker__dial-face bear-relative bear-w-48 bear-h-48 bear-mx-auto bear-mb-4",children:e.jsx(v.ClockFaceSvg,{values:O,isHourMode:t,format:a,selectedHour:c,selectedMinute:d,onSelect:R})}),e.jsxs("div",{className:i.TIMEPICKER_FOOTER_CLASSES,children:[E&&p&&e.jsx("button",{onClick:()=>{l==null||l(null),N()},className:i.TIMEPICKER_CLEAR_BUTTON_CLASSES,children:b.cancel}),e.jsx("button",{onClick:C,className:i.TIMEPICKER_CONFIRM_BUTTON_CLASSES,children:b.ok})]})]})};exports.TimePickerDialDropdown=D;
|