@robert-stackflow/oneui 0.5.1 → 0.6.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/CHANGELOG.md +0 -7
- package/README.md +45 -14
- package/components/AppShell.d.ts +6 -13
- package/components/AppShell.js +28 -17
- package/components/AppShell.module.css +251 -269
- package/components/AuthLayout.d.ts +8 -0
- package/components/AuthLayout.js +25 -0
- package/components/AuthLayout.module.css +36 -0
- package/components/Badge.d.ts +2 -2
- package/components/Badge.js +4 -2
- package/components/BarChart.d.ts +8 -0
- package/components/BarChart.js +37 -0
- package/components/BarChart.module.css +34 -0
- package/components/Button.d.ts +1 -1
- package/components/Button.module.css +3 -0
- package/components/ContributionCalendar.js +2 -2
- package/components/ContributionCalendar.module.css +3 -0
- package/components/CopyButton.d.ts +9 -0
- package/components/CopyButton.js +23 -0
- package/components/Layout.d.ts +81 -0
- package/components/Layout.js +271 -0
- package/components/Layout.module.css +66 -0
- package/components/Menu.d.ts +4 -1
- package/components/Menu.js +10 -4
- package/components/MultiSelect.d.ts +1 -2
- package/components/MultiSelect.js +13 -82
- package/components/MultiSelect.module.css +0 -6
- package/components/NumberInput.d.ts +1 -0
- package/components/NumberInput.js +4 -0
- package/components/NumberInput.module.css +11 -0
- package/components/Page.d.ts +7 -1
- package/components/Page.js +15 -8
- package/components/Page.module.css +1 -0
- package/components/Pagination.d.ts +2 -1
- package/components/Pagination.js +3 -2
- package/components/ResourceCard.d.ts +12 -0
- package/components/ResourceCard.js +24 -0
- package/components/ResourceCard.module.css +13 -0
- package/components/SidebarNavigation.d.ts +29 -0
- package/components/SidebarNavigation.js +139 -0
- package/components/SidebarNavigation.module.css +109 -0
- package/components/Table.module.css +2 -2
- package/components/TableMarkup.d.ts +23 -0
- package/components/TableMarkup.js +41 -0
- package/components/Tooltip.d.ts +2 -1
- package/components/Tooltip.js +3 -1
- package/components/index.d.ts +12 -2
- package/components/index.js +42 -1
- package/package.json +42 -2
package/components/Button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from "react";
|
|
2
2
|
type ButtonProps = {
|
|
3
|
-
variant?: "primary" | "secondary" | "ghost" | "danger";
|
|
3
|
+
variant?: "primary" | "secondary" | "ghost" | "danger" | "link";
|
|
4
4
|
size?: "normal" | "small";
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
} & ((ComponentPropsWithRef<"button"> & {
|
|
@@ -57,6 +57,9 @@
|
|
|
57
57
|
padding: 4px 9px;
|
|
58
58
|
font-size: 11px;
|
|
59
59
|
}
|
|
60
|
+
.link {min-height:0;padding:0;border:0;border-radius:2px;background:transparent;box-shadow:none;color:var(--accent);font-size:13px;line-height:1.6;text-align:left;justify-content:flex-start;white-space:normal;}
|
|
61
|
+
.link:hover:not(:disabled):not([aria-disabled="true"]) {background:transparent;color:var(--accent-hover,var(--accent));text-decoration:underline;text-underline-offset:3px;}
|
|
62
|
+
.link .content {justify-content:flex-start;}
|
|
60
63
|
.spin {
|
|
61
64
|
animation: spin 1s linear infinite;
|
|
62
65
|
}
|
|
@@ -106,7 +106,7 @@ function ContributionCalendar({
|
|
|
106
106
|
"div",
|
|
107
107
|
{
|
|
108
108
|
className: s.calendar,
|
|
109
|
-
style: { "--calendar-color": color },
|
|
109
|
+
style: { "--calendar-color": color, "--calendar-weeks": model.weeks },
|
|
110
110
|
children: [
|
|
111
111
|
/* @__PURE__ */ jsxs("header", { className: s.header, children: [
|
|
112
112
|
/* @__PURE__ */ jsx("h3", { children: label }),
|
|
@@ -127,7 +127,7 @@ function ContributionCalendar({
|
|
|
127
127
|
"aria-hidden": "true",
|
|
128
128
|
children: [
|
|
129
129
|
/* @__PURE__ */ jsx("span", {}),
|
|
130
|
-
model.months.map((month) => /* @__PURE__ */ jsxs("span", { style: { gridColumn: month.column + 2 }, children: [
|
|
130
|
+
model.months.filter((month, index, months) => !months[index + 1] || months[index + 1].column - month.column >= 2).map((month) => /* @__PURE__ */ jsxs("span", { style: { gridColumn: month.column + 2 }, children: [
|
|
131
131
|
month.month,
|
|
132
132
|
"\u6708"
|
|
133
133
|
] }, month.key))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.calendar {
|
|
2
|
+
container-type: inline-size;
|
|
2
3
|
--calendar-cell: 13px;
|
|
3
4
|
--calendar-gap: 3px;
|
|
4
5
|
min-width: 0;
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
color: var(--muted);
|
|
24
25
|
}
|
|
25
26
|
.scroll {
|
|
27
|
+
--calendar-cell: clamp(9px, calc((100cqw - 32px) / var(--calendar-weeks) - var(--calendar-gap)), 13px);
|
|
26
28
|
overflow: auto;
|
|
27
29
|
padding: 3px 2px 6px;
|
|
28
30
|
}
|
|
@@ -39,6 +41,7 @@
|
|
|
39
41
|
color: var(--muted);
|
|
40
42
|
}
|
|
41
43
|
.months > span {
|
|
44
|
+
grid-row: 1;
|
|
42
45
|
white-space: nowrap;
|
|
43
46
|
}
|
|
44
47
|
.row {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** Behavior-only clipboard helper; presentation is composed from shared buttons. */
|
|
3
|
+
export declare function CopyButton({ value, children, }: {
|
|
4
|
+
value: string;
|
|
5
|
+
children(state: {
|
|
6
|
+
copied: boolean;
|
|
7
|
+
copy(): void;
|
|
8
|
+
}): ReactNode;
|
|
9
|
+
}): ReactNode;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useToast } from "./ToastProvider.js";
|
|
3
|
+
function CopyButton({
|
|
4
|
+
value,
|
|
5
|
+
children
|
|
6
|
+
}) {
|
|
7
|
+
const [copied, setCopied] = useState(false), timer = useRef(void 0), toast = useToast();
|
|
8
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
9
|
+
async function copy() {
|
|
10
|
+
try {
|
|
11
|
+
await navigator.clipboard.writeText(value);
|
|
12
|
+
setCopied(true);
|
|
13
|
+
clearTimeout(timer.current);
|
|
14
|
+
timer.current = setTimeout(() => setCopied(false), 1800);
|
|
15
|
+
} catch {
|
|
16
|
+
toast("\u65E0\u6CD5\u590D\u5236\uFF0C\u8BF7\u624B\u52A8\u9009\u62E9\u5E76\u590D\u5236\u3002", "error");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return children({ copied, copy: () => void copy() });
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
CopyButton
|
|
23
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { CSSProperties, ElementType, HTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
type Space = number | "xs" | "sm" | "md" | "lg" | "xl";
|
|
3
|
+
type LayoutProps = HTMLAttributes<HTMLElement> & {
|
|
4
|
+
as?: ElementType;
|
|
5
|
+
to?: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
p?: Space;
|
|
9
|
+
px?: Space;
|
|
10
|
+
py?: Space;
|
|
11
|
+
pt?: Space;
|
|
12
|
+
pb?: Space;
|
|
13
|
+
m?: Space;
|
|
14
|
+
mt?: Space;
|
|
15
|
+
mb?: Space;
|
|
16
|
+
ml?: Space;
|
|
17
|
+
mr?: Space;
|
|
18
|
+
my?: Space;
|
|
19
|
+
w?: CSSProperties["width"];
|
|
20
|
+
maw?: CSSProperties["maxWidth"];
|
|
21
|
+
h?: CSSProperties["height"];
|
|
22
|
+
mih?: CSSProperties["minHeight"];
|
|
23
|
+
};
|
|
24
|
+
export declare function Box(props: LayoutProps): import("react").JSX.Element;
|
|
25
|
+
type FlexProps = LayoutProps & {
|
|
26
|
+
gap?: Space;
|
|
27
|
+
align?: CSSProperties["alignItems"];
|
|
28
|
+
justify?: CSSProperties["justifyContent"];
|
|
29
|
+
wrap?: CSSProperties["flexWrap"];
|
|
30
|
+
};
|
|
31
|
+
export declare function Stack({ gap, align, ...props }: FlexProps): import("react").JSX.Element;
|
|
32
|
+
export declare function Group({ gap, align, justify, wrap, ...props }: FlexProps): import("react").JSX.Element;
|
|
33
|
+
export declare function Center(props: LayoutProps): import("react").JSX.Element;
|
|
34
|
+
export declare function SimpleGrid({ cols, spacing, ...props }: LayoutProps & {
|
|
35
|
+
cols?: number | {
|
|
36
|
+
base?: number;
|
|
37
|
+
sm?: number;
|
|
38
|
+
lg?: number;
|
|
39
|
+
xl?: number;
|
|
40
|
+
};
|
|
41
|
+
spacing?: Space;
|
|
42
|
+
}): import("react").JSX.Element;
|
|
43
|
+
export declare function Surface({ withBorder, radius, bg, interactive, ...props }: LayoutProps & {
|
|
44
|
+
withBorder?: boolean;
|
|
45
|
+
radius?: number;
|
|
46
|
+
bg?: string;
|
|
47
|
+
interactive?: boolean;
|
|
48
|
+
}): import("react").JSX.Element;
|
|
49
|
+
export declare function Text({ size, c, fw, fz, ta, truncate, lineClamp, ...props }: LayoutProps & {
|
|
50
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
51
|
+
c?: string;
|
|
52
|
+
fw?: CSSProperties["fontWeight"];
|
|
53
|
+
fz?: number;
|
|
54
|
+
ta?: CSSProperties["textAlign"];
|
|
55
|
+
truncate?: boolean;
|
|
56
|
+
lineClamp?: number;
|
|
57
|
+
}): import("react").JSX.Element;
|
|
58
|
+
export declare function Heading({ order, fz, lineClamp, ...props }: LayoutProps & {
|
|
59
|
+
order?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
60
|
+
fz?: number;
|
|
61
|
+
lineClamp?: number;
|
|
62
|
+
}): import("react").JSX.Element;
|
|
63
|
+
export declare function Code({ block, children, ...props }: HTMLAttributes<HTMLElement> & {
|
|
64
|
+
block?: boolean;
|
|
65
|
+
}): import("react").JSX.Element;
|
|
66
|
+
export declare function IconSurface({ size, radius, children, }: {
|
|
67
|
+
size?: number;
|
|
68
|
+
radius?: number;
|
|
69
|
+
children: ReactNode;
|
|
70
|
+
}): import("react").JSX.Element;
|
|
71
|
+
export declare function ScrollArea({ h, viewportRef, onScrollPositionChange, children, }: {
|
|
72
|
+
h?: CSSProperties["height"];
|
|
73
|
+
viewportRef?: Ref<HTMLDivElement>;
|
|
74
|
+
onScrollPositionChange?(position: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
}): void;
|
|
78
|
+
children: ReactNode;
|
|
79
|
+
}): import("react").JSX.Element;
|
|
80
|
+
export declare function Mark(props: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import s from "./Layout.module.css";
|
|
3
|
+
import card from "./Card.module.css";
|
|
4
|
+
const spaces = { xs: 6, sm: 10, md: 16, lg: 20, xl: 24 };
|
|
5
|
+
const space = (v) => typeof v === "string" ? spaces[v] : v;
|
|
6
|
+
function extract({
|
|
7
|
+
as,
|
|
8
|
+
p,
|
|
9
|
+
px,
|
|
10
|
+
py,
|
|
11
|
+
pt,
|
|
12
|
+
pb,
|
|
13
|
+
m,
|
|
14
|
+
mt,
|
|
15
|
+
mb,
|
|
16
|
+
ml,
|
|
17
|
+
mr,
|
|
18
|
+
my,
|
|
19
|
+
w,
|
|
20
|
+
maw,
|
|
21
|
+
h,
|
|
22
|
+
mih,
|
|
23
|
+
style,
|
|
24
|
+
...rest
|
|
25
|
+
}) {
|
|
26
|
+
return {
|
|
27
|
+
as,
|
|
28
|
+
rest,
|
|
29
|
+
style: {
|
|
30
|
+
paddingLeft: space(px ?? p),
|
|
31
|
+
paddingRight: space(px ?? p),
|
|
32
|
+
paddingTop: space(pt ?? py ?? p),
|
|
33
|
+
paddingBottom: space(pb ?? py ?? p),
|
|
34
|
+
marginTop: space(mt ?? my ?? m),
|
|
35
|
+
marginBottom: space(mb ?? my ?? m),
|
|
36
|
+
marginLeft: space(ml ?? m),
|
|
37
|
+
marginRight: space(mr ?? m),
|
|
38
|
+
width: w,
|
|
39
|
+
maxWidth: maw,
|
|
40
|
+
height: h,
|
|
41
|
+
minHeight: mih,
|
|
42
|
+
...style
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function Box(props) {
|
|
47
|
+
const { as: Tag = "div", rest, style } = extract(props);
|
|
48
|
+
return /* @__PURE__ */ jsx(Tag, { ...rest, style });
|
|
49
|
+
}
|
|
50
|
+
function Stack({ gap = "md", align, ...props }) {
|
|
51
|
+
const { style, ...rest } = props;
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
Box,
|
|
54
|
+
{
|
|
55
|
+
...rest,
|
|
56
|
+
style: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "column",
|
|
59
|
+
gap: space(gap),
|
|
60
|
+
alignItems: align,
|
|
61
|
+
minWidth: 0,
|
|
62
|
+
...style
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function Group({
|
|
68
|
+
gap = "md",
|
|
69
|
+
align = "center",
|
|
70
|
+
justify,
|
|
71
|
+
wrap = "wrap",
|
|
72
|
+
...props
|
|
73
|
+
}) {
|
|
74
|
+
const { style, ...rest } = props;
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
Box,
|
|
77
|
+
{
|
|
78
|
+
...rest,
|
|
79
|
+
style: {
|
|
80
|
+
display: "flex",
|
|
81
|
+
gap: space(gap),
|
|
82
|
+
alignItems: align,
|
|
83
|
+
justifyContent: justify,
|
|
84
|
+
flexWrap: wrap,
|
|
85
|
+
minWidth: 0,
|
|
86
|
+
...style
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function Center(props) {
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
Box,
|
|
94
|
+
{
|
|
95
|
+
...props,
|
|
96
|
+
style: {
|
|
97
|
+
display: "flex",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
...props.style
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function SimpleGrid({
|
|
106
|
+
cols = 1,
|
|
107
|
+
spacing = "md",
|
|
108
|
+
...props
|
|
109
|
+
}) {
|
|
110
|
+
const values = typeof cols === "number" ? { base: cols } : cols;
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
Box,
|
|
113
|
+
{
|
|
114
|
+
...props,
|
|
115
|
+
className: `${s.grid} ${props.className || ""}`,
|
|
116
|
+
style: {
|
|
117
|
+
"--grid-base": values.base || 1,
|
|
118
|
+
"--grid-sm": values.sm || values.base || 1,
|
|
119
|
+
"--grid-lg": values.lg || values.sm || values.base || 1,
|
|
120
|
+
"--grid-xl": values.xl || values.lg || values.sm || values.base || 1,
|
|
121
|
+
gap: space(spacing),
|
|
122
|
+
...props.style
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function Surface({
|
|
128
|
+
withBorder = true,
|
|
129
|
+
radius,
|
|
130
|
+
bg,
|
|
131
|
+
interactive = false,
|
|
132
|
+
...props
|
|
133
|
+
}) {
|
|
134
|
+
return /* @__PURE__ */ jsx(
|
|
135
|
+
Box,
|
|
136
|
+
{
|
|
137
|
+
...props,
|
|
138
|
+
className: `${card.card} ${interactive ? s.interactive : ""} ${props.className || ""}`,
|
|
139
|
+
style: {
|
|
140
|
+
border: withBorder ? void 0 : "none",
|
|
141
|
+
borderRadius: radius,
|
|
142
|
+
background: bg,
|
|
143
|
+
...props.style
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function Text({
|
|
149
|
+
size = "sm",
|
|
150
|
+
c,
|
|
151
|
+
fw,
|
|
152
|
+
fz,
|
|
153
|
+
ta,
|
|
154
|
+
truncate,
|
|
155
|
+
lineClamp,
|
|
156
|
+
...props
|
|
157
|
+
}) {
|
|
158
|
+
const color = c === "dimmed" ? "var(--muted)" : c === "red" ? "var(--danger)" : c ?? "var(--fg)";
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
Box,
|
|
161
|
+
{
|
|
162
|
+
as: "p",
|
|
163
|
+
...props,
|
|
164
|
+
className: `${s.text} ${truncate ? s.truncate : ""} ${props.className || ""}`,
|
|
165
|
+
style: {
|
|
166
|
+
fontSize: fz ?? { xs: 12, sm: 13, md: 14, lg: 16, xl: 18 }[size],
|
|
167
|
+
fontWeight: fw,
|
|
168
|
+
color,
|
|
169
|
+
textAlign: ta,
|
|
170
|
+
...lineClamp ? {
|
|
171
|
+
display: "-webkit-box",
|
|
172
|
+
WebkitLineClamp: lineClamp,
|
|
173
|
+
WebkitBoxOrient: "vertical",
|
|
174
|
+
overflow: "hidden"
|
|
175
|
+
} : {},
|
|
176
|
+
...props.style
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function Heading({
|
|
182
|
+
order = 2,
|
|
183
|
+
fz,
|
|
184
|
+
lineClamp,
|
|
185
|
+
...props
|
|
186
|
+
}) {
|
|
187
|
+
return /* @__PURE__ */ jsx(
|
|
188
|
+
Box,
|
|
189
|
+
{
|
|
190
|
+
as: `h${order}`,
|
|
191
|
+
...props,
|
|
192
|
+
className: `${s.heading} ${props.className || ""}`,
|
|
193
|
+
style: {
|
|
194
|
+
fontSize: fz ?? { 1: 28, 2: 15, 3: 14, 4: 14, 5: 13, 6: 12 }[order],
|
|
195
|
+
...lineClamp ? {
|
|
196
|
+
display: "-webkit-box",
|
|
197
|
+
WebkitLineClamp: lineClamp,
|
|
198
|
+
WebkitBoxOrient: "vertical",
|
|
199
|
+
overflow: "hidden"
|
|
200
|
+
} : {},
|
|
201
|
+
...props.style
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
function Code({
|
|
207
|
+
block,
|
|
208
|
+
children,
|
|
209
|
+
...props
|
|
210
|
+
}) {
|
|
211
|
+
const Tag = block ? "pre" : "code";
|
|
212
|
+
return /* @__PURE__ */ jsx(
|
|
213
|
+
Tag,
|
|
214
|
+
{
|
|
215
|
+
...props,
|
|
216
|
+
className: `${s.code} ${block ? s.codeBlock : ""} ${props.className || ""}`,
|
|
217
|
+
children
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
function IconSurface({
|
|
222
|
+
size = 36,
|
|
223
|
+
radius = 9,
|
|
224
|
+
children
|
|
225
|
+
}) {
|
|
226
|
+
return /* @__PURE__ */ jsx(
|
|
227
|
+
"span",
|
|
228
|
+
{
|
|
229
|
+
className: s.icon,
|
|
230
|
+
style: { width: size, height: size, borderRadius: radius },
|
|
231
|
+
children
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function ScrollArea({
|
|
236
|
+
h,
|
|
237
|
+
viewportRef,
|
|
238
|
+
onScrollPositionChange,
|
|
239
|
+
children
|
|
240
|
+
}) {
|
|
241
|
+
return /* @__PURE__ */ jsx(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
ref: viewportRef,
|
|
245
|
+
className: s.scroll,
|
|
246
|
+
style: { height: h },
|
|
247
|
+
onScroll: (e) => onScrollPositionChange?.({
|
|
248
|
+
x: e.currentTarget.scrollLeft,
|
|
249
|
+
y: e.currentTarget.scrollTop
|
|
250
|
+
}),
|
|
251
|
+
children
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function Mark(props) {
|
|
256
|
+
return /* @__PURE__ */ jsx("mark", { ...props, className: `${s.mark} ${props.className || ""}` });
|
|
257
|
+
}
|
|
258
|
+
export {
|
|
259
|
+
Box,
|
|
260
|
+
Center,
|
|
261
|
+
Code,
|
|
262
|
+
Group,
|
|
263
|
+
Heading,
|
|
264
|
+
IconSurface,
|
|
265
|
+
Mark,
|
|
266
|
+
ScrollArea,
|
|
267
|
+
SimpleGrid,
|
|
268
|
+
Stack,
|
|
269
|
+
Surface,
|
|
270
|
+
Text
|
|
271
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.text {
|
|
2
|
+
margin: 0;
|
|
3
|
+
line-height: 1.65;
|
|
4
|
+
overflow-wrap: anywhere;
|
|
5
|
+
}
|
|
6
|
+
.heading {
|
|
7
|
+
margin: 0;
|
|
8
|
+
line-height: 1.35;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
letter-spacing: -0.02em;
|
|
11
|
+
overflow-wrap: anywhere;
|
|
12
|
+
}
|
|
13
|
+
.truncate {
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
}
|
|
18
|
+
.grid {
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-columns: repeat(var(--grid-base), minmax(0, 1fr));
|
|
21
|
+
}
|
|
22
|
+
@media (min-width: 768px) {
|
|
23
|
+
.grid {
|
|
24
|
+
grid-template-columns: repeat(var(--grid-sm), minmax(0, 1fr));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@media (min-width: 1200px) {
|
|
28
|
+
.grid {
|
|
29
|
+
grid-template-columns: repeat(var(--grid-lg), minmax(0, 1fr));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
@media (min-width: 1440px) {
|
|
33
|
+
.grid {
|
|
34
|
+
grid-template-columns: repeat(var(--grid-xl), minmax(0, 1fr));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
.code {
|
|
38
|
+
font:
|
|
39
|
+
12px/1.7 Consolas,
|
|
40
|
+
monospace;
|
|
41
|
+
background: var(--soft);
|
|
42
|
+
border-radius: 5px;
|
|
43
|
+
padding: 2px 5px;
|
|
44
|
+
color: var(--fg);
|
|
45
|
+
overflow-wrap: anywhere;
|
|
46
|
+
}
|
|
47
|
+
.codeBlock {
|
|
48
|
+
margin: 0;
|
|
49
|
+
padding: 16px;
|
|
50
|
+
white-space: pre-wrap;
|
|
51
|
+
overflow: auto;
|
|
52
|
+
}
|
|
53
|
+
.icon {
|
|
54
|
+
display: inline-flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
color: var(--accent);
|
|
58
|
+
background: var(--selected);
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
}
|
|
61
|
+
.scroll {
|
|
62
|
+
overflow: auto;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
}
|
|
65
|
+
.interactive { text-decoration:none;color:inherit;transition:border-color var(--motion-hover),background var(--motion-hover); }.interactive:hover {border-color:var(--accent);background:var(--field);}
|
|
66
|
+
.mark { background:var(--selected);color:var(--fg);border-radius:3px;padding:0 1px;font-weight:600; }
|
package/components/Menu.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
export declare function Menu({ label, items, }: {
|
|
2
|
+
export declare function Menu({ label, items, trigger, variant, className, }: {
|
|
3
3
|
label: string;
|
|
4
|
+
trigger?: ReactNode;
|
|
5
|
+
variant?: "primary" | "secondary" | "ghost" | "danger";
|
|
6
|
+
className?: string;
|
|
4
7
|
items: {
|
|
5
8
|
label: string;
|
|
6
9
|
icon?: ReactNode;
|
package/components/Menu.js
CHANGED
|
@@ -7,13 +7,19 @@ import { Popover } from "./Popover.js";
|
|
|
7
7
|
import { usePopover } from "./usePopover.js";
|
|
8
8
|
function Menu({
|
|
9
9
|
label,
|
|
10
|
-
items
|
|
10
|
+
items,
|
|
11
|
+
trigger,
|
|
12
|
+
variant = "secondary",
|
|
13
|
+
className
|
|
11
14
|
}) {
|
|
12
15
|
const pop = usePopover(), id = useId();
|
|
13
16
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
-
/* @__PURE__ */
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
15
18
|
Button,
|
|
16
19
|
{
|
|
20
|
+
variant,
|
|
21
|
+
className,
|
|
22
|
+
"aria-label": label,
|
|
17
23
|
ref: pop.anchor,
|
|
18
24
|
"aria-haspopup": "menu",
|
|
19
25
|
"aria-expanded": pop.open,
|
|
@@ -25,10 +31,10 @@ function Menu({
|
|
|
25
31
|
pop.show();
|
|
26
32
|
}
|
|
27
33
|
},
|
|
28
|
-
children: [
|
|
34
|
+
children: trigger ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
35
|
label,
|
|
30
36
|
/* @__PURE__ */ jsx(ChevronDown, { size: 14 })
|
|
31
|
-
]
|
|
37
|
+
] })
|
|
32
38
|
}
|
|
33
39
|
),
|
|
34
40
|
/* @__PURE__ */ jsx(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FieldOptions } from "./field";
|
|
2
2
|
import type { SelectOption } from "./types";
|
|
3
|
-
export declare function MultiSelect({ value, onChange, options, label, disabled, readOnly, required, name, id: controlId, error, hint, maxSelected, clearable, placeholder, display,
|
|
3
|
+
export declare function MultiSelect({ value, onChange, options, label, disabled, readOnly, required, name, id: controlId, error, hint, maxSelected, clearable, placeholder, display, ...aria }: FieldOptions & {
|
|
4
4
|
value: string[];
|
|
5
5
|
onChange(value: string[]): void;
|
|
6
6
|
options: SelectOption[];
|
|
@@ -10,5 +10,4 @@ export declare function MultiSelect({ value, onChange, options, label, disabled,
|
|
|
10
10
|
clearable?: boolean;
|
|
11
11
|
placeholder?: string;
|
|
12
12
|
display?: "summary" | "tags";
|
|
13
|
-
onCreate?(label: string): string | void | Promise<string | void>;
|
|
14
13
|
}): import("react").JSX.Element;
|