@robert-stackflow/oneui 0.6.47 → 0.6.49
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 +4 -0
- package/components/Drawer.d.ts +3 -1
- package/components/Drawer.js +5 -1
- package/components/Drawer.module.css +7 -0
- package/components/TableOfContents.d.ts +3 -1
- package/components/TableOfContents.js +2 -0
- package/components/TableOfContents.module.css +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/components/Drawer.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type DrawerProps = {
|
|
|
5
5
|
onClose(): void;
|
|
6
6
|
onAfterClose?(): void;
|
|
7
7
|
title: ReactNode;
|
|
8
|
+
/** Contextual actions next to the close control, outside the title heading. */
|
|
9
|
+
headerActions?: ReactNode;
|
|
8
10
|
description?: ReactNode;
|
|
9
11
|
/** Hide the header divider when embedded navigation already provides one. */
|
|
10
12
|
headerDivider?: boolean;
|
|
@@ -22,4 +24,4 @@ export type DrawerProps = {
|
|
|
22
24
|
portalContainer?: HTMLElement | null;
|
|
23
25
|
className?: string;
|
|
24
26
|
};
|
|
25
|
-
export declare function Drawer({ open: requestedOpen, onClose, onAfterClose, title, description, headerDivider, children, footer, placement, size, closable, closeOnEscape, closeOnBackdrop, initialFocus, returnFocus, fallbackFocus, portalContainer, closeLabel, className, }: DrawerProps): import("react").ReactPortal | null;
|
|
27
|
+
export declare function Drawer({ open: requestedOpen, onClose, onAfterClose, title, headerActions, description, headerDivider, children, footer, placement, size, closable, closeOnEscape, closeOnBackdrop, initialFocus, returnFocus, fallbackFocus, portalContainer, closeLabel, className, }: DrawerProps): import("react").ReactPortal | null;
|
package/components/Drawer.js
CHANGED
|
@@ -32,6 +32,7 @@ function Drawer({
|
|
|
32
32
|
onClose,
|
|
33
33
|
onAfterClose,
|
|
34
34
|
title,
|
|
35
|
+
headerActions,
|
|
35
36
|
description,
|
|
36
37
|
headerDivider = true,
|
|
37
38
|
children,
|
|
@@ -147,7 +148,10 @@ function Drawer({
|
|
|
147
148
|
/* @__PURE__ */ jsx("h2", { id: titleId, children: title }),
|
|
148
149
|
description != null && /* @__PURE__ */ jsx("div", { id: descriptionId, className: s.description, children: description })
|
|
149
150
|
] }),
|
|
150
|
-
closable && /* @__PURE__ */
|
|
151
|
+
(headerActions || closable) && /* @__PURE__ */ jsxs("div", { className: s.actions, children: [
|
|
152
|
+
headerActions,
|
|
153
|
+
closable && /* @__PURE__ */ jsx(IconButton, { label: closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx(X, {}) })
|
|
154
|
+
] })
|
|
151
155
|
] }),
|
|
152
156
|
/* @__PURE__ */ jsx("div", { className: s.body, "data-drawer-body": true, children }),
|
|
153
157
|
footer && /* @__PURE__ */ jsx("footer", { className: s.footer, children: footer })
|
|
@@ -62,9 +62,16 @@
|
|
|
62
62
|
var(--separator-color);
|
|
63
63
|
}
|
|
64
64
|
.heading {
|
|
65
|
+
flex: 1;
|
|
65
66
|
min-width: 0;
|
|
66
67
|
padding-top: 4px;
|
|
67
68
|
}
|
|
69
|
+
.actions {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex: none;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
}
|
|
68
75
|
.header[data-divider="false"] {
|
|
69
76
|
border-bottom: 0;
|
|
70
77
|
}
|
|
@@ -12,6 +12,8 @@ export type TableOfContentsProps = {
|
|
|
12
12
|
hoverMode?: "single" | "nearby" | "all";
|
|
13
13
|
/** Display the full compact hierarchy in a rail popup. */
|
|
14
14
|
railLayout?: "preview" | "outline";
|
|
15
|
+
/** Align short rail marks to the start or end of their column. */
|
|
16
|
+
railAlign?: "start" | "end";
|
|
15
17
|
popoverSide?: "left" | "right";
|
|
16
18
|
previewCount?: number;
|
|
17
19
|
depthBasedLength?: boolean;
|
|
@@ -24,4 +26,4 @@ export type TableOfContentsProps = {
|
|
|
24
26
|
scrollable?: boolean;
|
|
25
27
|
className?: string;
|
|
26
28
|
};
|
|
27
|
-
export declare function TableOfContents({ items, contentRef, variant, hoverMode, railLayout, popoverSide, previewCount, depthBasedLength, label, activeId, onActiveChange, maxLevel, scrollOffset, scrollable, className, }: TableOfContentsProps): import("react").JSX.Element | null;
|
|
29
|
+
export declare function TableOfContents({ items, contentRef, variant, hoverMode, railLayout, railAlign, popoverSide, previewCount, depthBasedLength, label, activeId, onActiveChange, maxLevel, scrollOffset, scrollable, className, }: TableOfContentsProps): import("react").JSX.Element | null;
|
|
@@ -23,6 +23,7 @@ function TableOfContents({
|
|
|
23
23
|
variant = "tree",
|
|
24
24
|
hoverMode = "nearby",
|
|
25
25
|
railLayout = "preview",
|
|
26
|
+
railAlign = "end",
|
|
26
27
|
popoverSide = "left",
|
|
27
28
|
previewCount = 5,
|
|
28
29
|
depthBasedLength = false,
|
|
@@ -391,6 +392,7 @@ function TableOfContents({
|
|
|
391
392
|
{
|
|
392
393
|
ref: railRoot,
|
|
393
394
|
className: `${s.rail} ${className}`,
|
|
395
|
+
"data-rail-align": railAlign,
|
|
394
396
|
"aria-label": `${label}\u5FEB\u6377\u5B9A\u4F4D`,
|
|
395
397
|
onPointerEnter: () => {
|
|
396
398
|
keepOpen();
|
|
@@ -115,6 +115,16 @@
|
|
|
115
115
|
opacity 180ms var(--ease),
|
|
116
116
|
background-color 180ms var(--ease);
|
|
117
117
|
}
|
|
118
|
+
.rail[data-rail-align="start"] .trigger {
|
|
119
|
+
align-items: flex-start;
|
|
120
|
+
}
|
|
121
|
+
.rail[data-rail-align="start"] .railItem {
|
|
122
|
+
justify-content: flex-start;
|
|
123
|
+
padding-inline: 3px 0;
|
|
124
|
+
}
|
|
125
|
+
.rail[data-rail-align="start"] .railItem > i {
|
|
126
|
+
transform-origin: left center;
|
|
127
|
+
}
|
|
118
128
|
.railItem[data-active="true"] > i {
|
|
119
129
|
background: var(--fg);
|
|
120
130
|
opacity: 1;
|