haze-ui 1.14.0 → 1.16.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 +89 -0
- package/dist/components/Button/Button.js +11 -25
- package/dist/components/Button/ButtonLink.js +23 -0
- package/dist/components/Button/styles.js +18 -0
- package/dist/components/Carousel/Carousel.js +5 -5
- package/dist/components/ChatInput/ChatInput.js +3 -3
- package/dist/components/Collapsible/Collapsible.js +6 -6
- package/dist/components/Combobox/Combobox.js +4 -4
- package/dist/components/Command/Command.js +8 -8
- package/dist/components/ContextMenu/ContextMenu.js +4 -4
- package/dist/components/Dialog/Dialog.js +4 -4
- package/dist/components/Disclosure/Disclosure.js +4 -4
- package/dist/components/Drawer/Drawer.js +4 -4
- package/dist/components/DropdownMenu/DropdownMenu.js +3 -3
- package/dist/components/InlineEdit/InlineEdit.js +4 -4
- package/dist/components/LogViewer/LogViewer.js +3 -3
- package/dist/components/Menu/Menu.js +3 -3
- package/dist/components/Popover/Popover.js +3 -3
- package/dist/components/Stepper/Stepper.js +4 -4
- package/dist/components/Tooltip/Tooltip.js +5 -5
- package/dist/components/Transfer/Transfer.js +3 -3
- package/dist/components/Tree/Tree.js +3 -3
- package/dist/css/button.css +2 -1
- package/dist/form/FormItem.js +33 -22
- package/dist/haze-ui.css +2 -1
- package/dist/index.js +139 -138
- package/dist/types/components/Button/ButtonLink.d.ts +31 -0
- package/dist/types/components/Button/index.d.ts +2 -0
- package/dist/types/components/Button/styles.d.ts +29 -0
- package/dist/types/form/FormItem.d.ts +70 -4
- package/dist/types/form/index.d.ts +1 -1
- package/dist/types/index.d.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,42 @@ Component CSS files are kebab-case versions of the component name
|
|
|
49
49
|
cover that component's rules — tokens (themes, spacing, typography)
|
|
50
50
|
always come from `haze-ui/css/tokens.css`.
|
|
51
51
|
|
|
52
|
+
## ButtonLink: a real anchor with the Button skin
|
|
53
|
+
|
|
54
|
+
Navigation that must look like a button should still *be* a link —
|
|
55
|
+
rendering `as={Button}` drops `href` onto a `<button>` (an invalid
|
|
56
|
+
attribute: no ⌘/middle-click new tab, nothing for crawlers or no-JS).
|
|
57
|
+
`ButtonLink` renders a native `<a>` wearing Button's full appearance —
|
|
58
|
+
same `variant`/`size`/`square` props, same hover/active/focus and
|
|
59
|
+
disabled visual states:
|
|
60
|
+
|
|
61
|
+
```jsx
|
|
62
|
+
import { ButtonLink } from 'haze-ui';
|
|
63
|
+
|
|
64
|
+
<ButtonLink href='/page/2' variant='outline'>Next page</ButtonLink>
|
|
65
|
+
|
|
66
|
+
// anchors have no `disabled` attribute — report the state with
|
|
67
|
+
// aria-disabled (+ tabIndex={-1} to leave the focus order); ButtonLink
|
|
68
|
+
// styles it exactly like Button's :disabled
|
|
69
|
+
<ButtonLink href='/prev' aria-disabled tabIndex={-1}>← Previous</ButtonLink>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Everything else extends the native `<a>` attributes and is spread onto
|
|
73
|
+
the anchor (`target`, `rel`, `download`, `aria-*`, …), with the ref
|
|
74
|
+
forwarded — the same composition shape `NavLink` uses, so routers can
|
|
75
|
+
swap their own Link element through an `as` prop:
|
|
76
|
+
|
|
77
|
+
```jsx
|
|
78
|
+
// with a typed router Link (href + SPA onClick injected by the router):
|
|
79
|
+
<TypedLink to='/articles' search={{offset: 20}} as={ButtonLink}>
|
|
80
|
+
Next page
|
|
81
|
+
</TypedLink>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Both components share one skin (a styles module), so a theme tweak to
|
|
85
|
+
`Button` re-skins `ButtonLink` in lockstep. CSS: `haze-ui/css/button.css`
|
|
86
|
+
covers both.
|
|
87
|
+
|
|
52
88
|
## react-f0rm Integration
|
|
53
89
|
|
|
54
90
|
react-f0rm owns form field state, and its headless `useField` hook is
|
|
@@ -154,6 +190,59 @@ render-prop are mutually exclusive.
|
|
|
154
190
|
- With a typed form, `validate`'s value argument is the field's actual
|
|
155
191
|
type (`PathValueOf<TValues, P>`), not `any`.
|
|
156
192
|
|
|
193
|
+
#### `input`: declarative binding for haze-ui cores (typed prop forwarding)
|
|
194
|
+
|
|
195
|
+
The ergonomic form for the controlled cores — pass the component and the
|
|
196
|
+
rest of the JSX goes straight to it, type-checked against its own props:
|
|
197
|
+
|
|
198
|
+
```jsx
|
|
199
|
+
<FormItem
|
|
200
|
+
form={form}
|
|
201
|
+
name="email"
|
|
202
|
+
label="Email"
|
|
203
|
+
input={InputCore}
|
|
204
|
+
placeholder="you@x.dev"
|
|
205
|
+
mode="onBlur"
|
|
206
|
+
validate={(v) => (v.includes('@') ? undefined : 'must be an email')}
|
|
207
|
+
/>
|
|
208
|
+
|
|
209
|
+
// JSX children forward too — a SelectCore's options:
|
|
210
|
+
<FormItem form={form} name="role" label="Role" input={SelectCore}>
|
|
211
|
+
<option value="admin">Admin</option>
|
|
212
|
+
<option value="viewer">Viewer</option>
|
|
213
|
+
</FormItem>
|
|
214
|
+
|
|
215
|
+
// checkbox-style controls keep the valueToProps adapter:
|
|
216
|
+
<FormItem
|
|
217
|
+
form={form}
|
|
218
|
+
name="subscribed"
|
|
219
|
+
label="Subscribe"
|
|
220
|
+
input={CheckboxCore}
|
|
221
|
+
valueToProps={(checked) => ({ checked })}
|
|
222
|
+
/>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`input` wires the same id/aria/`onBlur`/`onChange`/value contract as `as`
|
|
226
|
+
— every haze core (`InputCore`, `TextareaCore`, `SelectCore`,
|
|
227
|
+
`TagInputCore`, `CheckboxCore`, `SwitchCore`, …) speaks the plain
|
|
228
|
+
`{value, onChange}` pair, so the default adapters need nothing
|
|
229
|
+
(`TagInputCore`'s `onChange` already emits the next `string[]`; a
|
|
230
|
+
checkbox-style core pairs with `valueToProps`). The differences from
|
|
231
|
+
`as`:
|
|
232
|
+
|
|
233
|
+
- Forwarded props are **type-checked against the core's own props** —
|
|
234
|
+
`input={InputCore} size="xl"` is a compile error, while `asProps` is an
|
|
235
|
+
untyped bag.
|
|
236
|
+
- JSX **children** forward to the core (a `SelectCore`'s `<option>`s);
|
|
237
|
+
the render-prop children and `input` are mutually exclusive (a
|
|
238
|
+
render-prop next to `input` throws — it's a migration leftover).
|
|
239
|
+
- The wiring (`id`, `aria-invalid`, `aria-describedby`, `onBlur`,
|
|
240
|
+
`onChange`, `value`/`checked`) and FormItem's own prop names are
|
|
241
|
+
**reserved**: they are excluded from the forwarded type and always win
|
|
242
|
+
at runtime. A control prop that collides with one (e.g. CheckboxCore's
|
|
243
|
+
own `label`) is unreachable through `input` — use the render-prop or
|
|
244
|
+
`as`/`asProps` for it.
|
|
245
|
+
|
|
157
246
|
#### `mode`: per-field validation timing (react-f0rm ≥ 0.6)
|
|
158
247
|
|
|
159
248
|
Pass `mode` to validate one field on its own schedule instead of the
|
|
@@ -1,33 +1,19 @@
|
|
|
1
|
-
|
|
2
1
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
|
|
4
|
-
import { jsx as
|
|
2
|
+
import { base as t, sizes as n, squareSizes as r, variants as i } from "./styles.js";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
5
4
|
//#region src/lib/components/Button/Button.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ghost: "haze-Button__ghost"
|
|
10
|
-
}, i = "haze-Button__sizeSm", a = "haze-Button__sizeMd", o = "haze-Button__sizeLg", s = "haze-Button__squareSm", c = "haze-Button__squareMd", l = "haze-Button__squareLg", u = {
|
|
11
|
-
sm: i,
|
|
12
|
-
md: a,
|
|
13
|
-
lg: o
|
|
14
|
-
}, d = {
|
|
15
|
-
sm: s,
|
|
16
|
-
md: c,
|
|
17
|
-
lg: l
|
|
18
|
-
};
|
|
19
|
-
function f({ variant: i = "solid", size: a = "md", square: o = !1, className: s, ...c }) {
|
|
20
|
-
let l = o ? d[a] : u[a];
|
|
21
|
-
return /* @__PURE__ */ t("button", {
|
|
5
|
+
function o({ variant: o = "solid", size: s = "md", square: c = !1, className: l, ...u }) {
|
|
6
|
+
let d = c ? r[s] : n[s];
|
|
7
|
+
return /* @__PURE__ */ a("button", {
|
|
22
8
|
type: "button",
|
|
23
|
-
...
|
|
9
|
+
...u,
|
|
24
10
|
className: e([
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
t,
|
|
12
|
+
i[o],
|
|
13
|
+
d,
|
|
14
|
+
l
|
|
29
15
|
])
|
|
30
16
|
});
|
|
31
17
|
}
|
|
32
18
|
//#endregion
|
|
33
|
-
export {
|
|
19
|
+
export { o as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { base as t, sizes as n, squareSizes as r, variants as i } from "./styles.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
import { forwardRef as o } from "react";
|
|
7
|
+
//#region src/lib/components/Button/ButtonLink.tsx
|
|
8
|
+
var s = "haze-ButtonLink__link", c = o(function({ variant: o = "solid", size: c = "md", square: l = !1, className: u, ...d }, f) {
|
|
9
|
+
let p = l ? r[c] : n[c];
|
|
10
|
+
return /* @__PURE__ */ a("a", {
|
|
11
|
+
ref: f,
|
|
12
|
+
...d,
|
|
13
|
+
className: e([
|
|
14
|
+
t,
|
|
15
|
+
i[o],
|
|
16
|
+
p,
|
|
17
|
+
s,
|
|
18
|
+
u
|
|
19
|
+
])
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { c as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
/* empty css */
|
|
3
|
+
//#region src/lib/components/Button/styles.ts
|
|
4
|
+
var e = "haze-styles__base", t = {
|
|
5
|
+
solid: "haze-styles__solid",
|
|
6
|
+
outline: "haze-styles__outline",
|
|
7
|
+
ghost: "haze-styles__ghost"
|
|
8
|
+
}, n = "haze-styles__sizeSm", r = "haze-styles__sizeMd", i = "haze-styles__sizeLg", a = "haze-styles__squareSm", o = "haze-styles__squareMd", s = "haze-styles__squareLg", c = {
|
|
9
|
+
sm: n,
|
|
10
|
+
md: r,
|
|
11
|
+
lg: i
|
|
12
|
+
}, l = {
|
|
13
|
+
sm: a,
|
|
14
|
+
md: o,
|
|
15
|
+
lg: s
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { e as base, i as sizeLg, r as sizeMd, n as sizeSm, c as sizes, s as squareLg, o as squareMd, l as squareSizes, a as squareSm, t as variants };
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Children as i, useEffect as a, useRef as o } from "react";
|
|
6
|
+
import { useControl as s } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/Carousel/Carousel.tsx
|
|
8
8
|
var c = "haze-Carousel__wrapper", l = "haze-Carousel__track", u = "haze-Carousel__navBtn", d = "haze-Carousel__prevBtn", f = "haze-Carousel__nextBtn", p = "haze-Carousel__indicators", m = "haze-Carousel__dot", h = "haze-Carousel__dotActive";
|
|
9
9
|
function g({ value: g, autoPlay: _ = !1, interval: v = 5e3, className: y, children: b }) {
|
|
10
|
-
let [x, S] =
|
|
11
|
-
return
|
|
10
|
+
let [x, S] = s(g, 0), C = o(null), w = i.count(b);
|
|
11
|
+
return a(() => {
|
|
12
12
|
let e = C.current;
|
|
13
13
|
if (!e) return;
|
|
14
14
|
let t = e.children[x];
|
|
@@ -17,7 +17,7 @@ function g({ value: g, autoPlay: _ = !1, interval: v = 5e3, className: y, childr
|
|
|
17
17
|
block: "nearest",
|
|
18
18
|
inline: "start"
|
|
19
19
|
});
|
|
20
|
-
}, [x]),
|
|
20
|
+
}, [x]), a(() => {
|
|
21
21
|
if (!_ || w <= 1) return;
|
|
22
22
|
let e = setInterval(() => {
|
|
23
23
|
S((e) => (e + 1) % w);
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useCallback as r, useRef as i } from "react";
|
|
6
|
+
import { useControl as a } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/ChatInput/ChatInput.tsx
|
|
8
8
|
var o = "haze-ChatInput__wrapper", s = "haze-ChatInput__textarea", c = "haze-ChatInput__sendBtn";
|
|
9
9
|
function l({ value: l, onSend: u, placeholder: d = "Type a message...", disabled: f, maxLength: p, className: m }) {
|
|
10
|
-
let [h, g] =
|
|
10
|
+
let [h, g] = a(l, ""), _ = i(null), v = r(() => {
|
|
11
11
|
let e = h.trim();
|
|
12
12
|
!e || f || (u?.(e), g(""), _.current && (_.current.style.height = "auto"));
|
|
13
13
|
}, [
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createContext as n, useContext as r } from "react";
|
|
6
|
+
import { useControl as i } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/Collapsible/Collapsible.tsx
|
|
8
|
-
var a =
|
|
8
|
+
var a = n(void 0);
|
|
9
9
|
function o() {
|
|
10
|
-
let e =
|
|
10
|
+
let e = r(a);
|
|
11
11
|
if (!e) throw Error("Collapsible sub-components must be used within <Collapsible>");
|
|
12
12
|
return e;
|
|
13
13
|
}
|
|
14
14
|
var s = "haze-Collapsible__base";
|
|
15
|
-
function c({ open:
|
|
16
|
-
let [l, u] = n
|
|
15
|
+
function c({ open: n, defaultOpen: r = !1, children: o, className: c }) {
|
|
16
|
+
let [l, u] = i(n, r);
|
|
17
17
|
return /* @__PURE__ */ t(a.Provider, {
|
|
18
18
|
value: {
|
|
19
19
|
open: l,
|
|
@@ -4,18 +4,18 @@ import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
|
|
|
4
4
|
import r from "./ComboboxOption.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useEffect as o, useId as s, useRef as c, useState as l } from "react";
|
|
8
|
+
import { useControl as u } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/Combobox/Combobox.tsx
|
|
10
10
|
var d = "haze-Combobox__wrapper", f = "haze-Combobox__input", p = "haze-Combobox__listbox";
|
|
11
11
|
function m({ value: m, open: h, options: g, placeholder: _, className: v }) {
|
|
12
|
-
let [y, b] =
|
|
12
|
+
let [y, b] = u(m, ""), [x, S] = l(""), [C, w] = u(h, !1), [T, E] = l(-1), D = s(), O = c(null), k = c(null), A = n({
|
|
13
13
|
open: C,
|
|
14
14
|
setOpen: w,
|
|
15
15
|
triggerRef: O,
|
|
16
16
|
panelRef: k
|
|
17
17
|
}), j = g.filter((e) => e.label.toLowerCase().includes(x.toLowerCase()));
|
|
18
|
-
|
|
18
|
+
o(() => {
|
|
19
19
|
E(-1);
|
|
20
20
|
}, [x]);
|
|
21
21
|
let M = (e) => {
|
|
@@ -3,26 +3,26 @@ import { classnames as e } from "../../utils/classnames.js";
|
|
|
3
3
|
import { getEnabledMenuItems as t, useMenuKeyboard as n, useRovingTabindex as r } from "../../utils/menuKeyboard.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { createContext as a, useContext as o, useId as s, useMemo as c, useRef as l } from "react";
|
|
7
|
+
import { useControl as u } from "react-use-control";
|
|
8
8
|
//#region src/lib/components/Command/Command.tsx
|
|
9
|
-
var d = "[role=\"option\"]", f =
|
|
9
|
+
var d = "[role=\"option\"]", f = a(void 0);
|
|
10
10
|
function p() {
|
|
11
|
-
let e =
|
|
11
|
+
let e = o(f);
|
|
12
12
|
if (!e) throw Error("Command sub-components must be used within <Command>");
|
|
13
13
|
return e;
|
|
14
14
|
}
|
|
15
15
|
var m = "haze-Command__base";
|
|
16
16
|
function h({ query: t, children: n, className: r }) {
|
|
17
|
-
let [
|
|
18
|
-
query:
|
|
19
|
-
setQuery:
|
|
17
|
+
let [a, o] = u(t, ""), d = l(null), p = l(null), h = s(), g = c(() => ({
|
|
18
|
+
query: a,
|
|
19
|
+
setQuery: o,
|
|
20
20
|
inputRef: d,
|
|
21
21
|
listRef: p,
|
|
22
22
|
listId: h
|
|
23
23
|
}), [
|
|
24
|
+
a,
|
|
24
25
|
o,
|
|
25
|
-
s,
|
|
26
26
|
h
|
|
27
27
|
]);
|
|
28
28
|
return /* @__PURE__ */ i(f.Provider, {
|
|
@@ -4,19 +4,19 @@ import { useFloating as t } from "../../utils/floating.js";
|
|
|
4
4
|
import { ContextMenuProvider as n } from "./ContextMenuContext.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useCallback as i, useRef as a, useState as o } from "react";
|
|
8
|
+
import { useControl as s } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/ContextMenu/ContextMenu.tsx
|
|
10
10
|
var c = "haze-ContextMenu__wrapper";
|
|
11
11
|
function l({ open: l, onOpenChange: u, children: d, className: f }) {
|
|
12
|
-
let [p, m] =
|
|
12
|
+
let [p, m] = s(l, !1), [h, g] = o(0), [_, v] = o(0), y = a(null), b = a(null), x = i((e) => {
|
|
13
13
|
let t = typeof e == "function" ? e(p) : e;
|
|
14
14
|
m(t), u?.(t);
|
|
15
15
|
}, [
|
|
16
16
|
p,
|
|
17
17
|
m,
|
|
18
18
|
u
|
|
19
|
-
]), S =
|
|
19
|
+
]), S = i((e, t) => {
|
|
20
20
|
g(e), v(t);
|
|
21
21
|
}, []), C = t({
|
|
22
22
|
open: p,
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useEffect as r, useId as i, useRef as a } from "react";
|
|
6
|
+
import { useControl as o } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/Dialog/Dialog.tsx
|
|
8
8
|
var s = "haze-Dialog__overlay", c = "haze-Dialog__titleText";
|
|
9
9
|
function l({ open: l, onClose: u, title: d, className: f, children: p }) {
|
|
10
|
-
let [m, h] =
|
|
11
|
-
return
|
|
10
|
+
let [m, h] = o(l, !1), g = a(null), _ = a(null), v = `haze-dialog-title-${i()}`;
|
|
11
|
+
return r(() => {
|
|
12
12
|
let e = g.current;
|
|
13
13
|
e && (m && !e.open ? (_.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal()) : !m && e.open && e.close());
|
|
14
14
|
}, [m]), /* @__PURE__ */ n("dialog", {
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useEffect as r, useRef as i } from "react";
|
|
6
|
+
import { useControl as a } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/Disclosure/Disclosure.tsx
|
|
8
8
|
var o = "haze-Disclosure__details", s = "haze-Disclosure__summaryStyle", c = "haze-Disclosure__content";
|
|
9
9
|
function l({ open: l, summary: u, className: d, children: f }) {
|
|
10
|
-
let [p] =
|
|
11
|
-
return
|
|
10
|
+
let [p] = a(l, !1), m = i(null);
|
|
11
|
+
return r(() => {
|
|
12
12
|
m.current && (m.current.open = p);
|
|
13
13
|
}, [p]), /* @__PURE__ */ n("details", {
|
|
14
14
|
ref: m,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useEffect as n, useRef as r } from "react";
|
|
6
|
+
import { useControl as i } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/Drawer/Drawer.tsx
|
|
8
8
|
var a = "haze-Drawer__overlay", o = {
|
|
9
9
|
left: "haze-Drawer__left",
|
|
@@ -12,8 +12,8 @@ var a = "haze-Drawer__overlay", o = {
|
|
|
12
12
|
bottom: "haze-Drawer__bottom"
|
|
13
13
|
};
|
|
14
14
|
function s({ open: s, placement: c = "right", onClose: l, className: u, children: d }) {
|
|
15
|
-
let [f, p] =
|
|
16
|
-
return
|
|
15
|
+
let [f, p] = i(s, !1), m = r(null);
|
|
16
|
+
return n(() => {
|
|
17
17
|
let e = m.current;
|
|
18
18
|
e && (f && !e.open ? e.showModal() : !f && e.open && e.close());
|
|
19
19
|
}, [f]), /* @__PURE__ */ t("dialog", {
|
|
@@ -4,12 +4,12 @@ import { useFloating as t } from "../../utils/floating.js";
|
|
|
4
4
|
import { DropdownMenuProvider as n } from "./DropdownMenuContext.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useCallback as i, useId as a, useRef as o } from "react";
|
|
8
|
+
import { useControl as s } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/DropdownMenu/DropdownMenu.tsx
|
|
10
10
|
var c = "haze-DropdownMenu__wrapper";
|
|
11
11
|
function l({ open: l, onOpenChange: u, children: d, className: f }) {
|
|
12
|
-
let [p, m] =
|
|
12
|
+
let [p, m] = s(l, !1), h = o(null), g = o(null), _ = a(), v = o(null), y = i((e) => {
|
|
13
13
|
let t = typeof e == "function" ? e(p) : e;
|
|
14
14
|
m(t), u?.(t);
|
|
15
15
|
}, [
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useEffect as n, useRef as r, useState as i } from "react";
|
|
6
|
+
import { useControl as a } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/InlineEdit/InlineEdit.tsx
|
|
8
8
|
var o = "haze-InlineEdit__display", s = "haze-InlineEdit__editing", c = "haze-InlineEdit__placeholderStyle";
|
|
9
9
|
function l({ value: l, onChange: u, placeholder: d = "Click to edit", disabled: f, className: p }) {
|
|
10
|
-
let [m, h] =
|
|
11
|
-
|
|
10
|
+
let [m, h] = a(l, ""), [g, _] = i(!1), [v, y] = i(m), b = r(null);
|
|
11
|
+
n(() => {
|
|
12
12
|
g && (b.current?.focus(), b.current?.select());
|
|
13
13
|
}, [g]);
|
|
14
14
|
let x = () => {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useMemo as r } from "react";
|
|
6
|
+
import { useControl as i } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/LogViewer/LogViewer.tsx
|
|
8
8
|
var a = "haze-LogViewer__wrapper", o = "haze-LogViewer__toolbar", s = "haze-LogViewer__filterBtn", c = "haze-LogViewer__filterActive", l = "haze-LogViewer__body", u = "haze-LogViewer__entry", d = "haze-LogViewer__timestamp", f = "haze-LogViewer__levelBadge", p = "haze-LogViewer__levelDebug", m = "haze-LogViewer__levelInfo", h = "haze-LogViewer__levelWarn", g = "haze-LogViewer__levelError", _ = "haze-LogViewer__messageStyle", v = {
|
|
9
9
|
debug: p,
|
|
@@ -17,7 +17,7 @@ var a = "haze-LogViewer__wrapper", o = "haze-LogViewer__toolbar", s = "haze-LogV
|
|
|
17
17
|
"error"
|
|
18
18
|
];
|
|
19
19
|
function b({ logs: p, filter: m, className: h }) {
|
|
20
|
-
let [g, b] =
|
|
20
|
+
let [g, b] = i(m, null), x = r(() => g ? p.filter((e) => e.level === g) : p, [p, g]);
|
|
21
21
|
return /* @__PURE__ */ n("div", {
|
|
22
22
|
className: e([a, h]),
|
|
23
23
|
children: [/* @__PURE__ */ n("div", {
|
|
@@ -4,12 +4,12 @@ import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
|
|
|
4
4
|
import { useMenuKeyboard as r, useRovingTabindex as i } from "../../utils/menuKeyboard.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useRef as s } from "react";
|
|
8
|
+
import { useControl as c } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/Menu/Menu.tsx
|
|
10
10
|
var l = "haze-Menu__container", u = "haze-Menu__panel";
|
|
11
11
|
function d({ open: d, trigger: f, className: p, children: m }) {
|
|
12
|
-
let [h, g] =
|
|
12
|
+
let [h, g] = c(d, !1), _ = s(null), v = s(null), y = n({
|
|
13
13
|
open: h,
|
|
14
14
|
setOpen: g,
|
|
15
15
|
triggerRef: _,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { FloatingPanel as e, useFloating as t } from "../../utils/floating.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useId as i, useRef as a } from "react";
|
|
6
|
+
import { useControl as o } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/Popover/Popover.tsx
|
|
8
8
|
var s = "haze-Popover__container", c = "haze-Popover__panelVisuals";
|
|
9
9
|
function l({ content: l, open: u, className: d, children: f }) {
|
|
10
|
-
let [p, m] =
|
|
10
|
+
let [p, m] = o(u, !1), h = i(), g = a(null), _ = a(null), v = t({
|
|
11
11
|
open: p,
|
|
12
12
|
setOpen: m,
|
|
13
13
|
triggerRef: g,
|
|
@@ -3,12 +3,12 @@ import { classnames as e } from "../../utils/classnames.js";
|
|
|
3
3
|
import { StepperProvider as t } from "./StepperContext.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Children as r, cloneElement as i, isValidElement as a } from "react";
|
|
7
|
+
import { useControl as o } from "react-use-control";
|
|
8
8
|
//#region src/lib/components/Stepper/Stepper.tsx
|
|
9
9
|
var s = "haze-Stepper__stepper";
|
|
10
10
|
function c({ activeStep: c, children: l, className: u }) {
|
|
11
|
-
let [d, f] =
|
|
11
|
+
let [d, f] = o(c, 0), p = r.count(l);
|
|
12
12
|
return /* @__PURE__ */ n(t, {
|
|
13
13
|
value: {
|
|
14
14
|
activeStep: d,
|
|
@@ -18,7 +18,7 @@ function c({ activeStep: c, children: l, className: u }) {
|
|
|
18
18
|
children: n("div", {
|
|
19
19
|
role: "list",
|
|
20
20
|
className: e([s, u]),
|
|
21
|
-
children:
|
|
21
|
+
children: r.map(l, (e, t) => a(e) ? i(e, { index: t }) : e)
|
|
22
22
|
})
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -3,8 +3,8 @@ import { classnames as e } from "../../utils/classnames.js";
|
|
|
3
3
|
import { floatingPlacementClasses as t, useFloating as n, useFloatingPosition as r } from "../../utils/floating.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useEffect as o, useId as s, useRef as c } from "react";
|
|
7
|
+
import { useControl as l } from "react-use-control";
|
|
8
8
|
//#region src/lib/components/Tooltip/Tooltip.tsx
|
|
9
9
|
var u = "haze-Tooltip__wrapper", d = "haze-Tooltip__bubble", f = {
|
|
10
10
|
top: "top",
|
|
@@ -13,7 +13,7 @@ var u = "haze-Tooltip__wrapper", d = "haze-Tooltip__bubble", f = {
|
|
|
13
13
|
right: "right"
|
|
14
14
|
};
|
|
15
15
|
function p({ content: p, position: m = "top", delay: h = 150, open: g, className: _, children: v }) {
|
|
16
|
-
let [y, b] =
|
|
16
|
+
let [y, b] = l(g, !1), x = s(), S = c(null), C = c(null), w = f[m], T = n({
|
|
17
17
|
open: y,
|
|
18
18
|
setOpen: b,
|
|
19
19
|
triggerRef: S,
|
|
@@ -23,8 +23,8 @@ function p({ content: p, position: m = "top", delay: h = 150, open: g, className
|
|
|
23
23
|
behavior: T,
|
|
24
24
|
placement: w
|
|
25
25
|
});
|
|
26
|
-
let E =
|
|
27
|
-
|
|
26
|
+
let E = c(0);
|
|
27
|
+
o(() => () => window.clearTimeout(E.current), []);
|
|
28
28
|
let D = () => {
|
|
29
29
|
window.clearTimeout(E.current), E.current = window.setTimeout(() => b(!0), h);
|
|
30
30
|
}, O = () => {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useState as r } from "react";
|
|
6
|
+
import { useControl as i } from "react-use-control";
|
|
7
7
|
//#region src/lib/components/Transfer/Transfer.tsx
|
|
8
8
|
var a = "haze-Transfer__container", o = "haze-Transfer__panel", s = "haze-Transfer__panelHeader", c = "haze-Transfer__panelBody", l = "haze-Transfer__itemStyle", u = "haze-Transfer__actions", d = "haze-Transfer__actionBtn";
|
|
9
9
|
function f({ dataSource: f, targetKeys: p, onChange: m, className: h }) {
|
|
10
|
-
let [g, _] =
|
|
10
|
+
let [g, _] = i(p, []), [v, y] = r([]), [b, x] = r([]), S = f.filter((e) => !g.includes(e.key)), C = f.filter((e) => g.includes(e.key)), w = (e) => {
|
|
11
11
|
y((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
12
12
|
}, T = (e) => {
|
|
13
13
|
x((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
@@ -4,8 +4,8 @@ import t from "./TreeItem.js";
|
|
|
4
4
|
import { findNodeByKey as n, getChildKeys as r, getParentKey as i } from "./utils.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useMemo as s } from "react";
|
|
8
|
+
import { useControl as c } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/Tree/Tree.tsx
|
|
10
10
|
var l = "haze-Tree__base", u = "haze-Tree__group";
|
|
11
11
|
function d(e, t, n) {
|
|
@@ -26,7 +26,7 @@ function d(e, t, n) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
function f({ treeData: f, multiple: p = !1, checkable: m = !1, checkStrictly: h = !1, selectable: g = !0, disabled: _ = !1, blockNode: v = !1, showLine: y = !1, showIcon: b = !1, switcherIcon: x, loadingIcon: S, titleRender: C, iconRender: w, expandedKeys: T, selectedKeys: E, checkedKeys: D, className: O, onExpand: k, onSelect: A, onCheck: j }) {
|
|
29
|
-
let [M, N] =
|
|
29
|
+
let [M, N] = c(T, []), [P, F] = c(E, []), [I, L] = c(D, []), R = I, z = s(() => d(R, f, h), [
|
|
30
30
|
R,
|
|
31
31
|
f,
|
|
32
32
|
h
|
package/dist/css/button.css
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
/* haze-ui button — generated by scripts/split-css.mjs, do not edit */
|
|
2
|
-
.haze-
|
|
2
|
+
.haze-ButtonLink__link{-webkit-text-decoration:none;text-decoration:none}.haze-ButtonLink__link[aria-disabled=true]{opacity:.5;cursor:not-allowed;pointer-events:none}
|
|
3
|
+
.haze-styles__base{justify-content:center;align-items:center;gap:var(--haze-space-2);border-radius:var(--haze-radius-md);font-family:var(--haze-font-sans);font-weight:var(--haze-weight-medium);line-height:var(--haze-leading-tight);cursor:pointer;-webkit-user-select:none;user-select:none;border:1px solid #0000;transition:background .15s,color .15s,border-color .15s,box-shadow .15s;display:inline-flex}.haze-styles__base:focus-visible{box-shadow:0 0 0 3px var(--haze-color-focus-ring);outline:none}.haze-styles__base:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.haze-styles__solid{background:var(--haze-color-primary);color:var(--haze-color-text-inverse)}.haze-styles__solid:hover{background:var(--haze-color-primary-hover)}.haze-styles__solid:active{background:var(--haze-color-primary-active)}.haze-styles__outline{border-color:var(--haze-color-border);color:var(--haze-color-text);background:0 0}.haze-styles__outline:hover{border-color:var(--haze-color-border-hover);background:var(--haze-color-bg-subtle)}.haze-styles__outline:active{background:var(--haze-color-bg-muted)}.haze-styles__ghost{color:var(--haze-color-text);background:0 0}.haze-styles__ghost:hover{background:var(--haze-color-bg-subtle)}.haze-styles__ghost:active{background:var(--haze-color-bg-muted)}.haze-styles__sizeSm{padding:var(--haze-space-1) var(--haze-space-3);font-size:var(--haze-text-sm)}.haze-styles__sizeMd{padding:var(--haze-space-2) var(--haze-space-4);font-size:var(--haze-text-sm)}.haze-styles__sizeLg{padding:var(--haze-space-3) var(--haze-space-6);font-size:var(--haze-text-base)}.haze-styles__squareSm{padding:var(--haze-space-1);font-size:var(--haze-text-sm)}.haze-styles__squareMd{padding:var(--haze-space-2);font-size:var(--haze-text-sm)}.haze-styles__squareLg{padding:var(--haze-space-3);font-size:var(--haze-text-base)}
|