@alulore/kumiko 0.0.0-stage → 0.14.2

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 (194) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -2
  3. package/dist/badge/badge.css +287 -0
  4. package/dist/badge/badge.d.ts +40 -0
  5. package/dist/badge/badge.js +51 -0
  6. package/dist/badge/index.d.ts +1 -0
  7. package/dist/badge/index.js +1 -0
  8. package/dist/board/board-api.d.ts +147 -0
  9. package/dist/board/board-api.js +139 -0
  10. package/dist/board/board-card-menu.d.ts +17 -0
  11. package/dist/board/board-card-menu.js +53 -0
  12. package/dist/board/board-drag-events.d.ts +12 -0
  13. package/dist/board/board-drag-events.js +86 -0
  14. package/dist/board/board-fold.d.ts +10 -0
  15. package/dist/board/board-fold.js +30 -0
  16. package/dist/board/board-group.d.ts +10 -0
  17. package/dist/board/board-group.js +28 -0
  18. package/dist/board/board-keys.d.ts +16 -0
  19. package/dist/board/board-keys.js +65 -0
  20. package/dist/board/board-locked-rows.d.ts +23 -0
  21. package/dist/board/board-locked-rows.js +77 -0
  22. package/dist/board/board-motion.d.ts +7 -0
  23. package/dist/board/board-motion.js +102 -0
  24. package/dist/board/board-primitive.d.ts +53 -0
  25. package/dist/board/board-primitive.js +66 -0
  26. package/dist/board/board-pull.d.ts +6 -0
  27. package/dist/board/board-pull.js +94 -0
  28. package/dist/board/board-selection.d.ts +42 -0
  29. package/dist/board/board-selection.js +130 -0
  30. package/dist/board/board-slots.d.ts +1003 -0
  31. package/dist/board/board-slots.js +250 -0
  32. package/dist/board/board-types.d.ts +99 -0
  33. package/dist/board/board-types.js +1 -0
  34. package/dist/board/board.css +343 -0
  35. package/dist/board/board.d.ts +290 -0
  36. package/dist/board/board.js +23 -0
  37. package/dist/board/card-menu.d.ts +21 -0
  38. package/dist/board/card-menu.js +79 -0
  39. package/dist/board/cell-key.d.ts +6 -0
  40. package/dist/board/cell-key.js +16 -0
  41. package/dist/board/index.d.ts +6 -0
  42. package/dist/board/index.js +5 -0
  43. package/dist/board/interactive.d.ts +18 -0
  44. package/dist/board/interactive.js +51 -0
  45. package/dist/board/keep-capture.d.ts +16 -0
  46. package/dist/board/keep-capture.js +57 -0
  47. package/dist/board/landing.d.ts +5 -0
  48. package/dist/board/landing.js +10 -0
  49. package/dist/board/press-to-drop.d.ts +9 -0
  50. package/dist/board/press-to-drop.js +28 -0
  51. package/dist/board/refused-home.d.ts +16 -0
  52. package/dist/board/refused-home.js +50 -0
  53. package/dist/board/repeat-gate.d.ts +4 -0
  54. package/dist/board/repeat-gate.js +12 -0
  55. package/dist/board/scrollbar-gutter.d.ts +1 -0
  56. package/dist/board/scrollbar-gutter.js +27 -0
  57. package/dist/board/touch-hold.d.ts +19 -0
  58. package/dist/board/touch-hold.js +103 -0
  59. package/dist/button/button.css +576 -0
  60. package/dist/button/button.d.ts +50 -0
  61. package/dist/button/button.js +70 -0
  62. package/dist/button/index.d.ts +2 -0
  63. package/dist/button/index.js +1 -0
  64. package/dist/checkbox/checkbox-mark.d.ts +8 -0
  65. package/dist/checkbox/checkbox-mark.js +17 -0
  66. package/dist/checkbox/checkbox-marks.d.ts +33 -0
  67. package/dist/checkbox/checkbox-marks.js +30 -0
  68. package/dist/checkbox/checkbox.css +201 -0
  69. package/dist/checkbox/checkbox.d.ts +26 -0
  70. package/dist/checkbox/checkbox.js +11 -0
  71. package/dist/checkbox/index.d.ts +3 -0
  72. package/dist/checkbox/index.js +3 -0
  73. package/dist/chip/chip.css +251 -0
  74. package/dist/chip/chip.d.ts +39 -0
  75. package/dist/chip/chip.js +25 -0
  76. package/dist/chip/index.d.ts +1 -0
  77. package/dist/chip/index.js +1 -0
  78. package/dist/dialog/dialog.css +247 -0
  79. package/dist/dialog/index.d.ts +3 -0
  80. package/dist/dialog/index.js +3 -0
  81. package/dist/hover-card/hover-card.css +149 -0
  82. package/dist/hover-card/hover-card.d.ts +3 -0
  83. package/dist/hover-card/hover-card.js +8 -0
  84. package/dist/hover-card/index.d.ts +2 -0
  85. package/dist/hover-card/index.js +2 -0
  86. package/dist/input/index.d.ts +5 -0
  87. package/dist/input/index.js +5 -0
  88. package/dist/input/input-attributes.d.ts +12 -0
  89. package/dist/input/input-attributes.js +9 -0
  90. package/dist/input/input.css +752 -0
  91. package/dist/input/input.d.ts +28 -0
  92. package/dist/input/input.js +9 -0
  93. package/dist/input/search-input.d.ts +41 -0
  94. package/dist/input/search-input.js +47 -0
  95. package/dist/kbd/index.d.ts +1 -0
  96. package/dist/kbd/index.js +1 -0
  97. package/dist/kbd/kbd.css +77 -0
  98. package/dist/kbd/kbd.d.ts +21 -0
  99. package/dist/kbd/kbd.js +37 -0
  100. package/dist/label/index.d.ts +1 -0
  101. package/dist/label/index.js +1 -0
  102. package/dist/label/label.css +37 -0
  103. package/dist/label/label.d.ts +13 -0
  104. package/dist/label/label.js +10 -0
  105. package/dist/menu/index.d.ts +3 -0
  106. package/dist/menu/index.js +3 -0
  107. package/dist/menu/menu.css +349 -0
  108. package/dist/menu/menu.d.ts +11 -0
  109. package/dist/menu/menu.js +86 -0
  110. package/dist/menu/point-menu.d.ts +26 -0
  111. package/dist/menu/point-menu.js +51 -0
  112. package/dist/motion/flip-math.d.ts +19 -0
  113. package/dist/motion/flip-math.js +33 -0
  114. package/dist/motion/flip.d.ts +40 -0
  115. package/dist/motion/flip.js +203 -0
  116. package/dist/motion/index.d.ts +2 -0
  117. package/dist/motion/index.js +2 -0
  118. package/dist/motion/motion.css +169 -0
  119. package/dist/popover/index.d.ts +1 -0
  120. package/dist/popover/index.js +1 -0
  121. package/dist/popover/popover.css +208 -0
  122. package/dist/progress/index.d.ts +2 -0
  123. package/dist/progress/index.js +2 -0
  124. package/dist/progress/progress.css +390 -0
  125. package/dist/progress/progress.d.ts +36 -0
  126. package/dist/progress/progress.js +107 -0
  127. package/dist/select/index.d.ts +3 -0
  128. package/dist/select/index.js +2 -0
  129. package/dist/select/select-labels.d.ts +6 -0
  130. package/dist/select/select-labels.js +64 -0
  131. package/dist/select/select-search.d.ts +18 -0
  132. package/dist/select/select-search.js +10 -0
  133. package/dist/select/select.css +470 -0
  134. package/dist/select/select.d.ts +44 -0
  135. package/dist/select/select.js +92 -0
  136. package/dist/separator/index.d.ts +2 -0
  137. package/dist/separator/index.js +1 -0
  138. package/dist/separator/separator.css +32 -0
  139. package/dist/separator/separator.d.ts +17 -0
  140. package/dist/separator/separator.js +10 -0
  141. package/dist/slider/index.d.ts +2 -0
  142. package/dist/slider/index.js +2 -0
  143. package/dist/slider/slider-bubble.css +203 -0
  144. package/dist/slider/slider-feel.d.ts +33 -0
  145. package/dist/slider/slider-feel.js +153 -0
  146. package/dist/slider/slider-format.d.ts +13 -0
  147. package/dist/slider/slider-format.js +15 -0
  148. package/dist/slider/slider-marks.d.ts +16 -0
  149. package/dist/slider/slider-marks.js +32 -0
  150. package/dist/slider/slider.css +335 -0
  151. package/dist/slider/slider.d.ts +34 -0
  152. package/dist/slider/slider.js +94 -0
  153. package/dist/smooth-caret/caret-box.d.ts +7 -0
  154. package/dist/smooth-caret/caret-box.js +8 -0
  155. package/dist/smooth-caret/caret-controller.d.ts +7 -0
  156. package/dist/smooth-caret/caret-controller.js +222 -0
  157. package/dist/smooth-caret/caret-geometry.d.ts +11 -0
  158. package/dist/smooth-caret/caret-geometry.js +230 -0
  159. package/dist/smooth-caret/caret-glide.d.ts +13 -0
  160. package/dist/smooth-caret/caret-glide.js +76 -0
  161. package/dist/smooth-caret/caret-host.d.ts +5 -0
  162. package/dist/smooth-caret/caret-host.js +40 -0
  163. package/dist/smooth-caret/index.d.ts +7 -0
  164. package/dist/smooth-caret/index.js +7 -0
  165. package/dist/smooth-caret/remote-carets.d.ts +40 -0
  166. package/dist/smooth-caret/remote-carets.js +130 -0
  167. package/dist/smooth-caret/smooth-caret.css +157 -0
  168. package/dist/smooth-caret/smooth-caret.d.ts +5 -0
  169. package/dist/smooth-caret/smooth-caret.js +9 -0
  170. package/dist/smooth-caret/use-smooth-caret.d.ts +5 -0
  171. package/dist/smooth-caret/use-smooth-caret.js +9 -0
  172. package/dist/switch/index.d.ts +2 -0
  173. package/dist/switch/index.js +2 -0
  174. package/dist/switch/switch-drag.d.ts +21 -0
  175. package/dist/switch/switch-drag.js +23 -0
  176. package/dist/switch/switch-gesture.d.ts +28 -0
  177. package/dist/switch/switch-gesture.js +131 -0
  178. package/dist/switch/switch.css +189 -0
  179. package/dist/switch/switch.d.ts +15 -0
  180. package/dist/switch/switch.js +24 -0
  181. package/dist/textarea/index.d.ts +2 -0
  182. package/dist/textarea/index.js +2 -0
  183. package/dist/textarea/textarea.css +37 -0
  184. package/dist/textarea/textarea.d.ts +35 -0
  185. package/dist/textarea/textarea.js +11 -0
  186. package/dist/toast/index.d.ts +2 -0
  187. package/dist/toast/index.js +2 -0
  188. package/dist/toast/toast.css +293 -0
  189. package/dist/tooltip/index.d.ts +2 -0
  190. package/dist/tooltip/index.js +2 -0
  191. package/dist/tooltip/tooltip.css +143 -0
  192. package/dist/tooltip/tooltip.d.ts +14 -0
  193. package/dist/tooltip/tooltip.js +13 -0
  194. package/package.json +243 -5
