@jonmilner/ui 0.21.2 → 0.22.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/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/AlertDialog/index.d.mts +1 -1
- package/dist/Avatar/index.d.mts +1 -1
- package/dist/Avatar/index.mjs +5 -5
- package/dist/Badge/index.d.mts +1 -1
- package/dist/Badge/index.mjs +12 -12
- package/dist/Box/index.mjs +1 -1
- package/dist/Button/index.d.mts +1 -1
- package/dist/Button/index.mjs +22 -22
- package/dist/Checkbox/index.mjs +7 -7
- package/dist/Chip/index.mjs +35 -35
- package/dist/Clickable/index.d.mts +1 -1
- package/dist/Clickable/index.mjs +4 -4
- package/dist/ColorField/client.mjs +6 -6
- package/dist/ColorField/index.mjs +14 -14
- package/dist/Combobox/Combobox.css +1 -1
- package/dist/Combobox/client.mjs +26 -26
- package/dist/Combobox/index.mjs +20 -20
- package/dist/Dialog/client.mjs +26 -26
- package/dist/Dialog/index.d.mts +1 -1
- package/dist/Dialog/index.mjs +19 -19
- package/dist/Field/client.mjs +6 -6
- package/dist/Field/index.mjs +29 -29
- package/dist/IconButton/IconButton.css +1 -1
- package/dist/IconButton/IconButton.css.mjs +2 -2
- package/dist/IconButton/index.d.mts +5 -2
- package/dist/IconButton/index.mjs +60 -21
- package/dist/Inline/index.d.mts +2 -2
- package/dist/Inline/index.mjs +4 -4
- package/dist/Menu/Menu.css +1 -1
- package/dist/Menu/Menu.css.mjs +2 -2
- package/dist/Menu/client.d.mts +1 -0
- package/dist/Menu/client.mjs +95 -53
- package/dist/Menu/index.d.mts +8 -0
- package/dist/Menu/index.mjs +123 -87
- package/dist/MultiSelect/MultiSelect.css +1 -1
- package/dist/MultiSelect/client.mjs +4 -4
- package/dist/MultiSelect/index.mjs +8 -8
- package/dist/NavList/NavList.css +1 -1
- package/dist/NavList/client.mjs +3 -3
- package/dist/NavList/index.d.mts +3 -3
- package/dist/NavList/index.mjs +67 -65
- package/dist/NumberField/index.mjs +17 -17
- package/dist/RadioGroup/index.mjs +23 -23
- package/dist/SearchField/client.mjs +13 -13
- package/dist/SearchField/index.mjs +16 -16
- package/dist/Select/Select.css +1 -1
- package/dist/Select/client.mjs +11 -11
- package/dist/Select/index.mjs +8 -8
- package/dist/Sidebar/index.d.mts +1 -1
- package/dist/Sidebar/index.mjs +21 -21
- package/dist/SidebarLayout/index.d.mts +1 -1
- package/dist/SidebarLayout/index.mjs +8 -8
- package/dist/Stack/index.d.mts +2 -2
- package/dist/Stack/index.mjs +4 -4
- package/dist/Switch/index.mjs +13 -13
- package/dist/Table/index.d.mts +1 -1
- package/dist/Table/index.mjs +59 -59
- package/dist/Tabs/index.mjs +26 -26
- package/dist/Tag/index.d.mts +1 -1
- package/dist/Tag/index.mjs +16 -16
- package/dist/Text/index.d.mts +2 -2
- package/dist/Text/index.mjs +4 -4
- package/dist/TextField/index.mjs +16 -16
- package/dist/Textarea/index.mjs +9 -9
- package/dist/Toast/client.d.mts +2 -1
- package/dist/Toast/client.mjs +62 -55
- package/dist/Tooltip/base.mjs +13 -13
- package/dist/contrast/contrast.d.mts +1 -1
- package/dist/contrast/contrast.mjs +9 -9
- package/dist/contrast/mixes.mjs +27 -27
- package/dist/docs/Combobox.md +1 -0
- package/dist/docs/IconButton.md +9 -1
- package/dist/docs/Menu.md +51 -3
- package/dist/docs/MultiSelect.md +1 -0
- package/dist/docs/NavList.md +2 -2
- package/dist/docs/Select.md +1 -0
- package/dist/docs/Toast.md +7 -0
- package/dist/docs/llms.txt +1 -1
- package/dist/docs/manifest.json +118 -1
- package/dist/docs/migrations/0.22.0.md +35 -0
- package/dist/icons/index.d.mts +3 -3
- package/dist/icons/index.mjs +33 -33
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +39 -39
- package/dist/lint/index.mjs +1 -0
- package/dist/popup/client.d.mts +1 -1
- package/dist/popup/client.mjs +49 -32
- package/dist/popup/direction.d.mts +1 -0
- package/dist/popup/direction.mjs +23 -0
- package/dist/popup/listbox-base.mjs +24 -24
- package/dist/popup/listbox-options.mjs +4 -4
- package/dist/popup/listbox-row.mjs +1 -0
- package/dist/popup/tooltip.d.mts +1 -0
- package/dist/popup/tooltip.mjs +48 -42
- package/dist/theme/define-theme.mjs +42 -42
- package/package.json +2 -2
package/dist/TextField/index.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Box as e } from "../Box/base.mjs";
|
|
2
|
+
import { Field as t } from "../Field/index.mjs";
|
|
3
|
+
import { InputIcons as n } from "../icon-slot/input-icons.mjs";
|
|
4
|
+
import { controlText as r } from "../styles/control-size.mjs";
|
|
5
|
+
import { join as i } from "../styles/join.mjs";
|
|
6
|
+
import { Text as a } from "../Text/index.mjs";
|
|
7
7
|
import { hiddenLabel as o, input as s, slot as c } from "./TextField.css.mjs";
|
|
8
8
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
9
|
import { Input as d } from "@base-ui/react/input";
|
|
10
10
|
// src/TextField/index.tsx
|
|
11
11
|
function f({ label: f, hideLabel: p = !1, type: m = "text", value: h, defaultValue: g, onValueChange: _, placeholder: v, description: y, error: b, size: x = "med", disabled: S = !1, required: C = !1, name: w, inputProps: T, iconStart: E, iconEnd: D, className: O, style: k, ...A }) {
|
|
12
|
-
return /* @__PURE__ */ u(
|
|
12
|
+
return /* @__PURE__ */ u(t, {
|
|
13
13
|
...A,
|
|
14
14
|
className: O,
|
|
15
15
|
disabled: S,
|
|
16
16
|
invalid: b != null && b !== !1 && b !== "",
|
|
17
17
|
style: k,
|
|
18
18
|
children: [
|
|
19
|
-
/* @__PURE__ */ l(
|
|
19
|
+
/* @__PURE__ */ l(t.Label, {
|
|
20
20
|
className: p ? o : void 0,
|
|
21
21
|
children: f
|
|
22
22
|
}),
|
|
23
|
-
/* @__PURE__ */ u(
|
|
23
|
+
/* @__PURE__ */ u(e, {
|
|
24
24
|
display: "grid",
|
|
25
25
|
children: [/* @__PURE__ */ l(d, {
|
|
26
26
|
...T,
|
|
@@ -28,24 +28,24 @@ function f({ label: f, hideLabel: p = !1, type: m = "text", value: h, defaultVal
|
|
|
28
28
|
name: w,
|
|
29
29
|
onValueChange: _ && ((e) => _(e)),
|
|
30
30
|
placeholder: v,
|
|
31
|
-
render: /* @__PURE__ */ l(
|
|
31
|
+
render: /* @__PURE__ */ l(a, {
|
|
32
32
|
as: "input",
|
|
33
|
-
className:
|
|
34
|
-
size:
|
|
33
|
+
className: i(s({ size: x }), E && c.roomStart[x], D && c.roomEnd[x]),
|
|
34
|
+
size: r[x]
|
|
35
35
|
}),
|
|
36
36
|
required: C,
|
|
37
37
|
type: m,
|
|
38
38
|
value: h
|
|
39
|
-
}), /* @__PURE__ */ l(
|
|
39
|
+
}), /* @__PURE__ */ l(n, {
|
|
40
40
|
iconEnd: D,
|
|
41
41
|
iconStart: E,
|
|
42
42
|
size: x,
|
|
43
|
-
step:
|
|
43
|
+
step: r[x],
|
|
44
44
|
styles: c
|
|
45
45
|
})]
|
|
46
46
|
}),
|
|
47
|
-
y != null && /* @__PURE__ */ l(
|
|
48
|
-
/* @__PURE__ */ l(
|
|
47
|
+
y != null && /* @__PURE__ */ l(t.Description, { children: y }),
|
|
48
|
+
/* @__PURE__ */ l(t.Error, { children: b })
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
}
|
package/dist/Textarea/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Field as e } from "../Field/index.mjs";
|
|
2
|
+
import { controlText as t } from "../styles/control-size.mjs";
|
|
3
|
+
import { Text as n } from "../Text/index.mjs";
|
|
4
4
|
import { hiddenLabel as r, input as i } from "./Textarea.css.mjs";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
6
|
import { Input as s } from "@base-ui/react/input";
|
|
7
7
|
// src/Textarea/index.tsx
|
|
8
8
|
function c({ label: c, hideLabel: l = !1, rows: u = 3, value: d, defaultValue: f, onValueChange: p, placeholder: m, description: h, error: g, size: _ = "med", disabled: v = !1, required: y = !1, name: b, inputProps: x, className: S, style: C, ...w }) {
|
|
9
|
-
return /* @__PURE__ */ o(
|
|
9
|
+
return /* @__PURE__ */ o(e, {
|
|
10
10
|
...w,
|
|
11
11
|
className: S,
|
|
12
12
|
disabled: v,
|
|
13
13
|
invalid: g != null && g !== !1 && g !== "",
|
|
14
14
|
style: C,
|
|
15
15
|
children: [
|
|
16
|
-
/* @__PURE__ */ a(
|
|
16
|
+
/* @__PURE__ */ a(e.Label, {
|
|
17
17
|
className: l ? r : void 0,
|
|
18
18
|
children: c
|
|
19
19
|
}),
|
|
@@ -23,17 +23,17 @@ function c({ label: c, hideLabel: l = !1, rows: u = 3, value: d, defaultValue: f
|
|
|
23
23
|
name: b,
|
|
24
24
|
onValueChange: p && ((e) => p(e)),
|
|
25
25
|
placeholder: m,
|
|
26
|
-
render: /* @__PURE__ */ a(
|
|
26
|
+
render: /* @__PURE__ */ a(n, {
|
|
27
27
|
as: "textarea",
|
|
28
28
|
className: i({ size: _ }),
|
|
29
29
|
rows: u,
|
|
30
|
-
size:
|
|
30
|
+
size: t[_]
|
|
31
31
|
}),
|
|
32
32
|
required: y,
|
|
33
33
|
value: d
|
|
34
34
|
}),
|
|
35
|
-
h != null && /* @__PURE__ */ a(
|
|
36
|
-
/* @__PURE__ */ a(
|
|
35
|
+
h != null && /* @__PURE__ */ a(e.Description, { children: h }),
|
|
36
|
+
/* @__PURE__ */ a(e.Error, { children: g })
|
|
37
37
|
]
|
|
38
38
|
});
|
|
39
39
|
}
|
package/dist/Toast/client.d.mts
CHANGED
|
@@ -11,6 +11,7 @@ export type ToastOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
description?: string;
|
|
13
13
|
duration?: number;
|
|
14
|
+
onClose?: () => void;
|
|
14
15
|
title: string;
|
|
15
16
|
variant?: ToastVariant;
|
|
16
17
|
};
|
|
@@ -38,7 +39,7 @@ declare const icons: {
|
|
|
38
39
|
};
|
|
39
40
|
declare function ToastProvider({ limit, closeLabel, regionLabel, className, style, children }: ToastProviderProps): import("react").JSX.Element;
|
|
40
41
|
export declare function useToast(): {
|
|
41
|
-
add: ({ title, description, variant, duration, action }: ToastOptions) => string;
|
|
42
|
+
add: ({ title, description, variant, duration, action, onClose }: ToastOptions) => string;
|
|
42
43
|
close: (id: string) => void;
|
|
43
44
|
};
|
|
44
45
|
export { ToastProvider };
|
package/dist/Toast/client.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Box as e } from "../Box/base.mjs";
|
|
3
|
+
import { Button as t } from "../Button/index.mjs";
|
|
4
4
|
import { Clickable as n } from "../Clickable/index.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { CircleAlertIcon as r } from "../icons/CircleAlertIcon.mjs";
|
|
6
|
+
import { CircleCheckIcon as i } from "../icons/CircleCheckIcon.mjs";
|
|
7
|
+
import { InfoIcon as a } from "../icons/InfoIcon.mjs";
|
|
8
|
+
import { XIcon as o } from "../icons/XIcon.mjs";
|
|
9
|
+
import { join as s } from "../styles/join.mjs";
|
|
10
|
+
import { Text as c } from "../Text/index.mjs";
|
|
11
|
+
import { useThemeContainer as l } from "../theme/use-theme-container.mjs";
|
|
12
12
|
import { announcer as u, close as d, content as f, list as p, root as m, toast as h, viewport as g } from "./Toast.css.mjs";
|
|
13
13
|
import { createContext as _, use as v, useCallback as y, useEffect as b, useLayoutEffect as x, useMemo as S, useRef as C, useState as w } from "react";
|
|
14
14
|
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
@@ -16,39 +16,39 @@ import { Toast as D } from "@base-ui/react/toast";
|
|
|
16
16
|
// src/Toast/client.tsx
|
|
17
17
|
var O = {
|
|
18
18
|
info: {
|
|
19
|
-
Icon:
|
|
19
|
+
Icon: a,
|
|
20
20
|
color: "fgMuted"
|
|
21
21
|
},
|
|
22
22
|
success: {
|
|
23
|
-
Icon:
|
|
23
|
+
Icon: i,
|
|
24
24
|
color: "success"
|
|
25
25
|
},
|
|
26
26
|
error: {
|
|
27
|
-
Icon:
|
|
27
|
+
Icon: r,
|
|
28
28
|
color: "danger"
|
|
29
29
|
}
|
|
30
30
|
}, k = _(null), A = _(null), j = (e) => e !== void 0 && Object.hasOwn(O, e);
|
|
31
|
-
function M({ limit:
|
|
32
|
-
let { container:
|
|
31
|
+
function M({ limit: t = 3, closeLabel: n = "Dismiss", regionLabel: r = "Notifications", className: i, style: a, children: o }) {
|
|
32
|
+
let { container: s, ref: c } = l(), [u] = w(D.createToastManager);
|
|
33
33
|
return /* @__PURE__ */ T(D.Provider, {
|
|
34
|
-
limit:
|
|
34
|
+
limit: t,
|
|
35
35
|
toastManager: u,
|
|
36
36
|
children: /* @__PURE__ */ E(k, {
|
|
37
37
|
value: u,
|
|
38
38
|
children: [
|
|
39
|
-
/* @__PURE__ */ T(
|
|
39
|
+
/* @__PURE__ */ T(e, {
|
|
40
40
|
as: "span",
|
|
41
41
|
hidden: !0,
|
|
42
|
-
ref:
|
|
42
|
+
ref: c
|
|
43
43
|
}),
|
|
44
|
-
|
|
44
|
+
o,
|
|
45
45
|
/* @__PURE__ */ T(P, {}),
|
|
46
46
|
/* @__PURE__ */ T(D.Portal, {
|
|
47
|
-
container:
|
|
47
|
+
container: s,
|
|
48
48
|
children: /* @__PURE__ */ T(N, {
|
|
49
49
|
className: i,
|
|
50
50
|
regionLabel: r,
|
|
51
|
-
style:
|
|
51
|
+
style: a,
|
|
52
52
|
children: /* @__PURE__ */ T(F, { closeLabel: n })
|
|
53
53
|
})
|
|
54
54
|
})
|
|
@@ -56,47 +56,47 @@ function M({ limit: e = 3, closeLabel: n = "Dismiss", regionLabel: r = "Notifica
|
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
function N({ regionLabel:
|
|
60
|
-
let
|
|
59
|
+
function N({ regionLabel: t, className: n, style: r, children: i }) {
|
|
60
|
+
let a = C(null), o = C(null);
|
|
61
61
|
return b(() => {
|
|
62
|
-
let e =
|
|
62
|
+
let e = o.current;
|
|
63
63
|
if (!e) return;
|
|
64
|
-
let t = e.ownerDocument, n = !1, r = (t) => {
|
|
65
|
-
e.contains(t.target) ? n = !0 : n && (n = !1, e.dispatchEvent(new MouseEvent("mouseout", {
|
|
64
|
+
let t = e.ownerDocument, n = { inside: !1 }, r = (t) => {
|
|
65
|
+
e.contains(t.target) ? n.inside = !0 : n.inside && (n.inside = !1, e.dispatchEvent(new MouseEvent("mouseout", {
|
|
66
66
|
bubbles: !0,
|
|
67
67
|
relatedTarget: e.parentElement
|
|
68
68
|
})));
|
|
69
69
|
}, i = (t) => {
|
|
70
70
|
let r = t.relatedTarget;
|
|
71
|
-
r && e.contains(r) || (n = !1);
|
|
71
|
+
r && e.contains(r) || (n.inside = !1);
|
|
72
72
|
};
|
|
73
73
|
return t.addEventListener("mouseover", r), t.addEventListener("mouseout", i), () => {
|
|
74
74
|
t.removeEventListener("mouseover", r), t.removeEventListener("mouseout", i);
|
|
75
75
|
};
|
|
76
76
|
}, []), /* @__PURE__ */ T(D.Viewport, {
|
|
77
77
|
"aria-atomic": void 0,
|
|
78
|
-
"aria-label":
|
|
78
|
+
"aria-label": t,
|
|
79
79
|
"aria-live": "off",
|
|
80
80
|
"aria-relevant": void 0,
|
|
81
81
|
onFocus: (e) => {
|
|
82
82
|
let t = e.relatedTarget;
|
|
83
|
-
t && !e.currentTarget.contains(t) && (
|
|
83
|
+
t && !e.currentTarget.contains(t) && (a.current = t);
|
|
84
84
|
},
|
|
85
85
|
onKeyDown: (e) => {
|
|
86
86
|
e.key === "Escape" && e.stopPropagation();
|
|
87
87
|
},
|
|
88
|
-
ref:
|
|
89
|
-
render: /* @__PURE__ */ T(
|
|
90
|
-
className:
|
|
88
|
+
ref: o,
|
|
89
|
+
render: /* @__PURE__ */ T(e, {
|
|
90
|
+
className: s(g, n),
|
|
91
91
|
position: "fixed",
|
|
92
|
-
style:
|
|
92
|
+
style: r,
|
|
93
93
|
zIndex: "toast"
|
|
94
94
|
}),
|
|
95
95
|
children: /* @__PURE__ */ T("div", {
|
|
96
96
|
className: p,
|
|
97
97
|
children: /* @__PURE__ */ T(A, {
|
|
98
|
-
value:
|
|
99
|
-
children:
|
|
98
|
+
value: a,
|
|
99
|
+
children: i
|
|
100
100
|
})
|
|
101
101
|
})
|
|
102
102
|
});
|
|
@@ -129,43 +129,43 @@ function F({ closeLabel: e }) {
|
|
|
129
129
|
toast: t
|
|
130
130
|
}, t.id));
|
|
131
131
|
}
|
|
132
|
-
function I({ toast:
|
|
133
|
-
let
|
|
132
|
+
function I({ toast: r, closeLabel: i }) {
|
|
133
|
+
let a = j(r.type) ? r.type : "info", { Icon: l, color: u } = O[a], p = v(k), g = v(A), [_, b] = w(!1), S = y((e) => {
|
|
134
134
|
e && b(getComputedStyle(e).direction === "rtl");
|
|
135
|
-
}, []), M = C(!1), N =
|
|
135
|
+
}, []), M = C(!1), N = r.transitionStatus === "ending";
|
|
136
136
|
return x(() => {
|
|
137
|
-
let e =
|
|
137
|
+
let e = r.ref?.current, t = e?.ownerDocument.activeElement;
|
|
138
138
|
if (!N || M.current || !t || !e.contains(t)) return;
|
|
139
139
|
let n = g?.current;
|
|
140
140
|
n instanceof HTMLElement && n.isConnected && n.focus({ preventScroll: !0 });
|
|
141
141
|
}, [
|
|
142
142
|
N,
|
|
143
143
|
g,
|
|
144
|
-
|
|
144
|
+
r.ref
|
|
145
145
|
]), /* @__PURE__ */ E(D.Root, {
|
|
146
146
|
"aria-modal": void 0,
|
|
147
147
|
ref: S,
|
|
148
|
-
render: /* @__PURE__ */ T(
|
|
148
|
+
render: /* @__PURE__ */ T(e, {
|
|
149
149
|
alignItems: "start",
|
|
150
150
|
backgroundColor: "bgRaised",
|
|
151
151
|
borderRadius: "med",
|
|
152
152
|
boxShadow: "lg",
|
|
153
|
-
className:
|
|
153
|
+
className: s(m, h({ variant: a })),
|
|
154
154
|
display: "flex",
|
|
155
155
|
gap: "12",
|
|
156
156
|
padding: "12"
|
|
157
157
|
}),
|
|
158
158
|
role: "group",
|
|
159
159
|
swipeDirection: ["down", _ ? "left" : "right"],
|
|
160
|
-
toast:
|
|
160
|
+
toast: r,
|
|
161
161
|
children: [
|
|
162
|
-
/* @__PURE__ */ T(
|
|
162
|
+
/* @__PURE__ */ T(e, {
|
|
163
163
|
display: "flex",
|
|
164
164
|
flexShrink: 0,
|
|
165
165
|
paddingBlock: "2",
|
|
166
166
|
children: /* @__PURE__ */ T(l, { color: u })
|
|
167
167
|
}),
|
|
168
|
-
/* @__PURE__ */ E(
|
|
168
|
+
/* @__PURE__ */ E(e, {
|
|
169
169
|
alignItems: "start",
|
|
170
170
|
className: f,
|
|
171
171
|
display: "flex",
|
|
@@ -173,16 +173,16 @@ function I({ toast: a, closeLabel: o }) {
|
|
|
173
173
|
flexGrow: 1,
|
|
174
174
|
gap: "8",
|
|
175
175
|
children: [
|
|
176
|
-
/* @__PURE__ */ T(D.Title, { render: /* @__PURE__ */ T(
|
|
176
|
+
/* @__PURE__ */ T(D.Title, { render: /* @__PURE__ */ T(c, {
|
|
177
177
|
as: "div",
|
|
178
178
|
weight: "medium"
|
|
179
179
|
}) }),
|
|
180
|
-
/* @__PURE__ */ T(D.Description, { render: /* @__PURE__ */ T(
|
|
180
|
+
/* @__PURE__ */ T(D.Description, { render: /* @__PURE__ */ T(c, {
|
|
181
181
|
as: "div",
|
|
182
182
|
color: "fgMuted",
|
|
183
183
|
size: "sm"
|
|
184
184
|
}) }),
|
|
185
|
-
/* @__PURE__ */ T(D.Action, { render: /* @__PURE__ */ T(
|
|
185
|
+
/* @__PURE__ */ T(D.Action, { render: /* @__PURE__ */ T(t, {
|
|
186
186
|
size: "med",
|
|
187
187
|
variant: "secondary"
|
|
188
188
|
}) })
|
|
@@ -190,11 +190,11 @@ function I({ toast: a, closeLabel: o }) {
|
|
|
190
190
|
}),
|
|
191
191
|
/* @__PURE__ */ T(D.Close, {
|
|
192
192
|
"aria-hidden": !1,
|
|
193
|
-
"aria-label":
|
|
193
|
+
"aria-label": i,
|
|
194
194
|
onClick: (e) => {
|
|
195
195
|
if (e.detail !== 0 || !p) return;
|
|
196
|
-
let t =
|
|
197
|
-
n instanceof HTMLElement && (e.preventBaseUIHandler(), M.current = !0, p.close(
|
|
196
|
+
let t = r.ref?.current, n = (t && L(t)) ?? g?.current;
|
|
197
|
+
n instanceof HTMLElement && (e.preventBaseUIHandler(), M.current = !0, p.close(r.id), requestAnimationFrame(() => {
|
|
198
198
|
n.isConnected && n.focus();
|
|
199
199
|
}));
|
|
200
200
|
},
|
|
@@ -204,7 +204,7 @@ function I({ toast: a, closeLabel: o }) {
|
|
|
204
204
|
flexShrink: 0,
|
|
205
205
|
padding: "4"
|
|
206
206
|
}),
|
|
207
|
-
children: /* @__PURE__ */ T(
|
|
207
|
+
children: /* @__PURE__ */ T(o, {})
|
|
208
208
|
})
|
|
209
209
|
]
|
|
210
210
|
});
|
|
@@ -219,25 +219,32 @@ function R() {
|
|
|
219
219
|
return S(() => {
|
|
220
220
|
let t = (t) => e.close(t);
|
|
221
221
|
return {
|
|
222
|
-
add: ({ title: n, description: r, variant: i = "info", duration: a = i === "error" ? 0 : 5e3, action: o }) => {
|
|
223
|
-
let
|
|
222
|
+
add: ({ title: n, description: r, variant: i = "info", duration: a = i === "error" ? 0 : 5e3, action: o, onClose: s }) => {
|
|
223
|
+
let c = e.add({
|
|
224
224
|
title: n,
|
|
225
225
|
description: r,
|
|
226
226
|
type: i,
|
|
227
227
|
timeout: a,
|
|
228
228
|
priority: "low",
|
|
229
|
+
onClose: s && (() => {
|
|
230
|
+
try {
|
|
231
|
+
s();
|
|
232
|
+
} catch (e) {
|
|
233
|
+
reportError(e);
|
|
234
|
+
}
|
|
235
|
+
}),
|
|
229
236
|
actionProps: o && {
|
|
230
237
|
children: o.label,
|
|
231
238
|
onClick: () => {
|
|
232
239
|
try {
|
|
233
240
|
o.onClick();
|
|
234
241
|
} finally {
|
|
235
|
-
t(
|
|
242
|
+
t(c);
|
|
236
243
|
}
|
|
237
244
|
}
|
|
238
245
|
}
|
|
239
246
|
});
|
|
240
|
-
return
|
|
247
|
+
return c;
|
|
241
248
|
},
|
|
242
249
|
close: t
|
|
243
250
|
};
|
package/dist/Tooltip/base.mjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { Box as e } from "../Box/base.mjs";
|
|
2
|
+
import { TooltipPopupPart as t, TooltipPortal as n, TooltipPositioner as r } from "../popup/tooltip.mjs";
|
|
3
|
+
import { join as i } from "../styles/join.mjs";
|
|
4
|
+
import { splitStyleProps as a } from "../styles/split-style-props.mjs";
|
|
5
|
+
import { Text as o } from "../Text/index.mjs";
|
|
6
6
|
import { popup as s, positioner as c } from "./Tooltip.css.mjs";
|
|
7
7
|
import { Children as l } from "react";
|
|
8
8
|
import { jsx as u } from "react/jsx-runtime";
|
|
9
9
|
// src/Tooltip/base.tsx
|
|
10
|
-
function d({ side:
|
|
11
|
-
let [x, S] =
|
|
12
|
-
return /* @__PURE__ */ u(
|
|
10
|
+
function d({ side: o = "top", align: l = "center", backgroundColor: d = "bgRaised", borderRadius: p = "xs", boxShadow: m = "med", paddingBlock: h = "4", paddingInline: g = "8", className: _, style: v, children: y, ...b }) {
|
|
11
|
+
let [x, S] = a(b);
|
|
12
|
+
return /* @__PURE__ */ u(n, { children: /* @__PURE__ */ u(r, {
|
|
13
13
|
align: l,
|
|
14
14
|
className: c,
|
|
15
|
-
side:
|
|
16
|
-
children: /* @__PURE__ */ u(
|
|
15
|
+
side: o,
|
|
16
|
+
children: /* @__PURE__ */ u(t, {
|
|
17
17
|
...S,
|
|
18
|
-
render: /* @__PURE__ */ u(
|
|
18
|
+
render: /* @__PURE__ */ u(e, {
|
|
19
19
|
backgroundColor: d,
|
|
20
20
|
borderRadius: p,
|
|
21
21
|
boxShadow: m,
|
|
22
22
|
paddingBlock: h,
|
|
23
23
|
paddingInline: g,
|
|
24
24
|
...x,
|
|
25
|
-
className:
|
|
25
|
+
className: i(s, _),
|
|
26
26
|
style: v
|
|
27
27
|
}),
|
|
28
28
|
children: f(y)
|
|
@@ -30,7 +30,7 @@ function d({ side: r = "top", align: l = "center", backgroundColor: d = "bgRaise
|
|
|
30
30
|
}) });
|
|
31
31
|
}
|
|
32
32
|
function f(e) {
|
|
33
|
-
return l.toArray(e).some((e) => typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ u(
|
|
33
|
+
return l.toArray(e).some((e) => typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ u(o, {
|
|
34
34
|
size: "sm",
|
|
35
35
|
children: e
|
|
36
36
|
}) : e;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { subtleFills as e } from "../styles/subtle-fills.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { overlayRoles as t } from "../tokens/roles.mjs";
|
|
3
|
+
import { decode as n, resolveColor as r } from "./color.mjs";
|
|
4
4
|
// src/contrast/contrast.ts
|
|
5
5
|
var i = [
|
|
6
6
|
"bg",
|
|
@@ -31,17 +31,17 @@ var i = [
|
|
|
31
31
|
...a(["borderStrong", "focus"], i, 3),
|
|
32
32
|
...a(["focus"], o.map(([, e]) => e), 3),
|
|
33
33
|
...a(o.map(([e]) => e), ["bg"], 3),
|
|
34
|
-
...a(["fg", "fgMuted"],
|
|
34
|
+
...a(["fg", "fgMuted"], t, 4.5).flatMap((e) => i.map((t) => ({
|
|
35
35
|
...e,
|
|
36
36
|
over: t
|
|
37
37
|
})))
|
|
38
38
|
], c = ["light", "dark"];
|
|
39
|
-
function l({ r: e, g:
|
|
40
|
-
return .2126 *
|
|
39
|
+
function l({ r: e, g: t, b: r }) {
|
|
40
|
+
return .2126 * n(e) + .7152 * n(t) + .0722 * n(r);
|
|
41
41
|
}
|
|
42
|
-
function u(e, t,
|
|
43
|
-
let a =
|
|
44
|
-
return f(
|
|
42
|
+
function u(e, t, n = "light", i) {
|
|
43
|
+
let a = r(t, n);
|
|
44
|
+
return f(r(e, n), i ? d(a, r(i, n)) : a, t);
|
|
45
45
|
}
|
|
46
46
|
function d(e, t) {
|
|
47
47
|
let n = (t, n) => t * e.alpha + n * (1 - e.alpha);
|
|
@@ -59,7 +59,7 @@ function f(e, t, n) {
|
|
|
59
59
|
}
|
|
60
60
|
function p(e) {
|
|
61
61
|
return c.flatMap((t) => {
|
|
62
|
-
let
|
|
62
|
+
let n = /* @__PURE__ */ new Map(), i = (i) => n.get(i) ?? n.set(i, r(e.color[i], t)).get(i);
|
|
63
63
|
return s.flatMap((n) => {
|
|
64
64
|
let r = n.over ? d(i(n.bg), i(n.over)) : i(n.bg), a = f(i(n.fg), r, e.color[n.bg]);
|
|
65
65
|
return a < n.min ? [{
|
package/dist/contrast/mixes.mjs
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { fills as e } from "../styles/button-fills.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { highlightFill as t, highlightText as n } from "../styles/highlight.mjs";
|
|
3
|
+
import { hoverFill as r } from "../styles/hover-tint.mjs";
|
|
4
|
+
import { subtleFills as i } from "../styles/subtle-fills.mjs";
|
|
5
|
+
import { overlayRoles as a } from "../tokens/roles.mjs";
|
|
6
|
+
import { contrastRatio as o, surfaces as s } from "./contrast.mjs";
|
|
7
7
|
// src/contrast/mixes.ts
|
|
8
|
-
var c = (e) =>
|
|
8
|
+
var c = (e) => a.includes(e), l = [
|
|
9
9
|
{
|
|
10
10
|
name: "Menu highlight",
|
|
11
|
-
fill:
|
|
12
|
-
text:
|
|
11
|
+
fill: t,
|
|
12
|
+
text: n,
|
|
13
13
|
min: 4.5
|
|
14
14
|
},
|
|
15
15
|
...Object.entries(e).flatMap(([e, { backgroundColor: t, color: n }]) => {
|
|
16
|
-
let
|
|
16
|
+
let i = [n];
|
|
17
17
|
return t && !c(t) ? [{
|
|
18
18
|
name: `${e} Button hover`,
|
|
19
|
-
fill: (e) =>
|
|
20
|
-
text:
|
|
19
|
+
fill: (e) => r(e.fg, e[t]),
|
|
20
|
+
text: i,
|
|
21
21
|
min: 4.5
|
|
22
|
-
}] :
|
|
22
|
+
}] : s.map((n) => ({
|
|
23
23
|
name: `${e} Button hover on ${n}`,
|
|
24
|
-
fill: (e) =>
|
|
24
|
+
fill: (e) => r(e.fg, e[t ?? n]),
|
|
25
25
|
...t && { over: n },
|
|
26
|
-
text:
|
|
26
|
+
text: i,
|
|
27
27
|
min: 4.5
|
|
28
28
|
}));
|
|
29
29
|
}),
|
|
30
30
|
{
|
|
31
31
|
name: "pressed Chip hover",
|
|
32
|
-
fill: (e) =>
|
|
32
|
+
fill: (e) => r(e.fg, e.accent),
|
|
33
33
|
text: ["accentFg"],
|
|
34
34
|
min: 4.5
|
|
35
35
|
},
|
|
36
|
-
...
|
|
36
|
+
...s.map((e) => ({
|
|
37
37
|
name: `Table row hover on ${e}`,
|
|
38
|
-
fill: (t) =>
|
|
38
|
+
fill: (t) => r(t.fg, t[e], "5%"),
|
|
39
39
|
text: e === "bgMuted" || e === "bgPanel" ? ["fg", "fgMuted"] : [
|
|
40
40
|
"fg",
|
|
41
41
|
"fgMuted",
|
|
@@ -47,24 +47,24 @@ var c = (e) => n.includes(e), l = [
|
|
|
47
47
|
],
|
|
48
48
|
min: 4.5
|
|
49
49
|
})),
|
|
50
|
-
...Object.entries(
|
|
50
|
+
...Object.entries(i).map(([e, { backgroundColor: t, color: n }]) => ({
|
|
51
51
|
name: `${e} Table row hover`,
|
|
52
|
-
fill: (e) =>
|
|
52
|
+
fill: (e) => r(e.fg, e[t], "5%"),
|
|
53
53
|
text: [n],
|
|
54
54
|
min: 4.5
|
|
55
55
|
}))
|
|
56
56
|
];
|
|
57
57
|
function u(e) {
|
|
58
|
-
return ["light", "dark"].flatMap((t) => l.flatMap(({ name: n, fill:
|
|
59
|
-
let c =
|
|
60
|
-
return
|
|
61
|
-
let
|
|
62
|
-
return
|
|
63
|
-
fg:
|
|
58
|
+
return ["light", "dark"].flatMap((t) => l.flatMap(({ name: n, fill: r, text: i, min: a, over: s }) => {
|
|
59
|
+
let c = r(e.color), l = s && e.color[s];
|
|
60
|
+
return i.flatMap((r) => {
|
|
61
|
+
let i = o(e.color[r], c, t, l);
|
|
62
|
+
return i < a ? [{
|
|
63
|
+
fg: r,
|
|
64
64
|
mix: n,
|
|
65
|
-
min:
|
|
65
|
+
min: a,
|
|
66
66
|
mode: t,
|
|
67
|
-
ratio:
|
|
67
|
+
ratio: i
|
|
68
68
|
}] : [];
|
|
69
69
|
});
|
|
70
70
|
}));
|
package/dist/docs/Combobox.md
CHANGED
|
@@ -32,6 +32,7 @@ A form field for picking one value, or any number with `multiple`, from a list l
|
|
|
32
32
|
- `disabled` disables the trigger and mutes the label. `required` marks the field required; report a missing value through `error`.
|
|
33
33
|
- The trigger, the popup and its listbox are named by `label`; the filter input by `filterLabel`.
|
|
34
34
|
- Style props, `className` and `style` go to the `Field` around the label, trigger and messages, not to the trigger or the popup.
|
|
35
|
+
- The popup stops 8px from the viewport's edges. A long option's label wraps, breaking inside a URL or hash if it has to, so there is no need to shorten labels or set a width to fit them.
|
|
35
36
|
- The popup portals into the trigger's nearest `ThemeProvider`, so it keeps the brand and mode. That provider must not clip or stack its content: wrap the app root, and keep a nested provider off elements with `overflow: hidden`, a `transform` or their own `z-index`. It sits on `zIndex` `popover`, below the trigger by default, and flips when it would overflow the viewport. The input stays at its top while the options scroll.
|
|
36
37
|
- Never add key handlers or `tabIndex`; Base UI handles the keyboard.
|
|
37
38
|
- The module has no hooks, so a server component can render it; `onValueChange` must come from a client component.
|
package/dist/docs/IconButton.md
CHANGED
|
@@ -22,7 +22,8 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
22
22
|
- `icon` takes an icon component (a generated `XIcon`, or a component that renders `Icon`), not an element: IconButton renders it at the `fontSize` step one below its `size` (12, 14 and 16px at `sm`, `med`, `lg`), as Button's icons, `aria-hidden`.
|
|
23
23
|
- `variant`: `ghost` (default), a muted ghost: no fill, border or glow, an `fgMuted` icon that turns `fg` on hover, keyboard focus and while open, for most icon actions, toolbars and controls that already frame it (SearchField's clear button). `secondary`, Button's quiet `controlFill` look, for an icon action that needs a visible frame; `primary` for the one action a view or dialog exists for. There is no `tone` and no `danger`: a destructive action deserves a labelled `Button` (ADR 0163).
|
|
24
24
|
- `size`: `sm`, `med` (default) or `lg`, never `md`. Each is a square as wide as Button's height of the same name (24, 32 and 40px), so an IconButton lines up with a Button beside it.
|
|
25
|
-
- `disabled` renders `aria-disabled="true"` and a dashed border, never the native `disabled`. There is no
|
|
25
|
+
- `disabled` renders `aria-disabled="true"` and a dashed border, never the native `disabled`. There is no tooltip.
|
|
26
|
+
- `loading` shows Button's three pulsing dots in place of the icon, in the same square, and renders `aria-busy="true"`: the button stays focusable, keeps its size and `label`, and blocks click, Enter and Space. A raw `aria-busy` counts as `loading`. On the muted `ghost` the dots are `fg`, or the passed `color`. The dots hold still under `prefers-reduced-motion: reduce` (ADR 0179).
|
|
26
27
|
- With `aria-expanded="true"`, as a Dialog trigger sets it, it holds the hover tint and an inset ring while the popup is open, as Button does.
|
|
27
28
|
- Fill (`backgroundColor`), text color (`color`), width (`minInlineSize`), height (`minBlockSize`) and `borderRadius` (`sm`) are default style props: pass one to change it. Change width and height together to keep the square. A `color` replaces the muted ghost's `fgMuted` and its `fg` on hover. `primary`'s glow gives way to a `boxShadow` prop, as on Button. Hover tints whatever the fill is; a custom fill needs an icon color that passes 3:1 on it (4.5:1 to match Button).
|
|
28
29
|
- `as="a"` with `href` for an icon-only link.
|
|
@@ -41,6 +42,10 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
41
42
|
</Inline>
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
```tsx
|
|
46
|
+
<IconButton label="Merge" icon={GitMergeIcon} loading={merging} onClick={merge} />
|
|
47
|
+
```
|
|
48
|
+
|
|
44
49
|
## Don't
|
|
45
50
|
|
|
46
51
|
```tsx
|
|
@@ -63,6 +68,7 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
63
68
|
- The `label` is announced as the button's name; the icon is hidden from assistive technology.
|
|
64
69
|
- The label is not shown on hover or focus. Sighted users who don't recognise the icon get no text, so keep IconButton to widely understood icons.
|
|
65
70
|
- A disabled IconButton stays in the tab order, and Enter and Space do nothing; the blocked click still bubbles to an ancestor's `onClick` (see Clickable's Rules). State is never color alone: disabled adds a dashed border.
|
|
71
|
+
- A loading IconButton is announced as busy under its `label`, stays in the tab order, and Enter and Space do nothing; the dots are hidden from assistive technology.
|
|
66
72
|
- Every size is at least 24 by 24 CSS px (WCAG 2.2 target size); the icon on each variant passes 4.5:1 at rest and on hover in light and dark modes. Under forced colors it keeps Button's system colors, `ghost`'s `CanvasText` border included, and drops `primary`'s glow.
|
|
67
73
|
|
|
68
74
|
## Props
|
|
@@ -73,10 +79,12 @@ Generated from the TypeScript types.
|
|
|
73
79
|
|
|
74
80
|
| Prop | Type | Required | Description |
|
|
75
81
|
| --- | --- | --- | --- |
|
|
82
|
+
| `aria-busy` | `"false" \| "true" \| boolean` | no | |
|
|
76
83
|
| `as` | `ElementType` | no | |
|
|
77
84
|
| `disabled` | `boolean` | no | |
|
|
78
85
|
| `icon` | `ComponentType` | yes | |
|
|
79
86
|
| `label` | `string` | yes | |
|
|
87
|
+
| `loading` | `boolean` | no | |
|
|
80
88
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
81
89
|
| `variant` | `"ghost" \| "primary" \| "secondary"` | no | |
|
|
82
90
|
|