@robert-stackflow/oneui 0.6.37 → 0.6.39
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 +269 -259
- package/README.md +329 -315
- package/components/Combobox.js +1 -0
- package/components/ContextMenu.js +4 -1
- package/components/ContextMenu.module.css +43 -43
- package/components/ContributionCalendar.d.ts +5 -1
- package/components/ContributionCalendar.js +8 -3
- package/components/ContributionCalendar.module.css +7 -1
- package/components/Dialog.module.css +153 -153
- package/components/IconButton.module.css +9 -2
- package/components/MenuItem.d.ts +1 -1
- package/components/MenuItem.js +2 -0
- package/components/MenuItem.module.css +9 -0
- package/components/MenuItemContent.d.ts +2 -1
- package/components/MenuItemContent.js +2 -1
- package/components/SelectOptionContent.js +1 -0
- package/components/types.d.ts +2 -0
- package/package.json +1 -1
package/components/Combobox.js
CHANGED
|
@@ -307,6 +307,7 @@ function Combobox({
|
|
|
307
307
|
label: item.label,
|
|
308
308
|
icon: item.icon,
|
|
309
309
|
description: item.description,
|
|
310
|
+
descriptionLines: item.descriptionLines,
|
|
310
311
|
shortcut: item.shortcut,
|
|
311
312
|
reserveIcon: filtered.some((option) => !!option.icon),
|
|
312
313
|
selected: value === item.value,
|
|
@@ -105,7 +105,10 @@ function ContextMenu({
|
|
|
105
105
|
document.addEventListener("pointerdown", pointer, true);
|
|
106
106
|
document.addEventListener("pointermove", track, true);
|
|
107
107
|
document.addEventListener("keydown", key2, true);
|
|
108
|
-
document.addEventListener("wheel", wheel, {
|
|
108
|
+
document.addEventListener("wheel", wheel, {
|
|
109
|
+
capture: true,
|
|
110
|
+
passive: false
|
|
111
|
+
});
|
|
109
112
|
window.addEventListener("blur", blur);
|
|
110
113
|
return () => {
|
|
111
114
|
document.removeEventListener("pointerdown", pointer, true);
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
.host {
|
|
2
|
-
min-width: 0;
|
|
3
|
-
}
|
|
4
|
-
.root {
|
|
5
|
-
position: fixed;
|
|
6
|
-
inset: 0;
|
|
7
|
-
margin: 0;
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: 100%;
|
|
10
|
-
padding: 0;
|
|
11
|
-
border: 0;
|
|
12
|
-
background: transparent;
|
|
13
|
-
color: var(--fg);
|
|
14
|
-
overflow: visible;
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
}
|
|
17
|
-
.root::backdrop {
|
|
18
|
-
background: transparent;
|
|
19
|
-
pointer-events: none;
|
|
20
|
-
}
|
|
21
|
-
.panel {
|
|
22
|
-
position: fixed;
|
|
23
|
-
pointer-events: auto;
|
|
24
|
-
width: 236px;
|
|
25
|
-
max-width: calc(100vw - 16px);
|
|
26
|
-
max-height: calc(100vh - 16px);
|
|
27
|
-
overflow: auto;
|
|
28
|
-
overscroll-behavior: contain;
|
|
29
|
-
padding: 5px;
|
|
30
|
-
background: var(--surface);
|
|
31
|
-
border: 1px solid var(--line);
|
|
32
|
-
border-radius: var(--radius);
|
|
33
|
-
box-shadow: var(--shadow);
|
|
34
|
-
}
|
|
35
|
-
.error {
|
|
36
|
-
padding: 8px;
|
|
37
|
-
color: var(--danger);
|
|
38
|
-
font-size: 12px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.panel[inert] {
|
|
42
|
-
pointer-events: none;
|
|
43
|
-
}
|
|
1
|
+
.host {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
}
|
|
4
|
+
.root {
|
|
5
|
+
position: fixed;
|
|
6
|
+
inset: 0;
|
|
7
|
+
margin: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
padding: 0;
|
|
11
|
+
border: 0;
|
|
12
|
+
background: transparent;
|
|
13
|
+
color: var(--fg);
|
|
14
|
+
overflow: visible;
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
}
|
|
17
|
+
.root::backdrop {
|
|
18
|
+
background: transparent;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
}
|
|
21
|
+
.panel {
|
|
22
|
+
position: fixed;
|
|
23
|
+
pointer-events: auto;
|
|
24
|
+
width: 236px;
|
|
25
|
+
max-width: calc(100vw - 16px);
|
|
26
|
+
max-height: calc(100vh - 16px);
|
|
27
|
+
overflow: auto;
|
|
28
|
+
overscroll-behavior: contain;
|
|
29
|
+
padding: 5px;
|
|
30
|
+
background: var(--surface);
|
|
31
|
+
border: 1px solid var(--line);
|
|
32
|
+
border-radius: var(--radius);
|
|
33
|
+
box-shadow: var(--shadow);
|
|
34
|
+
}
|
|
35
|
+
.error {
|
|
36
|
+
padding: 8px;
|
|
37
|
+
color: var(--danger);
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.panel[inert] {
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
import { type ContributionDay } from "./contribution";
|
|
2
|
-
export declare function ContributionCalendar({ data, year, startDate, endDate, weekStartsOn, value, onChange, label, unit, locale, color, emptyMode, allowFuture, today, thresholds, }: {
|
|
3
|
+
export declare function ContributionCalendar({ data, year, startDate, endDate, weekStartsOn, value, onChange, label, unit, locale, color, emptyMode, allowFuture, today, thresholds, footer, source, fill, }: {
|
|
3
4
|
data: ContributionDay[];
|
|
4
5
|
year?: number;
|
|
5
6
|
startDate?: string;
|
|
@@ -15,4 +16,7 @@ export declare function ContributionCalendar({ data, year, startDate, endDate, w
|
|
|
15
16
|
allowFuture?: boolean;
|
|
16
17
|
today?: string;
|
|
17
18
|
thresholds?: [number, number, number, number];
|
|
19
|
+
footer?: ReactNode;
|
|
20
|
+
source?: ReactNode;
|
|
21
|
+
fill?: boolean;
|
|
18
22
|
}): import("react").JSX.Element;
|
|
@@ -27,7 +27,10 @@ function ContributionCalendar({
|
|
|
27
27
|
emptyMode = "zero",
|
|
28
28
|
allowFuture = false,
|
|
29
29
|
today,
|
|
30
|
-
thresholds
|
|
30
|
+
thresholds,
|
|
31
|
+
footer,
|
|
32
|
+
source,
|
|
33
|
+
fill = false
|
|
31
34
|
}) {
|
|
32
35
|
const current = /* @__PURE__ */ new Date(), todayKey = today || [
|
|
33
36
|
current.getFullYear(),
|
|
@@ -109,6 +112,7 @@ function ContributionCalendar({
|
|
|
109
112
|
className: s.calendar,
|
|
110
113
|
style: {
|
|
111
114
|
"--calendar-color": color,
|
|
115
|
+
"--calendar-cell-max": fill ? "24px" : "13px",
|
|
112
116
|
"--calendar-weeks": model.weeks
|
|
113
117
|
},
|
|
114
118
|
children: [
|
|
@@ -183,7 +187,7 @@ function ContributionCalendar({
|
|
|
183
187
|
)
|
|
184
188
|
] }),
|
|
185
189
|
/* @__PURE__ */ jsxs("footer", { className: s.footer, children: [
|
|
186
|
-
value && /* @__PURE__ */ jsx("span", { children: value }),
|
|
190
|
+
source ?? (value && /* @__PURE__ */ jsx("span", { children: value })),
|
|
187
191
|
/* @__PURE__ */ jsxs("div", { className: s.legend, "aria-label": "\u6D3B\u52A8\u6B21\u6570\u7531\u5C11\u5230\u591A", children: [
|
|
188
192
|
/* @__PURE__ */ jsx("span", { children: "\u5C11" }),
|
|
189
193
|
[0, 1, 2, 3, 4].map((level) => /* @__PURE__ */ jsx(
|
|
@@ -197,7 +201,8 @@ function ContributionCalendar({
|
|
|
197
201
|
)),
|
|
198
202
|
/* @__PURE__ */ jsx("span", { children: "\u591A" })
|
|
199
203
|
] })
|
|
200
|
-
] })
|
|
204
|
+
] }),
|
|
205
|
+
footer && /* @__PURE__ */ jsx("div", { className: s.extraFooter, children: footer })
|
|
201
206
|
]
|
|
202
207
|
}
|
|
203
208
|
);
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--calendar-cell: clamp(
|
|
28
28
|
9px,
|
|
29
29
|
calc((100cqw - 32px) / var(--calendar-weeks) - var(--calendar-gap)),
|
|
30
|
-
13px
|
|
30
|
+
var(--calendar-cell-max, 13px)
|
|
31
31
|
);
|
|
32
32
|
overflow: auto;
|
|
33
33
|
padding: 3px 2px 6px;
|
|
@@ -119,3 +119,9 @@
|
|
|
119
119
|
.legend .day {
|
|
120
120
|
cursor: default;
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
.extraFooter {
|
|
124
|
+
margin-top: 16px;
|
|
125
|
+
padding-top: 16px;
|
|
126
|
+
border-top: 1px solid var(--line);
|
|
127
|
+
}
|
|
@@ -1,153 +1,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: flex-start;
|
|
31
|
-
justify-content: space-between;
|
|
32
|
-
gap: 16px;
|
|
33
|
-
padding: 24px 24px 20px;
|
|
34
|
-
}
|
|
35
|
-
.dialogHeading {
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
gap: 14px;
|
|
39
|
-
min-width: 0;
|
|
40
|
-
}
|
|
41
|
-
.dialogHeading h2 {
|
|
42
|
-
min-width: 0;
|
|
43
|
-
overflow-wrap: anywhere;
|
|
44
|
-
font-size: 18px;
|
|
45
|
-
font-weight: 600;
|
|
46
|
-
line-height: 1.5;
|
|
47
|
-
}
|
|
48
|
-
.dialogHeader > button {
|
|
49
|
-
flex-shrink: 0;
|
|
50
|
-
margin-top: -3px;
|
|
51
|
-
margin-right: -6px;
|
|
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: 0 24px 24px;
|
|
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"]) .dialogHeader {
|
|
109
|
-
padding: 22px 24px 12px;
|
|
110
|
-
}
|
|
111
|
-
.dialog:is([data-variant="message"], [data-variant="confirm"]) .dialogHeading {
|
|
112
|
-
gap: 10px;
|
|
113
|
-
}
|
|
114
|
-
.dialog:is([data-variant="message"], [data-variant="confirm"])
|
|
115
|
-
.dialogHeader
|
|
116
|
-
h2 {
|
|
117
|
-
font-size: 17px;
|
|
118
|
-
}
|
|
119
|
-
.dialog:is([data-variant="message"], [data-variant="confirm"]) .dialogBody {
|
|
120
|
-
padding: 0 24px 24px;
|
|
121
|
-
}
|
|
122
|
-
.closing {
|
|
123
|
-
pointer-events: none;
|
|
124
|
-
}
|
|
125
|
-
.dialog.closing::backdrop {
|
|
126
|
-
background: transparent;
|
|
127
|
-
backdrop-filter: blur(0);
|
|
128
|
-
transition:
|
|
129
|
-
background var(--popup-exit),
|
|
130
|
-
backdrop-filter var(--popup-exit);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@media (max-width: 600px) {
|
|
134
|
-
.dialog {
|
|
135
|
-
max-height: calc(100dvh - 24px);
|
|
136
|
-
}
|
|
137
|
-
.dialogBody {
|
|
138
|
-
padding: 0 20px 20px;
|
|
139
|
-
}
|
|
140
|
-
.dialogHeader,
|
|
141
|
-
.dialogFooter {
|
|
142
|
-
padding: 18px 20px;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
@keyframes fade-in {
|
|
147
|
-
from {
|
|
148
|
-
opacity: 0;
|
|
149
|
-
}
|
|
150
|
-
to {
|
|
151
|
-
opacity: 1;
|
|
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: flex-start;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
gap: 16px;
|
|
33
|
+
padding: 24px 24px 20px;
|
|
34
|
+
}
|
|
35
|
+
.dialogHeading {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: 14px;
|
|
39
|
+
min-width: 0;
|
|
40
|
+
}
|
|
41
|
+
.dialogHeading h2 {
|
|
42
|
+
min-width: 0;
|
|
43
|
+
overflow-wrap: anywhere;
|
|
44
|
+
font-size: 18px;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
line-height: 1.5;
|
|
47
|
+
}
|
|
48
|
+
.dialogHeader > button {
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
margin-top: -3px;
|
|
51
|
+
margin-right: -6px;
|
|
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: 0 24px 24px;
|
|
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"]) .dialogHeader {
|
|
109
|
+
padding: 22px 24px 12px;
|
|
110
|
+
}
|
|
111
|
+
.dialog:is([data-variant="message"], [data-variant="confirm"]) .dialogHeading {
|
|
112
|
+
gap: 10px;
|
|
113
|
+
}
|
|
114
|
+
.dialog:is([data-variant="message"], [data-variant="confirm"])
|
|
115
|
+
.dialogHeader
|
|
116
|
+
h2 {
|
|
117
|
+
font-size: 17px;
|
|
118
|
+
}
|
|
119
|
+
.dialog:is([data-variant="message"], [data-variant="confirm"]) .dialogBody {
|
|
120
|
+
padding: 0 24px 24px;
|
|
121
|
+
}
|
|
122
|
+
.closing {
|
|
123
|
+
pointer-events: none;
|
|
124
|
+
}
|
|
125
|
+
.dialog.closing::backdrop {
|
|
126
|
+
background: transparent;
|
|
127
|
+
backdrop-filter: blur(0);
|
|
128
|
+
transition:
|
|
129
|
+
background var(--popup-exit),
|
|
130
|
+
backdrop-filter var(--popup-exit);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (max-width: 600px) {
|
|
134
|
+
.dialog {
|
|
135
|
+
max-height: calc(100dvh - 24px);
|
|
136
|
+
}
|
|
137
|
+
.dialogBody {
|
|
138
|
+
padding: 0 20px 20px;
|
|
139
|
+
}
|
|
140
|
+
.dialogHeader,
|
|
141
|
+
.dialogFooter {
|
|
142
|
+
padding: 18px 20px;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@keyframes fade-in {
|
|
147
|
+
from {
|
|
148
|
+
opacity: 0;
|
|
149
|
+
}
|
|
150
|
+
to {
|
|
151
|
+
opacity: 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
color: var(--muted);
|
|
12
12
|
transition:
|
|
13
13
|
background var(--motion-hover),
|
|
14
|
-
color var(--motion-hover)
|
|
14
|
+
color var(--motion-hover),
|
|
15
|
+
opacity var(--motion-hover);
|
|
15
16
|
}
|
|
16
|
-
.iconButton:hover {
|
|
17
|
+
.iconButton:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
17
18
|
color: var(--fg);
|
|
18
19
|
background: var(--hover);
|
|
19
20
|
}
|
|
@@ -83,3 +84,9 @@
|
|
|
83
84
|
.iconButton[data-variant="ghost"][aria-pressed="true"]:hover:not(:disabled) {
|
|
84
85
|
background: color-mix(in srgb, var(--selected) 70%, var(--hover));
|
|
85
86
|
}
|
|
87
|
+
|
|
88
|
+
.iconButton:disabled,
|
|
89
|
+
.iconButton[aria-disabled="true"] {
|
|
90
|
+
opacity: 0.35;
|
|
91
|
+
cursor: not-allowed;
|
|
92
|
+
}
|
package/components/MenuItem.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export type MenuItemProps = Omit<HTMLAttributes<HTMLElement>, "children" | "pref
|
|
|
17
17
|
selection?: "check" | "checkbox" | "radio";
|
|
18
18
|
tone?: "default" | "danger";
|
|
19
19
|
};
|
|
20
|
-
export declare function MenuItem({ as, asChild, children, prefix, label, description, icon, reserveIcon, shortcut, trailing, meta, selected, active, disabled, selection, tone, className, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
20
|
+
export declare function MenuItem({ as, asChild, children, prefix, label, description, descriptionLines, icon, reserveIcon, shortcut, trailing, meta, selected, active, disabled, selection, tone, className, ...props }: MenuItemProps): import("react").JSX.Element;
|
package/components/MenuItem.js
CHANGED
|
@@ -14,6 +14,7 @@ function MenuItem({
|
|
|
14
14
|
prefix,
|
|
15
15
|
label,
|
|
16
16
|
description,
|
|
17
|
+
descriptionLines,
|
|
17
18
|
icon,
|
|
18
19
|
reserveIcon = false,
|
|
19
20
|
shortcut,
|
|
@@ -34,6 +35,7 @@ function MenuItem({
|
|
|
34
35
|
{
|
|
35
36
|
label,
|
|
36
37
|
description,
|
|
38
|
+
descriptionLines,
|
|
37
39
|
icon,
|
|
38
40
|
reserveIcon
|
|
39
41
|
}
|
|
@@ -118,6 +118,15 @@
|
|
|
118
118
|
white-space: nowrap;
|
|
119
119
|
text-align: right;
|
|
120
120
|
}
|
|
121
|
+
.description[data-lines="2"],
|
|
122
|
+
.description[data-lines="3"] {
|
|
123
|
+
display: -webkit-box;
|
|
124
|
+
-webkit-box-orient: vertical;
|
|
125
|
+
-webkit-line-clamp: 2;
|
|
126
|
+
white-space: pre-line;
|
|
127
|
+
overflow-wrap: anywhere;
|
|
128
|
+
}
|
|
129
|
+
.description[data-lines="3"] { -webkit-line-clamp: 3; }
|
|
121
130
|
.shortcut ~ .trailing:empty {
|
|
122
131
|
display: none;
|
|
123
132
|
}
|
|
@@ -2,7 +2,8 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
export type MenuItemContentProps = {
|
|
3
3
|
label: ReactNode;
|
|
4
4
|
description?: ReactNode;
|
|
5
|
+
descriptionLines?: 1 | 2 | 3;
|
|
5
6
|
icon?: ReactNode;
|
|
6
7
|
reserveIcon?: boolean;
|
|
7
8
|
};
|
|
8
|
-
export declare function MenuItemContent({ label, description, icon, reserveIcon, }: MenuItemContentProps): import("react").JSX.Element;
|
|
9
|
+
export declare function MenuItemContent({ label, description, descriptionLines, icon, reserveIcon, }: MenuItemContentProps): import("react").JSX.Element;
|
|
@@ -4,6 +4,7 @@ import s from "./MenuItem.module.css";
|
|
|
4
4
|
function MenuItemContent({
|
|
5
5
|
label,
|
|
6
6
|
description,
|
|
7
|
+
descriptionLines = 1,
|
|
7
8
|
icon,
|
|
8
9
|
reserveIcon = false
|
|
9
10
|
}) {
|
|
@@ -11,7 +12,7 @@ function MenuItemContent({
|
|
|
11
12
|
(icon || reserveIcon) && /* @__PURE__ */ jsx("span", { className: s.leading, "data-menu-icon": true, "aria-hidden": "true", children: icon }),
|
|
12
13
|
/* @__PURE__ */ jsxs("span", { className: s.copy, children: [
|
|
13
14
|
/* @__PURE__ */ jsx("span", { className: s.label, "data-menu-label": true, children: label }),
|
|
14
|
-
description && /* @__PURE__ */ jsx("span", { className: s.description, children: description })
|
|
15
|
+
description && /* @__PURE__ */ jsx("span", { className: s.description, "data-lines": descriptionLines, title: typeof description === "string" ? description : void 0, children: description })
|
|
15
16
|
] })
|
|
16
17
|
] });
|
|
17
18
|
}
|
package/components/types.d.ts
CHANGED