@@ -0,0 +1,335 @@
1
+ @import "../motion/motion.css";
2
+ @import "./slider-bubble.css";
3
+
4
+ @layer kumiko {
5
+ :where(:root) {
6
+ --kumiko-touch-target: 2.75rem;
7
+ --kumiko-slider-thumb-size: 1.375rem;
8
+ --kumiko-slider-thumb-size-sm: 1rem;
9
+ --kumiko-slider-thumb-border-width: 2px;
10
+ --kumiko-slider-thumb-bg: Canvas;
11
+ --kumiko-slider-thumb-border: CanvasText;
12
+ --kumiko-slider-readonly-thumb-bg: color-mix(in oklab, CanvasText 45%, transparent);
13
+ --kumiko-slider-focus-ring: Highlight;
14
+ --kumiko-slider-disabled-opacity: 0.5;
15
+ --kumiko-slider-length: 10rem;
16
+ --kumiko-slider-value-width: 3rem;
17
+ --kumiko-slider-value-gap: 0.75rem;
18
+ --kumiko-slider-value-color: color-mix(in oklab, CanvasText 70%, Canvas);
19
+ --kumiko-slider-mark-size: 0.3125rem;
20
+ --kumiko-slider-mark-gap: 0.5rem;
21
+ --kumiko-slider-mark-color: color-mix(in oklab, CanvasText 40%, transparent);
22
+ }
23
+
24
+ /* The track reads Progress's tokens, so a page that styles its bars styles its sliders the same way. */
25
+ [data-slot="slider"] {
26
+ --_height: var(--kumiko-progress-height, 0.5rem);
27
+ --_thumb: var(--kumiko-slider-thumb-size);
28
+ --_fill: var(--kumiko-progress-fill-bg, Highlight);
29
+ --_radius: var(--kumiko-progress-radius, 999px);
30
+ --_inset: var(--kumiko-progress-inset, 0.1875rem);
31
+ --_track-bg: var(
32
+ --kumiko-progress-track-bg,
33
+ color-mix(in oklab, currentColor 12%, transparent)
34
+ );
35
+ --_track-shadow: var(
36
+ --kumiko-progress-track-shadow,
37
+ inset 0 1px 2px rgb(0 0 0 / 0.4),
38
+ inset 0 0 0 1px rgb(0 0 0 / 0.06)
39
+ );
40
+ --_value-width: var(--kumiko-slider-value-width);
41
+ --_glide: var(--kumiko-move-duration) var(--kumiko-move-ease);
42
+
43
+ display: flex;
44
+ box-sizing: border-box;
45
+ inline-size: 100%;
46
+ align-items: flex-start;
47
+ gap: var(--kumiko-slider-value-gap);
48
+ user-select: none;
49
+ }
50
+
51
+ [data-slot="slider"][data-orientation="vertical"] {
52
+ flex-direction: column;
53
+ align-items: center;
54
+ inline-size: auto;
55
+ block-size: var(--kumiko-slider-length);
56
+ }
57
+
58
+ [data-slot="slider"][data-size="sm"] {
59
+ --_height: var(--kumiko-progress-height-sm, 0.25rem);
60
+ --_thumb: var(--kumiko-slider-thumb-size-sm);
61
+ }
62
+
63
+ [data-slot="slider"][data-range] {
64
+ --_value-width: calc(2 * var(--kumiko-slider-value-width) + 1ch);
65
+ }
66
+
67
+ /*
68
+ * The recessed track and floating fill are on.
69
+ * A data-kumiko-slider list on a slider or on any ancestor of it turns them off.
70
+ * The words are no-recessed, no-floating, or flat for both, as data-kumiko-progress does.
71
+ */
72
+ :is(
73
+ [data-kumiko-slider~="no-recessed"] [data-slot="slider"],
74
+ [data-slot="slider"][data-kumiko-slider~="no-recessed"],
75
+ [data-kumiko-slider~="flat"] [data-slot="slider"],
76
+ [data-slot="slider"][data-kumiko-slider~="flat"]
77
+ ) {
78
+ --_track-bg: var(
79
+ --kumiko-progress-flat-track-bg,
80
+ color-mix(in oklab, CanvasText 12%, Canvas)
81
+ );
82
+ --_track-shadow: var(--kumiko-progress-flat-track-shadow, 0 0 0 0 transparent);
83
+ }
84
+
85
+ :is(
86
+ [data-kumiko-slider~="no-floating"] [data-slot="slider"],
87
+ [data-slot="slider"][data-kumiko-slider~="no-floating"],
88
+ [data-kumiko-slider~="flat"] [data-slot="slider"],
89
+ [data-slot="slider"][data-kumiko-slider~="flat"]
90
+ ) {
91
+ --_inset: 0px;
92
+ }
93
+
94
+ /* The control is the press area. The thumbs sit half a thumb in from its ends, so they never overhang it. */
95
+ [data-slot="slider-control"] {
96
+ position: relative;
97
+ display: flex;
98
+ box-sizing: border-box;
99
+ min-inline-size: 0;
100
+ min-block-size: var(--_thumb);
101
+ flex: 1 1 0;
102
+ align-items: center;
103
+ padding-inline: calc(var(--_thumb) / 2);
104
+ cursor: var(--kumiko-press-cursor, pointer);
105
+ }
106
+
107
+ [data-slot="slider"][data-orientation="vertical"] [data-slot="slider-control"] {
108
+ min-block-size: 0;
109
+ min-inline-size: var(--_thumb);
110
+ flex-direction: column;
111
+ padding-block: calc(var(--_thumb) / 2);
112
+ padding-inline: 0;
113
+ }
114
+
115
+ [data-slot="slider-control"]:has([data-slot="slider-marks"]) {
116
+ padding-block-end: calc(var(--kumiko-slider-mark-size) + var(--kumiko-slider-mark-gap));
117
+ }
118
+
119
+ [data-slot="slider"][data-orientation="vertical"]
120
+ [data-slot="slider-control"]:has([data-slot="slider-marks"]) {
121
+ padding-block-end: calc(var(--_thumb) / 2);
122
+ padding-inline-end: calc(var(--kumiko-slider-mark-size) + var(--kumiko-slider-mark-gap));
123
+ }
124
+
125
+ [data-slot="slider-track"] {
126
+ flex: 1 1 auto;
127
+ block-size: calc(var(--_height) + 2 * var(--_inset));
128
+ border-radius: var(--_radius);
129
+ background: var(--_track-bg);
130
+ box-shadow: var(--_track-shadow);
131
+ }
132
+
133
+ [data-slot="slider"][data-orientation="vertical"] [data-slot="slider-track"] {
134
+ inline-size: calc(var(--_height) + 2 * var(--_inset));
135
+ block-size: auto;
136
+ }
137
+
138
+ /*
139
+ * The fill is sized in percent of the whole track by ui-sdk, so it ends exactly under the thumb's centre.
140
+ * The floating gap is drawn inside it, which the thumb hides at the ends.
141
+ */
142
+ [data-slot="slider-indicator"] {
143
+ transition:
144
+ inset-inline-start var(--_glide),
145
+ width var(--_glide),
146
+ bottom var(--_glide),
147
+ height var(--_glide);
148
+ }
149
+
150
+ [data-slot="slider-indicator"]::before {
151
+ content: "";
152
+ position: absolute;
153
+ inset: var(--_inset);
154
+ border-radius: var(--_radius);
155
+ background: var(--_fill);
156
+ }
157
+
158
+ [data-slot="slider-thumb"] {
159
+ box-sizing: border-box;
160
+ inline-size: var(--_thumb);
161
+ block-size: var(--_thumb);
162
+ transition:
163
+ inset-inline-start var(--_glide),
164
+ inset-inline-end var(--_glide),
165
+ bottom var(--_glide);
166
+ }
167
+
168
+ /* A drag or a held key moves the value, and the thumb and fill sit where it is at once, with no lag. */
169
+ [data-slot="slider"][data-follow]
170
+ :is([data-slot="slider-thumb"], [data-slot="slider-indicator"]) {
171
+ transition: none;
172
+ }
173
+
174
+ [data-slot="slider-thumb-face"] {
175
+ display: block;
176
+ box-sizing: border-box;
177
+ inline-size: 100%;
178
+ block-size: 100%;
179
+ border: var(--kumiko-slider-thumb-border-width) solid var(--kumiko-slider-thumb-border);
180
+ border-radius: 999px;
181
+ background: var(--kumiko-slider-thumb-bg);
182
+ transition:
183
+ background-color var(--kumiko-fade-duration) var(--kumiko-fade-ease),
184
+ scale var(--kumiko-press-duration) var(--kumiko-press-ease);
185
+ }
186
+
187
+ /* The ring is for the keyboard: a press with a mouse, pen or finger sets data-pointer, and the next key press clears it. */
188
+ [data-slot="slider"]:not([data-pointer])
189
+ [data-slot="slider-thumb"]:has(:focus-visible)
190
+ [data-slot="slider-thumb-face"] {
191
+ outline: 2px solid var(--kumiko-slider-focus-ring);
192
+ outline-offset: 2px;
193
+ }
194
+
195
+ [data-slot="slider-thumb"][data-dragging] [data-slot="slider-thumb-face"] {
196
+ scale: var(--kumiko-squash-x) var(--kumiko-squash-y);
197
+ }
198
+
199
+ @media (hover: hover) and (pointer: fine) {
200
+ [data-slot="slider"]:not([data-disabled], [data-readonly])
201
+ [data-slot="slider-thumb"]:hover:not([data-dragging])
202
+ [data-slot="slider-thumb-face"] {
203
+ scale: var(--kumiko-hover-scale);
204
+ }
205
+ }
206
+
207
+ /* On a finger, an invisible area around the thumb reaches the touch target, and the thumb itself does not grow. */
208
+ @media (pointer: coarse) {
209
+ [data-slot="slider-thumb"]::after {
210
+ content: "";
211
+ position: absolute;
212
+ inset-block-start: 50%;
213
+ left: 50%;
214
+ inline-size: max(var(--_thumb), var(--kumiko-touch-target));
215
+ block-size: max(var(--_thumb), var(--kumiko-touch-target));
216
+ translate: -50% -50%;
217
+ }
218
+ }
219
+
220
+ [data-slot="slider"][data-disabled] {
221
+ opacity: var(--kumiko-slider-disabled-opacity);
222
+ }
223
+
224
+ [data-slot="slider"][data-disabled] [data-slot="slider-control"] {
225
+ cursor: not-allowed;
226
+ }
227
+
228
+ /* Read-only is a status, not a control: a muted thumb that does not react, and it is not dimmed, so it never looks disabled. */
229
+ [data-slot="slider"][data-readonly] [data-slot="slider-control"] {
230
+ cursor: default;
231
+ }
232
+
233
+ [data-slot="slider"][data-readonly][data-disabled] [data-slot="slider-control"] {
234
+ cursor: not-allowed;
235
+ }
236
+
237
+ [data-slot="slider"][data-readonly] [data-slot="slider-thumb-face"] {
238
+ border-color: var(--kumiko-slider-readonly-thumb-bg);
239
+ background: var(--kumiko-slider-readonly-thumb-bg);
240
+ }
241
+
242
+ /* The value, always shown beside the track at a fixed width, so the track never shifts as the digits change. */
243
+ [data-slot="slider-value"] {
244
+ flex: none;
245
+ inline-size: var(--_value-width);
246
+ block-size: var(--_thumb);
247
+ color: var(--kumiko-slider-value-color);
248
+ font-size: 0.8125rem;
249
+ font-variant-numeric: tabular-nums;
250
+ line-height: var(--_thumb);
251
+ text-align: end;
252
+ white-space: nowrap;
253
+ }
254
+
255
+ [data-slot="slider"][data-orientation="vertical"] [data-slot="slider-value"] {
256
+ block-size: auto;
257
+ line-height: normal;
258
+ text-align: center;
259
+ }
260
+
261
+ /* A mark at each step, outside the track, so one the fill has passed can take the fill colour. */
262
+ [data-slot="slider-marks"] {
263
+ position: absolute;
264
+ inset-inline: 0;
265
+ inset-block-start: calc(100% + var(--kumiko-slider-mark-gap));
266
+ block-size: var(--kumiko-slider-mark-size);
267
+ pointer-events: none;
268
+ }
269
+
270
+ [data-slot="slider-mark"] {
271
+ position: absolute;
272
+ inset-inline-start: var(--kumiko-slider-mark-at);
273
+ margin-inline-start: calc(var(--kumiko-slider-mark-size) / -2);
274
+ inline-size: var(--kumiko-slider-mark-size);
275
+ block-size: var(--kumiko-slider-mark-size);
276
+ border-radius: 999px;
277
+ background: var(--kumiko-slider-mark-color);
278
+ transition: background-color var(--kumiko-fade-duration) var(--kumiko-fade-ease);
279
+ }
280
+
281
+ [data-slot="slider-mark"][data-passed] {
282
+ background: var(--_fill);
283
+ }
284
+
285
+ [data-slot="slider"][data-orientation="vertical"] [data-slot="slider-marks"] {
286
+ inset-block: 0;
287
+ inset-inline: auto;
288
+ inset-inline-start: calc(100% + var(--kumiko-slider-mark-gap));
289
+ inline-size: var(--kumiko-slider-mark-size);
290
+ block-size: auto;
291
+ }
292
+
293
+ [data-slot="slider"][data-orientation="vertical"] [data-slot="slider-mark"] {
294
+ inset-block-end: var(--kumiko-slider-mark-at);
295
+ inset-inline-start: 0;
296
+ margin-inline-start: 0;
297
+ margin-block-end: calc(var(--kumiko-slider-mark-size) / -2);
298
+ }
299
+
300
+ /* Forced colours replace colours that are not system colours, so the track, fill and thumb keep to the system palette. */
301
+ @media (forced-colors: active) {
302
+ [data-slot="slider"] {
303
+ --_fill: Highlight;
304
+ }
305
+
306
+ [data-slot="slider-track"] {
307
+ outline: 1px solid ButtonText;
308
+ outline-offset: -1px;
309
+ background: Canvas;
310
+ box-shadow: none;
311
+ }
312
+
313
+ [data-slot="slider-thumb-face"] {
314
+ border-color: ButtonText;
315
+ background: Canvas;
316
+ }
317
+
318
+ [data-slot="slider"][data-readonly] [data-slot="slider-thumb-face"] {
319
+ border-color: GrayText;
320
+ background: GrayText;
321
+ }
322
+
323
+ [data-slot="slider-mark"] {
324
+ background: ButtonText;
325
+ }
326
+
327
+ [data-slot="slider-mark"][data-passed] {
328
+ background: Highlight;
329
+ }
330
+
331
+ [data-slot="slider-value"] {
332
+ color: CanvasText;
333
+ }
334
+ }
335
+ }
@@ -0,0 +1,34 @@
1
+ import { Slider as SdkSlider } from "@ui-sdk/react/slider";
2
+ type SdkSliderProps<Value extends number | number[]> = Parameters<typeof SdkSlider<Value>>[0];
3
+ /** Where a slider shows its value as text: in a bubble above the thumb while it is moved, beside the track, or nowhere. */
4
+ export type ShowValue = "none" | "bubble" | "beside";
5
+ export type SliderProps<Value extends number | number[] = number | number[]> = Omit<SdkSliderProps<Value>, "children"> & {
6
+ /** The size of the track and thumb. @defaultValue "md" */
7
+ size?: "sm" | "md";
8
+ /** The name of each thumb, for `aria-label`: one string for all, or one per thumb. A range needs a name for each thumb. */
9
+ thumbLabel?: string | string[];
10
+ /** Where the value is shown as text. @defaultValue "bubble" */
11
+ showValue?: ShowValue;
12
+ /** How the value bubble looks. @defaultValue "pill" */
13
+ bubble?: SliderBubble;
14
+ /** The empty track sinks into the surface: a tint of the text colour and an inset shadow. @defaultValue true */
15
+ recessed?: boolean;
16
+ /** The fill sits inside the track with a gap all round. @defaultValue true */
17
+ floating?: boolean;
18
+ /** Small marks along the track at each step, for sliders with few steps. None are drawn above 20 steps. @defaultValue false */
19
+ marks?: boolean;
20
+ };
21
+ /** How the value bubble looks: like a Kumiko tooltip, a round pill, a map pin, or the bare value. */
22
+ export type SliderBubble = "tooltip" | "pill" | "pin" | "plain";
23
+ /**
24
+ * The ui-sdk slider with Kumiko's look and motion, composed: the control, the track with its fill and one thumb for each value.
25
+ * A press on the track glides the thumb there with the move tokens.
26
+ * A drag or key makes thumb and fill follow with no transition.
27
+ * The `showValue` prop shows the formatted value in a bubble above the thumb while it is moved (the default), or always beside the track.
28
+ * The `bubble` prop picks the bubble's look.
29
+ * The recessed track and floating fill are on by default, as in Progress.
30
+ * A `data-kumiko-slider` list on an ancestor (`no-recessed`, `no-floating`, `flat` for both) does the same for every slider inside it.
31
+ * A slider needs a name: a `thumbLabel`, an `aria-label` on the slider for a range, or a field label.
32
+ */
33
+ export declare function Slider<Value extends number | number[] = number | number[]>({ size, thumbLabel, showValue, bubble, recessed, floating, marks, ...props }: SliderProps<Value>): React.JSX.Element;
34
+ export {};
@@ -0,0 +1,94 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { pageLocale } from "@ui-sdk/core";
3
+ import { Slider as SdkSlider, SliderControl, SliderIndicator, SliderThumb, SliderTrack, SliderValue } from "@ui-sdk/react/slider";
4
+ import { useState } from "react";
5
+ import { alongside, useSliderFeel } from "./slider-feel";
6
+ import { formatThumb } from "./slider-format";
7
+ import { isPassed, marksFor } from "./slider-marks";
8
+ /** The data-kumiko-slider list for the looks a slider turned off. */
9
+ function looks(on) {
10
+ const list = [on.recessed ? "" : "no-recessed", on.floating ? "" : "no-floating"].filter(Boolean);
11
+ return list.length > 0 ? list.join(" ") : undefined;
12
+ }
13
+ /** The value bubble, which reads the page's locale once it is mounted, the way ui-sdk does for the thumb's own text. */
14
+ function Bubble({ value, formatting }) {
15
+ const [page, setPage] = useState(undefined);
16
+ return (_jsx("span", { "data-slot": "slider-bubble", "aria-hidden": "true", ref: (element) => {
17
+ const found = element ? pageLocale(element) : undefined;
18
+ if (element && found !== page) {
19
+ setPage(found);
20
+ }
21
+ }, children: formatThumb(value, { ...formatting, pageLocale: page }) }));
22
+ }
23
+ function Thumbs({ count, labels, bubble, keyed, shown, formatting }) {
24
+ return (_jsx(_Fragment, { children: Array.from({ length: count }, (_, index) => (_jsx(SliderThumb, { index: index, "aria-label": Array.isArray(labels) ? labels[index] : labels, "data-adjusting": keyed === index ? "" : undefined, "data-revealed": shown === index ? "" : undefined, children: (state) => (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "slider-thumb-face", "aria-hidden": "true" }), bubble ? (_jsx(Bubble, { value: state.thumbValue, formatting: formatting })) : null] })) }, index))) }));
25
+ }
26
+ function markStyle(percent) {
27
+ return { "--kumiko-slider-mark-at": `${percent}%` };
28
+ }
29
+ /** A mark at each step, each told whether the fill has passed it. Nothing above 20 steps. */
30
+ function Marks({ min, max, step, values }) {
31
+ const marks = marksFor(min, max, step);
32
+ if (marks.length === 0) {
33
+ return null;
34
+ }
35
+ return (_jsx("span", { "data-slot": "slider-marks", "aria-hidden": "true", children: marks.map((mark) => (_jsx("span", { "data-slot": "slider-mark", "data-passed": isPassed(mark.value, values) ? "" : undefined, style: markStyle(mark.percent) }, mark.value))) }));
36
+ }
37
+ /** The control with the track, its fill, the marks and the thumbs. */
38
+ function Rail({ marks, thumbs }) {
39
+ return (_jsx(SliderControl, { children: _jsx(SliderTrack, { children: (state) => (_jsxs(_Fragment, { children: [_jsx(SliderIndicator, {}), marks ? _jsx(Marks, { ...marks, values: [state.value].flat() }) : null, _jsx(Thumbs, { ...thumbs })] })) }) }));
40
+ }
41
+ /** The handlers that tell the feel what the slider is doing, each running the caller's own first. */
42
+ function feelHandlers(feel, props) {
43
+ return {
44
+ onValueChange: (next, details) => {
45
+ feel.changed(details.reason, details.thumb);
46
+ props.onValueChange?.(next, details);
47
+ },
48
+ onPointerDownCapture: alongside(props.onPointerDownCapture, feel.pressed),
49
+ onPointerUp: alongside(props.onPointerUp, feel.released),
50
+ onPointerCancel: alongside(props.onPointerCancel, feel.released),
51
+ onLostPointerCapture: alongside(props.onLostPointerCapture, feel.released),
52
+ onKeyDownCapture: alongside(props.onKeyDownCapture, feel.keyDown),
53
+ onKeyUp: alongside(props.onKeyUp, feel.keyUp),
54
+ onBlur: alongside(props.onBlur, feel.blurred)
55
+ };
56
+ }
57
+ /** How many thumbs the value or default value asks for. */
58
+ function thumbsIn(value) {
59
+ return Array.isArray(value) ? Math.max(1, value.length) : 1;
60
+ }
61
+ /** What the bubble needs to format a thumb's value the way ui-sdk does. */
62
+ function formattingOf(props) {
63
+ return {
64
+ format: props.format,
65
+ locale: props.locale,
66
+ step: props.step !== undefined && props.step > 0 ? props.step : 1
67
+ };
68
+ }
69
+ /** The range the marks are drawn over, or null when there are none. */
70
+ function marksOf(on, props) {
71
+ return on ? { min: props.min ?? 0, max: props.max ?? 100, step: props.step ?? 1 } : null;
72
+ }
73
+ /**
74
+ * The ui-sdk slider with Kumiko's look and motion, composed: the control, the track with its fill and one thumb for each value.
75
+ * A press on the track glides the thumb there with the move tokens.
76
+ * A drag or key makes thumb and fill follow with no transition.
77
+ * The `showValue` prop shows the formatted value in a bubble above the thumb while it is moved (the default), or always beside the track.
78
+ * The `bubble` prop picks the bubble's look.
79
+ * The recessed track and floating fill are on by default, as in Progress.
80
+ * A `data-kumiko-slider` list on an ancestor (`no-recessed`, `no-floating`, `flat` for both) does the same for every slider inside it.
81
+ * A slider needs a name: a `thumbLabel`, an `aria-label` on the slider for a range, or a field label.
82
+ */
83
+ export function Slider({ size = "md", thumbLabel, showValue = "bubble", bubble = "pill", recessed = true, floating = true, marks = false, ...props }) {
84
+ const feel = useSliderFeel();
85
+ const count = thumbsIn(props.value ?? props.defaultValue);
86
+ return (_jsxs(SdkSlider, { "data-size": size, "data-show-value": showValue, "data-bubble": bubble, "data-pointer": feel.pointer ? "" : undefined, "data-touch": feel.touch ? "" : undefined, "data-range": count > 1 ? "" : undefined, "data-follow": feel.follow ? "" : undefined, "data-kumiko-slider": looks({ recessed, floating }), ...props, ...feelHandlers(feel, props), children: [_jsx(Rail, { marks: marksOf(marks, props), thumbs: {
87
+ count,
88
+ labels: thumbLabel,
89
+ bubble: showValue === "bubble",
90
+ keyed: feel.keyed,
91
+ shown: feel.shown,
92
+ formatting: formattingOf(props)
93
+ } }), showValue === "beside" ? _jsx(SliderValue, {}) : null] }));
94
+ }
@@ -0,0 +1,7 @@
1
+ export interface Box {
2
+ left: number;
3
+ top: number;
4
+ right: number;
5
+ bottom: number;
6
+ }
7
+ export declare function intersectBoxes(a: Box, b: Box): Box;
@@ -0,0 +1,8 @@
1
+ export function intersectBoxes(a, b) {
2
+ return {
3
+ left: Math.max(a.left, b.left),
4
+ top: Math.max(a.top, b.top),
5
+ right: Math.min(a.right, b.right),
6
+ bottom: Math.min(a.bottom, b.bottom)
7
+ };
8
+ }
@@ -0,0 +1,7 @@
1
+ type Disposer = () => void;
2
+ /**
3
+ * Starts the gliding caret over the given caret and bar elements. Returns a function that stops it and gives
4
+ * the native caret back.
5
+ */
6
+ export declare function startSmoothCaret(caret: HTMLElement, bar: HTMLElement): Disposer;
7
+ export {};