@forgedevstack/bear 1.1.1 → 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/AlertDialog/AlertDialog.cjs +1 -0
- package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -0
- package/dist/components/AlertDialog/AlertDialog.const.d.ts +5 -0
- package/dist/components/AlertDialog/AlertDialog.const.js +8 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +4 -0
- package/dist/components/AlertDialog/AlertDialog.js +107 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +34 -0
- package/dist/components/AlertDialog/index.d.ts +3 -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/AspectRatio/AspectRatio.cjs +1 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +3 -0
- package/dist/components/AspectRatio/AspectRatio.js +29 -0
- package/dist/components/AspectRatio/AspectRatio.types.d.ts +9 -0
- package/dist/components/AspectRatio/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/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +2 -2
- package/dist/components/Button/Button.constants.d.ts +1 -0
- package/dist/components/Button/Button.constants.js +10 -3
- package/dist/components/Button/Button.js +92 -84
- package/dist/components/Button/Button.types.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/FormField/FormField.cjs +1 -0
- package/dist/components/FormField/FormField.const.cjs +1 -0
- package/dist/components/FormField/FormField.const.d.ts +20 -0
- package/dist/components/FormField/FormField.const.js +23 -0
- package/dist/components/FormField/FormField.d.ts +3 -0
- package/dist/components/FormField/FormField.js +127 -0
- package/dist/components/FormField/FormField.types.d.ts +23 -0
- package/dist/components/FormField/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 +114 -44
- package/dist/components/Input/Input.types.d.ts +20 -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/components/ClearIcon/ClearIcon.cjs +1 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.d.ts +7 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.js +25 -0
- package/dist/components/Input/components/ClearIcon/index.d.ts +1 -0
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/InputGroup/InputGroup.cjs +1 -0
- package/dist/components/InputGroup/InputGroup.d.ts +4 -0
- package/dist/components/InputGroup/InputGroup.js +63 -0
- package/dist/components/InputGroup/InputGroup.types.d.ts +23 -0
- package/dist/components/InputGroup/index.d.ts +2 -0
- 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/PasswordInput/PasswordInput.cjs +1 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/components/PasswordInput/PasswordInput.js +61 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +18 -0
- package/dist/components/PasswordInput/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/ResizableTextarea/ResizableTextarea.cjs +1 -1
- package/dist/components/ResizableTextarea/ResizableTextarea.js +90 -54
- package/dist/components/ResizableTextarea/ResizableTextarea.types.d.ts +10 -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/RichEditor/RichEditor.cjs +1 -1
- package/dist/components/RichEditor/RichEditor.js +186 -169
- package/dist/components/RichEditor/RichEditor.types.d.ts +4 -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 +54 -0
- package/dist/components/index.js +349 -292
- package/dist/index.cjs +1 -1
- package/dist/index.js +439 -382
- 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/dist/types/component.types.d.ts +13 -0
- package/package.json +10 -6
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as T } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Typography as k } from "../Typography/Typography.js";
|
|
5
|
+
import { DEFAULT_SIZE as x, TRACK_COLOR as N, DEFAULT_THICKNESS as O, ROOT_CLASS as S } from "./RingProgress.const.js";
|
|
6
|
+
const j = ({
|
|
7
|
+
sections: d,
|
|
8
|
+
size: t = x,
|
|
9
|
+
thickness: a = O,
|
|
10
|
+
roundCaps: g = !1,
|
|
11
|
+
label: o,
|
|
12
|
+
rootColor: s,
|
|
13
|
+
className: v,
|
|
14
|
+
testId: y,
|
|
15
|
+
...b
|
|
16
|
+
}) => {
|
|
17
|
+
const l = d.reduce((r, i) => r + i.value, 0), c = (t - a) / 2, m = 2 * Math.PI * c, f = t / 2, h = t / 2;
|
|
18
|
+
let p = 0;
|
|
19
|
+
return /* @__PURE__ */ n(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: T(S, v),
|
|
23
|
+
"data-testid": y,
|
|
24
|
+
...b,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ n("svg", { width: t, height: t, className: "bear-rotate-[-90deg]", children: [
|
|
27
|
+
/* @__PURE__ */ e(
|
|
28
|
+
"circle",
|
|
29
|
+
{
|
|
30
|
+
cx: f,
|
|
31
|
+
cy: h,
|
|
32
|
+
r: c,
|
|
33
|
+
fill: "none",
|
|
34
|
+
strokeWidth: a,
|
|
35
|
+
className: s ? void 0 : N,
|
|
36
|
+
style: s ? { stroke: s } : void 0
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
l > 0 && d.map((r, i) => {
|
|
40
|
+
const u = r.value / l * m, L = -p;
|
|
41
|
+
return p += u, /* @__PURE__ */ n("g", { children: [
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
"circle",
|
|
44
|
+
{
|
|
45
|
+
cx: f,
|
|
46
|
+
cy: h,
|
|
47
|
+
r: c,
|
|
48
|
+
fill: "none",
|
|
49
|
+
strokeWidth: a,
|
|
50
|
+
stroke: r.color,
|
|
51
|
+
strokeDasharray: `${u} ${m}`,
|
|
52
|
+
strokeDashoffset: L,
|
|
53
|
+
strokeLinecap: g ? "round" : "butt"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
r.tooltip && /* @__PURE__ */ e("title", { children: r.tooltip })
|
|
57
|
+
] }, i);
|
|
58
|
+
})
|
|
59
|
+
] }),
|
|
60
|
+
o !== void 0 && /* @__PURE__ */ e("div", { className: "bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center", children: typeof o == "string" ? /* @__PURE__ */ e(k, { variant: "body2", color: "secondary", children: o }) : o })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
j as RingProgress
|
|
67
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export interface RingProgressSection {
|
|
3
|
+
value: number;
|
|
4
|
+
color: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RingProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
sections: RingProgressSection[];
|
|
9
|
+
size?: number;
|
|
10
|
+
thickness?: number;
|
|
11
|
+
roundCaps?: boolean;
|
|
12
|
+
label?: ReactNode;
|
|
13
|
+
rootColor?: string;
|
|
14
|
+
testId?: string;
|
|
15
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),r=require("react"),S=require("../../utils/cn.cjs"),y=require("../Button/Button.cjs"),s=require("./SignPad.const.cjs"),V=B=>{const{onChange:a,width:p,height:b=s.SIGN_PAD_DEFAULT_HEIGHT,strokeColor:O,strokeWidth:T=s.SIGN_PAD_DEFAULT_STROKE_WIDTH,backgroundColor:M,placeholder:U=s.SIGN_PAD_DEFAULT_PLACEHOLDER,disabled:o=!1,readOnly:c=!1,showClear:N=!0,showSave:m=!1,clearText:j="Clear",saveText:F="Save",outputFormat:P=s.SIGN_PAD_DEFAULT_OUTPUT_FORMAT,outputQuality:v=s.SIGN_PAD_DEFAULT_OUTPUT_QUALITY,className:H,testId:K,id:q,...W}=B,i=r.useRef(null),w=r.useRef(null),A=r.useRef(null),g=r.useRef(!1),[h,L]=r.useState(!1),[E,z]=r.useState(!1);r.useEffect(()=>{const e=()=>{z(document.documentElement.classList.contains("dark"))};e();const t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const k=O||(E?s.SIGN_PAD_STROKE_DARK:s.SIGN_PAD_STROKE_LIGHT),C=M||(E?s.SIGN_PAD_BG_DARK:s.SIGN_PAD_BG_LIGHT),_=r.useCallback(()=>{const e=i.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=C==="transparent"?"rgba(0,0,0,0)":C,t.fillRect(0,0,e.width,e.height))},[C]);r.useEffect(()=>{const e=i.current,t=w.current;if(!e||!t)return;const n=()=>{const d=t.getBoundingClientRect(),f=p??Math.round(d.width),G=b;(e.width!==f||e.height!==G)&&(e.width=f,e.height=G,_())};n();const l=new ResizeObserver(n);return l.observe(t),()=>l.disconnect()},[p,b,_]),r.useEffect(()=>{_()},[_,E]),r.useEffect(()=>{const e=i.current;if(!e||o||c)return;const t=n=>n.preventDefault();return e.addEventListener("touchstart",t,{passive:!1}),e.addEventListener("touchmove",t,{passive:!1}),()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchmove",t)}},[o,c]);const D=r.useCallback(e=>{const t=i.current;if(!t)return{x:0,y:0};const n=t.getBoundingClientRect(),l=t.width/n.width,d=t.height/n.height;if("touches"in e){const f=e.touches[0];return{x:(f.clientX-n.left)*l,y:(f.clientY-n.top)*d}}return{x:(e.clientX-n.left)*l,y:(e.clientY-n.top)*d}},[]),I=r.useCallback(e=>{if(o||c)return;const t=D(e);g.current=!0,A.current=t},[o,c,D]),x=r.useCallback(e=>{if(!g.current||o||c)return;const t=i.current,n=t==null?void 0:t.getContext("2d"),l=A.current;if(!t||!n||!l)return;const d=D(e);n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(d.x,d.y),n.strokeStyle=k,n.lineWidth=T,n.lineCap="round",n.lineJoin="round",n.stroke(),A.current=d,L(!0)},[o,c,k,T,D]),R=r.useCallback(()=>{if(g.current){const e=i.current;if(e&&a){const t=e.toDataURL(P,v);a(t)}}g.current=!1,A.current=null},[a,P,v]),X=r.useCallback(()=>{const e=i.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.clearRect(0,0,e.width,e.height),_(),L(!1),a==null||a(null))},[_,a]),Y=r.useCallback(()=>{const e=i.current;if(!e||!h)return;const t=e.toDataURL(P,v);a==null||a(t)},[h,a,P,v]);return u.jsxs("div",{id:q,"data-testid":K,className:S.cn("Bear-SignPad bear-w-full",s.SIGN_PAD_ROOT_CLASSES,o&&"Bear-SignPad--disabled bear-opacity-50",c&&"Bear-SignPad--readonly",H),...W,children:[u.jsxs("div",{ref:w,className:S.cn("Bear-SignPad__canvas-wrapper bear-w-full bear-overflow-hidden","touch-none",s.SIGN_PAD_CANVAS_WRAPPER_CLASSES,!o&&!c&&s.SIGN_PAD_CANVAS_WRAPPER_HOVER,o&&"bear-cursor-not-allowed",!o&&!c&&"bear-cursor-crosshair"),children:[u.jsx("canvas",{ref:i,className:"Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full touch-none",style:{height:b,touchAction:"none"},onMouseDown:I,onMouseMove:x,onMouseUp:R,onMouseLeave:R,onTouchStart:I,onTouchMove:x,onTouchEnd:R}),!h&&u.jsx("div",{className:S.cn("Bear-SignPad__placeholder",s.SIGN_PAD_PLACEHOLDER_CLASSES),children:U}),u.jsx("div",{className:S.cn("Bear-SignPad__line",s.SIGN_PAD_LINE_CLASSES)}),u.jsx("span",{className:S.cn("Bear-SignPad__x-mark",s.SIGN_PAD_X_MARK_CLASSES),children:"×"})]}),(N||m)&&u.jsxs("div",{className:S.cn("Bear-SignPad__actions",s.SIGN_PAD_ACTIONS_CLASSES),children:[N&&u.jsx(y.Button,{size:"sm",variant:"ghost",onClick:X,disabled:o||!h,children:j}),m&&u.jsx(y.Button,{size:"sm",variant:"primary",onClick:Y,disabled:o||!h,children:F})]})]})};exports.SignPad=V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=200,e=2,S="Sign here",A="image/png",r=.92,a="#1f2937",b="#f3f4f6",t="#ffffff",D="#18181b",P="bear-inline-flex bear-flex-col bear-gap-2",E="bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600",I="hover:bear-border-pink-400 dark:hover:bear-border-pink-500",o="bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none",G="bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600",T="bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold",N="bear-flex bear-gap-2 bear-justify-end";exports.SIGN_PAD_ACTIONS_CLASSES=N;exports.SIGN_PAD_BG_DARK=D;exports.SIGN_PAD_BG_LIGHT=t;exports.SIGN_PAD_CANVAS_WRAPPER_CLASSES=E;exports.SIGN_PAD_CANVAS_WRAPPER_HOVER=I;exports.SIGN_PAD_DEFAULT_HEIGHT=_;exports.SIGN_PAD_DEFAULT_OUTPUT_FORMAT=A;exports.SIGN_PAD_DEFAULT_OUTPUT_QUALITY=r;exports.SIGN_PAD_DEFAULT_PLACEHOLDER=S;exports.SIGN_PAD_DEFAULT_STROKE_WIDTH=e;exports.SIGN_PAD_LINE_CLASSES=G;exports.SIGN_PAD_PLACEHOLDER_CLASSES=o;exports.SIGN_PAD_ROOT_CLASSES=P;exports.SIGN_PAD_STROKE_DARK=b;exports.SIGN_PAD_STROKE_LIGHT=a;exports.SIGN_PAD_X_MARK_CLASSES=T;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
const e =
|
|
1
|
+
const e = 200, r = 2, a = "Sign here", b = "image/png", _ = 0.92, t = "#1f2937", o = "#f3f4f6", A = "#ffffff", S = "#18181b", n = "bear-inline-flex bear-flex-col bear-gap-2", s = "bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600", D = "hover:bear-border-pink-400 dark:hover:bear-border-pink-500", P = "bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none", c = "bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600", E = "bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold", I = "bear-flex bear-gap-2 bear-justify-end";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
I as SIGN_PAD_ACTIONS_CLASSES,
|
|
4
|
+
S as SIGN_PAD_BG_DARK,
|
|
5
|
+
A as SIGN_PAD_BG_LIGHT,
|
|
6
6
|
s as SIGN_PAD_CANVAS_WRAPPER_CLASSES,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
D as SIGN_PAD_CANVAS_WRAPPER_HOVER,
|
|
8
|
+
e as SIGN_PAD_DEFAULT_HEIGHT,
|
|
9
9
|
b as SIGN_PAD_DEFAULT_OUTPUT_FORMAT,
|
|
10
|
-
|
|
10
|
+
_ as SIGN_PAD_DEFAULT_OUTPUT_QUALITY,
|
|
11
11
|
a as SIGN_PAD_DEFAULT_PLACEHOLDER,
|
|
12
|
-
|
|
13
|
-
e as SIGN_PAD_DEFAULT_WIDTH,
|
|
12
|
+
r as SIGN_PAD_DEFAULT_STROKE_WIDTH,
|
|
14
13
|
c as SIGN_PAD_LINE_CLASSES,
|
|
15
14
|
P as SIGN_PAD_PLACEHOLDER_CLASSES,
|
|
16
|
-
|
|
15
|
+
n as SIGN_PAD_ROOT_CLASSES,
|
|
17
16
|
o as SIGN_PAD_STROKE_DARK,
|
|
18
|
-
|
|
17
|
+
t as SIGN_PAD_STROKE_LIGHT,
|
|
19
18
|
E as SIGN_PAD_X_MARK_CLASSES
|
|
20
19
|
};
|
|
@@ -3,14 +3,12 @@ import { SignPadProps } from './SignPad.types';
|
|
|
3
3
|
/**
|
|
4
4
|
* SignPad - Digital signature capture component
|
|
5
5
|
*
|
|
6
|
+
* Canvas fills 100% of its container width. Height is configurable.
|
|
7
|
+
* Uses ResizeObserver so drawing works correctly at any size.
|
|
8
|
+
*
|
|
6
9
|
* @example
|
|
7
10
|
* ```tsx
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* <SignPad
|
|
11
|
-
* onChange={setSignature}
|
|
12
|
-
* placeholder="Sign here"
|
|
13
|
-
* />
|
|
11
|
+
* <SignPad onChange={setSignature} placeholder="Sign here" />
|
|
14
12
|
* ```
|
|
15
13
|
*/
|
|
16
14
|
export declare const SignPad: FC<SignPadProps>;
|
|
@@ -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
|
+
};
|