@jonmilner/ui 0.13.0 → 0.13.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/dist/Badge/Badge.css +1 -1
- package/dist/Badge/Badge.css.mjs +19 -2
- package/dist/Badge/index.d.mts +3 -2
- package/dist/Badge/index.mjs +37 -23
- package/dist/Button/index.d.mts +3 -5
- package/dist/Button/index.mjs +45 -47
- package/dist/Switch/Switch.css +1 -1
- package/dist/Switch/Switch.css.mjs +5 -2
- package/dist/Switch/index.d.mts +2 -1
- package/dist/Switch/index.mjs +48 -39
- package/dist/Tag/Tag.css +1 -1
- package/dist/Tag/Tag.css.mjs +16 -2
- package/dist/Tag/index.d.mts +3 -2
- package/dist/Tag/index.mjs +51 -54
- package/dist/Text/Text.css +1 -1
- package/dist/docs/Badge.md +19 -2
- package/dist/docs/Switch.md +4 -2
- package/dist/docs/Tag.md +9 -0
- package/dist/docs/manifest.json +30 -1
- package/dist/icon-slot/gap.mjs +12 -0
- package/dist/icon-slot/slot.d.mts +6 -0
- package/dist/icon-slot/slot.mjs +39 -0
- package/dist/styles/capped.mjs +23 -0
- package/dist/tokens/contract.mjs +6 -6
- package/package.json +1 -1
package/dist/Badge/Badge.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.avatar, components.badge, components.button, components.chip, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.nav-list, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.table;
|
|
2
|
-
@layer components.badge{._1ixfil10{border-width:var(--space-1);border-style:solid;border-color:#0000}@media (forced-colors:active){._1ixfil10{color:canvastext;background-color:canvas;border-color:canvastext}}}
|
|
2
|
+
@layer components.badge{._1ixfil10{border-width:var(--space-1);border-style:solid;border-color:#0000}._1ixfil1d{vertical-align:calc((1cap - var(--font-size-xs)) / 2);margin-inline-end:var(--space-4);display:inline-block}._1ixfil1e{vertical-align:calc((1cap - var(--font-size-sm)) / 2);margin-inline-end:var(--space-4);display:inline-block}._1ixfil1f{vertical-align:calc((1cap - var(--font-size-med)) / 2);margin-inline-end:var(--space-8);display:inline-block}._1ixfil1g{vertical-align:calc((1cap - var(--font-size-xs)) / 2);margin-inline-start:var(--space-4);display:inline-block}._1ixfil1h{vertical-align:calc((1cap - var(--font-size-sm)) / 2);margin-inline-start:var(--space-4);display:inline-block}._1ixfil1i{vertical-align:calc((1cap - var(--font-size-med)) / 2);margin-inline-start:var(--space-8);display:inline-block}._1ixfil1j{vertical-align:top;max-inline-size:calc(100% - var(--font-size-xs) - var(--space-4));display:inline-block}._1ixfil1k{vertical-align:top;max-inline-size:calc(100% - var(--font-size-sm) - var(--space-4));display:inline-block}._1ixfil1l{vertical-align:top;max-inline-size:calc(100% - var(--font-size-med) - var(--space-8));display:inline-block}:where([data-text-reveal]:hover,[data-text-reveal]:focus-within) ._1ixfil1m{max-inline-size:none;display:inline}@media (forced-colors:active){._1ixfil10{color:canvastext;background-color:canvas;border-color:canvastext}}}
|
package/dist/Badge/Badge.css.mjs
CHANGED
|
@@ -27,5 +27,22 @@ var t = "_1ixfil10", n = e({
|
|
|
27
27
|
},
|
|
28
28
|
defaultVariants: {},
|
|
29
29
|
compoundVariants: []
|
|
30
|
-
})
|
|
31
|
-
|
|
30
|
+
}), r = {
|
|
31
|
+
start: {
|
|
32
|
+
xs: "_1ixfil1d",
|
|
33
|
+
sm: "_1ixfil1e",
|
|
34
|
+
med: "_1ixfil1f"
|
|
35
|
+
},
|
|
36
|
+
end: {
|
|
37
|
+
xs: "_1ixfil1g",
|
|
38
|
+
sm: "_1ixfil1h",
|
|
39
|
+
med: "_1ixfil1i"
|
|
40
|
+
},
|
|
41
|
+
clip: {
|
|
42
|
+
xs: "_1ixfil1j",
|
|
43
|
+
sm: "_1ixfil1k",
|
|
44
|
+
med: "_1ixfil1l"
|
|
45
|
+
},
|
|
46
|
+
reveal: "_1ixfil1m"
|
|
47
|
+
};
|
|
48
|
+
export { n as badge, t as root, r as slot };
|
package/dist/Badge/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { OmitEach } from "../types.mjs";
|
|
2
2
|
import { StyleProps } from "../Box/base.mjs";
|
|
3
|
+
import { IconSlotProps } from "../icon-slot/slot.mjs";
|
|
3
4
|
import { Tone } from "../styles/subtle-fills.mjs";
|
|
4
5
|
import { ComponentPropsWithRef } from "react";
|
|
5
|
-
export type BadgeOwnProps = {
|
|
6
|
+
export type BadgeOwnProps = IconSlotProps & {
|
|
6
7
|
size?: "xs" | "sm" | "med";
|
|
7
8
|
subtle?: boolean;
|
|
8
9
|
variant?: Tone;
|
|
9
10
|
};
|
|
10
11
|
export type BadgeProps = StyleProps & BadgeOwnProps & OmitEach<ComponentPropsWithRef<"span">, keyof StyleProps | keyof BadgeOwnProps>;
|
|
11
|
-
export declare function Badge({ variant, subtle, size, display, paddingInline, paddingBlock, borderRadius, backgroundColor, color, className, children, ...props }: BadgeProps): import("react").JSX.Element | null;
|
|
12
|
+
export declare function Badge({ variant, subtle, size, iconStart, iconEnd, display, paddingInline, paddingBlock, borderRadius, backgroundColor, color, maxInlineSize, className, style, children, ...props }: BadgeProps): import("react").JSX.Element | null;
|
package/dist/Badge/index.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { join as e } from "../styles/join.mjs";
|
|
2
2
|
import { Box as t } from "../Box/base.mjs";
|
|
3
3
|
import { Text as n } from "../Text/index.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { slotIcons as r } from "../icon-slot/slot.mjs";
|
|
5
|
+
import { capped as i } from "../styles/capped.mjs";
|
|
6
|
+
import { subtleFills as a } from "../styles/subtle-fills.mjs";
|
|
7
|
+
import { badge as o, root as s, slot as c } from "./Badge.css.mjs";
|
|
8
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
7
9
|
// src/Badge/index.tsx
|
|
8
|
-
var
|
|
10
|
+
var u = {
|
|
9
11
|
neutral: {
|
|
10
12
|
backgroundColor: "bgMuted",
|
|
11
13
|
color: "fgMuted"
|
|
@@ -30,7 +32,7 @@ var s = {
|
|
|
30
32
|
backgroundColor: "done",
|
|
31
33
|
color: "doneFg"
|
|
32
34
|
}
|
|
33
|
-
},
|
|
35
|
+
}, d = {
|
|
34
36
|
xs: {
|
|
35
37
|
paddingInline: "4",
|
|
36
38
|
paddingBlock: "2"
|
|
@@ -44,29 +46,41 @@ var s = {
|
|
|
44
46
|
paddingBlock: "6"
|
|
45
47
|
}
|
|
46
48
|
};
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
function f({ variant: f = "neutral", subtle: p = !1, size: m = "med", iconStart: h, iconEnd: g, display: _ = "inline-block", paddingInline: v = d[m].paddingInline, paddingBlock: y = d[m].paddingBlock, borderRadius: b = "sm", backgroundColor: x = (p ? a : u)[f].backgroundColor, color: S = (p ? a : u)[f].color, maxInlineSize: C, className: w, style: T, children: E, ...D }) {
|
|
50
|
+
if (E == null || typeof E == "boolean" || E === "") return null;
|
|
51
|
+
let O = i(C, T);
|
|
52
|
+
return /* @__PURE__ */ l(t, {
|
|
53
|
+
...D,
|
|
50
54
|
as: "span",
|
|
51
|
-
backgroundColor:
|
|
52
|
-
borderRadius:
|
|
53
|
-
className: e(
|
|
54
|
-
variant:
|
|
55
|
-
subtle:
|
|
56
|
-
size:
|
|
57
|
-
}),
|
|
58
|
-
color:
|
|
59
|
-
display:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
backgroundColor: x,
|
|
56
|
+
borderRadius: b,
|
|
57
|
+
className: e(s, o({
|
|
58
|
+
variant: f,
|
|
59
|
+
subtle: p,
|
|
60
|
+
size: m
|
|
61
|
+
}), w),
|
|
62
|
+
color: S,
|
|
63
|
+
display: _,
|
|
64
|
+
maxInlineSize: C,
|
|
65
|
+
paddingBlock: y,
|
|
66
|
+
paddingInline: v,
|
|
67
|
+
style: T,
|
|
68
|
+
children: /* @__PURE__ */ l(n, {
|
|
63
69
|
as: "span",
|
|
64
70
|
font: "label",
|
|
65
|
-
size:
|
|
71
|
+
size: m,
|
|
72
|
+
truncate: O,
|
|
66
73
|
weight: "medium",
|
|
67
74
|
wrap: "nowrap",
|
|
68
|
-
children:
|
|
75
|
+
children: r({
|
|
76
|
+
iconStart: h,
|
|
77
|
+
iconEnd: g,
|
|
78
|
+
size: m,
|
|
79
|
+
styles: c,
|
|
80
|
+
truncate: O,
|
|
81
|
+
children: E
|
|
82
|
+
})
|
|
69
83
|
})
|
|
70
84
|
});
|
|
71
85
|
}
|
|
72
|
-
export {
|
|
86
|
+
export { f as Badge };
|
package/dist/Button/index.d.mts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { PolymorphicProps } from "../types.mjs";
|
|
2
2
|
import { StyleProps } from "../Box/base.mjs";
|
|
3
3
|
import { ClickableOwnProps } from "../Clickable/index.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export type ButtonOwnProps = {
|
|
7
|
-
iconEnd?: ComponentType<IconProps>;
|
|
8
|
-
iconStart?: ComponentType<IconProps>;
|
|
4
|
+
import { IconSlotProps } from "../icon-slot/slot.mjs";
|
|
5
|
+
import { ElementType } from "react";
|
|
6
|
+
export type ButtonOwnProps = IconSlotProps & {
|
|
9
7
|
loading?: boolean;
|
|
10
8
|
size?: "sm" | "med" | "lg";
|
|
11
9
|
variant?: "primary" | "secondary" | "ghost" | "danger";
|
package/dist/Button/index.mjs
CHANGED
|
@@ -2,90 +2,88 @@ import { join as e } from "../styles/join.mjs";
|
|
|
2
2
|
import { Box as t } from "../Box/base.mjs";
|
|
3
3
|
import { Clickable as n } from "../Clickable/index.mjs";
|
|
4
4
|
import { Icon as r } from "../Icon/index.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { iconGap as i } from "../icon-slot/gap.mjs";
|
|
6
|
+
import { fills as a } from "../styles/button-fills.mjs";
|
|
7
|
+
import { content as o, stack as s } from "../styles/button-parts.css.mjs";
|
|
8
|
+
import { controlHeight as c, controlText as l } from "../styles/control-size.mjs";
|
|
9
|
+
import { Text as u } from "../Text/index.mjs";
|
|
10
|
+
import { button as d, content as f, root as p, stack as m } from "./Button.css.mjs";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
12
|
// src/Button/index.tsx
|
|
12
|
-
var
|
|
13
|
+
var _ = {
|
|
13
14
|
sm: {
|
|
14
|
-
minBlockSize:
|
|
15
|
+
minBlockSize: c.sm,
|
|
15
16
|
paddingBlock: "4",
|
|
16
|
-
paddingInline: "8"
|
|
17
|
-
gap: "4"
|
|
17
|
+
paddingInline: "8"
|
|
18
18
|
},
|
|
19
19
|
med: {
|
|
20
|
-
minBlockSize:
|
|
20
|
+
minBlockSize: c.med,
|
|
21
21
|
paddingBlock: "6",
|
|
22
|
-
paddingInline: "12"
|
|
23
|
-
gap: "4"
|
|
22
|
+
paddingInline: "12"
|
|
24
23
|
},
|
|
25
24
|
lg: {
|
|
26
|
-
minBlockSize:
|
|
25
|
+
minBlockSize: c.lg,
|
|
27
26
|
paddingBlock: "8",
|
|
28
|
-
paddingInline: "16"
|
|
29
|
-
gap: "8"
|
|
27
|
+
paddingInline: "16"
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
...
|
|
36
|
-
backgroundColor:
|
|
37
|
-
borderRadius:
|
|
38
|
-
busy:
|
|
39
|
-
className: e(
|
|
40
|
-
variant:
|
|
41
|
-
size:
|
|
42
|
-
}),
|
|
43
|
-
color:
|
|
44
|
-
minBlockSize:
|
|
45
|
-
paddingBlock:
|
|
46
|
-
paddingInline:
|
|
47
|
-
children: /* @__PURE__ */
|
|
30
|
+
function v({ variant: c = "secondary", size: v = "med", loading: y = !1, iconStart: b, iconEnd: x, minBlockSize: S = _[v].minBlockSize, paddingBlock: C = _[v].paddingBlock, paddingInline: w = _[v].paddingInline, gap: T = i[l[v]], borderRadius: E = "full", backgroundColor: D = a[c].backgroundColor, color: O = a[c].color, className: k, children: A, "aria-busy": j, ...M }) {
|
|
31
|
+
let N = y || String(j) === "true", P = M, F = l[v];
|
|
32
|
+
return /* @__PURE__ */ h(n, {
|
|
33
|
+
...P,
|
|
34
|
+
backgroundColor: D,
|
|
35
|
+
borderRadius: E,
|
|
36
|
+
busy: N,
|
|
37
|
+
className: e(p, d({
|
|
38
|
+
variant: c,
|
|
39
|
+
size: v
|
|
40
|
+
}), k),
|
|
41
|
+
color: O,
|
|
42
|
+
minBlockSize: S,
|
|
43
|
+
paddingBlock: C,
|
|
44
|
+
paddingInline: w,
|
|
45
|
+
children: /* @__PURE__ */ g(t, {
|
|
48
46
|
alignItems: "center",
|
|
49
47
|
as: "span",
|
|
50
|
-
className: e(
|
|
48
|
+
className: e(m, s),
|
|
51
49
|
display: "grid",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
50
|
+
children: [/* @__PURE__ */ g(t, {
|
|
53
51
|
alignItems: "center",
|
|
54
52
|
as: "span",
|
|
55
|
-
className: e(
|
|
53
|
+
className: e(f, o),
|
|
56
54
|
display: "flex",
|
|
57
|
-
gap:
|
|
55
|
+
gap: T,
|
|
58
56
|
children: [
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
b && /* @__PURE__ */ h(b, { size: F }),
|
|
58
|
+
A != null && A !== !1 && A !== "" && /* @__PURE__ */ h(u, {
|
|
61
59
|
as: "span",
|
|
62
60
|
className: e("hkhd89", "_1gwwloa2"),
|
|
63
61
|
font: "label",
|
|
64
|
-
size:
|
|
62
|
+
size: F,
|
|
65
63
|
weight: "bold",
|
|
66
|
-
children:
|
|
64
|
+
children: A
|
|
67
65
|
}),
|
|
68
|
-
|
|
66
|
+
x && /* @__PURE__ */ h(x, { size: F })
|
|
69
67
|
]
|
|
70
|
-
}),
|
|
68
|
+
}), N && /* @__PURE__ */ g(r, {
|
|
71
69
|
className: "hkhd8d",
|
|
72
70
|
fill: "currentColor",
|
|
73
|
-
size:
|
|
71
|
+
size: F,
|
|
74
72
|
stroke: "none",
|
|
75
73
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ h("circle", {
|
|
77
75
|
className: "hkhd8e",
|
|
78
76
|
cx: "5",
|
|
79
77
|
cy: "12",
|
|
80
78
|
r: "2"
|
|
81
79
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ h("circle", {
|
|
83
81
|
className: "hkhd8e",
|
|
84
82
|
cx: "12",
|
|
85
83
|
cy: "12",
|
|
86
84
|
r: "2"
|
|
87
85
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ h("circle", {
|
|
89
87
|
className: "hkhd8e",
|
|
90
88
|
cx: "19",
|
|
91
89
|
cy: "12",
|
|
@@ -96,4 +94,4 @@ function _({ variant: s = "secondary", size: _ = "med", loading: v = !1, iconSta
|
|
|
96
94
|
})
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
|
-
export {
|
|
97
|
+
export { v as Button };
|
package/dist/Switch/Switch.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.avatar, components.badge, components.button, components.chip, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.nav-list, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.table;
|
|
2
|
-
@layer components.switch{.njq9m00{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}.
|
|
2
|
+
@layer components.switch{.njq9m03{--njq9m00:var(--space-12);--njq9m01:var(--space-1);--njq9m02:calc(var(--distance-sm) + var(--distance-med))}.njq9m04{--njq9m00:var(--space-16);--njq9m01:var(--space-2);--njq9m02:var(--distance-lg)}.njq9m05{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}.njq9m06{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;min-inline-size:var(--size-xs);min-block-size:var(--size-xs);border-radius:var(--radius-full);flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.njq9m06:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}.njq9m06[aria-disabled=true]{cursor:not-allowed}.njq9m06[aria-readonly=true]{cursor:default}.njq9m06[aria-busy=true]{cursor:progress}.njq9m07{grid-template-columns:repeat(2, var(--njq9m00));padding:var(--njq9m01);border:var(--space-1) solid var(--color-border-strong);border-radius:var(--radius-full);background-color:var(--color-bg);forced-color-adjust:none;align-items:center;display:grid}.njq9m06:not([aria-checked=true],[aria-invalid=true],[aria-disabled=true],[aria-readonly=true]):hover .njq9m07{border-color:var(--color-fg)}.njq9m06[aria-checked=true] .njq9m07{background-color:var(--color-accent);border-color:var(--color-accent)}.njq9m06[aria-readonly=true]:not([aria-busy=true]) .njq9m07{background-clip:padding-box;border-style:dotted}.njq9m06[aria-busy=true] .njq9m07{opacity:.5}.njq9m06[aria-disabled=true] .njq9m07{border-style:dashed;border-color:var(--color-border-strong);background-clip:border-box;background-color:var(--color-bg-muted)}.njq9m06[aria-invalid=true] .njq9m07{padding:calc(var(--njq9m01) - var(--space-1));border-width:var(--space-2);border-color:var(--color-danger)}.njq9m08{inline-size:var(--njq9m00);block-size:var(--njq9m00);border-radius:var(--radius-full);transition:opacity var(--duration-med) var(--easing-standard), translate var(--duration-med) var(--easing-standard);background-color:var(--color-fg-muted);grid-area:1/1/auto/-1;justify-self:start}.njq9m06[aria-checked=true] .njq9m08{opacity:0;translate:calc(var(--dir) * var(--njq9m02))}.njq9m09{inline-size:var(--njq9m00);block-size:var(--njq9m00);border-radius:var(--radius-full);transition:opacity var(--duration-med) var(--easing-standard), translate var(--duration-med) var(--easing-standard);background-color:var(--color-accent-fg);opacity:0;translate:calc(-1 * var(--dir) * var(--njq9m02));grid-area:1/1/auto/-1;justify-self:end}.njq9m06[aria-checked=true] .njq9m09{opacity:1;translate:0}.njq9m06[aria-disabled=true] .njq9m09{background-color:var(--color-fg-muted)}}
|
|
@@ -3,5 +3,8 @@ import "./Switch.css";
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
// src/Switch/Switch.css.ts
|
|
6
|
-
var e =
|
|
7
|
-
|
|
6
|
+
var e = {
|
|
7
|
+
sm: "njq9m03",
|
|
8
|
+
med: "njq9m04"
|
|
9
|
+
}, t = "njq9m05", n = "njq9m06", r = "njq9m07", i = "njq9m08", a = "njq9m09";
|
|
10
|
+
export { t as hiddenLabel, i as offThumb, a as onThumb, n as root, e as size, r as track };
|
package/dist/Switch/index.d.mts
CHANGED
|
@@ -21,9 +21,10 @@ export type SwitchProps = StyleProps & SwitchName & {
|
|
|
21
21
|
onCheckedChange?: (checked: boolean) => void;
|
|
22
22
|
readOnly?: boolean;
|
|
23
23
|
required?: boolean;
|
|
24
|
+
size?: "sm" | "med";
|
|
24
25
|
style?: CSSProperties;
|
|
25
26
|
uncheckedValue?: string;
|
|
26
27
|
value?: string;
|
|
27
28
|
};
|
|
28
|
-
export declare function Switch({ label, hideLabel, "aria-label": ariaLabel, checked, defaultChecked, onCheckedChange, description, error, name, value, uncheckedValue, disabled, readOnly, required, busy, className, style, ...atoms }: SwitchProps): import("react").JSX.Element;
|
|
29
|
+
export declare function Switch({ label, hideLabel, "aria-label": ariaLabel, checked, defaultChecked, onCheckedChange, description, error, name, value, uncheckedValue, disabled, readOnly, required, busy, size, className, style, ...atoms }: SwitchProps): import("react").JSX.Element;
|
|
29
30
|
export {};
|
package/dist/Switch/index.mjs
CHANGED
|
@@ -1,59 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { join as e } from "../styles/join.mjs";
|
|
2
|
+
import { Box as t } from "../Box/base.mjs";
|
|
3
|
+
import { controlText as n } from "../styles/control-size.mjs";
|
|
4
|
+
import { Field as r } from "../Field/index.mjs";
|
|
5
|
+
import { offThumb as i, onThumb as a, root as o, size as s, track as c } from "./Switch.css.mjs";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { Switch as d } from "@base-ui/react/switch";
|
|
6
8
|
// src/Switch/index.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
...
|
|
11
|
-
className:
|
|
12
|
-
disabled:
|
|
13
|
-
invalid:
|
|
14
|
-
style:
|
|
9
|
+
function f({ label: f, hideLabel: p = !1, "aria-label": m, checked: h, defaultChecked: g, onCheckedChange: _, description: v, error: y, name: b, value: x, uncheckedValue: S, disabled: C = !1, readOnly: w = !1, required: T = !1, busy: E = !1, size: D = "med", className: O, style: k, ...A }) {
|
|
10
|
+
let j = E && !w && !C;
|
|
11
|
+
return /* @__PURE__ */ u(r, {
|
|
12
|
+
...A,
|
|
13
|
+
className: O,
|
|
14
|
+
disabled: C,
|
|
15
|
+
invalid: y != null && y !== !1 && y !== "",
|
|
16
|
+
style: k,
|
|
15
17
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ u(t, {
|
|
17
19
|
alignItems: "center",
|
|
18
20
|
as: "div",
|
|
19
21
|
display: "flex",
|
|
20
22
|
gap: "8",
|
|
21
|
-
children: [/* @__PURE__ */
|
|
22
|
-
"aria-busy":
|
|
23
|
-
"aria-label":
|
|
24
|
-
checked:
|
|
25
|
-
defaultChecked:
|
|
26
|
-
name:
|
|
27
|
-
onCheckedChange:
|
|
28
|
-
readOnly:
|
|
29
|
-
render: /* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ l(d.Root, {
|
|
24
|
+
"aria-busy": j || void 0,
|
|
25
|
+
"aria-label": m,
|
|
26
|
+
checked: h,
|
|
27
|
+
defaultChecked: g,
|
|
28
|
+
name: b,
|
|
29
|
+
onCheckedChange: _ && ((e) => _(e)),
|
|
30
|
+
readOnly: w || j,
|
|
31
|
+
render: /* @__PURE__ */ l(t, {
|
|
30
32
|
as: "span",
|
|
31
|
-
className:
|
|
33
|
+
className: e(o, s[D])
|
|
32
34
|
}),
|
|
33
|
-
required:
|
|
34
|
-
uncheckedValue:
|
|
35
|
-
value:
|
|
36
|
-
children: /* @__PURE__ */
|
|
35
|
+
required: T,
|
|
36
|
+
uncheckedValue: S,
|
|
37
|
+
value: x,
|
|
38
|
+
children: /* @__PURE__ */ u(t, {
|
|
37
39
|
as: "span",
|
|
38
|
-
className:
|
|
39
|
-
children: [/* @__PURE__ */
|
|
40
|
+
className: c,
|
|
41
|
+
children: [/* @__PURE__ */ l(t, {
|
|
40
42
|
"aria-hidden": "true",
|
|
41
43
|
as: "span",
|
|
42
|
-
className:
|
|
43
|
-
}), /* @__PURE__ */
|
|
44
|
+
className: i
|
|
45
|
+
}), /* @__PURE__ */ l(t, {
|
|
44
46
|
"aria-hidden": "true",
|
|
45
47
|
as: "span",
|
|
46
|
-
className:
|
|
48
|
+
className: a
|
|
47
49
|
})]
|
|
48
50
|
})
|
|
49
|
-
}),
|
|
50
|
-
className:
|
|
51
|
-
|
|
51
|
+
}), f != null && /* @__PURE__ */ l(r.Label, {
|
|
52
|
+
className: p ? "njq9m05" : void 0,
|
|
53
|
+
size: n[D],
|
|
54
|
+
children: f
|
|
52
55
|
})]
|
|
53
56
|
}),
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
v != null && /* @__PURE__ */ l(r.Description, {
|
|
58
|
+
size: n[D],
|
|
59
|
+
children: v
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ l(r.Error, {
|
|
62
|
+
size: n[D],
|
|
63
|
+
children: y
|
|
64
|
+
})
|
|
56
65
|
]
|
|
57
66
|
});
|
|
58
67
|
}
|
|
59
|
-
export {
|
|
68
|
+
export { f as Switch };
|
package/dist/Tag/Tag.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.avatar, components.badge, components.button, components.chip, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.nav-list, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.table;
|
|
2
|
-
@layer components.tag{._1jsyd8s0{border-width:var(--space-1);border-style:solid;border-color:#0000}._1jsyd8s1{overflow-wrap:anywhere}._1jsyd8s0:hover ._1jsyd8s1,._1jsyd8s0:focus-within ._1jsyd8s1{padding-block:var(--space-4);margin-block:0}._1jsyd8s2{text-decoration:underline}._1jsyd8s3:hover{background-color:var(--color-bg)}@media (forced-colors:active){._1jsyd8s0{color:canvastext;background-color:canvas;border-color:canvastext}}}
|
|
2
|
+
@layer components.tag{._1jsyd8s0{border-width:var(--space-1);border-style:solid;border-color:#0000}._1jsyd8s1{overflow-wrap:anywhere}._1jsyd8s0:hover ._1jsyd8s1,._1jsyd8s0:focus-within ._1jsyd8s1{padding-block:var(--space-4);margin-block:0}._1jsyd8s2{text-decoration:underline}._1jsyd8s3:hover{background-color:var(--color-bg)}._1jsyd8sd{vertical-align:calc((1cap - var(--font-size-sm)) / 2);margin-inline-end:var(--space-4);display:inline-block}._1jsyd8se{vertical-align:calc((1cap - var(--font-size-med)) / 2);margin-inline-end:var(--space-8);display:inline-block}._1jsyd8sf{vertical-align:calc((1cap - var(--font-size-sm)) / 2);margin-inline-start:var(--space-4);display:inline-block}._1jsyd8sg{vertical-align:calc((1cap - var(--font-size-med)) / 2);margin-inline-start:var(--space-8);display:inline-block}._1jsyd8sh{vertical-align:top;max-inline-size:calc(100% - var(--font-size-sm) - var(--space-4));display:inline-block}._1jsyd8si{vertical-align:top;max-inline-size:calc(100% - var(--font-size-med) - var(--space-8));display:inline-block}:where([data-text-reveal]:hover,[data-text-reveal]:focus-within) ._1jsyd8sj{max-inline-size:none;display:inline}@media (forced-colors:active){._1jsyd8s0{color:canvastext;background-color:canvas;border-color:canvastext}}}
|
package/dist/Tag/Tag.css.mjs
CHANGED
|
@@ -22,5 +22,19 @@ var t = "_1jsyd8s0", n = "_1jsyd8s1", r = "_1jsyd8s2", i = "_1jsyd8s3", a = e({
|
|
|
22
22
|
},
|
|
23
23
|
defaultVariants: {},
|
|
24
24
|
compoundVariants: []
|
|
25
|
-
})
|
|
26
|
-
|
|
25
|
+
}), o = {
|
|
26
|
+
start: {
|
|
27
|
+
sm: "_1jsyd8sd",
|
|
28
|
+
med: "_1jsyd8se"
|
|
29
|
+
},
|
|
30
|
+
end: {
|
|
31
|
+
sm: "_1jsyd8sf",
|
|
32
|
+
med: "_1jsyd8sg"
|
|
33
|
+
},
|
|
34
|
+
clip: {
|
|
35
|
+
sm: "_1jsyd8sh",
|
|
36
|
+
med: "_1jsyd8si"
|
|
37
|
+
},
|
|
38
|
+
reveal: "_1jsyd8sj"
|
|
39
|
+
};
|
|
40
|
+
export { n as label, r as link, i as remove, t as root, o as slot, a as tag };
|
package/dist/Tag/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { OmitEach } from "../types.mjs";
|
|
2
2
|
import { StyleProps } from "../Box/base.mjs";
|
|
3
|
+
import { IconSlotProps } from "../icon-slot/slot.mjs";
|
|
3
4
|
import { Tone } from "../styles/subtle-fills.mjs";
|
|
4
5
|
import { ComponentPropsWithRef } from "react";
|
|
5
|
-
export type TagOwnProps = {
|
|
6
|
+
export type TagOwnProps = IconSlotProps & {
|
|
6
7
|
href?: string;
|
|
7
8
|
onRemove?: () => void;
|
|
8
9
|
removeLabel?: string;
|
|
@@ -10,4 +11,4 @@ export type TagOwnProps = {
|
|
|
10
11
|
variant?: Tone;
|
|
11
12
|
};
|
|
12
13
|
export type TagProps = StyleProps & TagOwnProps & OmitEach<ComponentPropsWithRef<"span">, keyof StyleProps | keyof TagOwnProps>;
|
|
13
|
-
export declare function Tag({ variant, size, href, onRemove, removeLabel, display, alignItems, gap, minBlockSize, paddingInlineStart, paddingInlineEnd, borderRadius, backgroundColor, color, maxInlineSize, className, style, children, ...props }: TagProps): import("react").JSX.Element | null;
|
|
14
|
+
export declare function Tag({ variant, size, href, iconStart, iconEnd, onRemove, removeLabel, display, alignItems, gap, minBlockSize, paddingInlineStart, paddingInlineEnd, borderRadius, backgroundColor, color, maxInlineSize, className, style, children, ...props }: TagProps): import("react").JSX.Element | null;
|
package/dist/Tag/index.mjs
CHANGED
|
@@ -2,30 +2,20 @@ import { join as e } from "../styles/join.mjs";
|
|
|
2
2
|
import { Box as t } from "../Box/base.mjs";
|
|
3
3
|
import { Clickable as n } from "../Clickable/index.mjs";
|
|
4
4
|
import { Text as r } from "../Text/index.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { slotIcons as i } from "../icon-slot/slot.mjs";
|
|
6
|
+
import { capped as a } from "../styles/capped.mjs";
|
|
7
|
+
import { subtleFills as o } from "../styles/subtle-fills.mjs";
|
|
8
|
+
import { XIcon as s } from "../icons/XIcon.mjs";
|
|
9
|
+
import { label as c, link as l, root as u, slot as d, tag as f } from "./Tag.css.mjs";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
11
|
// src/Tag/index.tsx
|
|
11
|
-
function
|
|
12
|
+
function h(e) {
|
|
12
13
|
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
13
14
|
if (!Array.isArray(e)) return;
|
|
14
|
-
let t = e.map(
|
|
15
|
+
let t = e.map(h);
|
|
15
16
|
return t.every((e) => e !== void 0) ? t.join("") : void 0;
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
-
"",
|
|
19
|
-
"none",
|
|
20
|
-
"auto",
|
|
21
|
-
"initial",
|
|
22
|
-
"unset"
|
|
23
|
-
]);
|
|
24
|
-
function g(e, t) {
|
|
25
|
-
let n = t?.maxInlineSize ?? t?.maxWidth;
|
|
26
|
-
return n == null ? typeof e != "object" || !e ? m.has(e) : e.base != null && Object.values(e).every((e) => e == null || m.has(e)) : !h.has(String(n).trim()) && !/-content\b/.test(String(n));
|
|
27
|
-
}
|
|
28
|
-
var _ = {
|
|
18
|
+
var g = {
|
|
29
19
|
sm: {
|
|
30
20
|
paddingInlineStart: "6",
|
|
31
21
|
paddingInlineEnd: "6"
|
|
@@ -35,52 +25,59 @@ var _ = {
|
|
|
35
25
|
paddingInlineEnd: "8"
|
|
36
26
|
}
|
|
37
27
|
};
|
|
38
|
-
function
|
|
39
|
-
if (
|
|
40
|
-
let
|
|
28
|
+
function _({ variant: _ = "neutral", size: v = "med", href: y, iconStart: b, iconEnd: x, onRemove: S, removeLabel: C, display: w = "inline-flex", alignItems: T = "center", gap: E = "2", minBlockSize: D = "xs", paddingInlineStart: O = g[v].paddingInlineStart, paddingInlineEnd: k = S ? "2" : g[v].paddingInlineEnd, borderRadius: A = "lg", backgroundColor: j = o[_].backgroundColor, color: M = o[_].color, maxInlineSize: N, className: P, style: F, children: I, ...L }) {
|
|
29
|
+
if (I == null || typeof I == "boolean" || I === "" || h(I) === "") return null;
|
|
30
|
+
let R = a(N, F), z = /* @__PURE__ */ p(r, {
|
|
41
31
|
as: "span",
|
|
42
|
-
className:
|
|
32
|
+
className: c,
|
|
43
33
|
font: "label",
|
|
44
|
-
paddingBlock:
|
|
45
|
-
size:
|
|
46
|
-
truncate:
|
|
34
|
+
paddingBlock: R ? void 0 : "4",
|
|
35
|
+
size: v,
|
|
36
|
+
truncate: R,
|
|
47
37
|
weight: "medium",
|
|
48
|
-
children:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
children: i({
|
|
39
|
+
iconStart: b,
|
|
40
|
+
iconEnd: x,
|
|
41
|
+
size: v,
|
|
42
|
+
styles: d,
|
|
43
|
+
truncate: R,
|
|
44
|
+
children: I
|
|
45
|
+
})
|
|
46
|
+
}), B = h(I), V = C ?? (B === void 0 ? void 0 : `Remove ${B}`);
|
|
47
|
+
return /* @__PURE__ */ m(t, {
|
|
48
|
+
...L,
|
|
49
|
+
alignItems: T,
|
|
53
50
|
as: "span",
|
|
54
|
-
backgroundColor:
|
|
55
|
-
borderRadius:
|
|
56
|
-
className: e(
|
|
57
|
-
variant:
|
|
58
|
-
size:
|
|
59
|
-
}),
|
|
60
|
-
color:
|
|
51
|
+
backgroundColor: j,
|
|
52
|
+
borderRadius: A,
|
|
53
|
+
className: e(u, f({
|
|
54
|
+
variant: _,
|
|
55
|
+
size: v
|
|
56
|
+
}), P),
|
|
57
|
+
color: M,
|
|
61
58
|
"data-text-reveal": "",
|
|
62
|
-
display:
|
|
63
|
-
gap:
|
|
64
|
-
maxInlineSize:
|
|
65
|
-
minBlockSize:
|
|
66
|
-
paddingInlineEnd:
|
|
67
|
-
paddingInlineStart:
|
|
68
|
-
style:
|
|
69
|
-
children: [
|
|
59
|
+
display: w,
|
|
60
|
+
gap: E,
|
|
61
|
+
maxInlineSize: N,
|
|
62
|
+
minBlockSize: D,
|
|
63
|
+
paddingInlineEnd: k,
|
|
64
|
+
paddingInlineStart: O,
|
|
65
|
+
style: F,
|
|
66
|
+
children: [y ? /* @__PURE__ */ p(n, {
|
|
70
67
|
as: "a",
|
|
71
|
-
className:
|
|
72
|
-
href:
|
|
68
|
+
className: l,
|
|
69
|
+
href: y,
|
|
73
70
|
overflow: "hidden",
|
|
74
|
-
children:
|
|
75
|
-
}) :
|
|
71
|
+
children: z
|
|
72
|
+
}) : z, S && /* @__PURE__ */ p(n, {
|
|
76
73
|
alignSelf: "start",
|
|
77
|
-
"aria-label":
|
|
74
|
+
"aria-label": V ?? "Remove",
|
|
78
75
|
borderRadius: "full",
|
|
79
76
|
className: "_1jsyd8s3",
|
|
80
77
|
flexShrink: 0,
|
|
81
|
-
onClick:
|
|
82
|
-
children: /* @__PURE__ */
|
|
78
|
+
onClick: S,
|
|
79
|
+
children: /* @__PURE__ */ p(s, { size: v })
|
|
83
80
|
})]
|
|
84
81
|
});
|
|
85
82
|
}
|
|
86
|
-
export {
|
|
83
|
+
export { _ as Tag };
|
package/dist/Text/Text.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.avatar, components.badge, components.button, components.chip, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.nav-list, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.table;
|
|
2
|
-
@layer components.text{._1mgdisq3{--_1mgdisq0:var(--line-height-med);--_1mgdisq1:calc((var(--font-trim-body-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-body-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-body);font-size:var(--font-size-med);font-weight:var(--font-weight-regular);line-height:var(--_1mgdisq0)}._1mgdisq3:before{content:"";margin-block-end:var(--_1mgdisq1);display:table}._1mgdisq3:after{content:"";margin-block-start:var(--_1mgdisq2);display:table}:where(li)>._1mgdisq4{display:flow-root}:where(li)>._1mgdisq4:before,:where(li)>._1mgdisq4:after{display:block}:where(li:has(>._1mgdisq4))::marker{font-family:var(--font-body);line-height:0}:where(._1mgdisq3)>._1mgdisq3:where(a,abbr,b,bdi,bdo,cite,code,data,del,dfn,em,i,ins,kbd,label,mark,output,q,s,samp,small,span,strong,sub,sup,time,u,var){--_1mgdisq0:inherit;--_1mgdisq1:inherit;--_1mgdisq2:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;display:inline}:where(._1mgdisq3)>._1mgdisq3:where(a,abbr,b,bdi,bdo,cite,code,data,del,dfn,em,i,ins,kbd,label,mark,output,q,s,samp,small,span,strong,sub,sup,time,u,var):before,:where(._1mgdisq3)>._1mgdisq3:where(a,abbr,b,bdi,bdo,cite,code,data,del,dfn,em,i,ins,kbd,label,mark,output,q,s,samp,small,span,strong,sub,sup,time,u,var):after{content:none}._1mgdisq5{--_1mgdisq0:inherit;--_1mgdisq1:inherit;--_1mgdisq2:inherit;text-overflow:ellipsis;white-space:nowrap;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}._1mgdisq5:before,._1mgdisq5:after{content:none}._1mgdisq6{--_1mgdisq1:calc((var(--font-trim-body-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-body-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-body)}._1mgdisq7{--_1mgdisq1:calc((var(--font-trim-heading-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-heading-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-heading)}._1mgdisq8{--_1mgdisq1:calc((var(--font-trim-display-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-display-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-display)}._1mgdisq9{--_1mgdisq1:calc((var(--font-trim-label-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-label-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-label)}._1mgdisqa{--_1mgdisq1:calc((var(--font-trim-mono-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-mono-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-mono)}._1mgdisqb{font-size:var(--font-size-xs)}._1mgdisqc{font-size:var(--font-size-sm)}._1mgdisqd{font-size:var(--font-size-med)}._1mgdisqe{font-size:var(--font-size-lg)}._1mgdisqf{font-size:var(--font-size-xl)}._1mgdisqg{font-size:var(--font-size-2xl)}._1mgdisqh{font-size:var(--font-size-3xl)}._1mgdisqi{font-size:var(--font-size-4xl)}._1mgdisqj{font-weight:var(--font-weight-regular)}._1mgdisqk{font-weight:var(--font-weight-medium)}._1mgdisql{font-weight:var(--font-weight-semibold)}._1mgdisqm{font-weight:var(--font-weight-bold)}._1mgdisqn{--_1mgdisq0:var(--line-height-sm);line-height:var(--_1mgdisq0)}._1mgdisqo{--_1mgdisq0:var(--line-height-med);line-height:var(--_1mgdisq0)}._1mgdisqp{--_1mgdisq0:var(--line-height-lg);line-height:var(--_1mgdisq0)}._1mgdisqq{font-variant-numeric:tabular-nums}._1mgdisqr{white-space:nowrap}._1mgdisqs{white-space:pre-wrap;overflow-wrap:anywhere}._1mgdisqt{white-space:pre}._1mgdisqu{text-overflow:ellipsis;white-space:nowrap;margin-block-start:var(--_1mgdisq1);margin-block-end:var(--_1mgdisq2);padding-block-start:calc(-1 * var(--_1mgdisq1));padding-block-end:calc(-1 * var(--_1mgdisq2))}:where([data-text-reveal]:hover,[data-text-reveal]:focus-within) ._1mgdisqu{white-space:normal;text-overflow:clip}}
|
|
2
|
+
@layer components.text{._1mgdisq3{--_1mgdisq0:var(--line-height-med);--_1mgdisq1:calc((var(--font-trim-body-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-body-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-body);font-size:var(--font-size-med);font-weight:var(--font-weight-regular);line-height:var(--_1mgdisq0)}._1mgdisq3:before{content:"";margin-block-end:var(--_1mgdisq1);display:table}._1mgdisq3:after{content:"";margin-block-start:var(--_1mgdisq2);display:table}:where(li)>._1mgdisq4{display:flow-root}:where(li)>._1mgdisq4:before,:where(li)>._1mgdisq4:after{display:block}:where(li:has(>._1mgdisq4))::marker{font-family:var(--font-body);line-height:0}:where(._1mgdisq3)>._1mgdisq3:where(a,abbr,b,bdi,bdo,cite,code,data,del,dfn,em,i,ins,kbd,label,mark,output,q,s,samp,small,span,strong,sub,sup,time,u,var){--_1mgdisq0:inherit;--_1mgdisq1:inherit;--_1mgdisq2:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;display:inline}:where(._1mgdisq3)>._1mgdisq3:where(a,abbr,b,bdi,bdo,cite,code,data,del,dfn,em,i,ins,kbd,label,mark,output,q,s,samp,small,span,strong,sub,sup,time,u,var):before,:where(._1mgdisq3)>._1mgdisq3:where(a,abbr,b,bdi,bdo,cite,code,data,del,dfn,em,i,ins,kbd,label,mark,output,q,s,samp,small,span,strong,sub,sup,time,u,var):after{content:none}._1mgdisq5{--_1mgdisq0:inherit;--_1mgdisq1:inherit;--_1mgdisq2:inherit;text-overflow:ellipsis;white-space:nowrap;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}._1mgdisq5:before,._1mgdisq5:after{content:none}:where([data-text-reveal]:hover,[data-text-reveal]:focus-within) ._1mgdisq5{white-space:normal;text-overflow:clip}._1mgdisq6{--_1mgdisq1:calc((var(--font-trim-body-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-body-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-body)}._1mgdisq7{--_1mgdisq1:calc((var(--font-trim-heading-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-heading-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-heading)}._1mgdisq8{--_1mgdisq1:calc((var(--font-trim-display-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-display-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-display)}._1mgdisq9{--_1mgdisq1:calc((var(--font-trim-label-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-label-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-label)}._1mgdisqa{--_1mgdisq1:calc((var(--font-trim-mono-cap) - var(--_1mgdisq0) / 2) * 1em);--_1mgdisq2:calc((var(--font-trim-mono-baseline) - var(--_1mgdisq0) / 2) * 1em);font-family:var(--font-mono)}._1mgdisqb{font-size:var(--font-size-xs)}._1mgdisqc{font-size:var(--font-size-sm)}._1mgdisqd{font-size:var(--font-size-med)}._1mgdisqe{font-size:var(--font-size-lg)}._1mgdisqf{font-size:var(--font-size-xl)}._1mgdisqg{font-size:var(--font-size-2xl)}._1mgdisqh{font-size:var(--font-size-3xl)}._1mgdisqi{font-size:var(--font-size-4xl)}._1mgdisqj{font-weight:var(--font-weight-regular)}._1mgdisqk{font-weight:var(--font-weight-medium)}._1mgdisql{font-weight:var(--font-weight-semibold)}._1mgdisqm{font-weight:var(--font-weight-bold)}._1mgdisqn{--_1mgdisq0:var(--line-height-sm);line-height:var(--_1mgdisq0)}._1mgdisqo{--_1mgdisq0:var(--line-height-med);line-height:var(--_1mgdisq0)}._1mgdisqp{--_1mgdisq0:var(--line-height-lg);line-height:var(--_1mgdisq0)}._1mgdisqq{font-variant-numeric:tabular-nums}._1mgdisqr{white-space:nowrap}._1mgdisqs{white-space:pre-wrap;overflow-wrap:anywhere}._1mgdisqt{white-space:pre}._1mgdisqu{text-overflow:ellipsis;white-space:nowrap;margin-block-start:var(--_1mgdisq1);margin-block-end:var(--_1mgdisq2);padding-block-start:calc(-1 * var(--_1mgdisq1));padding-block-end:calc(-1 * var(--_1mgdisq2))}:where([data-text-reveal]:hover,[data-text-reveal]:focus-within) ._1mgdisqu{white-space:normal;text-overflow:clip}}
|
package/dist/docs/Badge.md
CHANGED
|
@@ -23,9 +23,10 @@ A static label that states the status of, or a short fact about, the thing besid
|
|
|
23
23
|
|
|
24
24
|
- `variant`: `neutral` (default, `fgMuted` on `bgMuted`) for most statuses and facts; `accent` (`accentFg` on `accent`) to draw the eye; `success` (`successFg` on `success`) for a passing or healthy state; `warning` (`warningFg` on `warning`) for one that needs attention soon; `danger` (`dangerFg` on `danger`) for a failure or a blocked state; `done` (`doneFg` on `done`, violet) for finished work, such as a merged PR or a closed issue.
|
|
25
25
|
- `subtle`: `false` (default) is the solid fill above; `true` swaps it for the variant's tint, `<variant>SubtleFg` on `<variant>Subtle` (`neutralSubtleFg` on `neutralSubtle` and so on). Use subtle where many badges sit together, such as a list or a board, so each one stays calm and the color still means one thing; keep solid for the one status that should stand out.
|
|
26
|
-
- `size`: `xs`, `sm` or `med` (default), the label's `fontSize` step. Use `xs` (a 12px label, 4px by 2px padding) in dense rows and narrow table cells, such as a board column of status pills; keep `sm` or `med` elsewhere, since `xs` is the smallest readable label.
|
|
26
|
+
- `size`: `xs`, `sm` or `med` (default), the label's `fontSize` step. Use `xs` (a 12px label, 4px by 2px padding) in dense rows and narrow table cells, such as a board column of status pills; keep `sm` or `med` elsewhere, since `xs` is the smallest readable label.
|
|
27
27
|
- The label states the state. Color is never the only cue (WCAG 1.4.1): under forced colors every variant, `success` and `warning` included, is the same outlined box, and some readers cannot tell the fills apart (green from red above all). Write "Failed" or "Passed", not a red or green badge reading "3".
|
|
28
|
-
-
|
|
28
|
+
- `iconStart` and `iconEnd` take an icon component (a generated `GitMergeIcon` from `@jonmilner/ui/icons`, or a component that renders `Icon`), not an element. Badge renders it inline in the label at the badge's text step, spaced from the words and centred on their cap height, so the badge keeps the height it has without one (ADR 0044, 0152). The icons are decorative (`aria-hidden`); the label states the state. Do not put an `Icon` in the children: it renders as a block and breaks the line.
|
|
29
|
+
- Keep it to one or two words; it never wraps. A cap, `maxInlineSize` as the style prop or in `style` (Tag's rule: a step, `full`, or a `style` length), cuts the label to one line with an ellipsis; the end icon stays in view after it. A badge has no hover or focus, so a cut label never shows its whole text: cap one only where the full text is also elsewhere. With no children it renders nothing.
|
|
29
30
|
- Fill, text color, padding, radius and `display` (`inline-block`) are default style props on the outer `span`; a consumer's win. `className`, `style` and `ref` go to it, `className` last. The box holds inside a `Text` or `Heading` too.
|
|
30
31
|
- The module has no hooks, so a server component can render it.
|
|
31
32
|
- Migrating from the inbox's `Pill`: `Pill tone=…` is `Badge variant=…`, with `good` as `success`, `warn` as `warning` and `bad` as `danger`; `pillLink` has no Badge equivalent (compose `Clickable`).
|
|
@@ -52,6 +53,13 @@ A static label that states the status of, or a short fact about, the thing besid
|
|
|
52
53
|
</Badge>
|
|
53
54
|
```
|
|
54
55
|
|
|
56
|
+
```tsx
|
|
57
|
+
// An icon component, not an element: the badge sizes and centres it.
|
|
58
|
+
<Badge iconStart={GitMergeIcon} variant="done">
|
|
59
|
+
Merged
|
|
60
|
+
</Badge>
|
|
61
|
+
```
|
|
62
|
+
|
|
55
63
|
```tsx
|
|
56
64
|
// A narrow board column or table cell: xs is the narrowest pill that still reads.
|
|
57
65
|
<Badge size="xs" subtle variant="warning">
|
|
@@ -71,6 +79,13 @@ A static label that states the status of, or a short fact about, the thing besid
|
|
|
71
79
|
<Badge onClick={retry}>Retry</Badge>
|
|
72
80
|
```
|
|
73
81
|
|
|
82
|
+
```tsx
|
|
83
|
+
// An Icon in the children is a block box: the badge grows and the text moves off-centre.
|
|
84
|
+
<Badge>
|
|
85
|
+
<GitMergeIcon size="med" /> Merged
|
|
86
|
+
</Badge>
|
|
87
|
+
```
|
|
88
|
+
|
|
74
89
|
## Accessibility
|
|
75
90
|
|
|
76
91
|
- It is plain text in a `span`: screen readers read the label in line with what is around it, so the label must make sense there ("Quarterly report Draft").
|
|
@@ -86,6 +101,8 @@ Generated from the TypeScript types.
|
|
|
86
101
|
|
|
87
102
|
| Prop | Type | Required | Description |
|
|
88
103
|
| --- | --- | --- | --- |
|
|
104
|
+
| `iconEnd` | `ComponentType` | no | |
|
|
105
|
+
| `iconStart` | `ComponentType` | no | |
|
|
89
106
|
| `size` | `"med" \| "sm" \| "xs"` | no | |
|
|
90
107
|
| `subtle` | `boolean` | no | |
|
|
91
108
|
| `variant` | `"accent" \| "danger" \| "done" \| "neutral" \| "success" \| "warning"` | no | |
|
package/dist/docs/Switch.md
CHANGED
|
@@ -24,7 +24,7 @@ Turns one setting on or off, and the change applies the moment it flips. Built o
|
|
|
24
24
|
- `description` and `error` render below the row through `Field`; a non-empty `error` marks it invalid (`aria-invalid`, a thicker `danger` border) and joins its `aria-describedby`.
|
|
25
25
|
- `disabled` takes it out of the tab order and dashes the border. `readOnly` keeps it focusable and announced (`aria-readonly`) but unchangeable and dots the border; say nearby why it cannot change.
|
|
26
26
|
- `name` submits `value` (default `"on"`) while on; off submits nothing unless you set `uncheckedValue`.
|
|
27
|
-
-
|
|
27
|
+
- `size` is `med` by default: a 38 by 22 track, the label at 14 px. `sm` is a 28 by 16 track with a 12 px thumb and the label, description and error at 12 px, for a toggle repeated down a dense table's rows. The target is 24 by 24 px at both sizes (ADR 0124, 0153). There is no `lg`. Style props, `className` and `style` go to the `Field` around the row and its messages, not to the switch.
|
|
28
28
|
- The module has no hooks, so a server component can render it. `onCheckedChange` is a function: set it from a client component.
|
|
29
29
|
|
|
30
30
|
## Do
|
|
@@ -53,8 +53,9 @@ Turns one setting on or off, and the change applies the moment it flips. Built o
|
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
```tsx
|
|
56
|
-
// The row's heading names the setting.
|
|
56
|
+
// The row's heading names the setting; `sm` fits a dense table row.
|
|
57
57
|
<Switch
|
|
58
|
+
size="sm"
|
|
58
59
|
aria-label={`Notifications for ${repo.name}`}
|
|
59
60
|
checked={repo.notify}
|
|
60
61
|
onCheckedChange={(next) => setNotify(repo.id, next)}
|
|
@@ -112,6 +113,7 @@ Generated from the TypeScript types.
|
|
|
112
113
|
| `onCheckedChange` | `((checked: boolean) => void)` | no | |
|
|
113
114
|
| `readOnly` | `boolean` | no | |
|
|
114
115
|
| `required` | `boolean` | no | |
|
|
116
|
+
| `size` | `"med" \| "sm"` | no | |
|
|
115
117
|
| `style` | `CSSProperties` | no | |
|
|
116
118
|
| `uncheckedValue` | `string` | no | |
|
|
117
119
|
| `value` | `string` | no | |
|
package/dist/docs/Tag.md
CHANGED
|
@@ -21,6 +21,7 @@ A label that puts content in a category: a topic, a label, a user-made category.
|
|
|
21
21
|
## Rules
|
|
22
22
|
|
|
23
23
|
- `size`: `sm` or `med` (default), the label's `fontSize` step.
|
|
24
|
+
- `iconStart` and `iconEnd` take an icon component (a generated `InboxIcon` from `@jonmilner/ui/icons`, or a component that renders `Icon`), not an element. Tag renders it inline in the label (inside the link, with `href`) at the label's text step, spaced from the words and centred on their cap height, so the tag keeps the height it has without one (ADR 0044, 0152). The icons are decorative (`aria-hidden`): they are not in the link's or the remove button's name. A truncated label keeps its end icon in view after the ellipsis.
|
|
24
25
|
- `variant`: the tone's subtle fill, `<variant>SubtleFg` on `<variant>Subtle`. `neutral` (default) for most categories; `accent`, `success`, `warning`, `danger` and `done` only where the category has a meaning those colors already carry in the app, as Badge's variants do. Tag has no solid fills: a category label stays calm (ADR 0121). The tone is never the only cue: the label names the category.
|
|
25
26
|
- Read-only is the default. `href` makes the label a link (a `Clickable` `<a>` around the text, underlined). The tag itself stays a `span`, so a remove button never nests in the link.
|
|
26
27
|
- `onRemove` adds a native `<button>` after the label with an `x` icon. Its name is "Remove <label>" from a string or number label; set `removeLabel` for any other label. Enter and Space activate it; the click calls `onRemove`. Tag handles no keys, so Backspace and Delete do nothing (ADR 0003, 0055).
|
|
@@ -57,6 +58,12 @@ Tell screen reader users the tag is gone, with the owner's live region or by nam
|
|
|
57
58
|
<Tag style={{ maxInlineSize: "min(10rem, 100%)" }}>{longCategoryName}</Tag>
|
|
58
59
|
```
|
|
59
60
|
|
|
61
|
+
```tsx
|
|
62
|
+
<Tag href="/inbox" iconStart={InboxIcon}>
|
|
63
|
+
Inbox
|
|
64
|
+
</Tag>
|
|
65
|
+
```
|
|
66
|
+
|
|
60
67
|
```tsx
|
|
61
68
|
<Tag variant="done" href="/labels/shipped">
|
|
62
69
|
Shipped
|
|
@@ -99,6 +106,8 @@ Generated from the TypeScript types.
|
|
|
99
106
|
| Prop | Type | Required | Description |
|
|
100
107
|
| --- | --- | --- | --- |
|
|
101
108
|
| `href` | `string` | no | |
|
|
109
|
+
| `iconEnd` | `ComponentType` | no | |
|
|
110
|
+
| `iconStart` | `ComponentType` | no | |
|
|
102
111
|
| `onRemove` | `(() => void)` | no | |
|
|
103
112
|
| `removeLabel` | `string` | no | |
|
|
104
113
|
| `size` | `"med" \| "sm"` | no | |
|
package/dist/docs/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./manifest.schema.json",
|
|
3
3
|
"package": "@jonmilner/ui",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.2",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"name": "AlertDialog",
|
|
@@ -166,6 +166,16 @@
|
|
|
166
166
|
"name": "Badge",
|
|
167
167
|
"styleProps": true,
|
|
168
168
|
"props": [
|
|
169
|
+
{
|
|
170
|
+
"name": "iconEnd",
|
|
171
|
+
"type": "ComponentType",
|
|
172
|
+
"required": false
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "iconStart",
|
|
176
|
+
"type": "ComponentType",
|
|
177
|
+
"required": false
|
|
178
|
+
},
|
|
169
179
|
{
|
|
170
180
|
"name": "size",
|
|
171
181
|
"type": "\"med\" | \"sm\" | \"xs\"",
|
|
@@ -2346,6 +2356,15 @@
|
|
|
2346
2356
|
"type": "boolean",
|
|
2347
2357
|
"required": false
|
|
2348
2358
|
},
|
|
2359
|
+
{
|
|
2360
|
+
"name": "size",
|
|
2361
|
+
"type": "\"med\" | \"sm\"",
|
|
2362
|
+
"required": false,
|
|
2363
|
+
"values": [
|
|
2364
|
+
"med",
|
|
2365
|
+
"sm"
|
|
2366
|
+
]
|
|
2367
|
+
},
|
|
2349
2368
|
{
|
|
2350
2369
|
"name": "style",
|
|
2351
2370
|
"type": "CSSProperties",
|
|
@@ -2792,6 +2811,16 @@
|
|
|
2792
2811
|
"type": "string",
|
|
2793
2812
|
"required": false
|
|
2794
2813
|
},
|
|
2814
|
+
{
|
|
2815
|
+
"name": "iconEnd",
|
|
2816
|
+
"type": "ComponentType",
|
|
2817
|
+
"required": false
|
|
2818
|
+
},
|
|
2819
|
+
{
|
|
2820
|
+
"name": "iconStart",
|
|
2821
|
+
"type": "ComponentType",
|
|
2822
|
+
"required": false
|
|
2823
|
+
},
|
|
2795
2824
|
{
|
|
2796
2825
|
"name": "onRemove",
|
|
2797
2826
|
"type": "(() => void)",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { join as e } from "../styles/join.mjs";
|
|
2
|
+
import { Text as t } from "../Text/index.mjs";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
// src/icon-slot/slot.tsx
|
|
5
|
+
var a = "";
|
|
6
|
+
function o({ iconStart: o, iconEnd: s, size: c, styles: l, truncate: u, children: d }) {
|
|
7
|
+
if (!o && !s) return d;
|
|
8
|
+
let f = o && /* @__PURE__ */ i(t, {
|
|
9
|
+
"aria-hidden": !0,
|
|
10
|
+
as: "span",
|
|
11
|
+
display: "inline",
|
|
12
|
+
wrap: "nowrap",
|
|
13
|
+
children: [/* @__PURE__ */ r(o, {
|
|
14
|
+
className: l.start[c],
|
|
15
|
+
size: c
|
|
16
|
+
}), a]
|
|
17
|
+
}), p = s && /* @__PURE__ */ i(t, {
|
|
18
|
+
"aria-hidden": !0,
|
|
19
|
+
as: "span",
|
|
20
|
+
display: "inline",
|
|
21
|
+
wrap: "nowrap",
|
|
22
|
+
children: [a, /* @__PURE__ */ r(s, {
|
|
23
|
+
className: l.end[c],
|
|
24
|
+
size: c
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
return u && p ? /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ i(t, {
|
|
28
|
+
as: "span",
|
|
29
|
+
className: e(l.clip[c], l.reveal),
|
|
30
|
+
display: "inline-block",
|
|
31
|
+
truncate: "box",
|
|
32
|
+
children: [f, d]
|
|
33
|
+
}), p] }) : /* @__PURE__ */ i(n, { children: [
|
|
34
|
+
f,
|
|
35
|
+
d,
|
|
36
|
+
p
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
export { o as slotIcons };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/styles/capped.ts
|
|
2
|
+
var e = new Set(Object.keys({
|
|
3
|
+
xs: !0,
|
|
4
|
+
sm: !0,
|
|
5
|
+
med: !0,
|
|
6
|
+
lg: !0,
|
|
7
|
+
xl: !0,
|
|
8
|
+
full: !0
|
|
9
|
+
})), t = /* @__PURE__ */ new Set([
|
|
10
|
+
"",
|
|
11
|
+
"none",
|
|
12
|
+
"auto",
|
|
13
|
+
"initial",
|
|
14
|
+
"unset",
|
|
15
|
+
"inherit",
|
|
16
|
+
"revert",
|
|
17
|
+
"revert-layer"
|
|
18
|
+
]);
|
|
19
|
+
function n(n, r) {
|
|
20
|
+
let i = r?.maxInlineSize ?? r?.maxWidth;
|
|
21
|
+
return i == null ? typeof n != "object" || !n ? e.has(n) : n.base != null && Object.values(n).every((t) => t == null || e.has(t)) : !t.has(String(i).trim()) && !/-content\b/.test(String(i));
|
|
22
|
+
}
|
|
23
|
+
export { n as capped };
|
package/dist/tokens/contract.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { colorRoles as e, fontRoles as t } from "./roles.mjs";
|
|
2
|
+
import { tokens as n } from "./scales.mjs";
|
|
3
3
|
// src/tokens/contract.ts
|
|
4
4
|
function r(e, t) {
|
|
5
5
|
return typeof e == "string" ? `var(--${t.join("-").replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`)})` : Object.fromEntries(Object.entries(e).map(([e, n]) => [e, r(n, [...t, e])]));
|
|
6
6
|
}
|
|
7
7
|
var i = (e, t) => Object.fromEntries(e.map((e) => [e, t])), a = {
|
|
8
|
-
...
|
|
9
|
-
color: i(
|
|
10
|
-
font: i(
|
|
11
|
-
fontTrim: i(
|
|
8
|
+
...n,
|
|
9
|
+
color: i(e, ""),
|
|
10
|
+
font: i(t, ""),
|
|
11
|
+
fontTrim: i(t, {
|
|
12
12
|
cap: "",
|
|
13
13
|
baseline: ""
|
|
14
14
|
})
|