@alulore/kumiko 0.18.2 → 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.
Files changed (147) hide show
  1. package/dist/dialog/ask.d.ts +7 -0
  2. package/dist/dialog/ask.js +8 -0
  3. package/dist/dialog/dialog-content.d.ts +23 -0
  4. package/dist/dialog/dialog-content.js +15 -0
  5. package/dist/dialog/dialog-entry.d.ts +14 -0
  6. package/dist/dialog/dialog-entry.js +111 -0
  7. package/dist/dialog/dialog-labels.d.ts +23 -0
  8. package/dist/dialog/dialog-labels.js +16 -0
  9. package/dist/dialog/dialog-store.d.ts +139 -0
  10. package/dist/dialog/dialog-store.js +296 -0
  11. package/dist/dialog/dialog.css +39 -1
  12. package/dist/dialog/dialog.d.ts +0 -3
  13. package/dist/dialog/dialog.js +0 -6
  14. package/dist/dialog/index.d.ts +8 -2
  15. package/dist/dialog/index.js +7 -2
  16. package/dist/dialog/leave-guard.d.ts +24 -0
  17. package/dist/dialog/leave-guard.js +98 -0
  18. package/dist/dialog/nest.d.ts +14 -0
  19. package/dist/dialog/nest.js +26 -0
  20. package/dist/dialog/open-dialog.d.ts +16 -0
  21. package/dist/dialog/open-dialog.js +13 -0
  22. package/dist/dialog/overlay-host.d.ts +27 -0
  23. package/dist/dialog/overlay-host.js +47 -0
  24. package/dist/dialog/question-dialog.d.ts +21 -0
  25. package/dist/dialog/question-dialog.js +78 -0
  26. package/dist/drawer/drawer.css +18 -16
  27. package/dist/menu/menu.css +21 -17
  28. package/dist/otp-input/otp-input.css +38 -37
  29. package/dist/page/index.d.ts +8 -0
  30. package/dist/page/index.js +8 -0
  31. package/dist/page/page-action.d.ts +26 -0
  32. package/dist/page/page-action.js +23 -0
  33. package/dist/page/page-actions.d.ts +10 -0
  34. package/dist/page/page-actions.js +66 -0
  35. package/dist/page/page-back.d.ts +11 -0
  36. package/dist/page/page-back.js +17 -0
  37. package/dist/page/page-breadcrumbs.d.ts +21 -0
  38. package/dist/page/page-breadcrumbs.js +60 -0
  39. package/dist/page/page-context.d.ts +5 -0
  40. package/dist/page/page-context.js +13 -0
  41. package/dist/page/page-fit.d.ts +26 -0
  42. package/dist/page/page-fit.js +36 -0
  43. package/dist/page/page-header.d.ts +26 -0
  44. package/dist/page/page-header.js +16 -0
  45. package/dist/page/page-icons.d.ts +4 -0
  46. package/dist/page/page-icons.js +13 -0
  47. package/dist/page/page-labels.d.ts +12 -0
  48. package/dist/page/page-labels.js +6 -0
  49. package/dist/page/page-section.d.ts +14 -0
  50. package/dist/page/page-section.js +9 -0
  51. package/dist/page/page.css +422 -0
  52. package/dist/page/page.d.ts +16 -0
  53. package/dist/page/page.js +12 -0
  54. package/dist/page/use-measured-fit.d.ts +22 -0
  55. package/dist/page/use-measured-fit.js +75 -0
  56. package/dist/page/use-stuck.d.ts +7 -0
  57. package/dist/page/use-stuck.js +31 -0
  58. package/dist/pagination/index.d.ts +3 -0
  59. package/dist/pagination/index.js +3 -0
  60. package/dist/pagination/pagination-extras.d.ts +28 -0
  61. package/dist/pagination/pagination-extras.js +42 -0
  62. package/dist/pagination/pagination-fit.d.ts +15 -0
  63. package/dist/pagination/pagination-fit.js +52 -0
  64. package/dist/pagination/pagination-icons.d.ts +4 -0
  65. package/dist/pagination/pagination-icons.js +16 -0
  66. package/dist/pagination/pagination-labels.d.ts +23 -0
  67. package/dist/pagination/pagination-labels.js +14 -0
  68. package/dist/pagination/pagination-math.d.ts +7 -0
  69. package/dist/pagination/pagination-math.js +24 -0
  70. package/dist/pagination/pagination-motion.d.ts +6 -0
  71. package/dist/pagination/pagination-motion.js +71 -0
  72. package/dist/pagination/pagination.css +455 -0
  73. package/dist/pagination/pagination.d.ts +59 -0
  74. package/dist/pagination/pagination.js +77 -0
  75. package/dist/select/select.css +6 -10
  76. package/dist/server-render.test.js +49 -0
  77. package/dist/sidebar/app-shell.d.ts +54 -0
  78. package/dist/sidebar/app-shell.js +28 -0
  79. package/dist/sidebar/index.d.ts +9 -0
  80. package/dist/sidebar/index.js +8 -0
  81. package/dist/sidebar/shell-context.d.ts +30 -0
  82. package/dist/sidebar/shell-context.js +20 -0
  83. package/dist/sidebar/shell-sheet.d.ts +7 -0
  84. package/dist/sidebar/shell-sheet.js +12 -0
  85. package/dist/sidebar/shell-top-bar.d.ts +8 -0
  86. package/dist/sidebar/shell-top-bar.js +25 -0
  87. package/dist/sidebar/sidebar-body.d.ts +5 -0
  88. package/dist/sidebar/sidebar-body.js +37 -0
  89. package/dist/sidebar/sidebar-icons.d.ts +4 -0
  90. package/dist/sidebar/sidebar-icons.js +13 -0
  91. package/dist/sidebar/sidebar-item.d.ts +26 -0
  92. package/dist/sidebar/sidebar-item.js +68 -0
  93. package/dist/sidebar/sidebar-labels.d.ts +14 -0
  94. package/dist/sidebar/sidebar-labels.js +7 -0
  95. package/dist/sidebar/sidebar-marker.d.ts +12 -0
  96. package/dist/sidebar/sidebar-marker.js +77 -0
  97. package/dist/sidebar/sidebar-storage.d.ts +18 -0
  98. package/dist/sidebar/sidebar-storage.js +27 -0
  99. package/dist/sidebar/sidebar-toggle.d.ts +7 -0
  100. package/dist/sidebar/sidebar-toggle.js +18 -0
  101. package/dist/sidebar/sidebar.css +587 -0
  102. package/dist/sidebar/sidebar.d.ts +19 -0
  103. package/dist/sidebar/sidebar.js +31 -0
  104. package/dist/sidebar/use-collapsed.d.ts +13 -0
  105. package/dist/sidebar/use-collapsed.js +20 -0
  106. package/dist/sidebar/use-narrow.d.ts +4 -0
  107. package/dist/sidebar/use-narrow.js +18 -0
  108. package/dist/sidebar/use-shell-focus.d.ts +8 -0
  109. package/dist/sidebar/use-shell-focus.js +30 -0
  110. package/dist/sidebar/use-shell-shortcut.d.ts +4 -0
  111. package/dist/sidebar/use-shell-shortcut.js +32 -0
  112. package/dist/sidebar/use-shell-state.d.ts +18 -0
  113. package/dist/sidebar/use-shell-state.js +47 -0
  114. package/dist/slider/slider.css +9 -6
  115. package/dist/smooth-caret/caret-geometry.js +10 -4
  116. package/dist/table/data-table-props.d.ts +96 -0
  117. package/dist/table/data-table-props.js +1 -0
  118. package/dist/table/data-table.d.ts +7 -0
  119. package/dist/table/data-table.js +59 -0
  120. package/dist/table/index.d.ts +7 -0
  121. package/dist/table/index.js +5 -0
  122. package/dist/table/table-actions.d.ts +9 -0
  123. package/dist/table/table-actions.js +24 -0
  124. package/dist/table/table-builder.d.ts +60 -0
  125. package/dist/table/table-builder.js +99 -0
  126. package/dist/table/table-cells.d.ts +19 -0
  127. package/dist/table/table-cells.js +67 -0
  128. package/dist/table/table-columns.d.ts +38 -0
  129. package/dist/table/table-columns.js +119 -0
  130. package/dist/table/table-icons.d.ts +3 -0
  131. package/dist/table/table-icons.js +8 -0
  132. package/dist/table/table-labels.d.ts +24 -0
  133. package/dist/table/table-labels.js +17 -0
  134. package/dist/table/table-model.d.ts +28 -0
  135. package/dist/table/table-model.js +69 -0
  136. package/dist/table/table-sections.d.ts +25 -0
  137. package/dist/table/table-sections.js +79 -0
  138. package/dist/table/table-state.d.ts +42 -0
  139. package/dist/table/table-state.js +81 -0
  140. package/dist/table/table-types.d.ts +86 -0
  141. package/dist/table/table-types.js +1 -0
  142. package/dist/table/table.css +919 -0
  143. package/dist/table/use-table-view.d.ts +30 -0
  144. package/dist/table/use-table-view.js +147 -0
  145. package/dist/toast/index.d.ts +1 -2
  146. package/dist/toast/index.js +1 -2
  147. package/package.json +44 -1
