@alulore/kumiko 0.0.0-stage → 0.14.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/badge/badge.css +287 -0
- package/dist/badge/badge.d.ts +40 -0
- package/dist/badge/badge.js +51 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +1 -0
- package/dist/board/board-api.d.ts +147 -0
- package/dist/board/board-api.js +139 -0
- package/dist/board/board-card-menu.d.ts +17 -0
- package/dist/board/board-card-menu.js +53 -0
- package/dist/board/board-drag-events.d.ts +12 -0
- package/dist/board/board-drag-events.js +86 -0
- package/dist/board/board-fold.d.ts +10 -0
- package/dist/board/board-fold.js +30 -0
- package/dist/board/board-group.d.ts +10 -0
- package/dist/board/board-group.js +28 -0
- package/dist/board/board-keys.d.ts +16 -0
- package/dist/board/board-keys.js +65 -0
- package/dist/board/board-locked-rows.d.ts +23 -0
- package/dist/board/board-locked-rows.js +77 -0
- package/dist/board/board-motion.d.ts +7 -0
- package/dist/board/board-motion.js +102 -0
- package/dist/board/board-primitive.d.ts +53 -0
- package/dist/board/board-primitive.js +66 -0
- package/dist/board/board-pull.d.ts +6 -0
- package/dist/board/board-pull.js +94 -0
- package/dist/board/board-selection.d.ts +42 -0
- package/dist/board/board-selection.js +130 -0
- package/dist/board/board-slots.d.ts +1003 -0
- package/dist/board/board-slots.js +250 -0
- package/dist/board/board-types.d.ts +99 -0
- package/dist/board/board-types.js +1 -0
- package/dist/board/board.css +343 -0
- package/dist/board/board.d.ts +290 -0
- package/dist/board/board.js +23 -0
- package/dist/board/card-menu.d.ts +21 -0
- package/dist/board/card-menu.js +79 -0
- package/dist/board/cell-key.d.ts +6 -0
- package/dist/board/cell-key.js +16 -0
- package/dist/board/index.d.ts +6 -0
- package/dist/board/index.js +5 -0
- package/dist/board/interactive.d.ts +18 -0
- package/dist/board/interactive.js +51 -0
- package/dist/board/keep-capture.d.ts +16 -0
- package/dist/board/keep-capture.js +57 -0
- package/dist/board/landing.d.ts +5 -0
- package/dist/board/landing.js +10 -0
- package/dist/board/press-to-drop.d.ts +9 -0
- package/dist/board/press-to-drop.js +28 -0
- package/dist/board/refused-home.d.ts +16 -0
- package/dist/board/refused-home.js +50 -0
- package/dist/board/repeat-gate.d.ts +4 -0
- package/dist/board/repeat-gate.js +12 -0
- package/dist/board/scrollbar-gutter.d.ts +1 -0
- package/dist/board/scrollbar-gutter.js +27 -0
- package/dist/board/touch-hold.d.ts +19 -0
- package/dist/board/touch-hold.js +103 -0
- package/dist/button/button.css +576 -0
- package/dist/button/button.d.ts +50 -0
- package/dist/button/button.js +70 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +1 -0
- package/dist/checkbox/checkbox-mark.d.ts +8 -0
- package/dist/checkbox/checkbox-mark.js +17 -0
- package/dist/checkbox/checkbox-marks.d.ts +33 -0
- package/dist/checkbox/checkbox-marks.js +30 -0
- package/dist/checkbox/checkbox.css +201 -0
- package/dist/checkbox/checkbox.d.ts +26 -0
- package/dist/checkbox/checkbox.js +11 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/checkbox/index.js +3 -0
- package/dist/chip/chip.css +251 -0
- package/dist/chip/chip.d.ts +39 -0
- package/dist/chip/chip.js +25 -0
- package/dist/chip/index.d.ts +1 -0
- package/dist/chip/index.js +1 -0
- package/dist/dialog/dialog.css +247 -0
- package/dist/dialog/index.d.ts +3 -0
- package/dist/dialog/index.js +3 -0
- package/dist/hover-card/hover-card.css +149 -0
- package/dist/hover-card/hover-card.d.ts +3 -0
- package/dist/hover-card/hover-card.js +8 -0
- package/dist/hover-card/index.d.ts +2 -0
- package/dist/hover-card/index.js +2 -0
- package/dist/input/index.d.ts +5 -0
- package/dist/input/index.js +5 -0
- package/dist/input/input-attributes.d.ts +12 -0
- package/dist/input/input-attributes.js +9 -0
- package/dist/input/input.css +752 -0
- package/dist/input/input.d.ts +28 -0
- package/dist/input/input.js +9 -0
- package/dist/input/search-input.d.ts +41 -0
- package/dist/input/search-input.js +47 -0
- package/dist/kbd/index.d.ts +1 -0
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/kbd.css +77 -0
- package/dist/kbd/kbd.d.ts +21 -0
- package/dist/kbd/kbd.js +37 -0
- package/dist/label/index.d.ts +1 -0
- package/dist/label/index.js +1 -0
- package/dist/label/label.css +37 -0
- package/dist/label/label.d.ts +13 -0
- package/dist/label/label.js +10 -0
- package/dist/menu/index.d.ts +3 -0
- package/dist/menu/index.js +3 -0
- package/dist/menu/menu.css +349 -0
- package/dist/menu/menu.d.ts +11 -0
- package/dist/menu/menu.js +86 -0
- package/dist/menu/point-menu.d.ts +26 -0
- package/dist/menu/point-menu.js +51 -0
- package/dist/motion/flip-math.d.ts +19 -0
- package/dist/motion/flip-math.js +33 -0
- package/dist/motion/flip.d.ts +40 -0
- package/dist/motion/flip.js +203 -0
- package/dist/motion/index.d.ts +2 -0
- package/dist/motion/index.js +2 -0
- package/dist/motion/motion.css +169 -0
- package/dist/popover/index.d.ts +1 -0
- package/dist/popover/index.js +1 -0
- package/dist/popover/popover.css +208 -0
- package/dist/progress/index.d.ts +2 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/progress.css +390 -0
- package/dist/progress/progress.d.ts +36 -0
- package/dist/progress/progress.js +107 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.js +2 -0
- package/dist/select/select-labels.d.ts +6 -0
- package/dist/select/select-labels.js +64 -0
- package/dist/select/select-search.d.ts +18 -0
- package/dist/select/select-search.js +10 -0
- package/dist/select/select.css +470 -0
- package/dist/select/select.d.ts +44 -0
- package/dist/select/select.js +92 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +1 -0
- package/dist/separator/separator.css +32 -0
- package/dist/separator/separator.d.ts +17 -0
- package/dist/separator/separator.js +10 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.js +2 -0
- package/dist/slider/slider-bubble.css +203 -0
- package/dist/slider/slider-feel.d.ts +33 -0
- package/dist/slider/slider-feel.js +153 -0
- package/dist/slider/slider-format.d.ts +13 -0
- package/dist/slider/slider-format.js +15 -0
- package/dist/slider/slider-marks.d.ts +16 -0
- package/dist/slider/slider-marks.js +32 -0
- package/dist/slider/slider.css +335 -0
- package/dist/slider/slider.d.ts +34 -0
- package/dist/slider/slider.js +94 -0
- package/dist/smooth-caret/caret-box.d.ts +7 -0
- package/dist/smooth-caret/caret-box.js +8 -0
- package/dist/smooth-caret/caret-controller.d.ts +7 -0
- package/dist/smooth-caret/caret-controller.js +222 -0
- package/dist/smooth-caret/caret-geometry.d.ts +11 -0
- package/dist/smooth-caret/caret-geometry.js +230 -0
- package/dist/smooth-caret/caret-glide.d.ts +13 -0
- package/dist/smooth-caret/caret-glide.js +76 -0
- package/dist/smooth-caret/caret-host.d.ts +5 -0
- package/dist/smooth-caret/caret-host.js +40 -0
- package/dist/smooth-caret/index.d.ts +7 -0
- package/dist/smooth-caret/index.js +7 -0
- package/dist/smooth-caret/remote-carets.d.ts +40 -0
- package/dist/smooth-caret/remote-carets.js +130 -0
- package/dist/smooth-caret/smooth-caret.css +157 -0
- package/dist/smooth-caret/smooth-caret.d.ts +5 -0
- package/dist/smooth-caret/smooth-caret.js +9 -0
- package/dist/smooth-caret/use-smooth-caret.d.ts +5 -0
- package/dist/smooth-caret/use-smooth-caret.js +9 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/index.js +2 -0
- package/dist/switch/switch-drag.d.ts +21 -0
- package/dist/switch/switch-drag.js +23 -0
- package/dist/switch/switch-gesture.d.ts +28 -0
- package/dist/switch/switch-gesture.js +131 -0
- package/dist/switch/switch.css +189 -0
- package/dist/switch/switch.d.ts +15 -0
- package/dist/switch/switch.js +24 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -0
- package/dist/textarea/textarea.css +37 -0
- package/dist/textarea/textarea.d.ts +35 -0
- package/dist/textarea/textarea.js +11 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/toast.css +293 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/tooltip.css +143 -0
- package/dist/tooltip/tooltip.d.ts +14 -0
- package/dist/tooltip/tooltip.js +13 -0
- package/package.json +246 -5
- package/README.md +0 -3
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
@import "../motion/motion.css";
|
|
2
|
+
|
|
3
|
+
@layer kumiko {
|
|
4
|
+
:where(:root) {
|
|
5
|
+
--kumiko-progress-height: 0.5rem;
|
|
6
|
+
--kumiko-progress-height-sm: 0.25rem;
|
|
7
|
+
--kumiko-progress-height-lg: 0.875rem;
|
|
8
|
+
--kumiko-progress-radius: 999px;
|
|
9
|
+
--kumiko-progress-track-bg: color-mix(in oklab, currentColor 12%, transparent);
|
|
10
|
+
--kumiko-progress-track-shadow:
|
|
11
|
+
inset 0 1px 2px rgb(0 0 0 / 0.4), inset 0 0 0 1px rgb(0 0 0 / 0.06);
|
|
12
|
+
--kumiko-progress-flat-track-bg: color-mix(in oklab, CanvasText 12%, Canvas);
|
|
13
|
+
--kumiko-progress-flat-track-shadow: 0 0 0 0 transparent;
|
|
14
|
+
--kumiko-progress-fill-bg: Highlight;
|
|
15
|
+
--kumiko-progress-fill-lift: transparent;
|
|
16
|
+
--kumiko-progress-fill-highlight: transparent;
|
|
17
|
+
--kumiko-progress-edge-glow: transparent;
|
|
18
|
+
--kumiko-progress-edge-glow-size: 1.75rem;
|
|
19
|
+
--kumiko-progress-inset: 0.1875rem;
|
|
20
|
+
--kumiko-progress-lit-lift: color-mix(in oklab, white 14%, transparent);
|
|
21
|
+
--kumiko-progress-lit-highlight: color-mix(in oklab, white 26%, transparent);
|
|
22
|
+
--kumiko-progress-lit-glow: color-mix(in oklab, white 45%, transparent);
|
|
23
|
+
--kumiko-progress-sheen-opacity: 0.4;
|
|
24
|
+
--kumiko-progress-sheen-color: white;
|
|
25
|
+
--kumiko-progress-sheen-duration: 3s;
|
|
26
|
+
--kumiko-progress-complete-duration: 900ms;
|
|
27
|
+
--kumiko-progress-gap: 0.375rem;
|
|
28
|
+
--kumiko-progress-label-size: 0.8125rem;
|
|
29
|
+
--kumiko-progress-label-weight: 500;
|
|
30
|
+
--kumiko-progress-label-color: CanvasText;
|
|
31
|
+
--kumiko-progress-value-color: color-mix(in oklab, CanvasText 70%, Canvas);
|
|
32
|
+
--kumiko-progress-label-gap: 0.75rem;
|
|
33
|
+
--kumiko-progress-indeterminate-duration: 1.2s;
|
|
34
|
+
--kumiko-progress-indeterminate-ease: ease-in-out;
|
|
35
|
+
--kumiko-progress-shimmer-size: 0.4;
|
|
36
|
+
--kumiko-progress-bounce-size: 0.3;
|
|
37
|
+
--kumiko-progress-pulse-duration: 1.6s;
|
|
38
|
+
--kumiko-progress-pulse-min: 0.3;
|
|
39
|
+
--kumiko-progress-reduced-duration: 3s;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-slot="progress"] {
|
|
43
|
+
--_height: var(--kumiko-progress-height);
|
|
44
|
+
--_fill: var(--kumiko-progress-fill-bg);
|
|
45
|
+
--_complete: var(--kumiko-progress-complete-bg, var(--_fill));
|
|
46
|
+
--_track-bg: var(--kumiko-progress-track-bg);
|
|
47
|
+
--_track-shadow: var(--kumiko-progress-track-shadow);
|
|
48
|
+
--_lift: var(--kumiko-progress-fill-lift);
|
|
49
|
+
--_highlight: var(--kumiko-progress-fill-highlight);
|
|
50
|
+
--_glow: var(--kumiko-progress-edge-glow);
|
|
51
|
+
--_inset: var(--kumiko-progress-inset);
|
|
52
|
+
--_sheen-display: block;
|
|
53
|
+
--_done-animation: kumiko-progress-complete var(--kumiko-progress-complete-duration)
|
|
54
|
+
ease-out var(--kumiko-move-duration) 1;
|
|
55
|
+
--_dir: 1;
|
|
56
|
+
--_towards: right;
|
|
57
|
+
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-wrap: wrap;
|
|
60
|
+
align-items: baseline;
|
|
61
|
+
gap: var(--kumiko-progress-gap) var(--kumiko-progress-label-gap);
|
|
62
|
+
inline-size: 100%;
|
|
63
|
+
font-size: var(--kumiko-progress-label-size);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-slot="progress"]:dir(rtl) {
|
|
67
|
+
--_dir: -1;
|
|
68
|
+
--_towards: left;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* Recessed track, floating fill, sheen and the finishing glow are on. A data-kumiko-progress list on a
|
|
73
|
+
* bar or on any ancestor of it turns them off (no-recessed, no-floating, no-sheen, no-glow, or flat for
|
|
74
|
+
* all four) and turns the lit fill on (lit).
|
|
75
|
+
*/
|
|
76
|
+
:is(
|
|
77
|
+
[data-kumiko-progress~="no-recessed"] [data-slot="progress"],
|
|
78
|
+
[data-slot="progress"][data-kumiko-progress~="no-recessed"],
|
|
79
|
+
[data-kumiko-progress~="flat"] [data-slot="progress"],
|
|
80
|
+
[data-slot="progress"][data-kumiko-progress~="flat"]
|
|
81
|
+
) {
|
|
82
|
+
--_track-bg: var(--kumiko-progress-flat-track-bg);
|
|
83
|
+
--_track-shadow: var(--kumiko-progress-flat-track-shadow);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:is(
|
|
87
|
+
[data-kumiko-progress~="no-floating"] [data-slot="progress"],
|
|
88
|
+
[data-slot="progress"][data-kumiko-progress~="no-floating"],
|
|
89
|
+
[data-kumiko-progress~="flat"] [data-slot="progress"],
|
|
90
|
+
[data-slot="progress"][data-kumiko-progress~="flat"]
|
|
91
|
+
) {
|
|
92
|
+
--_inset: 0px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:is(
|
|
96
|
+
[data-kumiko-progress~="no-sheen"] [data-slot="progress"],
|
|
97
|
+
[data-slot="progress"][data-kumiko-progress~="no-sheen"],
|
|
98
|
+
[data-kumiko-progress~="flat"] [data-slot="progress"],
|
|
99
|
+
[data-slot="progress"][data-kumiko-progress~="flat"]
|
|
100
|
+
) {
|
|
101
|
+
--_sheen-display: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:is(
|
|
105
|
+
[data-kumiko-progress~="no-glow"] [data-slot="progress"],
|
|
106
|
+
[data-slot="progress"][data-kumiko-progress~="no-glow"],
|
|
107
|
+
[data-kumiko-progress~="flat"] [data-slot="progress"],
|
|
108
|
+
[data-slot="progress"][data-kumiko-progress~="flat"]
|
|
109
|
+
) {
|
|
110
|
+
--_done-animation: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:is(
|
|
114
|
+
[data-kumiko-progress~="lit"] [data-slot="progress"],
|
|
115
|
+
[data-slot="progress"][data-kumiko-progress~="lit"]
|
|
116
|
+
) {
|
|
117
|
+
--_lift: var(--kumiko-progress-lit-lift);
|
|
118
|
+
--_highlight: var(--kumiko-progress-lit-highlight);
|
|
119
|
+
--_glow: var(--kumiko-progress-lit-glow);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[data-slot="progress"][data-size="sm"] {
|
|
123
|
+
--_height: var(--kumiko-progress-height-sm);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-slot="progress"][data-size="lg"] {
|
|
127
|
+
--_height: var(--kumiko-progress-height-lg);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
[data-slot="progress-label"] {
|
|
131
|
+
min-inline-size: 0;
|
|
132
|
+
flex: 1 1 0;
|
|
133
|
+
overflow-wrap: anywhere;
|
|
134
|
+
color: var(--kumiko-progress-label-color);
|
|
135
|
+
font-weight: var(--kumiko-progress-label-weight);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[data-slot="progress-value"] {
|
|
139
|
+
flex: none;
|
|
140
|
+
margin-inline-start: auto;
|
|
141
|
+
color: var(--kumiko-progress-value-color);
|
|
142
|
+
font-variant-numeric: tabular-nums;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
[data-slot="progress-track"] {
|
|
146
|
+
position: relative;
|
|
147
|
+
flex: 0 0 100%;
|
|
148
|
+
block-size: calc(var(--_height) + 2 * var(--_inset));
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
border-radius: var(--kumiko-progress-radius);
|
|
151
|
+
background: var(--_track-bg);
|
|
152
|
+
box-shadow: var(--_track-shadow);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Clips the fill to the room inside the track, so a floating fill never shows in the gap. */
|
|
156
|
+
[data-slot="progress-clip"] {
|
|
157
|
+
position: absolute;
|
|
158
|
+
inset: var(--_inset);
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
border-radius: var(--kumiko-progress-radius);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* The fill is always as wide as the track and slid along it, so a new value moves it with a transform. */
|
|
164
|
+
[data-slot="progress-indicator"] {
|
|
165
|
+
position: absolute;
|
|
166
|
+
inset-block: 0;
|
|
167
|
+
|
|
168
|
+
/* Only !important beats the inline width ui-sdk sets from the value. */
|
|
169
|
+
inline-size: 100% !important;
|
|
170
|
+
border-radius: var(--kumiko-progress-radius);
|
|
171
|
+
background-color: var(--_fill);
|
|
172
|
+
background-image:
|
|
173
|
+
linear-gradient(to bottom, var(--_highlight), transparent 60%),
|
|
174
|
+
linear-gradient(to var(--_towards), transparent, var(--_lift));
|
|
175
|
+
translate: calc((var(--progress-value, 100%) - 100%) * var(--_dir)) 0;
|
|
176
|
+
transition: translate var(--kumiko-move-duration) var(--kumiko-move-ease);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
[data-slot="progress-indicator"][data-complete] {
|
|
180
|
+
background-color: var(--_complete);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* A soft glow at the leading end of the fill, which is its inline end. It moves with the fill. */
|
|
184
|
+
[data-slot="progress-glow"] {
|
|
185
|
+
position: absolute;
|
|
186
|
+
inset-block: 0;
|
|
187
|
+
inset-inline-end: 0;
|
|
188
|
+
inline-size: var(--kumiko-progress-edge-glow-size);
|
|
189
|
+
border-radius: inherit;
|
|
190
|
+
background: radial-gradient(
|
|
191
|
+
ellipse 100% 100% at calc(50% + 50% * var(--_dir)) 50%,
|
|
192
|
+
var(--_glow),
|
|
193
|
+
transparent
|
|
194
|
+
);
|
|
195
|
+
pointer-events: none;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* A faint sheen drifts over the part of the fill that shows. */
|
|
199
|
+
[data-slot="progress-sheen"] {
|
|
200
|
+
position: absolute;
|
|
201
|
+
inset-block: 0;
|
|
202
|
+
inset-inline-end: 0;
|
|
203
|
+
display: var(--_sheen-display);
|
|
204
|
+
inline-size: var(--progress-value, 100%);
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
border-radius: inherit;
|
|
207
|
+
opacity: var(--kumiko-progress-sheen-opacity);
|
|
208
|
+
pointer-events: none;
|
|
209
|
+
transition: inline-size var(--kumiko-move-duration) var(--kumiko-move-ease);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
[data-slot="progress-sheen"]::before {
|
|
213
|
+
content: "";
|
|
214
|
+
position: absolute;
|
|
215
|
+
inset-block: 0;
|
|
216
|
+
inset-inline-start: 0;
|
|
217
|
+
inline-size: 40%;
|
|
218
|
+
background: linear-gradient(
|
|
219
|
+
to right,
|
|
220
|
+
transparent,
|
|
221
|
+
var(--kumiko-progress-sheen-color),
|
|
222
|
+
transparent
|
|
223
|
+
);
|
|
224
|
+
animation: kumiko-progress-sheen var(--kumiko-progress-sheen-duration) ease-in-out infinite;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
[data-slot="progress-indicator"][data-indeterminate] > [data-slot="progress-glow"],
|
|
228
|
+
[data-slot="progress-indicator"][data-indeterminate] > [data-slot="progress-sheen"],
|
|
229
|
+
[data-slot="progress-indicator"][data-complete] > [data-slot="progress-sheen"] {
|
|
230
|
+
display: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/* Reaching the end glows and settles once. The bar sets data-finished then, never on first render. */
|
|
234
|
+
[data-slot="progress"][data-finished] [data-slot="progress-track"] {
|
|
235
|
+
animation: var(--_done-animation);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@keyframes kumiko-progress-sheen {
|
|
239
|
+
0% {
|
|
240
|
+
translate: calc(-100% * var(--_dir)) 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
60%,
|
|
244
|
+
100% {
|
|
245
|
+
translate: calc(250% * var(--_dir)) 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@keyframes kumiko-progress-complete {
|
|
250
|
+
0% {
|
|
251
|
+
scale: 1;
|
|
252
|
+
filter: drop-shadow(0 0 0 transparent);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
35% {
|
|
256
|
+
scale: 1.015 1.25;
|
|
257
|
+
filter: drop-shadow(
|
|
258
|
+
0 0 0.5rem
|
|
259
|
+
var(
|
|
260
|
+
--kumiko-progress-complete-glow,
|
|
261
|
+
color-mix(in oklab, var(--_fill) 70%, transparent)
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
100% {
|
|
267
|
+
scale: 1;
|
|
268
|
+
filter: drop-shadow(0 0 0 transparent);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
[data-slot="progress-indicator"][data-indeterminate] {
|
|
273
|
+
translate: none;
|
|
274
|
+
transition: none;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
[data-indeterminate-style="shimmer"] [data-slot="progress-indicator"][data-indeterminate] {
|
|
278
|
+
inline-size: calc(100% * var(--kumiko-progress-shimmer-size)) !important;
|
|
279
|
+
background: linear-gradient(
|
|
280
|
+
to right,
|
|
281
|
+
transparent,
|
|
282
|
+
var(--_fill) 30%,
|
|
283
|
+
var(--_fill) 70%,
|
|
284
|
+
transparent
|
|
285
|
+
);
|
|
286
|
+
animation: kumiko-progress-shimmer var(--kumiko-progress-indeterminate-duration)
|
|
287
|
+
var(--kumiko-progress-indeterminate-ease) infinite;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
[data-indeterminate-style="bounce"] [data-slot="progress-indicator"][data-indeterminate] {
|
|
291
|
+
inline-size: calc(100% * var(--kumiko-progress-bounce-size)) !important;
|
|
292
|
+
background: var(--_fill);
|
|
293
|
+
animation: kumiko-progress-bounce var(--kumiko-progress-indeterminate-duration)
|
|
294
|
+
var(--kumiko-progress-indeterminate-ease) infinite alternate;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
[data-indeterminate-style="pulse"] [data-slot="progress-indicator"][data-indeterminate] {
|
|
298
|
+
animation: kumiko-progress-fade var(--kumiko-progress-pulse-duration)
|
|
299
|
+
var(--kumiko-progress-indeterminate-ease) infinite alternate;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@keyframes kumiko-progress-shimmer {
|
|
303
|
+
from {
|
|
304
|
+
translate: calc(-100% * var(--_dir)) 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
to {
|
|
308
|
+
translate: calc(100% / var(--kumiko-progress-shimmer-size) * var(--_dir)) 0;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
@keyframes kumiko-progress-bounce {
|
|
313
|
+
from {
|
|
314
|
+
translate: 0 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
to {
|
|
318
|
+
translate: calc((1 / var(--kumiko-progress-bounce-size) - 1) * 100% * var(--_dir)) 0;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
@keyframes kumiko-progress-fade {
|
|
323
|
+
from {
|
|
324
|
+
opacity: var(--kumiko-progress-pulse-min);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
to {
|
|
328
|
+
opacity: 1;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* Reduced motion and the still preset never slide: the whole fill fades slowly instead. */
|
|
333
|
+
@media (prefers-reduced-motion: reduce) {
|
|
334
|
+
[data-slot="progress"] [data-slot="progress-sheen"] {
|
|
335
|
+
display: none;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
[data-slot="progress"][data-finished] [data-slot="progress-track"] {
|
|
339
|
+
animation: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
[data-indeterminate-style] [data-slot="progress-indicator"][data-indeterminate] {
|
|
343
|
+
inline-size: 100% !important;
|
|
344
|
+
background: var(--_fill);
|
|
345
|
+
animation: kumiko-progress-fade var(--kumiko-progress-reduced-duration)
|
|
346
|
+
var(--kumiko-progress-indeterminate-ease) infinite alternate;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
[data-kumiko-motion="still"] [data-slot="progress"] [data-slot="progress-sheen"] {
|
|
351
|
+
display: none;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
[data-kumiko-motion="still"]
|
|
355
|
+
[data-slot="progress"][data-finished]
|
|
356
|
+
[data-slot="progress-track"] {
|
|
357
|
+
animation: none;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
[data-kumiko-motion="still"]
|
|
361
|
+
[data-indeterminate-style]
|
|
362
|
+
[data-slot="progress-indicator"][data-indeterminate] {
|
|
363
|
+
inline-size: 100% !important;
|
|
364
|
+
background: var(--_fill);
|
|
365
|
+
animation: kumiko-progress-fade var(--kumiko-progress-reduced-duration)
|
|
366
|
+
var(--kumiko-progress-indeterminate-ease) infinite alternate;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
@media (forced-colors: active) {
|
|
370
|
+
[data-slot="progress"] {
|
|
371
|
+
--_fill: Highlight;
|
|
372
|
+
--_complete: Highlight;
|
|
373
|
+
--_lift: transparent;
|
|
374
|
+
--_highlight: transparent;
|
|
375
|
+
--_glow: transparent;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
[data-slot="progress-track"] {
|
|
379
|
+
outline: 1px solid ButtonText;
|
|
380
|
+
outline-offset: -1px;
|
|
381
|
+
background: Canvas;
|
|
382
|
+
box-shadow: none;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
[data-slot="progress-label"],
|
|
386
|
+
[data-slot="progress-value"] {
|
|
387
|
+
color: CanvasText;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Progress as SdkProgress } from "@ui-sdk/react/progress";
|
|
2
|
+
type SdkProgressProps = Parameters<typeof SdkProgress>[0];
|
|
3
|
+
/** How an unknown amount of progress looks: a soft band sliding across, a segment bouncing, or the fill fading. */
|
|
4
|
+
export type IndeterminateStyle = "shimmer" | "bounce" | "pulse";
|
|
5
|
+
export type ProgressProps = Omit<SdkProgressProps, "children"> & {
|
|
6
|
+
/** The height of the bar. @defaultValue "md" */
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
/** A visible name, shown above the bar at its start. It also names the bar for screen readers. */
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
/** Shows the formatted value above the bar at its end. */
|
|
11
|
+
showValue?: boolean;
|
|
12
|
+
/** How the bar looks while `value` is null. @defaultValue "shimmer" */
|
|
13
|
+
indeterminate?: IndeterminateStyle;
|
|
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
|
+
/** A faint sheen drifts over a filling bar. @defaultValue true */
|
|
19
|
+
sheen?: boolean;
|
|
20
|
+
/** Reaching the end glows and settles once. @defaultValue true */
|
|
21
|
+
completeGlow?: boolean;
|
|
22
|
+
/** The fill is lighter toward its leading end, with a highlight along its top and a glowing end. @defaultValue false */
|
|
23
|
+
lit?: boolean;
|
|
24
|
+
/** Counts the shown value up or down while the fill glides. Screen readers still get the real value. @defaultValue true */
|
|
25
|
+
countUp?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The ui-sdk progress bar with Kumiko's look and motion. The fill glides to a new value with the move
|
|
29
|
+
* tokens, `label` and `showValue` add a row above the bar, and a null value shows an indeterminate style.
|
|
30
|
+
* The recessed track, floating fill, sheen, finishing glow and counting value are on by default and each
|
|
31
|
+
* has a prop to turn it off; `lit` turns the lit fill on. A `data-kumiko-progress` list on an ancestor
|
|
32
|
+
* (`no-recessed`, `no-floating`, `no-sheen`, `no-glow`, `flat` for all four, `lit`) does the same for
|
|
33
|
+
* every bar inside it. A bar without a `label` needs an `aria-label`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function Progress({ size, label, showValue, indeterminate, recessed, floating, sheen, completeGlow, lit, countUp, ...props }: ProgressProps): React.JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Progress as SdkProgress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue } from "@ui-sdk/react/progress";
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
/** The text ui-sdk would show for a value, for the numbers in between while counting. */
|
|
5
|
+
function formatAt(value, { min = 0, max = 100, format, locale }) {
|
|
6
|
+
if (typeof format === "function") {
|
|
7
|
+
return format(value);
|
|
8
|
+
}
|
|
9
|
+
if (format && format.style !== "percent") {
|
|
10
|
+
return new Intl.NumberFormat(locale, format).format(value);
|
|
11
|
+
}
|
|
12
|
+
const span = max - min;
|
|
13
|
+
const share = span === 0 ? 0 : (Math.min(max, Math.max(min, value)) - min) / span;
|
|
14
|
+
return new Intl.NumberFormat(locale, format ?? { style: "percent" }).format(share);
|
|
15
|
+
}
|
|
16
|
+
/** The move duration, in milliseconds, that the tokens give an element. */
|
|
17
|
+
function moveDuration(element) {
|
|
18
|
+
const raw = getComputedStyle(element).getPropertyValue("--kumiko-move-duration").trim();
|
|
19
|
+
const amount = Number(raw.replace(/m?s$/u, ""));
|
|
20
|
+
if (Number.isNaN(amount)) {
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
return raw.endsWith("ms") ? amount : amount * 1000;
|
|
24
|
+
}
|
|
25
|
+
/** Walks a number to its target over the move duration, and says so while it is on the way. */
|
|
26
|
+
function useCount(target, enabled, element) {
|
|
27
|
+
const [shown, setShown] = useState(target);
|
|
28
|
+
const [counting, setCounting] = useState(false);
|
|
29
|
+
const current = useRef(target);
|
|
30
|
+
useLayoutEffect(() => {
|
|
31
|
+
const from = current.current;
|
|
32
|
+
const duration = element.current ? moveDuration(element.current) : 0;
|
|
33
|
+
if (!enabled || from === null || target === null || duration <= 0 || from === target) {
|
|
34
|
+
current.current = target;
|
|
35
|
+
setCounting(false);
|
|
36
|
+
setShown(target);
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const start = performance.now();
|
|
40
|
+
let frame = 0;
|
|
41
|
+
const step = (now) => {
|
|
42
|
+
const done = Math.min(1, Math.max(0, (now - start) / duration));
|
|
43
|
+
const value = done >= 1 ? target : from + (target - from) * (1 - (1 - done) ** 3);
|
|
44
|
+
current.current = value;
|
|
45
|
+
setShown(value);
|
|
46
|
+
if (done < 1) {
|
|
47
|
+
frame = requestAnimationFrame(step);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
setCounting(false);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
setCounting(true);
|
|
54
|
+
setShown(from);
|
|
55
|
+
frame = requestAnimationFrame(step);
|
|
56
|
+
return () => cancelAnimationFrame(frame);
|
|
57
|
+
}, [target, enabled, element]);
|
|
58
|
+
return { shown, counting };
|
|
59
|
+
}
|
|
60
|
+
function CountedValue({ state, settings }) {
|
|
61
|
+
const element = useRef(null);
|
|
62
|
+
const { shown, counting } = useCount(state.value, true, element);
|
|
63
|
+
return (_jsx("span", { ref: element, children: counting && shown !== null ? formatAt(shown, settings) : state.text }));
|
|
64
|
+
}
|
|
65
|
+
/** True once a value that was short of the end reaches it, so a bar that first shows full does not celebrate. */
|
|
66
|
+
function useFinished(value, max) {
|
|
67
|
+
const complete = typeof value === "number" && value >= max;
|
|
68
|
+
const [finished, setFinished] = useState(false);
|
|
69
|
+
const was = useRef(complete);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
setFinished(complete && !was.current ? true : complete && finished);
|
|
72
|
+
was.current = complete;
|
|
73
|
+
}, [complete, finished]);
|
|
74
|
+
return finished;
|
|
75
|
+
}
|
|
76
|
+
/** The data-kumiko-progress list for the looks a bar turned off, and the lit fill when it is on. */
|
|
77
|
+
function looks(on) {
|
|
78
|
+
const list = [
|
|
79
|
+
on.recessed ? "" : "no-recessed",
|
|
80
|
+
on.floating ? "" : "no-floating",
|
|
81
|
+
on.sheen ? "" : "no-sheen",
|
|
82
|
+
on.completeGlow ? "" : "no-glow",
|
|
83
|
+
on.lit ? "lit" : ""
|
|
84
|
+
].filter(Boolean);
|
|
85
|
+
return list.length > 0 ? list.join(" ") : undefined;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The ui-sdk progress bar with Kumiko's look and motion. The fill glides to a new value with the move
|
|
89
|
+
* tokens, `label` and `showValue` add a row above the bar, and a null value shows an indeterminate style.
|
|
90
|
+
* The recessed track, floating fill, sheen, finishing glow and counting value are on by default and each
|
|
91
|
+
* has a prop to turn it off; `lit` turns the lit fill on. A `data-kumiko-progress` list on an ancestor
|
|
92
|
+
* (`no-recessed`, `no-floating`, `no-sheen`, `no-glow`, `flat` for all four, `lit`) does the same for
|
|
93
|
+
* every bar inside it. A bar without a `label` needs an `aria-label`.
|
|
94
|
+
*/
|
|
95
|
+
export function Progress({ size = "md", label, showValue = false, indeterminate = "shimmer", recessed = true, floating = true, sheen = true, completeGlow = true, lit = false, countUp = true, ...props }) {
|
|
96
|
+
const named = label !== undefined && label !== null && label !== false;
|
|
97
|
+
const finished = useFinished(props.value, props.max ?? 100);
|
|
98
|
+
const settings = {
|
|
99
|
+
min: props.min,
|
|
100
|
+
max: props.max,
|
|
101
|
+
format: props.format,
|
|
102
|
+
locale: props.locale
|
|
103
|
+
};
|
|
104
|
+
return (_jsxs(SdkProgress, { "data-size": size, "data-indeterminate-style": indeterminate, "data-kumiko-progress": looks({ recessed, floating, sheen, completeGlow, lit }), "data-finished": finished ? "" : undefined, ...props, children: [named ? _jsx(ProgressLabel, { children: label }) : null, showValue ? (_jsx(ProgressValue, { children: countUp
|
|
105
|
+
? (state) => (_jsx(CountedValue, { state: state, settings: settings }))
|
|
106
|
+
: undefined })) : null, _jsx(ProgressTrack, { children: _jsx("div", { "data-slot": "progress-clip", children: _jsxs(ProgressIndicator, { children: [_jsx("span", { "data-slot": "progress-glow", "aria-hidden": "true" }), _jsx("span", { "data-slot": "progress-sheen", "aria-hidden": "true" })] }) }) })] }));
|
|
107
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Select, SelectContent, SelectItem, SelectTrigger, type SelectContentProps, type SelectItemProps, type SelectTriggerProps } from "./select";
|
|
2
|
+
export type { SelectSearch, SelectSearchOptions } from "./select-search";
|
|
3
|
+
export { createSelectController, SelectArrow, SelectClear, SelectEmpty, SelectGroup, SelectGroupLabel, SelectInput, SelectItemIcon, SelectItemIndicator, SelectItems, SelectItemText, SelectLabel, SelectList, SelectSelectAll, SelectSeparator, SelectStatus, SelectValue, SelectValueIcon, type ListAnnouncement, type ListData, type ListFilter, type ListGroup, type ListHighlightDetails, type ListItem, type ListSeparator, type MatchSegment, type SelectApi, type SelectArrowState, type SelectChangeOptions, type SelectClearProps, type SelectClearState, type SelectContentState, type SelectController, type SelectDismissReason, type SelectEmptyState, type SelectInputState, type SelectItemIconProps, type SelectItemIconState, type SelectItemIndicatorProps, type SelectItemIndicatorState, type SelectItemState, type SelectItemTextState, type SelectOpenChangeReason, type SelectOptions, type SelectPrimitive, type SelectProps, type SelectQueryChangeReason, type SelectSelectAllState, type SelectStatusState, type SelectTriggerState, type SelectValueData, type SelectValueChangeReason, type SelectValueProps, type SelectValueState } from "@ui-sdk/react/select";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Select, SelectContent, SelectItem, SelectTrigger } from "./select";
|
|
2
|
+
export { createSelectController, SelectArrow, SelectClear, SelectEmpty, SelectGroup, SelectGroupLabel, SelectInput, SelectItemIcon, SelectItemIndicator, SelectItems, SelectItemText, SelectLabel, SelectList, SelectSelectAll, SelectSeparator, SelectStatus, SelectValue, SelectValueIcon } from "@ui-sdk/react/select";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ListData } from "@ui-sdk/react/select";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
/** What the trigger can show: every option label and the placeholder that Select could find, or none when it found nothing. */
|
|
4
|
+
export declare const LabelsContext: import("react").Context<readonly string[]>;
|
|
5
|
+
/** Every option label that a select's `items` and children give, and its placeholder. */
|
|
6
|
+
export declare function labelsOf(items: ListData<unknown> | undefined, children: ReactNode, placeholder: string | undefined): string[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SelectItemIcon, SelectItemIndicator } from "@ui-sdk/react/select";
|
|
2
|
+
import { Children, createContext, isValidElement } from "react";
|
|
3
|
+
/** What the trigger can show: every option label and the placeholder that Select could find, or none when it found nothing. */
|
|
4
|
+
export const LabelsContext = createContext([]);
|
|
5
|
+
const decorations = new Set([SelectItemIndicator, SelectItemIcon]);
|
|
6
|
+
function textOf(node) {
|
|
7
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
8
|
+
return String(node);
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(node)) {
|
|
11
|
+
return node.map((part) => textOf(part)).join("");
|
|
12
|
+
}
|
|
13
|
+
if (isValidElement(node)) {
|
|
14
|
+
const hidden = decorations.has(node.type) || node.props["aria-hidden"] !== undefined;
|
|
15
|
+
return hidden ? "" : textOf(node.props.children);
|
|
16
|
+
}
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
/** The labels of the items written as elements in a tree, like ui-sdk's own search for the chosen one: an element with a `value` and a `label` or text. */
|
|
20
|
+
function labelsInTree(tree, found) {
|
|
21
|
+
for (const node of Children.toArray(tree)) {
|
|
22
|
+
if (!isValidElement(node)) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const { value, label, children } = node.props;
|
|
26
|
+
if (value !== undefined && typeof node.type !== "string") {
|
|
27
|
+
const shown = typeof label === "string" ? label : textOf(children);
|
|
28
|
+
const tidy = shown.replaceAll(/\s+/gu, " ").trim();
|
|
29
|
+
if (tidy !== "") {
|
|
30
|
+
found.push(tidy);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (typeof children !== "function") {
|
|
34
|
+
labelsInTree(children, found);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function labelsInData(data, found) {
|
|
39
|
+
for (const entry of data) {
|
|
40
|
+
if (typeof entry === "string") {
|
|
41
|
+
found.push(entry);
|
|
42
|
+
}
|
|
43
|
+
else if (typeof entry === "object" && "type" in entry) {
|
|
44
|
+
if (entry.type === "group") {
|
|
45
|
+
labelsInData(entry.items, found);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (typeof entry === "object" && "label" in entry) {
|
|
49
|
+
found.push(entry.label);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Every option label that a select's `items` and children give, and its placeholder. */
|
|
54
|
+
export function labelsOf(items, children, placeholder) {
|
|
55
|
+
const found = [];
|
|
56
|
+
if (items) {
|
|
57
|
+
labelsInData(items, found);
|
|
58
|
+
}
|
|
59
|
+
labelsInTree(children, found);
|
|
60
|
+
if (found.length > 0 && placeholder) {
|
|
61
|
+
found.push(placeholder);
|
|
62
|
+
}
|
|
63
|
+
return [...new Set(found)];
|
|
64
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SelectContentState } from "@ui-sdk/react/select";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
/** Whether the list around an item has a search field, so its text can show what matched. */
|
|
4
|
+
export declare const SearchContext: import("react").Context<boolean>;
|
|
5
|
+
export interface SelectSearchOptions {
|
|
6
|
+
/** The field's accessible name. @defaultValue "Search" */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** What the empty field shows. @defaultValue "Search…" */
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** What shows while nothing matches. @defaultValue "No matches" */
|
|
11
|
+
empty?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export type SelectSearch = boolean | SelectSearchOptions;
|
|
14
|
+
/** A search field, a message for no matches, and the items in a list that scrolls under the field. */
|
|
15
|
+
export declare function SearchedList({ search, children }: {
|
|
16
|
+
search: SelectSearchOptions;
|
|
17
|
+
children: ReactNode | ((state: SelectContentState) => ReactNode);
|
|
18
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SelectEmpty, SelectInput, SelectList } from "@ui-sdk/react/select";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
/** Whether the list around an item has a search field, so its text can show what matched. */
|
|
5
|
+
export const SearchContext = createContext(false);
|
|
6
|
+
/** A search field, a message for no matches, and the items in a list that scrolls under the field. */
|
|
7
|
+
export function SearchedList({ search, children }) {
|
|
8
|
+
const { label = "Search", placeholder = "Search…", empty = "No matches" } = search;
|
|
9
|
+
return (_jsxs(SearchContext.Provider, { value: true, children: [_jsx(SelectInput, { "aria-label": label, placeholder: placeholder }), _jsx(SelectEmpty, { children: empty }), _jsx(SelectList, { children: children })] }));
|
|
10
|
+
}
|