@jonmilner/ui 0.21.1 → 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/ColorField.css +1 -1
- 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/NumberField.css +1 -1
- package/dist/NumberField/index.mjs +17 -17
- package/dist/RadioGroup/index.mjs +23 -23
- package/dist/SearchField/SearchField.css +1 -1
- 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/TextField.css +1 -1
- package/dist/TextField/index.mjs +16 -16
- package/dist/Textarea/Textarea.css +1 -1
- 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/popup/tooltip.mjs
CHANGED
|
@@ -1,81 +1,87 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { Box as e } from "../Box/base.mjs";
|
|
3
|
+
import { join as t } from "../styles/join.mjs";
|
|
4
|
+
import { splitStyleProps as n } from "../styles/split-style-props.mjs";
|
|
5
|
+
import { TriggerDirection as r, usePhysicalSide as i, useTriggerDirection as a } from "./direction.mjs";
|
|
6
|
+
import { createContext as o, use as s, useCallback as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
7
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
8
|
+
import { Tooltip as m } from "@base-ui/react/tooltip";
|
|
8
9
|
// src/popup/tooltip.tsx
|
|
9
|
-
var
|
|
10
|
+
var h = o({
|
|
10
11
|
attach: () => {},
|
|
11
12
|
container: null,
|
|
12
13
|
describes: !0,
|
|
13
14
|
id: void 0
|
|
14
15
|
});
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
e &&
|
|
18
|
-
}, []),
|
|
19
|
-
id:
|
|
16
|
+
function g({ describes: e = !0, children: t, onOpenChange: n, ...i }) {
|
|
17
|
+
let o = l(), s = d(null), [g, _] = a(i.open ?? i.defaultOpen, s, n), [v, y] = f(null), b = c((e) => {
|
|
18
|
+
s.current = e, e && y(e.closest("[data-brand]") ?? e.ownerDocument.body);
|
|
19
|
+
}, []), x = u(() => ({
|
|
20
|
+
id: i.disabled || !e ? void 0 : o,
|
|
20
21
|
describes: e,
|
|
21
|
-
container:
|
|
22
|
-
attach:
|
|
22
|
+
container: v,
|
|
23
|
+
attach: b
|
|
23
24
|
}), [
|
|
24
|
-
|
|
25
|
+
i.disabled,
|
|
25
26
|
e,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
o,
|
|
28
|
+
v,
|
|
29
|
+
b
|
|
29
30
|
]);
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
value:
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
children:
|
|
31
|
+
return /* @__PURE__ */ p(h, {
|
|
32
|
+
value: x,
|
|
33
|
+
children: /* @__PURE__ */ p(r, {
|
|
34
|
+
value: g,
|
|
35
|
+
children: /* @__PURE__ */ p(m.Root, {
|
|
36
|
+
...i,
|
|
37
|
+
onOpenChange: _,
|
|
38
|
+
children: t
|
|
39
|
+
})
|
|
35
40
|
})
|
|
36
41
|
});
|
|
37
42
|
}
|
|
38
|
-
function
|
|
39
|
-
let { attach: t } =
|
|
40
|
-
return /* @__PURE__ */
|
|
43
|
+
function _({ render: e }) {
|
|
44
|
+
let { attach: t } = s(h);
|
|
45
|
+
return /* @__PURE__ */ p(m.Trigger, {
|
|
41
46
|
id: e.props.id,
|
|
42
47
|
ref: t,
|
|
43
48
|
render: e
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
|
-
function
|
|
47
|
-
let { container: t, describes: n } =
|
|
48
|
-
return /* @__PURE__ */
|
|
51
|
+
function v({ children: e }) {
|
|
52
|
+
let { container: t, describes: n } = s(h);
|
|
53
|
+
return /* @__PURE__ */ p(m.Portal, {
|
|
49
54
|
container: t,
|
|
50
55
|
keepMounted: n,
|
|
51
56
|
children: e
|
|
52
57
|
});
|
|
53
58
|
}
|
|
54
|
-
function
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
...
|
|
59
|
+
function y({ className: e, side: r = "top", ...a }) {
|
|
60
|
+
return /* @__PURE__ */ p(m.Positioner, {
|
|
61
|
+
...a,
|
|
57
62
|
collisionPadding: 8,
|
|
58
63
|
render: (r) => {
|
|
59
|
-
let [, i] =
|
|
60
|
-
return /* @__PURE__ */
|
|
64
|
+
let [, i] = n(r);
|
|
65
|
+
return /* @__PURE__ */ p(b, {
|
|
61
66
|
...i,
|
|
62
|
-
className: e
|
|
67
|
+
className: t(e, i.className)
|
|
63
68
|
});
|
|
64
69
|
},
|
|
70
|
+
side: i(r),
|
|
65
71
|
sideOffset: 4
|
|
66
72
|
});
|
|
67
73
|
}
|
|
68
|
-
function
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
...
|
|
74
|
+
function b(t) {
|
|
75
|
+
return /* @__PURE__ */ p(e, {
|
|
76
|
+
...t,
|
|
71
77
|
zIndex: "tooltip"
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
|
-
function
|
|
75
|
-
return /* @__PURE__ */
|
|
80
|
+
function x(e) {
|
|
81
|
+
return /* @__PURE__ */ p(m.Popup, {
|
|
76
82
|
...e,
|
|
77
|
-
id:
|
|
83
|
+
id: s(h).id,
|
|
78
84
|
role: "tooltip"
|
|
79
85
|
});
|
|
80
86
|
}
|
|
81
|
-
export {
|
|
87
|
+
export { _ as TooltipElementTrigger, h as TooltipLink, x as TooltipPopupPart, v as TooltipPortal, y as TooltipPositioner, g as TooltipRootScope };
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { fallbackFaces as e, fallbackFamily as t, fallbackPairs as n, fontFeatures as r, fontStack as i, fontTracking as a, fontTrim as o, isFeatures as s, isTracking as c } from "../brands/font.mjs";
|
|
2
|
+
import { forcedColors as l } from "../brands/forced-colors.mjs";
|
|
3
|
+
import { presets as u } from "../brands/index.mjs";
|
|
4
|
+
import { resolveColor as d } from "../contrast/color.mjs";
|
|
5
|
+
import { checkContrast as f, contrastPairs as p } from "../contrast/contrast.mjs";
|
|
6
|
+
import { checkMixes as m, contrastMixes as h } from "../contrast/mixes.mjs";
|
|
7
|
+
import { customProperty as g } from "../styles/custom-property.mjs";
|
|
8
|
+
import { vars as _ } from "../tokens/contract.mjs";
|
|
9
|
+
import { colorRoles as v, fontRoles as y } from "../tokens/roles.mjs";
|
|
10
10
|
// src/theme/define-theme.ts
|
|
11
11
|
var b = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), x = (e, t) => `${e} {\n${t.map(([e, t]) => ` ${e}: ${t};\n`).join("")}}`;
|
|
12
|
-
function S(
|
|
13
|
-
let
|
|
14
|
-
throw Error(`defineTheme("${
|
|
12
|
+
function S(d) {
|
|
13
|
+
let f = (e) => {
|
|
14
|
+
throw Error(`defineTheme("${d.name}"): ${e}`);
|
|
15
15
|
};
|
|
16
|
-
/^[a-z][\w-]*$/i.test(
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
for (let [e, t] of Object.entries(
|
|
20
|
-
for (let [e, t] of Object.entries(
|
|
21
|
-
t.tracking !== void 0 && !
|
|
22
|
-
for (let
|
|
16
|
+
/^[a-z][\w-]*$/i.test(d.name) || f("the name must be a CSS identifier");
|
|
17
|
+
let p = v.filter((e) => typeof d.color[e] != "string");
|
|
18
|
+
p.length > 0 && f(`color is missing ${p.map((e) => `color.${e}`).join(", ")}`);
|
|
19
|
+
for (let [e, t] of Object.entries(d.color)) C.test(t) && f(`color.${e} must be a single color value`);
|
|
20
|
+
for (let [e, t] of Object.entries(d.font)) {
|
|
21
|
+
t.tracking !== void 0 && !c(t.tracking) && f(`font.${e}.tracking must be a plain CSS length such as -0.01em or 0.5px, or normal: ${t.tracking}`), t.features !== void 0 && !s(t.features) && f(`font.${e}.features must be quoted four-letter tags such as "cv11", "ss03", or normal: ${t.features}`);
|
|
22
|
+
for (let r of [t.metrics, ...n(t).flatMap(({ fallback: e }) => [e, ...Object.values(e.variants ?? {})])].flatMap((e) => [
|
|
23
23
|
e.familyName,
|
|
24
24
|
e.fullName,
|
|
25
25
|
e.postscriptName
|
|
26
|
-
]))
|
|
26
|
+
])) r !== void 0 && (C.test(r) || /["'\n]/.test(r)) && f(`font.${e} has a font name with quotes or CSS syntax: ${r}`);
|
|
27
27
|
}
|
|
28
|
-
process.env.NODE_ENV !== "production" && O(
|
|
29
|
-
let
|
|
28
|
+
process.env.NODE_ENV !== "production" && O(d, f);
|
|
29
|
+
let m = `[data-brand="${d.name}"]`, h = Object.values(d.font), S = Object.values(u).flatMap((e) => Object.values(e.font)), T;
|
|
30
30
|
try {
|
|
31
|
-
T =
|
|
31
|
+
T = e([...S, ...h]);
|
|
32
32
|
} catch (e) {
|
|
33
|
-
return
|
|
33
|
+
return f(e.message);
|
|
34
34
|
}
|
|
35
|
-
let E = new Set(
|
|
36
|
-
for (let [
|
|
35
|
+
let E = new Set(h.flatMap(n).map(t));
|
|
36
|
+
for (let [t, n] of e(S)) E.delete(t), T.get(t).length > n.length && f(`"${t}" is declared with a weight or style base.css lacks`);
|
|
37
37
|
let D = [
|
|
38
38
|
...[...T].filter(([e]) => E.has(e)).flatMap(([e, t]) => t.map((t) => x("@font-face", [["font-family", `"${e}"`], ...Object.entries(t).map(([e, t]) => [b(e), t])]))),
|
|
39
|
-
x(
|
|
40
|
-
let
|
|
39
|
+
x(m, [...v.map((e) => [g(_.color[e]), d.color[e]]), ...y.flatMap((e) => {
|
|
40
|
+
let t = o(d.font[e].metrics);
|
|
41
41
|
return [
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
42
|
+
[g(_.font[e]), i(d.font[e])],
|
|
43
|
+
[g(_.fontTrim[e].cap), t.cap],
|
|
44
|
+
[g(_.fontTrim[e].baseline), t.baseline],
|
|
45
|
+
[g(_.fontTracking[e]), a(d.font[e])],
|
|
46
|
+
[g(_.fontFeatures[e]), r(d.font[e])]
|
|
47
47
|
];
|
|
48
48
|
})]),
|
|
49
|
-
`@media (forced-colors: active) {\n${x(
|
|
49
|
+
`@media (forced-colors: active) {\n${x(m, v.map((e) => [g(_.color[e]), l[e]])).split("\n").map((e) => ` ${e}`).join("\n")}\n}`
|
|
50
50
|
].join("\n");
|
|
51
51
|
return {
|
|
52
|
-
brand:
|
|
53
|
-
href: `ui-theme-${
|
|
52
|
+
brand: d,
|
|
53
|
+
href: `ui-theme-${d.name}-${w(D)}`,
|
|
54
54
|
css: D
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -60,29 +60,29 @@ function w(e) {
|
|
|
60
60
|
for (let n = 0; n < e.length; n++) t = Math.imul(t ^ e.charCodeAt(n), 16777619);
|
|
61
61
|
return (t >>> 0).toString(36);
|
|
62
62
|
}
|
|
63
|
-
var T = /var\(\s*--color-([a-z-]+)\s*\)/g, E = new Map(
|
|
63
|
+
var T = /var\(\s*--color-([a-z-]+)\s*\)/g, E = new Map(v.map((e) => [b(e), e])), D = new Set(p.filter((e) => !e.over).map((e) => e.bg));
|
|
64
64
|
function O(e, t) {
|
|
65
65
|
let n = (r, i = []) => (i.includes(r) && t(`color.${r} references itself through var()`), e.color[r].replace(T, (e, t) => {
|
|
66
66
|
let a = E.get(t);
|
|
67
67
|
return a ? n(a, [...i, r]) : e;
|
|
68
|
-
})), r = Object.fromEntries(
|
|
69
|
-
for (let n of
|
|
68
|
+
})), r = Object.fromEntries(v.map((e) => [e, n(e)]));
|
|
69
|
+
for (let n of v) {
|
|
70
70
|
r[n].includes("var(") && t(`color.${n} is ${e.color[n]}: the contrast check needs literal colors, so use var() only to reference another color role`);
|
|
71
71
|
for (let i of ["light", "dark"]) {
|
|
72
72
|
let a;
|
|
73
73
|
try {
|
|
74
|
-
({alpha: a} =
|
|
74
|
+
({alpha: a} = d(r[n], i));
|
|
75
75
|
} catch (r) {
|
|
76
76
|
return t(`color.${n} is ${e.color[n]}, which the contrast check cannot resolve (${r.message}). Use hex, rgb(), oklab(), oklch(), color-mix() or light-dark(); named colors other than white, black and transparent are not supported`);
|
|
77
77
|
}
|
|
78
78
|
a < 1 && D.has(n) && t(`color.${n} is translucent in ${i} mode, but it is a background in a contrast pair and must be opaque`);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
for (let { name: e, fill: n, over: i } of
|
|
81
|
+
for (let { name: e, fill: n, over: i } of h) for (let a of ["light", "dark"]) !i && d(n(r), a).alpha < 1 && t(`the ${e} is translucent in ${a} mode: the roles it mixes must be opaque`);
|
|
82
82
|
let i = {
|
|
83
83
|
...e,
|
|
84
84
|
color: r
|
|
85
|
-
}, a =
|
|
85
|
+
}, a = f(i), o = [...a, ...m(i).filter((e) => !a.some((t) => t.fg === e.fg && t.mode === e.mode && t.ratio === e.ratio)).map(({ mix: e, ...t }) => ({
|
|
86
86
|
...t,
|
|
87
87
|
bg: `the ${e}`
|
|
88
88
|
}))].toSorted((e, t) => e.mode === t.mode ? 0 : e.mode === "light" ? -1 : 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jonmilner/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"ui-doctor": "./dist/cli/ui-doctor.mjs"
|
|
6
6
|
},
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
"@vanilla-extract/css": "1.21.3",
|
|
204
204
|
"@vanilla-extract/vite-plugin": "5.2.6",
|
|
205
205
|
"ajv": "8.20.0",
|
|
206
|
-
"lucide-static": "1.
|
|
206
|
+
"lucide-static": "1.68.0",
|
|
207
207
|
"playwright": "1.65.0",
|
|
208
208
|
"publint": "0.3.25",
|
|
209
209
|
"react": "19.3.1",
|