@@ -0,0 +1,455 @@
1
+ @import "../motion/motion.css";
2
+
3
+ @layer kumiko {
4
+ :where(:root) {
5
+ --kumiko-touch-target: 2.75rem;
6
+ --kumiko-pagination-gap: 0.25rem;
7
+ --kumiko-pagination-row-gap: 0.75rem;
8
+ --kumiko-pagination-height-sm: 2rem;
9
+ --kumiko-pagination-height: 2.25rem;
10
+ --kumiko-pagination-font-size-sm: 0.8125rem;
11
+ --kumiko-pagination-font-size: 0.875rem;
12
+ --kumiko-pagination-font-weight: 500;
13
+ --kumiko-pagination-current-weight: 600;
14
+ --kumiko-pagination-padding: 0.75em;
15
+ --kumiko-pagination-radius: 999px;
16
+ --kumiko-pagination-icon-size: 1rem;
17
+ --kumiko-pagination-fg: color-mix(in oklab, CanvasText 72%, Canvas);
18
+ --kumiko-pagination-hover-bg: color-mix(in oklab, CanvasText 8%, transparent);
19
+ --kumiko-pagination-hover-fg: CanvasText;
20
+ --kumiko-pagination-current-bg: Highlight;
21
+ --kumiko-pagination-current-fg: HighlightText;
22
+ --kumiko-pagination-border: color-mix(in oklab, CanvasText 18%, transparent);
23
+ --kumiko-pagination-muted: color-mix(in oklab, CanvasText 58%, Canvas);
24
+ --kumiko-pagination-focus-ring: Highlight;
25
+ --kumiko-pagination-disabled-opacity: 0.4;
26
+ --kumiko-pagination-indicator-shadow: 0 1px 2px
27
+ color-mix(in oklab, var(--kumiko-pagination-current-bg) 35%, transparent);
28
+ --kumiko-pagination-nudge: 2px;
29
+ }
30
+
31
+ /* The landmark lays out its parts in a row that wraps: the range, the pages, then the size and the jump field. */
32
+ :where([data-slot="pagination"]) {
33
+ --_h: var(--kumiko-pagination-height);
34
+ --_fs: var(--kumiko-pagination-font-size);
35
+
36
+ position: relative;
37
+ isolation: isolate;
38
+ display: flex;
39
+ flex-wrap: wrap;
40
+ align-items: center;
41
+ gap: var(--kumiko-pagination-row-gap) 1.25rem;
42
+ min-inline-size: 0;
43
+ font-size: var(--_fs);
44
+ }
45
+
46
+ /*
47
+ * The range and the trailing controls take equal shares either side, so the pages stay put in the middle
48
+ * however wide "Showing 1–20" or "Showing 81–100" is.
49
+ */
50
+ :where([data-slot="pagination-range"], [data-slot="pagination-trailing"]) {
51
+ flex: 1 1 0;
52
+ }
53
+
54
+ :where([data-slot="pagination-trailing"]) {
55
+ display: flex;
56
+ flex-wrap: wrap;
57
+ align-items: center;
58
+ justify-content: flex-end;
59
+ gap: var(--kumiko-pagination-row-gap) 1.25rem;
60
+ }
61
+
62
+ :where([data-slot="pagination"][data-size="sm"]) {
63
+ --_h: var(--kumiko-pagination-height-sm);
64
+ --_fs: var(--kumiko-pagination-font-size-sm);
65
+ }
66
+
67
+ /* The list never shrinks beside the range or the size: it wraps onto its own line, and only then shrinks to fit. */
68
+ :where([data-slot="pagination-list"]) {
69
+ --_digits: 2;
70
+
71
+ position: relative;
72
+ z-index: 1;
73
+ display: flex;
74
+ flex: none;
75
+ flex-wrap: nowrap;
76
+ align-items: center;
77
+ gap: var(--kumiko-pagination-gap);
78
+ max-inline-size: 100%;
79
+ margin: 0;
80
+ padding: 0;
81
+ list-style: none;
82
+ }
83
+
84
+ :where([data-slot="pagination-list"] > li) {
85
+ display: flex;
86
+ }
87
+
88
+ /* Every page number gets the width of the widest one, so a two- or three-digit page never shifts its row. */
89
+ :where([data-slot="pagination-list"][data-digits="3"]) {
90
+ --_digits: 3;
91
+ }
92
+
93
+ :where([data-slot="pagination-list"][data-digits="4"]) {
94
+ --_digits: 4;
95
+ }
96
+
97
+ :where([data-slot="pagination-list"][data-digits="5"]) {
98
+ --_digits: 5;
99
+ }
100
+
101
+ :where([data-slot="pagination-list"][data-digits="6"]) {
102
+ --_digits: 6;
103
+ }
104
+
105
+ /*
106
+ * The current page's fill is its own layer under the list, so it glides from page to page on the move tokens.
107
+ * Script places it; until then (and without script) the current link carries the fill itself.
108
+ */
109
+ :where([data-slot="pagination-indicator"]) {
110
+ position: absolute;
111
+ top: 0;
112
+ left: 0;
113
+ z-index: 0;
114
+ box-sizing: border-box;
115
+ inline-size: var(--_w, 0);
116
+ block-size: var(--_ih, 0);
117
+ translate: var(--_x, 0) var(--_y, 0);
118
+ border-radius: var(--kumiko-pagination-radius);
119
+ background: var(--kumiko-pagination-current-bg);
120
+ box-shadow: var(--kumiko-pagination-indicator-shadow);
121
+ pointer-events: none;
122
+ transition:
123
+ translate var(--kumiko-move-duration) var(--kumiko-move-ease),
124
+ inline-size var(--kumiko-move-duration) var(--kumiko-move-ease),
125
+ block-size var(--kumiko-move-duration) var(--kumiko-move-ease),
126
+ opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease);
127
+ }
128
+
129
+ :where([data-slot="pagination-indicator"][data-instant]) {
130
+ transition: none;
131
+ }
132
+
133
+ :where([data-slot="pagination-indicator"][data-hidden]) {
134
+ opacity: 0;
135
+ }
136
+
137
+ /* Every page and step is a button-sized target, square for a number or an icon. */
138
+ :where(
139
+ [data-slot="pagination-link"],
140
+ [data-slot="pagination-previous"],
141
+ [data-slot="pagination-next"],
142
+ [data-slot="pagination-first"],
143
+ [data-slot="pagination-last"]
144
+ ) {
145
+ position: relative;
146
+ display: inline-flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ gap: 0.375em;
150
+ box-sizing: border-box;
151
+ min-inline-size: var(--_h);
152
+ block-size: var(--_h);
153
+ padding: 0 calc(var(--_h) * 0.3);
154
+ border: 1px solid transparent;
155
+ border-radius: var(--kumiko-pagination-radius);
156
+ background: transparent;
157
+ color: var(--kumiko-pagination-fg);
158
+ font: inherit;
159
+ font-weight: var(--kumiko-pagination-font-weight);
160
+ font-variant-numeric: tabular-nums;
161
+ line-height: 1;
162
+ text-decoration: none;
163
+ white-space: nowrap;
164
+ cursor: var(--kumiko-press-cursor, pointer);
165
+ user-select: none;
166
+ -webkit-tap-highlight-color: transparent;
167
+ transition:
168
+ background-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
169
+ color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
170
+ border-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
171
+ opacity var(--kumiko-fade-duration) var(--kumiko-fade-ease),
172
+ scale var(--kumiko-lift-duration) var(--kumiko-lift-ease);
173
+ }
174
+
175
+ /*
176
+ * After the shared size above, so a page number is as wide as the widest one: each digit (or separator) gets
177
+ * 1.1ch, room for the current page's bolder digits, plus the padding and the 1px border on each side.
178
+ */
179
+ :where([data-slot="pagination-link"]) {
180
+ min-inline-size: max(var(--_h), calc(var(--_digits) * 1.1ch + var(--_h) * 0.6 + 2px));
181
+ }
182
+
183
+ /* The nudge follows the hover grow of the motion preset, so the still preset and reduced motion keep it still. */
184
+ :where([data-slot="pagination-icon"]) {
185
+ --_dir: 1;
186
+ --_nudge: calc(var(--kumiko-pagination-nudge) * (var(--kumiko-hover-scale) - 1) * 20);
187
+
188
+ flex: none;
189
+ transition: translate var(--kumiko-lift-duration) var(--kumiko-lift-ease);
190
+ inline-size: var(--kumiko-pagination-icon-size);
191
+ block-size: var(--kumiko-pagination-icon-size);
192
+ }
193
+
194
+ :where(:dir(rtl) [data-slot="pagination-icon"]) {
195
+ --_dir: -1;
196
+
197
+ scale: -1 1;
198
+ }
199
+
200
+ :where([data-slot="pagination-link"][data-current]) {
201
+ background: var(--kumiko-pagination-current-bg);
202
+ color: var(--kumiko-pagination-current-fg);
203
+ font-weight: var(--kumiko-pagination-current-weight);
204
+ }
205
+
206
+ :where([data-slot="pagination"][data-indicator] [data-slot="pagination-link"][data-current]) {
207
+ background: transparent;
208
+ }
209
+
210
+ :where([data-slot^="pagination-"]:is(a, button)):focus-visible {
211
+ outline: 2px solid var(--kumiko-pagination-focus-ring);
212
+ outline-offset: 2px;
213
+ z-index: 1;
214
+ }
215
+
216
+ :where([data-slot^="pagination-"]:is(a, button)[aria-disabled="true"]) {
217
+ opacity: var(--kumiko-pagination-disabled-opacity);
218
+ cursor: not-allowed;
219
+ }
220
+
221
+ :where(
222
+ [data-slot^="pagination-"]:is(a, button):not([aria-disabled="true"], [data-current])
223
+ ):active {
224
+ scale: var(--kumiko-press-scale);
225
+ transition-duration:
226
+ var(--kumiko-fade-duration), var(--kumiko-fade-duration), var(--kumiko-fade-duration),
227
+ var(--kumiko-fade-duration), var(--kumiko-press-duration);
228
+ transition-timing-function:
229
+ var(--kumiko-fade-ease), var(--kumiko-fade-ease), var(--kumiko-fade-ease),
230
+ var(--kumiko-fade-ease), var(--kumiko-press-ease);
231
+ }
232
+
233
+ @media (hover: hover) and (pointer: fine) {
234
+ :where(
235
+ [data-slot^="pagination-"]:is(a, button):not([aria-disabled="true"], [data-current])
236
+ ):hover {
237
+ background: var(--kumiko-pagination-hover-bg);
238
+ color: var(--kumiko-pagination-hover-fg);
239
+ }
240
+
241
+ /* Pages only tint, so running the pointer along the row stays calm. A step's arrow leans the way it goes. */
242
+ :where([data-slot="pagination-previous"], [data-slot="pagination-first"]):not(
243
+ [aria-disabled="true"]
244
+ ):hover
245
+ [data-slot="pagination-icon"] {
246
+ translate: calc(var(--_dir) * var(--_nudge) * -1) 0;
247
+ }
248
+
249
+ :where([data-slot="pagination-next"], [data-slot="pagination-last"]):not(
250
+ [aria-disabled="true"]
251
+ ):hover
252
+ [data-slot="pagination-icon"] {
253
+ translate: calc(var(--_dir) * var(--_nudge)) 0;
254
+ }
255
+ }
256
+
257
+ /* A finger gets a full-size target, wider than the button where needed. */
258
+ @media (pointer: coarse) {
259
+ :where([data-slot^="pagination-"]:is(a, button))::after {
260
+ content: "";
261
+ position: absolute;
262
+ inset: 50% auto auto 50%;
263
+ translate: -50% -50%;
264
+ inline-size: max(100%, var(--kumiko-touch-target));
265
+ block-size: max(100%, var(--kumiko-touch-target));
266
+ }
267
+ }
268
+
269
+ :where([data-slot="pagination-ellipsis"]) {
270
+ display: inline-flex;
271
+ align-items: center;
272
+ justify-content: center;
273
+ min-inline-size: calc(var(--_h) * 0.75);
274
+ block-size: var(--_h);
275
+ color: var(--kumiko-pagination-muted);
276
+ }
277
+
278
+ :where([data-slot="pagination-status"]) {
279
+ display: inline-flex;
280
+ align-items: center;
281
+ block-size: var(--_h);
282
+ padding-inline: 0.5em;
283
+ color: var(--kumiko-pagination-muted);
284
+ font-variant-numeric: tabular-nums;
285
+ white-space: nowrap;
286
+ }
287
+
288
+ :where([data-slot="pagination-range"]) {
289
+ margin: 0;
290
+ color: var(--kumiko-pagination-muted);
291
+ font-variant-numeric: tabular-nums;
292
+ white-space: nowrap;
293
+ }
294
+
295
+ /* Words that stay readable to assistive tech while out of sight. */
296
+ :where(
297
+ [data-slot="pagination-step-label"],
298
+ [data-slot="pagination-status"] > [data-part="words"]
299
+ ) {
300
+ position: absolute;
301
+ inline-size: 1px;
302
+ block-size: 1px;
303
+ overflow: hidden;
304
+ clip-path: inset(50%);
305
+ white-space: nowrap;
306
+ }
307
+
308
+ /* The numbered layout shows pages and hides the status; the others hide the pages and show it. */
309
+ :where([data-slot="pagination-list"] > [data-part="status"]) {
310
+ display: none;
311
+ }
312
+
313
+ :where([data-slot="pagination-status"] > [data-part="short"]) {
314
+ display: none;
315
+ min-inline-size: calc((var(--_digits) * 2 + 3) * 1ch);
316
+ text-align: center;
317
+ }
318
+
319
+ /* The simple layout: Previous and Next carry their words, with "Page 5 of 20" between them across the row. */
320
+ :where(
321
+ [data-slot="pagination"]:not([data-fit="compact"]):is(
322
+ [data-layout="simple"],
323
+ :not([data-layout]):is([data-kumiko-pagination~="simple"] *)
324
+ )
325
+ ) {
326
+ & > [data-slot="pagination-list"] {
327
+ flex: 1 0 auto;
328
+ justify-content: space-between;
329
+ }
330
+
331
+ & [data-part="page"],
332
+ & [data-part="gap"] {
333
+ display: none;
334
+ }
335
+
336
+ & [data-part="status"] {
337
+ display: flex;
338
+ }
339
+
340
+ & [data-slot="pagination-status"] > [data-part="words"],
341
+ & [data-slot="pagination-step-label"] {
342
+ position: static;
343
+ inline-size: auto;
344
+ block-size: auto;
345
+ overflow: visible;
346
+ clip-path: none;
347
+ }
348
+
349
+ & :is([data-slot="pagination-previous"], [data-slot="pagination-next"]) {
350
+ padding-inline: var(--kumiko-pagination-padding);
351
+ }
352
+ }
353
+
354
+ /* The compact layout, which a numbered or simple pagination also turns into when it runs out of room. */
355
+ :where(
356
+ [data-slot="pagination"]:is(
357
+ [data-fit="compact"],
358
+ [data-layout="compact"],
359
+ :not([data-layout]):is([data-kumiko-pagination~="compact"] *)
360
+ )
361
+ ) {
362
+ & [data-part="page"],
363
+ & [data-part="gap"] {
364
+ display: none;
365
+ }
366
+
367
+ & [data-part="status"] {
368
+ display: flex;
369
+ }
370
+
371
+ & [data-slot="pagination-status"] > [data-part="short"] {
372
+ display: inline-block;
373
+ }
374
+ }
375
+
376
+ /* Outlined: every page and step has a border, and the current page is filled. */
377
+ :where(
378
+ [data-slot="pagination"]:is(
379
+ [data-look="outlined"],
380
+ :not([data-look]):is([data-kumiko-pagination~="outlined"] *)
381
+ )
382
+ ) {
383
+ & :is(a, button):is([data-slot^="pagination-"]):not([data-current]) {
384
+ border-color: var(--kumiko-pagination-border);
385
+ }
386
+ }
387
+
388
+ /* Joined: one strip with shared borders, rounded only at its ends. It tints on hover and never grows. */
389
+ :where(
390
+ [data-slot="pagination"]:is(
391
+ [data-look="joined"],
392
+ :not([data-look]):is([data-kumiko-pagination~="joined"] *)
393
+ )
394
+ ) {
395
+ & > [data-slot="pagination-list"] {
396
+ gap: 0;
397
+ }
398
+
399
+ & :is(a, button):is([data-slot^="pagination-"]),
400
+ & [data-slot="pagination-ellipsis"],
401
+ & [data-slot="pagination-status"] {
402
+ border: 1px solid var(--kumiko-pagination-border);
403
+ border-radius: 0;
404
+ margin-inline-start: -1px;
405
+ scale: none;
406
+ }
407
+
408
+ & > [data-slot="pagination-list"] > li:first-of-type > * {
409
+ margin-inline-start: 0;
410
+ border-start-start-radius: var(--_join-radius);
411
+ border-end-start-radius: var(--_join-radius);
412
+ }
413
+
414
+ & > [data-slot="pagination-list"] > li:last-of-type > * {
415
+ border-start-end-radius: var(--_join-radius);
416
+ border-end-end-radius: var(--_join-radius);
417
+ }
418
+
419
+ --_join-radius: min(var(--kumiko-pagination-radius), calc(var(--_h) * 0.3));
420
+ }
421
+
422
+ /* Rows per page and the jump field sit inline with their labels. */
423
+ :where([data-slot="pagination-size"], [data-slot="pagination-jump"]) {
424
+ display: flex;
425
+ align-items: center;
426
+ gap: 0.5rem;
427
+ color: var(--kumiko-pagination-muted);
428
+ white-space: nowrap;
429
+ }
430
+
431
+ :where([data-slot="pagination-size"] [data-slot="select"]) {
432
+ display: flex;
433
+ align-items: center;
434
+ gap: 0.5rem;
435
+ }
436
+
437
+ /* One class of weight, so the field's own full width, from a stylesheet that may load later, gives way. */
438
+ [data-slot="pagination-jump"] :where([data-slot="input"]) {
439
+ inline-size: 4.5em;
440
+ text-align: center;
441
+ }
442
+
443
+ @media (forced-colors: active) {
444
+ :where([data-slot="pagination-link"][data-current]) {
445
+ forced-color-adjust: none;
446
+ background: Highlight;
447
+ color: HighlightText;
448
+ }
449
+
450
+ :where([data-slot^="pagination-"]:is(a, button)[aria-disabled="true"]) {
451
+ color: GrayText;
452
+ opacity: 1;
453
+ }
454
+ }
455
+ }
@@ -0,0 +1,59 @@
1
+ import { Pagination as SdkPagination } from "@ui-sdk/react/pagination";
2
+ import { type ReactElement } from "react";
3
+ import { type PaginationLabels } from "./pagination-labels";
4
+ /** What the pagination shows: page numbers with gaps, Previous and Next with "Page 5 of 20", or arrows around "5 / 20". */
5
+ export type PaginationLayout = "numbered" | "simple" | "compact";
6
+ /** How the buttons look: quiet with the current page filled, each outlined, or joined into one strip. */
7
+ export type PaginationLook = "quiet" | "outlined" | "joined";
8
+ export type PaginationSize = "sm" | "md";
9
+ type SdkPaginationProps = Parameters<typeof SdkPagination>[0];
10
+ /** The props a page link or step receives, to spread onto the app's own link. */
11
+ export type PaginationLinkRenderProps = Record<string, unknown>;
12
+ export type PaginationProps = Omit<SdkPaginationProps, "children" | "render" | "pageSize"> & {
13
+ /**
14
+ * What the pagination shows. Without it, `data-kumiko-pagination="simple"` or `"compact"` on any container picks.
15
+ * @defaultValue "numbered"
16
+ */
17
+ layout?: PaginationLayout;
18
+ /**
19
+ * How the buttons look. Without it, `data-kumiko-pagination="outlined"` or `"joined"` on any container picks.
20
+ * @defaultValue "quiet"
21
+ */
22
+ look?: PaginationLook;
23
+ /** @defaultValue "md" */
24
+ size?: PaginationSize;
25
+ /** Adds steps to the first and last page. @defaultValue false */
26
+ firstLast?: boolean;
27
+ /** Shows which items the page holds, like "Showing 21–40 of 95". Needs `total`. @defaultValue false */
28
+ range?: boolean;
29
+ /** How many items fit on a page, with `total`. Pass it to control the page size. */
30
+ pageSize?: number;
31
+ /** The page size it starts with, when uncontrolled. @defaultValue the first of `pageSizes`, or 10 */
32
+ defaultPageSize?: number;
33
+ /** The page sizes to choose from. With it, a "Rows per page" select appears, and a new size goes back to page 1. */
34
+ pageSizes?: readonly number[];
35
+ onPageSizeChange?: (pageSize: number) => void;
36
+ /** Adds a field to type a page number and go there. @defaultValue false */
37
+ jump?: boolean;
38
+ /**
39
+ * Renders each page link and step as the app's own link, such as a router's, given the props to spread on it
40
+ * and the page it goes to. Needs `getHref`, which still gives each link its URL.
41
+ */
42
+ renderLink?: (props: PaginationLinkRenderProps, page: number) => ReactElement;
43
+ /**
44
+ * Whether a numbered pagination that doesn't fit its row first drops the pages beside the current one, then
45
+ * turns compact. @defaultValue true
46
+ */
47
+ fit?: boolean;
48
+ /** The locale numbers are written in. @defaultValue the page's */
49
+ locale?: string;
50
+ /** Replaces any of the English words. */
51
+ labels?: Partial<PaginationLabels>;
52
+ };
53
+ /**
54
+ * Pages through results with ui-sdk's pagination: Previous and Next, page numbers with gaps, and optionally the
55
+ * first and last page, the range shown, a page size and a field to jump to a page. It is a named navigation
56
+ * landmark, and with `getHref` every page is a real link that works before JavaScript loads.
57
+ */
58
+ export declare function Pagination(props: PaginationProps): React.JSX.Element;
59
+ export {};
@@ -0,0 +1,77 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createPaginationController, Pagination as SdkPagination, PaginationEllipsis, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationList, PaginationNext, PaginationPrevious } from "@ui-sdk/react/pagination";
3
+ import { useMemo, useState } from "react";
4
+ import { PaginationJump, PaginationPageSize, PaginationRange } from "./pagination-extras";
5
+ import { usePaginationFit } from "./pagination-fit";
6
+ import { FirstIcon, LastIcon, NextIcon, PreviousIcon } from "./pagination-icons";
7
+ import { paginationLabels } from "./pagination-labels";
8
+ import { usePaginationMotion } from "./pagination-motion";
9
+ function StepLabel({ children }) {
10
+ return _jsx("span", { "data-slot": "pagination-step-label", children: children });
11
+ }
12
+ /** The status between the steps: "Page 5 of 20" for the simple layout, "5 / 20" for the compact one. */
13
+ function Status({ page, pageCount, words, format }) {
14
+ return (_jsx(PaginationItem, { "data-part": "status", children: _jsxs("span", { "data-slot": "pagination-status", children: [_jsx("span", { "data-part": "words", children: words.pageOf(format(page), format(pageCount)) }), _jsxs("span", { "data-part": "short", "aria-hidden": "true", children: [format(page), " / ", format(pageCount)] })] }) }));
15
+ }
16
+ function Pages({ items, words, format, link }) {
17
+ return (_jsx(_Fragment, { children: items.map((item) => (_jsx(PaginationItem, { "data-part": typeof item === "number" ? "page" : "gap", "data-flip-key": String(item), children: typeof item === "number" ? (_jsx(PaginationLink, { page: item, render: link, "aria-label": words.page(format(item)), children: format(item) })) : (_jsx(PaginationEllipsis, { children: "\u2026" })) }, item))) }));
18
+ }
19
+ function Steps(props) {
20
+ const { firstLast, words, link } = props;
21
+ return (_jsxs(_Fragment, { children: [firstLast && (_jsx(PaginationItem, { "data-part": "end", children: _jsx(PaginationFirst, { render: link, "aria-label": words.first, children: _jsx(FirstIcon, {}) }) })), _jsx(PaginationItem, { "data-part": "step", children: _jsxs(PaginationPrevious, { render: link, children: [_jsx(PreviousIcon, {}), _jsx(StepLabel, { children: words.previous })] }) }), _jsx(Status, { ...props }), _jsx(Pages, { ...props }), _jsx(PaginationItem, { "data-part": "step", children: _jsxs(PaginationNext, { render: link, children: [_jsx(StepLabel, { children: words.next }), _jsx(NextIcon, {})] }) }), firstLast && (_jsx(PaginationItem, { "data-part": "end", children: _jsx(PaginationLast, { render: link, "aria-label": words.last, children: _jsx(LastIcon, {}) }) }))] }));
22
+ }
23
+ function useFormat(locale) {
24
+ return useMemo(() => {
25
+ const formatter = new Intl.NumberFormat(locale);
26
+ return (value) => formatter.format(value);
27
+ }, [locale]);
28
+ }
29
+ const fitWords = ["", "fewer", "compact"];
30
+ /** The page size the pagination uses: the app's, or its own when uncontrolled. A new size goes back to page 1. */
31
+ function usePageSize(props, controller) {
32
+ const [own, setOwn] = useState(props.defaultPageSize ?? props.pageSizes?.[0] ?? 10);
33
+ return {
34
+ perPage: props.pageSize ?? own,
35
+ changeSize: (size) => {
36
+ setOwn(size);
37
+ props.onPageSizeChange?.(size);
38
+ controller.setPage(1);
39
+ }
40
+ };
41
+ }
42
+ /** The page size select and the jump field, after the pages. */
43
+ function Trailing({ state, options, controller, perPage, changeSize, words, format }) {
44
+ const { pageSizes, disabled = false } = options;
45
+ return (_jsxs("div", { "data-slot": "pagination-trailing", children: [pageSizes && (_jsx(PaginationPageSize, { sizes: pageSizes, value: perPage, onChange: changeSize, words: words, format: format, disabled: disabled })), options.jump && (_jsx(PaginationJump, { controller: controller, pageCount: state.pageCount, words: words, disabled: disabled }))] }));
46
+ }
47
+ function Body(props) {
48
+ const { state, options, perPage, words, format } = props;
49
+ const { renderLink, getHref, total } = options;
50
+ const [list, setList] = useState(null);
51
+ usePaginationMotion(list, state.page, state.items.join(","));
52
+ const trailing = Boolean(options.range || options.pageSizes || options.jump);
53
+ const link = renderLink && getHref
54
+ ? (linkProps, part) => renderLink(linkProps, part.page)
55
+ : undefined;
56
+ return (_jsxs(_Fragment, { children: [options.range && total !== undefined && (_jsx(PaginationRange, { page: state.page, pageSize: perPage, total: total, words: words, format: format })), _jsx("span", { "data-slot": "pagination-indicator", "aria-hidden": "true", "data-hidden": "" }), _jsx(PaginationList, { ref: setList, "data-digits": format(state.pageCount).length, children: ({ items }) => (_jsx(Steps, { items: items, page: state.page, pageCount: state.pageCount, firstLast: options.firstLast ?? false, words: words, format: format, link: link })) }), trailing && _jsx(Trailing, { ...props })] }));
57
+ }
58
+ /** Splits off the props only Kumiko reads, leaving the ones ui-sdk's pagination takes. */
59
+ function ownProps(props) {
60
+ const { layout, look, size = "md", firstLast: _firstLast, range: _range, pageSize: _pageSize, defaultPageSize: _defaultPageSize, pageSizes: _pageSizes, onPageSizeChange: _onPageSizeChange, jump: _jump, renderLink: _renderLink, fit: fitting = true, locale, labels, controller: given, siblings = 1, ...rest } = props;
61
+ return { layout, look, size, fitting, locale, labels, given, siblings, rest };
62
+ }
63
+ /**
64
+ * Pages through results with ui-sdk's pagination: Previous and Next, page numbers with gaps, and optionally the
65
+ * first and last page, the range shown, a page size and a field to jump to a page. It is a named navigation
66
+ * landmark, and with `getHref` every page is a real link that works before JavaScript loads.
67
+ */
68
+ export function Pagination(props) {
69
+ const { layout, look, size, fitting, locale, labels, given, siblings, rest } = ownProps(props);
70
+ const words = { ...paginationLabels, ...labels };
71
+ const format = useFormat(locale);
72
+ const [own] = useState(createPaginationController);
73
+ const controller = given ?? own;
74
+ const { perPage, changeSize } = usePageSize(props, controller);
75
+ const { fit, rootRef } = usePaginationFit(fitting);
76
+ return (_jsx(SdkPagination, { "aria-label": words.navigation, ...rest, ref: rootRef, pageSize: rest.total === undefined ? undefined : perPage, siblings: fit >= 1 ? 0 : siblings, controller: controller, "data-layout": layout, "data-look": look, "data-size": size, "data-fit": fitWords[fit] || undefined, children: (state) => (_jsx(Body, { state: state, options: props, controller: controller, perPage: perPage, changeSize: changeSize, words: words, format: format })) }));
77
+ }
@@ -86,6 +86,7 @@
86
86
  :where([data-slot="select-value"]) {
87
87
  grid-area: 1 / 2;
88
88
  min-inline-size: 0;
89
+ contain: var(--_select-value-contain, none);
89
90
  overflow: hidden;
90
91
  text-overflow: ellipsis;
91
92
  white-space: nowrap;
@@ -110,10 +111,8 @@
110
111
  grid-area: 1 / 1;
111
112
  }
