@robert-stackflow/oneui 0.6.39 → 0.6.40
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/CHANGELOG.md +8 -0
- package/README.md +341 -329
- package/components/Card.d.ts +2 -1
- package/components/Card.js +3 -1
- package/components/Card.module.css +6 -1
- package/components/Descriptions.module.css +4 -3
- package/components/FormField.module.css +11 -3
- package/components/IconButton.module.css +6 -10
- package/components/Popover.js +12 -5
- package/components/Section.d.ts +7 -4
- package/components/Section.js +24 -8
- package/components/Section.module.css +24 -5
- package/components/SettingRow.js +1 -1
- package/components/SettingRow.module.css +8 -6
- package/components/SettingsLayout.module.css +3 -2
- package/components/SplitButton.d.ts +14 -3
- package/components/SplitButton.js +76 -40
- package/components/SplitButton.module.css +34 -8
- package/components/index.d.ts +1 -1
- package/package.json +1 -1
- package/styles/base.css +9 -0
- package/styles/minimal.css +2 -2
package/components/Card.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode, ComponentPropsWithRef } from "react";
|
|
2
|
-
export declare function Card({ title, description, action, children, className, onClick, bodyClassName, padding, ...props }: Omit<ComponentPropsWithRef<"section">, "title"> & {
|
|
2
|
+
export declare function Card({ title, description, action, children, className, onClick, bodyClassName, padding, headingLevel, ...props }: Omit<ComponentPropsWithRef<"section">, "title"> & {
|
|
3
3
|
title?: ReactNode;
|
|
4
4
|
description?: ReactNode;
|
|
5
5
|
action?: ReactNode;
|
|
@@ -7,4 +7,5 @@ export declare function Card({ title, description, action, children, className,
|
|
|
7
7
|
className?: string;
|
|
8
8
|
bodyClassName?: string;
|
|
9
9
|
padding?: "normal" | "compact" | "none";
|
|
10
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
10
11
|
}): import("react").JSX.Element;
|
package/components/Card.js
CHANGED
|
@@ -10,14 +10,16 @@ function Card({
|
|
|
10
10
|
onClick,
|
|
11
11
|
bodyClassName,
|
|
12
12
|
padding = "normal",
|
|
13
|
+
headingLevel = 2,
|
|
13
14
|
...props
|
|
14
15
|
}) {
|
|
16
|
+
const Heading = `h${headingLevel}`;
|
|
15
17
|
const hasBody = children != null && children !== false;
|
|
16
18
|
const classes = `${s.card} ${!hasBody ? s.headerOnly : ""} ${s[padding]} ${className}`;
|
|
17
19
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
20
|
(title || description || action) && /* @__PURE__ */ jsxs("header", { className: s.header, children: [
|
|
19
21
|
/* @__PURE__ */ jsxs("div", { className: s.heading, children: [
|
|
20
|
-
title && /* @__PURE__ */ jsx(
|
|
22
|
+
title && /* @__PURE__ */ jsx(Heading, { className: s.title, children: title }),
|
|
21
23
|
description && /* @__PURE__ */ jsx("div", { className: s.description, children: description })
|
|
22
24
|
] }),
|
|
23
25
|
action
|
|
@@ -36,8 +36,13 @@
|
|
|
36
36
|
flex: 1;
|
|
37
37
|
min-width: 0;
|
|
38
38
|
}
|
|
39
|
-
.
|
|
39
|
+
.title {
|
|
40
|
+
margin: 0;
|
|
40
41
|
color: var(--fg);
|
|
42
|
+
font-size: var(--card-title-size, 16px);
|
|
43
|
+
font-weight: var(--card-title-weight, 600);
|
|
44
|
+
line-height: 1.5;
|
|
45
|
+
overflow-wrap: anywhere;
|
|
41
46
|
}
|
|
42
47
|
.description {
|
|
43
48
|
margin-top: 6px;
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
container-type: inline-size;
|
|
4
4
|
}
|
|
5
5
|
.title {
|
|
6
|
-
margin-bottom:
|
|
7
|
-
font-size: 14px;
|
|
8
|
-
font-weight: 600;
|
|
6
|
+
margin-bottom: var(--section-title-gap, 12px);
|
|
7
|
+
font-size: var(--section-title-size, 14px);
|
|
8
|
+
font-weight: var(--section-title-weight, 600);
|
|
9
|
+
line-height: var(--section-title-line-height, 1.5);
|
|
9
10
|
}
|
|
10
11
|
.list {
|
|
11
12
|
display: grid;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
display: inline-flex;
|
|
9
9
|
align-items: baseline;
|
|
10
10
|
gap: 5px;
|
|
11
|
-
font-size:
|
|
11
|
+
font-size: var(--field-label-size, 13px);
|
|
12
|
+
font-weight: var(--field-label-weight, 400);
|
|
12
13
|
color: var(--fg);
|
|
13
14
|
}
|
|
14
15
|
.required {
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
}
|
|
19
20
|
.optional {
|
|
20
21
|
color: var(--muted);
|
|
21
|
-
font-size:
|
|
22
|
+
font-size: var(--field-message-size, 12px);
|
|
22
23
|
}
|
|
23
24
|
.hint,
|
|
24
25
|
.error {
|
|
@@ -56,7 +57,14 @@
|
|
|
56
57
|
}
|
|
57
58
|
.group > legend {
|
|
58
59
|
padding: 0;
|
|
59
|
-
margin-bottom:
|
|
60
|
+
margin-bottom: var(--section-title-gap, 12px);
|
|
61
|
+
color: var(--fg);
|
|
62
|
+
font-size: var(--section-title-size, 14px);
|
|
63
|
+
font-weight: var(--section-title-weight, 600);
|
|
64
|
+
line-height: var(--section-title-line-height, 1.5);
|
|
65
|
+
}
|
|
66
|
+
.group > legend > span {
|
|
67
|
+
font: inherit;
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
.labelRow {
|
|
@@ -71,20 +71,16 @@
|
|
|
71
71
|
align-items: center;
|
|
72
72
|
gap: 3px;
|
|
73
73
|
}
|
|
74
|
-
.iconButton[data-
|
|
74
|
+
.iconButton[data-variant="ghost"][aria-expanded="true"]:not(:disabled):not(
|
|
75
|
+
[aria-disabled="true"]
|
|
76
|
+
),
|
|
77
|
+
.iconButton[data-variant="ghost"][aria-pressed="true"]:not(:disabled):not(
|
|
78
|
+
[aria-disabled="true"]
|
|
79
|
+
) {
|
|
75
80
|
color: var(--accent-ink, var(--fg));
|
|
76
81
|
background: var(--hover);
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
/* Toggle tools use the theme selection surface, without a second outlined button. */
|
|
80
|
-
.iconButton[data-variant="ghost"][aria-pressed="true"] {
|
|
81
|
-
background: var(--selected);
|
|
82
|
-
color: var(--fg);
|
|
83
|
-
}
|
|
84
|
-
.iconButton[data-variant="ghost"][aria-pressed="true"]:hover:not(:disabled) {
|
|
85
|
-
background: color-mix(in srgb, var(--selected) 70%, var(--hover));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
84
|
.iconButton:disabled,
|
|
89
85
|
.iconButton[aria-disabled="true"] {
|
|
90
86
|
opacity: 0.35;
|
package/components/Popover.js
CHANGED
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
cancelMotion
|
|
15
15
|
} from "./motion.js";
|
|
16
16
|
import s from "./Popover.module.css";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
SurfacePortalContext,
|
|
19
|
+
useSurfaceHost,
|
|
20
|
+
useSurfacePortal
|
|
21
|
+
} from "./surfacePortal.js";
|
|
18
22
|
function Popover({
|
|
19
23
|
open: requestedOpen,
|
|
20
24
|
onClose,
|
|
@@ -39,7 +43,8 @@ function Popover({
|
|
|
39
43
|
}) {
|
|
40
44
|
const root = usePortalRoot();
|
|
41
45
|
const owner = useSurfacePortal(), portalHost = portalContainer || owner?.host || root, open = requestedOpen && owner?.active !== false;
|
|
42
|
-
const ref
|
|
46
|
+
const { ref, host, setRef } = useSurfaceHost();
|
|
47
|
+
const close = useRef(onClose);
|
|
43
48
|
close.current = onClose;
|
|
44
49
|
const opened = useRef(open);
|
|
45
50
|
opened.current = open;
|
|
@@ -165,6 +170,8 @@ function Popover({
|
|
|
165
170
|
};
|
|
166
171
|
const key = (event) => {
|
|
167
172
|
if (event.key === "Escape") {
|
|
173
|
+
if (surface.querySelector("[popover]:popover-open:not([inert])"))
|
|
174
|
+
return;
|
|
168
175
|
event.preventDefault();
|
|
169
176
|
event.stopPropagation();
|
|
170
177
|
close.current();
|
|
@@ -208,7 +215,7 @@ function Popover({
|
|
|
208
215
|
/* @__PURE__ */ jsx(
|
|
209
216
|
"div",
|
|
210
217
|
{
|
|
211
|
-
ref,
|
|
218
|
+
ref: setRef,
|
|
212
219
|
id,
|
|
213
220
|
popover: "manual",
|
|
214
221
|
role,
|
|
@@ -216,10 +223,10 @@ function Popover({
|
|
|
216
223
|
"aria-describedby": descriptionId,
|
|
217
224
|
onKeyDown,
|
|
218
225
|
className: `${s.popover} ${scrollable ? "" : s.contained} ${arrow ? s.withArrow : ""} ${className}`,
|
|
219
|
-
children: /* @__PURE__ */ jsx(FieldContext, { value: null, children: arrow ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
226
|
+
children: /* @__PURE__ */ jsx(SurfacePortalContext, { value: { host, active: open }, children: /* @__PURE__ */ jsx(FieldContext, { value: null, children: arrow ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
220
227
|
/* @__PURE__ */ jsx("span", { className: s.arrow, "data-popover-arrow": true, "aria-hidden": "true" }),
|
|
221
228
|
/* @__PURE__ */ jsx("div", { className: `${s.body} ${scrollable ? "" : s.bodyContained}`, children })
|
|
222
|
-
] }) : children })
|
|
229
|
+
] }) : children }) })
|
|
223
230
|
}
|
|
224
231
|
),
|
|
225
232
|
portalHost
|
package/components/Section.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export
|
|
3
|
-
title:
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
export type SectionProps = Omit<ComponentPropsWithoutRef<"section">, "title"> & {
|
|
3
|
+
title: ReactNode;
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
aside?: ReactNode;
|
|
6
|
-
|
|
6
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
contentLayout?: "default" | "settings";
|
|
8
|
+
};
|
|
9
|
+
export declare function Section({ title, children, aside, headingLevel, contentLayout, className, ...props }: SectionProps): import("react").JSX.Element;
|
package/components/Section.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
3
4
|
import s from "./Section.module.css";
|
|
4
5
|
function Section({
|
|
5
6
|
title,
|
|
6
7
|
children,
|
|
7
|
-
aside
|
|
8
|
+
aside,
|
|
9
|
+
headingLevel = 2,
|
|
10
|
+
contentLayout = "default",
|
|
11
|
+
className = "",
|
|
12
|
+
...props
|
|
8
13
|
}) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const titleId = useId();
|
|
15
|
+
const Heading = `h${headingLevel}`;
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
"section",
|
|
18
|
+
{
|
|
19
|
+
...props,
|
|
20
|
+
className: `${s.section} ${className}`,
|
|
21
|
+
"data-content-layout": contentLayout,
|
|
22
|
+
"aria-labelledby": props["aria-labelledby"] ?? (props["aria-label"] ? void 0 : titleId),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("header", { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Heading, { id: titleId, className: s.title, children: title }),
|
|
26
|
+
aside
|
|
27
|
+
] }),
|
|
28
|
+
children
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
);
|
|
16
32
|
}
|
|
17
33
|
export {
|
|
18
34
|
Section
|
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
.section {
|
|
2
|
-
margin
|
|
2
|
+
margin: 0 0 var(--section-gap, 28px);
|
|
3
3
|
min-width: 0;
|
|
4
4
|
}
|
|
5
5
|
.section > header {
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: space-between;
|
|
9
|
-
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
gap: 8px 16px;
|
|
11
|
+
margin-bottom: var(--section-title-gap, 12px);
|
|
10
12
|
}
|
|
11
|
-
.
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
.title {
|
|
14
|
+
min-width: 0;
|
|
15
|
+
margin: 0;
|
|
16
|
+
color: var(--fg);
|
|
17
|
+
font-size: var(--section-title-size, 14px);
|
|
18
|
+
font-weight: var(--section-title-weight, 600);
|
|
19
|
+
line-height: var(--section-title-line-height, 1.5);
|
|
20
|
+
overflow-wrap: anywhere;
|
|
21
|
+
}
|
|
22
|
+
.section[data-content-layout="settings"] {
|
|
23
|
+
margin-bottom: max(
|
|
24
|
+
0px,
|
|
25
|
+
calc(var(--section-gap, 28px) - var(--setting-row-padding-block, 15px))
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
.section[data-content-layout="settings"] > header {
|
|
29
|
+
margin-bottom: 0;
|
|
30
|
+
}
|
|
31
|
+
.section:last-child {
|
|
32
|
+
margin-bottom: 0;
|
|
14
33
|
}
|
package/components/SettingRow.js
CHANGED
|
@@ -28,7 +28,7 @@ function SettingRow({
|
|
|
28
28
|
"data-sized": controlWidth !== void 0,
|
|
29
29
|
children: [
|
|
30
30
|
/* @__PURE__ */ jsxs("div", { className: s.settingCopy, children: [
|
|
31
|
-
/* @__PURE__ */ jsx("
|
|
31
|
+
/* @__PURE__ */ jsx("div", { id: titleId, className: s.settingTitle, children: controlId ? /* @__PURE__ */ jsx("label", { htmlFor: controlId, children: title }) : title }),
|
|
32
32
|
description && /* @__PURE__ */ jsx("p", { id: descriptionId, children: description })
|
|
33
33
|
] }),
|
|
34
34
|
/* @__PURE__ */ jsx(
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
gap: 24px;
|
|
6
6
|
min-height: var(--row-height);
|
|
7
|
-
padding: 15px 0;
|
|
7
|
+
padding: var(--setting-row-padding-block, 15px) 0;
|
|
8
8
|
}
|
|
9
9
|
.settingRow + .settingRow[data-divider="true"] {
|
|
10
10
|
border-top: var(--separator-width) var(--separator-style)
|
|
@@ -17,20 +17,22 @@
|
|
|
17
17
|
flex: 1;
|
|
18
18
|
min-width: 0;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
21
|
-
font-size: 13px;
|
|
22
|
-
font-weight: 400;
|
|
20
|
+
.settingTitle {
|
|
21
|
+
font-size: var(--field-label-size, 13px);
|
|
22
|
+
font-weight: var(--field-label-weight, 400);
|
|
23
|
+
line-height: 1.5;
|
|
23
24
|
}
|
|
24
25
|
.settingCopy label {
|
|
25
26
|
font: inherit;
|
|
26
27
|
color: inherit;
|
|
27
28
|
cursor: pointer;
|
|
28
29
|
}
|
|
29
|
-
.settingRow[data-title-bold="true"] .
|
|
30
|
+
.settingRow[data-title-bold="true"] .settingTitle {
|
|
30
31
|
font-weight: 600;
|
|
31
32
|
}
|
|
32
33
|
.settingCopy p {
|
|
33
|
-
font-size:
|
|
34
|
+
font-size: var(--field-message-size, 12px);
|
|
35
|
+
line-height: 1.5;
|
|
34
36
|
color: var(--muted);
|
|
35
37
|
margin-top: 4px;
|
|
36
38
|
max-width: 440px;
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
min-width: 0;
|
|
20
20
|
}
|
|
21
21
|
.panel > h2 {
|
|
22
|
-
font-size: 16px;
|
|
22
|
+
font-size: var(--card-title-size, 16px);
|
|
23
23
|
margin: 2px 0 18px;
|
|
24
|
-
font-weight: 600;
|
|
24
|
+
font-weight: var(--card-title-weight, 600);
|
|
25
|
+
line-height: 1.5;
|
|
25
26
|
}
|
|
26
27
|
.card {
|
|
27
28
|
padding: 0 18px;
|
|
@@ -7,11 +7,22 @@ export type SplitButtonItem = {
|
|
|
7
7
|
description?: string;
|
|
8
8
|
onSelect(): void;
|
|
9
9
|
};
|
|
10
|
-
export declare function SplitButton({ children, onClick, items, menuLabel, variant, disabled, }: {
|
|
10
|
+
export declare function SplitButton({ children, onClick, items, menuLabel, variant, disabled, label, iconOnly, size, pressed, panel, panelWidth, open: suppliedOpen, onOpenChange, portalContainer, }: {
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
onClick(): void;
|
|
13
|
-
items
|
|
13
|
+
items?: SplitButtonItem[];
|
|
14
14
|
menuLabel: string;
|
|
15
|
-
variant?: "primary" | "secondary";
|
|
15
|
+
variant?: "primary" | "secondary" | "ghost";
|
|
16
16
|
disabled?: boolean;
|
|
17
|
+
/** Accessible name for the primary action; required for icon-only content. */
|
|
18
|
+
label?: string;
|
|
19
|
+
iconOnly?: boolean;
|
|
20
|
+
size?: "small" | "normal";
|
|
21
|
+
pressed?: boolean;
|
|
22
|
+
/** Custom nonmodal panel in place of menu items, e.g. color or text settings. */
|
|
23
|
+
panel?: ReactNode;
|
|
24
|
+
panelWidth?: number;
|
|
25
|
+
open?: boolean;
|
|
26
|
+
onOpenChange?(open: boolean): void;
|
|
27
|
+
portalContainer?: HTMLElement | null;
|
|
17
28
|
}): import("react").JSX.Element;
|
|
@@ -4,53 +4,83 @@ import { MenuItem } from "./MenuItem.js";
|
|
|
4
4
|
import { useId, useRef, useState } from "react";
|
|
5
5
|
import { Popover } from "./Popover.js";
|
|
6
6
|
import { DisclosureChevron } from "./DisclosureChevron.js";
|
|
7
|
+
import { Tooltip } from "./Tooltip.js";
|
|
7
8
|
import s from "./SplitButton.module.css";
|
|
8
9
|
function SplitButton({
|
|
9
10
|
children,
|
|
10
11
|
onClick,
|
|
11
|
-
items,
|
|
12
|
+
items = [],
|
|
12
13
|
menuLabel,
|
|
13
14
|
variant = "secondary",
|
|
14
|
-
disabled = false
|
|
15
|
+
disabled = false,
|
|
16
|
+
label,
|
|
17
|
+
iconOnly = false,
|
|
18
|
+
size = "normal",
|
|
19
|
+
pressed,
|
|
20
|
+
panel,
|
|
21
|
+
panelWidth = 280,
|
|
22
|
+
open: suppliedOpen,
|
|
23
|
+
onOpenChange,
|
|
24
|
+
portalContainer
|
|
15
25
|
}) {
|
|
16
|
-
const [
|
|
26
|
+
const [localOpen, setLocalOpen] = useState(false), anchor = useRef(null), root = useRef(null), id = useId();
|
|
27
|
+
const open = suppliedOpen ?? localOpen;
|
|
28
|
+
const setOpen = (value) => {
|
|
29
|
+
if (suppliedOpen === void 0) setLocalOpen(value);
|
|
30
|
+
onOpenChange?.(value);
|
|
31
|
+
};
|
|
17
32
|
const reserveIcon = items.some((item) => !!item.icon);
|
|
18
33
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
-
/* @__PURE__ */ jsxs(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onClick: () => setOpen((v) => !v),
|
|
44
|
-
onKeyDown: (e) => {
|
|
45
|
-
if (e.key === "ArrowDown") {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
setOpen(true);
|
|
34
|
+
/* @__PURE__ */ jsxs(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: s.split,
|
|
38
|
+
"data-variant": variant,
|
|
39
|
+
"data-disabled": disabled,
|
|
40
|
+
"data-icon-only": iconOnly || void 0,
|
|
41
|
+
"data-size": size,
|
|
42
|
+
"data-expanded": open && !disabled,
|
|
43
|
+
"data-pressed": pressed && !disabled,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(Tooltip, { content: label || menuLabel, disabled: !iconOnly, children: /* @__PURE__ */ jsx(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
className: s.action,
|
|
50
|
+
disabled,
|
|
51
|
+
"aria-label": label,
|
|
52
|
+
"aria-pressed": pressed,
|
|
53
|
+
onClick: () => {
|
|
54
|
+
setOpen(false);
|
|
55
|
+
onClick();
|
|
56
|
+
},
|
|
57
|
+
children
|
|
48
58
|
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
) }),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
ref: anchor,
|
|
64
|
+
type: "button",
|
|
65
|
+
className: s.arrow,
|
|
66
|
+
disabled,
|
|
67
|
+
"aria-label": menuLabel,
|
|
68
|
+
"aria-haspopup": panel ? "dialog" : "menu",
|
|
69
|
+
"aria-controls": id,
|
|
70
|
+
"aria-expanded": open && !disabled,
|
|
71
|
+
onClick: () => setOpen(!open),
|
|
72
|
+
onKeyDown: (e) => {
|
|
73
|
+
if (e.key === "ArrowDown") {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
setOpen(true);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
children: /* @__PURE__ */ jsx(DisclosureChevron, { expanded: open })
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
),
|
|
54
84
|
/* @__PURE__ */ jsx(
|
|
55
85
|
Popover,
|
|
56
86
|
{
|
|
@@ -58,10 +88,16 @@ function SplitButton({
|
|
|
58
88
|
open: open && !disabled,
|
|
59
89
|
onClose: () => setOpen(false),
|
|
60
90
|
id,
|
|
61
|
-
role: "menu",
|
|
91
|
+
role: panel ? "dialog" : "menu",
|
|
62
92
|
label: menuLabel,
|
|
63
|
-
width: 235,
|
|
93
|
+
width: panel ? panelWidth : 235,
|
|
94
|
+
arrow: !!panel,
|
|
95
|
+
offset: panel ? 12 : void 0,
|
|
96
|
+
align: panel ? "center" : "start",
|
|
97
|
+
portalContainer,
|
|
98
|
+
autoFocus: !panel,
|
|
64
99
|
onKeyDown: (e) => {
|
|
100
|
+
if (panel) return;
|
|
65
101
|
const buttons = Array.from(
|
|
66
102
|
root.current?.querySelectorAll(
|
|
67
103
|
"button:not(:disabled)"
|
|
@@ -76,7 +112,7 @@ function SplitButton({
|
|
|
76
112
|
buttons[e.key === "Home" ? 0 : e.key === "End" ? buttons.length - 1 : (index + (e.key === "ArrowDown" ? 1 : buttons.length - 1)) % buttons.length].focus();
|
|
77
113
|
}
|
|
78
114
|
},
|
|
79
|
-
children: /* @__PURE__ */ jsx("div", { ref: root, className: s.menu, children: items.map((item, index) => /* @__PURE__ */ jsx(
|
|
115
|
+
children: panel || /* @__PURE__ */ jsx("div", { ref: root, className: s.menu, children: items.map((item, index) => /* @__PURE__ */ jsx(
|
|
80
116
|
MenuItem,
|
|
81
117
|
{
|
|
82
118
|
label: item.label,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
overflow: hidden;
|
|
7
7
|
background: var(--surface);
|
|
8
8
|
}
|
|
9
|
-
.split
|
|
9
|
+
.split button {
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: center;
|
|
12
12
|
justify-content: center;
|
|
@@ -27,30 +27,56 @@
|
|
|
27
27
|
border-left: var(--separator-width) var(--separator-style)
|
|
28
28
|
var(--separator-color);
|
|
29
29
|
}
|
|
30
|
-
.split
|
|
31
|
-
.split
|
|
30
|
+
.split button:hover:not(:disabled),
|
|
31
|
+
.split button[aria-expanded="true"] {
|
|
32
32
|
background: var(--hover);
|
|
33
33
|
}
|
|
34
|
-
.split
|
|
34
|
+
.split button:active:not(:disabled) > svg {
|
|
35
35
|
scale: 0.94;
|
|
36
36
|
}
|
|
37
|
-
.split
|
|
37
|
+
.split button:focus-visible {
|
|
38
38
|
outline-offset: -3px;
|
|
39
39
|
}
|
|
40
40
|
.split[data-variant="primary"] {
|
|
41
41
|
background: var(--accent);
|
|
42
42
|
border-color: var(--accent);
|
|
43
43
|
}
|
|
44
|
-
.split[data-variant="primary"]
|
|
44
|
+
.split[data-variant="primary"] button {
|
|
45
45
|
color: var(--on-accent);
|
|
46
46
|
}
|
|
47
47
|
.split[data-variant="primary"] > .arrow {
|
|
48
48
|
border-left-color: color-mix(in srgb, var(--on-accent) 24%, transparent);
|
|
49
49
|
}
|
|
50
|
-
.split[data-variant="primary"]
|
|
51
|
-
.split[data-variant="primary"]
|
|
50
|
+
.split[data-variant="primary"] button:hover:not(:disabled),
|
|
51
|
+
.split[data-variant="primary"] button[aria-expanded="true"] {
|
|
52
52
|
background: color-mix(in srgb, var(--on-accent) 14%, transparent);
|
|
53
53
|
}
|
|
54
54
|
.menu {
|
|
55
55
|
display: block;
|
|
56
56
|
}
|
|
57
|
+
.split[data-size="small"] button {
|
|
58
|
+
min-height: 30px;
|
|
59
|
+
padding-block: 0;
|
|
60
|
+
}
|
|
61
|
+
.split[data-icon-only] .action {
|
|
62
|
+
width: 30px;
|
|
63
|
+
padding-inline: 0;
|
|
64
|
+
}
|
|
65
|
+
.split[data-icon-only] > .arrow {
|
|
66
|
+
width: 19px;
|
|
67
|
+
min-width: 19px;
|
|
68
|
+
}
|
|
69
|
+
.split[data-variant="ghost"] {
|
|
70
|
+
border: 0;
|
|
71
|
+
background: transparent;
|
|
72
|
+
border-radius: calc(var(--radius) - 3px);
|
|
73
|
+
color: var(--muted);
|
|
74
|
+
}
|
|
75
|
+
.split[data-variant="ghost"] button {
|
|
76
|
+
color: inherit;
|
|
77
|
+
}
|
|
78
|
+
.split[data-variant="ghost"][data-expanded="true"],
|
|
79
|
+
.split[data-variant="ghost"][data-pressed="true"] {
|
|
80
|
+
background: var(--hover);
|
|
81
|
+
color: var(--accent-ink, var(--fg));
|
|
82
|
+
}
|
package/components/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { Page, PageHeading } from "./Page";
|
|
|
17
17
|
export { Popover } from "./Popover";
|
|
18
18
|
export { Progress } from "./Progress";
|
|
19
19
|
export { SearchField } from "./SearchField";
|
|
20
|
-
export { Section } from "./Section";
|
|
20
|
+
export { Section, type SectionProps } from "./Section";
|
|
21
21
|
export { Segmented } from "./Segmented";
|
|
22
22
|
export { Select } from "./Select";
|
|
23
23
|
export { SettingRow, type SettingRowProps } from "./SettingRow";
|
package/package.json
CHANGED
package/styles/base.css
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
:root[data-ui-theme] {
|
|
3
3
|
--card-radius: var(--radius-lg, calc(var(--radius) + 4px));
|
|
4
4
|
--card-space: var(--space, 24px);
|
|
5
|
+
--card-title-size: 16px;
|
|
6
|
+
--card-title-weight: 600;
|
|
7
|
+
--section-title-size: 14px;
|
|
8
|
+
--section-title-weight: 600;
|
|
9
|
+
--section-title-line-height: 1.5;
|
|
10
|
+
--section-title-gap: 12px;
|
|
11
|
+
--section-gap: 28px;
|
|
12
|
+
--setting-row-padding-block: 15px;
|
|
13
|
+
--field-label-weight: 400;
|
|
5
14
|
}
|
|
6
15
|
@keyframes fade-in {
|
|
7
16
|
from {
|
package/styles/minimal.css
CHANGED
|
@@ -253,8 +253,8 @@
|
|
|
253
253
|
--field-readonly: var(--field);
|
|
254
254
|
--field-gap: 7px;
|
|
255
255
|
--field-trigger-width: auto;
|
|
256
|
-
--field-label-size:
|
|
257
|
-
--field-message-size:
|
|
256
|
+
--field-label-size: 13px;
|
|
257
|
+
--field-message-size: 12px;
|
|
258
258
|
--select-width: auto;
|
|
259
259
|
--popup-background: var(--surface);
|
|
260
260
|
--popup-border: var(--line);
|