@konstructio/ui 0.1.0-alpha.2 → 0.1.0-alpha.3
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/DatePicker.css +1 -0
- package/dist/{Modal-i7eolhYH.js → Modal-B2ujmsSW.js} +2 -2
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +55 -41
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +14 -14
- package/dist/components/Badge/Badge.variants.js +18 -17
- package/dist/components/Breadcrumb/Breadcrumb.js +43 -52
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +10 -41
- package/dist/components/Breadcrumb/components/Item/Item.js +22 -23
- package/dist/components/Breadcrumb/components/Item/Item.variants.js +43 -56
- package/dist/components/Button/Button.js +30 -26
- package/dist/components/Button/Button.variants.js +115 -28
- package/dist/components/Checkbox/Checkbox.js +297 -187
- package/dist/components/Checkbox/Checkbox.variants.js +12 -15
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/components/Command.js +1 -1
- package/dist/components/Command/components/CommandEmpty.js +1 -1
- package/dist/components/Command/components/CommandGroup.js +1 -1
- package/dist/components/Command/components/CommandInput.js +1 -1
- package/dist/components/Command/components/CommandItem.js +1 -1
- package/dist/components/Command/components/CommandList.js +1 -1
- package/dist/components/Command/components/CommandSeparator.js +1 -1
- package/dist/components/Command/components/DialogContent.js +1 -1
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +2711 -0
- package/dist/components/Datepicker/DatePicker.variants.js +5 -0
- package/dist/components/Dropdown/contexts/dropdown.hook.js +5 -3
- package/dist/components/Input/Input.js +106 -137
- package/dist/components/Input/Input.variants.js +15 -13
- package/dist/components/Loading/Loading.js +2 -2
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +1 -1
- package/dist/components/Radio/Radio.variants.js +14 -12
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +141 -126
- package/dist/components/Tabs/Tabs.js +24 -0
- package/dist/components/Tabs/Tabs.variants.js +58 -0
- package/dist/components/Tabs/components/Content.js +19 -0
- package/dist/components/Tabs/components/List.js +20 -0
- package/dist/components/Tabs/components/Trigger.js +26 -0
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/TimePicker/TimePicker.js +8 -0
- package/dist/components/TimePicker/TimePicker.variants.js +62 -0
- package/dist/components/TimePicker/components/HoursList/HoursList.js +93 -0
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +68 -0
- package/dist/components/TimePicker/components/MinutesList/MinutesList.js +60 -0
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +102 -0
- package/dist/components/TimePicker/components/WrapperList/WrapperList.js +51 -0
- package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +16 -0
- package/dist/components/TimePicker/components/index.js +4 -0
- package/dist/components/TimePicker/contexts/index.js +8 -0
- package/dist/components/TimePicker/contexts/time-picker.context.js +22 -0
- package/dist/components/TimePicker/contexts/time-picker.hook.js +13 -0
- package/dist/components/TimePicker/contexts/time-picker.provider.js +46 -0
- package/dist/components/TimePicker/utils/index.js +6 -0
- package/dist/components/Toast/Toast.js +37 -35
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Typography/Typography.js +1 -1
- package/dist/components/index.js +72 -66
- package/dist/createLucideIcon-BA2PlKw1.js +94 -0
- package/dist/index-55GVbfLI.js +432 -0
- package/dist/{index-D9BbbgUq.js → index-B-qIIQlg.js} +2 -2
- package/dist/index-BRcC_VTj.js +31 -0
- package/dist/{index-Bry5AFQ2.js → index-Bc1LNrRD.js} +1 -1
- package/dist/index-BdMNhZnh.js +9 -0
- package/dist/index-C2xwUZXm.js +323 -0
- package/dist/{index-YaQrdkGE.js → index-CQ6ORxI_.js} +31 -30
- package/dist/index-Cq1I1cG9.js +129 -0
- package/dist/index-Cs8Lv8Wj.js +13 -0
- package/dist/{index-dRxIWVBr.js → index-DmCJ8fIR.js} +6 -5
- package/dist/index-DwYXX2sM.js +13 -0
- package/dist/{index-g-TFwd6Y.js → index-ObZsP5Eh.js} +2 -1
- package/dist/{index-DvFiic6N.js → index-Ud3-A7-K.js} +95 -101
- package/dist/{index-G_6jG4Qc.js → index-Y44iCJcQ.js} +18 -18
- package/dist/index-tIydFizp.js +83 -0
- package/dist/{index-AM3avohj.js → index-xPmNHv1y.js} +3 -3
- package/dist/index.d.ts +72 -13
- package/dist/index.js +78 -72
- package/dist/package.json +25 -22
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +263 -0
- package/dist/ui/kubefirst-theme.css +1 -1
- package/dist/ui/theme.css +11 -0
- package/dist/utils/index.js +3 -3
- package/package.json +25 -22
- package/dist/createLucideIcon-CoF3ywd5.js +0 -89
- package/dist/index-BOx5P4tS.js +0 -423
- package/dist/index-Bk324h27.js +0 -82
- package/dist/index-CWKdynYu.js +0 -32
- package/dist/index-bYyfdsls.js +0 -118
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsxs as b, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as N } from "react";
|
|
3
|
+
import { cn as t } from "../../../../utils/index.js";
|
|
4
|
+
import { buttonVariants as c, liVariants as s } from "../../TimePicker.variants.js";
|
|
5
|
+
import { useTimePickerContext as x } from "../../contexts/time-picker.hook.js";
|
|
6
|
+
const M = ({
|
|
7
|
+
listClassName: m,
|
|
8
|
+
listItemClassName: a,
|
|
9
|
+
listItemButtonClassName: i
|
|
10
|
+
}) => {
|
|
11
|
+
const { format: p, isAM: l, onSelectAM: u, onSelectPM: d } = x(), o = N(
|
|
12
|
+
(e, f) => {
|
|
13
|
+
var n;
|
|
14
|
+
(n = e.currentTarget) == null || n.blur(), f();
|
|
15
|
+
},
|
|
16
|
+
[]
|
|
17
|
+
);
|
|
18
|
+
return p === "24" ? null : /* @__PURE__ */ b(
|
|
19
|
+
"ul",
|
|
20
|
+
{
|
|
21
|
+
className: t("flex items-center justify-center flex-col", m),
|
|
22
|
+
"aria-label": "meridian",
|
|
23
|
+
role: "listbox",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ r(
|
|
26
|
+
"li",
|
|
27
|
+
{
|
|
28
|
+
className: t(s({ className: a })),
|
|
29
|
+
"data-active": l,
|
|
30
|
+
role: "presentation",
|
|
31
|
+
children: /* @__PURE__ */ r(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
role: "option",
|
|
36
|
+
className: t(c({ className: i })),
|
|
37
|
+
onClick: (e) => o(e, u),
|
|
38
|
+
children: "AM"
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ r(
|
|
44
|
+
"li",
|
|
45
|
+
{
|
|
46
|
+
className: t(s({ className: a })),
|
|
47
|
+
"data-active": !l,
|
|
48
|
+
role: "presentation",
|
|
49
|
+
children: /* @__PURE__ */ r(
|
|
50
|
+
"button",
|
|
51
|
+
{
|
|
52
|
+
type: "button",
|
|
53
|
+
role: "option",
|
|
54
|
+
className: t(c({ className: i })),
|
|
55
|
+
onClick: (e) => o(e, d),
|
|
56
|
+
children: "PM"
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
M.displayName = "MeridianList";
|
|
66
|
+
export {
|
|
67
|
+
M as MeridianList
|
|
68
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as i, useEffect as p, useCallback as f } from "react";
|
|
3
|
+
import { cn as n } from "../../../../utils/index.js";
|
|
4
|
+
import { buttonVariants as b, liVariants as h, ulVariants as d } from "../../TimePicker.variants.js";
|
|
5
|
+
import { useTimePickerContext as k } from "../../contexts/time-picker.hook.js";
|
|
6
|
+
const y = ({ minutes: a, scrollBehavior: l }) => {
|
|
7
|
+
const s = i(null), u = i(a), { onSelectMinute: c } = k();
|
|
8
|
+
p(() => {
|
|
9
|
+
const r = s.current;
|
|
10
|
+
if (r) {
|
|
11
|
+
const e = `0${u.current}`.slice(-2), t = r.querySelector(
|
|
12
|
+
`[data-value="${e}"]`
|
|
13
|
+
);
|
|
14
|
+
t == null || t.scrollIntoView({
|
|
15
|
+
behavior: l,
|
|
16
|
+
block: "center"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}, [l]);
|
|
20
|
+
const m = f(
|
|
21
|
+
(r, e) => {
|
|
22
|
+
var t;
|
|
23
|
+
c(r), (t = e.currentTarget) == null || t.blur();
|
|
24
|
+
},
|
|
25
|
+
[c]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ o(
|
|
28
|
+
"ul",
|
|
29
|
+
{
|
|
30
|
+
ref: s,
|
|
31
|
+
className: n(d()),
|
|
32
|
+
"aria-label": "minutes",
|
|
33
|
+
role: "listbox",
|
|
34
|
+
children: Array.from({ length: 60 }, (r, e) => /* @__PURE__ */ o(
|
|
35
|
+
"li",
|
|
36
|
+
{
|
|
37
|
+
className: n(h()),
|
|
38
|
+
"data-value": `0${e}`.slice(-2),
|
|
39
|
+
"data-active": a === e,
|
|
40
|
+
role: "presentation",
|
|
41
|
+
children: /* @__PURE__ */ o(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
role: "option",
|
|
46
|
+
className: n(b()),
|
|
47
|
+
onClick: (t) => m(e, t),
|
|
48
|
+
children: `0${e}`.slice(-2)
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
},
|
|
52
|
+
e
|
|
53
|
+
))
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
y.displayName = "MinutesList";
|
|
58
|
+
export {
|
|
59
|
+
y as MinutesList
|
|
60
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useId as C, useState as E, useRef as I, useCallback as L, useEffect as O } from "react";
|
|
3
|
+
import { cn as m } from "../../../../utils/index.js";
|
|
4
|
+
import { timePickerVariants as j } from "../../TimePicker.variants.js";
|
|
5
|
+
import { WrapperList as P } from "../WrapperList/WrapperList.js";
|
|
6
|
+
import { c as R } from "../../../../createLucideIcon-BA2PlKw1.js";
|
|
7
|
+
import { useTimePickerContext as T } from "../../contexts/time-picker.hook.js";
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v0.510.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
const W = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], _ = R("chevron-down", W), $ = ({
|
|
15
|
+
name: p,
|
|
16
|
+
label: i,
|
|
17
|
+
required: u,
|
|
18
|
+
scrollBehavior: f,
|
|
19
|
+
className: h,
|
|
20
|
+
listClassName: x,
|
|
21
|
+
listItemClassName: w,
|
|
22
|
+
listItemButtonClassName: b
|
|
23
|
+
}) => {
|
|
24
|
+
const k = C(), [n, o] = E(!1), l = I(null), { format: v, formattedTime: c } = T(), r = p ?? `time-${k}`, N = L(() => o((e) => !e), []);
|
|
25
|
+
return O(() => {
|
|
26
|
+
const e = new AbortController(), g = (s) => {
|
|
27
|
+
s.key === "Escape" && o(!1);
|
|
28
|
+
}, y = (s) => {
|
|
29
|
+
var d;
|
|
30
|
+
(d = l.current) != null && d.contains(s.target) || o(!1);
|
|
31
|
+
};
|
|
32
|
+
return document.addEventListener("mousedown", y, {
|
|
33
|
+
signal: e.signal
|
|
34
|
+
}), document.addEventListener("keydown", g, {
|
|
35
|
+
signal: e.signal
|
|
36
|
+
}), () => {
|
|
37
|
+
e.abort();
|
|
38
|
+
};
|
|
39
|
+
}, []), /* @__PURE__ */ t(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
ref: l,
|
|
43
|
+
className: m(
|
|
44
|
+
"w-max text-slate-800 text-sm flex flex-col gap-2",
|
|
45
|
+
v === "12" ? "w-[208px]" : "w-[140px]"
|
|
46
|
+
),
|
|
47
|
+
children: [
|
|
48
|
+
i ? /* @__PURE__ */ t("label", { htmlFor: r, className: "text-slate-500 font-medium", children: [
|
|
49
|
+
i,
|
|
50
|
+
" ",
|
|
51
|
+
u && /* @__PURE__ */ a("span", { className: "text-red-600", children: "*" })
|
|
52
|
+
] }) : null,
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "relative", children: [
|
|
54
|
+
/* @__PURE__ */ t(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
"aria-label": r,
|
|
58
|
+
"aria-haspopup": "listbox",
|
|
59
|
+
"aria-expanded": "true",
|
|
60
|
+
"aria-controls": "time-options",
|
|
61
|
+
className: m(j({ className: h })),
|
|
62
|
+
"data-open": n,
|
|
63
|
+
onClick: N,
|
|
64
|
+
children: [
|
|
65
|
+
c,
|
|
66
|
+
/* @__PURE__ */ a(
|
|
67
|
+
_,
|
|
68
|
+
{
|
|
69
|
+
className: "w-4 h-4 transition-all text-gray-400 data-[open=true]:rotate-180",
|
|
70
|
+
"data-open": n
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ a(
|
|
77
|
+
P,
|
|
78
|
+
{
|
|
79
|
+
isOpen: n,
|
|
80
|
+
scrollBehavior: f,
|
|
81
|
+
listClassName: x,
|
|
82
|
+
listItemClassName: w,
|
|
83
|
+
listItemButtonClassName: b
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ a(
|
|
88
|
+
"input",
|
|
89
|
+
{
|
|
90
|
+
type: "hidden",
|
|
91
|
+
name: r,
|
|
92
|
+
value: c,
|
|
93
|
+
className: "hidden"
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
$ as Wrapper
|
|
102
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as n } from "react";
|
|
3
|
+
import { cn as s } from "../../../../utils/index.js";
|
|
4
|
+
import { getHours as d, getMinutes as M } from "../../utils/index.js";
|
|
5
|
+
import { HoursList as x } from "../HoursList/HoursList.js";
|
|
6
|
+
import { MeridianList as L } from "../MeridianList/MeridianList.js";
|
|
7
|
+
import { MinutesList as g } from "../MinutesList/MinutesList.js";
|
|
8
|
+
import { wrapperVariants as H } from "./WrapperList.variants.js";
|
|
9
|
+
import { useTimePickerContext as j } from "../../contexts/time-picker.hook.js";
|
|
10
|
+
const v = ({
|
|
11
|
+
isOpen: m,
|
|
12
|
+
scrollBehavior: p,
|
|
13
|
+
listClassName: o,
|
|
14
|
+
listItemClassName: i,
|
|
15
|
+
listItemButtonClassName: t
|
|
16
|
+
}) => {
|
|
17
|
+
const { time: r } = j(), u = n(() => d(r), [r]), f = n(() => M(r), [r]);
|
|
18
|
+
return m ? /* @__PURE__ */ c("div", { role: "group", className: s(H()), children: [
|
|
19
|
+
/* @__PURE__ */ e(
|
|
20
|
+
x,
|
|
21
|
+
{
|
|
22
|
+
hours: u,
|
|
23
|
+
scrollBehavior: p,
|
|
24
|
+
listClassName: o,
|
|
25
|
+
listItemClassName: i,
|
|
26
|
+
listItemButtonClassName: t
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ e(
|
|
30
|
+
g,
|
|
31
|
+
{
|
|
32
|
+
minutes: f,
|
|
33
|
+
scrollBehavior: p,
|
|
34
|
+
listClassName: o,
|
|
35
|
+
listItemClassName: i,
|
|
36
|
+
listItemButtonClassName: t
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ e(
|
|
40
|
+
L,
|
|
41
|
+
{
|
|
42
|
+
listClassName: o,
|
|
43
|
+
listItemClassName: i,
|
|
44
|
+
listItemButtonClassName: t
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }) : null;
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
v as WrapperList
|
|
51
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { c as a } from "../../../../index-BNmRGtA6.js";
|
|
2
|
+
const p = a([
|
|
3
|
+
"flex",
|
|
4
|
+
"gap-1.5",
|
|
5
|
+
"p-2",
|
|
6
|
+
"rounded-md",
|
|
7
|
+
"shadow",
|
|
8
|
+
"w-full",
|
|
9
|
+
"max-h-[216px]",
|
|
10
|
+
"absolute mt-1",
|
|
11
|
+
"bg-white",
|
|
12
|
+
"z-10"
|
|
13
|
+
]);
|
|
14
|
+
export {
|
|
15
|
+
p as wrapperVariants
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TimePickerContext as o } from "./time-picker.context.js";
|
|
2
|
+
import { TimePickerProvider as t } from "./time-picker.provider.js";
|
|
3
|
+
import { useTimePickerContext as x } from "./time-picker.hook.js";
|
|
4
|
+
export {
|
|
5
|
+
o as TimePickerContext,
|
|
6
|
+
t as TimePickerProvider,
|
|
7
|
+
x as useTimePickerContext
|
|
8
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
const o = e({
|
|
3
|
+
time: /* @__PURE__ */ new Date(),
|
|
4
|
+
format: "12",
|
|
5
|
+
formattedTime: "",
|
|
6
|
+
isAM: !1,
|
|
7
|
+
onSelectHour() {
|
|
8
|
+
throw new Error("onSelectHour is not implemented");
|
|
9
|
+
},
|
|
10
|
+
onSelectMinute() {
|
|
11
|
+
throw new Error("onSelectMinute is not implemented");
|
|
12
|
+
},
|
|
13
|
+
onSelectAM() {
|
|
14
|
+
throw new Error("onSelectAM is not implemented");
|
|
15
|
+
},
|
|
16
|
+
onSelectPM() {
|
|
17
|
+
throw new Error("onSelectPM is not implemented");
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
o as TimePickerContext
|
|
22
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext as t } from "react";
|
|
2
|
+
import { TimePickerContext as r } from "./time-picker.context.js";
|
|
3
|
+
const n = () => {
|
|
4
|
+
const e = t(r);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error(
|
|
7
|
+
"useTimePickerContext must be used within a TimePickerProvider"
|
|
8
|
+
);
|
|
9
|
+
return e;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
n as useTimePickerContext
|
|
13
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useMemo as T, useCallback as c, useEffect as d } from "react";
|
|
3
|
+
import { getFormattedTime as P } from "../utils/index.js";
|
|
4
|
+
import { TimePickerContext as p } from "./time-picker.context.js";
|
|
5
|
+
const x = ({ children: m, time: u, format: a }) => {
|
|
6
|
+
const [n, l] = i(a), [t, r] = i(() => u ?? /* @__PURE__ */ new Date()), s = T(() => t.getHours() < 12, [t]), f = c(
|
|
7
|
+
(e) => {
|
|
8
|
+
const o = new Date(t);
|
|
9
|
+
n === "12" ? e === 12 ? o.setHours(s ? 0 : 12) : o.setHours(s ? e : e + 12) : o.setHours(e), r(o);
|
|
10
|
+
},
|
|
11
|
+
[n, s, t]
|
|
12
|
+
), H = c(
|
|
13
|
+
(e) => {
|
|
14
|
+
const o = new Date(t);
|
|
15
|
+
o.setMinutes(e), r(o);
|
|
16
|
+
},
|
|
17
|
+
[t]
|
|
18
|
+
), w = c(() => {
|
|
19
|
+
const e = new Date(t), o = e.getHours();
|
|
20
|
+
s || e.setHours(o - 12), r(e);
|
|
21
|
+
}, [s, t]), M = c(() => {
|
|
22
|
+
const e = new Date(t), o = e.getHours();
|
|
23
|
+
s && e.setHours(o + 12), r(e);
|
|
24
|
+
}, [s, t]);
|
|
25
|
+
return d(() => {
|
|
26
|
+
l(n);
|
|
27
|
+
}, [n]), /* @__PURE__ */ S(
|
|
28
|
+
p.Provider,
|
|
29
|
+
{
|
|
30
|
+
value: {
|
|
31
|
+
time: t,
|
|
32
|
+
format: n,
|
|
33
|
+
formattedTime: P(t, n),
|
|
34
|
+
isAM: s,
|
|
35
|
+
onSelectHour: f,
|
|
36
|
+
onSelectMinute: H,
|
|
37
|
+
onSelectAM: w,
|
|
38
|
+
onSelectPM: M
|
|
39
|
+
},
|
|
40
|
+
children: m
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
x as TimePickerProvider
|
|
46
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const e = (t, r) => r === "12" ? `${t.getHours() % 12 || 12}:${t.getMinutes().toString().padStart(2, "0")} ${t.getHours() >= 12 ? "PM" : "AM"}` : `${t.getHours().toString().padStart(2, "0")}:${t.getMinutes().toString().padStart(2, "0")}`, n = (t) => t.getHours(), g = (t) => t.getMinutes();
|
|
2
|
+
export {
|
|
3
|
+
e as getFormattedTime,
|
|
4
|
+
n as getHours,
|
|
5
|
+
g as getMinutes
|
|
6
|
+
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { jsx as c, jsxs as D, Fragment as se } from "react/jsx-runtime";
|
|
2
|
-
import { u as ae, S as j } from "../../index-
|
|
2
|
+
import { u as ae, S as j } from "../../index-tIydFizp.js";
|
|
3
3
|
import * as s from "react";
|
|
4
4
|
import { useRef as Re, useEffect as be, useMemo as oe, isValidElement as re, useCallback as ge } from "react";
|
|
5
|
-
import { P as L, r as Se, d as Ie } from "../../index-
|
|
6
|
-
import { c as Ne, a as Ae, b,
|
|
7
|
-
import { c as _e } from "../../index-
|
|
8
|
-
import { B as De, R as Le, P as Me } from "../../index-
|
|
9
|
-
import { P as Oe } from "../../index-
|
|
10
|
-
import {
|
|
5
|
+
import { P as L, r as Se, d as Ie } from "../../index-ObZsP5Eh.js";
|
|
6
|
+
import { c as Ne, a as Ae, b, u as Fe } from "../../index-Cq1I1cG9.js";
|
|
7
|
+
import { c as _e } from "../../index-B-qIIQlg.js";
|
|
8
|
+
import { B as De, R as Le, P as Me } from "../../index-CQ6ORxI_.js";
|
|
9
|
+
import { P as Oe } from "../../index-Y44iCJcQ.js";
|
|
10
|
+
import { u as $ } from "../../index-DwYXX2sM.js";
|
|
11
|
+
import { V as ie, R as ke } from "../../index-BRcC_VTj.js";
|
|
11
12
|
import { cn as q } from "../../utils/index.js";
|
|
12
13
|
import { closeToastVariants as Ve, toastVariants as Ke, viewportToastVariants as He } from "./Toast.variants.js";
|
|
13
14
|
import { X as We } from "../../x-DU-Zw-L_.js";
|
|
14
|
-
var Z = "ToastProvider", [ee, Xe, $e] = _e("Toast"), [ce,
|
|
15
|
+
var Z = "ToastProvider", [ee, Xe, $e] = _e("Toast"), [ce, Rt] = Ne("Toast", [$e]), [Ue, U] = ce(Z), ue = (e) => {
|
|
15
16
|
const {
|
|
16
17
|
__scopeToast: r,
|
|
17
18
|
label: o = "Notification",
|
|
@@ -49,7 +50,7 @@ var le = "ToastViewport", Ye = ["F8"], G = "toast.viewportPause", J = "toast.vie
|
|
|
49
50
|
hotkey: t = Ye,
|
|
50
51
|
label: u = "Notifications ({hotkey})",
|
|
51
52
|
...d
|
|
52
|
-
} = e, f =
|
|
53
|
+
} = e, f = U(le, o), m = Xe(o), v = s.useRef(null), n = s.useRef(null), h = s.useRef(null), w = s.useRef(null), S = ae(r, w, f.onViewportChange), g = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), R = f.toastCount > 0;
|
|
53
54
|
s.useEffect(() => {
|
|
54
55
|
const i = (C) => {
|
|
55
56
|
var T;
|
|
@@ -101,8 +102,8 @@ var le = "ToastViewport", Ye = ["F8"], G = "toast.viewportPause", J = "toast.vie
|
|
|
101
102
|
(y = n.current) == null || y.focus();
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
|
-
const A = l({ tabbingDirection: F ? "backwards" : "forwards" }),
|
|
105
|
-
z(A.slice(
|
|
105
|
+
const A = l({ tabbingDirection: F ? "backwards" : "forwards" }), K = A.findIndex((a) => a === M);
|
|
106
|
+
z(A.slice(K + 1)) ? p.preventDefault() : F ? (P = n.current) == null || P.focus() : (N = h.current) == null || N.focus();
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
return i.addEventListener("keydown", C), () => i.removeEventListener("keydown", C);
|
|
@@ -149,7 +150,7 @@ var le = "ToastViewport", Ye = ["F8"], G = "toast.viewportPause", J = "toast.vie
|
|
|
149
150
|
de.displayName = le;
|
|
150
151
|
var fe = "ToastFocusProxy", Q = s.forwardRef(
|
|
151
152
|
(e, r) => {
|
|
152
|
-
const { __scopeToast: o, onFocusFromOutsideViewport: t, ...u } = e, d =
|
|
153
|
+
const { __scopeToast: o, onFocusFromOutsideViewport: t, ...u } = e, d = U(fe, o);
|
|
153
154
|
return /* @__PURE__ */ c(
|
|
154
155
|
ie,
|
|
155
156
|
{
|
|
@@ -168,12 +169,13 @@ var fe = "ToastFocusProxy", Q = s.forwardRef(
|
|
|
168
169
|
}
|
|
169
170
|
);
|
|
170
171
|
Q.displayName = fe;
|
|
171
|
-
var
|
|
172
|
+
var V = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.swipeCancel", ze = "toast.swipeEnd", pe = s.forwardRef(
|
|
172
173
|
(e, r) => {
|
|
173
|
-
const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [m
|
|
174
|
+
const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [m, v] = Ae({
|
|
174
175
|
prop: t,
|
|
175
|
-
defaultProp: u,
|
|
176
|
-
onChange: d
|
|
176
|
+
defaultProp: u ?? !0,
|
|
177
|
+
onChange: d,
|
|
178
|
+
caller: V
|
|
177
179
|
});
|
|
178
180
|
return /* @__PURE__ */ c(Oe, { present: o || m, children: /* @__PURE__ */ c(
|
|
179
181
|
Qe,
|
|
@@ -182,8 +184,8 @@ var U = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.sw
|
|
|
182
184
|
...f,
|
|
183
185
|
ref: r,
|
|
184
186
|
onClose: () => v(!1),
|
|
185
|
-
onPause:
|
|
186
|
-
onResume:
|
|
187
|
+
onPause: $(e.onPause),
|
|
188
|
+
onResume: $(e.onResume),
|
|
187
189
|
onSwipeStart: b(e.onSwipeStart, (n) => {
|
|
188
190
|
n.currentTarget.setAttribute("data-swipe", "start");
|
|
189
191
|
}),
|
|
@@ -202,8 +204,8 @@ var U = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.sw
|
|
|
202
204
|
) });
|
|
203
205
|
}
|
|
204
206
|
);
|
|
205
|
-
pe.displayName =
|
|
206
|
-
var [Ge, Je] = ce(
|
|
207
|
+
pe.displayName = V;
|
|
208
|
+
var [Ge, Je] = ce(V, {
|
|
207
209
|
onClose() {
|
|
208
210
|
}
|
|
209
211
|
}), Qe = s.forwardRef(
|
|
@@ -222,7 +224,7 @@ var [Ge, Je] = ce(U, {
|
|
|
222
224
|
onSwipeCancel: S,
|
|
223
225
|
onSwipeEnd: g,
|
|
224
226
|
...R
|
|
225
|
-
} = e, l =
|
|
227
|
+
} = e, l = U(V, o), [i, C] = s.useState(null), p = ae(r, (a) => C(a)), T = s.useRef(null), E = s.useRef(null), y = u || l.duration, P = s.useRef(0), N = s.useRef(y), M = s.useRef(0), { onToastAdd: F, onToastRemove: Y } = l, _ = $(() => {
|
|
226
228
|
var x;
|
|
227
229
|
(i == null ? void 0 : i.contains(document.activeElement)) && ((x = l.viewport) == null || x.focus()), f();
|
|
228
230
|
}), A = s.useCallback(
|
|
@@ -247,16 +249,16 @@ var [Ge, Je] = ce(U, {
|
|
|
247
249
|
}, [l.viewport, y, v, n, A]), s.useEffect(() => {
|
|
248
250
|
d && !l.isClosePausedRef.current && A(y);
|
|
249
251
|
}, [d, y, l.isClosePausedRef, A]), s.useEffect(() => (F(), () => Y()), [F, Y]);
|
|
250
|
-
const
|
|
252
|
+
const K = s.useMemo(() => i ? Ce(i) : null, [i]);
|
|
251
253
|
return l.viewport ? /* @__PURE__ */ D(se, { children: [
|
|
252
|
-
|
|
254
|
+
K && /* @__PURE__ */ c(
|
|
253
255
|
Ze,
|
|
254
256
|
{
|
|
255
257
|
__scopeToast: o,
|
|
256
258
|
role: "status",
|
|
257
259
|
"aria-live": t === "foreground" ? "assertive" : "polite",
|
|
258
260
|
"aria-atomic": !0,
|
|
259
|
-
children:
|
|
261
|
+
children: K
|
|
260
262
|
}
|
|
261
263
|
),
|
|
262
264
|
/* @__PURE__ */ c(Ge, { scope: o, onClose: _, children: Se.createPortal(
|
|
@@ -287,10 +289,10 @@ var [Ge, Je] = ce(U, {
|
|
|
287
289
|
}),
|
|
288
290
|
onPointerMove: b(e.onPointerMove, (a) => {
|
|
289
291
|
if (!T.current) return;
|
|
290
|
-
const x = a.clientX - T.current.x, I = a.clientY - T.current.y, O = !!E.current, k = ["left", "right"].includes(l.swipeDirection),
|
|
291
|
-
O ? (E.current =
|
|
292
|
+
const x = a.clientX - T.current.x, I = a.clientY - T.current.y, O = !!E.current, k = ["left", "right"].includes(l.swipeDirection), H = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Pe = k ? H(0, x) : 0, xe = k ? 0 : H(0, I), B = a.pointerType === "touch" ? 10 : 2, W = { x: Pe, y: xe }, te = { originalEvent: a, delta: W };
|
|
293
|
+
O ? (E.current = W, X(je, w, te, {
|
|
292
294
|
discrete: !1
|
|
293
|
-
})) : ne(
|
|
295
|
+
})) : ne(W, l.swipeDirection, B) ? (E.current = W, X(Be, h, te, {
|
|
294
296
|
discrete: !1
|
|
295
297
|
}), a.target.setPointerCapture(a.pointerId)) : (Math.abs(x) > B || Math.abs(I) > B) && (T.current = null);
|
|
296
298
|
}),
|
|
@@ -298,16 +300,16 @@ var [Ge, Je] = ce(U, {
|
|
|
298
300
|
const x = E.current, I = a.target;
|
|
299
301
|
if (I.hasPointerCapture(a.pointerId) && I.releasePointerCapture(a.pointerId), E.current = null, T.current = null, x) {
|
|
300
302
|
const O = a.currentTarget, k = { originalEvent: a, delta: x };
|
|
301
|
-
ne(x, l.swipeDirection, l.swipeThreshold) ?
|
|
303
|
+
ne(x, l.swipeDirection, l.swipeThreshold) ? X(ze, g, k, {
|
|
302
304
|
discrete: !0
|
|
303
|
-
}) :
|
|
305
|
+
}) : X(
|
|
304
306
|
qe,
|
|
305
307
|
S,
|
|
306
308
|
k,
|
|
307
309
|
{
|
|
308
310
|
discrete: !0
|
|
309
311
|
}
|
|
310
|
-
), O.addEventListener("click", (
|
|
312
|
+
), O.addEventListener("click", (H) => H.preventDefault(), {
|
|
311
313
|
once: !0
|
|
312
314
|
});
|
|
313
315
|
}
|
|
@@ -321,7 +323,7 @@ var [Ge, Je] = ce(U, {
|
|
|
321
323
|
] }) : null;
|
|
322
324
|
}
|
|
323
325
|
), Ze = (e) => {
|
|
324
|
-
const { __scopeToast: r, children: o, ...t } = e, u =
|
|
326
|
+
const { __scopeToast: r, children: o, ...t } = e, u = U(V, r), [d, f] = s.useState(!1), [m, v] = s.useState(!1);
|
|
325
327
|
return ot(() => f(!0)), s.useEffect(() => {
|
|
326
328
|
const n = window.setTimeout(() => v(!0), 1e3);
|
|
327
329
|
return () => window.clearTimeout(n);
|
|
@@ -394,7 +396,7 @@ function Ce(e) {
|
|
|
394
396
|
}
|
|
395
397
|
}), r;
|
|
396
398
|
}
|
|
397
|
-
function
|
|
399
|
+
function X(e, r, o, { discrete: t }) {
|
|
398
400
|
const u = o.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: o });
|
|
399
401
|
r && u.addEventListener(e, r, { once: !0 }), t ? Ie(u, d) : u.dispatchEvent(d);
|
|
400
402
|
}
|
|
@@ -404,7 +406,7 @@ var ne = (e, r, o = 0) => {
|
|
|
404
406
|
};
|
|
405
407
|
function ot(e = () => {
|
|
406
408
|
}) {
|
|
407
|
-
const r =
|
|
409
|
+
const r = $(e);
|
|
408
410
|
Fe(() => {
|
|
409
411
|
let o = 0, t = 0;
|
|
410
412
|
return o = window.requestAnimationFrame(() => t = window.requestAnimationFrame(r)), () => {
|
|
@@ -430,7 +432,7 @@ function z(e) {
|
|
|
430
432
|
return e.some((o) => o === r ? !0 : (o.focus(), document.activeElement !== r));
|
|
431
433
|
}
|
|
432
434
|
var st = ue, at = de, it = pe, ct = me, ut = Te, lt = we;
|
|
433
|
-
const
|
|
435
|
+
const bt = ({
|
|
434
436
|
title: e,
|
|
435
437
|
duration: r = 5e3,
|
|
436
438
|
titleClassName: o,
|
|
@@ -481,5 +483,5 @@ const Rt = ({
|
|
|
481
483
|
] });
|
|
482
484
|
};
|
|
483
485
|
export {
|
|
484
|
-
|
|
486
|
+
bt as Toast
|
|
485
487
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import { S as i } from "../../index-
|
|
2
|
+
import { S as i } from "../../index-tIydFizp.js";
|
|
3
3
|
import { forwardRef as v, useRef as N, useImperativeHandle as w, useMemo as h, isValidElement as x } from "react";
|
|
4
4
|
import { cn as o } from "../../utils/index.js";
|
|
5
5
|
import { arrowVariants as R, tooltipVariants as V } from "./Tooltip.variants.js";
|
|
@@ -2,7 +2,7 @@ import { jsx as f } from "react/jsx-runtime";
|
|
|
2
2
|
import { useId as d } from "react";
|
|
3
3
|
import { cn as h } from "../../utils/index.js";
|
|
4
4
|
import { typographyVariants as l } from "./Typography.variants.js";
|
|
5
|
-
import { S as g } from "../../index-
|
|
5
|
+
import { S as g } from "../../index-tIydFizp.js";
|
|
6
6
|
const i = ({
|
|
7
7
|
className: p,
|
|
8
8
|
theme: m,
|