@robert-stackflow/oneui 0.5.2 → 0.6.1
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 +78 -69
- package/README.md +188 -149
- package/components/AppShell.d.ts +6 -7
- package/components/AppShell.js +31 -6
- 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 +23 -0
- package/components/ContributionCalendar.js +7 -2
- package/components/ContributionCalendar.module.css +7 -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 +82 -0
- package/components/Menu.d.ts +4 -1
- package/components/Menu.js +10 -4
- 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 +6 -0
- package/components/Page.js +21 -8
- package/components/Page.module.css +6 -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 +33 -0
- package/components/ResourceCard.module.css +98 -0
- package/components/SidebarNavigation.d.ts +29 -0
- package/components/SidebarNavigation.js +139 -0
- package/components/SidebarNavigation.module.css +130 -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 +11 -1
- package/components/index.js +42 -1
- package/package.json +42 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export declare function AuthLayout({ brandName, brandIcon, title, children, footer, }: {
|
|
3
|
+
brandName: string;
|
|
4
|
+
brandIcon?: ReactNode;
|
|
5
|
+
title: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
footer?: ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Surface, Stack, Heading } from "./Layout.js";
|
|
3
|
+
import s from "./AuthLayout.module.css";
|
|
4
|
+
function AuthLayout({
|
|
5
|
+
brandName,
|
|
6
|
+
brandIcon,
|
|
7
|
+
title,
|
|
8
|
+
children,
|
|
9
|
+
footer
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsxs("main", { className: s.page, children: [
|
|
12
|
+
/* @__PURE__ */ jsxs("div", { className: s.brand, children: [
|
|
13
|
+
brandIcon,
|
|
14
|
+
/* @__PURE__ */ jsx(Heading, { order: 1, fz: 24, children: brandName })
|
|
15
|
+
] }),
|
|
16
|
+
/* @__PURE__ */ jsx(Surface, { className: s.panel, p: "xl", children: /* @__PURE__ */ jsxs(Stack, { gap: "lg", children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Heading, { order: 2, fz: 18, children: title }),
|
|
18
|
+
children
|
|
19
|
+
] }) }),
|
|
20
|
+
footer && /* @__PURE__ */ jsx("div", { className: s.footer, children: footer })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
AuthLayout
|
|
25
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.page {
|
|
2
|
+
min-height: 100dvh;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
padding: 24px;
|
|
8
|
+
background: var(--canvas);
|
|
9
|
+
}
|
|
10
|
+
.brand {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 10px;
|
|
14
|
+
margin-bottom: 28px;
|
|
15
|
+
color: var(--fg);
|
|
16
|
+
}
|
|
17
|
+
.brand > img {
|
|
18
|
+
width: 34px;
|
|
19
|
+
height: 34px;
|
|
20
|
+
}
|
|
21
|
+
.panel {
|
|
22
|
+
width: 100%;
|
|
23
|
+
max-width: 400px;
|
|
24
|
+
}
|
|
25
|
+
.footer {
|
|
26
|
+
max-width: 400px;
|
|
27
|
+
margin-top: 20px;
|
|
28
|
+
color: var(--muted);
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
text-align: center;
|
|
31
|
+
}
|
|
32
|
+
@media (max-width: 480px) {
|
|
33
|
+
.page {
|
|
34
|
+
padding: 18px;
|
|
35
|
+
}
|
|
36
|
+
}
|
package/components/Badge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
export declare function Badge({ children, tone, }: {
|
|
1
|
+
import type { ReactNode, HTMLAttributes } from "react";
|
|
2
|
+
export declare function Badge({ children, tone, className, ...props }: HTMLAttributes<HTMLSpanElement> & {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
tone?: "neutral" | "success" | "warning" | "accent" | "danger";
|
|
5
5
|
}): import("react").JSX.Element;
|
package/components/Badge.js
CHANGED
|
@@ -2,9 +2,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import s from "./Badge.module.css";
|
|
3
3
|
function Badge({
|
|
4
4
|
children,
|
|
5
|
-
tone = "neutral"
|
|
5
|
+
tone = "neutral",
|
|
6
|
+
className = "",
|
|
7
|
+
...props
|
|
6
8
|
}) {
|
|
7
|
-
return /* @__PURE__ */ jsx("span", { className: `${s.badge} ${s[tone]}`, children });
|
|
9
|
+
return /* @__PURE__ */ jsx("span", { ...props, className: `${s.badge} ${s[tone]} ${className}`, children });
|
|
8
10
|
}
|
|
9
11
|
export {
|
|
10
12
|
Badge
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip } from "./Tooltip.js";
|
|
3
|
+
import s from "./BarChart.module.css";
|
|
4
|
+
function BarChart({
|
|
5
|
+
data,
|
|
6
|
+
label
|
|
7
|
+
}) {
|
|
8
|
+
const max = Math.max(1, ...data.map((point) => point.value));
|
|
9
|
+
return /* @__PURE__ */ jsx("div", { className: s.chart, role: "img", "aria-label": label, children: data.map((point, index) => /* @__PURE__ */ jsx(
|
|
10
|
+
Tooltip,
|
|
11
|
+
{
|
|
12
|
+
content: point.description || `${point.label} \xB7 ${point.value}`,
|
|
13
|
+
children: /* @__PURE__ */ jsxs(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: s.column,
|
|
17
|
+
tabIndex: 0,
|
|
18
|
+
"aria-label": `${point.label}: ${point.value}`,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: s.bar,
|
|
24
|
+
style: { height: Math.max(0, point.value) / max * 132 }
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsx("span", { children: index % Math.max(1, Math.ceil(data.length / 7)) === 0 ? point.label : "" })
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
index
|
|
33
|
+
)) });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
BarChart
|
|
37
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.chart {
|
|
2
|
+
height: 166px;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: flex-end;
|
|
5
|
+
gap: 5px;
|
|
6
|
+
border-bottom: 1px solid var(--line);
|
|
7
|
+
}
|
|
8
|
+
.chart > span {
|
|
9
|
+
flex: 1;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
.column {
|
|
14
|
+
min-width: 0;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
justify-content: flex-end;
|
|
18
|
+
align-items: center;
|
|
19
|
+
height: 100%;
|
|
20
|
+
gap: 9px;
|
|
21
|
+
}
|
|
22
|
+
.bar {
|
|
23
|
+
width: 75%;
|
|
24
|
+
background: var(--accent);
|
|
25
|
+
opacity: 0.8;
|
|
26
|
+
border-radius: 4px 4px 0 0;
|
|
27
|
+
}
|
|
28
|
+
.column > span {
|
|
29
|
+
font-size: 9px;
|
|
30
|
+
color: var(--muted);
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
height: 16px;
|
|
33
|
+
padding-bottom: 3px;
|
|
34
|
+
}
|
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,29 @@
|
|
|
57
57
|
padding: 4px 9px;
|
|
58
58
|
font-size: 11px;
|
|
59
59
|
}
|
|
60
|
+
.link {
|
|
61
|
+
min-height: 0;
|
|
62
|
+
padding: 0;
|
|
63
|
+
border: 0;
|
|
64
|
+
border-radius: 2px;
|
|
65
|
+
background: transparent;
|
|
66
|
+
box-shadow: none;
|
|
67
|
+
color: var(--accent);
|
|
68
|
+
font-size: 13px;
|
|
69
|
+
line-height: 1.6;
|
|
70
|
+
text-align: left;
|
|
71
|
+
justify-content: flex-start;
|
|
72
|
+
white-space: normal;
|
|
73
|
+
}
|
|
74
|
+
.link:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
75
|
+
background: transparent;
|
|
76
|
+
color: var(--accent-hover, var(--accent));
|
|
77
|
+
text-decoration: underline;
|
|
78
|
+
text-underline-offset: 3px;
|
|
79
|
+
}
|
|
80
|
+
.link .content {
|
|
81
|
+
justify-content: flex-start;
|
|
82
|
+
}
|
|
60
83
|
.spin {
|
|
61
84
|
animation: spin 1s linear infinite;
|
|
62
85
|
}
|
|
@@ -106,7 +106,10 @@ function ContributionCalendar({
|
|
|
106
106
|
"div",
|
|
107
107
|
{
|
|
108
108
|
className: s.calendar,
|
|
109
|
-
style: {
|
|
109
|
+
style: {
|
|
110
|
+
"--calendar-color": color,
|
|
111
|
+
"--calendar-weeks": model.weeks
|
|
112
|
+
},
|
|
110
113
|
children: [
|
|
111
114
|
/* @__PURE__ */ jsxs("header", { className: s.header, children: [
|
|
112
115
|
/* @__PURE__ */ jsx("h3", { children: label }),
|
|
@@ -127,7 +130,9 @@ function ContributionCalendar({
|
|
|
127
130
|
"aria-hidden": "true",
|
|
128
131
|
children: [
|
|
129
132
|
/* @__PURE__ */ jsx("span", {}),
|
|
130
|
-
model.months.
|
|
133
|
+
model.months.filter(
|
|
134
|
+
(month, index, months) => !months[index + 1] || months[index + 1].column - month.column >= 2
|
|
135
|
+
).map((month) => /* @__PURE__ */ jsxs("span", { style: { gridColumn: month.column + 2 }, children: [
|
|
131
136
|
month.month,
|
|
132
137
|
"\u6708"
|
|
133
138
|
] }, 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,11 @@
|
|
|
23
24
|
color: var(--muted);
|
|
24
25
|
}
|
|
25
26
|
.scroll {
|
|
27
|
+
--calendar-cell: clamp(
|
|
28
|
+
9px,
|
|
29
|
+
calc((100cqw - 32px) / var(--calendar-weeks) - var(--calendar-gap)),
|
|
30
|
+
13px
|
|
31
|
+
);
|
|
26
32
|
overflow: auto;
|
|
27
33
|
padding: 3px 2px 6px;
|
|
28
34
|
}
|
|
@@ -39,6 +45,7 @@
|
|
|
39
45
|
color: var(--muted);
|
|
40
46
|
}
|
|
41
47
|
.months > span {
|
|
48
|
+
grid-row: 1;
|
|
42
49
|
white-space: nowrap;
|
|
43
50
|
}
|
|
44
51
|
.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
|
+
};
|