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
package/README.md
CHANGED
|
@@ -51,34 +51,45 @@ always come from `haze-ui/css/tokens.css`.
|
|
|
51
51
|
|
|
52
52
|
## react-f0rm Integration
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
react-f0rm owns form field state, and its headless `useField` hook is
|
|
55
|
+
the single binding layer — the same channel its built-in
|
|
56
|
+
`Field`/`Checkbox`/`Select` components use. haze-ui contributes the
|
|
57
|
+
views: controlled cores (`InputCore`, `SelectCore`, `SwitchCore`,
|
|
58
|
+
`TextareaCore`, `TagInputCore`, ...) take the plain `{value, onChange}`
|
|
59
|
+
pair with zero adapters, and `FormItem` wraps the hook's state in label,
|
|
60
|
+
error and aria wiring. The sugar components (`Input`, `Select`, ...)
|
|
61
|
+
keep their `Control<T> | T` API for standalone use outside forms.
|
|
59
62
|
|
|
60
|
-
###
|
|
63
|
+
### useField: field → {value, onChange}
|
|
61
64
|
|
|
62
65
|
```jsx
|
|
63
|
-
import { useForm,
|
|
64
|
-
import {
|
|
66
|
+
import { useForm, useField } from 'react-f0rm';
|
|
67
|
+
import { InputCore } from 'haze-ui';
|
|
65
68
|
|
|
66
69
|
function NameField({ form }) {
|
|
67
|
-
const
|
|
68
|
-
return <
|
|
70
|
+
const { value, onChange } = useField({ form, name: 'name' });
|
|
71
|
+
return <InputCore value={value} onChange={onChange} />; // two-way bound
|
|
69
72
|
}
|
|
70
73
|
```
|
|
71
74
|
|
|
72
|
-
The
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
The hook subscribes to the field (sibling fields stay isolated), and
|
|
76
|
+
`onChange` writes through react-f0rm's user-change channel — a write
|
|
77
|
+
fires exactly the validation a user typing into the field would fire:
|
|
78
|
+
the field's effective `mode` (a `FormItem`/`useField` per-field override
|
|
79
|
+
included) and the form's `reValidateMode`. With the default
|
|
80
|
+
`mode: 'onSubmit'` + `reValidateMode: 'onChange'`, typing through a bound
|
|
81
|
+
core after a failed submit re-validates per keystroke and clears the
|
|
82
|
+
error as soon as the value is valid — no blur, no resubmit. `onChange`
|
|
83
|
+
accepts plain values only (controlled cores emit the next value, never
|
|
84
|
+
functional updaters; read the previous value from `value` on the next
|
|
85
|
+
render). `reset(form, newValues)` re-seeds every binding with no
|
|
86
|
+
remounting.
|
|
76
87
|
|
|
77
88
|
### FormItem: label, errors and aria wiring
|
|
78
89
|
|
|
79
90
|
```jsx
|
|
80
91
|
import { Form, useForm } from 'react-f0rm';
|
|
81
|
-
import { FormItem,
|
|
92
|
+
import { FormItem, InputCore } from 'haze-ui';
|
|
82
93
|
|
|
83
94
|
function ProfileForm() {
|
|
84
95
|
const form = useForm({ initialValues: { email: '' } });
|
|
@@ -90,8 +101,8 @@ function ProfileForm() {
|
|
|
90
101
|
label="Email"
|
|
91
102
|
validate={(v) => (v.includes('@') ? undefined : 'must be an email')}
|
|
92
103
|
>
|
|
93
|
-
{({ id, errorId, invalid,
|
|
94
|
-
<
|
|
104
|
+
{({ id, errorId, invalid, value, onChange }) => (
|
|
105
|
+
<InputCore id={id} value={value} onChange={onChange} aria-invalid={invalid} aria-describedby={errorId} />
|
|
95
106
|
)}
|
|
96
107
|
</FormItem>
|
|
97
108
|
</Form>
|
|
@@ -119,10 +130,11 @@ keep the form's mode.
|
|
|
119
130
|
mode="onBlur"
|
|
120
131
|
validate={(v) => (v.includes('@') ? undefined : 'must be an email')}
|
|
121
132
|
>
|
|
122
|
-
{({ id, errorId, invalid, onBlur,
|
|
123
|
-
<
|
|
133
|
+
{({ id, errorId, invalid, onBlur, value, onChange }) => (
|
|
134
|
+
<InputCore
|
|
124
135
|
id={id}
|
|
125
|
-
value={
|
|
136
|
+
value={value}
|
|
137
|
+
onChange={onChange}
|
|
126
138
|
aria-invalid={invalid}
|
|
127
139
|
aria-describedby={errorId}
|
|
128
140
|
onBlur={onBlur}
|
|
@@ -131,8 +143,8 @@ keep the form's mode.
|
|
|
131
143
|
</FormItem>
|
|
132
144
|
```
|
|
133
145
|
|
|
134
|
-
With `mode="onBlur"` (and the binding's `onBlur` passed to the
|
|
135
|
-
|
|
146
|
+
With `mode="onBlur"` (and the binding's `onBlur` passed to the core, as
|
|
147
|
+
above) the email field is validated the moment it loses focus — no
|
|
136
148
|
submit needed. `mode` accepts `'onSubmit'`, `'onBlur'`, `'onChange'`,
|
|
137
149
|
`'onTouched'` or `'all'`; only this field's schedule changes, the rest
|
|
138
150
|
of the form keeps its own `mode`.
|
|
@@ -166,8 +178,8 @@ react-f0rm's `useField`:
|
|
|
166
178
|
rules={{ required: 'Email is required' }}
|
|
167
179
|
validate={(v) => (v.includes('@') ? undefined : 'must be an email')}
|
|
168
180
|
>
|
|
169
|
-
{({ id, errorId, invalid,
|
|
170
|
-
<
|
|
181
|
+
{({ id, errorId, invalid, value, onChange }) => (
|
|
182
|
+
<InputCore id={id} value={value} onChange={onChange} aria-invalid={invalid} aria-describedby={errorId} />
|
|
171
183
|
)}
|
|
172
184
|
</FormItem>
|
|
173
185
|
```
|
|
@@ -1,24 +1,17 @@
|
|
|
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 "./CheckboxCore.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/Checkbox/Checkbox.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
...
|
|
16
|
-
className: e([i, s])
|
|
17
|
-
});
|
|
18
|
-
return c === void 0 ? p : /* @__PURE__ */ n("label", {
|
|
19
|
-
className: e(a),
|
|
20
|
-
children: [p, c]
|
|
5
|
+
function r({ checked: r, className: i, label: a, onChange: o, ...s }) {
|
|
6
|
+
let [c, l] = n(r, !1);
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
checked: c,
|
|
9
|
+
onChange: l,
|
|
10
|
+
onNativeChange: o,
|
|
11
|
+
className: i,
|
|
12
|
+
label: a,
|
|
13
|
+
...s
|
|
21
14
|
});
|
|
22
15
|
}
|
|
23
16
|
//#endregion
|
|
24
|
-
export {
|
|
17
|
+
export { r as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
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/Checkbox/CheckboxCore.tsx
|
|
6
|
+
var r = "haze-CheckboxCore__base", i = "haze-CheckboxCore__labelText";
|
|
7
|
+
function a({ checked: a, onChange: o, onNativeChange: s, className: c, label: l, ...u }) {
|
|
8
|
+
let d = /* @__PURE__ */ t("input", {
|
|
9
|
+
type: "checkbox",
|
|
10
|
+
checked: a,
|
|
11
|
+
onChange: (e) => {
|
|
12
|
+
o(e.target.checked), s?.(e);
|
|
13
|
+
},
|
|
14
|
+
...u,
|
|
15
|
+
className: e([r, c])
|
|
16
|
+
});
|
|
17
|
+
return l === void 0 ? d : /* @__PURE__ */ n("label", {
|
|
18
|
+
className: e(i),
|
|
19
|
+
children: [d, l]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as default };
|
|
@@ -1,46 +1,17 @@
|
|
|
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 "./ColorPickerCore.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/ColorPicker/ColorPicker.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
g(e), p?.(e);
|
|
17
|
-
};
|
|
18
|
-
return /* @__PURE__ */ n("div", {
|
|
19
|
-
className: e([i, m]),
|
|
20
|
-
children: [/* @__PURE__ */ n("div", {
|
|
21
|
-
className: e([a]),
|
|
22
|
-
children: [/* @__PURE__ */ t("input", {
|
|
23
|
-
type: "color",
|
|
24
|
-
value: h,
|
|
25
|
-
onChange: v,
|
|
26
|
-
className: e([o])
|
|
27
|
-
}), /* @__PURE__ */ t("input", {
|
|
28
|
-
type: "text",
|
|
29
|
-
value: h,
|
|
30
|
-
onChange: _,
|
|
31
|
-
className: e([s])
|
|
32
|
-
})]
|
|
33
|
-
}), f && f.length > 0 && /* @__PURE__ */ t("div", {
|
|
34
|
-
className: e([c]),
|
|
35
|
-
children: f.map((n) => /* @__PURE__ */ t("button", {
|
|
36
|
-
type: "button",
|
|
37
|
-
style: { background: n },
|
|
38
|
-
"aria-label": n,
|
|
39
|
-
onClick: () => y(n),
|
|
40
|
-
className: e([l, h === n && u])
|
|
41
|
-
}, n))
|
|
42
|
-
})]
|
|
5
|
+
function r({ value: r, presets: i, onChange: a, className: o }) {
|
|
6
|
+
let [s, c] = n(r, "#000000");
|
|
7
|
+
return /* @__PURE__ */ t(e, {
|
|
8
|
+
value: s,
|
|
9
|
+
onChange: (e) => {
|
|
10
|
+
c(e), a?.(e);
|
|
11
|
+
},
|
|
12
|
+
presets: i,
|
|
13
|
+
className: o
|
|
43
14
|
});
|
|
44
15
|
}
|
|
45
16
|
//#endregion
|
|
46
|
-
export {
|
|
17
|
+
export { r as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
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/ColorPicker/ColorPickerCore.tsx
|
|
6
|
+
var r = "haze-ColorPickerCore__container", i = "haze-ColorPickerCore__previewRow", a = "haze-ColorPickerCore__colorInput", o = "haze-ColorPickerCore__textInput", s = "haze-ColorPickerCore__presetsRow", c = "haze-ColorPickerCore__presetBtn", l = "haze-ColorPickerCore__activePreset";
|
|
7
|
+
function u({ value: u, onChange: d, presets: f, className: p }) {
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: e([r, p]),
|
|
10
|
+
children: [/* @__PURE__ */ n("div", {
|
|
11
|
+
className: e([i]),
|
|
12
|
+
children: [/* @__PURE__ */ t("input", {
|
|
13
|
+
type: "color",
|
|
14
|
+
value: u,
|
|
15
|
+
onChange: (e) => d(e.target.value),
|
|
16
|
+
className: e([a])
|
|
17
|
+
}), /* @__PURE__ */ t("input", {
|
|
18
|
+
type: "text",
|
|
19
|
+
value: u,
|
|
20
|
+
onChange: (e) => d(e.target.value),
|
|
21
|
+
className: e([o])
|
|
22
|
+
})]
|
|
23
|
+
}), f && f.length > 0 && /* @__PURE__ */ t("div", {
|
|
24
|
+
className: e([s]),
|
|
25
|
+
children: f.map((n) => /* @__PURE__ */ t("button", {
|
|
26
|
+
type: "button",
|
|
27
|
+
style: { background: n },
|
|
28
|
+
"aria-label": n,
|
|
29
|
+
onClick: () => d(n),
|
|
30
|
+
className: e([c, u === n && l])
|
|
31
|
+
}, n))
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { u 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,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
|
+
//#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
|
+
value: o,
|
|
14
|
+
onChange: (e) => c(e.target.value),
|
|
15
|
+
className: e([i])
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ t("span", {
|
|
18
|
+
className: e([a]),
|
|
19
|
+
children: u
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ t("input", {
|
|
22
|
+
type: "date",
|
|
23
|
+
value: s,
|
|
24
|
+
onChange: (e) => l(e.target.value),
|
|
25
|
+
className: e([i])
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { o 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,42 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import t from "./Calendar.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { useEffect as i, useRef as a } from "react";
|
|
7
|
+
//#region src/lib/components/Datepicker/DatepickerCore.tsx
|
|
8
|
+
var o = "haze-DatepickerCore__wrapper", s = "haze-DatepickerCore__input", c = "haze-DatepickerCore__dropdown", l = "haze-DatepickerCore__hiddenStyle";
|
|
9
|
+
function u({ value: u, onChange: d, open: f, onOpenChange: p, min: m, max: h, placeholder: g = "Select date", className: _ }) {
|
|
10
|
+
let v = a(null);
|
|
11
|
+
return i(() => {
|
|
12
|
+
if (!f) return;
|
|
13
|
+
let e = (e) => {
|
|
14
|
+
v.current && !v.current.contains(e.target) && p(!1);
|
|
15
|
+
};
|
|
16
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
17
|
+
}, [f, p]), /* @__PURE__ */ r("div", {
|
|
18
|
+
ref: v,
|
|
19
|
+
className: e([o, _]),
|
|
20
|
+
children: [/* @__PURE__ */ n("input", {
|
|
21
|
+
readOnly: !0,
|
|
22
|
+
className: s,
|
|
23
|
+
value: u,
|
|
24
|
+
placeholder: g,
|
|
25
|
+
onClick: () => p(!f),
|
|
26
|
+
"aria-haspopup": "dialog",
|
|
27
|
+
"aria-expanded": f
|
|
28
|
+
}), /* @__PURE__ */ n("div", {
|
|
29
|
+
className: e([c, !f && l]),
|
|
30
|
+
children: /* @__PURE__ */ n(t, {
|
|
31
|
+
value: u,
|
|
32
|
+
min: m,
|
|
33
|
+
max: h,
|
|
34
|
+
onSelect: (e) => {
|
|
35
|
+
d(e), p(!1);
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { u as default };
|
|
@@ -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,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 };
|