@alulore/kumiko 0.18.3 → 0.19.0
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/dialog/ask.d.ts +7 -0
- package/dist/dialog/ask.js +8 -0
- package/dist/dialog/dialog-content.d.ts +23 -0
- package/dist/dialog/dialog-content.js +15 -0
- package/dist/dialog/dialog-entry.d.ts +14 -0
- package/dist/dialog/dialog-entry.js +111 -0
- package/dist/dialog/dialog-labels.d.ts +23 -0
- package/dist/dialog/dialog-labels.js +16 -0
- package/dist/dialog/dialog-store.d.ts +139 -0
- package/dist/dialog/dialog-store.js +296 -0
- package/dist/dialog/dialog.css +36 -0
- package/dist/dialog/dialog.d.ts +0 -3
- package/dist/dialog/dialog.js +0 -6
- package/dist/dialog/index.d.ts +8 -2
- package/dist/dialog/index.js +7 -2
- package/dist/dialog/leave-guard.d.ts +24 -0
- package/dist/dialog/leave-guard.js +98 -0
- package/dist/dialog/nest.d.ts +14 -0
- package/dist/dialog/nest.js +26 -0
- package/dist/dialog/open-dialog.d.ts +16 -0
- package/dist/dialog/open-dialog.js +13 -0
- package/dist/dialog/overlay-host.d.ts +27 -0
- package/dist/dialog/overlay-host.js +47 -0
- package/dist/dialog/question-dialog.d.ts +21 -0
- package/dist/dialog/question-dialog.js +78 -0
- package/dist/drawer/drawer.css +18 -16
- package/dist/menu/menu.css +21 -17
- package/dist/otp-input/otp-input.css +38 -37
- package/dist/page/index.d.ts +8 -0
- package/dist/page/index.js +8 -0
- package/dist/page/page-action.d.ts +26 -0
- package/dist/page/page-action.js +23 -0
- package/dist/page/page-actions.d.ts +10 -0
- package/dist/page/page-actions.js +66 -0
- package/dist/page/page-back.d.ts +11 -0
- package/dist/page/page-back.js +17 -0
- package/dist/page/page-breadcrumbs.d.ts +21 -0
- package/dist/page/page-breadcrumbs.js +60 -0
- package/dist/page/page-context.d.ts +5 -0
- package/dist/page/page-context.js +13 -0
- package/dist/page/page-fit.d.ts +26 -0
- package/dist/page/page-fit.js +36 -0
- package/dist/page/page-header.d.ts +26 -0
- package/dist/page/page-header.js +16 -0
- package/dist/page/page-icons.d.ts +4 -0
- package/dist/page/page-icons.js +13 -0
- package/dist/page/page-labels.d.ts +12 -0
- package/dist/page/page-labels.js +6 -0
- package/dist/page/page-section.d.ts +14 -0
- package/dist/page/page-section.js +9 -0
- package/dist/page/page.css +422 -0
- package/dist/page/page.d.ts +16 -0
- package/dist/page/page.js +12 -0
- package/dist/page/use-measured-fit.d.ts +22 -0
- package/dist/page/use-measured-fit.js +75 -0
- package/dist/page/use-stuck.d.ts +7 -0
- package/dist/page/use-stuck.js +31 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.js +3 -0
- package/dist/pagination/pagination-extras.d.ts +28 -0
- package/dist/pagination/pagination-extras.js +42 -0
- package/dist/pagination/pagination-fit.d.ts +15 -0
- package/dist/pagination/pagination-fit.js +52 -0
- package/dist/pagination/pagination-icons.d.ts +4 -0
- package/dist/pagination/pagination-icons.js +16 -0
- package/dist/pagination/pagination-labels.d.ts +23 -0
- package/dist/pagination/pagination-labels.js +14 -0
- package/dist/pagination/pagination-math.d.ts +7 -0
- package/dist/pagination/pagination-math.js +24 -0
- package/dist/pagination/pagination-motion.d.ts +6 -0
- package/dist/pagination/pagination-motion.js +71 -0
- package/dist/pagination/pagination.css +455 -0
- package/dist/pagination/pagination.d.ts +59 -0
- package/dist/pagination/pagination.js +77 -0
- package/dist/select/select.css +6 -10
- package/dist/server-render.test.js +49 -0
- package/dist/sidebar/app-shell.d.ts +54 -0
- package/dist/sidebar/app-shell.js +28 -0
- package/dist/sidebar/index.d.ts +9 -0
- package/dist/sidebar/index.js +8 -0
- package/dist/sidebar/shell-context.d.ts +30 -0
- package/dist/sidebar/shell-context.js +20 -0
- package/dist/sidebar/shell-sheet.d.ts +7 -0
- package/dist/sidebar/shell-sheet.js +12 -0
- package/dist/sidebar/shell-top-bar.d.ts +8 -0
- package/dist/sidebar/shell-top-bar.js +25 -0
- package/dist/sidebar/sidebar-body.d.ts +5 -0
- package/dist/sidebar/sidebar-body.js +37 -0
- package/dist/sidebar/sidebar-icons.d.ts +4 -0
- package/dist/sidebar/sidebar-icons.js +13 -0
- package/dist/sidebar/sidebar-item.d.ts +26 -0
- package/dist/sidebar/sidebar-item.js +68 -0
- package/dist/sidebar/sidebar-labels.d.ts +14 -0
- package/dist/sidebar/sidebar-labels.js +7 -0
- package/dist/sidebar/sidebar-marker.d.ts +12 -0
- package/dist/sidebar/sidebar-marker.js +77 -0
- package/dist/sidebar/sidebar-storage.d.ts +18 -0
- package/dist/sidebar/sidebar-storage.js +27 -0
- package/dist/sidebar/sidebar-toggle.d.ts +7 -0
- package/dist/sidebar/sidebar-toggle.js +18 -0
- package/dist/sidebar/sidebar.css +587 -0
- package/dist/sidebar/sidebar.d.ts +19 -0
- package/dist/sidebar/sidebar.js +31 -0
- package/dist/sidebar/use-collapsed.d.ts +13 -0
- package/dist/sidebar/use-collapsed.js +20 -0
- package/dist/sidebar/use-narrow.d.ts +4 -0
- package/dist/sidebar/use-narrow.js +18 -0
- package/dist/sidebar/use-shell-focus.d.ts +8 -0
- package/dist/sidebar/use-shell-focus.js +30 -0
- package/dist/sidebar/use-shell-shortcut.d.ts +4 -0
- package/dist/sidebar/use-shell-shortcut.js +32 -0
- package/dist/sidebar/use-shell-state.d.ts +18 -0
- package/dist/sidebar/use-shell-state.js +47 -0
- package/dist/slider/slider.css +9 -6
- package/dist/smooth-caret/caret-geometry.js +10 -4
- package/dist/table/data-table-props.d.ts +96 -0
- package/dist/table/data-table-props.js +1 -0
- package/dist/table/data-table.d.ts +7 -0
- package/dist/table/data-table.js +59 -0
- package/dist/table/index.d.ts +7 -0
- package/dist/table/index.js +5 -0
- package/dist/table/table-actions.d.ts +9 -0
- package/dist/table/table-actions.js +24 -0
- package/dist/table/table-builder.d.ts +60 -0
- package/dist/table/table-builder.js +99 -0
- package/dist/table/table-cells.d.ts +19 -0
- package/dist/table/table-cells.js +67 -0
- package/dist/table/table-columns.d.ts +38 -0
- package/dist/table/table-columns.js +119 -0
- package/dist/table/table-icons.d.ts +3 -0
- package/dist/table/table-icons.js +8 -0
- package/dist/table/table-labels.d.ts +24 -0
- package/dist/table/table-labels.js +17 -0
- package/dist/table/table-model.d.ts +28 -0
- package/dist/table/table-model.js +69 -0
- package/dist/table/table-sections.d.ts +25 -0
- package/dist/table/table-sections.js +79 -0
- package/dist/table/table-state.d.ts +42 -0
- package/dist/table/table-state.js +81 -0
- package/dist/table/table-types.d.ts +86 -0
- package/dist/table/table-types.js +1 -0
- package/dist/table/table.css +919 -0
- package/dist/table/use-table-view.d.ts +30 -0
- package/dist/table/use-table-view.js +147 -0
- package/dist/toast/index.d.ts +1 -2
- package/dist/toast/index.js +1 -2
- package/package.json +44 -1
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
@import "../motion/motion.css";
|
|
2
|
+
@import "../button/button.css";
|
|
3
|
+
@import "../drawer/drawer.css";
|
|
4
|
+
@import "../tooltip/tooltip.css";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* The app shell: a sidebar beside the page. It collapses to an icon rail or slides out, and on a phone the shell
|
|
8
|
+
* puts it in a drawer. A media query can't read a custom property, so each narrow-at word has its own query below,
|
|
9
|
+
* and they match the ones in use-narrow.ts.
|
|
10
|
+
*/
|
|
11
|
+
@layer kumiko {
|
|
12
|
+
:where(:root) {
|
|
13
|
+
--kumiko-touch-target: 2.75rem;
|
|
14
|
+
--kumiko-sidebar-width: 16rem;
|
|
15
|
+
--kumiko-sidebar-rail-width: 3.5rem;
|
|
16
|
+
--kumiko-sidebar-bg: color-mix(in oklab, CanvasText 3.5%, Canvas);
|
|
17
|
+
--kumiko-sidebar-fg: CanvasText;
|
|
18
|
+
--kumiko-sidebar-muted: color-mix(in oklab, CanvasText 58%, Canvas);
|
|
19
|
+
--kumiko-sidebar-border: color-mix(in oklab, CanvasText 12%, Canvas);
|
|
20
|
+
--kumiko-sidebar-item-height: 2.25rem;
|
|
21
|
+
--kumiko-sidebar-item-radius: 0.5rem;
|
|
22
|
+
--kumiko-sidebar-item-gap: 0.125rem;
|
|
23
|
+
--kumiko-sidebar-item-hover-bg: color-mix(in oklab, CanvasText 7%, transparent);
|
|
24
|
+
--kumiko-sidebar-current-fg: CanvasText;
|
|
25
|
+
--kumiko-sidebar-indicator-bg: color-mix(in oklab, Highlight 16%, Canvas);
|
|
26
|
+
--kumiko-sidebar-indicator-shadow: 0 1px 2px
|
|
27
|
+
color-mix(in oklab, CanvasText 14%, transparent);
|
|
28
|
+
--kumiko-sidebar-badge-bg: Highlight;
|
|
29
|
+
--kumiko-sidebar-badge-fg: HighlightText;
|
|
30
|
+
--kumiko-sidebar-group-gap: 1rem;
|
|
31
|
+
--kumiko-sidebar-padding: 0.5rem;
|
|
32
|
+
--kumiko-sidebar-page-bg: Canvas;
|
|
33
|
+
--kumiko-sidebar-page-radius: 0.75rem;
|
|
34
|
+
--kumiko-sidebar-topbar-height: 3rem;
|
|
35
|
+
--kumiko-sidebar-focus-ring: Highlight;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* The shell fills its container. The two custom properties say whether the top bar and the in-place sidebar
|
|
40
|
+
* show: the narrow queries and hide mode change them, so the server's wide markup looks right on a phone before
|
|
41
|
+
* script runs.
|
|
42
|
+
*/
|
|
43
|
+
:where([data-slot="app-shell"]) {
|
|
44
|
+
--_dir: 1;
|
|
45
|
+
--_bar: none;
|
|
46
|
+
--_inplace: flex;
|
|
47
|
+
|
|
48
|
+
position: relative;
|
|
49
|
+
display: flex;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
inline-size: 100%;
|
|
52
|
+
min-block-size: var(--kumiko-shell-min-block-size, 100dvh);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:where([data-slot="app-shell"]:dir(rtl)) {
|
|
56
|
+
--_dir: -1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:where([data-slot="app-shell"][data-collapse="hide"][data-collapsed]) {
|
|
60
|
+
--_bar: flex;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media (width < 40rem) {
|
|
64
|
+
:where([data-slot="app-shell"][data-narrow-at="sm"]) {
|
|
65
|
+
--_bar: flex;
|
|
66
|
+
--_inplace: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (width < 56rem) {
|
|
71
|
+
:where([data-slot="app-shell"][data-narrow-at="md"]) {
|
|
72
|
+
--_bar: flex;
|
|
73
|
+
--_inplace: none;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media (width < 64rem) {
|
|
78
|
+
:where([data-slot="app-shell"][data-narrow-at="lg"]) {
|
|
79
|
+
--_bar: flex;
|
|
80
|
+
--_inplace: none;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* The skip link is first in the order and out of sight until Tab reaches it. */
|
|
85
|
+
:where([data-slot="app-shell-skip"]:not(:focus)) {
|
|
86
|
+
position: absolute;
|
|
87
|
+
inline-size: 1px;
|
|
88
|
+
block-size: 1px;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
clip-path: inset(50%);
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:where([data-slot="app-shell-skip"]:focus) {
|
|
95
|
+
position: absolute;
|
|
96
|
+
inset-block-start: 0.5rem;
|
|
97
|
+
inset-inline-start: 0.5rem;
|
|
98
|
+
z-index: 20;
|
|
99
|
+
padding: 0.5rem 0.875rem;
|
|
100
|
+
border-radius: var(--kumiko-sidebar-item-radius);
|
|
101
|
+
background: var(--kumiko-sidebar-page-bg);
|
|
102
|
+
color: var(--kumiko-sidebar-fg);
|
|
103
|
+
box-shadow: 0 0 0 2px var(--kumiko-sidebar-focus-ring);
|
|
104
|
+
font-size: 0.875rem;
|
|
105
|
+
outline: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:where([data-slot="app-shell-page"]) {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex: 1 1 0;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
min-inline-size: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:where([data-slot="app-shell-main"]) {
|
|
116
|
+
flex: 1 1 auto;
|
|
117
|
+
min-block-size: 0;
|
|
118
|
+
outline: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:where([data-slot="app-shell-top-bar"]) {
|
|
122
|
+
position: sticky;
|
|
123
|
+
inset-block-start: 0;
|
|
124
|
+
z-index: 2;
|
|
125
|
+
display: var(--_bar);
|
|
126
|
+
flex: none;
|
|
127
|
+
align-items: center;
|
|
128
|
+
gap: 0.5rem;
|
|
129
|
+
box-sizing: border-box;
|
|
130
|
+
block-size: var(--kumiko-sidebar-topbar-height);
|
|
131
|
+
padding-inline: var(--kumiko-sidebar-padding);
|
|
132
|
+
border-block-end: 1px solid var(--kumiko-sidebar-border);
|
|
133
|
+
background: var(--kumiko-sidebar-page-bg);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* The sidebar. It keeps to the top as the page scrolls, and its body scrolls on its own. */
|
|
137
|
+
:where([data-slot="sidebar"]) {
|
|
138
|
+
--_icon: 1.25rem;
|
|
139
|
+
--_px: calc(
|
|
140
|
+
(var(--kumiko-sidebar-rail-width) - 2 * var(--kumiko-sidebar-padding) - var(--_icon)) /
|
|
141
|
+
2
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
box-sizing: border-box;
|
|
147
|
+
min-inline-size: 0;
|
|
148
|
+
overflow: hidden;
|
|
149
|
+
background: var(--kumiko-sidebar-bg);
|
|
150
|
+
color: var(--kumiko-sidebar-fg);
|
|
151
|
+
font-size: 0.875rem;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:where([data-slot="sidebar"][data-placement="page"]) {
|
|
155
|
+
--_w: var(--kumiko-sidebar-width);
|
|
156
|
+
|
|
157
|
+
position: sticky;
|
|
158
|
+
inset-block-start: 0;
|
|
159
|
+
display: var(--_inplace);
|
|
160
|
+
flex: none;
|
|
161
|
+
align-self: flex-start;
|
|
162
|
+
inline-size: var(--_w);
|
|
163
|
+
block-size: var(--kumiko-shell-min-block-size, 100dvh);
|
|
164
|
+
border-inline-end: 1px solid var(--kumiko-sidebar-border);
|
|
165
|
+
transition: inline-size var(--kumiko-settle-duration) var(--kumiko-settle-ease);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:where([data-slot="sidebar"][data-rail]) {
|
|
169
|
+
--_w: var(--kumiko-sidebar-rail-width);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
:where([data-slot="sidebar"][data-hidden]) {
|
|
173
|
+
--_w: 0px;
|
|
174
|
+
|
|
175
|
+
border-inline-end-width: 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
:where([data-slot="sidebar"][data-placement="sheet"]) {
|
|
179
|
+
inline-size: 100%;
|
|
180
|
+
block-size: 100%;
|
|
181
|
+
background: transparent;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:where([data-slot="sidebar-inner"]) {
|
|
185
|
+
display: flex;
|
|
186
|
+
flex: 1 1 auto;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
min-block-size: 0;
|
|
190
|
+
padding: var(--kumiko-sidebar-padding);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/*
|
|
194
|
+
* In hide mode the sidebar keeps its full width while its box shrinks to nothing, so its content slides away
|
|
195
|
+
* instead of squeezing.
|
|
196
|
+
*/
|
|
197
|
+
:where([data-slot="sidebar"][data-placement="page"]:is([data-hidden], :not([data-rail]))) {
|
|
198
|
+
& > [data-slot="sidebar-inner"] {
|
|
199
|
+
inline-size: var(--kumiko-sidebar-width);
|
|
200
|
+
transition: translate var(--kumiko-settle-duration) var(--kumiko-settle-ease);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:where([data-slot="sidebar"][data-hidden] > [data-slot="sidebar-inner"]) {
|
|
205
|
+
translate: calc(var(--_dir) * -100%) 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
:where([data-slot="sidebar"][data-rail] > [data-slot="sidebar-inner"]) {
|
|
209
|
+
inline-size: 100%;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
:where([data-slot="sidebar-header"]) {
|
|
213
|
+
display: flex;
|
|
214
|
+
flex: none;
|
|
215
|
+
align-items: center;
|
|
216
|
+
box-sizing: border-box;
|
|
217
|
+
min-block-size: 2.75rem;
|
|
218
|
+
padding: 0 var(--_px) 0.5rem;
|
|
219
|
+
overflow: hidden;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
:where([data-slot="sidebar-footer"]) {
|
|
223
|
+
display: flex;
|
|
224
|
+
flex: none;
|
|
225
|
+
align-items: center;
|
|
226
|
+
gap: 0.5rem;
|
|
227
|
+
padding-block-start: 0.5rem;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-footer"]) {
|
|
231
|
+
flex-direction: column;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
:where([data-slot="sidebar-footer"] > [data-sidebar-toggle]) {
|
|
235
|
+
flex: none;
|
|
236
|
+
margin-inline-start: auto;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-footer"] > [data-sidebar-toggle]) {
|
|
240
|
+
margin-inline-start: 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* The body scrolls, and its edges fade where there is more to see. */
|
|
244
|
+
:where([data-slot="sidebar-body"]) {
|
|
245
|
+
--_fade-top: 0px;
|
|
246
|
+
--_fade-bottom: 0px;
|
|
247
|
+
|
|
248
|
+
flex: 1 1 auto;
|
|
249
|
+
min-block-size: 0;
|
|
250
|
+
overflow: hidden auto;
|
|
251
|
+
overscroll-behavior: contain;
|
|
252
|
+
scrollbar-width: thin;
|
|
253
|
+
mask-image: linear-gradient(
|
|
254
|
+
to bottom,
|
|
255
|
+
transparent 0,
|
|
256
|
+
#000 var(--_fade-top),
|
|
257
|
+
#000 calc(100% - var(--_fade-bottom)),
|
|
258
|
+
transparent 100%
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
:where([data-slot="sidebar-body"][data-more-above]) {
|
|
263
|
+
--_fade-top: 1.25rem;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
:where([data-slot="sidebar-body"][data-more-below]) {
|
|
267
|
+
--_fade-bottom: 1.25rem;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-body"]) {
|
|
271
|
+
scrollbar-width: none;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:where([data-slot="sidebar-content"]) {
|
|
275
|
+
position: relative;
|
|
276
|
+
isolation: isolate;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
:where([data-slot="sidebar-list"]) {
|
|
280
|
+
display: flex;
|
|
281
|
+
flex-direction: column;
|
|
282
|
+
gap: var(--kumiko-sidebar-item-gap);
|
|
283
|
+
margin: 0;
|
|
284
|
+
padding: 0;
|
|
285
|
+
list-style: none;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* A group is a heading over its items. In the rail the heading shrinks away and a divider takes its place. */
|
|
289
|
+
:where([data-slot="sidebar-group"]) {
|
|
290
|
+
border-block-start: 1px solid transparent;
|
|
291
|
+
transition: border-color var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
:where([data-slot="sidebar-group"]:not(:first-child)) {
|
|
295
|
+
margin-block-start: calc(var(--kumiko-sidebar-group-gap) / 2);
|
|
296
|
+
padding-block-start: calc(var(--kumiko-sidebar-group-gap) / 2);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-group"]:not(:first-child)) {
|
|
300
|
+
border-block-start-color: var(--kumiko-sidebar-border);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
:where([data-slot="sidebar-group-label"]) {
|
|
304
|
+
box-sizing: border-box;
|
|
305
|
+
block-size: 1.75rem;
|
|
306
|
+
margin: 0;
|
|
307
|
+
padding: 0.375rem var(--_px) 0.125rem;
|
|
308
|
+
overflow: hidden;
|
|
309
|
+
color: var(--kumiko-sidebar-muted);
|
|
310
|
+
font-size: 0.75rem;
|
|
311
|
+
font-weight: 600;
|
|
312
|
+
letter-spacing: 0.02em;
|
|
313
|
+
line-height: 1.25rem;
|
|
314
|
+
white-space: nowrap;
|
|
315
|
+
transition:
|
|
316
|
+
block-size var(--kumiko-settle-duration) var(--kumiko-settle-ease),
|
|
317
|
+
padding var(--kumiko-settle-duration) var(--kumiko-settle-ease),
|
|
318
|
+
opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-group-label"]) {
|
|
322
|
+
block-size: 0;
|
|
323
|
+
padding-block: 0;
|
|
324
|
+
opacity: 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/*
|
|
328
|
+
* The marker is one element under the items, which Script places over the current one. Until it has, and
|
|
329
|
+
* without script, the current item carries the fill itself.
|
|
330
|
+
*/
|
|
331
|
+
:where([data-slot="sidebar-marker"]) {
|
|
332
|
+
position: absolute;
|
|
333
|
+
inset: 0 auto auto 0;
|
|
334
|
+
z-index: 0;
|
|
335
|
+
box-sizing: border-box;
|
|
336
|
+
inline-size: var(--_w, 0);
|
|
337
|
+
block-size: var(--_h, 0);
|
|
338
|
+
translate: var(--_x, 0) var(--_y, 0);
|
|
339
|
+
border-radius: var(--kumiko-sidebar-item-radius);
|
|
340
|
+
background: var(--kumiko-sidebar-indicator-bg);
|
|
341
|
+
box-shadow: var(--kumiko-sidebar-indicator-shadow);
|
|
342
|
+
opacity: 0;
|
|
343
|
+
pointer-events: none;
|
|
344
|
+
transition:
|
|
345
|
+
translate var(--kumiko-move-duration) var(--kumiko-move-ease),
|
|
346
|
+
inline-size var(--kumiko-move-duration) var(--kumiko-move-ease),
|
|
347
|
+
block-size var(--kumiko-move-duration) var(--kumiko-move-ease),
|
|
348
|
+
opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
:where([data-slot="sidebar-marker"][data-placed]:not([data-hidden])) {
|
|
352
|
+
opacity: 1;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
:where([data-slot="sidebar-marker"][data-instant]) {
|
|
356
|
+
transition: opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
:where([data-slot="sidebar-item"]) {
|
|
360
|
+
position: relative;
|
|
361
|
+
z-index: 1;
|
|
362
|
+
display: flex;
|
|
363
|
+
align-items: center;
|
|
364
|
+
gap: 0.75rem;
|
|
365
|
+
box-sizing: border-box;
|
|
366
|
+
inline-size: 100%;
|
|
367
|
+
block-size: var(--kumiko-sidebar-item-height);
|
|
368
|
+
padding: 0 var(--_px);
|
|
369
|
+
border: 0;
|
|
370
|
+
border-radius: var(--kumiko-sidebar-item-radius);
|
|
371
|
+
background: transparent;
|
|
372
|
+
color: var(--kumiko-sidebar-fg);
|
|
373
|
+
font: inherit;
|
|
374
|
+
font-weight: 500;
|
|
375
|
+
text-align: start;
|
|
376
|
+
text-decoration: none;
|
|
377
|
+
cursor: var(--kumiko-press-cursor, pointer);
|
|
378
|
+
user-select: none;
|
|
379
|
+
-webkit-tap-highlight-color: transparent;
|
|
380
|
+
transition:
|
|
381
|
+
background-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
|
|
382
|
+
color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
|
|
383
|
+
scale var(--kumiko-lift-duration) var(--kumiko-lift-ease);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
:where([data-slot="sidebar-item"][aria-current="page"]) {
|
|
387
|
+
color: var(--kumiko-sidebar-current-fg);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
:where(
|
|
391
|
+
[data-slot="sidebar-content"]:not([data-marker])
|
|
392
|
+
[data-slot="sidebar-item"][aria-current="page"]
|
|
393
|
+
) {
|
|
394
|
+
background: var(--kumiko-sidebar-indicator-bg);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
:where([data-slot="sidebar-item"]):focus-visible {
|
|
398
|
+
outline: 2px solid var(--kumiko-sidebar-focus-ring);
|
|
399
|
+
outline-offset: -2px;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
:where([data-slot="sidebar-item"]):active {
|
|
403
|
+
scale: var(--kumiko-press-scale);
|
|
404
|
+
transition-duration:
|
|
405
|
+
var(--kumiko-fade-duration), var(--kumiko-fade-duration), var(--kumiko-press-duration);
|
|
406
|
+
transition-timing-function:
|
|
407
|
+
var(--kumiko-fade-ease), var(--kumiko-fade-ease), var(--kumiko-press-ease);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
@media (hover: hover) and (pointer: fine) {
|
|
411
|
+
:where([data-slot="sidebar-item"]:not([aria-current="page"])):hover {
|
|
412
|
+
background: var(--kumiko-sidebar-item-hover-bg);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* A finger gets a full-size target, taller than the item where needed. */
|
|
417
|
+
@media (pointer: coarse) {
|
|
418
|
+
:where([data-slot="sidebar-item"])::after {
|
|
419
|
+
content: "";
|
|
420
|
+
position: absolute;
|
|
421
|
+
inset: 50% auto auto 50%;
|
|
422
|
+
translate: -50% -50%;
|
|
423
|
+
inline-size: max(100%, var(--kumiko-touch-target));
|
|
424
|
+
block-size: max(100%, var(--kumiko-touch-target));
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
:where([data-slot="sidebar-item-icon"]) {
|
|
429
|
+
display: grid;
|
|
430
|
+
flex: none;
|
|
431
|
+
place-items: center;
|
|
432
|
+
inline-size: var(--_icon);
|
|
433
|
+
block-size: var(--_icon);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
:where([data-slot="sidebar-item-icon"] > svg) {
|
|
437
|
+
inline-size: 100%;
|
|
438
|
+
block-size: 100%;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
:where(:dir(rtl) [data-slot="sidebar-icon"][data-mirror]) {
|
|
442
|
+
scale: -1 1;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
:where([data-slot="sidebar-item-label"]) {
|
|
446
|
+
flex: 1 1 auto;
|
|
447
|
+
min-inline-size: 0;
|
|
448
|
+
overflow: hidden;
|
|
449
|
+
text-overflow: ellipsis;
|
|
450
|
+
white-space: nowrap;
|
|
451
|
+
transition: opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
:where([data-slot="sidebar-item-badge"]) {
|
|
455
|
+
display: grid;
|
|
456
|
+
flex: none;
|
|
457
|
+
place-items: center;
|
|
458
|
+
box-sizing: border-box;
|
|
459
|
+
min-inline-size: 1.25rem;
|
|
460
|
+
block-size: 1.25rem;
|
|
461
|
+
padding-inline: 0.375rem;
|
|
462
|
+
border-radius: 999px;
|
|
463
|
+
font-size: 0.6875rem;
|
|
464
|
+
font-variant-numeric: tabular-nums;
|
|
465
|
+
font-weight: 600;
|
|
466
|
+
line-height: 1;
|
|
467
|
+
transition: opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
:where([data-slot="sidebar-item-badge"][data-kind="count"]) {
|
|
471
|
+
background: var(--kumiko-sidebar-badge-bg);
|
|
472
|
+
color: var(--kumiko-sidebar-badge-fg);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-item-label"]) {
|
|
476
|
+
opacity: 0;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/* In the rail a count shrinks to a dot at the corner of the icon, and any other badge steps aside. */
|
|
480
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-item-badge"]) {
|
|
481
|
+
position: absolute;
|
|
482
|
+
inset-block-start: calc(50% - var(--_icon) / 2 - 0.125rem);
|
|
483
|
+
inset-inline-start: calc(var(--_px) + var(--_icon) - 0.375rem);
|
|
484
|
+
min-inline-size: 0;
|
|
485
|
+
inline-size: 0.5rem;
|
|
486
|
+
block-size: 0.5rem;
|
|
487
|
+
padding: 0;
|
|
488
|
+
box-shadow: 0 0 0 2px var(--kumiko-sidebar-bg);
|
|
489
|
+
font-size: 0;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
:where([data-slot="sidebar"][data-rail] [data-slot="sidebar-item-badge"][data-kind="mark"]) {
|
|
493
|
+
opacity: 0;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/* The sidebar as the phone drawer's sheet: flush, with no padding of the drawer's own. */
|
|
497
|
+
:where([data-slot="drawer-content"][data-sidebar-sheet]) {
|
|
498
|
+
gap: 0;
|
|
499
|
+
padding: 0;
|
|
500
|
+
background: var(--kumiko-sidebar-bg);
|
|
501
|
+
color: var(--kumiko-sidebar-fg);
|
|
502
|
+
inline-size: min(var(--kumiko-sidebar-width), calc(100dvw - 3rem));
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/* Inset: the sidebar and the page sit on one surface, and the page is raised on a rounded sheet of its own. */
|
|
506
|
+
:where(
|
|
507
|
+
[data-slot="app-shell"]:is(
|
|
508
|
+
[data-look="inset"],
|
|
509
|
+
:not([data-look]):is([data-kumiko-sidebar~="inset"] *)
|
|
510
|
+
)
|
|
511
|
+
) {
|
|
512
|
+
background: var(--kumiko-sidebar-bg);
|
|
513
|
+
|
|
514
|
+
& > [data-slot="sidebar"][data-placement="page"] {
|
|
515
|
+
border-inline-end-width: 0;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
& > [data-slot="app-shell-page"] {
|
|
519
|
+
margin: 0.5rem;
|
|
520
|
+
overflow: clip;
|
|
521
|
+
border-radius: var(--kumiko-sidebar-page-radius);
|
|
522
|
+
background: var(--kumiko-sidebar-page-bg);
|
|
523
|
+
box-shadow:
|
|
524
|
+
0 0 0 1px var(--kumiko-sidebar-border),
|
|
525
|
+
0 1px 3px color-mix(in oklab, CanvasText 10%, transparent);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
@media (forced-colors: active) {
|
|
530
|
+
:where([data-slot="sidebar"][data-placement="page"]) {
|
|
531
|
+
border-inline-end-color: CanvasText;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
:where([data-slot="sidebar-marker"]),
|
|
535
|
+
:where(
|
|
536
|
+
[data-slot="sidebar-content"]:not([data-marker])
|
|
537
|
+
[data-slot="sidebar-item"][aria-current="page"]
|
|
538
|
+
) {
|
|
539
|
+
forced-color-adjust: none;
|
|
540
|
+
background: Highlight;
|
|
541
|
+
box-shadow: none;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
:where([data-slot="sidebar-item"][aria-current="page"]) {
|
|
545
|
+
forced-color-adjust: none;
|
|
546
|
+
color: HighlightText;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
:where([data-slot="sidebar-item-badge"][data-kind="count"]) {
|
|
550
|
+
forced-color-adjust: none;
|
|
551
|
+
background: ButtonText;
|
|
552
|
+
color: ButtonFace;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/*
|
|
558
|
+
* The page's sticky bar sits below the shell's top bar while it shows. These repeat the conditions that show the bar
|
|
559
|
+
* (hide mode collapsed, and the three narrow-at queries), because a media query can't read a custom property.
|
|
560
|
+
*/
|
|
561
|
+
@layer kumiko {
|
|
562
|
+
:where([data-slot="app-shell"]) {
|
|
563
|
+
--kumiko-page-sticky-top: 0px;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
:where([data-slot="app-shell"][data-collapse="hide"][data-collapsed]) {
|
|
567
|
+
--kumiko-page-sticky-top: var(--kumiko-sidebar-topbar-height);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
@media (width < 40rem) {
|
|
571
|
+
:where([data-slot="app-shell"][data-narrow-at="sm"]) {
|
|
572
|
+
--kumiko-page-sticky-top: var(--kumiko-sidebar-topbar-height);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
@media (width < 56rem) {
|
|
577
|
+
:where([data-slot="app-shell"][data-narrow-at="md"]) {
|
|
578
|
+
--kumiko-page-sticky-top: var(--kumiko-sidebar-topbar-height);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
@media (width < 64rem) {
|
|
583
|
+
:where([data-slot="app-shell"][data-narrow-at="lg"]) {
|
|
584
|
+
--kumiko-page-sticky-top: var(--kumiko-sidebar-topbar-height);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SidebarProps extends Omit<React.ComponentProps<"nav">, "aria-label"> {
|
|
2
|
+
/** Names the navigation landmark, and the drawer on a phone, like "Admin". */
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The navigation landmark. Lay it out with `SidebarHeader`, `SidebarBody` and `SidebarFooter`. Beside the page it
|
|
7
|
+
* keeps to the top as the page scrolls; on a phone the shell draws it inside its drawer.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Sidebar({ label, children, ...props }: SidebarProps): React.JSX.Element;
|
|
10
|
+
/** The top of the sidebar, for a wordmark. It stays put while the body scrolls. */
|
|
11
|
+
export declare function SidebarHeader(props: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
/** The bottom of the sidebar, for the signed-in user and a `SidebarToggle`. It stays put while the body scrolls. */
|
|
13
|
+
export declare function SidebarFooter(props: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
export interface SidebarGroupProps extends Omit<React.ComponentProps<"li">, "aria-labelledby"> {
|
|
15
|
+
/** The group's heading. In the rail it shrinks away, and a divider takes its place. */
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
/** A labelled set of items. */
|
|
19
|
+
export declare function SidebarGroup({ label, children, ...props }: SidebarGroupProps): React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { DrawerCloseButton, DrawerContent } from "../drawer";
|
|
4
|
+
import { useAppShell, useShellInternals } from "./shell-context";
|
|
5
|
+
/**
|
|
6
|
+
* The navigation landmark. Lay it out with `SidebarHeader`, `SidebarBody` and `SidebarFooter`. Beside the page it
|
|
7
|
+
* keeps to the top as the page scrolls; on a phone the shell draws it inside its drawer.
|
|
8
|
+
*/
|
|
9
|
+
export function Sidebar({ label, children, ...props }) {
|
|
10
|
+
const { collapsed, rail } = useAppShell();
|
|
11
|
+
const { collapse, placement, labels } = useShellInternals();
|
|
12
|
+
const hidden = placement === "page" && collapse === "hide" && collapsed;
|
|
13
|
+
const nav = (_jsx("nav", { "data-slot": "sidebar", "data-placement": placement, "data-rail": rail || undefined, "data-hidden": hidden || undefined, inert: hidden, "aria-label": label, ...props, children: _jsx("div", { "data-slot": "sidebar-inner", children: children }) }));
|
|
14
|
+
if (placement === "page") {
|
|
15
|
+
return nav;
|
|
16
|
+
}
|
|
17
|
+
return (_jsxs(DrawerContent, { "aria-label": label, "data-sidebar-sheet": "", children: [nav, _jsx(DrawerCloseButton, { label: labels.closeMenu })] }));
|
|
18
|
+
}
|
|
19
|
+
/** The top of the sidebar, for a wordmark. It stays put while the body scrolls. */
|
|
20
|
+
export function SidebarHeader(props) {
|
|
21
|
+
return _jsx("div", { "data-slot": "sidebar-header", ...props });
|
|
22
|
+
}
|
|
23
|
+
/** The bottom of the sidebar, for the signed-in user and a `SidebarToggle`. It stays put while the body scrolls. */
|
|
24
|
+
export function SidebarFooter(props) {
|
|
25
|
+
return _jsx("div", { "data-slot": "sidebar-footer", ...props });
|
|
26
|
+
}
|
|
27
|
+
/** A labelled set of items. */
|
|
28
|
+
export function SidebarGroup({ label, children, ...props }) {
|
|
29
|
+
const headingId = useId();
|
|
30
|
+
return (_jsxs("li", { "data-slot": "sidebar-group", ...props, children: [_jsx("h2", { "data-slot": "sidebar-group-label", id: headingId, children: label }), _jsx("ul", { "data-slot": "sidebar-list", "aria-labelledby": headingId, children: children })] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SidebarStorage } from "./sidebar-storage";
|
|
2
|
+
export interface CollapsedOptions {
|
|
3
|
+
collapsed: boolean | undefined;
|
|
4
|
+
defaultCollapsed: boolean | undefined;
|
|
5
|
+
onCollapsedChange: ((collapsed: boolean) => void) | undefined;
|
|
6
|
+
storage: SidebarStorage | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Holds whether the sidebar is collapsed. The app controls it with `collapsed`, or the shell holds it, starting from
|
|
10
|
+
* `defaultCollapsed`, else from the storage. The storage is written only when the shell holds the state, and only
|
|
11
|
+
* when it changes: never on the first render.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useCollapsed(options: CollapsedOptions): [boolean, (next: boolean) => void];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { collapsedWord, expandedWord } from "./sidebar-storage";
|
|
3
|
+
/**
|
|
4
|
+
* Holds whether the sidebar is collapsed. The app controls it with `collapsed`, or the shell holds it, starting from
|
|
5
|
+
* `defaultCollapsed`, else from the storage. The storage is written only when the shell holds the state, and only
|
|
6
|
+
* when it changes: never on the first render.
|
|
7
|
+
*/
|
|
8
|
+
export function useCollapsed(options) {
|
|
9
|
+
const { collapsed, defaultCollapsed, onCollapsedChange, storage } = options;
|
|
10
|
+
const [own, setOwn] = useState(() => defaultCollapsed ?? storage?.get() === collapsedWord);
|
|
11
|
+
const controlled = collapsed !== undefined;
|
|
12
|
+
const set = (next) => {
|
|
13
|
+
if (!controlled) {
|
|
14
|
+
setOwn(next);
|
|
15
|
+
storage?.set(next ? collapsedWord : expandedWord);
|
|
16
|
+
}
|
|
17
|
+
onCollapsedChange?.(next);
|
|
18
|
+
};
|
|
19
|
+
return [controlled ? collapsed : own, set];
|
|
20
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The window width below which the sidebar moves into a drawer: 40, 56 or 64rem. */
|
|
2
|
+
export type SidebarNarrowAt = "sm" | "md" | "lg";
|
|
3
|
+
/** Whether the window is narrower than `at`. A server and the first hydration render say wide. */
|
|
4
|
+
export declare function useNarrow(at: SidebarNarrowAt): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
const widths = { sm: 40, md: 56, lg: 64 };
|
|
3
|
+
/** The query the stylesheet repeats for each `data-narrow-at`, since a media query can't read a custom property. */
|
|
4
|
+
function queryOf(at) {
|
|
5
|
+
return `(width < ${widths[at]}rem)`;
|
|
6
|
+
}
|
|
7
|
+
/** Whether the window is narrower than `at`. A server and the first hydration render say wide. */
|
|
8
|
+
export function useNarrow(at) {
|
|
9
|
+
const query = queryOf(at);
|
|
10
|
+
const subscribe = useCallback((notify) => {
|
|
11
|
+
const list = window.matchMedia(query);
|
|
12
|
+
list.addEventListener("change", notify);
|
|
13
|
+
return () => {
|
|
14
|
+
list.removeEventListener("change", notify);
|
|
15
|
+
};
|
|
16
|
+
}, [query]);
|
|
17
|
+
return useSyncExternalStore(subscribe, () => window.matchMedia(query).matches, () => false);
|
|
18
|
+
}
|