@konstructio/ui 0.1.2-alpha.54 → 0.1.2-alpha.55
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/Button/Button.variants.js +7 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +34 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +118 -0
- package/dist/components/ButtonGroup/ButtonGroup.types.d.ts +92 -0
- package/dist/components/ButtonGroup/ButtonGroup.variants.d.ts +13 -0
- package/dist/components/ButtonGroup/ButtonGroup.variants.js +31 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.d.ts +3 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +263 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.types.d.ts +21 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.d.ts +26 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.js +89 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/index.d.ts +2 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/index.js +4 -0
- package/dist/components/ButtonGroup/components/ButtonGroupLabel/ButtonGroupLabel.d.ts +3 -0
- package/dist/components/ButtonGroup/components/ButtonGroupLabel/ButtonGroupLabel.js +45 -0
- package/dist/components/ButtonGroup/components/ButtonGroupLabel/ButtonGroupLabel.types.d.ts +8 -0
- package/dist/components/ButtonGroup/components/ButtonGroupLabel/index.d.ts +2 -0
- package/dist/components/ButtonGroup/components/ButtonGroupLabel/index.js +4 -0
- package/dist/components/ButtonGroup/components/ButtonGroupMessage/ButtonGroupMessage.d.ts +3 -0
- package/dist/components/ButtonGroup/components/ButtonGroupMessage/ButtonGroupMessage.js +37 -0
- package/dist/components/ButtonGroup/components/ButtonGroupMessage/ButtonGroupMessage.types.d.ts +6 -0
- package/dist/components/ButtonGroup/components/ButtonGroupMessage/index.d.ts +2 -0
- package/dist/components/ButtonGroup/components/ButtonGroupMessage/index.js +4 -0
- package/dist/components/ButtonGroup/components/index.d.ts +3 -0
- package/dist/components/ButtonGroup/components/index.js +8 -0
- package/dist/components/ButtonGroup/hooks/index.d.ts +2 -0
- package/dist/components/ButtonGroup/hooks/index.js +4 -0
- package/dist/components/ButtonGroup/hooks/useButtonGroup.d.ts +3 -0
- package/dist/components/ButtonGroup/hooks/useButtonGroup.js +67 -0
- package/dist/components/ButtonGroup/hooks/useButtonGroup.types.d.ts +18 -0
- package/dist/components/DateRangePicker/components/CalendarPanel/components/IndependentModeCalendar/IndependentModeCalendar.js +1 -1
- package/dist/components/DateRangePicker/components/CalendarPanel/components/TogetherModeCalendar/TogetherModeCalendar.js +1 -1
- package/dist/components/DateRangePicker/components/PresetPanel/PresetPanel.js +11 -11
- package/dist/components/Drawer/Drawer.d.ts +36 -0
- package/dist/components/Drawer/Drawer.js +134 -0
- package/dist/components/Drawer/Drawer.types.d.ts +65 -0
- package/dist/components/Drawer/Drawer.variants.d.ts +8 -0
- package/dist/components/Drawer/Drawer.variants.js +92 -0
- package/dist/components/Drawer/components/Body/Body.d.ts +3 -0
- package/dist/components/Drawer/components/Body/Body.js +24 -0
- package/dist/components/Drawer/components/Body/Body.types.d.ts +7 -0
- package/dist/components/Drawer/components/Body/index.d.ts +2 -0
- package/dist/components/Drawer/components/Body/index.js +4 -0
- package/dist/components/Drawer/components/Footer/Footer.d.ts +3 -0
- package/dist/components/Drawer/components/Footer/Footer.js +26 -0
- package/dist/components/Drawer/components/Footer/Footer.types.d.ts +7 -0
- package/dist/components/Drawer/components/Footer/index.d.ts +2 -0
- package/dist/components/Drawer/components/Footer/index.js +4 -0
- package/dist/components/Drawer/components/Header/Header.d.ts +3 -0
- package/dist/components/Drawer/components/Header/Header.js +27 -0
- package/dist/components/Drawer/components/Header/Header.types.d.ts +9 -0
- package/dist/components/Drawer/components/Header/index.d.ts +2 -0
- package/dist/components/Drawer/components/Header/index.js +4 -0
- package/dist/components/Drawer/components/index.d.ts +3 -0
- package/dist/components/Drawer/components/index.js +8 -0
- package/dist/components/Drawer/constants/index.d.ts +6 -0
- package/dist/components/Drawer/constants/index.js +9 -0
- package/dist/components/Drawer/contexts/Drawer.context.d.ts +7 -0
- package/dist/components/Drawer/contexts/Drawer.context.js +6 -0
- package/dist/components/Drawer/contexts/index.d.ts +2 -0
- package/dist/components/Drawer/contexts/index.js +5 -0
- package/dist/components/Drawer/hooks/index.d.ts +2 -0
- package/dist/components/Drawer/hooks/index.js +4 -0
- package/dist/components/Drawer/hooks/useDrawer.d.ts +2 -0
- package/dist/components/Drawer/hooks/useDrawer.js +66 -0
- package/dist/components/Drawer/hooks/useDrawer.types.d.ts +30 -0
- package/dist/components/PhoneNumberInput/components/Wrapper.js +116 -116
- package/dist/components/RadioGroup/RadioGroup.js +34 -33
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +3 -1
- package/dist/components/Stepper/Stepper.js +29 -25
- package/dist/components/Stepper/components/HorizontalStepItem/HorizontalStepItem.d.ts +1 -2
- package/dist/components/Stepper/components/HorizontalStepItem/HorizontalStepItem.js +96 -91
- package/dist/components/Stepper/components/StepConnector/StepConnector.d.ts +1 -2
- package/dist/components/Stepper/components/StepConnector/StepConnector.js +10 -9
- package/dist/components/Stepper/components/StepIndicatorContent/StepIndicatorContent.d.ts +1 -2
- package/dist/components/Stepper/components/StepIndicatorContent/StepIndicatorContent.js +13 -19
- package/dist/components/Stepper/components/StepItem/StepItem.d.ts +1 -2
- package/dist/components/Stepper/components/StepItem/StepItem.js +6 -5
- package/dist/components/Stepper/components/VerticalStepItem/VerticalStepItem.d.ts +1 -2
- package/dist/components/Stepper/components/VerticalStepItem/VerticalStepItem.js +65 -60
- package/dist/components/Stepper/constants/index.d.ts +3 -0
- package/dist/components/Stepper/constants/index.js +13 -0
- package/dist/components/Stepper/hooks/index.d.ts +1 -0
- package/dist/components/Stepper/hooks/index.js +4 -0
- package/dist/components/Stepper/hooks/useStepItemLogic.d.ts +2 -0
- package/dist/components/Stepper/hooks/useStepItemLogic.js +27 -0
- package/dist/components/Stepper/hooks/useStepItemLogic.types.d.ts +16 -0
- package/dist/components/Stepper/utils/index.d.ts +3 -0
- package/dist/components/Stepper/utils/index.js +13 -0
- package/dist/components/Tooltip/Tooltip.variants.d.ts +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +113 -109
- package/dist/index.js +115 -111
- package/dist/package.json +18 -17
- package/dist/{proxy-Drz23HDt.js → proxy-i19-YB39.js} +1044 -1035
- package/dist/styles.css +1 -1
- package/package.json +15 -16
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { c as t } from "../../index-D29mdTf5.js";
|
|
2
|
+
const o = t(
|
|
3
|
+
[
|
|
4
|
+
"bg-white",
|
|
5
|
+
"dark:bg-metal-900",
|
|
6
|
+
"duration-300",
|
|
7
|
+
"ease-in-out",
|
|
8
|
+
"fixed",
|
|
9
|
+
"flex",
|
|
10
|
+
"flex-col",
|
|
11
|
+
"group/drawer",
|
|
12
|
+
"inset-y-0",
|
|
13
|
+
"shadow-xl",
|
|
14
|
+
"transform",
|
|
15
|
+
"transition-transform",
|
|
16
|
+
"z-50"
|
|
17
|
+
],
|
|
18
|
+
{
|
|
19
|
+
variants: {
|
|
20
|
+
position: {
|
|
21
|
+
left: [
|
|
22
|
+
"left-0",
|
|
23
|
+
"border-r",
|
|
24
|
+
"border-slate-200",
|
|
25
|
+
"dark:border-metal-700"
|
|
26
|
+
],
|
|
27
|
+
right: [
|
|
28
|
+
"right-0",
|
|
29
|
+
"border-l",
|
|
30
|
+
"border-slate-200",
|
|
31
|
+
"dark:border-metal-700"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
position: "right"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
), a = t([
|
|
40
|
+
"fixed",
|
|
41
|
+
"inset-0",
|
|
42
|
+
"z-40",
|
|
43
|
+
"bg-black",
|
|
44
|
+
"transition-opacity",
|
|
45
|
+
"duration-300"
|
|
46
|
+
]), e = t([
|
|
47
|
+
"absolute",
|
|
48
|
+
"right-3",
|
|
49
|
+
"top-3",
|
|
50
|
+
"cursor-pointer",
|
|
51
|
+
"text-slate-500",
|
|
52
|
+
"hover:text-slate-700",
|
|
53
|
+
"dark:text-metal-400",
|
|
54
|
+
"dark:hover:text-metal-300",
|
|
55
|
+
"transition-colors",
|
|
56
|
+
"z-10"
|
|
57
|
+
]), i = t(
|
|
58
|
+
[
|
|
59
|
+
"absolute",
|
|
60
|
+
"bg-slate-200",
|
|
61
|
+
"dark:bg-metal-700",
|
|
62
|
+
"border-none",
|
|
63
|
+
"cursor-col-resize",
|
|
64
|
+
"h-full",
|
|
65
|
+
"opacity-0",
|
|
66
|
+
"p-0",
|
|
67
|
+
"top-0",
|
|
68
|
+
"transition-opacity",
|
|
69
|
+
"w-1",
|
|
70
|
+
"z-50",
|
|
71
|
+
"group-hover/drawer:opacity-100",
|
|
72
|
+
"hover:opacity-100!",
|
|
73
|
+
"focus:outline-none"
|
|
74
|
+
],
|
|
75
|
+
{
|
|
76
|
+
variants: {
|
|
77
|
+
position: {
|
|
78
|
+
left: ["right-0"],
|
|
79
|
+
right: ["left-0"]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
position: "right"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
export {
|
|
88
|
+
e as buttonCloseVariants,
|
|
89
|
+
o as drawerVariants,
|
|
90
|
+
a as overlayVariants,
|
|
91
|
+
i as resizeHandleVariants
|
|
92
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { memo as t } from "react";
|
|
3
|
+
import { cn as s } from "../../../../utils/index.js";
|
|
4
|
+
import { useDrawerContext as a } from "../../contexts/Drawer.context.js";
|
|
5
|
+
const p = t(({ children: o, className: r }) => {
|
|
6
|
+
const { classNames: m } = a();
|
|
7
|
+
return /* @__PURE__ */ e(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: s(
|
|
11
|
+
"flex-1",
|
|
12
|
+
"overflow-y-auto",
|
|
13
|
+
"p-4",
|
|
14
|
+
m?.body,
|
|
15
|
+
r
|
|
16
|
+
),
|
|
17
|
+
children: o
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
p.displayName = "Drawer.Body";
|
|
22
|
+
export {
|
|
23
|
+
p as Body
|
|
24
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as m } from "react";
|
|
3
|
+
import { cn as s } from "../../../../utils/index.js";
|
|
4
|
+
import { useDrawerContext as a } from "../../contexts/Drawer.context.js";
|
|
5
|
+
const i = m(({ children: r, className: o }) => {
|
|
6
|
+
const { classNames: e } = a();
|
|
7
|
+
return /* @__PURE__ */ t(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: s(
|
|
11
|
+
"flex-shrink-0",
|
|
12
|
+
"border-t",
|
|
13
|
+
"border-slate-200",
|
|
14
|
+
"dark:border-metal-700",
|
|
15
|
+
"p-4",
|
|
16
|
+
e?.footer,
|
|
17
|
+
o
|
|
18
|
+
),
|
|
19
|
+
children: r
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
i.displayName = "Drawer.Footer";
|
|
24
|
+
export {
|
|
25
|
+
i as Footer
|
|
26
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { memo as s } from "react";
|
|
3
|
+
import { cn as t } from "../../../../utils/index.js";
|
|
4
|
+
import { useDrawerContext as i } from "../../contexts/Drawer.context.js";
|
|
5
|
+
const p = s(({ children: r, className: e, id: o }) => {
|
|
6
|
+
const { classNames: a, headerId: m } = i();
|
|
7
|
+
return /* @__PURE__ */ d(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
id: o ?? m,
|
|
11
|
+
className: t(
|
|
12
|
+
"flex-shrink-0",
|
|
13
|
+
"border-b",
|
|
14
|
+
"border-slate-200",
|
|
15
|
+
"dark:border-metal-700",
|
|
16
|
+
"p-4",
|
|
17
|
+
a?.header,
|
|
18
|
+
e
|
|
19
|
+
),
|
|
20
|
+
children: r
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
p.displayName = "Drawer.Header";
|
|
25
|
+
export {
|
|
26
|
+
p as Header
|
|
27
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DEFAULT_WIDTH = 500;
|
|
2
|
+
export declare const DEFAULT_MIN_WIDTH = 400;
|
|
3
|
+
export declare const DEFAULT_MAX_WIDTH = 800;
|
|
4
|
+
export declare const ANIMATION_DELAY_MS = 10;
|
|
5
|
+
export declare const ANIMATION_DURATION_MS = 300;
|
|
6
|
+
export declare const KEYBOARD_RESIZE_STEP = 20;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useState as D, useRef as w, useEffect as c, useCallback as E, useMemo as S } from "react";
|
|
2
|
+
import { DEFAULT_WIDTH as k, ANIMATION_DELAY_MS as N, ANIMATION_DURATION_MS as K, DEFAULT_MIN_WIDTH as U, DEFAULT_MAX_WIDTH as x, KEYBOARD_RESIZE_STEP as I } from "../constants/index.js";
|
|
3
|
+
const X = ({
|
|
4
|
+
canResize: n = !1,
|
|
5
|
+
defaultWidth: T = k,
|
|
6
|
+
isOpen: s,
|
|
7
|
+
maxWidth: u = x,
|
|
8
|
+
minWidth: l = U,
|
|
9
|
+
position: t = "right",
|
|
10
|
+
onClose: M
|
|
11
|
+
}) => {
|
|
12
|
+
const [L, g] = D(!1), [a, h] = D(!1), [_, f] = D(T), d = w(!1), i = w(() => {
|
|
13
|
+
}), m = w(() => {
|
|
14
|
+
});
|
|
15
|
+
c(() => {
|
|
16
|
+
let e;
|
|
17
|
+
return s ? (g(!0), e = setTimeout(() => h(!0), N)) : (h(!1), e = setTimeout(() => g(!1), K)), () => {
|
|
18
|
+
clearTimeout(e);
|
|
19
|
+
};
|
|
20
|
+
}, [s]), c(() => {
|
|
21
|
+
if (!s) return;
|
|
22
|
+
const e = new AbortController(), r = (A) => {
|
|
23
|
+
A.code === "Escape" && M?.();
|
|
24
|
+
};
|
|
25
|
+
return window.addEventListener("keydown", r, {
|
|
26
|
+
signal: e.signal
|
|
27
|
+
}), () => {
|
|
28
|
+
e.abort();
|
|
29
|
+
};
|
|
30
|
+
}, [s, M]);
|
|
31
|
+
const o = E(() => {
|
|
32
|
+
document.removeEventListener("mousemove", i.current), document.removeEventListener("mouseup", m.current), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
33
|
+
}, []);
|
|
34
|
+
c(() => {
|
|
35
|
+
i.current = (e) => {
|
|
36
|
+
if (!d.current || !n) return;
|
|
37
|
+
let r;
|
|
38
|
+
t === "right" ? r = window.innerWidth - e.clientX : r = e.clientX, r = Math.max(l, Math.min(u, r)), f(r);
|
|
39
|
+
}, m.current = () => {
|
|
40
|
+
d.current = !1, o();
|
|
41
|
+
};
|
|
42
|
+
}, [t, l, u, n, o]);
|
|
43
|
+
const b = E(() => {
|
|
44
|
+
d.current = !0, document.addEventListener("mousemove", i.current), document.addEventListener("mouseup", m.current), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
45
|
+
}, []), v = E(
|
|
46
|
+
(e) => {
|
|
47
|
+
if (!n) return;
|
|
48
|
+
const r = t === "right" && e.key === "ArrowLeft" || t === "left" && e.key === "ArrowRight", A = t === "right" && e.key === "ArrowRight" || t === "left" && e.key === "ArrowLeft";
|
|
49
|
+
r ? (e.preventDefault(), f((y) => Math.min(u, y + I))) : A && (e.preventDefault(), f((y) => Math.max(l, y - I)));
|
|
50
|
+
},
|
|
51
|
+
[n, t, u, l]
|
|
52
|
+
);
|
|
53
|
+
c(() => o, [o]);
|
|
54
|
+
const R = S(() => a ? "translate-x-0" : t === "left" ? "-translate-x-full" : "translate-x-full", [a, t]);
|
|
55
|
+
return {
|
|
56
|
+
isAnimating: a,
|
|
57
|
+
isVisible: L,
|
|
58
|
+
width: _,
|
|
59
|
+
translateClass: R,
|
|
60
|
+
handleMouseDown: b,
|
|
61
|
+
handleKeyDown: v
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
X as useDrawer
|
|
66
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type UseDrawerProps = {
|
|
2
|
+
/** Enable resizable drawer */
|
|
3
|
+
canResize?: boolean;
|
|
4
|
+
/** Default width */
|
|
5
|
+
defaultWidth?: number;
|
|
6
|
+
/** Whether the drawer is open */
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
/** Maximum width when resizable */
|
|
9
|
+
maxWidth?: number;
|
|
10
|
+
/** Minimum width when resizable */
|
|
11
|
+
minWidth?: number;
|
|
12
|
+
/** Position of the drawer */
|
|
13
|
+
position?: 'left' | 'right';
|
|
14
|
+
/** Callback when drawer is closed */
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
};
|
|
17
|
+
export type UseDrawerReturn = {
|
|
18
|
+
/** Whether the drawer is animating (for CSS transitions) */
|
|
19
|
+
isAnimating: boolean;
|
|
20
|
+
/** Whether the drawer is visible in the DOM */
|
|
21
|
+
isVisible: boolean;
|
|
22
|
+
/** Current width of the drawer */
|
|
23
|
+
width: number;
|
|
24
|
+
/** The translate class based on animation state */
|
|
25
|
+
translateClass: string;
|
|
26
|
+
/** Handler for resize mouse down event */
|
|
27
|
+
handleMouseDown: () => void;
|
|
28
|
+
/** Handler for resize keyboard events */
|
|
29
|
+
handleKeyDown: (event: React.KeyboardEvent) => void;
|
|
30
|
+
};
|