haze-ui 1.12.1 → 1.13.0
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/README.md +99 -31
- package/dist/components/Checkbox/Checkbox.js +13 -20
- package/dist/components/Checkbox/CheckboxCore.js +23 -0
- package/dist/components/ColorPicker/ColorPicker.js +13 -42
- package/dist/components/ColorPicker/ColorPickerCore.js +38 -0
- package/dist/components/Combobox/Combobox.js +45 -34
- package/dist/components/Command/Command.js +72 -37
- package/dist/components/ContextMenu/ContextMenu.js +19 -17
- package/dist/components/ContextMenu/ContextMenuContent.js +24 -12
- package/dist/components/ContextMenu/ContextMenuItem.js +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +17 -35
- package/dist/components/DateRangePicker/DateRangePickerCore.js +33 -0
- package/dist/components/Datepicker/Calendar.js +58 -44
- package/dist/components/Datepicker/Datepicker.js +15 -39
- package/dist/components/Datepicker/DatepickerCore.js +50 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +20 -20
- package/dist/components/DropdownMenu/DropdownMenuContent.js +38 -45
- package/dist/components/DropdownMenu/DropdownMenuTrigger.js +9 -7
- package/dist/components/InlineEdit/InlineEdit.js +1 -0
- package/dist/components/Input/Input.js +11 -22
- package/dist/components/Input/InputCore.js +26 -0
- package/dist/components/Menu/Menu.js +38 -26
- package/dist/components/Menu/MenuItem.js +1 -0
- package/dist/components/ModelPicker/ModelPicker.js +1 -0
- package/dist/components/NumberInput/NumberInput.js +16 -53
- package/dist/components/NumberInput/NumberInputCore.js +56 -0
- package/dist/components/OTPInput/OTPInput.js +11 -45
- package/dist/components/OTPInput/OTPInputCore.js +44 -0
- package/dist/components/PasswordInput/PasswordInput.js +14 -29
- package/dist/components/PasswordInput/PasswordInputCore.js +31 -0
- package/dist/components/Popover/Popover.js +32 -75
- package/dist/components/Progress/Progress.js +2 -0
- package/dist/components/Radio/RadioGroup.js +12 -21
- package/dist/components/Radio/RadioGroupCore.js +24 -0
- package/dist/components/Rating/Rating.js +14 -46
- package/dist/components/Rating/RatingCore.js +48 -0
- package/dist/components/Segmented/Segmented.js +12 -37
- package/dist/components/Segmented/SegmentedCore.js +39 -0
- package/dist/components/Select/Select.js +12 -23
- package/dist/components/Select/SelectCore.js +27 -0
- package/dist/components/Slider/Slider.js +10 -15
- package/dist/components/Slider/SliderCore.js +19 -0
- package/dist/components/Switch/Switch.js +11 -38
- package/dist/components/Switch/SwitchCore.js +42 -0
- package/dist/components/TagInput/TagInput.js +18 -72
- package/dist/components/TagInput/TagInputCore.js +68 -0
- package/dist/components/Textarea/Textarea.js +11 -22
- package/dist/components/Textarea/TextareaCore.js +26 -0
- package/dist/components/TimePicker/TimePicker.js +10 -15
- package/dist/components/TimePicker/TimePickerCore.js +18 -0
- package/dist/components/Tooltip/Tooltip.js +50 -24
- package/dist/components/Tree/TreeItem.js +44 -41
- package/dist/components/Upload/Upload.js +1 -0
- package/dist/css/checkbox.css +1 -1
- package/dist/css/color-picker.css +1 -1
- package/dist/css/combobox.css +2 -1
- package/dist/css/command.css +1 -1
- package/dist/css/context-menu.css +1 -0
- package/dist/css/date-range-picker.css +1 -1
- package/dist/css/datepicker.css +3 -2
- package/dist/css/dropdown-menu.css +2 -1
- package/dist/css/input.css +1 -1
- package/dist/css/menu.css +2 -1
- package/dist/css/number-input.css +1 -1
- package/dist/css/otp-input.css +1 -1
- package/dist/css/password-input.css +1 -1
- package/dist/css/popover.css +2 -1
- package/dist/css/radio.css +1 -1
- package/dist/css/rating.css +1 -1
- package/dist/css/segmented.css +1 -1
- package/dist/css/select.css +1 -1
- package/dist/css/slider.css +1 -1
- package/dist/css/switch.css +1 -1
- package/dist/css/tag-input.css +1 -1
- package/dist/css/textarea.css +1 -1
- package/dist/css/time-picker.css +1 -1
- package/dist/css/tooltip.css +2 -1
- package/dist/form/FormItem.js +41 -33
- package/dist/haze-ui.css +31 -24
- package/dist/index.js +138 -122
- package/dist/types/components/Checkbox/CheckboxCore.d.ts +12 -0
- package/dist/types/components/Checkbox/index.d.ts +2 -0
- package/dist/types/components/ColorPicker/ColorPickerCore.d.ts +8 -0
- package/dist/types/components/ColorPicker/index.d.ts +2 -0
- package/dist/types/components/ContextMenu/ContextMenuContent.d.ts +1 -1
- package/dist/types/components/ContextMenu/ContextMenuContext.d.ts +5 -1
- package/dist/types/components/DateRangePicker/DateRangePickerCore.d.ts +11 -0
- package/dist/types/components/DateRangePicker/index.d.ts +2 -0
- package/dist/types/components/Datepicker/DatepickerCore.d.ts +12 -0
- package/dist/types/components/Datepicker/index.d.ts +2 -0
- package/dist/types/components/DropdownMenu/DropdownMenuContent.d.ts +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuContext.d.ts +3 -0
- package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
- package/dist/types/components/Input/InputCore.d.ts +13 -0
- package/dist/types/components/Input/index.d.ts +2 -0
- package/dist/types/components/NumberInput/NumberInputCore.d.ts +15 -0
- package/dist/types/components/NumberInput/index.d.ts +2 -0
- package/dist/types/components/OTPInput/OTPInputCore.d.ts +8 -0
- package/dist/types/components/OTPInput/index.d.ts +2 -0
- package/dist/types/components/PasswordInput/PasswordInputCore.d.ts +9 -0
- package/dist/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/types/components/Radio/RadioContext.d.ts +1 -2
- package/dist/types/components/Radio/RadioGroupCore.d.ts +10 -0
- package/dist/types/components/Radio/index.d.ts +2 -0
- package/dist/types/components/Rating/RatingCore.d.ts +9 -0
- package/dist/types/components/Rating/index.d.ts +2 -0
- package/dist/types/components/Segmented/Segmented.d.ts +1 -6
- package/dist/types/components/Segmented/SegmentedCore.d.ts +15 -0
- package/dist/types/components/Segmented/index.d.ts +2 -0
- package/dist/types/components/Select/SelectCore.d.ts +13 -0
- package/dist/types/components/Select/index.d.ts +2 -0
- package/dist/types/components/Slider/SliderCore.d.ts +11 -0
- package/dist/types/components/Slider/index.d.ts +2 -0
- package/dist/types/components/Switch/Switch.d.ts +1 -1
- package/dist/types/components/Switch/SwitchCore.d.ts +12 -0
- package/dist/types/components/Switch/index.d.ts +2 -0
- package/dist/types/components/TagInput/TagInputCore.d.ts +20 -0
- package/dist/types/components/TagInput/index.d.ts +2 -0
- package/dist/types/components/Textarea/TextareaCore.d.ts +12 -0
- package/dist/types/components/Textarea/index.d.ts +2 -0
- package/dist/types/components/TimePicker/TimePickerCore.d.ts +9 -0
- package/dist/types/components/TimePicker/index.d.ts +2 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +5 -1
- package/dist/types/form/FormItem.d.ts +86 -19
- package/dist/types/form/index.d.ts +2 -3
- package/dist/types/index.d.ts +36 -36
- package/dist/types/utils/floating.d.ts +99 -0
- package/dist/types/utils/menuKeyboard.d.ts +43 -0
- package/dist/utils/floating.js +181 -0
- package/dist/utils/menuKeyboard.js +88 -0
- package/package.json +45 -19
- package/dist/components/DropdownMenu/useMenuKeyboard.js +0 -52
- package/dist/form/useFormControl.js +0 -54
- package/dist/types/components/DropdownMenu/useMenuKeyboard.d.ts +0 -19
- package/dist/types/form/useFormControl.d.ts +0 -35
- package/dist/types/hooks/index.d.ts +0 -1
- package/dist/types/utils/index.d.ts +0 -1
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FloatingPanel as e } from "../../utils/floating.js";
|
|
3
|
+
import { useMenuKeyboard as t, useRovingTabindex as n } from "../../utils/menuKeyboard.js";
|
|
4
|
+
import { useContextMenuContext as r } from "./ContextMenuContext.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { jsx as
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
7
|
//#region src/lib/components/ContextMenu/ContextMenuContent.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let { open:
|
|
10
|
-
|
|
8
|
+
var a = "haze-ContextMenuContent__content";
|
|
9
|
+
function o({ children: o, className: s }) {
|
|
10
|
+
let { open: c, setOpen: l, x: u, y: d, contentRef: f, floating: p } = r(), m = t({
|
|
11
|
+
menuRef: f,
|
|
12
|
+
onClose: () => l(!1)
|
|
13
|
+
});
|
|
14
|
+
return n({
|
|
15
|
+
menuRef: f,
|
|
16
|
+
active: c
|
|
17
|
+
}), c ? /* @__PURE__ */ i(e, {
|
|
18
|
+
ref: f,
|
|
19
|
+
behavior: p,
|
|
20
|
+
role: "menu",
|
|
21
|
+
visualClass: a,
|
|
22
|
+
className: s,
|
|
11
23
|
style: {
|
|
12
|
-
left:
|
|
13
|
-
top:
|
|
24
|
+
left: u,
|
|
25
|
+
top: d
|
|
14
26
|
},
|
|
15
|
-
|
|
16
|
-
children:
|
|
27
|
+
onKeyDown: m,
|
|
28
|
+
children: o
|
|
17
29
|
}) : null;
|
|
18
30
|
}
|
|
19
31
|
//#endregion
|
|
20
|
-
export {
|
|
32
|
+
export { o as default };
|
|
@@ -1,39 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
import { useControl as r } from "react-use-control";
|
|
1
|
+
import e from "./DateRangePickerCore.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useControl as n } from "react-use-control";
|
|
6
4
|
//#region src/lib/components/DateRangePicker/DateRangePicker.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
className: e([a])
|
|
21
|
-
}),
|
|
22
|
-
/* @__PURE__ */ t("span", {
|
|
23
|
-
className: e([o]),
|
|
24
|
-
children: d
|
|
25
|
-
}),
|
|
26
|
-
/* @__PURE__ */ t("input", {
|
|
27
|
-
type: "date",
|
|
28
|
-
value: h,
|
|
29
|
-
onChange: (e) => {
|
|
30
|
-
let t = e.target.value;
|
|
31
|
-
g(t), u?.(t);
|
|
32
|
-
},
|
|
33
|
-
className: e([a])
|
|
34
|
-
})
|
|
35
|
-
]
|
|
5
|
+
function r({ startDate: r, endDate: i, onStartChange: a, onEndChange: o, separator: s, className: c }) {
|
|
6
|
+
let [l, u] = n(r, ""), [d, f] = n(i, "");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
startDate: l,
|
|
9
|
+
endDate: d,
|
|
10
|
+
onStartChange: (e) => {
|
|
11
|
+
u(e), a?.(e);
|
|
12
|
+
},
|
|
13
|
+
onEndChange: (e) => {
|
|
14
|
+
f(e), o?.(e);
|
|
15
|
+
},
|
|
16
|
+
separator: s,
|
|
17
|
+
className: c
|
|
36
18
|
});
|
|
37
19
|
}
|
|
38
20
|
//#endregion
|
|
39
|
-
export {
|
|
21
|
+
export { r as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/lib/components/DateRangePicker/DateRangePickerCore.tsx
|
|
6
|
+
var r = "haze-DateRangePickerCore__container", i = "haze-DateRangePickerCore__input", a = "haze-DateRangePickerCore__sep";
|
|
7
|
+
function o({ startDate: o, endDate: s, onStartChange: c, onEndChange: l, separator: u = "–", className: d }) {
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: e([r, d]),
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ t("input", {
|
|
12
|
+
type: "date",
|
|
13
|
+
"aria-label": "Start date",
|
|
14
|
+
value: o,
|
|
15
|
+
onChange: (e) => c(e.target.value),
|
|
16
|
+
className: e([i])
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ t("span", {
|
|
19
|
+
className: e([a]),
|
|
20
|
+
children: u
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ t("input", {
|
|
23
|
+
type: "date",
|
|
24
|
+
"aria-label": "End date",
|
|
25
|
+
value: s,
|
|
26
|
+
onChange: (e) => l(e.target.value),
|
|
27
|
+
className: e([i])
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { o as default };
|
|
@@ -4,7 +4,7 @@ import { classnames as e } from "../../utils/classnames.js";
|
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
5
|
import { useState as r } from "react";
|
|
6
6
|
//#region src/lib/components/Datepicker/Calendar.tsx
|
|
7
|
-
var i = "haze-Calendar__calendarWrapper", a = "haze-Calendar__header", o = "haze-Calendar__headerBtn", s = "haze-Calendar__headerTitle", c = "haze-Calendar__grid", l = "haze-
|
|
7
|
+
var i = "haze-Calendar__calendarWrapper", a = "haze-Calendar__header", o = "haze-Calendar__headerBtn", s = "haze-Calendar__headerTitle", c = "haze-Calendar__grid", l = "haze-Calendar__rowContents", u = "haze-Calendar__cellContents", d = "haze-Calendar__weekday", f = "haze-Calendar__dayBtn", p = "haze-Calendar__daySelected", m = "haze-Calendar__dayOutside", h = [
|
|
8
8
|
"Su",
|
|
9
9
|
"Mo",
|
|
10
10
|
"Tu",
|
|
@@ -13,94 +13,108 @@ var i = "haze-Calendar__calendarWrapper", a = "haze-Calendar__header", o = "haze
|
|
|
13
13
|
"Fr",
|
|
14
14
|
"Sa"
|
|
15
15
|
];
|
|
16
|
-
function
|
|
16
|
+
function g(e, t) {
|
|
17
17
|
return new Date(e, t + 1, 0).getDate();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function _(e, t, n) {
|
|
20
20
|
return `${e}-${String(t + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
for (let e =
|
|
29
|
-
let t =
|
|
30
|
-
|
|
31
|
-
day:
|
|
22
|
+
function v({ value: v, min: y, max: b, onSelect: x }) {
|
|
23
|
+
let S = v ? new Date(v) : /* @__PURE__ */ new Date(), [C, w] = r(S.getFullYear()), [T, E] = r(S.getMonth()), D = g(C, T), O = new Date(C, T, 1).getDay(), k = g(C, T - 1), A = () => {
|
|
24
|
+
E((e) => e === 0 ? (w((e) => e - 1), 11) : e - 1);
|
|
25
|
+
}, j = () => {
|
|
26
|
+
E((e) => e === 11 ? (w((e) => e + 1), 0) : e + 1);
|
|
27
|
+
}, M = (e) => !!(y && e < y || b && e > b), N = [];
|
|
28
|
+
for (let e = O - 1; e >= 0; e--) {
|
|
29
|
+
let t = T === 0 ? 11 : T - 1, n = T === 0 ? C - 1 : C;
|
|
30
|
+
N.push({
|
|
31
|
+
day: k - e,
|
|
32
32
|
month: t,
|
|
33
33
|
year: n,
|
|
34
34
|
outside: !0
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
for (let e = 1; e <=
|
|
37
|
+
for (let e = 1; e <= D; e++) N.push({
|
|
38
38
|
day: e,
|
|
39
|
-
month:
|
|
40
|
-
year:
|
|
39
|
+
month: T,
|
|
40
|
+
year: C,
|
|
41
41
|
outside: !1
|
|
42
42
|
});
|
|
43
|
-
let
|
|
44
|
-
if (
|
|
45
|
-
let t =
|
|
46
|
-
|
|
43
|
+
let P = 7 - N.length % 7;
|
|
44
|
+
if (P < 7) for (let e = 1; e <= P; e++) {
|
|
45
|
+
let t = T === 11 ? 0 : T + 1, n = T === 11 ? C + 1 : C;
|
|
46
|
+
N.push({
|
|
47
47
|
day: e,
|
|
48
48
|
month: t,
|
|
49
49
|
year: n,
|
|
50
50
|
outside: !0
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
let
|
|
53
|
+
let F = new Date(C, T).toLocaleString("default", {
|
|
54
54
|
month: "long",
|
|
55
55
|
year: "numeric"
|
|
56
|
-
});
|
|
56
|
+
}), I = [];
|
|
57
|
+
for (let e = 0; e < N.length; e += 7) I.push(N.slice(e, e + 7));
|
|
57
58
|
return /* @__PURE__ */ n("div", {
|
|
58
|
-
role: "grid",
|
|
59
|
-
"aria-label": N,
|
|
60
59
|
className: e([i]),
|
|
61
60
|
children: [/* @__PURE__ */ n("div", {
|
|
62
61
|
className: e([a]),
|
|
63
62
|
children: [
|
|
64
63
|
/* @__PURE__ */ t("button", {
|
|
65
64
|
type: "button",
|
|
66
|
-
onClick:
|
|
65
|
+
onClick: A,
|
|
67
66
|
"aria-label": "Previous month",
|
|
68
67
|
className: e([o]),
|
|
69
68
|
children: "‹"
|
|
70
69
|
}),
|
|
71
70
|
/* @__PURE__ */ t("span", {
|
|
72
71
|
className: e([s]),
|
|
73
|
-
children:
|
|
72
|
+
children: F
|
|
74
73
|
}),
|
|
75
74
|
/* @__PURE__ */ t("button", {
|
|
76
75
|
type: "button",
|
|
77
|
-
onClick:
|
|
76
|
+
onClick: j,
|
|
78
77
|
"aria-label": "Next month",
|
|
79
78
|
className: e([o]),
|
|
80
79
|
children: "›"
|
|
81
80
|
})
|
|
82
81
|
]
|
|
83
82
|
}), /* @__PURE__ */ n("div", {
|
|
83
|
+
role: "grid",
|
|
84
|
+
"aria-label": F,
|
|
84
85
|
className: e([c]),
|
|
85
|
-
children: [
|
|
86
|
+
children: [/* @__PURE__ */ t("div", {
|
|
87
|
+
role: "row",
|
|
86
88
|
className: e([l]),
|
|
87
|
-
children: n
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
children: h.map((n) => /* @__PURE__ */ t("span", {
|
|
90
|
+
role: "columnheader",
|
|
91
|
+
className: e([d]),
|
|
92
|
+
children: n
|
|
93
|
+
}, n))
|
|
94
|
+
}), I.map((n, r) => /* @__PURE__ */ t("div", {
|
|
95
|
+
role: "row",
|
|
96
|
+
className: e([l]),
|
|
97
|
+
children: n.map((n) => {
|
|
98
|
+
let r = _(n.year, n.month, n.day);
|
|
99
|
+
return /* @__PURE__ */ t("span", {
|
|
100
|
+
role: "gridcell",
|
|
101
|
+
className: e([u]),
|
|
102
|
+
children: /* @__PURE__ */ t("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
disabled: M(r),
|
|
105
|
+
onClick: () => x(r),
|
|
106
|
+
className: e([
|
|
107
|
+
f,
|
|
108
|
+
r === v && p,
|
|
109
|
+
n.outside && m
|
|
110
|
+
]),
|
|
111
|
+
children: n.day
|
|
112
|
+
})
|
|
113
|
+
}, r);
|
|
114
|
+
})
|
|
115
|
+
}, r))]
|
|
102
116
|
})]
|
|
103
117
|
});
|
|
104
118
|
}
|
|
105
119
|
//#endregion
|
|
106
|
-
export {
|
|
120
|
+
export { v as default };
|
|
@@ -1,43 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
/* empty css */
|
|
5
|
-
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
-
import { useControl as i } from "react-use-control";
|
|
7
|
-
import { useEffect as a, useRef as o } from "react";
|
|
1
|
+
import e from "./DatepickerCore.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useControl as n } from "react-use-control";
|
|
8
4
|
//#region src/lib/components/Datepicker/Datepicker.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
className: e([s, g]),
|
|
21
|
-
children: [/* @__PURE__ */ n("input", {
|
|
22
|
-
readOnly: !0,
|
|
23
|
-
className: c,
|
|
24
|
-
value: _,
|
|
25
|
-
placeholder: h,
|
|
26
|
-
onClick: () => b((e) => !e),
|
|
27
|
-
"aria-haspopup": "dialog",
|
|
28
|
-
"aria-expanded": y
|
|
29
|
-
}), /* @__PURE__ */ n("div", {
|
|
30
|
-
className: e([l, !y && u]),
|
|
31
|
-
children: /* @__PURE__ */ n(t, {
|
|
32
|
-
value: _,
|
|
33
|
-
min: p,
|
|
34
|
-
max: m,
|
|
35
|
-
onSelect: (e) => {
|
|
36
|
-
v(e), b(!1);
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
})]
|
|
5
|
+
function r({ value: r, open: i, min: a, max: o, placeholder: s, className: c }) {
|
|
6
|
+
let [l, u] = n(r, ""), [d, f] = n(i, !1);
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: l,
|
|
9
|
+
onChange: u,
|
|
10
|
+
open: d,
|
|
11
|
+
onOpenChange: f,
|
|
12
|
+
min: a,
|
|
13
|
+
max: o,
|
|
14
|
+
placeholder: s,
|
|
15
|
+
className: c
|
|
40
16
|
});
|
|
41
17
|
}
|
|
42
18
|
//#endregion
|
|
43
|
-
export {
|
|
19
|
+
export { r as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
|
|
4
|
+
import r from "./Calendar.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback as o, useId as s, useRef as c } from "react";
|
|
8
|
+
//#region src/lib/components/Datepicker/DatepickerCore.tsx
|
|
9
|
+
var l = "haze-DatepickerCore__wrapper", u = "haze-DatepickerCore__input", d = "haze-DatepickerCore__dropdown";
|
|
10
|
+
function f({ value: f, onChange: p, open: m, onOpenChange: h, min: g, max: _, placeholder: v = "Select date", className: y }) {
|
|
11
|
+
let b = c(null), x = c(null), S = s(), C = o((e) => h(typeof e == "function" ? e(m) : e), [h, m]), w = n({
|
|
12
|
+
open: m,
|
|
13
|
+
setOpen: C,
|
|
14
|
+
triggerRef: b,
|
|
15
|
+
panelRef: x
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ a("div", {
|
|
18
|
+
className: e([l, y]),
|
|
19
|
+
children: [/* @__PURE__ */ i("input", {
|
|
20
|
+
ref: b,
|
|
21
|
+
readOnly: !0,
|
|
22
|
+
style: w.triggerStyle,
|
|
23
|
+
className: u,
|
|
24
|
+
value: f,
|
|
25
|
+
placeholder: v,
|
|
26
|
+
role: "combobox",
|
|
27
|
+
"aria-haspopup": "dialog",
|
|
28
|
+
"aria-expanded": m,
|
|
29
|
+
"aria-controls": S,
|
|
30
|
+
onPointerDown: w.onTriggerPointerDown,
|
|
31
|
+
onClick: w.onTriggerClick
|
|
32
|
+
}), /* @__PURE__ */ i(t, {
|
|
33
|
+
ref: x,
|
|
34
|
+
behavior: w,
|
|
35
|
+
placement: "bottom",
|
|
36
|
+
visualClass: d,
|
|
37
|
+
id: S,
|
|
38
|
+
children: /* @__PURE__ */ i(r, {
|
|
39
|
+
value: f,
|
|
40
|
+
min: g,
|
|
41
|
+
max: _,
|
|
42
|
+
onSelect: (e) => {
|
|
43
|
+
p(e), h(!1);
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { f as default };
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useFloating as t } from "../../utils/floating.js";
|
|
4
|
+
import { DropdownMenuProvider as n } from "./DropdownMenuContext.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { useControl as
|
|
7
|
-
import { useCallback as
|
|
6
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
+
import { useControl as i } from "react-use-control";
|
|
8
|
+
import { useCallback as a, useId as o, useRef as s } from "react";
|
|
8
9
|
//#region src/lib/components/DropdownMenu/DropdownMenu.tsx
|
|
9
10
|
var c = "haze-DropdownMenu__wrapper";
|
|
10
11
|
function l({ open: l, onOpenChange: u, children: d, className: f }) {
|
|
11
|
-
let [p, m] =
|
|
12
|
+
let [p, m] = i(l, !1), h = s(null), g = s(null), _ = o(), v = s(null), y = a((e) => {
|
|
12
13
|
let t = typeof e == "function" ? e(p) : e;
|
|
13
14
|
m(t), u?.(t);
|
|
14
15
|
}, [
|
|
15
16
|
p,
|
|
16
17
|
m,
|
|
17
18
|
u
|
|
18
|
-
])
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, [p, b]), /* @__PURE__ */ n(t, {
|
|
19
|
+
]), b = t({
|
|
20
|
+
open: p,
|
|
21
|
+
setOpen: y,
|
|
22
|
+
triggerRef: h,
|
|
23
|
+
panelRef: g
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ r(n, {
|
|
26
26
|
value: {
|
|
27
27
|
open: p,
|
|
28
|
-
setOpen:
|
|
29
|
-
triggerRef:
|
|
30
|
-
contentRef:
|
|
31
|
-
contentId:
|
|
32
|
-
focusRequestRef:
|
|
28
|
+
setOpen: y,
|
|
29
|
+
triggerRef: h,
|
|
30
|
+
contentRef: g,
|
|
31
|
+
contentId: _,
|
|
32
|
+
focusRequestRef: v,
|
|
33
|
+
floating: b
|
|
33
34
|
},
|
|
34
|
-
children:
|
|
35
|
-
ref: h,
|
|
35
|
+
children: r("div", {
|
|
36
36
|
className: e([c, f]),
|
|
37
37
|
children: d
|
|
38
38
|
})
|
|
@@ -1,55 +1,48 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { FloatingPanel as e } from "../../utils/floating.js";
|
|
3
|
+
import { getEnabledMenuItems as t, useMenuKeyboard as n, useRovingTabindex as r } from "../../utils/menuKeyboard.js";
|
|
4
|
+
import { useDropdownMenuContext as i } from "./DropdownMenuContext.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { useCallback as
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback as o, useEffect as s } from "react";
|
|
8
8
|
//#region src/lib/components/DropdownMenu/DropdownMenuContent.tsx
|
|
9
|
-
var
|
|
10
|
-
start: "
|
|
11
|
-
center: "
|
|
12
|
-
end: "
|
|
9
|
+
var c = "haze-DropdownMenuContent__content", l = {
|
|
10
|
+
start: "bottom",
|
|
11
|
+
center: "bottom-center",
|
|
12
|
+
end: "bottom-end"
|
|
13
13
|
};
|
|
14
|
-
function
|
|
15
|
-
let { open:
|
|
16
|
-
|
|
17
|
-
}, [
|
|
18
|
-
menuRef:
|
|
19
|
-
onClose:
|
|
14
|
+
function u({ children: u, align: d = "start", className: f }) {
|
|
15
|
+
let { open: p, setOpen: m, triggerRef: h, contentRef: g, contentId: _, focusRequestRef: v, floating: y } = i(), b = o(() => {
|
|
16
|
+
m(!1), h.current?.focus();
|
|
17
|
+
}, [m, h]), x = n({
|
|
18
|
+
menuRef: g,
|
|
19
|
+
onClose: b
|
|
20
20
|
});
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_.current = null, r && (r === "first" ? t[0] : t[t.length - 1])?.focus();
|
|
31
|
-
let i = (t) => {
|
|
32
|
-
n(e).forEach((e) => {
|
|
33
|
-
e.tabIndex = e === t.target ? 0 : -1;
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
|
|
21
|
+
return r({
|
|
22
|
+
menuRef: g,
|
|
23
|
+
active: p
|
|
24
|
+
}), s(() => {
|
|
25
|
+
if (!p || !y.shown) return;
|
|
26
|
+
let e = v.current;
|
|
27
|
+
if (v.current = null, !e) return;
|
|
28
|
+
let n = t(g.current);
|
|
29
|
+
(e === "first" ? n[0] : n[n.length - 1])?.focus();
|
|
37
30
|
}, [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
p,
|
|
32
|
+
y.shown,
|
|
33
|
+
g,
|
|
34
|
+
v
|
|
35
|
+
]), p ? /* @__PURE__ */ a(e, {
|
|
36
|
+
ref: g,
|
|
37
|
+
behavior: y,
|
|
38
|
+
placement: l[d],
|
|
39
|
+
id: _,
|
|
44
40
|
role: "menu",
|
|
45
|
-
|
|
46
|
-
className:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
d
|
|
50
|
-
]),
|
|
51
|
-
children: l
|
|
41
|
+
visualClass: c,
|
|
42
|
+
className: f,
|
|
43
|
+
onKeyDown: x,
|
|
44
|
+
children: u
|
|
52
45
|
}) : null;
|
|
53
46
|
}
|
|
54
47
|
//#endregion
|
|
55
|
-
export {
|
|
48
|
+
export { u as default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { getEnabledMenuItems as t } from "../../utils/menuKeyboard.js";
|
|
4
|
+
import { useDropdownMenuContext as n } from "./DropdownMenuContext.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as r } from "react/jsx-runtime";
|
|
7
7
|
//#region src/lib/components/DropdownMenu/DropdownMenuTrigger.tsx
|
|
8
8
|
var i = "haze-DropdownMenuTrigger__trigger";
|
|
9
9
|
function a({ children: a, className: o }) {
|
|
10
|
-
let { open: s, setOpen: c, triggerRef: l, contentRef: u, contentId: d, focusRequestRef: f } =
|
|
10
|
+
let { open: s, setOpen: c, triggerRef: l, contentRef: u, contentId: d, focusRequestRef: f, floating: p } = n(), m = (e) => {
|
|
11
11
|
if (s) {
|
|
12
|
-
let
|
|
13
|
-
(e === "first" ?
|
|
12
|
+
let n = t(u.current);
|
|
13
|
+
(e === "first" ? n[0] : n[n.length - 1])?.focus();
|
|
14
14
|
} else f.current = e, c(!0);
|
|
15
15
|
};
|
|
16
16
|
return /* @__PURE__ */ r("button", {
|
|
@@ -19,9 +19,11 @@ function a({ children: a, className: o }) {
|
|
|
19
19
|
"aria-haspopup": "menu",
|
|
20
20
|
"aria-expanded": s,
|
|
21
21
|
"aria-controls": s ? d : void 0,
|
|
22
|
-
|
|
22
|
+
style: p.triggerStyle,
|
|
23
|
+
onPointerDown: p.onTriggerPointerDown,
|
|
24
|
+
onClick: p.onTriggerClick,
|
|
23
25
|
onKeyDown: (e) => {
|
|
24
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
26
|
+
e.key === "ArrowDown" ? (e.preventDefault(), m("first")) : e.key === "ArrowUp" && (e.preventDefault(), m("last"));
|
|
25
27
|
},
|
|
26
28
|
className: e([i, o]),
|
|
27
29
|
children: a
|