@forgedevstack/bear 1.0.4 → 1.0.6
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/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +8 -8
- package/dist/components/Button/Button.constants.cjs +1 -1
- package/dist/components/Button/Button.constants.js +1 -1
- package/dist/components/Button/Button.d.ts +5 -3
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.const.cjs +1 -1
- package/dist/components/Calendar/Calendar.const.d.ts +1 -0
- package/dist/components/Calendar/Calendar.const.js +6 -5
- package/dist/components/Calendar/Calendar.helpers.cjs +1 -1
- package/dist/components/Calendar/Calendar.helpers.js +4 -4
- package/dist/components/Calendar/Calendar.js +128 -128
- package/dist/components/Cascader/Cascader.cjs +1 -0
- package/dist/components/Cascader/Cascader.const.cjs +1 -0
- package/dist/components/Cascader/Cascader.const.d.ts +33 -0
- package/dist/components/Cascader/Cascader.const.js +21 -0
- package/dist/components/Cascader/Cascader.d.ts +17 -0
- package/dist/components/Cascader/Cascader.js +227 -0
- package/dist/components/Cascader/Cascader.types.d.ts +94 -0
- package/dist/components/Cascader/index.d.ts +2 -0
- package/dist/components/CommandPalette/CommandPalette.cjs +1 -0
- package/dist/components/CommandPalette/CommandPalette.const.cjs +1 -0
- package/dist/components/CommandPalette/CommandPalette.const.d.ts +25 -0
- package/dist/components/CommandPalette/CommandPalette.const.js +13 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +18 -0
- package/dist/components/CommandPalette/CommandPalette.js +190 -0
- package/dist/components/CommandPalette/CommandPalette.types.d.ts +90 -0
- package/dist/components/CommandPalette/CommandPalette.utils.cjs +1 -0
- package/dist/components/CommandPalette/CommandPalette.utils.d.ts +17 -0
- package/dist/components/CommandPalette/CommandPalette.utils.js +63 -0
- package/dist/components/CommandPalette/index.d.ts +2 -0
- package/dist/components/CreditInput/CreditInput.cjs +1 -0
- package/dist/components/CreditInput/CreditInput.const.cjs +1 -0
- package/dist/components/CreditInput/CreditInput.const.d.ts +37 -0
- package/dist/components/CreditInput/CreditInput.const.js +66 -0
- package/dist/components/CreditInput/CreditInput.d.ts +15 -0
- package/dist/components/CreditInput/CreditInput.js +214 -0
- package/dist/components/CreditInput/CreditInput.types.d.ts +93 -0
- package/dist/components/CreditInput/CreditInput.utils.cjs +1 -0
- package/dist/components/CreditInput/CreditInput.utils.d.ts +48 -0
- package/dist/components/CreditInput/CreditInput.utils.js +79 -0
- package/dist/components/CreditInput/index.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +108 -84
- package/dist/components/DatePicker/DatePicker.types.d.ts +2 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +75 -44
- package/dist/components/Form/Form.cjs +1 -0
- package/dist/components/Form/Form.const.cjs +1 -0
- package/dist/components/Form/Form.const.d.ts +33 -0
- package/dist/components/Form/Form.const.js +27 -0
- package/dist/components/Form/Form.context.cjs +1 -0
- package/dist/components/Form/Form.context.d.ts +13 -0
- package/dist/components/Form/Form.context.js +12 -0
- package/dist/components/Form/Form.d.ts +18 -0
- package/dist/components/Form/Form.js +230 -0
- package/dist/components/Form/Form.types.d.ts +166 -0
- package/dist/components/Form/Form.utils.cjs +1 -0
- package/dist/components/Form/Form.utils.d.ts +17 -0
- package/dist/components/Form/Form.utils.js +31 -0
- package/dist/components/Form/index.d.ts +3 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +36 -36
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -0
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -0
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +25 -0
- package/dist/components/NotificationCenter/NotificationCenter.const.js +28 -0
- package/dist/components/NotificationCenter/NotificationCenter.d.ts +15 -0
- package/dist/components/NotificationCenter/NotificationCenter.js +223 -0
- package/dist/components/NotificationCenter/NotificationCenter.types.d.ts +117 -0
- package/dist/components/NotificationCenter/NotificationCenter.utils.cjs +1 -0
- package/dist/components/NotificationCenter/NotificationCenter.utils.d.ts +11 -0
- package/dist/components/NotificationCenter/NotificationCenter.utils.js +19 -0
- package/dist/components/NotificationCenter/index.d.ts +2 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -0
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -0
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +33 -0
- package/dist/components/PhoneInput/PhoneInput.const.js +82 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +16 -0
- package/dist/components/PhoneInput/PhoneInput.js +194 -0
- package/dist/components/PhoneInput/PhoneInput.types.d.ts +108 -0
- package/dist/components/PhoneInput/PhoneInput.utils.cjs +1 -0
- package/dist/components/PhoneInput/PhoneInput.utils.d.ts +25 -0
- package/dist/components/PhoneInput/PhoneInput.utils.js +39 -0
- package/dist/components/PhoneInput/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +37 -37
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.const.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.const.d.ts +6 -2
- package/dist/components/Sidebar/Sidebar.const.js +24 -17
- package/dist/components/Sidebar/Sidebar.js +36 -31
- package/dist/components/Sidebar/Sidebar.types.d.ts +9 -0
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.cjs +1 -1
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.js +30 -29
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.js +56 -56
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.d.ts +22 -1
- package/dist/components/TimePicker/TimePicker.constants.js +36 -19
- package/dist/components/TimePicker/TimePicker.js +97 -131
- package/dist/components/TimePicker/TimePicker.types.d.ts +47 -6
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs +1 -0
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.d.ts +3 -0
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js +81 -0
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/index.d.ts +1 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.d.ts +3 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +84 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/index.d.ts +1 -0
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -0
- package/dist/components/TimePicker/helpers/ClockFaceSvg.d.ts +18 -0
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +67 -0
- package/dist/components/TimePicker/helpers/index.d.ts +2 -0
- package/dist/components/TimePicker/index.d.ts +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +13 -3
- package/dist/components/index.js +139 -126
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.js +25 -25
- package/dist/index.cjs +1 -1
- package/dist/index.js +247 -234
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.cjs +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +0 -3
- package/dist/components/DateTimePicker/DateTimePicker.js +0 -178
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +0 -26
- package/dist/components/DateTimePicker/DateTimePicker.utils.cjs +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.utils.d.ts +0 -2
- package/dist/components/DateTimePicker/DateTimePicker.utils.js +0 -16
- package/dist/components/DateTimePicker/index.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=256,E=64,t=16,S=12,I=14,_=18,o={default:"bear-bg-white dark:bear-bg-zinc-900 bear-border-zinc-200 dark:bear-border-zinc-700",bordered:"bear-bg-white dark:bear-bg-zinc-900 bear-border-2 bear-border-zinc-300 dark:bear-border-zinc-600 bear-rounded-xl bear-m-2",floating:"bear-bg-white/95 dark:bear-bg-zinc-900/95 bear-backdrop-blur-sm bear-shadow-2xl bear-rounded-xl bear-m-3"},A="bear-flex bear-items-center bear-gap-3 bear-py-2.5 bear-px-3 bear-rounded-lg bear-text-sm bear-transition-all bear-duration-200 bear-cursor-pointer",e="bear-bg-bear-500 bear-text-white bear-shadow-md",r="bear-bg-bear-50 dark:bear-bg-bear-900/30 bear-text-bear-700 dark:bear-text-bear-200 bear-border-l-2 bear-border-bear-500 -bear-ml-px bear-pl-[11px]",b="bear-relative bear-bg-bear-100 dark:bear-bg-bear-900/40 bear-text-bear-700 dark:bear-text-bear-200 before:bear-content-[''] before:bear-absolute before:bear-left-0 before:bear-top-1/2 before:-bear-translate-y-1/2 before:bear-w-1 before:bear-h-6 before:bear-rounded-full before:bear-bg-bear-500",n={fill:e,border:r,indicator:b},D="bear-text-zinc-600 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-900 dark:hover:bear-text-zinc-100",c="bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none",d="bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-zinc-400 dark:bear-text-zinc-500",i="bear-px-3 bear-py-4 bear-border-b bear-border-zinc-100 dark:bear-border-zinc-800 bear-flex bear-items-center bear-justify-between",R="bear-px-3 bear-py-3 bear-border-t bear-border-zinc-100 dark:bear-border-zinc-800 bear-mt-auto",T="bear-p-1.5 bear-rounded-lg bear-text-zinc-400 dark:bear-text-zinc-500 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-600 dark:hover:bear-text-zinc-300 bear-transition-colors";exports.SIDEBAR_COLLAPSED_WIDTH=E;exports.SIDEBAR_DEPTH_INDENT=S;exports.SIDEBAR_FOOTER_CLASSES=R;exports.SIDEBAR_GROUP_TITLE_CLASSES=d;exports.SIDEBAR_HEADER_CLASSES=i;exports.SIDEBAR_ICON_SIZE=I;exports.SIDEBAR_ITEM_ACTIVE_BORDER=r;exports.SIDEBAR_ITEM_ACTIVE_BY_VARIANT=n;exports.SIDEBAR_ITEM_ACTIVE_FILL=e;exports.SIDEBAR_ITEM_ACTIVE_INDICATOR=b;exports.SIDEBAR_ITEM_BASE_CLASSES=A;exports.SIDEBAR_ITEM_DISABLED_CLASSES=c;exports.SIDEBAR_ITEM_INACTIVE_CLASSES=D;exports.SIDEBAR_PADDING_BASE=t;exports.SIDEBAR_TOGGLE_CLASSES=T;exports.SIDEBAR_TOGGLE_ICON_SIZE=_;exports.SIDEBAR_VARIANT_STYLES=o;exports.SIDEBAR_WIDTH=a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SidebarVariant } from './Sidebar.types';
|
|
1
|
+
import { SidebarVariant, SidebarActiveVariant } from './Sidebar.types';
|
|
2
2
|
export declare const SIDEBAR_WIDTH = 256;
|
|
3
3
|
export declare const SIDEBAR_COLLAPSED_WIDTH = 64;
|
|
4
4
|
export declare const SIDEBAR_PADDING_BASE = 16;
|
|
@@ -7,7 +7,11 @@ export declare const SIDEBAR_ICON_SIZE = 14;
|
|
|
7
7
|
export declare const SIDEBAR_TOGGLE_ICON_SIZE = 18;
|
|
8
8
|
export declare const SIDEBAR_VARIANT_STYLES: Record<SidebarVariant, string>;
|
|
9
9
|
export declare const SIDEBAR_ITEM_BASE_CLASSES = "bear-flex bear-items-center bear-gap-3 bear-py-2.5 bear-px-3 bear-rounded-lg bear-text-sm bear-transition-all bear-duration-200 bear-cursor-pointer";
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const SIDEBAR_ITEM_ACTIVE_FILL = "bear-bg-bear-500 bear-text-white bear-shadow-md";
|
|
11
|
+
export declare const SIDEBAR_ITEM_ACTIVE_BORDER = "bear-bg-bear-50 dark:bear-bg-bear-900/30 bear-text-bear-700 dark:bear-text-bear-200 bear-border-l-2 bear-border-bear-500 -bear-ml-px bear-pl-[11px]";
|
|
12
|
+
export declare const SIDEBAR_ITEM_ACTIVE_INDICATOR = "bear-relative bear-bg-bear-100 dark:bear-bg-bear-900/40 bear-text-bear-700 dark:bear-text-bear-200 before:bear-content-[''] before:bear-absolute before:bear-left-0 before:bear-top-1/2 before:-bear-translate-y-1/2 before:bear-w-1 before:bear-h-6 before:bear-rounded-full before:bear-bg-bear-500";
|
|
13
|
+
export declare const SIDEBAR_ITEM_ACTIVE_CLASSES = "bear-bg-bear-500 bear-text-white bear-shadow-md";
|
|
14
|
+
export declare const SIDEBAR_ITEM_ACTIVE_BY_VARIANT: Record<SidebarActiveVariant, string>;
|
|
11
15
|
export declare const SIDEBAR_ITEM_INACTIVE_CLASSES = "bear-text-zinc-600 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-900 dark:hover:bear-text-zinc-100";
|
|
12
16
|
export declare const SIDEBAR_ITEM_DISABLED_CLASSES = "bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none";
|
|
13
17
|
export declare const SIDEBAR_GROUP_TITLE_CLASSES = "bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-zinc-400 dark:bear-text-zinc-500";
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = 256, t = 64, o = 16, n = 12, c = 14, d = 18, E = {
|
|
2
2
|
default: "bear-bg-white dark:bear-bg-zinc-900 bear-border-zinc-200 dark:bear-border-zinc-700",
|
|
3
3
|
bordered: "bear-bg-white dark:bear-bg-zinc-900 bear-border-2 bear-border-zinc-300 dark:bear-border-zinc-600 bear-rounded-xl bear-m-2",
|
|
4
4
|
floating: "bear-bg-white/95 dark:bear-bg-zinc-900/95 bear-backdrop-blur-sm bear-shadow-2xl bear-rounded-xl bear-m-3"
|
|
5
|
-
},
|
|
5
|
+
}, i = "bear-flex bear-items-center bear-gap-3 bear-py-2.5 bear-px-3 bear-rounded-lg bear-text-sm bear-transition-all bear-duration-200 bear-cursor-pointer", e = "bear-bg-bear-500 bear-text-white bear-shadow-md", r = "bear-bg-bear-50 dark:bear-bg-bear-900/30 bear-text-bear-700 dark:bear-text-bear-200 bear-border-l-2 bear-border-bear-500 -bear-ml-px bear-pl-[11px]", b = "bear-relative bear-bg-bear-100 dark:bear-bg-bear-900/40 bear-text-bear-700 dark:bear-text-bear-200 before:bear-content-[''] before:bear-absolute before:bear-left-0 before:bear-top-1/2 before:-bear-translate-y-1/2 before:bear-w-1 before:bear-h-6 before:bear-rounded-full before:bear-bg-bear-500", S = {
|
|
6
|
+
fill: e,
|
|
7
|
+
border: r,
|
|
8
|
+
indicator: b
|
|
9
|
+
}, I = "bear-text-zinc-600 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-900 dark:hover:bear-text-zinc-100", _ = "bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none", A = "bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-zinc-400 dark:bear-text-zinc-500", s = "bear-px-3 bear-py-4 bear-border-b bear-border-zinc-100 dark:bear-border-zinc-800 bear-flex bear-items-center bear-justify-between", x = "bear-px-3 bear-py-3 bear-border-t bear-border-zinc-100 dark:bear-border-zinc-800 bear-mt-auto", D = "bear-p-1.5 bear-rounded-lg bear-text-zinc-400 dark:bear-text-zinc-500 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-600 dark:hover:bear-text-zinc-300 bear-transition-colors";
|
|
6
10
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
o as
|
|
21
|
-
|
|
11
|
+
t as SIDEBAR_COLLAPSED_WIDTH,
|
|
12
|
+
n as SIDEBAR_DEPTH_INDENT,
|
|
13
|
+
x as SIDEBAR_FOOTER_CLASSES,
|
|
14
|
+
A as SIDEBAR_GROUP_TITLE_CLASSES,
|
|
15
|
+
s as SIDEBAR_HEADER_CLASSES,
|
|
16
|
+
c as SIDEBAR_ICON_SIZE,
|
|
17
|
+
r as SIDEBAR_ITEM_ACTIVE_BORDER,
|
|
18
|
+
S as SIDEBAR_ITEM_ACTIVE_BY_VARIANT,
|
|
19
|
+
e as SIDEBAR_ITEM_ACTIVE_FILL,
|
|
20
|
+
b as SIDEBAR_ITEM_ACTIVE_INDICATOR,
|
|
21
|
+
i as SIDEBAR_ITEM_BASE_CLASSES,
|
|
22
|
+
_ as SIDEBAR_ITEM_DISABLED_CLASSES,
|
|
23
|
+
I as SIDEBAR_ITEM_INACTIVE_CLASSES,
|
|
24
|
+
o as SIDEBAR_PADDING_BASE,
|
|
25
|
+
D as SIDEBAR_TOGGLE_CLASSES,
|
|
26
|
+
d as SIDEBAR_TOGGLE_ICON_SIZE,
|
|
27
|
+
E as SIDEBAR_VARIANT_STYLES,
|
|
28
|
+
a as SIDEBAR_WIDTH
|
|
22
29
|
};
|
|
@@ -1,70 +1,75 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as b, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { cn as r } from "../../utils/cn.js";
|
|
3
|
-
import { ChevronRightIcon as
|
|
4
|
-
import { SidebarItem as
|
|
5
|
-
import { SIDEBAR_WIDTH as
|
|
6
|
-
const
|
|
3
|
+
import { ChevronRightIcon as c, ChevronLeftIcon as S } from "../Icon/index.js";
|
|
4
|
+
import { SidebarItem as N } from "./components/SidebarItem/SidebarItem.js";
|
|
5
|
+
import { SIDEBAR_WIDTH as T, SIDEBAR_COLLAPSED_WIDTH as y, SIDEBAR_TOGGLE_ICON_SIZE as i, SIDEBAR_TOGGLE_CLASSES as H, SIDEBAR_HEADER_CLASSES as O, SIDEBAR_FOOTER_CLASSES as g, SIDEBAR_VARIANT_STYLES as w } from "./Sidebar.const.js";
|
|
6
|
+
const V = (f) => {
|
|
7
7
|
const {
|
|
8
|
-
items:
|
|
8
|
+
items: _,
|
|
9
9
|
collapsed: e = !1,
|
|
10
10
|
onCollapsedChange: d,
|
|
11
|
-
width:
|
|
12
|
-
collapsedWidth:
|
|
11
|
+
width: h = T,
|
|
12
|
+
collapsedWidth: m = y,
|
|
13
13
|
header: s,
|
|
14
14
|
footer: n,
|
|
15
|
+
showHeader: E = !0,
|
|
15
16
|
activeItemId: I,
|
|
16
17
|
onItemClick: p,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
activeVariant: A = "fill",
|
|
19
|
+
fullHeight: B = !1,
|
|
20
|
+
variant: l = "default",
|
|
21
|
+
position: t = "left",
|
|
22
|
+
className: u,
|
|
23
|
+
style: C,
|
|
24
|
+
testId: v,
|
|
25
|
+
id: D
|
|
26
|
+
} = f, R = e ? m : h, L = t === "left" ? "bear-border-r" : "bear-border-l", x = E && s;
|
|
27
|
+
return /* @__PURE__ */ b(
|
|
25
28
|
"aside",
|
|
26
29
|
{
|
|
27
|
-
id:
|
|
28
|
-
"data-testid":
|
|
30
|
+
id: D,
|
|
31
|
+
"data-testid": v,
|
|
29
32
|
className: r(
|
|
30
33
|
"Bear-Sidebar",
|
|
31
|
-
`Bear-Sidebar--${
|
|
34
|
+
`Bear-Sidebar--${l}`,
|
|
32
35
|
e && "Bear-Sidebar--collapsed",
|
|
33
36
|
"bear-flex bear-flex-col bear-h-full bear-transition-all bear-duration-300",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
B && "bear-min-h-full",
|
|
38
|
+
l === "default" && L,
|
|
39
|
+
w[l],
|
|
40
|
+
u
|
|
37
41
|
),
|
|
38
|
-
style: { width:
|
|
42
|
+
style: { width: R, ...C },
|
|
39
43
|
children: [
|
|
40
|
-
|
|
44
|
+
x && /* @__PURE__ */ b("div", { className: r("Bear-Sidebar__header", O), children: [
|
|
41
45
|
!e && s,
|
|
42
46
|
d && /* @__PURE__ */ a(
|
|
43
47
|
"button",
|
|
44
48
|
{
|
|
45
49
|
type: "button",
|
|
46
50
|
onClick: () => d(!e),
|
|
47
|
-
className: r("Bear-Sidebar__toggle",
|
|
51
|
+
className: r("Bear-Sidebar__toggle", H),
|
|
48
52
|
"aria-label": e ? "Expand sidebar" : "Collapse sidebar",
|
|
49
|
-
children: e ?
|
|
53
|
+
children: e ? t === "left" ? /* @__PURE__ */ a(c, { size: i }) : /* @__PURE__ */ a(S, { size: i }) : t === "left" ? /* @__PURE__ */ a(S, { size: i }) : /* @__PURE__ */ a(c, { size: i })
|
|
50
54
|
}
|
|
51
55
|
)
|
|
52
56
|
] }),
|
|
53
|
-
/* @__PURE__ */ a("nav", { className: "Bear-Sidebar__nav bear-flex-1 bear-overflow-y-auto bear-px-2 bear-py-3 bear-space-y-1", children:
|
|
54
|
-
|
|
57
|
+
/* @__PURE__ */ a("nav", { className: "Bear-Sidebar__nav bear-flex-1 bear-overflow-y-auto bear-px-2 bear-py-3 bear-space-y-1 bear-min-h-0", children: _.map((o) => /* @__PURE__ */ a(
|
|
58
|
+
N,
|
|
55
59
|
{
|
|
56
60
|
item: o,
|
|
57
61
|
isActive: o.id === I,
|
|
58
62
|
collapsed: e,
|
|
59
|
-
onClick: p
|
|
63
|
+
onClick: p,
|
|
64
|
+
activeVariant: A
|
|
60
65
|
},
|
|
61
66
|
o.id
|
|
62
67
|
)) }),
|
|
63
|
-
n && /* @__PURE__ */ a("div", { className: r("Bear-Sidebar__footer",
|
|
68
|
+
n && /* @__PURE__ */ a("div", { className: r("Bear-Sidebar__footer", g), children: e ? null : n })
|
|
64
69
|
]
|
|
65
70
|
}
|
|
66
71
|
);
|
|
67
72
|
};
|
|
68
73
|
export {
|
|
69
|
-
|
|
74
|
+
V as Sidebar
|
|
70
75
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
export type SidebarVariant = 'default' | 'bordered' | 'floating';
|
|
3
3
|
export type SidebarPosition = 'left' | 'right';
|
|
4
|
+
export type SidebarActiveVariant = 'fill' | 'border' | 'indicator';
|
|
4
5
|
export interface SidebarItem {
|
|
5
6
|
id: string;
|
|
6
7
|
label: string;
|
|
@@ -19,8 +20,14 @@ export interface SidebarProps {
|
|
|
19
20
|
collapsedWidth?: number | string;
|
|
20
21
|
header?: ReactNode;
|
|
21
22
|
footer?: ReactNode;
|
|
23
|
+
/** When false, header (e.g. logo + title) is not rendered. Default true. */
|
|
24
|
+
showHeader?: boolean;
|
|
22
25
|
activeItemId?: string;
|
|
23
26
|
onItemClick?: (item: SidebarItem) => void;
|
|
27
|
+
/** How the active item is highlighted: fill (solid bg), border (left border), indicator (pill). Default fill. */
|
|
28
|
+
activeVariant?: SidebarActiveVariant;
|
|
29
|
+
/** When true, sidebar uses min-h-full so it fills viewport height. Default false. */
|
|
30
|
+
fullHeight?: boolean;
|
|
24
31
|
variant?: SidebarVariant;
|
|
25
32
|
position?: SidebarPosition;
|
|
26
33
|
className?: string;
|
|
@@ -41,4 +48,6 @@ export interface SidebarItemComponentProps {
|
|
|
41
48
|
collapsed?: boolean;
|
|
42
49
|
depth?: number;
|
|
43
50
|
onClick?: (item: SidebarItem) => void;
|
|
51
|
+
/** How active state is shown. Passed from Sidebar activeVariant. */
|
|
52
|
+
activeVariant?: SidebarActiveVariant;
|
|
44
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("react"),b=require("../../../../utils/cn.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("react"),b=require("../../../../utils/cn.cjs"),f=require("../../../Icon/index.cjs"),r=require("../../Sidebar.const.cjs"),_=o=>{const{item:e,isActive:S,collapsed:i,depth:c=0,onClick:s,activeVariant:m="fill"}=o,[l,I]=d.useState(!1),t=e.children&&e.children.length>0,E=i?r.SIDEBAR_PADDING_BASE:r.SIDEBAR_PADDING_BASE+c*r.SIDEBAR_DEPTH_INDENT,h=d.useCallback(()=>{t&&I(n=>!n),e.onClick&&e.onClick(),s==null||s(e)},[t,e,s]),A=a.jsxs(a.Fragment,{children:[e.icon&&a.jsx("span",{className:"Bear-Sidebar__item-icon bear-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center",children:e.icon}),!i&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"Bear-Sidebar__item-label bear-flex-1 bear-truncate",children:e.label}),e.badge&&a.jsx("span",{className:"Bear-Sidebar__item-badge bear-ml-auto",children:e.badge}),t&&a.jsx(f.ChevronDownIcon,{size:r.SIDEBAR_ICON_SIZE,className:b.cn("Bear-Sidebar__item-chevron bear-ml-1 bear-transition-transform bear-duration-200",l&&"bear-rotate-180")})]})]}),B=r.SIDEBAR_ITEM_ACTIVE_BY_VARIANT[m],u=b.cn("Bear-Sidebar__item",r.SIDEBAR_ITEM_BASE_CLASSES,S?`Bear-Sidebar__item--active ${B}`:r.SIDEBAR_ITEM_INACTIVE_CLASSES,e.disabled&&`Bear-Sidebar__item--disabled ${r.SIDEBAR_ITEM_DISABLED_CLASSES}`,i&&"Bear-Sidebar__item--collapsed bear-justify-center"),D=e.href?"a":"button";return a.jsxs("div",{className:"Bear-Sidebar__item-wrapper",children:[a.jsx(D,{href:e.href,onClick:h,disabled:e.disabled,className:u,style:{paddingLeft:E},title:i?e.label:void 0,children:A}),t&&l&&!i&&a.jsx("div",{className:"Bear-Sidebar__children bear-mt-1",children:e.children.map(n=>a.jsx(_,{item:n,isActive:!1,collapsed:i,depth:c+1,onClick:s},n.id))})]})};exports.SidebarItem=_;
|
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { ChevronDownIcon as
|
|
5
|
-
import { SIDEBAR_ICON_SIZE as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as n, Fragment as d, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as C, useCallback as D } from "react";
|
|
3
|
+
import { cn as o } from "../../../../utils/cn.js";
|
|
4
|
+
import { ChevronDownIcon as N } from "../../../Icon/index.js";
|
|
5
|
+
import { SIDEBAR_ICON_SIZE as v, SIDEBAR_ITEM_DISABLED_CLASSES as u, SIDEBAR_ITEM_ACTIVE_BY_VARIANT as T, SIDEBAR_ITEM_INACTIVE_CLASSES as R, SIDEBAR_ITEM_BASE_CLASSES as g, SIDEBAR_PADDING_BASE as m, SIDEBAR_DEPTH_INDENT as k } from "../../Sidebar.const.js";
|
|
6
|
+
const x = (_) => {
|
|
7
7
|
const {
|
|
8
8
|
item: e,
|
|
9
|
-
isActive:
|
|
9
|
+
isActive: b,
|
|
10
10
|
collapsed: r,
|
|
11
11
|
depth: l = 0,
|
|
12
|
-
onClick: i
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
onClick: i,
|
|
13
|
+
activeVariant: S = "fill"
|
|
14
|
+
} = _, [c, h] = C(!1), t = e.children && e.children.length > 0, E = r ? m : m + l * k, I = D(() => {
|
|
15
|
+
t && h((s) => !s), e.onClick && e.onClick(), i == null || i(e);
|
|
16
|
+
}, [t, e, i]), B = /* @__PURE__ */ n(d, { children: [
|
|
16
17
|
e.icon && /* @__PURE__ */ a("span", { className: "Bear-Sidebar__item-icon bear-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center", children: e.icon }),
|
|
17
|
-
!r && /* @__PURE__ */
|
|
18
|
+
!r && /* @__PURE__ */ n(d, { children: [
|
|
18
19
|
/* @__PURE__ */ a("span", { className: "Bear-Sidebar__item-label bear-flex-1 bear-truncate", children: e.label }),
|
|
19
20
|
e.badge && /* @__PURE__ */ a("span", { className: "Bear-Sidebar__item-badge bear-ml-auto", children: e.badge }),
|
|
20
21
|
t && /* @__PURE__ */ a(
|
|
21
|
-
|
|
22
|
+
N,
|
|
22
23
|
{
|
|
23
|
-
size:
|
|
24
|
-
className:
|
|
24
|
+
size: v,
|
|
25
|
+
className: o(
|
|
25
26
|
"Bear-Sidebar__item-chevron bear-ml-1 bear-transition-transform bear-duration-200",
|
|
26
27
|
c && "bear-rotate-180"
|
|
27
28
|
)
|
|
28
29
|
}
|
|
29
30
|
)
|
|
30
31
|
] })
|
|
31
|
-
] }),
|
|
32
|
+
] }), A = T[S], f = o(
|
|
32
33
|
"Bear-Sidebar__item",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
e.disabled && `Bear-Sidebar__item--disabled ${
|
|
34
|
+
g,
|
|
35
|
+
b ? `Bear-Sidebar__item--active ${A}` : R,
|
|
36
|
+
e.disabled && `Bear-Sidebar__item--disabled ${u}`,
|
|
36
37
|
r && "Bear-Sidebar__item--collapsed bear-justify-center"
|
|
37
38
|
), p = e.href ? "a" : "button";
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ n("div", { className: "Bear-Sidebar__item-wrapper", children: [
|
|
39
40
|
/* @__PURE__ */ a(
|
|
40
41
|
p,
|
|
41
42
|
{
|
|
42
43
|
href: e.href,
|
|
43
|
-
onClick:
|
|
44
|
+
onClick: I,
|
|
44
45
|
disabled: e.disabled,
|
|
45
|
-
className:
|
|
46
|
-
style: { paddingLeft:
|
|
46
|
+
className: f,
|
|
47
|
+
style: { paddingLeft: E },
|
|
47
48
|
title: r ? e.label : void 0,
|
|
48
|
-
children:
|
|
49
|
+
children: B
|
|
49
50
|
}
|
|
50
51
|
),
|
|
51
|
-
t && c && !r && /* @__PURE__ */ a("div", { className: "Bear-Sidebar__children bear-mt-1", children: e.children.map((
|
|
52
|
-
|
|
52
|
+
t && c && !r && /* @__PURE__ */ a("div", { className: "Bear-Sidebar__children bear-mt-1", children: e.children.map((s) => /* @__PURE__ */ a(
|
|
53
|
+
x,
|
|
53
54
|
{
|
|
54
|
-
item:
|
|
55
|
+
item: s,
|
|
55
56
|
isActive: !1,
|
|
56
57
|
collapsed: r,
|
|
57
58
|
depth: l + 1,
|
|
58
59
|
onClick: i
|
|
59
60
|
},
|
|
60
|
-
|
|
61
|
+
s.id
|
|
61
62
|
)) })
|
|
62
63
|
] });
|
|
63
64
|
};
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
+
x as SidebarItem
|
|
66
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),s=require("react"),_=require("../../utils/cn.cjs"),p=require("../Button/Button.cjs"),a=require("./SignPad.const.cjs"),V=y=>{const{onChange:r,width:P=a.SIGN_PAD_DEFAULT_WIDTH,height:A=a.SIGN_PAD_DEFAULT_HEIGHT,strokeColor:B,strokeWidth:N=a.SIGN_PAD_DEFAULT_STROKE_WIDTH,backgroundColor:O,placeholder:U=a.SIGN_PAD_DEFAULT_PLACEHOLDER,disabled:o=!1,readOnly:l=!1,showClear:I=!0,showSave:v=!1,clearText:M="Clear",saveText:j="Save",outputFormat:h=a.SIGN_PAD_DEFAULT_OUTPUT_FORMAT,outputQuality:D=a.SIGN_PAD_DEFAULT_OUTPUT_QUALITY,className:F,testId:H,id:K,...W}=y,i=s.useRef(null),[f,x]=s.useState(!1),[u,m]=s.useState(!1),[g,C]=s.useState(null),[E,q]=s.useState(!1);s.useEffect(()=>{const e=()=>{const n=document.documentElement.classList.contains("dark");q(n)};e();const t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const k=B||(E?a.SIGN_PAD_STROKE_DARK:a.SIGN_PAD_STROKE_LIGHT),S=O||(E?a.SIGN_PAD_BG_DARK:a.SIGN_PAD_BG_LIGHT);s.useEffect(()=>{const e=i.current;if(!e)return;const t=e.getContext("2d");t&&(e.width=P,e.height=A,t.fillStyle=S,t.fillRect(0,0,P,A))},[P,A,S,E]);const b=s.useCallback(e=>{const t=i.current;if(!t)return{x:0,y:0};const n=t.getBoundingClientRect(),d=t.width/n.width,w=t.height/n.height;if("touches"in e){const G=e.touches[0];return{x:(G.clientX-n.left)*d,y:(G.clientY-n.top)*w}}return{x:(e.clientX-n.left)*d,y:(e.clientY-n.top)*w}},[]),L=s.useCallback(e=>{if(o||l)return;const t=b(e);x(!0),C(t)},[o,l,b]),R=s.useCallback(e=>{if(!f||o||l)return;const t=i.current,n=t==null?void 0:t.getContext("2d");if(!t||!n||!g)return;const d=b(e);n.beginPath(),n.moveTo(g.x,g.y),n.lineTo(d.x,d.y),n.strokeStyle=k,n.lineWidth=N,n.lineCap="round",n.lineJoin="round",n.stroke(),C(d),m(!0)},[f,o,l,g,k,N,b]),T=s.useCallback(()=>{if(f&&u){const e=i.current;if(e&&r){const t=e.toDataURL(h,D);r(t)}}x(!1),C(null)},[f,u,r,h,D]),X=s.useCallback(()=>{const e=i.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=S==="transparent"?"rgba(0,0,0,0)":S,t.clearRect(0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height),m(!1),r==null||r(null))},[S,r]),Y=s.useCallback(()=>{const e=i.current;if(!e||!u)return;const t=e.toDataURL(h,D);r==null||r(t)},[u,r,h,D]);return c.jsxs("div",{id:K,"data-testid":H,className:_.cn("Bear-SignPad bear-max-w-full bear-w-full",a.SIGN_PAD_ROOT_CLASSES,o&&"Bear-SignPad--disabled bear-opacity-50",l&&"Bear-SignPad--readonly",F),...W,children:[c.jsxs("div",{className:_.cn("Bear-SignPad__canvas-wrapper bear-max-w-full bear-overflow-hidden",a.SIGN_PAD_CANVAS_WRAPPER_CLASSES,!o&&!l&&a.SIGN_PAD_CANVAS_WRAPPER_HOVER,o&&"bear-cursor-not-allowed",!o&&!l&&"bear-cursor-crosshair"),children:[c.jsx("canvas",{ref:i,className:"Bear-SignPad__canvas bear-block bear-rounded-lg bear-max-w-full",style:{width:P,height:A},onMouseDown:L,onMouseMove:R,onMouseUp:T,onMouseLeave:T,onTouchStart:L,onTouchMove:R,onTouchEnd:T}),!u&&c.jsx("div",{className:_.cn("Bear-SignPad__placeholder",a.SIGN_PAD_PLACEHOLDER_CLASSES),children:U}),c.jsx("div",{className:_.cn("Bear-SignPad__line",a.SIGN_PAD_LINE_CLASSES)}),c.jsx("span",{className:_.cn("Bear-SignPad__x-mark",a.SIGN_PAD_X_MARK_CLASSES),children:"×"})]}),(I||v)&&c.jsxs("div",{className:_.cn("Bear-SignPad__actions",a.SIGN_PAD_ACTIONS_CLASSES),children:[I&&c.jsx(p.Button,{size:"sm",variant:"ghost",onClick:X,disabled:o||!u,children:M}),v&&c.jsx(p.Button,{size:"sm",variant:"primary",onClick:Y,disabled:o||!u,children:j})]})]})};exports.SignPad=V;
|
|
@@ -1,99 +1,99 @@
|
|
|
1
1
|
import { jsxs as I, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as J, useState as
|
|
2
|
+
import { useRef as J, useState as g, useEffect as y, useCallback as d } from "react";
|
|
3
3
|
import { cn as _ } from "../../utils/cn.js";
|
|
4
4
|
import { Button as O } from "../Button/Button.js";
|
|
5
|
-
import { SIGN_PAD_DEFAULT_WIDTH as q, SIGN_PAD_DEFAULT_HEIGHT as Z, SIGN_PAD_DEFAULT_STROKE_WIDTH as $, SIGN_PAD_DEFAULT_PLACEHOLDER as tt, SIGN_PAD_DEFAULT_OUTPUT_FORMAT as et, SIGN_PAD_DEFAULT_OUTPUT_QUALITY as
|
|
6
|
-
const
|
|
5
|
+
import { SIGN_PAD_DEFAULT_WIDTH as q, SIGN_PAD_DEFAULT_HEIGHT as Z, SIGN_PAD_DEFAULT_STROKE_WIDTH as $, SIGN_PAD_DEFAULT_PLACEHOLDER as tt, SIGN_PAD_DEFAULT_OUTPUT_FORMAT as et, SIGN_PAD_DEFAULT_OUTPUT_QUALITY as rt, SIGN_PAD_BG_DARK as nt, SIGN_PAD_BG_LIGHT as at, SIGN_PAD_STROKE_DARK as ot, SIGN_PAD_STROKE_LIGHT as st, SIGN_PAD_PLACEHOLDER_CLASSES as ct, SIGN_PAD_LINE_CLASSES as it, SIGN_PAD_X_MARK_CLASSES as lt, SIGN_PAD_CANVAS_WRAPPER_HOVER as dt, SIGN_PAD_CANVAS_WRAPPER_CLASSES as _t, SIGN_PAD_ACTIONS_CLASSES as ut, SIGN_PAD_ROOT_CLASSES as St } from "./SignPad.const.js";
|
|
6
|
+
const mt = (U) => {
|
|
7
7
|
const {
|
|
8
|
-
onChange:
|
|
8
|
+
onChange: n,
|
|
9
9
|
width: S = q,
|
|
10
10
|
height: A = Z,
|
|
11
11
|
strokeColor: B,
|
|
12
|
-
strokeWidth:
|
|
12
|
+
strokeWidth: b = $,
|
|
13
13
|
backgroundColor: M,
|
|
14
14
|
placeholder: F = tt,
|
|
15
|
-
disabled:
|
|
16
|
-
readOnly:
|
|
15
|
+
disabled: a = !1,
|
|
16
|
+
readOnly: o = !1,
|
|
17
17
|
showClear: v = !0,
|
|
18
|
-
showSave:
|
|
18
|
+
showSave: p = !1,
|
|
19
19
|
clearText: H = "Clear",
|
|
20
20
|
saveText: K = "Save",
|
|
21
21
|
outputFormat: h = et,
|
|
22
|
-
outputQuality: P =
|
|
22
|
+
outputQuality: P = rt,
|
|
23
23
|
className: W,
|
|
24
24
|
testId: X,
|
|
25
25
|
id: Y,
|
|
26
26
|
...V
|
|
27
|
-
} = U, s = J(null), [
|
|
27
|
+
} = U, s = J(null), [f, C] = g(!1), [c, L] = g(!1), [D, E] = g(null), [N, j] = g(!1);
|
|
28
28
|
y(() => {
|
|
29
29
|
const t = () => {
|
|
30
|
-
const
|
|
31
|
-
j(
|
|
30
|
+
const r = document.documentElement.classList.contains("dark");
|
|
31
|
+
j(r);
|
|
32
32
|
};
|
|
33
33
|
t();
|
|
34
34
|
const e = new MutationObserver(t);
|
|
35
35
|
return e.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => e.disconnect();
|
|
36
36
|
}, []);
|
|
37
|
-
const
|
|
37
|
+
const R = B || (N ? ot : st), u = M || (N ? nt : at);
|
|
38
38
|
y(() => {
|
|
39
39
|
const t = s.current;
|
|
40
40
|
if (!t) return;
|
|
41
41
|
const e = t.getContext("2d");
|
|
42
42
|
e && (t.width = S, t.height = A, e.fillStyle = u, e.fillRect(0, 0, S, A));
|
|
43
43
|
}, [S, A, u, N]);
|
|
44
|
-
const
|
|
44
|
+
const m = d((t) => {
|
|
45
45
|
const e = s.current;
|
|
46
46
|
if (!e) return { x: 0, y: 0 };
|
|
47
|
-
const
|
|
47
|
+
const r = e.getBoundingClientRect(), i = e.width / r.width, k = e.height / r.height;
|
|
48
48
|
if ("touches" in t) {
|
|
49
49
|
const x = t.touches[0];
|
|
50
50
|
return {
|
|
51
|
-
x: (x.clientX -
|
|
52
|
-
y: (x.clientY -
|
|
51
|
+
x: (x.clientX - r.left) * i,
|
|
52
|
+
y: (x.clientY - r.top) * k
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
|
-
x: (t.clientX -
|
|
57
|
-
y: (t.clientY -
|
|
56
|
+
x: (t.clientX - r.left) * i,
|
|
57
|
+
y: (t.clientY - r.top) * k
|
|
58
58
|
};
|
|
59
|
-
}, []),
|
|
60
|
-
if (
|
|
61
|
-
const e =
|
|
62
|
-
|
|
63
|
-
}, [
|
|
64
|
-
if (!
|
|
65
|
-
const e = s.current,
|
|
66
|
-
if (!e || !
|
|
67
|
-
const i =
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
if (
|
|
59
|
+
}, []), w = d((t) => {
|
|
60
|
+
if (a || o) return;
|
|
61
|
+
const e = m(t);
|
|
62
|
+
C(!0), E(e);
|
|
63
|
+
}, [a, o, m]), G = d((t) => {
|
|
64
|
+
if (!f || a || o) return;
|
|
65
|
+
const e = s.current, r = e == null ? void 0 : e.getContext("2d");
|
|
66
|
+
if (!e || !r || !D) return;
|
|
67
|
+
const i = m(t);
|
|
68
|
+
r.beginPath(), r.moveTo(D.x, D.y), r.lineTo(i.x, i.y), r.strokeStyle = R, r.lineWidth = b, r.lineCap = "round", r.lineJoin = "round", r.stroke(), E(i), L(!0);
|
|
69
|
+
}, [f, a, o, D, R, b, m]), T = d(() => {
|
|
70
|
+
if (f && c) {
|
|
71
71
|
const t = s.current;
|
|
72
|
-
if (t &&
|
|
72
|
+
if (t && n) {
|
|
73
73
|
const e = t.toDataURL(h, P);
|
|
74
|
-
|
|
74
|
+
n(e);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
}, [
|
|
77
|
+
C(!1), E(null);
|
|
78
|
+
}, [f, c, n, h, P]), z = d(() => {
|
|
79
79
|
const t = s.current, e = t == null ? void 0 : t.getContext("2d");
|
|
80
|
-
!t || !e || (e.fillStyle = u === "transparent" ? "rgba(0,0,0,0)" : u, e.clearRect(0, 0, t.width, t.height), e.fillRect(0, 0, t.width, t.height),
|
|
81
|
-
}, [u,
|
|
80
|
+
!t || !e || (e.fillStyle = u === "transparent" ? "rgba(0,0,0,0)" : u, e.clearRect(0, 0, t.width, t.height), e.fillRect(0, 0, t.width, t.height), L(!1), n == null || n(null));
|
|
81
|
+
}, [u, n]), Q = d(() => {
|
|
82
82
|
const t = s.current;
|
|
83
83
|
if (!t || !c) return;
|
|
84
84
|
const e = t.toDataURL(h, P);
|
|
85
|
-
|
|
86
|
-
}, [c,
|
|
85
|
+
n == null || n(e);
|
|
86
|
+
}, [c, n, h, P]);
|
|
87
87
|
return /* @__PURE__ */ I(
|
|
88
88
|
"div",
|
|
89
89
|
{
|
|
90
90
|
id: Y,
|
|
91
91
|
"data-testid": X,
|
|
92
92
|
className: _(
|
|
93
|
-
"Bear-SignPad",
|
|
93
|
+
"Bear-SignPad bear-max-w-full bear-w-full",
|
|
94
94
|
St,
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
a && "Bear-SignPad--disabled bear-opacity-50",
|
|
96
|
+
o && "Bear-SignPad--readonly",
|
|
97
97
|
W
|
|
98
98
|
),
|
|
99
99
|
...V,
|
|
@@ -102,25 +102,25 @@ const gt = (U) => {
|
|
|
102
102
|
"div",
|
|
103
103
|
{
|
|
104
104
|
className: _(
|
|
105
|
-
"Bear-SignPad__canvas-wrapper",
|
|
105
|
+
"Bear-SignPad__canvas-wrapper bear-max-w-full bear-overflow-hidden",
|
|
106
106
|
_t,
|
|
107
|
-
!
|
|
108
|
-
|
|
109
|
-
!
|
|
107
|
+
!a && !o && dt,
|
|
108
|
+
a && "bear-cursor-not-allowed",
|
|
109
|
+
!a && !o && "bear-cursor-crosshair"
|
|
110
110
|
),
|
|
111
111
|
children: [
|
|
112
112
|
/* @__PURE__ */ l(
|
|
113
113
|
"canvas",
|
|
114
114
|
{
|
|
115
115
|
ref: s,
|
|
116
|
-
className: "Bear-SignPad__canvas bear-block bear-rounded-lg",
|
|
116
|
+
className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-max-w-full",
|
|
117
117
|
style: { width: S, height: A },
|
|
118
|
-
onMouseDown:
|
|
119
|
-
onMouseMove:
|
|
118
|
+
onMouseDown: w,
|
|
119
|
+
onMouseMove: G,
|
|
120
120
|
onMouseUp: T,
|
|
121
121
|
onMouseLeave: T,
|
|
122
|
-
onTouchStart:
|
|
123
|
-
onTouchMove:
|
|
122
|
+
onTouchStart: w,
|
|
123
|
+
onTouchMove: G,
|
|
124
124
|
onTouchEnd: T
|
|
125
125
|
}
|
|
126
126
|
),
|
|
@@ -130,24 +130,24 @@ const gt = (U) => {
|
|
|
130
130
|
]
|
|
131
131
|
}
|
|
132
132
|
),
|
|
133
|
-
(v ||
|
|
133
|
+
(v || p) && /* @__PURE__ */ I("div", { className: _("Bear-SignPad__actions", ut), children: [
|
|
134
134
|
v && /* @__PURE__ */ l(
|
|
135
135
|
O,
|
|
136
136
|
{
|
|
137
137
|
size: "sm",
|
|
138
138
|
variant: "ghost",
|
|
139
139
|
onClick: z,
|
|
140
|
-
disabled:
|
|
140
|
+
disabled: a || !c,
|
|
141
141
|
children: H
|
|
142
142
|
}
|
|
143
143
|
),
|
|
144
|
-
|
|
144
|
+
p && /* @__PURE__ */ l(
|
|
145
145
|
O,
|
|
146
146
|
{
|
|
147
147
|
size: "sm",
|
|
148
148
|
variant: "primary",
|
|
149
149
|
onClick: Q,
|
|
150
|
-
disabled:
|
|
150
|
+
disabled: a || !c,
|
|
151
151
|
children: K
|
|
152
152
|
}
|
|
153
153
|
)
|
|
@@ -157,5 +157,5 @@ const gt = (U) => {
|
|
|
157
157
|
);
|
|
158
158
|
};
|
|
159
159
|
export {
|
|
160
|
-
|
|
160
|
+
mt as SignPad
|
|
161
161
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("react"),V=require("../../utils/cn.cjs"),G=require("../../hooks/useMediaQuery.cjs"),J=require("./TimePicker.utils.cjs"),e=require("./TimePicker.constants.cjs"),X=require("./components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs"),Y=require("./components/TimePickerDialDropdown/TimePickerDialDropdown.cjs"),Z=s.jsx("svg",{className:"bear-w-5 bear-h-5 bear-text-gray-400 dark:bear-text-zinc-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),g=t=>{const j={value:t.value,onChange:t.onChange,disabled:t.disabled??!1,placeholder:t.placeholder??"Select time",label:t.label,error:t.error,helperText:t.helperText,format:t.format??e.TIMEPICKER_FORMAT_12H,minuteStep:t.minuteStep??5,clearable:t.clearable??!0,className:t.className,size:t.size??"md",variant:t.variant??"default",dropdownVariant:t.dropdownVariant??e.TIMEPICKER_VARIANT_COLUMNS,dropdownVariantBreakpoint:t.dropdownVariantBreakpoint??e.TIMEPICKER_DEFAULT_BREAKPOINT,icon:t.icon,translations:t.translations},{value:y,onChange:l,disabled:T,placeholder:D,label:M,error:i,helperText:S,format:c,minuteStep:_,clearable:A,className:H,size:U,variant:q,dropdownVariant:f,dropdownVariantBreakpoint:F,icon:z,translations:b}=j,B=G.useMediaQuery(`(min-width: ${F}px)`),p=f===e.TIMEPICKER_VARIANT_AUTO?B?e.TIMEPICKER_VARIANT_DIAL:e.TIMEPICKER_VARIANT_COLUMNS:f,h=p===e.TIMEPICKER_VARIANT_DIAL&&c===e.TIMEPICKER_FORMAT_24H?e.TIMEPICKER_VARIANT_COLUMNS:p,n=y,[C,d]=r.useState(!1),[u,k]=r.useState(12),[E,N]=r.useState(0),[I,K]=r.useState("AM"),R=r.useRef(null);r.useEffect(()=>{if(n&&typeof n=="string"){const[o,a]=n.split(" "),[W,$]=o.split(":").map(Number);k(W),N($),a&&K(a)}},[n]),r.useEffect(()=>{const o=a=>{R.current&&!R.current.contains(a.target)&&d(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[]);const O=r.useCallback(()=>{l==null||l(J.formatTime(u,E,I,c??e.TIMEPICKER_FORMAT_12H)),d(!1)},[l,u,E,I,c]),x=c===e.TIMEPICKER_FORMAT_12H?Array.from({length:e.TIMEPICKER_HOURS_12H},(o,a)=>a+1):Array.from({length:e.TIMEPICKER_HOURS_24H},(o,a)=>a),L=Array.from({length:e.TIMEPICKER_MINUTES_DIVISOR/(_??5)},(o,a)=>a*(_??5)),w=r.useCallback(()=>d(!1),[]),v=c??e.TIMEPICKER_FORMAT_12H,P=_??5,m=r.useMemo(()=>({selectedHour:u,setSelectedHour:k,selectedMinute:E,setSelectedMinute:N,period:I,setPeriod:K,format:v,hours:x,minutes:L,timeValue:n,clearable:A??!0,onChange:l,onConfirm:O,onClose:w,translations:b}),[u,E,I,v,x,L,n,A,l,O,w,b]),Q=r.useCallback(()=>C?h===e.TIMEPICKER_VARIANT_DIAL?s.jsx(Y.TimePickerDialDropdown,{...m,minuteStep:P}):s.jsx(X.TimePickerColumnsDropdown,{...m}):null,[C,h,m,P]);return s.jsxs("div",{ref:R,className:V.cn(e.TIMEPICKER_ROOT_CLASSES,H),children:[M&&s.jsx("label",{className:e.TIMEPICKER_LABEL_CLASSES,children:M}),s.jsxs("button",{type:"button",onClick:()=>!T&&d(!C),disabled:T,className:V.cn(e.TIMEPICKER_BUTTON_CLASSES,e.sizeClasses[U??"md"],e.variantClasses[q??"default"],i?"bear-border-red-500":"focus:bear-border-pink-500",T&&"bear-opacity-50 bear-cursor-not-allowed",n?"bear-text-gray-900 dark:bear-text-white":"bear-text-gray-400 dark:bear-text-zinc-500"),children:[s.jsx("span",{children:n||D}),z??Z]}),i&&s.jsx("p",{className:e.TIMEPICKER_ERROR_CLASSES,children:i}),S&&!i&&s.jsx("p",{className:e.TIMEPICKER_HELPER_CLASSES,children:S}),Q()]})};exports.TimePicker=g;
|