haze-ui 1.12.0 → 1.12.2
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 +36 -24
- 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 +36 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +17 -35
- package/dist/components/DateRangePicker/DateRangePickerCore.js +31 -0
- package/dist/components/Datepicker/Datepicker.js +15 -39
- package/dist/components/Datepicker/DatepickerCore.js +42 -0
- package/dist/components/Input/Input.js +11 -22
- package/dist/components/Input/InputCore.js +26 -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 +43 -0
- package/dist/components/PasswordInput/PasswordInput.js +14 -29
- package/dist/components/PasswordInput/PasswordInputCore.js +30 -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/css/checkbox.css +1 -1
- package/dist/css/color-picker.css +1 -1
- package/dist/css/date-range-picker.css +1 -1
- package/dist/css/datepicker.css +1 -1
- package/dist/css/input.css +1 -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/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/form/FormItem.js +32 -32
- package/dist/haze-ui.css +17 -17
- 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/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/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/form/FormItem.d.ts +23 -12
- package/dist/types/form/index.d.ts +1 -2
- package/dist/types/index.d.ts +35 -35
- package/package.json +15 -15
- package/dist/form/useFormControl.js +0 -54
- package/dist/types/form/useFormControl.d.ts +0 -32
|
@@ -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,43 @@
|
|
|
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
|
+
value: s[r] ?? "",
|
|
35
|
+
onChange: (e) => d(r, e.target.value),
|
|
36
|
+
onKeyDown: (e) => f(r, e),
|
|
37
|
+
onPaste: p,
|
|
38
|
+
className: e([a])
|
|
39
|
+
}, r))
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
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,30 @@
|
|
|
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
|
+
value: s,
|
|
15
|
+
onChange: (e) => c(e.target.value),
|
|
16
|
+
placeholder: l,
|
|
17
|
+
disabled: u,
|
|
18
|
+
className: e([a])
|
|
19
|
+
}), /* @__PURE__ */ t("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
onClick: () => p(!f),
|
|
22
|
+
tabIndex: -1,
|
|
23
|
+
"aria-label": f ? "Hide password" : "Show password",
|
|
24
|
+
className: e([o]),
|
|
25
|
+
children: f ? "🙈" : "👁"
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { s as default };
|
|
@@ -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 };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { RadioProvider as t } from "./RadioContext.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
import { useId as r } from "react";
|
|
7
|
+
//#region src/lib/components/Radio/RadioGroupCore.tsx
|
|
8
|
+
var i = "haze-RadioGroupCore__base";
|
|
9
|
+
function a({ value: a, onChange: o, name: s, className: c, children: l }) {
|
|
10
|
+
let u = r();
|
|
11
|
+
return /* @__PURE__ */ n("fieldset", {
|
|
12
|
+
className: e([i, c]),
|
|
13
|
+
children: n(t, {
|
|
14
|
+
value: {
|
|
15
|
+
name: s ?? u,
|
|
16
|
+
value: a,
|
|
17
|
+
setValue: o
|
|
18
|
+
},
|
|
19
|
+
children: l
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as default };
|
|
@@ -1,50 +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 "./RatingCore.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/Rating/Rating.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let a = v >= i + 1, c = u && v >= i + .5 && v < i + 1;
|
|
19
|
-
return /* @__PURE__ */ t("span", {
|
|
20
|
-
role: "radio",
|
|
21
|
-
"aria-checked": p >= i + 1 ? "true" : "false",
|
|
22
|
-
"aria-label": `${i + 1} star${i > 0 ? "s" : ""}`,
|
|
23
|
-
onClick: () => _(i),
|
|
24
|
-
onMouseEnter: () => g(i + 1),
|
|
25
|
-
onMouseLeave: () => g(null),
|
|
26
|
-
className: e([o, (a || c) && s]),
|
|
27
|
-
children: /* @__PURE__ */ n("svg", {
|
|
28
|
-
width: "18",
|
|
29
|
-
height: "18",
|
|
30
|
-
viewBox: "0 0 24 24",
|
|
31
|
-
fill: a ? "currentColor" : c ? "url(#half)" : "none",
|
|
32
|
-
stroke: "currentColor",
|
|
33
|
-
strokeWidth: "2",
|
|
34
|
-
children: [c && /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ n("linearGradient", {
|
|
35
|
-
id: "half",
|
|
36
|
-
children: [/* @__PURE__ */ t("stop", {
|
|
37
|
-
offset: "50%",
|
|
38
|
-
stopColor: "currentColor"
|
|
39
|
-
}), /* @__PURE__ */ t("stop", {
|
|
40
|
-
offset: "50%",
|
|
41
|
-
stopColor: "transparent"
|
|
42
|
-
})]
|
|
43
|
-
}) }), /* @__PURE__ */ t("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })]
|
|
44
|
-
})
|
|
45
|
-
}, i);
|
|
46
|
-
})
|
|
5
|
+
function r({ value: r, count: i, allowHalf: a, onChange: o, className: s }) {
|
|
6
|
+
let [c, l] = n(r, 0);
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: c,
|
|
9
|
+
onChange: (e) => {
|
|
10
|
+
l(e), o?.(e);
|
|
11
|
+
},
|
|
12
|
+
count: i,
|
|
13
|
+
allowHalf: a,
|
|
14
|
+
className: s
|
|
47
15
|
});
|
|
48
16
|
}
|
|
49
17
|
//#endregion
|
|
50
|
-
export {
|
|
18
|
+
export { r as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
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/Rating/RatingCore.tsx
|
|
7
|
+
var i = "haze-RatingCore__container", a = "haze-RatingCore__star", o = "haze-RatingCore__starActive";
|
|
8
|
+
function s({ value: s, onChange: c, count: l = 5, allowHalf: u = !1, className: d }) {
|
|
9
|
+
let [f, p] = r(null), m = (e) => {
|
|
10
|
+
c(e + 1);
|
|
11
|
+
}, h = f ?? s;
|
|
12
|
+
return /* @__PURE__ */ t("div", {
|
|
13
|
+
role: "radiogroup",
|
|
14
|
+
className: e([i, d]),
|
|
15
|
+
children: Array.from({ length: l }, (r, i) => {
|
|
16
|
+
let c = h >= i + 1, l = u && h >= i + .5 && h < i + 1;
|
|
17
|
+
return /* @__PURE__ */ t("span", {
|
|
18
|
+
role: "radio",
|
|
19
|
+
"aria-checked": s >= i + 1 ? "true" : "false",
|
|
20
|
+
"aria-label": `${i + 1} star${i > 0 ? "s" : ""}`,
|
|
21
|
+
onClick: () => m(i),
|
|
22
|
+
onMouseEnter: () => p(i + 1),
|
|
23
|
+
onMouseLeave: () => p(null),
|
|
24
|
+
className: e([a, (c || l) && o]),
|
|
25
|
+
children: /* @__PURE__ */ n("svg", {
|
|
26
|
+
width: "18",
|
|
27
|
+
height: "18",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
fill: c ? "currentColor" : l ? "url(#half)" : "none",
|
|
30
|
+
stroke: "currentColor",
|
|
31
|
+
strokeWidth: "2",
|
|
32
|
+
children: [l && /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ n("linearGradient", {
|
|
33
|
+
id: "half",
|
|
34
|
+
children: [/* @__PURE__ */ t("stop", {
|
|
35
|
+
offset: "50%",
|
|
36
|
+
stopColor: "currentColor"
|
|
37
|
+
}), /* @__PURE__ */ t("stop", {
|
|
38
|
+
offset: "50%",
|
|
39
|
+
stopColor: "transparent"
|
|
40
|
+
})]
|
|
41
|
+
}) }), /* @__PURE__ */ t("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })]
|
|
42
|
+
})
|
|
43
|
+
}, i);
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { s as default };
|
|
@@ -1,43 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
/* empty css */
|
|
1
|
+
import e from "./SegmentedCore.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/Segmented/Segmented.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} : e;
|
|
18
|
-
}
|
|
19
|
-
function c({ options: c, value: l, onChange: u, size: d = "md", className: f }) {
|
|
20
|
-
let [p, m] = n(l, ""), h = (e) => {
|
|
21
|
-
m(e), u?.(e);
|
|
22
|
-
};
|
|
23
|
-
return /* @__PURE__ */ t("div", {
|
|
24
|
-
role: "group",
|
|
25
|
-
className: e([
|
|
26
|
-
r,
|
|
27
|
-
i[d],
|
|
28
|
-
f
|
|
29
|
-
]),
|
|
30
|
-
children: c.map((n) => {
|
|
31
|
-
let { value: r, label: i, disabled: c } = s(n);
|
|
32
|
-
return /* @__PURE__ */ t("button", {
|
|
33
|
-
type: "button",
|
|
34
|
-
disabled: c,
|
|
35
|
-
onClick: () => h(r),
|
|
36
|
-
className: e([a, p === r && o]),
|
|
37
|
-
children: i
|
|
38
|
-
}, r);
|
|
39
|
-
})
|
|
5
|
+
function r({ options: r, value: i, onChange: a, size: o, className: s }) {
|
|
6
|
+
let [c, l] = n(i, "");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
options: r,
|
|
9
|
+
value: c,
|
|
10
|
+
onChange: (e) => {
|
|
11
|
+
l(e), a?.(e);
|
|
12
|
+
},
|
|
13
|
+
size: o,
|
|
14
|
+
className: s
|
|
40
15
|
});
|
|
41
16
|
}
|
|
42
17
|
//#endregion
|
|
43
|
-
export {
|
|
18
|
+
export { r as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
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/Segmented/SegmentedCore.tsx
|
|
6
|
+
var n = "haze-SegmentedCore__container", r = {
|
|
7
|
+
sm: "haze-SegmentedCore__sm",
|
|
8
|
+
md: "haze-SegmentedCore__md",
|
|
9
|
+
lg: "haze-SegmentedCore__lg"
|
|
10
|
+
}, i = "haze-SegmentedCore__btn", a = "haze-SegmentedCore__activeBtn";
|
|
11
|
+
function o(e) {
|
|
12
|
+
return typeof e == "string" ? {
|
|
13
|
+
value: e,
|
|
14
|
+
label: e,
|
|
15
|
+
disabled: !1
|
|
16
|
+
} : e;
|
|
17
|
+
}
|
|
18
|
+
function s({ options: s, value: c, onChange: l, size: u = "md", className: d }) {
|
|
19
|
+
return /* @__PURE__ */ t("div", {
|
|
20
|
+
role: "group",
|
|
21
|
+
className: e([
|
|
22
|
+
n,
|
|
23
|
+
r[u],
|
|
24
|
+
d
|
|
25
|
+
]),
|
|
26
|
+
children: s.map((n) => {
|
|
27
|
+
let { value: r, label: s, disabled: u } = o(n);
|
|
28
|
+
return /* @__PURE__ */ t("button", {
|
|
29
|
+
type: "button",
|
|
30
|
+
disabled: u,
|
|
31
|
+
onClick: () => l(r),
|
|
32
|
+
className: e([i, c === r && a]),
|
|
33
|
+
children: s
|
|
34
|
+
}, r);
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { s as default };
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
/* empty css */
|
|
1
|
+
import e from "./SelectCore.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/Select/Select.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
f(e.target.value), l?.(e);
|
|
18
|
-
},
|
|
19
|
-
...u,
|
|
20
|
-
className: e([
|
|
21
|
-
r,
|
|
22
|
-
i[o],
|
|
23
|
-
s
|
|
24
|
-
]),
|
|
25
|
-
children: c
|
|
5
|
+
function r({ value: r, size: i, className: a, children: o, onChange: s, ...c }) {
|
|
6
|
+
let [l, u] = n(r, "");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: l,
|
|
9
|
+
onChange: u,
|
|
10
|
+
onNativeChange: s,
|
|
11
|
+
size: i,
|
|
12
|
+
className: a,
|
|
13
|
+
...c,
|
|
14
|
+
children: o
|
|
26
15
|
});
|
|
27
16
|
}
|
|
28
17
|
//#endregion
|
|
29
|
-
export {
|
|
18
|
+
export { r as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
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/Select/SelectCore.tsx
|
|
6
|
+
var n = "haze-SelectCore__base", r = {
|
|
7
|
+
sm: "haze-SelectCore__sm",
|
|
8
|
+
md: "haze-SelectCore__md",
|
|
9
|
+
lg: "haze-SelectCore__lg"
|
|
10
|
+
};
|
|
11
|
+
function i({ value: i, onChange: a, onNativeChange: o, size: s = "md", className: c, children: l, ...u }) {
|
|
12
|
+
return /* @__PURE__ */ t("select", {
|
|
13
|
+
value: i,
|
|
14
|
+
onChange: (e) => {
|
|
15
|
+
a(e.target.value), o?.(e);
|
|
16
|
+
},
|
|
17
|
+
...u,
|
|
18
|
+
className: e([
|
|
19
|
+
n,
|
|
20
|
+
r[s],
|
|
21
|
+
c
|
|
22
|
+
]),
|
|
23
|
+
children: l
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as default };
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
/* empty css */
|
|
1
|
+
import e from "./SliderCore.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/Slider/Slider.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
...s,
|
|
17
|
-
className: e([r, a])
|
|
5
|
+
function r({ value: r, className: i, onChange: a, ...o }) {
|
|
6
|
+
let [s, c] = n(r, 50);
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: s,
|
|
9
|
+
onChange: c,
|
|
10
|
+
onNativeChange: a,
|
|
11
|
+
className: i,
|
|
12
|
+
...o
|
|
18
13
|
});
|
|
19
14
|
}
|
|
20
15
|
//#endregion
|
|
21
|
-
export {
|
|
16
|
+
export { r as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
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/Slider/SliderCore.tsx
|
|
6
|
+
var n = "haze-SliderCore__base";
|
|
7
|
+
function r({ value: r, onChange: i, onNativeChange: a, className: o, ...s }) {
|
|
8
|
+
return /* @__PURE__ */ t("input", {
|
|
9
|
+
type: "range",
|
|
10
|
+
value: r,
|
|
11
|
+
onChange: (e) => {
|
|
12
|
+
i(Number(e.target.value)), a?.(e);
|
|
13
|
+
},
|
|
14
|
+
...s,
|
|
15
|
+
className: e([n, o])
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { r as default };
|