@alulore/kumiko 0.18.3 → 0.19.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/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 +56 -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,422 @@
|
|
|
1
|
+
@import "../motion/motion.css";
|
|
2
|
+
@import "../button/button.css";
|
|
3
|
+
@import "../menu/menu.css";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* The page: its width and padding, a header with the way back, the title and the actions, and titled sections. The
|
|
7
|
+
* actions and the breadcrumbs fold by the room their own container has, so each one's container takes the room that
|
|
8
|
+
* is left and never sizes itself by what it holds.
|
|
9
|
+
*/
|
|
10
|
+
@layer kumiko {
|
|
11
|
+
:where(:root) {
|
|
12
|
+
--kumiko-touch-target: 2.75rem;
|
|
13
|
+
--kumiko-page-max-width: 75rem;
|
|
14
|
+
--kumiko-page-max-width-narrow: 40rem;
|
|
15
|
+
--kumiko-page-max-width-wide: 90rem;
|
|
16
|
+
--kumiko-page-padding-inline: 1.5rem;
|
|
17
|
+
--kumiko-page-padding-block: 1.5rem;
|
|
18
|
+
--kumiko-page-gap: 2rem;
|
|
19
|
+
--kumiko-page-header-gap: 0.75rem;
|
|
20
|
+
--kumiko-page-eyebrow-fg: color-mix(in oklab, CanvasText 58%, Canvas);
|
|
21
|
+
--kumiko-page-title-fg: CanvasText;
|
|
22
|
+
--kumiko-page-title-font: inherit;
|
|
23
|
+
--kumiko-page-title-size: 1.75rem;
|
|
24
|
+
--kumiko-page-description-fg: color-mix(in oklab, CanvasText 66%, Canvas);
|
|
25
|
+
--kumiko-page-description-max-width: 42rem;
|
|
26
|
+
--kumiko-page-back-fg: color-mix(in oklab, CanvasText 62%, Canvas);
|
|
27
|
+
--kumiko-page-crumb-separator: "›";
|
|
28
|
+
--kumiko-page-sticky-top: 0px;
|
|
29
|
+
--kumiko-page-sticky-bg: Canvas;
|
|
30
|
+
--kumiko-page-sticky-border: color-mix(in oklab, CanvasText 12%, Canvas);
|
|
31
|
+
--kumiko-page-sticky-shadow: 0 1px 3px color-mix(in oklab, CanvasText 10%, transparent);
|
|
32
|
+
--kumiko-page-section-gap: 1rem;
|
|
33
|
+
--kumiko-page-section-title-size: 1.125rem;
|
|
34
|
+
--kumiko-page-focus-ring: Highlight;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:where([data-slot="page"]) {
|
|
38
|
+
--_max: var(--kumiko-page-max-width);
|
|
39
|
+
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
gap: var(--kumiko-page-gap);
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
inline-size: 100%;
|
|
45
|
+
max-inline-size: var(--_max);
|
|
46
|
+
margin-inline: auto;
|
|
47
|
+
padding: var(--kumiko-page-padding-block) var(--kumiko-page-padding-inline);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:where([data-slot="page"][data-width="narrow"]) {
|
|
51
|
+
--_max: var(--kumiko-page-max-width-narrow);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:where([data-slot="page"][data-width="wide"]) {
|
|
55
|
+
--_max: var(--kumiko-page-max-width-wide);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:where([data-slot="page"][data-width="full"]) {
|
|
59
|
+
--_max: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* The enter motion: a fade, and a small rise that reduced motion and the still preset take away. */
|
|
63
|
+
@keyframes kumiko-page-fade {
|
|
64
|
+
from {
|
|
65
|
+
opacity: 0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@keyframes kumiko-page-rise {
|
|
70
|
+
from {
|
|
71
|
+
translate: 0 0.75rem;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:where([data-slot="page"][data-enter]) {
|
|
76
|
+
animation:
|
|
77
|
+
kumiko-page-fade var(--kumiko-fade-duration) var(--kumiko-fade-ease) backwards,
|
|
78
|
+
kumiko-page-rise var(--kumiko-move-duration) var(--kumiko-move-ease) backwards;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:where([data-slot="page-header"]) {
|
|
82
|
+
display: grid;
|
|
83
|
+
gap: var(--kumiko-page-header-gap);
|
|
84
|
+
min-inline-size: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
* The titles take what they need up to 60%, and the actions take everything left, whatever they hold. The
|
|
89
|
+
* description sits under both, so its length never takes room from the actions.
|
|
90
|
+
*/
|
|
91
|
+
:where([data-slot="page-head"]) {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
gap: 1rem;
|
|
95
|
+
min-inline-size: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:where([data-slot="page-titles"]) {
|
|
99
|
+
display: grid;
|
|
100
|
+
flex: 0 1 auto;
|
|
101
|
+
gap: 0.25rem;
|
|
102
|
+
min-inline-size: 0;
|
|
103
|
+
max-inline-size: 60%;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:where([data-slot="page-eyebrow"]) {
|
|
107
|
+
margin: 0;
|
|
108
|
+
color: var(--kumiko-page-eyebrow-fg);
|
|
109
|
+
font-size: 0.8125rem;
|
|
110
|
+
font-weight: 600;
|
|
111
|
+
letter-spacing: 0.04em;
|
|
112
|
+
text-transform: uppercase;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:where([data-slot="page-title"]) {
|
|
116
|
+
margin: 0;
|
|
117
|
+
color: var(--kumiko-page-title-fg);
|
|
118
|
+
font-family: var(--kumiko-page-title-font);
|
|
119
|
+
font-size: var(--kumiko-page-title-size);
|
|
120
|
+
font-weight: 650;
|
|
121
|
+
line-height: 1.2;
|
|
122
|
+
overflow-wrap: anywhere;
|
|
123
|
+
text-wrap: balance;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:where([data-slot="page-description"]) {
|
|
127
|
+
max-inline-size: var(--kumiko-page-description-max-width);
|
|
128
|
+
margin: 0;
|
|
129
|
+
margin-block-start: calc(var(--kumiko-page-header-gap) / -2);
|
|
130
|
+
color: var(--kumiko-page-description-fg);
|
|
131
|
+
font-size: 0.9375rem;
|
|
132
|
+
line-height: 1.5;
|
|
133
|
+
text-wrap: pretty;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:where([data-slot="page-header-actions"]) {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex: 1 1 0;
|
|
139
|
+
justify-content: flex-end;
|
|
140
|
+
min-inline-size: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:where([data-slot="page-actions"]) {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex: 1 1 0;
|
|
146
|
+
flex-wrap: nowrap;
|
|
147
|
+
gap: 0.5rem;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: flex-end;
|
|
150
|
+
min-inline-size: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:where([data-slot="page-actions-item"]) {
|
|
154
|
+
display: inline-flex;
|
|
155
|
+
flex: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:where([data-slot="page-action-icon"]) {
|
|
159
|
+
display: inline-grid;
|
|
160
|
+
place-items: center;
|
|
161
|
+
margin-inline-end: 0.375rem;
|
|
162
|
+
vertical-align: middle;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:where([data-slot="page-action-icon"] > svg),
|
|
166
|
+
:where([data-slot="page-icon"]) {
|
|
167
|
+
inline-size: 1rem;
|
|
168
|
+
block-size: 1rem;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:where(:dir(rtl) [data-slot="page-icon"][data-mirror]) {
|
|
172
|
+
scale: -1 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* The way back. */
|
|
176
|
+
:where([data-slot="page-back"]) {
|
|
177
|
+
position: relative;
|
|
178
|
+
display: inline-flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
gap: 0.375rem;
|
|
181
|
+
justify-self: start;
|
|
182
|
+
padding: 0;
|
|
183
|
+
border: 0;
|
|
184
|
+
border-radius: 0.25rem;
|
|
185
|
+
background: transparent;
|
|
186
|
+
color: var(--kumiko-page-back-fg);
|
|
187
|
+
font: inherit;
|
|
188
|
+
font-size: 0.875rem;
|
|
189
|
+
text-decoration: none;
|
|
190
|
+
cursor: var(--kumiko-press-cursor, pointer);
|
|
191
|
+
transition: color var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
:where([data-slot="page-header-back"]) {
|
|
195
|
+
display: flex;
|
|
196
|
+
min-inline-size: 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
:where([data-slot="page-back"]):focus-visible,
|
|
200
|
+
:where([data-slot="page-crumb"]):focus-visible,
|
|
201
|
+
:where([data-slot="page-crumb-more"]):focus-visible {
|
|
202
|
+
outline: 2px solid var(--kumiko-page-focus-ring);
|
|
203
|
+
outline-offset: 2px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* Breadcrumbs. Every crumb after the first draws its separator before itself, so a hidden crumb takes its own away. */
|
|
207
|
+
:where([data-slot="page-breadcrumbs"]) {
|
|
208
|
+
flex: 1 1 0;
|
|
209
|
+
min-inline-size: 0;
|
|
210
|
+
color: var(--kumiko-page-back-fg);
|
|
211
|
+
font-size: 0.875rem;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
:where([data-slot="page-crumbs"]) {
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-wrap: nowrap;
|
|
217
|
+
align-items: center;
|
|
218
|
+
min-inline-size: 0;
|
|
219
|
+
margin: 0;
|
|
220
|
+
padding: 0;
|
|
221
|
+
list-style: none;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
:where([data-slot="page-crumb-item"]) {
|
|
225
|
+
display: flex;
|
|
226
|
+
flex: none;
|
|
227
|
+
align-items: center;
|
|
228
|
+
min-inline-size: 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
:where([data-slot="page-crumb-item"]:last-child) {
|
|
232
|
+
flex: 0 1 auto;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
:where([data-slot="page-crumb-item"]:not(:first-child))::before {
|
|
236
|
+
content: var(--kumiko-page-crumb-separator);
|
|
237
|
+
content: var(--kumiko-page-crumb-separator) / "";
|
|
238
|
+
flex: none;
|
|
239
|
+
margin-inline: 0.5rem;
|
|
240
|
+
opacity: 0.6;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
:where(:dir(rtl) [data-slot="page-crumb-item"]:not(:first-child))::before {
|
|
244
|
+
scale: -1 1;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:where([data-slot="page-crumb"]) {
|
|
248
|
+
position: relative;
|
|
249
|
+
display: inline-flex;
|
|
250
|
+
min-inline-size: 0;
|
|
251
|
+
color: inherit;
|
|
252
|
+
text-decoration: none;
|
|
253
|
+
border-radius: 0.25rem;
|
|
254
|
+
transition: color var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
:where([data-slot="page-crumb-label"]) {
|
|
258
|
+
min-inline-size: 0;
|
|
259
|
+
overflow: hidden;
|
|
260
|
+
text-overflow: ellipsis;
|
|
261
|
+
white-space: nowrap;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
:where([data-slot="page-crumb"][aria-current="page"]) {
|
|
265
|
+
color: var(--kumiko-page-title-fg);
|
|
266
|
+
font-weight: 500;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
:where([data-slot="page-crumb-more"]) {
|
|
270
|
+
position: relative;
|
|
271
|
+
display: inline-grid;
|
|
272
|
+
place-items: center;
|
|
273
|
+
inline-size: 1.75rem;
|
|
274
|
+
block-size: 1.5rem;
|
|
275
|
+
padding: 0;
|
|
276
|
+
border: 0;
|
|
277
|
+
border-radius: 0.375rem;
|
|
278
|
+
background: transparent;
|
|
279
|
+
color: inherit;
|
|
280
|
+
cursor: var(--kumiko-press-cursor, pointer);
|
|
281
|
+
transition:
|
|
282
|
+
background-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
|
|
283
|
+
color var(--kumiko-fade-duration) var(--kumiko-fade-ease);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
:where([data-slot="page-crumb-more"][data-open]) {
|
|
287
|
+
background: color-mix(in oklab, CanvasText 8%, transparent);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@media (hover: hover) and (pointer: fine) {
|
|
291
|
+
:where([data-slot="page-back"]):hover,
|
|
292
|
+
:where([data-slot="page-crumb"]:not([aria-current="page"])):hover {
|
|
293
|
+
color: var(--kumiko-page-title-fg);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
:where([data-slot="page-crumb"]:not([aria-current="page"])):hover {
|
|
297
|
+
text-decoration: underline;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
:where([data-slot="page-crumb-more"]):hover {
|
|
301
|
+
background: color-mix(in oklab, CanvasText 8%, transparent);
|
|
302
|
+
color: var(--kumiko-page-title-fg);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* A finger gets a full-size target, taller than the link where needed. */
|
|
307
|
+
@media (pointer: coarse) {
|
|
308
|
+
:where([data-slot="page-back"])::after,
|
|
309
|
+
:where([data-slot="page-crumb"])::after,
|
|
310
|
+
:where([data-slot="page-crumb-more"])::after {
|
|
311
|
+
content: "";
|
|
312
|
+
position: absolute;
|
|
313
|
+
inset: 50% auto auto 50%;
|
|
314
|
+
translate: -50% -50%;
|
|
315
|
+
inline-size: max(100%, var(--kumiko-touch-target));
|
|
316
|
+
block-size: max(100%, var(--kumiko-touch-target));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
:where([data-slot="page-actions"] [data-slot="button"]) {
|
|
320
|
+
min-block-size: var(--kumiko-touch-target);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
:where([data-slot="page-actions"] [data-slot="button"][data-icon]) {
|
|
324
|
+
min-inline-size: var(--kumiko-touch-target);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/*
|
|
329
|
+
* The sticky bar. Its holder has no height, so the page's flow doesn't change, and sticks below the shell's top bar
|
|
330
|
+
* for as long as the page is on screen. The bar hangs from it, and slides down out of the top bar's shadow.
|
|
331
|
+
*/
|
|
332
|
+
:where([data-slot="page-sticky"]) {
|
|
333
|
+
position: sticky;
|
|
334
|
+
inset-block-start: var(--kumiko-page-sticky-top);
|
|
335
|
+
z-index: 1;
|
|
336
|
+
block-size: 0;
|
|
337
|
+
margin-block-end: calc(-1 * var(--kumiko-page-gap));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
:where([data-slot="page-sticky-bar"]) {
|
|
341
|
+
position: absolute;
|
|
342
|
+
inset-block-start: 0;
|
|
343
|
+
inset-inline: calc(-1 * var(--kumiko-page-padding-inline));
|
|
344
|
+
display: flex;
|
|
345
|
+
align-items: center;
|
|
346
|
+
gap: 0.75rem;
|
|
347
|
+
box-sizing: border-box;
|
|
348
|
+
min-block-size: 3rem;
|
|
349
|
+
padding: 0.375rem var(--kumiko-page-padding-inline);
|
|
350
|
+
border-block-end: 1px solid var(--kumiko-page-sticky-border);
|
|
351
|
+
background: var(--kumiko-page-sticky-bg);
|
|
352
|
+
box-shadow: var(--kumiko-page-sticky-shadow);
|
|
353
|
+
opacity: 0;
|
|
354
|
+
translate: 0 -100%;
|
|
355
|
+
visibility: hidden;
|
|
356
|
+
transition:
|
|
357
|
+
translate var(--kumiko-settle-duration) var(--kumiko-settle-ease),
|
|
358
|
+
opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease),
|
|
359
|
+
visibility 0s linear var(--kumiko-settle-duration);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
:where([data-slot="page-sticky"][data-shown] > [data-slot="page-sticky-bar"]) {
|
|
363
|
+
opacity: 1;
|
|
364
|
+
translate: 0 0;
|
|
365
|
+
visibility: visible;
|
|
366
|
+
transition:
|
|
367
|
+
translate var(--kumiko-settle-duration) var(--kumiko-settle-ease),
|
|
368
|
+
opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease),
|
|
369
|
+
visibility 0s;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
:where([data-slot="page-sticky-title"]) {
|
|
373
|
+
flex: 0 1 auto;
|
|
374
|
+
min-inline-size: 0;
|
|
375
|
+
max-inline-size: 60%;
|
|
376
|
+
margin: 0;
|
|
377
|
+
overflow: hidden;
|
|
378
|
+
color: var(--kumiko-page-title-fg);
|
|
379
|
+
font-weight: 600;
|
|
380
|
+
text-overflow: ellipsis;
|
|
381
|
+
white-space: nowrap;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
:where([data-slot="page-sticky-actions"]) {
|
|
385
|
+
display: flex;
|
|
386
|
+
flex: 1 1 auto;
|
|
387
|
+
justify-content: flex-end;
|
|
388
|
+
min-inline-size: 0;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
:where([data-slot="page-actions"][data-sticky]) {
|
|
392
|
+
flex: none;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* Sections. */
|
|
396
|
+
:where([data-slot="page-section"]) {
|
|
397
|
+
display: grid;
|
|
398
|
+
gap: var(--kumiko-page-section-gap);
|
|
399
|
+
min-inline-size: 0;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
:where([data-slot="page-section-title"]) {
|
|
403
|
+
margin: 0;
|
|
404
|
+
color: var(--kumiko-page-title-fg);
|
|
405
|
+
font-size: var(--kumiko-page-section-title-size);
|
|
406
|
+
font-weight: 600;
|
|
407
|
+
line-height: 1.3;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
@media (forced-colors: active) {
|
|
411
|
+
:where([data-slot="page-sticky-bar"]) {
|
|
412
|
+
border-block-end-color: CanvasText;
|
|
413
|
+
box-shadow: none;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
:where([data-slot="page-crumb-more"][data-open]) {
|
|
417
|
+
forced-color-adjust: none;
|
|
418
|
+
background: Highlight;
|
|
419
|
+
color: HighlightText;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PageLabels } from "./page-labels";
|
|
2
|
+
/** How wide the page may grow: the narrow, default or wide token, or all the room. */
|
|
3
|
+
export type PageWidth = "narrow" | "default" | "wide" | "full";
|
|
4
|
+
export interface PageProps extends React.ComponentProps<"div"> {
|
|
5
|
+
/** @defaultValue "default" */
|
|
6
|
+
width?: PageWidth;
|
|
7
|
+
/** Plays the enter motion once when the page mounts: a fade with a small rise. @defaultValue true */
|
|
8
|
+
enter?: boolean;
|
|
9
|
+
/** The page parts' words, over the English ones. */
|
|
10
|
+
labels?: Partial<PageLabels>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The page of an app: its width, its padding and its enter motion. It is a `div`, because the app shell already has
|
|
14
|
+
* the `main`. Reduced motion and the `still` preset keep only the fade.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Page({ width, enter, labels, children, ...props }: PageProps): React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { LabelsProvider } from "./page-context";
|
|
4
|
+
import { pageLabels } from "./page-labels";
|
|
5
|
+
/**
|
|
6
|
+
* The page of an app: its width, its padding and its enter motion. It is a `div`, because the app shell already has
|
|
7
|
+
* the `main`. Reduced motion and the `still` preset keep only the fade.
|
|
8
|
+
*/
|
|
9
|
+
export function Page({ width = "default", enter = true, labels, children, ...props }) {
|
|
10
|
+
const words = useMemo(() => ({ ...pageLabels, ...labels }), [labels]);
|
|
11
|
+
return (_jsx(LabelsProvider, { value: words, children: _jsx("div", { "data-slot": "page", "data-width": width === "default" ? undefined : width, "data-enter": enter ? "" : undefined, ...props, children: children }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** What a fitting part reads off the page: its own room, and how wide each item was last seen. */
|
|
2
|
+
export interface Sizes {
|
|
3
|
+
room: number;
|
|
4
|
+
gap: number;
|
|
5
|
+
widths: (number | undefined)[];
|
|
6
|
+
/** The extra button's width ("More actions", "…"), once seen. */
|
|
7
|
+
extra: number | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Keeps a part's items sized to the room it has. The items carry `data-fit-index`, and the extra button
|
|
11
|
+
* `data-fit-extra`. Each width is remembered from the last time the item was on screen, so an item that has folded
|
|
12
|
+
* away still counts, and nothing flickers as the room changes. The first fit runs in a layout effect, before the
|
|
13
|
+
* first paint, and a resize runs it before the next. The server, and any render before the first fit, get `initial`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useMeasuredFit(options: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
initial: string;
|
|
18
|
+
decide: (sizes: Sizes) => string;
|
|
19
|
+
}): {
|
|
20
|
+
value: string;
|
|
21
|
+
rootRef: (element: HTMLElement | null) => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { flushSync } from "react-dom";
|
|
3
|
+
/** The width an item needs: an item that is cut short has shrunk, so it needs what its label lost as well. */
|
|
4
|
+
function neededWidth(item) {
|
|
5
|
+
const label = item.querySelector('[data-slot="page-crumb-label"]');
|
|
6
|
+
const lost = label ? Math.max(0, label.scrollWidth - label.clientWidth) : 0;
|
|
7
|
+
return Math.ceil(item.getBoundingClientRect().width) + lost;
|
|
8
|
+
}
|
|
9
|
+
/** Reads the room, and records the width of every item and of the extra button that is on screen now. */
|
|
10
|
+
function readSizes(root, widths, extra) {
|
|
11
|
+
for (const item of root.querySelectorAll("[data-fit-index]")) {
|
|
12
|
+
const width = neededWidth(item);
|
|
13
|
+
if (width > 0) {
|
|
14
|
+
widths[Number(item.dataset.fitIndex)] = width;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const more = root.querySelector("[data-fit-extra]");
|
|
18
|
+
const moreWidth = more ? Math.ceil(more.getBoundingClientRect().width) : 0;
|
|
19
|
+
if (moreWidth > 0) {
|
|
20
|
+
extra.current = moreWidth;
|
|
21
|
+
}
|
|
22
|
+
const gap = Number(getComputedStyle(root).columnGap.replace("px", ""));
|
|
23
|
+
return {
|
|
24
|
+
room: root.clientWidth,
|
|
25
|
+
gap: Number.isNaN(gap) ? 0 : gap,
|
|
26
|
+
widths,
|
|
27
|
+
extra: extra.current
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Keeps a part's items sized to the room it has. The items carry `data-fit-index`, and the extra button
|
|
32
|
+
* `data-fit-extra`. Each width is remembered from the last time the item was on screen, so an item that has folded
|
|
33
|
+
* away still counts, and nothing flickers as the room changes. The first fit runs in a layout effect, before the
|
|
34
|
+
* first paint, and a resize runs it before the next. The server, and any render before the first fit, get `initial`.
|
|
35
|
+
*/
|
|
36
|
+
export function useMeasuredFit(options) {
|
|
37
|
+
const { enabled, initial, decide } = options;
|
|
38
|
+
const [value, setValue] = useState(initial);
|
|
39
|
+
const [root, setRoot] = useState(null);
|
|
40
|
+
const current = useRef(initial);
|
|
41
|
+
const widths = useRef([]);
|
|
42
|
+
const extra = useRef(undefined);
|
|
43
|
+
const decider = useRef(decide);
|
|
44
|
+
useLayoutEffect(() => {
|
|
45
|
+
decider.current = decide;
|
|
46
|
+
});
|
|
47
|
+
const measure = useCallback((sync) => {
|
|
48
|
+
if (!enabled || !root) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const next = decider.current(readSizes(root, widths.current, extra));
|
|
52
|
+
if (next === current.current) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
current.current = next;
|
|
56
|
+
if (sync) {
|
|
57
|
+
flushSync(() => setValue(next));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
setValue(next);
|
|
61
|
+
}
|
|
62
|
+
}, [enabled, root]);
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
measure(false);
|
|
65
|
+
});
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!root || !enabled) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const observer = new ResizeObserver(() => measure(true));
|
|
71
|
+
observer.observe(root);
|
|
72
|
+
return () => observer.disconnect();
|
|
73
|
+
}, [root, enabled, measure]);
|
|
74
|
+
return { value: enabled ? value : initial, rootRef: setRoot };
|
|
75
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Whether the header has scrolled up under the sticky bar. The bar's holder sits just above the header until it
|
|
4
|
+
* sticks at its top offset, so the header is out of sight once its bottom is above the holder's top. It hears the
|
|
5
|
+
* scroll of any scrolling ancestor, as the shell's frame is one.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useStuck(enabled: boolean, header: RefObject<HTMLElement | null>, holder: RefObject<HTMLElement | null>): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Whether the header has scrolled up under the sticky bar. The bar's holder sits just above the header until it
|
|
4
|
+
* sticks at its top offset, so the header is out of sight once its bottom is above the holder's top. It hears the
|
|
5
|
+
* scroll of any scrolling ancestor, as the shell's frame is one.
|
|
6
|
+
*/
|
|
7
|
+
export function useStuck(enabled, header, holder) {
|
|
8
|
+
const [stuck, setStuck] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const head = header.current;
|
|
11
|
+
const hold = holder.current;
|
|
12
|
+
if (!enabled || !head || !hold) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const update = () => {
|
|
16
|
+
setStuck(head.getBoundingClientRect().bottom <= hold.getBoundingClientRect().top + 0.5);
|
|
17
|
+
};
|
|
18
|
+
update();
|
|
19
|
+
document.addEventListener("scroll", update, { capture: true, passive: true });
|
|
20
|
+
window.addEventListener("resize", update);
|
|
21
|
+
const observer = new ResizeObserver(update);
|
|
22
|
+
observer.observe(head);
|
|
23
|
+
return () => {
|
|
24
|
+
document.removeEventListener("scroll", update, { capture: true });
|
|
25
|
+
window.removeEventListener("resize", update);
|
|
26
|
+
observer.disconnect();
|
|
27
|
+
setStuck(false);
|
|
28
|
+
};
|
|
29
|
+
}, [enabled, header, holder]);
|
|
30
|
+
return enabled && stuck;
|
|
31
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Pagination, type PaginationLayout, type PaginationLinkRenderProps, type PaginationLook, type PaginationProps, type PaginationSize } from "./pagination";
|
|
2
|
+
export { paginationLabels, type PaginationLabels } from "./pagination-labels";
|
|
3
|
+
export { createPaginationController, Pagination as PaginationRoot, PaginationEllipsis, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationList, PaginationNext, PaginationPrevious, paginationRange, type PaginationChangeOptions, type PaginationController, type PaginationLinkProps, type PaginationLinkState, type PaginationPageChangeReason, type PaginationRangeItem, type PaginationRangeOptions, type PaginationState, type PaginationStepState } from "@ui-sdk/react/pagination";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Pagination } from "./pagination";
|
|
2
|
+
export { paginationLabels } from "./pagination-labels";
|
|
3
|
+
export { createPaginationController, Pagination as PaginationRoot, PaginationEllipsis, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationList, PaginationNext, PaginationPrevious, paginationRange } from "@ui-sdk/react/pagination";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PaginationController } from "@ui-sdk/react/pagination";
|
|
2
|
+
import type { PaginationLabels } from "./pagination-labels";
|
|
3
|
+
type Format = (value: number) => string;
|
|
4
|
+
/** "Showing 21–40 of 95": the first and last item on the page, out of the total. */
|
|
5
|
+
export declare function PaginationRange({ page, pageSize, total, words, format }: {
|
|
6
|
+
page: number;
|
|
7
|
+
pageSize: number;
|
|
8
|
+
total: number;
|
|
9
|
+
words: PaginationLabels;
|
|
10
|
+
format: Format;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
/** A select for how many items a page holds. */
|
|
13
|
+
export declare function PaginationPageSize({ sizes, value, onChange, words, format, disabled }: {
|
|
14
|
+
sizes: readonly number[];
|
|
15
|
+
value: number;
|
|
16
|
+
onChange: (size: number) => void;
|
|
17
|
+
words: PaginationLabels;
|
|
18
|
+
format: Format;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
/** A small field to type a page number and go there. A number past the end goes to the last page. */
|
|
22
|
+
export declare function PaginationJump({ controller, pageCount, words, disabled }: {
|
|
23
|
+
controller: PaginationController;
|
|
24
|
+
pageCount: number;
|
|
25
|
+
words: PaginationLabels;
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
}): React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useState } from "react";
|
|
3
|
+
import { Button } from "../button";
|
|
4
|
+
import { Input } from "../input";
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "../select";
|
|
6
|
+
import { itemRange, pageFromText } from "./pagination-math";
|
|
7
|
+
/** "Showing 21–40 of 95": the first and last item on the page, out of the total. */
|
|
8
|
+
export function PaginationRange({ page, pageSize, total, words, format }) {
|
|
9
|
+
const { from, to } = itemRange(page, pageSize, total);
|
|
10
|
+
return (_jsx("p", { "data-slot": "pagination-range", children: words.range(format(from), format(to), format(total)) }));
|
|
11
|
+
}
|
|
12
|
+
/** A select for how many items a page holds. */
|
|
13
|
+
export function PaginationPageSize({ sizes, value, onChange, words, format, disabled }) {
|
|
14
|
+
return (_jsx("div", { "data-slot": "pagination-size", children: _jsxs(Select, { value: value, disabled: disabled, onValueChange: (next) => {
|
|
15
|
+
if (typeof next === "number") {
|
|
16
|
+
onChange(next);
|
|
17
|
+
}
|
|
18
|
+
}, children: [_jsx(SelectLabel, { children: words.rowsPerPage }), _jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: sizes.map((size) => (_jsx(SelectItem, { value: size, children: format(size) }, size))) })] }) }));
|
|
19
|
+
}
|
|
20
|
+
/** A small field to type a page number and go there. A number past the end goes to the last page. */
|
|
21
|
+
export function PaginationJump({ controller, pageCount, words, disabled }) {
|
|
22
|
+
const id = useId();
|
|
23
|
+
const [text, setText] = useState("");
|
|
24
|
+
const [invalid, setInvalid] = useState(false);
|
|
25
|
+
function go() {
|
|
26
|
+
const page = pageFromText(text, pageCount);
|
|
27
|
+
setInvalid(page === null);
|
|
28
|
+
if (page !== null) {
|
|
29
|
+
controller.setPage(page);
|
|
30
|
+
setText("");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return (_jsxs("div", { "data-slot": "pagination-jump", children: [_jsx("label", { htmlFor: id, children: words.jumpTo }), _jsx(Input, { id: id, inputMode: "numeric", autoComplete: "off", value: text, disabled: disabled, "aria-invalid": invalid || undefined, onValueChange: (next) => {
|
|
34
|
+
setText(next);
|
|
35
|
+
setInvalid(false);
|
|
36
|
+
}, onKeyDown: (event) => {
|
|
37
|
+
if (event.key === "Enter") {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
go();
|
|
40
|
+
}
|
|
41
|
+
} }), _jsx(Button, { variant: "outline", size: "sm", disabled: disabled, onClick: go, children: words.go })] }));
|
|
42
|
+
}
|