@robert-stackflow/oneui 0.6.58 → 0.6.60
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/components/Dialog.js +1 -1
- package/components/Dialog.module.css +152 -153
- package/components/Link.module.css +1 -1
- package/components/NavBar.module.css +1 -1
- package/components/Segmented.js +2 -0
- package/components/Segmented.module.css +0 -3
- package/components/SidebarNavigation.module.css +1 -1
- package/components/Tab.module.css +0 -3
- package/components/TabFocus.module.css +34 -0
- package/components/TabList.js +2 -0
- package/components/TableOfContents.module.css +4 -4
- package/components/Tabs.module.css +10 -0
- package/package.json +1 -1
- package/styles/base.css +4 -2
package/CHANGELOG.md
CHANGED
package/components/Dialog.js
CHANGED
|
@@ -142,7 +142,7 @@ function Dialog({
|
|
|
142
142
|
content.headerIcon && /* @__PURE__ */ jsx("span", { className: s.dialogIcon, "aria-hidden": "true", children: content.headerIcon }),
|
|
143
143
|
/* @__PURE__ */ jsx("h2", { id: titleId, children: content.title })
|
|
144
144
|
] }),
|
|
145
|
-
/* @__PURE__ */ jsx(IconButton, { label: closeLabel, onClick: onClose, disabled: busy, children: /* @__PURE__ */ jsx(X, {}) })
|
|
145
|
+
/* @__PURE__ */ jsx(IconButton, { className: s.dialogClose, tooltip: false, label: closeLabel, onClick: onClose, disabled: busy, children: /* @__PURE__ */ jsx(X, {}) })
|
|
146
146
|
] }),
|
|
147
147
|
/* @__PURE__ */ jsx("div", { className: s.dialogBody, children: content.children }),
|
|
148
148
|
content.footer && /* @__PURE__ */ jsx("footer", { className: s.dialogFooter, children: content.footer })
|
|
@@ -1,153 +1,152 @@
|
|
|
1
|
-
.dialog {
|
|
2
|
-
width: min(var(--dialog-width), calc(100vw - 32px));
|
|
3
|
-
max-height: calc(100dvh - var(--dialog-inset));
|
|
4
|
-
padding: 0;
|
|
5
|
-
color: var(--fg);
|
|
6
|
-
background: var(--surface);
|
|
7
|
-
border: 1px solid var(--line);
|
|
8
|
-
border-radius: calc(var(--radius) + 3px);
|
|
9
|
-
box-shadow: var(--shadow-dialog);
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.dialog[open] {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.dialog::backdrop {
|
|
19
|
-
background: var(--overlay);
|
|
20
|
-
backdrop-filter: blur(3px);
|
|
21
|
-
animation: fade-in var(--popup-enter);
|
|
22
|
-
}
|
|
23
|
-
.dialog[data-placement="top"] {
|
|
24
|
-
margin-top: min(10dvh, 96px);
|
|
25
|
-
margin-bottom: auto;
|
|
26
|
-
}
|
|
27
|
-
.dialogHeader {
|
|
28
|
-
flex-shrink: 0;
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items:
|
|
31
|
-
justify-content: space-between;
|
|
32
|
-
gap: 16px;
|
|
33
|
-
padding:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
font-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
margin
|
|
52
|
-
color: var(--muted);
|
|
53
|
-
}
|
|
54
|
-
.dialogIcon {
|
|
55
|
-
display: inline-flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
flex: 0 0 21px;
|
|
59
|
-
width: 21px;
|
|
60
|
-
height: 25px;
|
|
61
|
-
color: var(--dialog-tone, var(--accent-ink, var(--accent)));
|
|
62
|
-
}
|
|
63
|
-
.dialogIcon > svg {
|
|
64
|
-
width: 21px;
|
|
65
|
-
height: 21px;
|
|
66
|
-
stroke-width: 1.7;
|
|
67
|
-
}
|
|
68
|
-
.dialog[data-tone="info"] {
|
|
69
|
-
--dialog-tone: var(--accent-ink, var(--accent));
|
|
70
|
-
}
|
|
71
|
-
.dialog[data-tone="success"] {
|
|
72
|
-
--dialog-tone: var(--success);
|
|
73
|
-
}
|
|
74
|
-
.dialog[data-tone="warning"] {
|
|
75
|
-
--dialog-tone: var(--warning);
|
|
76
|
-
}
|
|
77
|
-
.dialog[data-tone="danger"] {
|
|
78
|
-
--dialog-tone: var(--danger);
|
|
79
|
-
}
|
|
80
|
-
.dialogBody {
|
|
81
|
-
min-height: 0;
|
|
82
|
-
overflow: auto;
|
|
83
|
-
overscroll-behavior: contain;
|
|
84
|
-
padding:
|
|
85
|
-
}
|
|
86
|
-
.dialogBody > p {
|
|
87
|
-
color: var(--muted);
|
|
88
|
-
font-size: 12px;
|
|
89
|
-
line-height: 1.8;
|
|
90
|
-
}
|
|
91
|
-
.dialogFooter {
|
|
92
|
-
flex-shrink: 0;
|
|
93
|
-
flex-wrap: wrap;
|
|
94
|
-
display: flex;
|
|
95
|
-
justify-content: flex-end;
|
|
96
|
-
gap: 8px;
|
|
97
|
-
padding: 14px 24px;
|
|
98
|
-
border-top: var(--separator-width) var(--separator-style)
|
|
99
|
-
var(--separator-color);
|
|
100
|
-
background: var(--canvas);
|
|
101
|
-
}
|
|
102
|
-
.wide {
|
|
103
|
-
width: min(var(--dialog-wide-width), calc(100vw - 32px));
|
|
104
|
-
}
|
|
105
|
-
.small {
|
|
106
|
-
width: min(420px, calc(100vw - 32px));
|
|
107
|
-
}
|
|
108
|
-
.dialog:is([data-variant="message"], [data-variant="confirm"]) .
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
.dialog:is([data-variant="message"], [data-variant="confirm"])
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
.
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
.closing {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
.
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
.
|
|
138
|
-
padding:
|
|
139
|
-
}
|
|
140
|
-
.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
1
|
+
.dialog {
|
|
2
|
+
width: min(var(--dialog-width), calc(100vw - 32px));
|
|
3
|
+
max-height: calc(100dvh - var(--dialog-inset));
|
|
4
|
+
padding: 0;
|
|
5
|
+
color: var(--fg);
|
|
6
|
+
background: var(--surface);
|
|
7
|
+
border: 1px solid var(--line);
|
|
8
|
+
border-radius: calc(var(--radius) + 3px);
|
|
9
|
+
box-shadow: var(--shadow-dialog);
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dialog[open] {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dialog::backdrop {
|
|
19
|
+
background: var(--overlay);
|
|
20
|
+
backdrop-filter: blur(3px);
|
|
21
|
+
animation: fade-in var(--popup-enter);
|
|
22
|
+
}
|
|
23
|
+
.dialog[data-placement="top"] {
|
|
24
|
+
margin-top: min(10dvh, 96px);
|
|
25
|
+
margin-bottom: auto;
|
|
26
|
+
}
|
|
27
|
+
.dialogHeader {
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
gap: 16px;
|
|
33
|
+
padding: 12px 8px 12px 20px;
|
|
34
|
+
border-bottom: var(--separator-width) var(--separator-style) var(--separator-color);
|
|
35
|
+
}
|
|
36
|
+
.dialogHeading {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 14px;
|
|
40
|
+
min-width: 0;
|
|
41
|
+
}
|
|
42
|
+
.dialogHeading h2 {
|
|
43
|
+
min-width: 0;
|
|
44
|
+
overflow-wrap: anywhere;
|
|
45
|
+
font-size: 18px;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
line-height: 1.5;
|
|
48
|
+
}
|
|
49
|
+
.dialogClose {
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
margin: 0;
|
|
52
|
+
color: var(--muted);
|
|
53
|
+
}
|
|
54
|
+
.dialogIcon {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
flex: 0 0 21px;
|
|
59
|
+
width: 21px;
|
|
60
|
+
height: 25px;
|
|
61
|
+
color: var(--dialog-tone, var(--accent-ink, var(--accent)));
|
|
62
|
+
}
|
|
63
|
+
.dialogIcon > svg {
|
|
64
|
+
width: 21px;
|
|
65
|
+
height: 21px;
|
|
66
|
+
stroke-width: 1.7;
|
|
67
|
+
}
|
|
68
|
+
.dialog[data-tone="info"] {
|
|
69
|
+
--dialog-tone: var(--accent-ink, var(--accent));
|
|
70
|
+
}
|
|
71
|
+
.dialog[data-tone="success"] {
|
|
72
|
+
--dialog-tone: var(--success);
|
|
73
|
+
}
|
|
74
|
+
.dialog[data-tone="warning"] {
|
|
75
|
+
--dialog-tone: var(--warning);
|
|
76
|
+
}
|
|
77
|
+
.dialog[data-tone="danger"] {
|
|
78
|
+
--dialog-tone: var(--danger);
|
|
79
|
+
}
|
|
80
|
+
.dialogBody {
|
|
81
|
+
min-height: 0;
|
|
82
|
+
overflow: auto;
|
|
83
|
+
overscroll-behavior: contain;
|
|
84
|
+
padding: 18px 20px 20px;
|
|
85
|
+
}
|
|
86
|
+
.dialogBody > p {
|
|
87
|
+
color: var(--muted);
|
|
88
|
+
font-size: 12px;
|
|
89
|
+
line-height: 1.8;
|
|
90
|
+
}
|
|
91
|
+
.dialogFooter {
|
|
92
|
+
flex-shrink: 0;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
display: flex;
|
|
95
|
+
justify-content: flex-end;
|
|
96
|
+
gap: 8px;
|
|
97
|
+
padding: 14px 24px;
|
|
98
|
+
border-top: var(--separator-width) var(--separator-style)
|
|
99
|
+
var(--separator-color);
|
|
100
|
+
background: var(--canvas);
|
|
101
|
+
}
|
|
102
|
+
.wide {
|
|
103
|
+
width: min(var(--dialog-wide-width), calc(100vw - 32px));
|
|
104
|
+
}
|
|
105
|
+
.small {
|
|
106
|
+
width: min(420px, calc(100vw - 32px));
|
|
107
|
+
}
|
|
108
|
+
.dialog:is([data-variant="message"], [data-variant="confirm"]) .dialogHeading {
|
|
109
|
+
gap: 10px;
|
|
110
|
+
}
|
|
111
|
+
.dialog:is([data-variant="message"], [data-variant="confirm"])
|
|
112
|
+
.dialogHeader
|
|
113
|
+
h2 {
|
|
114
|
+
font-size: 17px;
|
|
115
|
+
}
|
|
116
|
+
.dialog:is([data-variant="message"], [data-variant="confirm"]) .dialogBody {
|
|
117
|
+
padding: 18px 20px 20px;
|
|
118
|
+
}
|
|
119
|
+
.closing {
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
.dialog.closing::backdrop {
|
|
123
|
+
background: transparent;
|
|
124
|
+
backdrop-filter: blur(0);
|
|
125
|
+
transition:
|
|
126
|
+
background var(--popup-exit),
|
|
127
|
+
backdrop-filter var(--popup-exit);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (max-width: 600px) {
|
|
131
|
+
.dialog {
|
|
132
|
+
max-height: calc(100dvh - 24px);
|
|
133
|
+
}
|
|
134
|
+
.dialogBody {
|
|
135
|
+
padding: 16px;
|
|
136
|
+
}
|
|
137
|
+
.dialogHeader {
|
|
138
|
+
padding: 10px 8px 10px 16px;
|
|
139
|
+
}
|
|
140
|
+
.dialogFooter {
|
|
141
|
+
padding: 18px 20px;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@keyframes fade-in {
|
|
146
|
+
from {
|
|
147
|
+
opacity: 0;
|
|
148
|
+
}
|
|
149
|
+
to {
|
|
150
|
+
opacity: 1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
text-decoration: underline;
|
|
13
13
|
}
|
|
14
14
|
.link:focus-visible {
|
|
15
|
-
outline: 2px solid var(--
|
|
15
|
+
outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
|
|
16
16
|
outline-offset: 3px;
|
|
17
17
|
}
|
|
18
18
|
.link[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
|
package/components/Segmented.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useLayoutEffect, useRef } from "react";
|
|
4
4
|
import s from "./Segmented.module.css";
|
|
5
|
+
import focus from "./TabFocus.module.css";
|
|
5
6
|
function Segmented({
|
|
6
7
|
value,
|
|
7
8
|
onChange,
|
|
@@ -67,6 +68,7 @@ function Segmented({
|
|
|
67
68
|
"button",
|
|
68
69
|
{
|
|
69
70
|
type: "button",
|
|
71
|
+
className: focus.target,
|
|
70
72
|
ref: (node) => {
|
|
71
73
|
if (node) buttons.current.set(option.value, node);
|
|
72
74
|
else buttons.current.delete(option.value);
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
.navigationButton:focus-visible,
|
|
172
172
|
.groupToggle:focus-visible,
|
|
173
173
|
.disclosure:focus-visible {
|
|
174
|
-
outline: 2px solid var(--
|
|
174
|
+
outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
|
|
175
175
|
outline-offset: -2px;
|
|
176
176
|
}
|
|
177
177
|
.children {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.target:focus-visible {
|
|
2
|
+
outline: none;
|
|
3
|
+
}
|
|
4
|
+
.target:focus-visible::before,
|
|
5
|
+
.target:focus-visible::after {
|
|
6
|
+
content: "";
|
|
7
|
+
position: absolute;
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
}
|
|
10
|
+
.target:focus-visible::before {
|
|
11
|
+
inset: 2px 0;
|
|
12
|
+
border-radius: 5px;
|
|
13
|
+
background: var(--keyboard-focus-fill);
|
|
14
|
+
z-index: -1;
|
|
15
|
+
}
|
|
16
|
+
.target:focus-visible::after {
|
|
17
|
+
inset-inline: 0;
|
|
18
|
+
bottom: 4px;
|
|
19
|
+
width: min(20px, 55%);
|
|
20
|
+
height: 2px;
|
|
21
|
+
margin-inline: auto;
|
|
22
|
+
border-radius: 2px;
|
|
23
|
+
background: var(--keyboard-focus-stroke);
|
|
24
|
+
}
|
|
25
|
+
@media (forced-colors: active) {
|
|
26
|
+
.target:focus-visible {
|
|
27
|
+
outline: 2px solid Highlight;
|
|
28
|
+
outline-offset: -2px;
|
|
29
|
+
}
|
|
30
|
+
.target:focus-visible::before,
|
|
31
|
+
.target:focus-visible::after {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
package/components/TabList.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useTabIndicator } from "./useTabIndicator.js";
|
|
4
4
|
import s from "./Tab.module.css";
|
|
5
|
+
import focus from "./TabFocus.module.css";
|
|
5
6
|
function TabList({
|
|
6
7
|
value,
|
|
7
8
|
onChange,
|
|
@@ -32,6 +33,7 @@ function TabList({
|
|
|
32
33
|
{
|
|
33
34
|
type: "button",
|
|
34
35
|
role: "tab",
|
|
36
|
+
className: focus.target,
|
|
35
37
|
"data-value": option.value,
|
|
36
38
|
id: option.id,
|
|
37
39
|
"aria-controls": option.panelId,
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
color: var(--fg);
|
|
75
75
|
}
|
|
76
76
|
.link:focus-visible {
|
|
77
|
-
outline: 2px solid var(--
|
|
77
|
+
outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
|
|
78
78
|
outline-offset: -2px;
|
|
79
79
|
border-radius: 5px;
|
|
80
80
|
}
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
opacity: 0.65;
|
|
134
134
|
}
|
|
135
135
|
.trigger:focus-visible {
|
|
136
|
-
outline: 2px solid var(--
|
|
136
|
+
outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
|
|
137
137
|
outline-offset: 2px;
|
|
138
138
|
}
|
|
139
139
|
.card {
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
background: var(--selected);
|
|
204
204
|
}
|
|
205
205
|
.flatLink:focus-visible {
|
|
206
|
-
outline: 2px solid var(--
|
|
206
|
+
outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
|
|
207
207
|
outline-offset: -2px;
|
|
208
208
|
}
|
|
209
209
|
.number {
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
.railItem:focus-visible {
|
|
237
|
-
outline: 2px solid var(--
|
|
237
|
+
outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
|
|
238
238
|
outline-offset: 1px;
|
|
239
239
|
border-radius: 4px;
|
|
240
240
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
.panel {
|
|
2
2
|
padding: 20px 0;
|
|
3
3
|
}
|
|
4
|
+
.panel:focus-visible {
|
|
5
|
+
outline: none;
|
|
6
|
+
box-shadow: inset 0 2px var(--keyboard-focus-stroke);
|
|
7
|
+
}
|
|
8
|
+
@media (forced-colors: active) {
|
|
9
|
+
.panel:focus-visible {
|
|
10
|
+
outline: 2px solid Highlight;
|
|
11
|
+
outline-offset: -2px;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
CHANGED
package/styles/base.css
CHANGED
|
@@ -64,6 +64,8 @@
|
|
|
64
64
|
|
|
65
65
|
:root[data-ui-theme] {
|
|
66
66
|
--ui-font: "Segoe UI", "Microsoft YaHei", sans-serif;
|
|
67
|
+
--keyboard-focus-stroke: color-mix(in srgb, var(--accent-ink, var(--fg)) 72%, var(--surface));
|
|
68
|
+
--keyboard-focus-fill: color-mix(in srgb, var(--accent-ink, var(--fg)) 10%, transparent);
|
|
67
69
|
}
|
|
68
70
|
:root[data-ui-theme] body {
|
|
69
71
|
font: 14px/1.6 var(--ui-font);
|
|
@@ -91,8 +93,8 @@
|
|
|
91
93
|
summary,
|
|
92
94
|
[tabindex]
|
|
93
95
|
):focus-visible {
|
|
94
|
-
outline: 2px solid var(--
|
|
95
|
-
outline-offset:
|
|
96
|
+
outline: 2px solid var(--keyboard-focus-stroke);
|
|
97
|
+
outline-offset: 2px;
|
|
96
98
|
}
|
|
97
99
|
:root[data-ui-theme="minimal"] {
|
|
98
100
|
--sidebar: var(--navigation);
|