@alulore/kumiko 0.17.2 → 0.18.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/dist/avatar/avatar-name.d.ts +12 -0
- package/dist/avatar/avatar-name.js +42 -0
- package/dist/avatar/avatar.css +274 -0
- package/dist/avatar/avatar.d.ts +72 -0
- package/dist/avatar/avatar.js +45 -0
- package/dist/avatar/index.d.ts +3 -0
- package/dist/avatar/index.js +3 -0
- package/dist/board/board-api.d.ts +1 -0
- package/dist/board/board-selection.d.ts +1 -0
- package/dist/board/board-slots.d.ts +7 -0
- package/dist/board/board-slots.js +2 -1
- package/dist/board/refused-home.js +26 -1
- package/dist/dialog/dialog.d.ts +9 -0
- package/dist/dialog/dialog.js +20 -0
- package/dist/dialog/index.d.ts +4 -3
- package/dist/dialog/index.js +4 -3
- package/dist/drawer/drawer.css +514 -0
- package/dist/drawer/drawer.d.ts +55 -0
- package/dist/drawer/drawer.js +43 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/index.js +2 -0
- package/dist/file-input/file-dropzone.d.ts +67 -0
- package/dist/file-input/file-dropzone.js +97 -0
- package/dist/file-input/file-input.css +505 -0
- package/dist/file-input/file-input.d.ts +29 -0
- package/dist/file-input/file-input.js +21 -0
- package/dist/file-input/file-preview.d.ts +15 -0
- package/dist/file-input/file-preview.js +41 -0
- package/dist/file-input/index.d.ts +4 -0
- package/dist/file-input/index.js +4 -0
- package/dist/hover-card/hover-card.js +2 -0
- package/dist/media-viewer/index.d.ts +1 -0
- package/dist/media-viewer/index.js +1 -0
- package/dist/media-viewer/labels.d.ts +27 -0
- package/dist/media-viewer/labels.js +23 -0
- package/dist/media-viewer/media-viewer.d.ts +3 -0
- package/dist/media-viewer/media-viewer.js +6 -3
- package/dist/media-viewer/video-controls.js +4 -2
- package/dist/media-viewer/viewer-chrome.js +11 -5
- package/dist/menu/menu.js +2 -0
- package/dist/motion/settle-close.d.ts +5 -0
- package/dist/motion/settle-close.js +78 -0
- package/dist/otp-input/index.d.ts +2 -0
- package/dist/otp-input/index.js +2 -0
- package/dist/otp-input/otp-input.css +336 -0
- package/dist/otp-input/otp-input.d.ts +56 -0
- package/dist/otp-input/otp-input.js +44 -0
- package/dist/popover/index.d.ts +2 -1
- package/dist/popover/index.js +2 -1
- package/dist/popover/popover.d.ts +3 -0
- package/dist/popover/popover.js +8 -0
- package/dist/server-render.test.d.ts +1 -0
- package/dist/server-render.test.js +57 -0
- package/dist/shortcuts/bindings.d.ts +23 -3
- package/dist/shortcuts/bindings.js +15 -9
- package/dist/shortcuts/bound.d.ts +15 -0
- package/dist/shortcuts/bound.js +55 -0
- package/dist/shortcuts/help.d.ts +7 -1
- package/dist/shortcuts/help.js +2 -2
- package/dist/shortcuts/index.d.ts +2 -1
- package/dist/shortcuts/index.js +1 -0
- package/dist/shortcuts/judge.d.ts +3 -0
- package/dist/shortcuts/judge.js +9 -1
- package/dist/shortcuts/list.d.ts +6 -1
- package/dist/shortcuts/list.js +6 -5
- package/dist/shortcuts/notes.d.ts +4 -0
- package/dist/shortcuts/notes.js +6 -0
- package/dist/shortcuts/provider.d.ts +8 -1
- package/dist/shortcuts/provider.js +47 -11
- package/dist/shortcuts/registration.d.ts +3 -1
- package/dist/shortcuts/registration.js +10 -2
- package/dist/shortcuts/shortcuts.css +5 -0
- package/dist/skeleton/index.d.ts +1 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton/skeleton.css +143 -0
- package/dist/skeleton/skeleton.d.ts +44 -0
- package/dist/skeleton/skeleton.js +22 -0
- package/dist/smooth-caret/smooth-caret.css +4 -2
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs.css +616 -0
- package/dist/tabs/tabs.d.ts +51 -0
- package/dist/tabs/tabs.js +20 -0
- package/dist/titlebar/index.d.ts +1 -1
- package/dist/titlebar/index.js +1 -1
- package/dist/titlebar/titlebar.d.ts +15 -2
- package/dist/titlebar/titlebar.js +18 -9
- package/dist/toast/index.d.ts +2 -1
- package/dist/toast/index.js +2 -1
- package/dist/tooltip/tooltip.js +2 -0
- package/dist/undo/index.d.ts +1 -1
- package/dist/undo/index.js +1 -1
- package/dist/undo/undo-keys.d.ts +7 -0
- package/dist/undo/undo-keys.js +18 -7
- package/package.json +59 -5
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
@import "../motion/motion.css";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Styles ui-sdk's drawer. Ui-sdk places the sheet, slides it and fades the backdrop; Kumiko gives the sheet its
|
|
5
|
+
* size, surface and corners, and lays out the header, body and footer. The tokens fall back to the dialog's, so a
|
|
6
|
+
* theme that styles dialogs styles drawers too.
|
|
7
|
+
*/
|
|
8
|
+
@layer kumiko {
|
|
9
|
+
:where(:root) {
|
|
10
|
+
--kumiko-drawer-padding: 1.25rem;
|
|
11
|
+
--kumiko-drawer-gap: 1rem;
|
|
12
|
+
--kumiko-drawer-width: 24rem;
|
|
13
|
+
--kumiko-drawer-room: 2.5rem;
|
|
14
|
+
--kumiko-drawer-sheet-width: 40rem;
|
|
15
|
+
--kumiko-drawer-max-height: 88dvh;
|
|
16
|
+
--kumiko-drawer-float-gap: 0.75rem;
|
|
17
|
+
--kumiko-drawer-grip-width: 2.5rem;
|
|
18
|
+
--kumiko-drawer-grip-height: 0.3125rem;
|
|
19
|
+
--kumiko-drawer-push: 0.04;
|
|
20
|
+
--kumiko-drawer-focus-ring: Highlight;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* The tokens that fall back to the dialog's resolve on each part, not on the root, so a dialog token set on any
|
|
25
|
+
* container reaches the drawer inside it.
|
|
26
|
+
*/
|
|
27
|
+
:where([data-slot^="drawer"]) {
|
|
28
|
+
--_drawer-bg: var(--kumiko-drawer-bg, var(--kumiko-dialog-bg, Canvas));
|
|
29
|
+
--_drawer-fg: var(--kumiko-drawer-fg, var(--kumiko-dialog-fg, CanvasText));
|
|
30
|
+
--_drawer-backdrop: var(
|
|
31
|
+
--kumiko-drawer-backdrop,
|
|
32
|
+
var(--kumiko-dialog-backdrop, rgb(0 0 0 / 0.45))
|
|
33
|
+
);
|
|
34
|
+
--_drawer-backdrop-blur: var(
|
|
35
|
+
--kumiko-drawer-backdrop-blur,
|
|
36
|
+
var(--kumiko-dialog-backdrop-blur, 0px)
|
|
37
|
+
);
|
|
38
|
+
--_drawer-border-width: var(
|
|
39
|
+
--kumiko-drawer-border-width,
|
|
40
|
+
var(--kumiko-dialog-border-width, 1px)
|
|
41
|
+
);
|
|
42
|
+
--_drawer-radius: var(--kumiko-drawer-radius, var(--kumiko-dialog-radius, 1rem));
|
|
43
|
+
--_drawer-shadow: var(
|
|
44
|
+
--kumiko-drawer-shadow,
|
|
45
|
+
var(
|
|
46
|
+
--kumiko-dialog-shadow,
|
|
47
|
+
0 24px 64px -16px color-mix(in oklab, CanvasText 40%, transparent)
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
--_drawer-font-size: var(
|
|
51
|
+
--kumiko-drawer-font-size,
|
|
52
|
+
var(--kumiko-dialog-font-size, 0.9375rem)
|
|
53
|
+
);
|
|
54
|
+
--_drawer-title-font: var(
|
|
55
|
+
--kumiko-drawer-title-font,
|
|
56
|
+
var(--kumiko-dialog-title-font, inherit)
|
|
57
|
+
);
|
|
58
|
+
--_drawer-title-size: var(
|
|
59
|
+
--kumiko-drawer-title-size,
|
|
60
|
+
var(--kumiko-dialog-title-size, 1.125rem)
|
|
61
|
+
);
|
|
62
|
+
--_drawer-title-weight: var(
|
|
63
|
+
--kumiko-drawer-title-weight,
|
|
64
|
+
var(--kumiko-dialog-title-weight, 600)
|
|
65
|
+
);
|
|
66
|
+
--_drawer-description-size: var(
|
|
67
|
+
--kumiko-drawer-description-size,
|
|
68
|
+
var(--kumiko-dialog-description-size, 0.9em)
|
|
69
|
+
);
|
|
70
|
+
--_drawer-close-size: var(
|
|
71
|
+
--kumiko-drawer-close-size,
|
|
72
|
+
var(--kumiko-dialog-close-size, 2rem)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:where([data-slot="drawer-content"]) {
|
|
77
|
+
/* Derived colours resolve on the sheet, so they follow a fg and bg set on any container. */
|
|
78
|
+
--_drawer-border: var(
|
|
79
|
+
--kumiko-drawer-border,
|
|
80
|
+
color-mix(in oklab, var(--_drawer-fg) 14%, transparent)
|
|
81
|
+
);
|
|
82
|
+
--_drawer-muted-fg: var(
|
|
83
|
+
--kumiko-drawer-muted-fg,
|
|
84
|
+
color-mix(in oklab, var(--_drawer-fg) 64%, var(--_drawer-bg))
|
|
85
|
+
);
|
|
86
|
+
--_drawer-safe-top: env(safe-area-inset-top, 0px);
|
|
87
|
+
--_drawer-safe-bottom: env(safe-area-inset-bottom, 0px);
|
|
88
|
+
--_drawer-safe-left: env(safe-area-inset-left, 0px);
|
|
89
|
+
--_drawer-safe-right: env(safe-area-inset-right, 0px);
|
|
90
|
+
|
|
91
|
+
position: relative;
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
gap: var(--kumiko-drawer-gap);
|
|
95
|
+
box-sizing: border-box;
|
|
96
|
+
margin: 0;
|
|
97
|
+
padding: var(--kumiko-drawer-padding);
|
|
98
|
+
border: var(--_drawer-border-width) solid var(--_drawer-border);
|
|
99
|
+
background: var(--_drawer-bg);
|
|
100
|
+
box-shadow: var(--_drawer-shadow);
|
|
101
|
+
color: var(--_drawer-fg);
|
|
102
|
+
font-size: var(--_drawer-font-size);
|
|
103
|
+
line-height: 1.5;
|
|
104
|
+
outline: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* A side sheet is as tall as the page and leaves room beside it to press and close. */
|
|
108
|
+
:where([data-slot="drawer-content"]:is([data-side="left"], [data-side="right"])) {
|
|
109
|
+
inline-size: min(var(--kumiko-drawer-width), calc(100dvw - var(--kumiko-drawer-room)));
|
|
110
|
+
block-size: 100%;
|
|
111
|
+
padding-block: calc(var(--kumiko-drawer-padding) + var(--_drawer-safe-top))
|
|
112
|
+
calc(var(--kumiko-drawer-padding) + var(--_drawer-safe-bottom));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* A top or bottom sheet is as tall as its content, up to a cap, and centred when the page is wide. */
|
|
116
|
+
:where([data-slot="drawer-content"]:is([data-side="top"], [data-side="bottom"])) {
|
|
117
|
+
inline-size: min(var(--kumiko-drawer-sheet-width), 100%);
|
|
118
|
+
block-size: fit-content;
|
|
119
|
+
max-block-size: var(--kumiko-drawer-max-height);
|
|
120
|
+
margin-inline: auto;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:where([data-slot="drawer-content"][data-side="bottom"]) {
|
|
124
|
+
padding-block-end: calc(var(--kumiko-drawer-padding) + var(--_drawer-safe-bottom));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:where([data-slot="drawer-content"][data-side="top"]) {
|
|
128
|
+
padding-block-start: calc(var(--kumiko-drawer-padding) + var(--_drawer-safe-top));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/*
|
|
132
|
+
* Attached: flush to its edge, with no border there and only the inner corners round. The sides are physical,
|
|
133
|
+
* since ui-sdk resolves start and end to the edge the sheet came from.
|
|
134
|
+
*/
|
|
135
|
+
:where(
|
|
136
|
+
[data-slot="drawer-content"]:not([data-look="floating"]):not(
|
|
137
|
+
[data-kumiko-drawer~="floating"] *
|
|
138
|
+
),
|
|
139
|
+
[data-slot="drawer-content"][data-look="attached"]
|
|
140
|
+
) {
|
|
141
|
+
&[data-side="bottom"] {
|
|
142
|
+
border-bottom-width: 0;
|
|
143
|
+
border-top-left-radius: var(--_drawer-radius);
|
|
144
|
+
border-top-right-radius: var(--_drawer-radius);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&[data-side="top"] {
|
|
148
|
+
border-top-width: 0;
|
|
149
|
+
border-bottom-left-radius: var(--_drawer-radius);
|
|
150
|
+
border-bottom-right-radius: var(--_drawer-radius);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&[data-side="left"] {
|
|
154
|
+
border-left-width: 0;
|
|
155
|
+
border-top-right-radius: var(--_drawer-radius);
|
|
156
|
+
border-bottom-right-radius: var(--_drawer-radius);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&[data-side="right"] {
|
|
160
|
+
border-right-width: 0;
|
|
161
|
+
border-top-left-radius: var(--_drawer-radius);
|
|
162
|
+
border-bottom-left-radius: var(--_drawer-radius);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Covers the gap a drag past the largest snap point opens between the sheet and its edge. */
|
|
166
|
+
&::after {
|
|
167
|
+
position: absolute;
|
|
168
|
+
background: inherit;
|
|
169
|
+
content: "";
|
|
170
|
+
pointer-events: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&:is([data-side="top"], [data-side="bottom"])::after {
|
|
174
|
+
inset-inline: calc(-1 * var(--_drawer-border-width));
|
|
175
|
+
block-size: 6rem;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&[data-side="bottom"]::after {
|
|
179
|
+
top: 100%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&[data-side="top"]::after {
|
|
183
|
+
bottom: 100%;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&:is([data-side="left"], [data-side="right"])::after {
|
|
187
|
+
inset-block: 0;
|
|
188
|
+
inline-size: 6rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&[data-side="left"]::after {
|
|
192
|
+
right: 100%;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&[data-side="right"]::after {
|
|
196
|
+
left: 100%;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
* Floating: held off every edge of the page, with every corner round. Ui-sdk slides the sheet by its own size,
|
|
202
|
+
* margins left out, so a margin would leave a strip of it on screen when closed. The sheet stays flush to its
|
|
203
|
+
* edge and transparent, and draws its surface on a ::before held the gap off every side.
|
|
204
|
+
*/
|
|
205
|
+
:where(
|
|
206
|
+
[data-slot="drawer-content"]:is(
|
|
207
|
+
[data-look="floating"],
|
|
208
|
+
:not([data-look]):is([data-kumiko-drawer~="floating"] *)
|
|
209
|
+
)
|
|
210
|
+
) {
|
|
211
|
+
--_drawer-float-pad: calc(var(--kumiko-drawer-float-gap) + var(--kumiko-drawer-padding));
|
|
212
|
+
|
|
213
|
+
isolation: isolate;
|
|
214
|
+
padding: var(--_drawer-float-pad);
|
|
215
|
+
border: 0;
|
|
216
|
+
background: transparent;
|
|
217
|
+
box-shadow: none;
|
|
218
|
+
|
|
219
|
+
&::before {
|
|
220
|
+
position: absolute;
|
|
221
|
+
inset: var(--kumiko-drawer-float-gap);
|
|
222
|
+
z-index: -1;
|
|
223
|
+
box-sizing: border-box;
|
|
224
|
+
border: var(--_drawer-border-width) solid var(--_drawer-border);
|
|
225
|
+
border-radius: var(--_drawer-radius);
|
|
226
|
+
background: var(--_drawer-bg);
|
|
227
|
+
box-shadow: var(--_drawer-shadow);
|
|
228
|
+
content: "";
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&:is([data-side="left"], [data-side="right"]) {
|
|
233
|
+
inline-size: min(
|
|
234
|
+
calc(var(--kumiko-drawer-width) + var(--kumiko-drawer-float-gap)),
|
|
235
|
+
calc(100dvw - var(--kumiko-drawer-room))
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&[data-side="left"] {
|
|
240
|
+
padding-left: calc(var(--_drawer-float-pad) + var(--_drawer-safe-left));
|
|
241
|
+
|
|
242
|
+
&::before {
|
|
243
|
+
left: calc(var(--kumiko-drawer-float-gap) + var(--_drawer-safe-left));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
&[data-side="right"] {
|
|
248
|
+
padding-right: calc(var(--_drawer-float-pad) + var(--_drawer-safe-right));
|
|
249
|
+
|
|
250
|
+
&::before {
|
|
251
|
+
right: calc(var(--kumiko-drawer-float-gap) + var(--_drawer-safe-right));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
&:is([data-side="left"], [data-side="right"]) {
|
|
256
|
+
padding-block: calc(var(--_drawer-float-pad) + var(--_drawer-safe-top))
|
|
257
|
+
calc(var(--_drawer-float-pad) + var(--_drawer-safe-bottom));
|
|
258
|
+
|
|
259
|
+
&::before {
|
|
260
|
+
top: calc(var(--kumiko-drawer-float-gap) + var(--_drawer-safe-top));
|
|
261
|
+
bottom: calc(var(--kumiko-drawer-float-gap) + var(--_drawer-safe-bottom));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
&:is([data-side="top"], [data-side="bottom"]) {
|
|
266
|
+
inline-size: min(
|
|
267
|
+
calc(var(--kumiko-drawer-sheet-width) + 2 * var(--kumiko-drawer-float-gap)),
|
|
268
|
+
100%
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&[data-side="bottom"] {
|
|
273
|
+
padding-block-end: calc(var(--_drawer-float-pad) + var(--_drawer-safe-bottom));
|
|
274
|
+
|
|
275
|
+
&::before {
|
|
276
|
+
bottom: calc(var(--kumiko-drawer-float-gap) + var(--_drawer-safe-bottom));
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&[data-side="top"] {
|
|
281
|
+
padding-block-start: calc(var(--_drawer-float-pad) + var(--_drawer-safe-top));
|
|
282
|
+
|
|
283
|
+
&::before {
|
|
284
|
+
top: calc(var(--kumiko-drawer-float-gap) + var(--_drawer-safe-top));
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
& > [data-kumiko-drawer-close] {
|
|
289
|
+
inset-block-start: calc(
|
|
290
|
+
var(--kumiko-drawer-float-gap) + var(--kumiko-drawer-padding) / 2
|
|
291
|
+
);
|
|
292
|
+
inset-inline-end: calc(
|
|
293
|
+
var(--kumiko-drawer-float-gap) + var(--kumiko-drawer-padding) / 2
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* A sheet with another drawer open above it steps back, a little more for each one. */
|
|
299
|
+
:where(
|
|
300
|
+
[data-slot="drawer-content"]:not([data-push="false"]):not(
|
|
301
|
+
:not([data-push]):is([data-kumiko-drawer~="no-push"] *)
|
|
302
|
+
)
|
|
303
|
+
) {
|
|
304
|
+
scale: calc(1 - var(--drawer-stack, 0) * var(--kumiko-drawer-push));
|
|
305
|
+
|
|
306
|
+
&[data-side="bottom"] {
|
|
307
|
+
transform-origin: 50% 100%;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&[data-side="top"] {
|
|
311
|
+
transform-origin: 50% 0;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
&[data-side="left"] {
|
|
315
|
+
transform-origin: 0 50%;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&[data-side="right"] {
|
|
319
|
+
transform-origin: 100% 50%;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/* Stepping back is movement, so reduced and still motion leave the sheet where it is. */
|
|
324
|
+
@media (prefers-reduced-motion: reduce) {
|
|
325
|
+
:where([data-slot="drawer-content"]) {
|
|
326
|
+
scale: none;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
:where([data-kumiko-motion="still"] [data-slot="drawer-content"]) {
|
|
331
|
+
scale: none;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
:where([data-slot="drawer-backdrop"]) {
|
|
335
|
+
position: fixed;
|
|
336
|
+
inset: 0;
|
|
337
|
+
background: var(--_drawer-backdrop);
|
|
338
|
+
backdrop-filter: blur(var(--_drawer-backdrop-blur));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
:where([data-slot="drawer-header"]) {
|
|
342
|
+
display: grid;
|
|
343
|
+
grid-template-columns: minmax(0, 1fr);
|
|
344
|
+
gap: 0.375rem;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* A close button in the header sits at its end, beside the title. */
|
|
348
|
+
:where([data-slot="drawer-header"]:has(> [data-kumiko-drawer-close])) {
|
|
349
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
350
|
+
column-gap: 0.75rem;
|
|
351
|
+
|
|
352
|
+
& > :not([data-kumiko-drawer-close]) {
|
|
353
|
+
grid-column: 1;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
& > [data-kumiko-drawer-close] {
|
|
357
|
+
grid-row: 1 / span 2;
|
|
358
|
+
grid-column: 2;
|
|
359
|
+
align-self: start;
|
|
360
|
+
margin-block-start: calc(
|
|
361
|
+
(var(--_drawer-title-size) * 1.25 - var(--_drawer-close-size)) / 2
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
:where([data-slot="drawer-title"]) {
|
|
367
|
+
margin: 0;
|
|
368
|
+
color: var(--kumiko-drawer-title-fg, inherit);
|
|
369
|
+
font-family: var(--_drawer-title-font);
|
|
370
|
+
font-size: var(--_drawer-title-size);
|
|
371
|
+
font-weight: var(--_drawer-title-weight);
|
|
372
|
+
line-height: 1.25;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/* A title beside a corner "×" leaves room for it. */
|
|
376
|
+
:where(
|
|
377
|
+
[data-slot="drawer-content"]:has(> [data-kumiko-drawer-close]) > [data-slot="drawer-title"]
|
|
378
|
+
) {
|
|
379
|
+
padding-inline-end: var(--_drawer-close-size);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
:where([data-slot="drawer-description"]) {
|
|
383
|
+
margin: 0;
|
|
384
|
+
color: var(--kumiko-drawer-description-fg, var(--_drawer-muted-fg));
|
|
385
|
+
font-size: var(--_drawer-description-size);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/*
|
|
389
|
+
* Without a header, a description still sits close under its title. It comes after the description's own
|
|
390
|
+
* margin, which it overrides.
|
|
391
|
+
*/
|
|
392
|
+
:where(
|
|
393
|
+
[data-slot="drawer-content"] > [data-slot="drawer-title"] + [data-slot="drawer-description"]
|
|
394
|
+
) {
|
|
395
|
+
margin-block-start: calc(0.375rem - var(--kumiko-drawer-gap));
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/*
|
|
399
|
+
* The body scrolls, and reaches the sheet's sides so its scrollbar sits at the edge. It sets no
|
|
400
|
+
* overscroll-behavior: a swipe it can't scroll carries on to the sheet, which then moves.
|
|
401
|
+
*/
|
|
402
|
+
:where([data-slot="drawer-body"]) {
|
|
403
|
+
flex: 1 1 auto;
|
|
404
|
+
min-block-size: 0;
|
|
405
|
+
margin-inline: calc(-1 * var(--kumiko-drawer-padding));
|
|
406
|
+
padding-inline: var(--kumiko-drawer-padding);
|
|
407
|
+
overflow-y: auto;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
:where([data-slot="drawer-footer"]) {
|
|
411
|
+
display: flex;
|
|
412
|
+
flex-wrap: wrap;
|
|
413
|
+
gap: 0.5rem;
|
|
414
|
+
justify-content: flex-end;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/* The "×": in the header it sits beside the title; straight in the sheet, in its corner. */
|
|
418
|
+
:where([data-kumiko-drawer-close]) {
|
|
419
|
+
position: relative;
|
|
420
|
+
display: inline-grid;
|
|
421
|
+
flex: none;
|
|
422
|
+
box-sizing: border-box;
|
|
423
|
+
inline-size: var(--_drawer-close-size);
|
|
424
|
+
block-size: var(--_drawer-close-size);
|
|
425
|
+
margin: 0;
|
|
426
|
+
padding: 0;
|
|
427
|
+
border: 0;
|
|
428
|
+
border-radius: 999px;
|
|
429
|
+
background: transparent;
|
|
430
|
+
color: var(--_drawer-muted-fg);
|
|
431
|
+
font: inherit;
|
|
432
|
+
cursor: var(--kumiko-press-cursor, pointer);
|
|
433
|
+
place-items: center;
|
|
434
|
+
transition:
|
|
435
|
+
background-color var(--kumiko-fade-duration) var(--kumiko-enter-ease),
|
|
436
|
+
color var(--kumiko-fade-duration) var(--kumiko-enter-ease);
|
|
437
|
+
|
|
438
|
+
& > svg {
|
|
439
|
+
inline-size: 1rem;
|
|
440
|
+
block-size: 1rem;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
:where([data-slot="drawer-content"] > [data-kumiko-drawer-close]) {
|
|
445
|
+
position: absolute;
|
|
446
|
+
inset-block-start: calc(var(--kumiko-drawer-padding) / 2);
|
|
447
|
+
inset-inline-end: calc(var(--kumiko-drawer-padding) / 2);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
@media (hover: hover) and (pointer: fine) {
|
|
451
|
+
:where([data-kumiko-drawer-close]:hover) {
|
|
452
|
+
background: color-mix(in oklab, var(--_drawer-fg) 10%, transparent);
|
|
453
|
+
color: var(--_drawer-fg);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
:where([data-kumiko-drawer-close], [data-slot="drawer-handle"]):focus-visible {
|
|
458
|
+
outline: 2px solid var(--kumiko-drawer-focus-ring);
|
|
459
|
+
outline-offset: 2px;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/* The grip, drawn or as a handle: a short rounded bar centred across a top or bottom sheet. */
|
|
463
|
+
:where([data-slot="drawer-grip"], [data-slot="drawer-handle"]) {
|
|
464
|
+
position: relative;
|
|
465
|
+
display: block;
|
|
466
|
+
flex: none;
|
|
467
|
+
box-sizing: content-box;
|
|
468
|
+
inline-size: var(--kumiko-drawer-grip-width);
|
|
469
|
+
block-size: var(--kumiko-drawer-grip-height);
|
|
470
|
+
margin: calc(-0.5 * var(--kumiko-drawer-padding)) auto 0;
|
|
471
|
+
padding: 0;
|
|
472
|
+
border: 0;
|
|
473
|
+
border-radius: 999px;
|
|
474
|
+
background: var(
|
|
475
|
+
--kumiko-drawer-grip-color,
|
|
476
|
+
color-mix(in oklab, var(--_drawer-fg) 25%, transparent)
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
:where([data-slot="drawer-content"][data-side="top"])
|
|
481
|
+
> :where([data-slot="drawer-grip"], [data-slot="drawer-handle"]) {
|
|
482
|
+
margin: 0 auto calc(-0.5 * var(--kumiko-drawer-padding));
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/* A side sheet is dragged by its body, so it draws no grip. */
|
|
486
|
+
:where([data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]))
|
|
487
|
+
> :where([data-slot="drawer-grip"], [data-slot="drawer-handle"]) {
|
|
488
|
+
display: none;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
:where([data-slot="drawer-handle"]) {
|
|
492
|
+
cursor: var(--kumiko-press-cursor, pointer);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/* The handle is thin, so it gets a press area at least the touch target's height, on every pointer. */
|
|
496
|
+
:where([data-slot="drawer-handle"])::after {
|
|
497
|
+
position: absolute;
|
|
498
|
+
inset-inline: -0.75rem;
|
|
499
|
+
inset-block: calc(
|
|
500
|
+
(var(--kumiko-drawer-grip-height) - var(--kumiko-touch-target, 2.75rem)) / 2
|
|
501
|
+
);
|
|
502
|
+
content: "";
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
@media (forced-colors: active) {
|
|
506
|
+
:where([data-slot="drawer-content"]) {
|
|
507
|
+
border-color: CanvasText;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
:where([data-slot="drawer-grip"], [data-slot="drawer-handle"]) {
|
|
511
|
+
background: CanvasText;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DrawerClose, DrawerContent as SdkDrawerContent, DrawerHandle as SdkDrawerHandle, type DrawerProps as SdkDrawerProps } from "@ui-sdk/react/drawer";
|
|
2
|
+
/** How the sheet meets its edge: flush against it, or held a little off it as a card. */
|
|
3
|
+
export type DrawerLook = "attached" | "floating";
|
|
4
|
+
export type DrawerProps = SdkDrawerProps;
|
|
5
|
+
/**
|
|
6
|
+
* Ui-sdk's drawer, opening from the end of the line (the right in left-to-right text) unless `side` says
|
|
7
|
+
* otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Drawer({ side, ...props }: DrawerProps): React.JSX.Element;
|
|
10
|
+
type SdkContentProps = Parameters<typeof SdkDrawerContent>[0];
|
|
11
|
+
export type DrawerContentProps = SdkContentProps & {
|
|
12
|
+
/**
|
|
13
|
+
* How the sheet meets its edge. Without it, `data-kumiko-drawer="floating"` on any container picks.
|
|
14
|
+
* @defaultValue "attached"
|
|
15
|
+
*/
|
|
16
|
+
look?: DrawerLook;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the sheet steps back while a drawer opened from inside it is open. Without it,
|
|
19
|
+
* `data-kumiko-drawer="no-push"` on any container turns it off.
|
|
20
|
+
* @defaultValue true
|
|
21
|
+
*/
|
|
22
|
+
push?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** The sheet. Lay it out with `DrawerHeader`, `DrawerBody` and `DrawerFooter`, or put anything in it. */
|
|
25
|
+
export declare function DrawerContent({ look, push, ...props }: DrawerContentProps): React.JSX.Element | null;
|
|
26
|
+
/** The top of the sheet: its title, description and close button. It stays put while the body scrolls. */
|
|
27
|
+
export declare function DrawerHeader(props: React.ComponentProps<"div">): React.JSX.Element;
|
|
28
|
+
/** The middle of the sheet, which scrolls when the content is taller than the room. */
|
|
29
|
+
export declare function DrawerBody(props: React.ComponentProps<"div">): React.JSX.Element;
|
|
30
|
+
/** The bottom of the sheet: a row of actions at the end. It stays put while the body scrolls. */
|
|
31
|
+
export declare function DrawerFooter(props: React.ComponentProps<"div">): React.JSX.Element;
|
|
32
|
+
export type DrawerCloseButtonProps = Omit<Parameters<typeof DrawerClose>[0], "children"> & {
|
|
33
|
+
/**
|
|
34
|
+
* What screen readers call the button.
|
|
35
|
+
* @defaultValue "Close"
|
|
36
|
+
*/
|
|
37
|
+
label?: string;
|
|
38
|
+
};
|
|
39
|
+
/** The "×" that closes the drawer. In a `DrawerHeader` it sits at the header's end; straight in the sheet, in its corner. */
|
|
40
|
+
export declare function DrawerCloseButton({ label, ...props }: DrawerCloseButtonProps): React.JSX.Element;
|
|
41
|
+
/** A bar on a top or bottom sheet that shows it can be dragged. For a drawer with snap points, use `DrawerHandle`. */
|
|
42
|
+
export declare function DrawerGrip(props: React.ComponentProps<"div">): React.JSX.Element;
|
|
43
|
+
export type DrawerHandleProps = Parameters<typeof SdkDrawerHandle>[0] & {
|
|
44
|
+
/**
|
|
45
|
+
* What screen readers call the handle.
|
|
46
|
+
* @defaultValue "Resize"
|
|
47
|
+
*/
|
|
48
|
+
label?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The grip as a button, for a drawer with snap points: a press moves to the next one, and arrow keys, Home and End
|
|
52
|
+
* pick one.
|
|
53
|
+
*/
|
|
54
|
+
export declare function DrawerHandle({ label, ...props }: DrawerHandleProps): React.JSX.Element;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Drawer as SdkDrawer, DrawerClose, DrawerContent as SdkDrawerContent, DrawerHandle as SdkDrawerHandle } from "@ui-sdk/react/drawer";
|
|
3
|
+
/**
|
|
4
|
+
* Ui-sdk's drawer, opening from the end of the line (the right in left-to-right text) unless `side` says
|
|
5
|
+
* otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export function Drawer({ side = "end", ...props }) {
|
|
8
|
+
return _jsx(SdkDrawer, { side: side, ...props });
|
|
9
|
+
}
|
|
10
|
+
function onOff(on) {
|
|
11
|
+
return on === undefined ? undefined : String(on);
|
|
12
|
+
}
|
|
13
|
+
/** The sheet. Lay it out with `DrawerHeader`, `DrawerBody` and `DrawerFooter`, or put anything in it. */
|
|
14
|
+
export function DrawerContent({ look, push, ...props }) {
|
|
15
|
+
return _jsx(SdkDrawerContent, { "data-look": look, "data-push": onOff(push), ...props });
|
|
16
|
+
}
|
|
17
|
+
/** The top of the sheet: its title, description and close button. It stays put while the body scrolls. */
|
|
18
|
+
export function DrawerHeader(props) {
|
|
19
|
+
return _jsx("div", { "data-slot": "drawer-header", ...props });
|
|
20
|
+
}
|
|
21
|
+
/** The middle of the sheet, which scrolls when the content is taller than the room. */
|
|
22
|
+
export function DrawerBody(props) {
|
|
23
|
+
return _jsx("div", { "data-slot": "drawer-body", ...props });
|
|
24
|
+
}
|
|
25
|
+
/** The bottom of the sheet: a row of actions at the end. It stays put while the body scrolls. */
|
|
26
|
+
export function DrawerFooter(props) {
|
|
27
|
+
return _jsx("div", { "data-slot": "drawer-footer", ...props });
|
|
28
|
+
}
|
|
29
|
+
/** The "×" that closes the drawer. In a `DrawerHeader` it sits at the header's end; straight in the sheet, in its corner. */
|
|
30
|
+
export function DrawerCloseButton({ label = "Close", ...props }) {
|
|
31
|
+
return (_jsx(DrawerClose, { "data-kumiko-drawer-close": "", "aria-label": label, ...props, children: _jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, "aria-hidden": true, children: _jsx("path", { d: "M4 4l8 8M12 4l-8 8", strokeLinecap: "round" }) }) }));
|
|
32
|
+
}
|
|
33
|
+
/** A bar on a top or bottom sheet that shows it can be dragged. For a drawer with snap points, use `DrawerHandle`. */
|
|
34
|
+
export function DrawerGrip(props) {
|
|
35
|
+
return _jsx("div", { "data-slot": "drawer-grip", "aria-hidden": true, ...props });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The grip as a button, for a drawer with snap points: a press moves to the next one, and arrow keys, Home and End
|
|
39
|
+
* pick one.
|
|
40
|
+
*/
|
|
41
|
+
export function DrawerHandle({ label = "Resize", ...props }) {
|
|
42
|
+
return _jsx(SdkDrawerHandle, { "aria-label": label, ...props });
|
|
43
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerGrip, DrawerHandle, DrawerHeader, type DrawerCloseButtonProps, type DrawerContentProps, type DrawerHandleProps, type DrawerLook, type DrawerProps } from "./drawer";
|
|
2
|
+
export { createDrawerController, DrawerBackdrop, DrawerClose, DrawerDescription, DrawerOutlet, DrawerShortcut, DrawerTitle, DrawerTrigger, sheetPhysics, type DrawerApi, type DrawerBackdropState, type DrawerContentState, type DrawerController, type DrawerDismissAttemptDetails, type DrawerDismissReason, type DrawerDriver, type DrawerHandleState, type DrawerKeyframes, type DrawerOpenChangeReason, type DrawerOptions, type DrawerOutletProps, type DrawerOutletState, type DrawerPayloadChangeReason, type DrawerSide, type DrawerSnapPointChangeReason, type DrawerTriggerProps, type SheetPhysics, type SnapPoint } from "@ui-sdk/react/drawer";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerGrip, DrawerHandle, DrawerHeader } from "./drawer";
|
|
2
|
+
export { createDrawerController, DrawerBackdrop, DrawerClose, DrawerDescription, DrawerOutlet, DrawerShortcut, DrawerTitle, DrawerTrigger, sheetPhysics } from "@ui-sdk/react/drawer";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type FileRejection } from "@ui-sdk/react/file-input";
|
|
2
|
+
import { type FileInputLook, type FileInputProps } from "./file-input";
|
|
3
|
+
/**
|
|
4
|
+
* Where a file's upload stands, as the app reports it. Uploading itself is the app's job; Kumiko only shows it.
|
|
5
|
+
* A `progress` of null is an upload of unknown length.
|
|
6
|
+
*/
|
|
7
|
+
export type FileStatus = {
|
|
8
|
+
phase: "uploading";
|
|
9
|
+
progress?: number | null;
|
|
10
|
+
} | {
|
|
11
|
+
phase: "done";
|
|
12
|
+
} | {
|
|
13
|
+
phase: "failed";
|
|
14
|
+
reason?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
/** Every word the drop zone shows or says. Each has an English default. */
|
|
17
|
+
export interface FileDropzoneLabels {
|
|
18
|
+
/** The button. @defaultValue "Browse files", or "Choose a file" for one file */
|
|
19
|
+
browse: string;
|
|
20
|
+
/** The file list's name. @defaultValue "Files" */
|
|
21
|
+
list: string;
|
|
22
|
+
/** The page-wide layer while files are over the window. @defaultValue "Drop to add" */
|
|
23
|
+
overlay: string;
|
|
24
|
+
/** The list of files that were turned away. @defaultValue "Not added" */
|
|
25
|
+
rejected: string;
|
|
26
|
+
/** The button that clears that list. @defaultValue "Dismiss" */
|
|
27
|
+
dismiss: string;
|
|
28
|
+
/** @defaultValue "Uploading" */
|
|
29
|
+
uploading: string;
|
|
30
|
+
/** @defaultValue "Uploaded" */
|
|
31
|
+
uploaded: string;
|
|
32
|
+
/** @defaultValue "Upload failed" */
|
|
33
|
+
failed: string;
|
|
34
|
+
/** The remove button's name for a file. Without it, ui-sdk's "Remove" and the file's name. */
|
|
35
|
+
remove?: (fileName: string) => string;
|
|
36
|
+
/** Why a file was turned away, by ui-sdk's reason or a reason your `validate` returns. */
|
|
37
|
+
reasons: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
export declare const fileDropzoneLabels: Omit<FileDropzoneLabels, "browse">;
|
|
40
|
+
export type FileDropzoneProps = Omit<FileInputProps, "children" | "title"> & {
|
|
41
|
+
look?: FileInputLook;
|
|
42
|
+
/** The zone's main line. @defaultValue "Drag files here", or "Drag a file here" for one file */
|
|
43
|
+
title?: React.ReactNode;
|
|
44
|
+
/** A quieter line under the title, like the types and sizes it takes. */
|
|
45
|
+
hint?: React.ReactNode;
|
|
46
|
+
/** Replaces the upload arrow. Pass `null` for none. */
|
|
47
|
+
icon?: React.ReactNode;
|
|
48
|
+
/** Also takes files dropped anywhere on the page, with a full-page layer while they are over the window. */
|
|
49
|
+
pageDrop?: boolean;
|
|
50
|
+
/** Lists the files it holds. @defaultValue true */
|
|
51
|
+
showList?: boolean;
|
|
52
|
+
/** Shows a picture's thumbnail in the list. @defaultValue true */
|
|
53
|
+
thumbnails?: boolean;
|
|
54
|
+
/** Where each file's upload stands. Look files up by identity, like `uploads.get(file)`. */
|
|
55
|
+
status?: (file: File) => FileStatus | undefined;
|
|
56
|
+
/** Words for a turned-away file, when a label per reason isn't enough. Beats `labels.reasons`. */
|
|
57
|
+
describeRejection?: (rejection: FileRejection) => React.ReactNode;
|
|
58
|
+
/** For file sizes. @defaultValue the browser's language */
|
|
59
|
+
locale?: string;
|
|
60
|
+
labels?: Partial<FileDropzoneLabels>;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* A file input in one line: a drop zone with a button, the files it holds, and the files it turned away. It
|
|
64
|
+
* takes files from the picker, drops and pastes, checks them against `accept`, `maxSize` and the rest, and submits
|
|
65
|
+
* them with a form when it has a `name`. Uploading them is the app's job; pass `status` to show how each goes.
|
|
66
|
+
*/
|
|
67
|
+
export declare function FileDropzone({ title, hint, icon, pageDrop, showList, thumbnails, status, describeRejection, locale, labels, onReject, onValueChange, ...props }: FileDropzoneProps): React.JSX.Element;
|