@konstructio/ui 0.0.13-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 +79 -0
- package/dist/components/Badge/Badge.variants.js +68 -0
- 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/Divider/Divider.variants.js +9 -12
- 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 +14 -99
- 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/ui/utilities.css +11 -2
- package/dist/utils/index.js +3 -3
- package/package.json +25 -22
- 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,93 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useCallback as v, useEffect as y } from "react";
|
|
3
|
+
import { cn as o } from "../../../../utils/index.js";
|
|
4
|
+
import { buttonVariants as b, liVariants as d, ulVariants as h } from "../../TimePicker.variants.js";
|
|
5
|
+
import { useTimePickerContext as k } from "../../contexts/time-picker.hook.js";
|
|
6
|
+
const H = ({ hours: l, scrollBehavior: i }) => {
|
|
7
|
+
const n = p(null), u = p(!0), { format: c, onSelectHour: m } = k(), s = c === "12" && l >= 12 ? l - 12 : l, f = v(
|
|
8
|
+
(r, e) => {
|
|
9
|
+
var t;
|
|
10
|
+
(t = r.currentTarget) == null || t.blur(), m(e);
|
|
11
|
+
},
|
|
12
|
+
[m]
|
|
13
|
+
);
|
|
14
|
+
if (y(() => {
|
|
15
|
+
if (u.current) {
|
|
16
|
+
const r = n.current, e = s === 0 && c === "12" ? 12 : s;
|
|
17
|
+
if (r) {
|
|
18
|
+
const t = r.querySelector(
|
|
19
|
+
`[data-value="${`0${e}`.slice(-2)}"]`
|
|
20
|
+
);
|
|
21
|
+
t == null || t.scrollIntoView({
|
|
22
|
+
behavior: i,
|
|
23
|
+
block: "center"
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
u.current = !1;
|
|
27
|
+
}
|
|
28
|
+
}, [c, s, i]), c === "12") {
|
|
29
|
+
const r = s === 0 ? 12 : s;
|
|
30
|
+
return /* @__PURE__ */ a(
|
|
31
|
+
"ul",
|
|
32
|
+
{
|
|
33
|
+
ref: n,
|
|
34
|
+
className: o(h()),
|
|
35
|
+
"aria-label": "hours",
|
|
36
|
+
role: "listbox",
|
|
37
|
+
children: Array.from({ length: 12 }, (e, t) => /* @__PURE__ */ a(
|
|
38
|
+
"li",
|
|
39
|
+
{
|
|
40
|
+
className: o(d()),
|
|
41
|
+
"data-value": `0${t + 1}`.slice(-2),
|
|
42
|
+
"data-active": r - 1 === t,
|
|
43
|
+
role: "presentation",
|
|
44
|
+
children: /* @__PURE__ */ a(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
role: "option",
|
|
49
|
+
className: o(b()),
|
|
50
|
+
onClick: (N) => f(N, t + 1),
|
|
51
|
+
children: t + 1
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
t
|
|
56
|
+
))
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ a(
|
|
61
|
+
"ul",
|
|
62
|
+
{
|
|
63
|
+
ref: n,
|
|
64
|
+
className: o(h()),
|
|
65
|
+
"aria-label": "hours",
|
|
66
|
+
role: "listbox",
|
|
67
|
+
children: Array.from({ length: 24 }, (r, e) => /* @__PURE__ */ a(
|
|
68
|
+
"li",
|
|
69
|
+
{
|
|
70
|
+
className: o(d()),
|
|
71
|
+
"data-value": `0${e}`.slice(-2),
|
|
72
|
+
"data-active": l === e,
|
|
73
|
+
role: "presentation",
|
|
74
|
+
children: /* @__PURE__ */ a(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
type: "button",
|
|
78
|
+
role: "option",
|
|
79
|
+
className: o(b()),
|
|
80
|
+
onClick: (t) => f(t, e),
|
|
81
|
+
children: e
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
},
|
|
85
|
+
e
|
|
86
|
+
))
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
H.displayName = "HoursList";
|
|
91
|
+
export {
|
|
92
|
+
H as HoursList
|
|
93
|
+
};
|
|
@@ -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
|
+
};
|