112
113
 
113
- :where(
114
- [data-slot="select-trigger"]:has(> [data-slot="select-sizer"]) > [data-slot="select-value"]
115
- ) {
116
- contain: inline-size;
114
+ :where([data-slot="select-trigger"]:has(> [data-slot="select-sizer"])) {
115
+ --_select-value-contain: inline-size;
117
116
  }
118
117
 
119
118
  :where([data-slot="select-value-icon"]) {
@@ -341,7 +340,7 @@
341
340
  [data-slot="select-content"][data-modality="keyboard"]
342
341
  [data-slot="select-item"][data-highlighted]
343
342
  ) {
344
- outline: 2px solid var(--kumiko-select-focus-ring);
343
+ outline: var(--_select-keyboard-ring, 2px solid var(--kumiko-select-focus-ring));
345
344
  outline-offset: -2px;
346
345
  }
347
346
 
@@ -448,11 +447,8 @@
448
447
  }
449
448
 
450
449
  /* Focus stays in the search field, which has the ring, so the highlighted row only has its fill. */
451
- :where(
452
- [data-slot="select-content"][data-modality="keyboard"]:has(> [data-slot="select-input"])
453
- [data-slot="select-item"][data-highlighted]
454
- ) {
455
- outline: none;
450
+ :where([data-slot="select-content"]:has(> [data-slot="select-input"])) {
451
+ --_select-keyboard-ring: none;
456
452
  }
457
453
 
458
454
  :where([data-slot="select-empty"]) {