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,28 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
/* empty css */
|
|
1
|
+
import e from "./InputCore.js";
|
|
4
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
5
3
|
import { useControl as n } from "react-use-control";
|
|
6
4
|
//#region src/lib/components/Input/Input.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onChange: (e) => {
|
|
17
|
-
d(e.target.value), c?.(e);
|
|
18
|
-
},
|
|
19
|
-
...l,
|
|
20
|
-
className: e([
|
|
21
|
-
r,
|
|
22
|
-
i[o],
|
|
23
|
-
s
|
|
24
|
-
])
|
|
5
|
+
function r({ value: r, size: i, className: a, onChange: o, ...s }) {
|
|
6
|
+
let [c, l] = n(r, "");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: c,
|
|
9
|
+
onChange: l,
|
|
10
|
+
onNativeChange: o,
|
|
11
|
+
size: i,
|
|
12
|
+
className: a,
|
|
13
|
+
...s
|
|
25
14
|
});
|
|
26
15
|
}
|
|
27
16
|
//#endregion
|
|
28
|
-
export {
|
|
17
|
+
export { r as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
+
//#region src/lib/components/Input/InputCore.tsx
|
|
6
|
+
var n = "haze-InputCore__base", r = {
|
|
7
|
+
sm: "haze-InputCore__sm",
|
|
8
|
+
md: "haze-InputCore__md",
|
|
9
|
+
lg: "haze-InputCore__lg"
|
|
10
|
+
};
|
|
11
|
+
function i({ value: i, onChange: a, onNativeChange: o, size: s = "md", className: c, ...l }) {
|
|
12
|
+
return /* @__PURE__ */ t("input", {
|
|
13
|
+
value: i,
|
|
14
|
+
onChange: (e) => {
|
|
15
|
+
a(e.target.value), o?.(e);
|
|
16
|
+
},
|
|
17
|
+
...l,
|
|
18
|
+
className: e([
|
|
19
|
+
n,
|
|
20
|
+
r[s],
|
|
21
|
+
c
|
|
22
|
+
])
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { i as default };
|
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
|
|
4
|
+
import { useMenuKeyboard as r, useRovingTabindex as i } from "../../utils/menuKeyboard.js";
|
|
3
5
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useControl as
|
|
6
|
-
import {
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { useControl as s } from "react-use-control";
|
|
8
|
+
import { useRef as c } from "react";
|
|
7
9
|
//#region src/lib/components/Menu/Menu.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
var l = "haze-Menu__container", u = "haze-Menu__panel";
|
|
11
|
+
function d({ open: d, trigger: f, className: p, children: m }) {
|
|
12
|
+
let [h, g] = s(d, !1), _ = c(null), v = c(null), y = n({
|
|
13
|
+
open: h,
|
|
14
|
+
setOpen: g,
|
|
15
|
+
triggerRef: _,
|
|
16
|
+
panelRef: v
|
|
17
|
+
});
|
|
18
|
+
i({
|
|
19
|
+
menuRef: v,
|
|
20
|
+
active: h
|
|
21
|
+
});
|
|
22
|
+
let b = r({
|
|
23
|
+
menuRef: v,
|
|
24
|
+
onClose: () => g(!1)
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ o("div", {
|
|
27
|
+
className: e(l),
|
|
28
|
+
children: [/* @__PURE__ */ a("span", {
|
|
29
|
+
ref: _,
|
|
30
|
+
style: y.triggerStyle,
|
|
31
|
+
onPointerDown: y.onTriggerPointerDown,
|
|
32
|
+
onClick: y.onTriggerClick,
|
|
30
33
|
children: f
|
|
34
|
+
}), /* @__PURE__ */ a(t, {
|
|
35
|
+
ref: v,
|
|
36
|
+
behavior: y,
|
|
37
|
+
placement: "bottom",
|
|
38
|
+
role: "menu",
|
|
39
|
+
visualClass: u,
|
|
40
|
+
className: p,
|
|
41
|
+
onKeyDown: b,
|
|
42
|
+
children: m
|
|
31
43
|
})]
|
|
32
44
|
});
|
|
33
45
|
}
|
|
34
46
|
//#endregion
|
|
35
|
-
export {
|
|
47
|
+
export { d as default };
|
|
@@ -10,6 +10,7 @@ function o({ value: o, onChange: s, options: c, disabled: l, className: u }) {
|
|
|
10
10
|
return /* @__PURE__ */ t("div", {
|
|
11
11
|
className: e([i, u]),
|
|
12
12
|
children: t("select", {
|
|
13
|
+
"aria-label": "Model",
|
|
13
14
|
value: d,
|
|
14
15
|
onChange: (e) => {
|
|
15
16
|
f(e.target.value), s?.(e.target.value);
|
|
@@ -1,57 +1,20 @@
|
|
|
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 "./NumberInputCore.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/NumberInput/NumberInput.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return c !== void 0 && t < c ? c : l !== void 0 && t > l ? l : t;
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */ n("div", {
|
|
22
|
-
className: e([i, f]),
|
|
23
|
-
children: [
|
|
24
|
-
/* @__PURE__ */ t("button", {
|
|
25
|
-
type: "button",
|
|
26
|
-
onClick: () => v(y(_ - u)),
|
|
27
|
-
disabled: c !== void 0 && _ <= c,
|
|
28
|
-
"aria-label": "Decrease",
|
|
29
|
-
className: e([o, m[d]]),
|
|
30
|
-
children: "−"
|
|
31
|
-
}),
|
|
32
|
-
/* @__PURE__ */ t("input", {
|
|
33
|
-
type: "number",
|
|
34
|
-
value: _,
|
|
35
|
-
min: c,
|
|
36
|
-
max: l,
|
|
37
|
-
step: u,
|
|
38
|
-
onChange: (e) => {
|
|
39
|
-
let t = Number(e.target.value);
|
|
40
|
-
Number.isNaN(t) || v(y(t)), h?.(e);
|
|
41
|
-
},
|
|
42
|
-
...g,
|
|
43
|
-
className: e([a, p[d]])
|
|
44
|
-
}),
|
|
45
|
-
/* @__PURE__ */ t("button", {
|
|
46
|
-
type: "button",
|
|
47
|
-
onClick: () => v(y(_ + u)),
|
|
48
|
-
disabled: l !== void 0 && _ >= l,
|
|
49
|
-
"aria-label": "Increase",
|
|
50
|
-
className: e([o, m[d]]),
|
|
51
|
-
children: "+"
|
|
52
|
-
})
|
|
53
|
-
]
|
|
5
|
+
function r({ value: r, min: i, max: a, step: o, size: s, className: c, onChange: l, ...u }) {
|
|
6
|
+
let [d, f] = n(r, 0);
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: d,
|
|
9
|
+
onChange: f,
|
|
10
|
+
onNativeChange: l,
|
|
11
|
+
min: i,
|
|
12
|
+
max: a,
|
|
13
|
+
step: o,
|
|
14
|
+
size: s,
|
|
15
|
+
className: c,
|
|
16
|
+
...u
|
|
54
17
|
});
|
|
55
18
|
}
|
|
56
19
|
//#endregion
|
|
57
|
-
export {
|
|
20
|
+
export { r as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
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/NumberInput/NumberInputCore.tsx
|
|
6
|
+
var r = "haze-NumberInputCore__wrapper", i = "haze-NumberInputCore__input", a = "haze-NumberInputCore__stepBtn", o = "haze-NumberInputCore__inputSm", s = "haze-NumberInputCore__inputMd", c = "haze-NumberInputCore__inputLg", l = "haze-NumberInputCore__btnSm", u = "haze-NumberInputCore__btnMd", d = "haze-NumberInputCore__btnLg", f = {
|
|
7
|
+
sm: o,
|
|
8
|
+
md: s,
|
|
9
|
+
lg: c
|
|
10
|
+
}, p = {
|
|
11
|
+
sm: l,
|
|
12
|
+
md: u,
|
|
13
|
+
lg: d
|
|
14
|
+
};
|
|
15
|
+
function m({ value: o, onChange: s, onNativeChange: c, min: l, max: u, step: d = 1, size: m = "md", className: h, ...g }) {
|
|
16
|
+
let _ = (e) => {
|
|
17
|
+
let t = Math.round(e * 1e10) / 1e10;
|
|
18
|
+
return l !== void 0 && t < l ? l : u !== void 0 && t > u ? u : t;
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ n("div", {
|
|
21
|
+
className: e([r, h]),
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ t("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
onClick: () => s(_(o - d)),
|
|
26
|
+
disabled: l !== void 0 && o <= l,
|
|
27
|
+
"aria-label": "Decrease",
|
|
28
|
+
className: e([a, p[m]]),
|
|
29
|
+
children: "−"
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ t("input", {
|
|
32
|
+
type: "number",
|
|
33
|
+
value: o,
|
|
34
|
+
min: l,
|
|
35
|
+
max: u,
|
|
36
|
+
step: d,
|
|
37
|
+
onChange: (e) => {
|
|
38
|
+
let t = Number(e.target.value);
|
|
39
|
+
Number.isNaN(t) || s(_(t)), c?.(e);
|
|
40
|
+
},
|
|
41
|
+
...g,
|
|
42
|
+
className: e([i, f[m]])
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ t("button", {
|
|
45
|
+
type: "button",
|
|
46
|
+
onClick: () => s(_(o + d)),
|
|
47
|
+
disabled: u !== void 0 && o >= u,
|
|
48
|
+
"aria-label": "Increase",
|
|
49
|
+
className: e([a, p[m]]),
|
|
50
|
+
children: "+"
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { m as default };
|
|
@@ -1,51 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
/* empty css */
|
|
1
|
+
import e from "./OTPInputCore.js";
|
|
4
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
5
3
|
import { useControl as n } from "react-use-control";
|
|
6
|
-
import { useCallback as r, useRef as i } from "react";
|
|
7
4
|
//#region src/lib/components/OTPInput/OTPInput.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
s,
|
|
18
|
-
f,
|
|
19
|
-
l
|
|
20
|
-
]), h = r((e, t) => {
|
|
21
|
-
t.key === "Backspace" && !d[e] && e > 0 && p.current[e - 1]?.focus();
|
|
22
|
-
}, [d]), g = r((e) => {
|
|
23
|
-
e.preventDefault();
|
|
24
|
-
let t = e.clipboardData.getData("text").slice(0, s);
|
|
25
|
-
f(t), l?.(t);
|
|
26
|
-
let n = Math.min(t.length, s - 1);
|
|
27
|
-
p.current[n]?.focus();
|
|
28
|
-
}, [
|
|
29
|
-
s,
|
|
30
|
-
f,
|
|
31
|
-
l
|
|
32
|
-
]);
|
|
33
|
-
return /* @__PURE__ */ t("div", {
|
|
34
|
-
className: e([a, u]),
|
|
35
|
-
children: Array.from({ length: s }, (n, r) => /* @__PURE__ */ t("input", {
|
|
36
|
-
ref: (e) => {
|
|
37
|
-
p.current[r] = e;
|
|
38
|
-
},
|
|
39
|
-
type: "text",
|
|
40
|
-
inputMode: "numeric",
|
|
41
|
-
maxLength: 1,
|
|
42
|
-
value: d[r] ?? "",
|
|
43
|
-
onChange: (e) => m(r, e.target.value),
|
|
44
|
-
onKeyDown: (e) => h(r, e),
|
|
45
|
-
onPaste: g,
|
|
46
|
-
className: e([o])
|
|
47
|
-
}, r))
|
|
5
|
+
function r({ length: r, value: i, onChange: a, className: o }) {
|
|
6
|
+
let [s, c] = n(i, "");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
length: r,
|
|
9
|
+
value: s,
|
|
10
|
+
onChange: (e) => {
|
|
11
|
+
c(e), a?.(e);
|
|
12
|
+
},
|
|
13
|
+
className: o
|
|
48
14
|
});
|
|
49
15
|
}
|
|
50
16
|
//#endregion
|
|
51
|
-
export {
|
|
17
|
+
export { r as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
+
import { useCallback as n, useRef as r } from "react";
|
|
6
|
+
//#region src/lib/components/OTPInput/OTPInputCore.tsx
|
|
7
|
+
var i = "haze-OTPInputCore__container", a = "haze-OTPInputCore__cell";
|
|
8
|
+
function o({ length: o = 6, value: s, onChange: c, className: l }) {
|
|
9
|
+
let u = r([]), d = n((e, t) => {
|
|
10
|
+
let n = s.split("");
|
|
11
|
+
n[e] = t.slice(-1), c(n.join("").slice(0, o)), t && e < o - 1 && u.current[e + 1]?.focus();
|
|
12
|
+
}, [
|
|
13
|
+
s,
|
|
14
|
+
o,
|
|
15
|
+
c
|
|
16
|
+
]), f = n((e, t) => {
|
|
17
|
+
t.key === "Backspace" && !s[e] && e > 0 && u.current[e - 1]?.focus();
|
|
18
|
+
}, [s]), p = n((e) => {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
let t = e.clipboardData.getData("text").slice(0, o);
|
|
21
|
+
c(t);
|
|
22
|
+
let n = Math.min(t.length, o - 1);
|
|
23
|
+
u.current[n]?.focus();
|
|
24
|
+
}, [o, c]);
|
|
25
|
+
return /* @__PURE__ */ t("div", {
|
|
26
|
+
className: e([i, l]),
|
|
27
|
+
children: Array.from({ length: o }, (n, r) => /* @__PURE__ */ t("input", {
|
|
28
|
+
ref: (e) => {
|
|
29
|
+
u.current[r] = e;
|
|
30
|
+
},
|
|
31
|
+
type: "text",
|
|
32
|
+
inputMode: "numeric",
|
|
33
|
+
maxLength: 1,
|
|
34
|
+
"aria-label": `Digit ${r + 1} of ${o}`,
|
|
35
|
+
value: s[r] ?? "",
|
|
36
|
+
onChange: (e) => d(r, e.target.value),
|
|
37
|
+
onKeyDown: (e) => f(r, e),
|
|
38
|
+
onPaste: p,
|
|
39
|
+
className: e([a])
|
|
40
|
+
}, r))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { o as default };
|
|
@@ -1,33 +1,18 @@
|
|
|
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";
|
|
6
|
-
import { useState as i } from "react";
|
|
1
|
+
import e from "./PasswordInputCore.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useControl as n } from "react-use-control";
|
|
7
4
|
//#region src/lib/components/PasswordInput/PasswordInput.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
placeholder: u,
|
|
20
|
-
disabled: d,
|
|
21
|
-
className: e([o])
|
|
22
|
-
}), /* @__PURE__ */ t("button", {
|
|
23
|
-
type: "button",
|
|
24
|
-
onClick: () => g(!h),
|
|
25
|
-
tabIndex: -1,
|
|
26
|
-
"aria-label": h ? "Hide password" : "Show password",
|
|
27
|
-
className: e([s]),
|
|
28
|
-
children: h ? "🙈" : "👁"
|
|
29
|
-
})]
|
|
5
|
+
function r({ value: r, onChange: i, placeholder: a, disabled: o, className: s }) {
|
|
6
|
+
let [c, l] = n(r, "");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: c,
|
|
9
|
+
onChange: (e) => {
|
|
10
|
+
l(e), i?.(e);
|
|
11
|
+
},
|
|
12
|
+
placeholder: a,
|
|
13
|
+
disabled: o,
|
|
14
|
+
className: s
|
|
30
15
|
});
|
|
31
16
|
}
|
|
32
17
|
//#endregion
|
|
33
|
-
export {
|
|
18
|
+
export { r as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { useState as r } from "react";
|
|
6
|
+
//#region src/lib/components/PasswordInput/PasswordInputCore.tsx
|
|
7
|
+
var i = "haze-PasswordInputCore__wrapper", a = "haze-PasswordInputCore__input", o = "haze-PasswordInputCore__toggle";
|
|
8
|
+
function s({ value: s, onChange: c, placeholder: l, disabled: u, className: d }) {
|
|
9
|
+
let [f, p] = r(!1);
|
|
10
|
+
return /* @__PURE__ */ n("div", {
|
|
11
|
+
className: e([i, d]),
|
|
12
|
+
children: [/* @__PURE__ */ t("input", {
|
|
13
|
+
type: f ? "text" : "password",
|
|
14
|
+
"aria-label": "Password",
|
|
15
|
+
value: s,
|
|
16
|
+
onChange: (e) => c(e.target.value),
|
|
17
|
+
placeholder: l,
|
|
18
|
+
disabled: u,
|
|
19
|
+
className: e([a])
|
|
20
|
+
}), /* @__PURE__ */ t("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
onClick: () => p(!f),
|
|
23
|
+
tabIndex: -1,
|
|
24
|
+
"aria-label": f ? "Hide password" : "Show password",
|
|
25
|
+
className: e([o]),
|
|
26
|
+
children: f ? "🙈" : "👁"
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { s as default };
|
|
@@ -1,82 +1,39 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { FloatingPanel as e, useFloating as t } from "../../utils/floating.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useControl as
|
|
6
|
-
import {
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { useControl as i } from "react-use-control";
|
|
6
|
+
import { useId as a, useRef as o } from "react";
|
|
7
7
|
//#region src/lib/components/Popover/Popover.tsx
|
|
8
|
-
var s =
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).marginTop) || 0;
|
|
36
|
-
e.style.top = `${n.bottom + r}px`, e.style.left = `${n.left}px`;
|
|
37
|
-
};
|
|
38
|
-
return n(), window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), () => {
|
|
39
|
-
window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n);
|
|
40
|
-
};
|
|
41
|
-
}, [
|
|
42
|
-
T,
|
|
43
|
-
E,
|
|
44
|
-
x
|
|
45
|
-
]), /* @__PURE__ */ n("span", {
|
|
46
|
-
className: u,
|
|
47
|
-
children: [/* @__PURE__ */ t("span", {
|
|
48
|
-
ref: D,
|
|
49
|
-
"aria-expanded": x,
|
|
50
|
-
"aria-controls": C,
|
|
51
|
-
style: E ? { anchorName: w } : void 0,
|
|
52
|
-
onPointerDown: () => {
|
|
53
|
-
x && (A.current = performance.now());
|
|
54
|
-
},
|
|
55
|
-
onClick: () => {
|
|
56
|
-
if (performance.now() - j.current < s) {
|
|
57
|
-
j.current = 0;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
S((e) => !e);
|
|
61
|
-
},
|
|
62
|
-
children: b
|
|
63
|
-
}), /* @__PURE__ */ t("div", {
|
|
64
|
-
id: C,
|
|
65
|
-
ref: O,
|
|
66
|
-
popover: T ? "auto" : void 0,
|
|
67
|
-
style: T && E ? { "--haze-popover-anchor": w } : void 0,
|
|
68
|
-
className: e([
|
|
69
|
-
d,
|
|
70
|
-
T && m,
|
|
71
|
-
T && E && h,
|
|
72
|
-
T && !E && g,
|
|
73
|
-
!T && f,
|
|
74
|
-
!T && !x && p,
|
|
75
|
-
y
|
|
76
|
-
]),
|
|
77
|
-
children: _
|
|
8
|
+
var s = "haze-Popover__container", c = "haze-Popover__panelVisuals";
|
|
9
|
+
function l({ content: l, open: u, className: d, children: f }) {
|
|
10
|
+
let [p, m] = i(u, !1), h = a(), g = o(null), _ = o(null), v = t({
|
|
11
|
+
open: p,
|
|
12
|
+
setOpen: m,
|
|
13
|
+
triggerRef: g,
|
|
14
|
+
panelRef: _
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ r("span", {
|
|
17
|
+
className: s,
|
|
18
|
+
children: [/* @__PURE__ */ n("span", {
|
|
19
|
+
ref: g,
|
|
20
|
+
style: v.triggerStyle,
|
|
21
|
+
role: "button",
|
|
22
|
+
"aria-expanded": p,
|
|
23
|
+
"aria-controls": h,
|
|
24
|
+
onPointerDown: v.onTriggerPointerDown,
|
|
25
|
+
onClick: v.onTriggerClick,
|
|
26
|
+
children: f
|
|
27
|
+
}), /* @__PURE__ */ n(e, {
|
|
28
|
+
ref: _,
|
|
29
|
+
behavior: v,
|
|
30
|
+
placement: "bottom-span",
|
|
31
|
+
id: h,
|
|
32
|
+
visualClass: c,
|
|
33
|
+
className: d,
|
|
34
|
+
children: l
|
|
78
35
|
})]
|
|
79
36
|
});
|
|
80
37
|
}
|
|
81
38
|
//#endregion
|
|
82
|
-
export {
|
|
39
|
+
export { l as default };
|
|
@@ -36,6 +36,7 @@ function m({ value: m = 0, variant: h = "bar", size: g = "md", color: _ = "prima
|
|
|
36
36
|
let r = p[g], i = f[g], a = 2 * Math.PI * r, o = a - y / 100 * a;
|
|
37
37
|
return /* @__PURE__ */ t("div", {
|
|
38
38
|
role: "progressbar",
|
|
39
|
+
"aria-label": "Progress",
|
|
39
40
|
"aria-valuemin": 0,
|
|
40
41
|
"aria-valuemax": 100,
|
|
41
42
|
"aria-valuenow": y,
|
|
@@ -66,6 +67,7 @@ function m({ value: m = 0, variant: h = "bar", size: g = "md", color: _ = "prima
|
|
|
66
67
|
}
|
|
67
68
|
return /* @__PURE__ */ t("div", {
|
|
68
69
|
role: "progressbar",
|
|
70
|
+
"aria-label": "Progress",
|
|
69
71
|
"aria-valuemin": 0,
|
|
70
72
|
"aria-valuemax": 100,
|
|
71
73
|
"aria-valuenow": y,
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
/* empty css */
|
|
5
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
-
import { useControl as r } from "react-use-control";
|
|
7
|
-
import { useId as i } from "react";
|
|
1
|
+
import e from "./RadioGroupCore.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/Radio/RadioGroup.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
value: u,
|
|
18
|
-
setValue: d
|
|
19
|
-
},
|
|
20
|
-
children: l
|
|
21
|
-
})
|
|
5
|
+
function r({ value: r, name: i, className: a, children: o }) {
|
|
6
|
+
let [s, c] = n(r, "");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: s,
|
|
9
|
+
onChange: c,
|
|
10
|
+
name: i,
|
|
11
|
+
className: a,
|
|
12
|
+
children: o
|
|
22
13
|
});
|
|
23
14
|
}
|
|
24
15
|
//#endregion
|
|
25
|
-
export {
|
|
16
|
+
export { r as default };
|