@kanso-labs/kanso-ui 0.45.34 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/index.js +13 -9
- package/dist/button/index.js.map +1 -1
- package/dist/calendar/styles.js +12 -7
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/styles.js +1 -0
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/styles.js +1 -1
- package/dist/collection/styles.js.map +1 -1
- package/dist/components/breadcrumbs/index.js +4 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +16 -3
- package/dist/components/button-group/index.js +53 -86
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +3 -3
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.js +5 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/carousel/index.js +162 -105
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +38 -15
- package/dist/components/chip/index.js +104 -8
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +5 -3
- package/dist/components/color-area/index.js +5 -3
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-picker/index.js +6 -3
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.js +24 -9
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +11 -3
- package/dist/components/combo-box/index.js +66 -62
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/copy-field/index.js +1 -0
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +22 -3
- package/dist/components/date-picker/index.js +234 -45
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +3 -1
- package/dist/components/date-range-picker/index.js +6 -4
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +4 -3
- package/dist/components/disclosure/index.js +159 -101
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +3 -1
- package/dist/components/fab/index.js +25 -12
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/fab-menu/index.js +1 -1
- package/dist/components/fab-menu/index.js.map +1 -1
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-rail/index.js +4 -4
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/navigation-tree/index.js +16 -13
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/popover/index.js +35 -33
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/range-calendar/index.js +41 -7
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +3 -2
- package/dist/components/segmented-button/index.js +46 -95
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.js +5 -2
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/slider/index.js +42 -10
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/time-picker/index.js +2 -0
- package/dist/components/time-picker/index.js.map +1 -1
- package/dist/components/token-field/index.js +89 -66
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +4 -0
- package/dist/components/toolbar/index.js +16 -5
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tree/index.js +1 -1
- package/dist/components/tree/index.js.map +1 -1
- package/dist/fab/styles.js +12 -0
- package/dist/fab/styles.js.map +1 -1
- package/dist/field/styles.js +2 -2
- package/dist/field/styles.js.map +1 -1
- package/dist/hooks/useDockedMonths.js +36 -0
- package/dist/hooks/useDockedMonths.js.map +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +34 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/navigation/index.js +5 -5
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js +4 -0
- package/dist/navigation/styles.js.map +1 -1
- package/dist/row/context.js +6 -0
- package/dist/row/context.js.map +1 -0
- package/dist/row/index.js +77 -66
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +15 -0
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/index.js +2 -1
- package/dist/segments/index.js.map +1 -1
- package/dist/segments/styles.js +4 -0
- package/dist/segments/styles.js.map +1 -1
- package/dist/styles/chequer.js +1 -0
- package/dist/styles/chequer.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles.css +158 -35
- package/dist/toggle-group/index.js +133 -0
- package/dist/toggle-group/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { mergeStyles } from "../../styles/merge.js";
|
|
|
8
8
|
import { radii } from "../../tokens/design.tokens.stylex.js";
|
|
9
9
|
import IconButton from "../icon-button/index.js";
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
|
-
import { Children, createContext, isValidElement, useContext, useLayoutEffect, useRef, useState } from "react";
|
|
11
|
+
import { Children, createContext, isValidElement, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
// src/components/carousel/index.tsx
|
|
14
14
|
/** The page's 16dp at a carousel's ends. */
|
|
@@ -106,12 +106,16 @@ function along(direction, { end, masked, scrolled, step }) {
|
|
|
106
106
|
* which is the element a layout positions.
|
|
107
107
|
*/
|
|
108
108
|
function Carousel(t0) {
|
|
109
|
-
const $ = c(
|
|
109
|
+
const $ = c(46);
|
|
110
110
|
const { children, itemSize: t1, label, layout: t2, nextLabel, previousLabel, ref, ...props$2 } = t0;
|
|
111
111
|
const itemSize = t1 === void 0 ? DEFAULT_ITEM_SIZE : t1;
|
|
112
112
|
const layout = t2 === void 0 ? "multi-browse" : t2;
|
|
113
113
|
const messages = useMessages();
|
|
114
114
|
const scrollerRef = useRef(null);
|
|
115
|
+
const previousRef = useRef(null);
|
|
116
|
+
const nextRef = useRef(null);
|
|
117
|
+
const droppedRef = useRef(null);
|
|
118
|
+
const controlsRef = useRef(null);
|
|
115
119
|
const [width, setWidth] = useState(0);
|
|
116
120
|
const [scrolled, setScrolled] = useState(0);
|
|
117
121
|
const items = Children.toArray(children).filter(isValidElement);
|
|
@@ -122,6 +126,8 @@ function Carousel(t0) {
|
|
|
122
126
|
const step = arrangement.large + 8;
|
|
123
127
|
const end = masked ? arrangement.steps * step : Math.max(count * step - 8 + 32 - width, 0);
|
|
124
128
|
const lastLarge = arrangement.largeCount - 1;
|
|
129
|
+
const atStart = scrolled <= .5;
|
|
130
|
+
const atEnd = scrolled >= end - .5;
|
|
125
131
|
const position = masked && step > 0 ? scrolled / step : 0;
|
|
126
132
|
const drawn = masked ? placements(layout, arrangement, room, PADDING, count, position) : [];
|
|
127
133
|
let t3;
|
|
@@ -158,8 +164,52 @@ function Carousel(t0) {
|
|
|
158
164
|
}
|
|
159
165
|
useLayoutEffect(t4, t5);
|
|
160
166
|
let t6;
|
|
161
|
-
|
|
167
|
+
let t7;
|
|
168
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
162
169
|
t6 = () => {
|
|
170
|
+
const controls = controlsRef.current;
|
|
171
|
+
if (controls === null) return;
|
|
172
|
+
const noteDropped = (event) => {
|
|
173
|
+
const { relatedTarget, target } = event;
|
|
174
|
+
droppedRef.current = relatedTarget === null && target instanceof Element && target.hasAttribute("disabled") ? target : null;
|
|
175
|
+
};
|
|
176
|
+
controls.addEventListener("focusout", noteDropped);
|
|
177
|
+
return () => {
|
|
178
|
+
controls.removeEventListener("focusout", noteDropped);
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
t7 = [];
|
|
182
|
+
$[4] = t6;
|
|
183
|
+
$[5] = t7;
|
|
184
|
+
} else {
|
|
185
|
+
t6 = $[4];
|
|
186
|
+
t7 = $[5];
|
|
187
|
+
}
|
|
188
|
+
useEffect(t6, t7);
|
|
189
|
+
let t8;
|
|
190
|
+
let t9;
|
|
191
|
+
if ($[6] !== atEnd || $[7] !== atStart) {
|
|
192
|
+
t8 = () => {
|
|
193
|
+
const dropped = droppedRef.current;
|
|
194
|
+
droppedRef.current = null;
|
|
195
|
+
const previousButton = previousRef.current;
|
|
196
|
+
const nextButton = nextRef.current;
|
|
197
|
+
if (atStart && previousButton !== null && holds(previousButton, dropped)) handFocus(nextButton);
|
|
198
|
+
if (atEnd && nextButton !== null && holds(nextButton, dropped)) handFocus(previousButton);
|
|
199
|
+
};
|
|
200
|
+
t9 = [atEnd, atStart];
|
|
201
|
+
$[6] = atEnd;
|
|
202
|
+
$[7] = atStart;
|
|
203
|
+
$[8] = t8;
|
|
204
|
+
$[9] = t9;
|
|
205
|
+
} else {
|
|
206
|
+
t8 = $[8];
|
|
207
|
+
t9 = $[9];
|
|
208
|
+
}
|
|
209
|
+
useLayoutEffect(t8, t9);
|
|
210
|
+
let t10;
|
|
211
|
+
if ($[10] !== end || $[11] !== lastLarge || $[12] !== masked || $[13] !== scrolled || $[14] !== step) {
|
|
212
|
+
t10 = () => {
|
|
163
213
|
const geometry = {
|
|
164
214
|
end,
|
|
165
215
|
lastLarge,
|
|
@@ -169,17 +219,17 @@ function Carousel(t0) {
|
|
|
169
219
|
};
|
|
170
220
|
scrollAlong(scrollerRef.current, along(-1, geometry));
|
|
171
221
|
};
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
} else
|
|
179
|
-
const previous =
|
|
180
|
-
let
|
|
181
|
-
if ($[
|
|
182
|
-
|
|
222
|
+
$[10] = end;
|
|
223
|
+
$[11] = lastLarge;
|
|
224
|
+
$[12] = masked;
|
|
225
|
+
$[13] = scrolled;
|
|
226
|
+
$[14] = step;
|
|
227
|
+
$[15] = t10;
|
|
228
|
+
} else t10 = $[15];
|
|
229
|
+
const previous = t10;
|
|
230
|
+
let t11;
|
|
231
|
+
if ($[16] !== end || $[17] !== lastLarge || $[18] !== masked || $[19] !== scrolled || $[20] !== step) {
|
|
232
|
+
t11 = () => {
|
|
183
233
|
const geometry_0 = {
|
|
184
234
|
end,
|
|
185
235
|
lastLarge,
|
|
@@ -189,20 +239,20 @@ function Carousel(t0) {
|
|
|
189
239
|
};
|
|
190
240
|
scrollAlong(scrollerRef.current, along(1, geometry_0));
|
|
191
241
|
};
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
} else
|
|
199
|
-
const next =
|
|
200
|
-
let
|
|
201
|
-
if ($[
|
|
202
|
-
|
|
203
|
-
const { target } =
|
|
204
|
-
if (!masked || step <= 0 || !(
|
|
205
|
-
const index = Array.from(
|
|
242
|
+
$[16] = end;
|
|
243
|
+
$[17] = lastLarge;
|
|
244
|
+
$[18] = masked;
|
|
245
|
+
$[19] = scrolled;
|
|
246
|
+
$[20] = step;
|
|
247
|
+
$[21] = t11;
|
|
248
|
+
} else t11 = $[21];
|
|
249
|
+
const next = t11;
|
|
250
|
+
let t12;
|
|
251
|
+
if ($[22] !== end || $[23] !== lastLarge || $[24] !== masked || $[25] !== scrolled || $[26] !== step) {
|
|
252
|
+
t12 = (event_0) => {
|
|
253
|
+
const { target: target_0 } = event_0;
|
|
254
|
+
if (!masked || step <= 0 || !(target_0 instanceof Node)) return;
|
|
255
|
+
const index = Array.from(event_0.currentTarget.children).findIndex((child) => child.contains(target_0));
|
|
206
256
|
if (index < 0) return;
|
|
207
257
|
const offset = Math.min(restRevealing(index, {
|
|
208
258
|
end,
|
|
@@ -213,14 +263,14 @@ function Carousel(t0) {
|
|
|
213
263
|
}) * step, end);
|
|
214
264
|
scrollAlong(scrollerRef.current, offset);
|
|
215
265
|
};
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
} else
|
|
223
|
-
const reveal =
|
|
266
|
+
$[22] = end;
|
|
267
|
+
$[23] = lastLarge;
|
|
268
|
+
$[24] = masked;
|
|
269
|
+
$[25] = scrolled;
|
|
270
|
+
$[26] = step;
|
|
271
|
+
$[27] = t12;
|
|
272
|
+
} else t12 = $[27];
|
|
273
|
+
const reveal = t12;
|
|
224
274
|
const slots = items.map((_, index_0) => ({
|
|
225
275
|
count,
|
|
226
276
|
index: index_0,
|
|
@@ -228,97 +278,98 @@ function Carousel(t0) {
|
|
|
228
278
|
layout,
|
|
229
279
|
placement: drawn[index_0]
|
|
230
280
|
}));
|
|
231
|
-
const
|
|
232
|
-
const
|
|
233
|
-
let
|
|
234
|
-
if ($[
|
|
235
|
-
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
} else
|
|
239
|
-
let
|
|
240
|
-
if ($[
|
|
241
|
-
|
|
281
|
+
const t13 = messages.carousel;
|
|
282
|
+
const t14 = mergeStyles({ className: "x9f619 x78zum5 xdt5ytf x126z3so xeuugli" }, props$2);
|
|
283
|
+
let t15;
|
|
284
|
+
if ($[28] !== masked) {
|
|
285
|
+
t15 = props(styles.scroller, focus.ring, !masked && styles.scrollerUncontained);
|
|
286
|
+
$[28] = masked;
|
|
287
|
+
$[29] = t15;
|
|
288
|
+
} else t15 = $[29];
|
|
289
|
+
let t16;
|
|
290
|
+
if ($[30] !== masked) {
|
|
291
|
+
t16 = masked ? /* @__PURE__ */ jsx("div", {
|
|
242
292
|
"aria-hidden": "true",
|
|
243
293
|
className: "xjm9jq1 x1i1rx1s x13vifvy x1o0tod x47corl x10l6tqk x1bhewko"
|
|
244
294
|
}) : null;
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
} else
|
|
248
|
-
let
|
|
249
|
-
if ($[
|
|
250
|
-
|
|
295
|
+
$[30] = masked;
|
|
296
|
+
$[31] = t16;
|
|
297
|
+
} else t16 = $[31];
|
|
298
|
+
let t17;
|
|
299
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
300
|
+
t17 = {
|
|
251
301
|
0: { className: "x9f619 x78zum5 x2lah0s x126z3so x1cmllll x790zyz" },
|
|
252
302
|
1: { className: "x9f619 x78zum5 x2lah0s x126z3so x1cmllll x790zyz xh8yej3 x1o0tod x7giv3 x7wzq59" }
|
|
253
303
|
};
|
|
254
|
-
$[
|
|
255
|
-
} else
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
} else t16 = $[27];
|
|
263
|
-
let t17;
|
|
264
|
-
if ($[28] !== previous || $[29] !== t14 || $[30] !== t15) {
|
|
265
|
-
t17 = /* @__PURE__ */ jsx(IconButton, {
|
|
266
|
-
"aria-label": t14,
|
|
267
|
-
isDisabled: t15,
|
|
268
|
-
onPress: previous,
|
|
269
|
-
children: t16
|
|
270
|
-
});
|
|
271
|
-
$[28] = previous;
|
|
272
|
-
$[29] = t14;
|
|
273
|
-
$[30] = t15;
|
|
274
|
-
$[31] = t17;
|
|
275
|
-
} else t17 = $[31];
|
|
276
|
-
const t18 = nextLabel ?? messages.nextSlide;
|
|
277
|
-
const t19 = scrolled >= end - .5;
|
|
304
|
+
$[32] = t17;
|
|
305
|
+
} else t17 = $[32];
|
|
306
|
+
const t18 = previousLabel ?? messages.previousSlide;
|
|
307
|
+
let t19;
|
|
308
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
309
|
+
t19 = /* @__PURE__ */ jsx(ChevronEndGlyph, { className: "xlzyvqe x1lliihq x15vhz18 x1pw7kks xpk2tj9" });
|
|
310
|
+
$[33] = t19;
|
|
311
|
+
} else t19 = $[33];
|
|
278
312
|
let t20;
|
|
279
|
-
if ($[
|
|
280
|
-
t20 = /* @__PURE__ */ jsx(
|
|
281
|
-
$[32] = t20;
|
|
282
|
-
} else t20 = $[32];
|
|
283
|
-
let t21;
|
|
284
|
-
if ($[33] !== next || $[34] !== t18 || $[35] !== t19) {
|
|
285
|
-
t21 = /* @__PURE__ */ jsx(IconButton, {
|
|
313
|
+
if ($[34] !== atStart || $[35] !== previous || $[36] !== t18) {
|
|
314
|
+
t20 = /* @__PURE__ */ jsx(IconButton, {
|
|
286
315
|
"aria-label": t18,
|
|
287
|
-
isDisabled:
|
|
288
|
-
onPress:
|
|
289
|
-
|
|
316
|
+
isDisabled: atStart,
|
|
317
|
+
onPress: previous,
|
|
318
|
+
ref: previousRef,
|
|
319
|
+
children: t19
|
|
290
320
|
});
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
} else
|
|
321
|
+
$[34] = atStart;
|
|
322
|
+
$[35] = previous;
|
|
323
|
+
$[36] = t18;
|
|
324
|
+
$[37] = t20;
|
|
325
|
+
} else t20 = $[37];
|
|
326
|
+
const t21 = nextLabel ?? messages.nextSlide;
|
|
296
327
|
let t22;
|
|
297
|
-
if ($[
|
|
298
|
-
t22 = /* @__PURE__ */
|
|
328
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
329
|
+
t22 = /* @__PURE__ */ jsx(ChevronEndGlyph, { className: "xlzyvqe x1lliihq x15vhz18 x19axjrm x1c071of" });
|
|
330
|
+
$[38] = t22;
|
|
331
|
+
} else t22 = $[38];
|
|
332
|
+
let t23;
|
|
333
|
+
if ($[39] !== atEnd || $[40] !== next || $[41] !== t21) {
|
|
334
|
+
t23 = /* @__PURE__ */ jsx(IconButton, {
|
|
335
|
+
"aria-label": t21,
|
|
336
|
+
isDisabled: atEnd,
|
|
337
|
+
onPress: next,
|
|
338
|
+
ref: nextRef,
|
|
339
|
+
children: t22
|
|
340
|
+
});
|
|
341
|
+
$[39] = atEnd;
|
|
342
|
+
$[40] = next;
|
|
343
|
+
$[41] = t21;
|
|
344
|
+
$[42] = t23;
|
|
345
|
+
} else t23 = $[42];
|
|
346
|
+
let t24;
|
|
347
|
+
if ($[43] !== t20 || $[44] !== t23) {
|
|
348
|
+
t24 = /* @__PURE__ */ jsxs("div", {
|
|
349
|
+
ref: controlsRef,
|
|
299
350
|
className: "x9f619 x78zum5 x126z3so x13a6bvl x790zyz",
|
|
300
|
-
children: [
|
|
351
|
+
children: [t20, t23]
|
|
301
352
|
});
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
} else
|
|
353
|
+
$[43] = t20;
|
|
354
|
+
$[44] = t23;
|
|
355
|
+
$[45] = t24;
|
|
356
|
+
} else t24 = $[45];
|
|
306
357
|
return /* @__PURE__ */ jsxs("section", {
|
|
307
358
|
"aria-label": label,
|
|
308
|
-
"aria-roledescription":
|
|
359
|
+
"aria-roledescription": t13,
|
|
309
360
|
ref,
|
|
310
361
|
...props$2,
|
|
311
|
-
...
|
|
362
|
+
...t14,
|
|
312
363
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
313
364
|
onScroll: measure,
|
|
314
365
|
ref: scrollerRef,
|
|
315
366
|
tabIndex: end > 0 ? 0 : void 0,
|
|
316
|
-
...
|
|
367
|
+
...t15,
|
|
317
368
|
children: [
|
|
318
|
-
|
|
369
|
+
t16,
|
|
319
370
|
/* @__PURE__ */ jsx("div", {
|
|
320
371
|
onFocus: reveal,
|
|
321
|
-
...
|
|
372
|
+
...t17[!!masked << 0],
|
|
322
373
|
children: items.map((item, index_1) => /* @__PURE__ */ jsx(SlotContext, {
|
|
323
374
|
value: slots[index_1] ?? null,
|
|
324
375
|
children: item
|
|
@@ -329,7 +380,7 @@ function Carousel(t0) {
|
|
|
329
380
|
...props(styles.marker, placed.marker(`${step}px`))
|
|
330
381
|
}, rest)) : null
|
|
331
382
|
]
|
|
332
|
-
}),
|
|
383
|
+
}), t24]
|
|
333
384
|
});
|
|
334
385
|
}
|
|
335
386
|
/**
|
|
@@ -392,6 +443,12 @@ function CarouselItem(t0) {
|
|
|
392
443
|
} else t6 = $[14];
|
|
393
444
|
return t6;
|
|
394
445
|
}
|
|
446
|
+
function handFocus(to) {
|
|
447
|
+
if (to !== null && !to.hasAttribute("disabled")) to.focus();
|
|
448
|
+
}
|
|
449
|
+
function holds(button, dropped) {
|
|
450
|
+
return dropped === button || document.activeElement === button;
|
|
451
|
+
}
|
|
395
452
|
function restRevealing(index, { lastLarge, scrolled, step }) {
|
|
396
453
|
const at = Math.round(scrolled / step);
|
|
397
454
|
if (index < at) return index;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","Children","createContext","isValidElement","useContext","useLayoutEffect","useRef","useState","arrange","placements","useMessages","focus","mergeStyles","radii","PADDING","DEFAULT_ITEM_SIZE","children","visibleWidth","width","itemSize","label","layout","nextLabel","previousLabel","styles","item","kaIpWk","kB7OPa","kzQI83","kmuXW","kAzted","kVQacm","kVAEAm","$$css","itemUncontained","k5xd4v","marker","scroller","kOuLrU","k1xSpc","kXHlph","kORKVm","kvh3hx","k5wCbM","khEr5k","kc424l","scrollerUncontained","katHQp","_temp","kzqmXN","_temp2","_temp3","placed","inlineSize","shift","clip","undefined","kz4h6p","kLqNvP","val","uncontained","count","index","large","placement","SlotContext","end","lastLarge","masked","scrolled","step","along","direction","offset","Math","round","min","max","Carousel","t0","$","t1","t2","ref","props","messages","scrollerRef","setWidth","setScrolled","items","toArray","filter","length","room","arrangement","steps","largeCount","position","drawn","t3","Symbol","for","current","clientWidth","abs","scrollLeft","measure","t4","t5","scroller_0","observer","ResizeObserver","observe","disconnect","t6","geometry","scrollAlong","previous","t7","geometry_0","next","t8","event","target","Node","Array","from","currentTarget","findIndex","child","contains","restRevealing","reveal","slots","map","_","index_0","t9","carousel","t10","className","t11","ring","t12","t13","0","1","t14","previousSlide","t15","t16","t17","t18","nextSlide","t19","t20","t21","t22","index_1","key","__0","rest","CarouselItem","slot","inset","slideLabel","slide","left","xl","at","sign","getComputedStyle","scrollTo","Item"],"sources":["../../../src/components/carousel/index.tsx"],"sourcesContent":["'use client';\n\nimport type { FocusEvent, HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { Children, createContext, isValidElement, useCallback, useContext, useLayoutEffect, useRef, useState } from 'react';\nimport type { CarouselLayout, Placement } from '../../carousel/arrangement';\nimport { arrange, GAP, placements } from '../../carousel/arrangement';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { useMessages } from '../../i18n';\nimport { focus } from '../../styles/focus';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, spacing } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\n\n// The carousel page's carousel: a row of items that scrolls on and off the\n// screen, drawn in three of the page's layouts. Each has the page's 16dp of\n// padding at its ends and 8dp at its top and bottom, 8dp between items and a\n// 28dp corner on every item.\n//\n// - **Multi-browse**, the default, shows as many large items as fit at\n// `itemSize`, then a medium one and a small one, and fills its width\n// exactly; the large width gives way where the preferred one does not fit.\n// - **Hero** shows one large item and one small.\n// - **Uncontained** shows every item at `itemSize`, scrolling past the edge.\n//\n// **Items change size as they move**, as the page draws them. The first two\n// layouts come to rest one item apart, and between two rests every item's\n// place and width are interpolated, so an item shrinks as it leaves and\n// grows as it arrives; the last rests turn the arrangement round a slot at a\n// time, so every item is drawn large at one of them. The arithmetic is\n// `src/carousel/arrangement.ts`.\n// An item is laid out at the large width and masked down to the width it is\n// drawn at, centred, with the page's corner on the mask: what it holds is\n// cut at both sides rather than squeezed, as the page's masked items are.\n//\n// **What an item holds can see its mask.** The page shows an item's text\n// once the item is wide enough to hold it, and only what the item holds\n// knows where its text is, so `Carousel.Item` takes its children as a\n// function too, handed the width the item is laid out at and the width\n// that shows of it, as MDC-Android's masked items report their mask to a\n// listener. The text can then fade or hide as the mask closes over it.\n//\n// **The scrolling is the browser's.** A scroller holds the items' track,\n// which stays put while it scrolls, and a run of empty markers one item\n// apart after it, which is what gives the scroller its length and its rests:\n// each marker's end is a scroll-snap point, and a mark at the scroller's\n// start is the first. The position the scroller reports is what the items\n// are drawn from. Uncontained has no rests and no masks, so its items scroll\n// in the track themselves, snapping to their own starts.\n//\n// **It is the ARIA carousel pattern**, since React Aria has no carousel: a\n// region named by `label` and described as a carousel, each item a group\n// described as a slide and named by which of how many it is, and a previous\n// and a next button under it, at the end. Focus moving into an item that is\n// not drawn large scrolls the carousel to the nearest rest that draws it\n// large, and the scroller is a tab stop while it scrolls, so the arrow keys\n// move it too. Under reduced motion the scroller jumps rather than scrolling\n// smoothly.\n//\n// The page's large width is \"dynamic, or user-set\", and neither MDC-Android\n// nor Compose has a default for it; `itemSize`'s 240 is this component's own.\n// Uncontained keeps the 16dp at its end as well as its start, where the page\n// gives it a leading padding alone, so its last item does not end flush\n// against the edge.\n\n/** The page's 16dp at a carousel's ends. */\nconst PADDING = 16;\nconst DEFAULT_ITEM_SIZE = 240;\ntype CarouselItemProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n /**\n * What the item shows: usually an image, which the item masks. A function\n * is handed how much of the item shows, every time that changes, so text\n * the item has no room for can be hidden as the mask closes over it.\n */\n children?: ((state: CarouselItemRenderProps) => ReactNode) | ReactNode;\n};\n\n/** How much of a `Carousel.Item` shows, for children written as a function. */\ntype CarouselItemRenderProps = {\n /**\n * How much of `width` shows, in pixels. The mask takes the rest evenly\n * from both sides, so `(width - visibleWidth) / 2` is cut off each. It is\n * `width` for an item drawn large, and for every item of an uncontained\n * carousel, which masks nothing.\n */\n visibleWidth: number;\n /**\n * The width the item is laid out at, in pixels: the large item's, which\n * every item in the carousel shares.\n */\n width: number;\n};\ntype CarouselProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {\n /** The items: `Carousel.Item` for each. */\n children?: ReactNode;\n /**\n * The large item's preferred width, in pixels. Multi-browse lays out as\n * many as fit and narrows them where they do not; uncontained draws every\n * item at it; hero takes its large item's width from the carousel's.\n * @default 240\n */\n itemSize?: number;\n /**\n * What the carousel shows, for a screen reader. Required rather than\n * optional: a carousel is a region, and a region with no name is one a\n * screen reader cannot introduce.\n */\n label: string;\n /**\n * Which of the page's layouts the carousel draws.\n * @default 'multi-browse'\n */\n layout?: CarouselLayout;\n /**\n * What the next button is called. Left out, the library names it in the\n * reader's locale — \"Next slide\" in English.\n */\n nextLabel?: string;\n /**\n * What the previous button is called. Left out, the library names it in\n * the reader's locale — \"Previous slide\" in English.\n */\n previousLabel?: string;\n};\nconst styles = {\n item: {\n kaIpWk: \"x19pkqky\",\n kB7OPa: \"x9f619\",\n kzQI83: \"x1c4vz4f\",\n kmuXW: \"x2lah0s\",\n kAzted: \"x2lwn1j\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n itemUncontained: {\n k5xd4v: \"x1bhewko\",\n $$css: true\n },\n marker: {\n kmuXW: \"x2lah0s\",\n k5xd4v: \"x83psoy\",\n $$css: true\n },\n scroller: {\n kOuLrU: \"xfk6m8\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXHlph: \"xw2csxc\",\n kORKVm: \"x10wlt62\",\n kvh3hx: \"x7p5m3t\",\n kVAEAm: \"x1n2onr6\",\n k5wCbM: \"x1rohswg\",\n khEr5k: \"xkcv6ua xg83hb1\",\n kc424l: \"xhfbhpw\",\n $$css: true\n },\n scrollerUncontained: {\n katHQp: \"x7jkkja\",\n $$css: true\n }\n};\nconst _temp = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst _temp2 = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst _temp3 = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst placed = {\n item: (inlineSize: string, shift: string, clip: string) => [_temp, clip !== undefined && {\n kz4h6p: clip != null ? \"xx58lst\" : \"\",\n $$css: true\n }, shift !== undefined && {\n kLqNvP: shift != null ? \"x1lxsm33\" : \"\",\n $$css: true\n }, {\n \"--x-clipPath\": clip != null ? clip : undefined,\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(inlineSize),\n \"--x-insetInlineStart\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(shift)\n }],\n marker: (inlineSize: string) => [_temp2, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(inlineSize)\n }],\n uncontained: (inlineSize: string) => [_temp3, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(inlineSize)\n }]\n};\ntype Slot = {\n count: number;\n index: number;\n /** The width the item is laid out at. */\n large: number;\n layout: CarouselLayout;\n /** Where it is drawn, for a layout that masks. */\n placement: Placement | undefined;\n};\nconst SlotContext = createContext<null | Slot>(null);\n\n/** What the controls and focus scroll by, as numbers read off one render. */\ntype Geometry = {\n /** The offset of the last rest, or for uncontained how far it scrolls. */\n end: number;\n /** How many items past the first large one the last large one is. */\n lastLarge: number;\n masked: boolean;\n scrolled: number;\n /** The distance between two rests, or for uncontained between two items. */\n step: number;\n};\n\n// Where a press of previous or next scrolls to from `scrolled`: the rest\n// either side of the nearest one, or for uncontained an item's width along,\n// kept between the two ends.\nfunction along(direction: -1 | 1, {\n end,\n masked,\n scrolled,\n step\n}: Geometry): number {\n if (step <= 0) {\n return 0;\n }\n const offset = masked ? (Math.round(scrolled / step) + direction) * step : scrolled + direction * step;\n return Math.min(Math.max(offset, 0), end);\n}\n\n/**\n * A row of items that scrolls on and off the screen, in the carousel page's\n * multi-browse, hero or uncontained layout. Name it with `label`, and give it\n * a `Carousel.Item` for each item.\n *\n * ```tsx\n * <Carousel label=\"Label\">\n * <Carousel.Item><img alt=\"First item\" src=\"…\" /></Carousel.Item>\n * <Carousel.Item><img alt=\"Second item\" src=\"…\" /></Carousel.Item>\n * </Carousel>\n * ```\n *\n * The call site's `className` and `style` land on the carousel as a whole,\n * which is the element a layout positions.\n */\nfunction Carousel({\n children,\n itemSize = DEFAULT_ITEM_SIZE,\n label,\n layout = 'multi-browse',\n nextLabel,\n previousLabel,\n ref,\n ...props\n}: CarouselProps & RefAttributes<HTMLElement>) {\n const messages = useMessages();\n const scrollerRef = useRef<HTMLDivElement>(null);\n // The scroller's width and how far it has scrolled along the text:\n // everything drawn is drawn from these two.\n const [width, setWidth] = useState(0);\n const [scrolled, setScrolled] = useState(0);\n const items = Children.toArray(children).filter(isValidElement);\n const count = items.length;\n const room = Math.max(width - 2 * PADDING, 0);\n const arrangement = arrange(layout, room, itemSize, count);\n const masked = layout !== 'uncontained';\n // Read off the arrangement as arithmetic, so each is a number of its own\n // rather than a field of an object the calls below are handed.\n const step = arrangement.large + GAP;\n // The last rest, or how far the uncontained track runs past the scroller.\n const end = masked ? arrangement.steps * step : Math.max(count * step - GAP + 2 * PADDING - width, 0);\n const lastLarge = arrangement.largeCount - 1;\n const position = masked && step > 0 ? scrolled / step : 0;\n const drawn = masked ? placements(layout, arrangement, room, PADDING, count, position) : [];\n\n // Measured before the first paint, again on every scroll, and whenever\n // the scroller's width changes. A right-to-left scroller counts its offset\n // down from zero.\n const measure = useCallback(() => {\n const scroller = scrollerRef.current;\n if (scroller === null) {\n return;\n }\n setWidth(scroller.clientWidth);\n setScrolled(Math.abs(scroller.scrollLeft));\n }, []);\n useLayoutEffect(() => {\n const scroller = scrollerRef.current;\n if (scroller === null) {\n return undefined;\n }\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(scroller);\n return () => {\n observer.disconnect();\n };\n }, [measure]);\n const previous = useCallback(() => {\n const geometry = {\n end,\n lastLarge,\n masked,\n scrolled,\n step\n };\n scrollAlong(scrollerRef.current, along(-1, geometry));\n }, [end, lastLarge, masked, scrolled, step]);\n const next = useCallback(() => {\n const geometry = {\n end,\n lastLarge,\n masked,\n scrolled,\n step\n };\n scrollAlong(scrollerRef.current, along(1, geometry));\n }, [end, lastLarge, masked, scrolled, step]);\n\n // Focus arriving in an item a masking layout is not drawing large.\n // Uncontained items are where they are drawn, so the browser's own\n // scrolling of focus into view is already right for them.\n const reveal = useCallback((event: FocusEvent<HTMLDivElement>) => {\n const {\n target\n } = event;\n if (!masked || step <= 0 || !(target instanceof Node)) {\n return;\n }\n const index = Array.from(event.currentTarget.children).findIndex(child => child.contains(target));\n if (index < 0) {\n return;\n }\n const geometry = {\n end,\n lastLarge,\n masked,\n scrolled,\n step\n };\n const offset = Math.min(restRevealing(index, geometry) * step, end);\n scrollAlong(scrollerRef.current, offset);\n }, [end, lastLarge, masked, scrolled, step]);\n const slots = items.map((_, index): Slot => ({\n count,\n index,\n large: arrangement.large,\n layout,\n placement: drawn[index]\n }));\n return <section aria-label={label} aria-roledescription={messages.carousel} ref={ref} {...props} {...mergeStyles({\n className: \"x9f619 x78zum5 xdt5ytf x126z3so xeuugli\"\n }, props)}>\n <div onScroll={measure} ref={scrollerRef}\n // A tab stop while there is anywhere to scroll, so the arrow keys\n // move it from rest to rest whatever its items hold. A scroll\n // container with nothing focusable inside is otherwise out of a\n // keyboard's reach, which axe's scrollable-region-focusable reports.\n // oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- see above\n tabIndex={end > 0 ? 0 : undefined} {...stylex.props(styles.scroller, focus.ring, !masked && styles.scrollerUncontained)}>\n {masked ? <div aria-hidden=\"true\" className=\"xjm9jq1 x1i1rx1s x13vifvy x1o0tod x47corl x10l6tqk x1bhewko\" /> : null}\n <div onFocus={reveal} {...{\n 0: {\n className: \"x9f619 x78zum5 x2lah0s x126z3so x1cmllll x790zyz\"\n },\n 1: {\n className: \"x9f619 x78zum5 x2lah0s x126z3so x1cmllll x790zyz xh8yej3 x1o0tod x7giv3 x7wzq59\"\n }\n }[!!masked << 0]}>\n {items.map((item, index) => <SlotContext key={item.key ?? index} value={slots[index] ?? null}>\n {item}\n </SlotContext>)}\n </div>\n {masked ? Array.from({\n length: arrangement.steps\n }, (_, rest) => <div aria-hidden=\"true\" key={rest} {...stylex.props(styles.marker, placed.marker(`${step}px`))} />) : null}\n </div>\n <div className=\"x9f619 x78zum5 x126z3so x13a6bvl x790zyz\">\n <IconButton aria-label={previousLabel ?? messages.previousSlide} isDisabled={scrolled <= 0.5} onPress={previous}>\n <ChevronEndGlyph className=\"xlzyvqe x1lliihq x15vhz18 x1pw7kks xpk2tj9\" />\n </IconButton>\n <IconButton aria-label={nextLabel ?? messages.nextSlide} isDisabled={scrolled >= end - 0.5} onPress={next}>\n <ChevronEndGlyph className=\"xlzyvqe x1lliihq x15vhz18 x19axjrm x1c071of\" />\n </IconButton>\n </div>\n </section>;\n}\n\n/**\n * One item. It is named by which of how many it is — \"2 of 6\" — unless it is\n * given an `aria-label` of its own.\n *\n * The call site's `className` and `style` land on the item.\n */\nfunction CarouselItem({\n children,\n ref,\n ...props\n}: CarouselItemProps & RefAttributes<HTMLDivElement>) {\n const messages = useMessages();\n const slot = useContext(SlotContext);\n const count = slot?.count ?? 1;\n const index = slot?.index ?? 0;\n const large = slot?.large ?? 0;\n const placement = slot?.placement;\n const visibleWidth = placement === undefined ? large : placement.width;\n const inset = (large - visibleWidth) / 2;\n return <div aria-label={messages.slideLabel(index + 1, count)} aria-roledescription={messages.slide} ref={ref}\n // The pattern's own role for a slide. Its suggested `fieldset` is a\n // form's grouping, with a legend and a border of its own.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- see above\n role=\"group\" {...props} {...mergeStyles(stylex.props(styles.item, slot?.layout === 'uncontained' && styles.itemUncontained, slot?.layout === 'uncontained' && placed.uncontained(`${large}px`), placement !== undefined && placed.item(`${large}px`, `${placement.left - inset - index * (large + GAP)}px`, `inset(0 ${inset}px round ${radii.xl})`)), props)}>\n {typeof children === 'function' ? children({\n visibleWidth,\n width: large\n }) : children}\n </div>;\n}\n\n// The nearest rest that draws the item at `index` large, from the rest\n// nearest `scrolled`: the one it starts, for an item before the large ones,\n// or the one it ends, for an item after them. At rest `s` the large items\n// are `s` to `s + lastLarge`.\nfunction restRevealing(index: number, {\n lastLarge,\n scrolled,\n step\n}: Geometry): number {\n const at = Math.round(scrolled / step);\n if (index < at) {\n return index;\n }\n if (index > at + lastLarge) {\n return index - lastLarge;\n }\n return at;\n}\n\n// Scrolls to an offset along the text, whichever way it runs: a\n// right-to-left scroller counts its offset down from zero.\nfunction scrollAlong(scroller: HTMLElement | null, offset: number) {\n if (scroller === null) {\n return;\n }\n const sign = getComputedStyle(scroller).direction === 'rtl' ? -1 : 1;\n scroller.scrollTo({\n left: sign * offset\n });\n}\nCarousel.Item = CarouselItem;\nexport type { CarouselItemProps, CarouselItemRenderProps, CarouselLayout, CarouselProps };\nexport { CarouselItem };\nexport default Carousel;"],"mappings":";;;;;;;;;;;;;;AAmEA,MAAMe,UAAU;AAChB,MAAMC,oBAAoB;AAyD1B,MAAMS,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,iBAAiB;EACfC,QAAQ;EACRF,OAAO;CACT;CACAG,QAAQ;EACNP,OAAO;EACPM,QAAQ;EACRF,OAAO;CACT;CACAI,UAAU;EACRC,QAAQ;EACRX,QAAQ;EACRY,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRV,QAAQ;EACRW,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRZ,OAAO;CACT;CACAa,qBAAqB;EACnBC,QAAQ;EACRd,OAAO;CACT;AACF;AACA,MAAMe,QAAQ;CACZC,QAAQ;CACR,SAAS;AACX;AACA,MAAMC,SAAS;CACbD,QAAQ;CACR,SAAS;AACX;AACA,MAAME,SAAS;CACbF,QAAQ;CACR,SAAS;AACX;AACA,MAAMG,SAAS;CACb3B,OAAO4B,YAAoBC,OAAeC,SAAiB;EAACP;EAAOO,SAASC,KAAAA,KAAa;GACvFC,QAAQF,QAAQ,OAAO,YAAY;GACnCtB,OAAO;EACT;EAAGqB,UAAUE,KAAAA,KAAa;GACxBE,QAAQJ,SAAS,OAAO,aAAa;GACrCrB,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,KAAA/D;EAAA+D,EAAA,KAAA4B;CAAA,OAAAA,KAAA5B,EAAA;CAAA,IAAAkC;CAAA,IAAAlC,EAAA,OAAAK,SAAAiF,SAAAtF,EAAA,OAAAI,WAAAJ,EAAA,QAAAG,OAAAH,EAAA,QAAAC,MAAAD,EAAA,QAAA2B,MAAA3B,EAAA,QAAA4B,IAAA;EARRM,KAAA,oBAAA,OAAA;GAAiB,cAAAjC;GAA6D,wBAAAC;GAAqBC;GAIrG,MAAAgB;GAAO,GAAKf;GAAK,GAAMuB;GACvBC,UAAAA;EAIG,CAAA;EAAA5B,EAAA,KAAAK,SAAAiF;EAAAtF,EAAA,KAAAI;EAAAJ,EAAA,MAAAG;EAAAH,EAAA,MAAAC;EAAAD,EAAA,MAAA2B;EAAA3B,EAAA,MAAA4B;EAAA5B,EAAA,MAAAkC;CAAA,OAAAA,KAAAlC,EAAA;CAAA,OATDkC;AASC;AAOV,SAASiB,cAAcrE,OAAe,EACpCK,WACAE,UACAC,QACmB;CACnB,MAAMmG,KAAK/F,KAAKC,MAAMN,WAAWC,IAAI;CACrC,IAAIR,QAAQ2G,IACV,OAAO3G;CAET,IAAIA,QAAQ2G,KAAKtG,WACf,OAAOL,QAAQK;CAEjB,OAAOsG;AACT;AAIA,SAASrD,YAAY/E,UAA8BoC,QAAgB;CACjE,IAAIpC,aAAa,MACf;CAEF,MAAMqI,OAAOC,iBAAiBtI,QAAQ,CAAC,CAACmC,cAAc,QAAQ,KAAK;CACnEnC,SAASuI,SAAS,EAChBL,MAAMG,OAAOjG,OACf,CAAC;AACH;AACAK,SAAS+F,OAAOX"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","Children","createContext","isValidElement","useContext","useEffect","useLayoutEffect","useRef","useState","arrange","placements","useMessages","focus","mergeStyles","radii","PADDING","DEFAULT_ITEM_SIZE","children","visibleWidth","width","itemSize","label","layout","nextLabel","previousLabel","styles","item","kaIpWk","kB7OPa","kzQI83","kmuXW","kAzted","kVQacm","kVAEAm","$$css","itemUncontained","k5xd4v","marker","scroller","kOuLrU","k1xSpc","kXHlph","kORKVm","kvh3hx","k5wCbM","khEr5k","kc424l","scrollerUncontained","katHQp","_temp","kzqmXN","_temp2","_temp3","placed","inlineSize","shift","clip","undefined","kz4h6p","kLqNvP","val","uncontained","count","index","large","placement","SlotContext","end","lastLarge","masked","scrolled","step","along","direction","offset","Math","round","min","max","Carousel","t0","$","t1","t2","ref","props","messages","scrollerRef","previousRef","nextRef","droppedRef","controlsRef","setWidth","setScrolled","items","toArray","filter","length","room","arrangement","steps","largeCount","atStart","atEnd","position","drawn","t3","Symbol","for","current","clientWidth","abs","scrollLeft","measure","t4","t5","scroller_0","observer","ResizeObserver","observe","disconnect","t6","t7","controls","noteDropped","event","relatedTarget","target","Element","hasAttribute","addEventListener","removeEventListener","t8","t9","dropped","previousButton","nextButton","holds","handFocus","t10","geometry","scrollAlong","previous","t11","geometry_0","next","t12","event_0","target_0","Node","Array","from","currentTarget","findIndex","child","contains","restRevealing","reveal","slots","map","_","index_0","t13","carousel","t14","className","t15","ring","t16","t17","0","1","t18","previousSlide","t19","t20","t21","nextSlide","t22","t23","t24","index_1","key","__0","rest","CarouselItem","slot","inset","slideLabel","slide","left","xl","to","button","document","activeElement","at","sign","getComputedStyle","scrollTo","Item"],"sources":["../../../src/components/carousel/index.tsx"],"sourcesContent":["'use client';\n\nimport type { FocusEvent, HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { Children, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport type { CarouselLayout, Placement } from '../../carousel/arrangement';\nimport { arrange, GAP, placements } from '../../carousel/arrangement';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { useMessages } from '../../i18n';\nimport { focus } from '../../styles/focus';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, spacing } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\n\n// The carousel page's carousel: a row of items that scrolls on and off the\n// screen, drawn in three of the page's layouts. Each has the page's 16dp of\n// padding at its ends and 8dp at its top and bottom, 8dp between items and a\n// 28dp corner on every item.\n//\n// - **Multi-browse**, the default, shows as many large items as fit at\n// `itemSize`, then a medium one and a small one, and fills its width\n// exactly; the large width gives way where the preferred one does not fit.\n// - **Hero** shows one large item and one small.\n// - **Uncontained** shows every item at `itemSize`, scrolling past the edge.\n//\n// **Items change size as they move**, as the page draws them. The first two\n// layouts come to rest one item apart, and between two rests every item's\n// place and width are interpolated, so an item shrinks as it leaves and\n// grows as it arrives; the last rests turn the arrangement round a slot at a\n// time, so every item is drawn large at one of them. The arithmetic is\n// `src/carousel/arrangement.ts`.\n// An item is laid out at the large width and masked down to the width it is\n// drawn at, centred, with the page's corner on the mask: what it holds is\n// cut at both sides rather than squeezed, as the page's masked items are.\n//\n// **What an item holds can see its mask.** The page shows an item's text\n// once the item is wide enough to hold it, and only what the item holds\n// knows where its text is, so `Carousel.Item` takes its children as a\n// function too, handed the width the item is laid out at and the width\n// that shows of it, as MDC-Android's masked items report their mask to a\n// listener. The text can then fade or hide as the mask closes over it.\n//\n// **The scrolling is the browser's.** A scroller holds the items' track,\n// which stays put while it scrolls, and a run of empty markers one item\n// apart after it, which is what gives the scroller its length and its rests:\n// each marker's end is a scroll-snap point, and a mark at the scroller's\n// start is the first. The position the scroller reports is what the items\n// are drawn from. Uncontained has no rests and no masks, so its items scroll\n// in the track themselves, snapping to their own starts.\n//\n// **It is the ARIA carousel pattern**, since React Aria has no carousel: a\n// region named by `label` and described as a carousel, each item a group\n// described as a slide and named by which of how many it is, and a previous\n// and a next button under it, at the end. Focus moving into an item that is\n// not drawn large scrolls the carousel to the nearest rest that draws it\n// large, and the scroller is a tab stop while it scrolls, so the arrow keys\n// move it too. Under reduced motion the scroller jumps rather than scrolling\n// smoothly.\n//\n// Previous disables at the first rest and next at the last. A disabled\n// button cannot hold focus, and the browser drops it on the page's body as\n// the button holding it disables, so the next Tab started again from the\n// top of the page. Focus goes to the other button instead, which is the way\n// back.\n//\n// The page's large width is \"dynamic, or user-set\", and neither MDC-Android\n// nor Compose has a default for it; `itemSize`'s 240 is this component's own.\n// Uncontained keeps the 16dp at its end as well as its start, where the page\n// gives it a leading padding alone, so its last item does not end flush\n// against the edge.\n\n/** The page's 16dp at a carousel's ends. */\nconst PADDING = 16;\nconst DEFAULT_ITEM_SIZE = 240;\ntype CarouselItemProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n /**\n * What the item shows: usually an image, which the item masks. A function\n * is handed how much of the item shows, every time that changes, so text\n * the item has no room for can be hidden as the mask closes over it.\n */\n children?: ((state: CarouselItemRenderProps) => ReactNode) | ReactNode;\n};\n\n/** How much of a `Carousel.Item` shows, for children written as a function. */\ntype CarouselItemRenderProps = {\n /**\n * How much of `width` shows, in pixels. The mask takes the rest evenly\n * from both sides, so `(width - visibleWidth) / 2` is cut off each. It is\n * `width` for an item drawn large, and for every item of an uncontained\n * carousel, which masks nothing.\n */\n visibleWidth: number;\n /**\n * The width the item is laid out at, in pixels: the large item's, which\n * every item in the carousel shares.\n */\n width: number;\n};\ntype CarouselProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {\n /** The items: `Carousel.Item` for each. */\n children?: ReactNode;\n /**\n * The large item's preferred width, in pixels. Multi-browse lays out as\n * many as fit and narrows them where they do not; uncontained draws every\n * item at it; hero takes its large item's width from the carousel's.\n * @default 240\n */\n itemSize?: number;\n /**\n * What the carousel shows, for a screen reader. Required rather than\n * optional: a carousel is a region, and a region with no name is one a\n * screen reader cannot introduce.\n */\n label: string;\n /**\n * Which of the page's layouts the carousel draws.\n * @default 'multi-browse'\n */\n layout?: CarouselLayout;\n /**\n * What the next button is called. Left out, the library names it in the\n * reader's locale — \"Next slide\" in English.\n */\n nextLabel?: string;\n /**\n * What the previous button is called. Left out, the library names it in\n * the reader's locale — \"Previous slide\" in English.\n */\n previousLabel?: string;\n};\nconst styles = {\n item: {\n kaIpWk: \"x19pkqky\",\n kB7OPa: \"x9f619\",\n kzQI83: \"x1c4vz4f\",\n kmuXW: \"x2lah0s\",\n kAzted: \"x2lwn1j\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n itemUncontained: {\n k5xd4v: \"x1bhewko\",\n $$css: true\n },\n marker: {\n kmuXW: \"x2lah0s\",\n k5xd4v: \"x83psoy\",\n $$css: true\n },\n scroller: {\n kOuLrU: \"xfk6m8\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXHlph: \"xw2csxc\",\n kORKVm: \"x10wlt62\",\n kvh3hx: \"x7p5m3t\",\n kVAEAm: \"x1n2onr6\",\n k5wCbM: \"x1rohswg\",\n khEr5k: \"xkcv6ua xg83hb1\",\n kc424l: \"xhfbhpw\",\n $$css: true\n },\n scrollerUncontained: {\n katHQp: \"x7jkkja\",\n $$css: true\n }\n};\nconst _temp = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst _temp2 = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst _temp3 = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst placed = {\n item: (inlineSize: string, shift: string, clip: string) => [_temp, clip !== undefined && {\n kz4h6p: clip != null ? \"xx58lst\" : \"\",\n $$css: true\n }, shift !== undefined && {\n kLqNvP: shift != null ? \"x1lxsm33\" : \"\",\n $$css: true\n }, {\n \"--x-clipPath\": clip != null ? clip : undefined,\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(inlineSize),\n \"--x-insetInlineStart\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(shift)\n }],\n marker: (inlineSize: string) => [_temp2, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(inlineSize)\n }],\n uncontained: (inlineSize: string) => [_temp3, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(inlineSize)\n }]\n};\ntype Slot = {\n count: number;\n index: number;\n /** The width the item is laid out at. */\n large: number;\n layout: CarouselLayout;\n /** Where it is drawn, for a layout that masks. */\n placement: Placement | undefined;\n};\nconst SlotContext = createContext<null | Slot>(null);\n\n/** What the controls and focus scroll by, as numbers read off one render. */\ntype Geometry = {\n /** The offset of the last rest, or for uncontained how far it scrolls. */\n end: number;\n /** How many items past the first large one the last large one is. */\n lastLarge: number;\n masked: boolean;\n scrolled: number;\n /** The distance between two rests, or for uncontained between two items. */\n step: number;\n};\n\n// Where a press of previous or next scrolls to from `scrolled`: the rest\n// either side of the nearest one, or for uncontained an item's width along,\n// kept between the two ends.\nfunction along(direction: -1 | 1, {\n end,\n masked,\n scrolled,\n step\n}: Geometry): number {\n if (step <= 0) {\n return 0;\n }\n const offset = masked ? (Math.round(scrolled / step) + direction) * step : scrolled + direction * step;\n return Math.min(Math.max(offset, 0), end);\n}\n\n/**\n * A row of items that scrolls on and off the screen, in the carousel page's\n * multi-browse, hero or uncontained layout. Name it with `label`, and give it\n * a `Carousel.Item` for each item.\n *\n * ```tsx\n * <Carousel label=\"Label\">\n * <Carousel.Item><img alt=\"First item\" src=\"…\" /></Carousel.Item>\n * <Carousel.Item><img alt=\"Second item\" src=\"…\" /></Carousel.Item>\n * </Carousel>\n * ```\n *\n * The call site's `className` and `style` land on the carousel as a whole,\n * which is the element a layout positions.\n */\nfunction Carousel({\n children,\n itemSize = DEFAULT_ITEM_SIZE,\n label,\n layout = 'multi-browse',\n nextLabel,\n previousLabel,\n ref,\n ...props\n}: CarouselProps & RefAttributes<HTMLElement>) {\n const messages = useMessages();\n const scrollerRef = useRef<HTMLDivElement>(null);\n const previousRef = useRef<HTMLAnchorElement | HTMLButtonElement>(null);\n const nextRef = useRef<HTMLAnchorElement | HTMLButtonElement>(null);\n // The button that has just lost focus by disabling, until the effect\n // below hands focus on from it.\n const droppedRef = useRef<Element | null>(null);\n const controlsRef = useRef<HTMLDivElement>(null);\n // The scroller's width and how far it has scrolled along the text:\n // everything drawn is drawn from these two.\n const [width, setWidth] = useState(0);\n const [scrolled, setScrolled] = useState(0);\n const items = Children.toArray(children).filter(isValidElement);\n const count = items.length;\n const room = Math.max(width - 2 * PADDING, 0);\n const arrangement = arrange(layout, room, itemSize, count);\n const masked = layout !== 'uncontained';\n // Read off the arrangement as arithmetic, so each is a number of its own\n // rather than a field of an object the calls below are handed.\n const step = arrangement.large + GAP;\n // The last rest, or how far the uncontained track runs past the scroller.\n const end = masked ? arrangement.steps * step : Math.max(count * step - GAP + 2 * PADDING - width, 0);\n const lastLarge = arrangement.largeCount - 1;\n const atStart = scrolled <= 0.5;\n const atEnd = scrolled >= end - 0.5;\n const position = masked && step > 0 ? scrolled / step : 0;\n const drawn = masked ? placements(layout, arrangement, room, PADDING, count, position) : [];\n\n // Measured before the first paint, again on every scroll, and whenever\n // the scroller's width changes. A right-to-left scroller counts its offset\n // down from zero.\n const measure = useCallback(() => {\n const scroller = scrollerRef.current;\n if (scroller === null) {\n return;\n }\n setWidth(scroller.clientWidth);\n setScrolled(Math.abs(scroller.scrollLeft));\n }, []);\n useLayoutEffect(() => {\n const scroller = scrollerRef.current;\n if (scroller === null) {\n return undefined;\n }\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(scroller);\n return () => {\n observer.disconnect();\n };\n }, [measure]);\n\n // Focus leaving a button because it disabled: the one blur that goes\n // nowhere from a button that is now disabled; see the header. A blur to\n // anywhere else, or from a button still enabled, is the reader's own. A\n // listener on the row's element rather than React's `onBlur`: the browser\n // blurs the button as React writes `disabled` onto it, in the middle of a\n // commit, and an `onBlur` on the row never ran for that blur.\n useEffect(() => {\n const controls = controlsRef.current;\n if (controls === null) {\n return undefined;\n }\n const noteDropped = (event: globalThis.FocusEvent) => {\n const {\n relatedTarget,\n target\n } = event;\n droppedRef.current = relatedTarget === null && target instanceof Element && target.hasAttribute('disabled') ? target : null;\n };\n controls.addEventListener('focusout', noteDropped);\n return () => {\n controls.removeEventListener('focusout', noteDropped);\n };\n }, []);\n\n // Run in the commit that disables a button, after the blur above, and so\n // before the reader can press anything else. The browser may also still\n // be holding focus on the button, to let go of it later.\n useLayoutEffect(() => {\n const dropped = droppedRef.current;\n droppedRef.current = null;\n const previousButton = previousRef.current;\n const nextButton = nextRef.current;\n if (atStart && previousButton !== null && holds(previousButton, dropped)) {\n handFocus(nextButton);\n }\n if (atEnd && nextButton !== null && holds(nextButton, dropped)) {\n handFocus(previousButton);\n }\n }, [atEnd, atStart]);\n const previous = useCallback(() => {\n const geometry = {\n end,\n lastLarge,\n masked,\n scrolled,\n step\n };\n scrollAlong(scrollerRef.current, along(-1, geometry));\n }, [end, lastLarge, masked, scrolled, step]);\n const next = useCallback(() => {\n const geometry = {\n end,\n lastLarge,\n masked,\n scrolled,\n step\n };\n scrollAlong(scrollerRef.current, along(1, geometry));\n }, [end, lastLarge, masked, scrolled, step]);\n\n // Focus arriving in an item a masking layout is not drawing large.\n // Uncontained items are where they are drawn, so the browser's own\n // scrolling of focus into view is already right for them.\n const reveal = useCallback((event: FocusEvent<HTMLDivElement>) => {\n const {\n target\n } = event;\n if (!masked || step <= 0 || !(target instanceof Node)) {\n return;\n }\n const index = Array.from(event.currentTarget.children).findIndex(child => child.contains(target));\n if (index < 0) {\n return;\n }\n const geometry = {\n end,\n lastLarge,\n masked,\n scrolled,\n step\n };\n const offset = Math.min(restRevealing(index, geometry) * step, end);\n scrollAlong(scrollerRef.current, offset);\n }, [end, lastLarge, masked, scrolled, step]);\n const slots = items.map((_, index): Slot => ({\n count,\n index,\n large: arrangement.large,\n layout,\n placement: drawn[index]\n }));\n return <section aria-label={label} aria-roledescription={messages.carousel} ref={ref} {...props} {...mergeStyles({\n className: \"x9f619 x78zum5 xdt5ytf x126z3so xeuugli\"\n }, props)}>\n <div onScroll={measure} ref={scrollerRef}\n // A tab stop while there is anywhere to scroll, so the arrow keys\n // move it from rest to rest whatever its items hold. A scroll\n // container with nothing focusable inside is otherwise out of a\n // keyboard's reach, which axe's scrollable-region-focusable reports.\n // oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- see above\n tabIndex={end > 0 ? 0 : undefined} {...stylex.props(styles.scroller, focus.ring, !masked && styles.scrollerUncontained)}>\n {masked ? <div aria-hidden=\"true\" className=\"xjm9jq1 x1i1rx1s x13vifvy x1o0tod x47corl x10l6tqk x1bhewko\" /> : null}\n <div onFocus={reveal} {...{\n 0: {\n className: \"x9f619 x78zum5 x2lah0s x126z3so x1cmllll x790zyz\"\n },\n 1: {\n className: \"x9f619 x78zum5 x2lah0s x126z3so x1cmllll x790zyz xh8yej3 x1o0tod x7giv3 x7wzq59\"\n }\n }[!!masked << 0]}>\n {items.map((item, index) => <SlotContext key={item.key ?? index} value={slots[index] ?? null}>\n {item}\n </SlotContext>)}\n </div>\n {masked ? Array.from({\n length: arrangement.steps\n }, (_, rest) => <div aria-hidden=\"true\" key={rest} {...stylex.props(styles.marker, placed.marker(`${step}px`))} />) : null}\n </div>\n <div ref={controlsRef} className=\"x9f619 x78zum5 x126z3so x13a6bvl x790zyz\">\n <IconButton aria-label={previousLabel ?? messages.previousSlide} isDisabled={atStart} onPress={previous} ref={previousRef}>\n <ChevronEndGlyph className=\"xlzyvqe x1lliihq x15vhz18 x1pw7kks xpk2tj9\" />\n </IconButton>\n <IconButton aria-label={nextLabel ?? messages.nextSlide} isDisabled={atEnd} onPress={next} ref={nextRef}>\n <ChevronEndGlyph className=\"xlzyvqe x1lliihq x15vhz18 x19axjrm x1c071of\" />\n </IconButton>\n </div>\n </section>;\n}\n\n/**\n * One item. It is named by which of how many it is — \"2 of 6\" — unless it is\n * given an `aria-label` of its own.\n *\n * The call site's `className` and `style` land on the item.\n */\nfunction CarouselItem({\n children,\n ref,\n ...props\n}: CarouselItemProps & RefAttributes<HTMLDivElement>) {\n const messages = useMessages();\n const slot = useContext(SlotContext);\n const count = slot?.count ?? 1;\n const index = slot?.index ?? 0;\n const large = slot?.large ?? 0;\n const placement = slot?.placement;\n const visibleWidth = placement === undefined ? large : placement.width;\n const inset = (large - visibleWidth) / 2;\n return <div aria-label={messages.slideLabel(index + 1, count)} aria-roledescription={messages.slide} ref={ref}\n // The pattern's own role for a slide. Its suggested `fieldset` is a\n // form's grouping, with a legend and a border of its own.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- see above\n role=\"group\" {...props} {...mergeStyles(stylex.props(styles.item, slot?.layout === 'uncontained' && styles.itemUncontained, slot?.layout === 'uncontained' && placed.uncontained(`${large}px`), placement !== undefined && placed.item(`${large}px`, `${placement.left - inset - index * (large + GAP)}px`, `inset(0 ${inset}px round ${radii.xl})`)), props)}>\n {typeof children === 'function' ? children({\n visibleWidth,\n width: large\n }) : children}\n </div>;\n}\n\n// Focus to the button other than the one that has just disabled, unless\n// that one is disabled too: a carousel with nowhere to scroll disables both.\nfunction handFocus(to: HTMLAnchorElement | HTMLButtonElement | null) {\n if (to !== null && !to.hasAttribute('disabled')) {\n to.focus();\n }\n}\n\n// Whether a button had focus as it disabled: it lost it in the blur the\n// controls noted, or it holds it still.\nfunction holds(button: Element, dropped: Element | null) {\n return dropped === button || document.activeElement === button;\n}\n\n// The nearest rest that draws the item at `index` large, from the rest\n// nearest `scrolled`: the one it starts, for an item before the large ones,\n// or the one it ends, for an item after them. At rest `s` the large items\n// are `s` to `s + lastLarge`.\nfunction restRevealing(index: number, {\n lastLarge,\n scrolled,\n step\n}: Geometry): number {\n const at = Math.round(scrolled / step);\n if (index < at) {\n return index;\n }\n if (index > at + lastLarge) {\n return index - lastLarge;\n }\n return at;\n}\n\n// Scrolls to an offset along the text, whichever way it runs: a\n// right-to-left scroller counts its offset down from zero.\nfunction scrollAlong(scroller: HTMLElement | null, offset: number) {\n if (scroller === null) {\n return;\n }\n const sign = getComputedStyle(scroller).direction === 'rtl' ? -1 : 1;\n scroller.scrollTo({\n left: sign * offset\n });\n}\nCarousel.Item = CarouselItem;\nexport type { CarouselItemProps, CarouselItemRender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AA,QAAAG,OAAAH,EAAA,QAAAC,MAAAD,EAAA,QAAAiC,MAAAjC,EAAA,QAAAkC,IAAA;EARRM,KAAA,oBAAA,OAAA;GAAiB,cAAAvC;GAA6D,wBAAAC;GAAqBC;GAIrG,MAAAsB;GAAO,GAAKrB;GAAK,GAAM6B;GACvBC,UAAAA;EAIG,CAAA;EAAAlC,EAAA,KAAAK,SAAAuG;EAAA5G,EAAA,KAAAI;EAAAJ,EAAA,MAAAG;EAAAH,EAAA,MAAAC;EAAAD,EAAA,MAAAiC;EAAAjC,EAAA,MAAAkC;EAAAlC,EAAA,MAAAwC;CAAA,OAAAA,KAAAxC,EAAA;CAAA,OATDwC;AASC;AAKV,SAASiB,UAAUsD,IAAkD;CACnE,IAAIA,OAAO,QAAQ,CAACA,GAAG/D,aAAa,UAAU,GAC5C+D,GAAGpL,MAAM;AAEb;AAIA,SAAS6H,MAAMwD,QAAiB3D,SAAyB;CACvD,OAAOA,YAAY2D,UAAUC,SAASC,kBAAkBF;AAC1D;AAMA,SAASrC,cAAc7F,OAAe,EACpCK,WACAE,UACAC,QACmB;CACnB,MAAM6H,KAAKzH,KAAKC,MAAMN,WAAWC,IAAI;CACrC,IAAIR,QAAQqI,IACV,OAAOrI;CAET,IAAIA,QAAQqI,KAAKhI,WACf,OAAOL,QAAQK;CAEjB,OAAOgI;AACT;AAIA,SAASvD,YAAYvG,UAA8BoC,QAAgB;CACjE,IAAIpC,aAAa,MACf;CAEF,MAAM+J,OAAOC,iBAAiBhK,QAAQ,CAAC,CAACmC,cAAc,QAAQ,KAAK;CACnEnC,SAASiK,SAAS,EAChBT,MAAMO,OAAO3H,OACf,CAAC;AACH;AACAK,SAASyH,OAAOf"}
|
|
@@ -34,8 +34,38 @@ type ChipBaseProps = {
|
|
|
34
34
|
*/
|
|
35
35
|
icon?: ReactNode;
|
|
36
36
|
};
|
|
37
|
+
/** A dropdown chip: a menu's trigger, drawn as a filter chip. */
|
|
38
|
+
type ChipDropdownProps = ChipBaseProps & ChipSelectableProps & Omit<ButtonProps, 'children' | 'isPending'> & {
|
|
39
|
+
variant: 'dropdown';
|
|
40
|
+
};
|
|
37
41
|
/** A filter chip: a two-state button, the default. */
|
|
38
|
-
type ChipFilterProps = ChipBaseProps & Omit<ToggleButtonProps, 'children'> & {
|
|
42
|
+
type ChipFilterProps = ChipBaseProps & ChipSelectableProps & Omit<ToggleButtonProps, 'children' | 'isSelected'> & {
|
|
43
|
+
/**
|
|
44
|
+
* `filter`, the default, for a two-state button; `dropdown` for the
|
|
45
|
+
* page's dropdown filter chip, which opens a menu and so is a plain
|
|
46
|
+
* button rather than a toggle; `assist` for an action the chip's context
|
|
47
|
+
* suggests, and `suggestion` for one the product generates. Either of
|
|
48
|
+
* those two is an action rather than a selection, so neither is ever
|
|
49
|
+
* selected.
|
|
50
|
+
* @default 'filter'
|
|
51
|
+
*/
|
|
52
|
+
variant?: 'filter';
|
|
53
|
+
};
|
|
54
|
+
type ChipProps = ChipActionProps | ChipDropdownProps | ChipFilterProps;
|
|
55
|
+
/**
|
|
56
|
+
* What the filter chip and the dropdown chip take and the action chips do
|
|
57
|
+
* not: both draw the pill a selection changes. Declared once, for the reason
|
|
58
|
+
* `ChipBaseProps` is.
|
|
59
|
+
*/
|
|
60
|
+
type ChipSelectableProps = {
|
|
61
|
+
/**
|
|
62
|
+
* Draws the chip selected: the secondary container, and the check in front
|
|
63
|
+
* of the label. On a filter chip it is the toggle's state, announced
|
|
64
|
+
* through `aria-pressed`: pass it with `onChange` to control it. On a
|
|
65
|
+
* dropdown chip it is drawn only, for a menu that has a choice, and the
|
|
66
|
+
* chip's label is the place to name that choice.
|
|
67
|
+
*/
|
|
68
|
+
isSelected?: boolean;
|
|
39
69
|
/**
|
|
40
70
|
* An icon after the label, in the same 18dp slot and the chip's own
|
|
41
71
|
* content role, which is the page's dropdown filter chip: an arrow here
|
|
@@ -43,18 +73,9 @@ type ChipFilterProps = ChipBaseProps & Omit<ToggleButtonProps, 'children'> & {
|
|
|
43
73
|
* icon drawn in `em` takes its size from the slot.
|
|
44
74
|
*/
|
|
45
75
|
trailingIcon?: ReactNode;
|
|
46
|
-
/**
|
|
47
|
-
* `filter`, the default, for a two-state button; `assist` for an action
|
|
48
|
-
* the chip's context suggests, and `suggestion` for one the product
|
|
49
|
-
* generates. Either of those is an action rather than a selection, so
|
|
50
|
-
* neither is ever selected.
|
|
51
|
-
* @default 'filter'
|
|
52
|
-
*/
|
|
53
|
-
variant?: 'filter';
|
|
54
76
|
};
|
|
55
|
-
type ChipProps = ChipActionProps | ChipFilterProps;
|
|
56
77
|
/** Which of the chips page's chips a Chip is. */
|
|
57
|
-
type ChipVariant = 'assist' | 'filter' | 'suggestion';
|
|
78
|
+
type ChipVariant = 'assist' | 'dropdown' | 'filter' | 'suggestion';
|
|
58
79
|
/**
|
|
59
80
|
* A chip. By default a filter chip, which is a two-state button, so its
|
|
60
81
|
* selected state is React Aria's `isSelected`: pass it with `onChange` to
|
|
@@ -65,9 +86,11 @@ type ChipVariant = 'assist' | 'filter' | 'suggestion';
|
|
|
65
86
|
* time or several, is a `ChipGroup`, which keeps the rule, moves between the
|
|
66
87
|
* chips with the arrow keys and labels the set.
|
|
67
88
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* label says so.
|
|
89
|
+
* `variant="dropdown"` is the page's dropdown filter chip: placed first
|
|
90
|
+
* inside a `Menu`, it opens the menu, and a `trailingIcon` arrow after its
|
|
91
|
+
* label says so. It is a menu button rather than a toggle, so it announces no
|
|
92
|
+
* pressed state; `isSelected` draws it selected once the menu has a choice,
|
|
93
|
+
* and its label is where to name that choice.
|
|
71
94
|
*
|
|
72
95
|
* `variant="assist"` and `variant="suggestion"` draw the page's two action
|
|
73
96
|
* chips instead: plain buttons, pressed with `onPress`, never selected.
|
|
@@ -84,4 +107,4 @@ type ChipVariant = 'assist' | 'filter' | 'suggestion';
|
|
|
84
107
|
* ```
|
|
85
108
|
*/
|
|
86
109
|
declare function Chip(props: ChipProps & RefAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
87
|
-
export { type ChipActionProps, type ChipFilterProps, type ChipProps, type ChipVariant, Chip as default };
|
|
110
|
+
export { type ChipActionProps, type ChipDropdownProps, type ChipFilterProps, type ChipProps, type ChipVariant, Chip as default };
|