@bug-on/m3-expressive 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +88 -60
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/buttons.js +185 -40
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +186 -41
- package/dist/buttons.mjs.map +1 -1
- package/dist/{core-CAU8g2HY.d.mts → core-D8FdHY6I.d.mts} +1 -1
- package/dist/{core-DRrLnsnJ.d.ts → core-DyEy8H9Z.d.ts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +156 -25
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +157 -26
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +20 -0
- package/dist/feedback.d.ts +20 -0
- package/dist/feedback.js +157 -26
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +158 -27
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +4 -2
- package/dist/forms.d.ts +4 -2
- package/dist/forms.js +5065 -2980
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +5064 -2982
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-USJo7AqO.d.mts → icon-button-CxyJv7UV.d.mts} +1 -1
- package/dist/{icon-button-CqdQBsRe.d.ts → icon-button-Di8VX6ou.d.ts} +1 -1
- package/dist/index.d.mts +12 -82
- package/dist/index.d.ts +12 -82
- package/dist/index.js +2875 -1226
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2723 -1086
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +481 -33
- package/dist/layout.d.ts +481 -33
- package/dist/layout.js +1653 -243
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +1626 -232
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-D0_Z7IXj.d.mts → md3-BQhRygSi.d.mts} +1 -1
- package/dist/{md3-D0_Z7IXj.d.ts → md3-BQhRygSi.d.ts} +1 -1
- package/dist/menu-types-rZNQFO7Y.d.mts +315 -0
- package/dist/menu-types-rZNQFO7Y.d.ts +315 -0
- package/dist/navigation.d.mts +5 -289
- package/dist/navigation.d.ts +5 -289
- package/dist/navigation.js +575 -271
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +568 -265
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +156 -25
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +157 -26
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +156 -25
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +157 -26
- package/dist/pickers.mjs.map +1 -1
- package/dist/{side-sheet-modal-Dgjt739k.d.mts → side-sheet-modal-64FGhDxL.d.mts} +1 -1
- package/dist/{side-sheet-modal-DdEZR6Vl.d.ts → side-sheet-modal-Bd5Qqvp9.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-26qlZvKT.d.mts → split-button-trailing-uncheckable-CGzk7KcG.d.ts} +3 -1
- package/dist/{split-button-trailing-uncheckable-CXUVrH64.d.ts → split-button-trailing-uncheckable-gAz6OAIi.d.mts} +3 -1
- package/dist/{text-field-DWC7qOvp.d.ts → text-field-4OlT9o8s.d.mts} +206 -55
- package/dist/{text-field-DWC7qOvp.d.mts → text-field-DARNdj14.d.ts} +206 -55
- package/package.json +3 -3
package/dist/layout.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
5
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
6
6
|
var react = require('motion/react');
|
|
7
|
-
var
|
|
7
|
+
var React23 = require('react');
|
|
8
8
|
var clsx = require('clsx');
|
|
9
9
|
var tailwindMerge = require('tailwind-merge');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -32,7 +32,7 @@ function _interopNamespace(e) {
|
|
|
32
32
|
return Object.freeze(n);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var React23__namespace = /*#__PURE__*/_interopNamespace(React23);
|
|
36
36
|
var RadixScrollArea__namespace = /*#__PURE__*/_interopNamespace(RadixScrollArea);
|
|
37
37
|
|
|
38
38
|
var __defProp = Object.defineProperty;
|
|
@@ -77,7 +77,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
77
77
|
function cn(...inputs) {
|
|
78
78
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
79
79
|
}
|
|
80
|
-
var RippleItem =
|
|
80
|
+
var RippleItem = React23__namespace.memo(function RippleItem2({
|
|
81
81
|
ripple,
|
|
82
82
|
onDone
|
|
83
83
|
}) {
|
|
@@ -121,8 +121,8 @@ function Ripple({
|
|
|
121
121
|
}
|
|
122
122
|
function useRippleState(options = {}) {
|
|
123
123
|
const { disabled = false } = options;
|
|
124
|
-
const [ripples, setRipples] =
|
|
125
|
-
const onPointerDown =
|
|
124
|
+
const [ripples, setRipples] = React23__namespace.useState([]);
|
|
125
|
+
const onPointerDown = React23__namespace.useCallback(
|
|
126
126
|
(e) => {
|
|
127
127
|
if (disabled) return;
|
|
128
128
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -139,21 +139,36 @@ function useRippleState(options = {}) {
|
|
|
139
139
|
},
|
|
140
140
|
[disabled]
|
|
141
141
|
);
|
|
142
|
-
const removeRipple =
|
|
142
|
+
const removeRipple = React23__namespace.useCallback((id) => {
|
|
143
143
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
144
144
|
}, []);
|
|
145
145
|
return { ripples, onPointerDown, removeRipple };
|
|
146
146
|
}
|
|
147
|
+
|
|
148
|
+
// src/ui/cards/card/card-tokens.ts
|
|
147
149
|
var SHADOW = {
|
|
148
150
|
level0: "none",
|
|
149
151
|
level1: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 1px 3px 1px rgba(0,0,0,.15)",
|
|
150
|
-
level2: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 2px 6px 2px rgba(0,0,0,.15)"
|
|
152
|
+
level2: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 2px 6px 2px rgba(0,0,0,.15)",
|
|
153
|
+
level3: "0px 4px 8px 3px rgba(0,0,0,.15), 0px 1px 3px 0px rgba(0,0,0,.3)",
|
|
154
|
+
level4: "0px 6px 10px 4px rgba(0,0,0,.15), 0px 2px 3px 0px rgba(0,0,0,.3)",
|
|
155
|
+
level5: "0px 8px 12px 6px rgba(0,0,0,.15), 0px 4px 4px 0px rgba(0,0,0,.3)"
|
|
151
156
|
};
|
|
157
|
+
function resolveElevationShadow(level) {
|
|
158
|
+
var _a;
|
|
159
|
+
if (level === void 0) return void 0;
|
|
160
|
+
if (typeof level === "number") {
|
|
161
|
+
const key = `level${level}`;
|
|
162
|
+
return (_a = SHADOW[key]) != null ? _a : SHADOW.level0;
|
|
163
|
+
}
|
|
164
|
+
return level;
|
|
165
|
+
}
|
|
152
166
|
var VARIANT_ELEVATION = {
|
|
153
167
|
elevated: {
|
|
154
168
|
rest: SHADOW.level1,
|
|
155
169
|
hover: SHADOW.level2,
|
|
156
170
|
pressed: SHADOW.level1,
|
|
171
|
+
dragged: SHADOW.level3,
|
|
157
172
|
disabled: SHADOW.level1
|
|
158
173
|
// ElevatedCardTokens.DisabledContainerElevation = Level1
|
|
159
174
|
},
|
|
@@ -161,78 +176,177 @@ var VARIANT_ELEVATION = {
|
|
|
161
176
|
rest: SHADOW.level0,
|
|
162
177
|
hover: SHADOW.level1,
|
|
163
178
|
pressed: SHADOW.level0,
|
|
179
|
+
dragged: SHADOW.level3,
|
|
164
180
|
disabled: SHADOW.level0
|
|
165
181
|
},
|
|
166
182
|
outlined: {
|
|
167
183
|
rest: SHADOW.level0,
|
|
168
184
|
hover: SHADOW.level1,
|
|
169
185
|
pressed: SHADOW.level0,
|
|
186
|
+
dragged: SHADOW.level3,
|
|
170
187
|
disabled: SHADOW.level0
|
|
171
188
|
}
|
|
172
189
|
};
|
|
190
|
+
function useCardElevation({
|
|
191
|
+
variant = "elevated",
|
|
192
|
+
disabled = false,
|
|
193
|
+
draggable = false,
|
|
194
|
+
elevation,
|
|
195
|
+
disableElevation = false,
|
|
196
|
+
hoverEffect = true
|
|
197
|
+
}) {
|
|
198
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
199
|
+
const defaultLevels = VARIANT_ELEVATION[variant] || VARIANT_ELEVATION.elevated;
|
|
200
|
+
let restShadow = defaultLevels.rest;
|
|
201
|
+
let hoverShadow = defaultLevels.hover;
|
|
202
|
+
let pressedShadow = defaultLevels.pressed;
|
|
203
|
+
let draggedShadow = defaultLevels.dragged;
|
|
204
|
+
if (disableElevation) {
|
|
205
|
+
restShadow = SHADOW.level0;
|
|
206
|
+
hoverShadow = SHADOW.level0;
|
|
207
|
+
pressedShadow = SHADOW.level0;
|
|
208
|
+
draggedShadow = SHADOW.level0;
|
|
209
|
+
} else if (typeof elevation === "number") {
|
|
210
|
+
const resolved = (_a = resolveElevationShadow(elevation)) != null ? _a : SHADOW.level0;
|
|
211
|
+
restShadow = resolved;
|
|
212
|
+
const hoverLevel = hoverEffect ? Math.min(elevation + 1, 5) : elevation;
|
|
213
|
+
hoverShadow = (_b = resolveElevationShadow(hoverLevel)) != null ? _b : resolved;
|
|
214
|
+
pressedShadow = resolved;
|
|
215
|
+
draggedShadow = (_c = resolveElevationShadow(
|
|
216
|
+
Math.min(elevation + 2, 5)
|
|
217
|
+
)) != null ? _c : resolved;
|
|
218
|
+
} else if (elevation && typeof elevation === "object") {
|
|
219
|
+
if (elevation.rest !== void 0) {
|
|
220
|
+
restShadow = (_d = resolveElevationShadow(elevation.rest)) != null ? _d : restShadow;
|
|
221
|
+
}
|
|
222
|
+
if (elevation.hover !== void 0) {
|
|
223
|
+
hoverShadow = (_e = resolveElevationShadow(elevation.hover)) != null ? _e : hoverShadow;
|
|
224
|
+
}
|
|
225
|
+
if (elevation.pressed !== void 0) {
|
|
226
|
+
pressedShadow = (_f = resolveElevationShadow(elevation.pressed)) != null ? _f : pressedShadow;
|
|
227
|
+
}
|
|
228
|
+
if (elevation.dragged !== void 0) {
|
|
229
|
+
draggedShadow = (_g = resolveElevationShadow(elevation.dragged)) != null ? _g : draggedShadow;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (!hoverEffect) {
|
|
233
|
+
hoverShadow = restShadow;
|
|
234
|
+
}
|
|
235
|
+
const animateShadow = disabled ? disableElevation ? SHADOW.level0 : defaultLevels.disabled : restShadow;
|
|
236
|
+
return {
|
|
237
|
+
animate: { boxShadow: animateShadow },
|
|
238
|
+
whileHover: disabled || !hoverEffect ? void 0 : { boxShadow: hoverShadow },
|
|
239
|
+
whileTap: disabled ? void 0 : { boxShadow: pressedShadow },
|
|
240
|
+
whileFocus: disabled || !hoverEffect ? void 0 : { boxShadow: hoverShadow },
|
|
241
|
+
whileDrag: !disabled && draggable ? { boxShadow: draggedShadow } : void 0,
|
|
242
|
+
transition: {
|
|
243
|
+
boxShadow: {
|
|
244
|
+
// Incoming: 120ms (from Elevation.kt DefaultIncomingSpec)
|
|
245
|
+
duration: 0.12,
|
|
246
|
+
ease: [0.4, 0, 0.2, 1]
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
173
251
|
var cardVariants = classVarianceAuthority.cva(
|
|
174
|
-
"rounded-m3-lg flex flex-col relative overflow-hidden transition-
|
|
252
|
+
"rounded-m3-lg flex flex-col relative overflow-hidden transition-all duration-200",
|
|
175
253
|
{
|
|
176
254
|
variants: {
|
|
177
255
|
variant: {
|
|
178
256
|
// ElevatedCardTokens.ContainerColor = SurfaceContainerLow
|
|
179
|
-
elevated: "bg-m3-surface-container-low",
|
|
257
|
+
elevated: "bg-m3-surface-container-low text-m3-on-surface",
|
|
180
258
|
// FilledCardTokens.ContainerColor = SurfaceContainerHighest
|
|
181
|
-
filled: "bg-m3-surface-container-highest",
|
|
259
|
+
filled: "bg-m3-surface-container-highest text-m3-on-surface",
|
|
182
260
|
// OutlinedCardTokens.ContainerColor = Surface, OutlineColor = OutlineVariant
|
|
183
|
-
outlined: "bg-m3-surface border border-m3-outline-variant"
|
|
261
|
+
outlined: "bg-m3-surface text-m3-on-surface border border-m3-outline-variant"
|
|
184
262
|
}
|
|
185
263
|
},
|
|
186
264
|
defaultVariants: { variant: "elevated" }
|
|
187
265
|
}
|
|
188
266
|
);
|
|
189
|
-
|
|
190
|
-
const levels = VARIANT_ELEVATION[variant];
|
|
191
|
-
return {
|
|
192
|
-
animate: { boxShadow: disabled ? levels.disabled : levels.rest },
|
|
193
|
-
whileHover: disabled ? void 0 : { boxShadow: levels.hover },
|
|
194
|
-
whileTap: disabled ? void 0 : { boxShadow: levels.pressed },
|
|
195
|
-
whileFocus: disabled ? void 0 : { boxShadow: levels.hover },
|
|
196
|
-
transition: {
|
|
197
|
-
boxShadow: {
|
|
198
|
-
// Incoming: 120ms (from Elevation.kt DefaultIncomingSpec)
|
|
199
|
-
duration: 0.12,
|
|
200
|
-
ease: [0.4, 0, 0.2, 1]
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
var CardImpl = React18__namespace.forwardRef(
|
|
267
|
+
var CardImpl = React23__namespace.forwardRef(
|
|
206
268
|
(_a, ref) => {
|
|
207
269
|
var _b = _a, {
|
|
208
270
|
className,
|
|
209
271
|
variant = "elevated",
|
|
272
|
+
elevation,
|
|
273
|
+
disableElevation = false,
|
|
274
|
+
ripple = true,
|
|
275
|
+
disableRipple = false,
|
|
276
|
+
hoverEffect = true,
|
|
277
|
+
disableHoverEffect = false,
|
|
278
|
+
stateLayer = true,
|
|
279
|
+
disableStateLayer = false,
|
|
210
280
|
disabled = false,
|
|
211
281
|
interactive = false,
|
|
282
|
+
draggable = false,
|
|
212
283
|
href,
|
|
213
284
|
target,
|
|
214
285
|
rel: relProp,
|
|
215
286
|
onClick,
|
|
287
|
+
onPointerDown: userOnPointerDown,
|
|
288
|
+
whileHover,
|
|
289
|
+
whileTap,
|
|
290
|
+
whileFocus,
|
|
291
|
+
whileDrag,
|
|
292
|
+
transition,
|
|
216
293
|
asChild = false,
|
|
217
294
|
children
|
|
218
295
|
} = _b, props = __objRest(_b, [
|
|
219
296
|
"className",
|
|
220
297
|
"variant",
|
|
298
|
+
"elevation",
|
|
299
|
+
"disableElevation",
|
|
300
|
+
"ripple",
|
|
301
|
+
"disableRipple",
|
|
302
|
+
"hoverEffect",
|
|
303
|
+
"disableHoverEffect",
|
|
304
|
+
"stateLayer",
|
|
305
|
+
"disableStateLayer",
|
|
221
306
|
"disabled",
|
|
222
307
|
"interactive",
|
|
308
|
+
"draggable",
|
|
223
309
|
"href",
|
|
224
310
|
"target",
|
|
225
311
|
"rel",
|
|
226
312
|
"onClick",
|
|
313
|
+
"onPointerDown",
|
|
314
|
+
"whileHover",
|
|
315
|
+
"whileTap",
|
|
316
|
+
"whileFocus",
|
|
317
|
+
"whileDrag",
|
|
318
|
+
"transition",
|
|
227
319
|
"asChild",
|
|
228
320
|
"children"
|
|
229
321
|
]);
|
|
230
|
-
const safeVariant = variant;
|
|
322
|
+
const safeVariant = variant || "elevated";
|
|
231
323
|
const isInteractive = !!onClick || !!href || interactive || asChild;
|
|
232
|
-
const
|
|
233
|
-
const
|
|
324
|
+
const isHoverEnabled = hoverEffect !== false && !disableHoverEffect;
|
|
325
|
+
const isRippleEnabled = ripple !== false && !disableRipple && isInteractive && !disabled;
|
|
326
|
+
const isStateLayerEnabled = stateLayer !== false && !disableStateLayer && isInteractive && !disabled;
|
|
327
|
+
const elevationProps = useCardElevation({
|
|
328
|
+
variant: safeVariant,
|
|
329
|
+
disabled,
|
|
330
|
+
draggable,
|
|
331
|
+
elevation,
|
|
332
|
+
disableElevation,
|
|
333
|
+
hoverEffect: isHoverEnabled
|
|
334
|
+
});
|
|
335
|
+
const {
|
|
336
|
+
ripples,
|
|
337
|
+
onPointerDown: rippleOnPointerDown,
|
|
338
|
+
removeRipple
|
|
339
|
+
} = useRippleState();
|
|
340
|
+
const handlePointerDown = (event) => {
|
|
341
|
+
if (isRippleEnabled) {
|
|
342
|
+
rippleOnPointerDown(event);
|
|
343
|
+
}
|
|
344
|
+
userOnPointerDown == null ? void 0 : userOnPointerDown(
|
|
345
|
+
event
|
|
346
|
+
);
|
|
347
|
+
};
|
|
234
348
|
const baseClass = cn(
|
|
235
|
-
cardVariants({ variant }),
|
|
349
|
+
cardVariants({ variant: safeVariant }),
|
|
236
350
|
// Disabled state:
|
|
237
351
|
// - pointer-events-none → disable interactions completely
|
|
238
352
|
// - opacity-[0.38] → MD3 DisabledContainerOpacity
|
|
@@ -242,17 +356,25 @@ var CardImpl = React18__namespace.forwardRef(
|
|
|
242
356
|
const interactiveClass = cn(
|
|
243
357
|
// Remove default outline, use MD3 state overlay & elevation for focus
|
|
244
358
|
"focus-visible:outline-none focus:outline-none group",
|
|
245
|
-
// Base pseudo-element overlay layer
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
359
|
+
// Base pseudo-element overlay layer (when stateLayer is enabled)
|
|
360
|
+
isStateLayerEnabled && [
|
|
361
|
+
"before:absolute before:inset-0 before:pointer-events-none before:bg-m3-on-surface before:opacity-0 before:transition-opacity before:duration-200",
|
|
362
|
+
isHoverEnabled && "hover:before:opacity-[0.08]",
|
|
363
|
+
"focus-visible:before:opacity-[0.10] active:before:opacity-[0.10]",
|
|
364
|
+
draggable && "active:before:opacity-[0.16]"
|
|
365
|
+
],
|
|
366
|
+
// Outlined interactive card: smooth transition of border color to m3-outline on hover/focus/press
|
|
367
|
+
safeVariant === "outlined" && "transition-colors duration-200 hover:border-m3-outline focus-visible:border-m3-outline active:border-m3-outline"
|
|
251
368
|
);
|
|
369
|
+
const mergedWhileHover = elevationProps.whileHover || whileHover ? __spreadValues(__spreadValues({}, elevationProps.whileHover), typeof whileHover === "object" ? whileHover : {}) : void 0;
|
|
370
|
+
const mergedWhileTap = elevationProps.whileTap || whileTap ? __spreadValues(__spreadValues({}, elevationProps.whileTap), typeof whileTap === "object" ? whileTap : {}) : void 0;
|
|
371
|
+
const mergedWhileFocus = elevationProps.whileFocus || whileFocus ? __spreadValues(__spreadValues({}, elevationProps.whileFocus), typeof whileFocus === "object" ? whileFocus : {}) : void 0;
|
|
372
|
+
const mergedWhileDrag = elevationProps.whileDrag || whileDrag ? __spreadValues(__spreadValues({}, elevationProps.whileDrag), typeof whileDrag === "object" ? whileDrag : {}) : void 0;
|
|
373
|
+
const mergedTransition = elevationProps.transition || transition ? __spreadValues(__spreadValues({}, elevationProps.transition), typeof transition === "object" ? transition : {}) : void 0;
|
|
252
374
|
if (asChild) {
|
|
253
|
-
const child =
|
|
375
|
+
const child = React23__namespace.Children.only(children);
|
|
254
376
|
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
255
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
377
|
+
isRippleEnabled && /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
256
378
|
child.props.children
|
|
257
379
|
] });
|
|
258
380
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -262,22 +384,26 @@ var CardImpl = React18__namespace.forwardRef(
|
|
|
262
384
|
className: cn(baseClass, interactiveClass),
|
|
263
385
|
"aria-disabled": disabled ? true : void 0,
|
|
264
386
|
tabIndex: disabled ? -1 : 0,
|
|
265
|
-
onPointerDown,
|
|
387
|
+
onPointerDown: handlePointerDown,
|
|
266
388
|
onClick
|
|
267
389
|
}, props), {
|
|
268
|
-
children:
|
|
390
|
+
children: React23__namespace.cloneElement(child, { children: innerContent })
|
|
269
391
|
})
|
|
270
392
|
) });
|
|
271
393
|
}
|
|
272
394
|
if (!isInteractive) {
|
|
273
395
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
274
396
|
"div",
|
|
275
|
-
{
|
|
397
|
+
__spreadProps(__spreadValues({
|
|
276
398
|
ref,
|
|
277
399
|
className: baseClass,
|
|
278
|
-
|
|
400
|
+
style: __spreadValues({
|
|
401
|
+
boxShadow: elevationProps.animate.boxShadow
|
|
402
|
+
}, props.style || {}),
|
|
403
|
+
"aria-disabled": disabled ? true : void 0
|
|
404
|
+
}, props), {
|
|
279
405
|
children
|
|
280
|
-
}
|
|
406
|
+
})
|
|
281
407
|
);
|
|
282
408
|
}
|
|
283
409
|
const safeRel = href ? relProp != null ? relProp : target === "_blank" ? "noreferrer" : void 0 : void 0;
|
|
@@ -292,10 +418,16 @@ var CardImpl = React18__namespace.forwardRef(
|
|
|
292
418
|
className: cn(baseClass, interactiveClass),
|
|
293
419
|
"aria-disabled": disabled ? true : void 0,
|
|
294
420
|
tabIndex: disabled ? -1 : 0,
|
|
295
|
-
onPointerDown
|
|
296
|
-
|
|
421
|
+
onPointerDown: handlePointerDown,
|
|
422
|
+
animate: elevationProps.animate,
|
|
423
|
+
whileHover: mergedWhileHover,
|
|
424
|
+
whileTap: mergedWhileTap,
|
|
425
|
+
whileFocus: mergedWhileFocus,
|
|
426
|
+
whileDrag: mergedWhileDrag,
|
|
427
|
+
transition: mergedTransition
|
|
428
|
+
}, props), {
|
|
297
429
|
children: [
|
|
298
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
430
|
+
isRippleEnabled && /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
299
431
|
children
|
|
300
432
|
]
|
|
301
433
|
})
|
|
@@ -303,7 +435,7 @@ var CardImpl = React18__namespace.forwardRef(
|
|
|
303
435
|
}
|
|
304
436
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
305
437
|
react.m.button,
|
|
306
|
-
__spreadProps(__spreadValues(
|
|
438
|
+
__spreadProps(__spreadValues({
|
|
307
439
|
ref,
|
|
308
440
|
type: "button",
|
|
309
441
|
disabled,
|
|
@@ -311,10 +443,16 @@ var CardImpl = React18__namespace.forwardRef(
|
|
|
311
443
|
className: cn(baseClass, interactiveClass),
|
|
312
444
|
"aria-disabled": disabled ? true : void 0,
|
|
313
445
|
tabIndex: disabled ? -1 : 0,
|
|
314
|
-
onPointerDown
|
|
315
|
-
|
|
446
|
+
onPointerDown: handlePointerDown,
|
|
447
|
+
animate: elevationProps.animate,
|
|
448
|
+
whileHover: mergedWhileHover,
|
|
449
|
+
whileTap: mergedWhileTap,
|
|
450
|
+
whileFocus: mergedWhileFocus,
|
|
451
|
+
whileDrag: mergedWhileDrag,
|
|
452
|
+
transition: mergedTransition
|
|
453
|
+
}, props), {
|
|
316
454
|
children: [
|
|
317
|
-
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
455
|
+
isRippleEnabled && /* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple }),
|
|
318
456
|
children
|
|
319
457
|
]
|
|
320
458
|
})
|
|
@@ -322,7 +460,1132 @@ var CardImpl = React18__namespace.forwardRef(
|
|
|
322
460
|
}
|
|
323
461
|
);
|
|
324
462
|
CardImpl.displayName = "Card";
|
|
325
|
-
var Card =
|
|
463
|
+
var Card = React23__namespace.memo(CardImpl);
|
|
464
|
+
var CardHeader = React23__namespace.forwardRef(
|
|
465
|
+
(_a, ref) => {
|
|
466
|
+
var _b = _a, { className, avatar, title, subheader, action, children } = _b, props = __objRest(_b, ["className", "avatar", "title", "subheader", "action", "children"]);
|
|
467
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
468
|
+
"div",
|
|
469
|
+
__spreadProps(__spreadValues({
|
|
470
|
+
ref,
|
|
471
|
+
className: cn(
|
|
472
|
+
"flex items-center gap-4 px-6 pt-6 pb-2 relative z-1",
|
|
473
|
+
className
|
|
474
|
+
)
|
|
475
|
+
}, props), {
|
|
476
|
+
children: [
|
|
477
|
+
avatar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 flex items-center", children: avatar }),
|
|
478
|
+
title || subheader ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
479
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-medium text-m3-on-surface truncate", children: title }),
|
|
480
|
+
subheader && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-m3-on-surface-variant truncate", children: subheader })
|
|
481
|
+
] }) : null,
|
|
482
|
+
children,
|
|
483
|
+
action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 ml-auto flex items-center", children: action })
|
|
484
|
+
]
|
|
485
|
+
})
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
);
|
|
489
|
+
CardHeader.displayName = "CardHeader";
|
|
490
|
+
var ASPECT_RATIO_CLASSES = {
|
|
491
|
+
video: "aspect-video",
|
|
492
|
+
square: "aspect-square",
|
|
493
|
+
wide: "aspect-[21/9]",
|
|
494
|
+
auto: ""
|
|
495
|
+
};
|
|
496
|
+
var CardMedia = React23__namespace.forwardRef(
|
|
497
|
+
(_a, ref) => {
|
|
498
|
+
var _b = _a, {
|
|
499
|
+
className,
|
|
500
|
+
src,
|
|
501
|
+
alt = "",
|
|
502
|
+
aspectRatio = "video",
|
|
503
|
+
component,
|
|
504
|
+
children
|
|
505
|
+
} = _b, props = __objRest(_b, [
|
|
506
|
+
"className",
|
|
507
|
+
"src",
|
|
508
|
+
"alt",
|
|
509
|
+
"aspectRatio",
|
|
510
|
+
"component",
|
|
511
|
+
"children"
|
|
512
|
+
]);
|
|
513
|
+
const ratioClass = aspectRatio in ASPECT_RATIO_CLASSES ? ASPECT_RATIO_CLASSES[aspectRatio] : "";
|
|
514
|
+
const Component = component || (src && !children ? "img" : "div");
|
|
515
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
516
|
+
"div",
|
|
517
|
+
__spreadProps(__spreadValues({
|
|
518
|
+
ref,
|
|
519
|
+
className: cn(
|
|
520
|
+
"relative w-full overflow-hidden shrink-0",
|
|
521
|
+
ratioClass,
|
|
522
|
+
className
|
|
523
|
+
)
|
|
524
|
+
}, props), {
|
|
525
|
+
children: children ? children : src ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
+
Component,
|
|
527
|
+
{
|
|
528
|
+
src,
|
|
529
|
+
alt,
|
|
530
|
+
className: "w-full h-full object-cover"
|
|
531
|
+
}
|
|
532
|
+
) : null
|
|
533
|
+
})
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
CardMedia.displayName = "CardMedia";
|
|
538
|
+
var CardContent = React23__namespace.forwardRef(
|
|
539
|
+
(_a, ref) => {
|
|
540
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
541
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
+
"div",
|
|
543
|
+
__spreadProps(__spreadValues({
|
|
544
|
+
ref,
|
|
545
|
+
className: cn(
|
|
546
|
+
"px-6 py-4 text-sm text-m3-on-surface-variant flex-1 relative z-1",
|
|
547
|
+
className
|
|
548
|
+
)
|
|
549
|
+
}, props), {
|
|
550
|
+
children
|
|
551
|
+
})
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
CardContent.displayName = "CardContent";
|
|
556
|
+
var ALIGN_CLASSES = {
|
|
557
|
+
start: "justify-start",
|
|
558
|
+
center: "justify-center",
|
|
559
|
+
end: "justify-end",
|
|
560
|
+
between: "justify-between"
|
|
561
|
+
};
|
|
562
|
+
var CardFooter = React23__namespace.forwardRef(
|
|
563
|
+
(_a, ref) => {
|
|
564
|
+
var _b = _a, { className, align = "end", children } = _b, props = __objRest(_b, ["className", "align", "children"]);
|
|
565
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
566
|
+
"div",
|
|
567
|
+
__spreadProps(__spreadValues({
|
|
568
|
+
ref,
|
|
569
|
+
className: cn(
|
|
570
|
+
"flex items-center gap-2 px-6 pb-6 pt-2 relative z-1",
|
|
571
|
+
ALIGN_CLASSES[align],
|
|
572
|
+
className
|
|
573
|
+
)
|
|
574
|
+
}, props), {
|
|
575
|
+
children
|
|
576
|
+
})
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
);
|
|
580
|
+
CardFooter.displayName = "CardFooter";
|
|
581
|
+
function CarouselGrid(_a) {
|
|
582
|
+
var _b = _a, {
|
|
583
|
+
children,
|
|
584
|
+
items,
|
|
585
|
+
renderItem,
|
|
586
|
+
preferredItemWidth = 240,
|
|
587
|
+
className,
|
|
588
|
+
style
|
|
589
|
+
} = _b, props = __objRest(_b, [
|
|
590
|
+
"children",
|
|
591
|
+
"items",
|
|
592
|
+
"renderItem",
|
|
593
|
+
"preferredItemWidth",
|
|
594
|
+
"className",
|
|
595
|
+
"style"
|
|
596
|
+
]);
|
|
597
|
+
const gridStyle = __spreadValues({
|
|
598
|
+
display: "grid",
|
|
599
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${preferredItemWidth}px, 1fr))`,
|
|
600
|
+
gap: "8px",
|
|
601
|
+
padding: "8px 16px",
|
|
602
|
+
width: "100%",
|
|
603
|
+
boxSizing: "border-box"
|
|
604
|
+
}, style);
|
|
605
|
+
const itemStyle = {
|
|
606
|
+
position: "relative",
|
|
607
|
+
width: "100%",
|
|
608
|
+
minHeight: "180px",
|
|
609
|
+
borderRadius: "28px",
|
|
610
|
+
overflow: "hidden"
|
|
611
|
+
};
|
|
612
|
+
if (items && renderItem) {
|
|
613
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
614
|
+
"section",
|
|
615
|
+
__spreadProps(__spreadValues({
|
|
616
|
+
className,
|
|
617
|
+
style: gridStyle,
|
|
618
|
+
"aria-label": "Expanded carousel grid"
|
|
619
|
+
}, props), {
|
|
620
|
+
children: items.map((item, index) => {
|
|
621
|
+
const itemKey = typeof item === "object" && item !== null && "id" in item ? item.id : typeof item === "object" && item !== null && "key" in item ? item.key : index;
|
|
622
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: itemStyle, children: renderItem(item, index) }, itemKey);
|
|
623
|
+
})
|
|
624
|
+
})
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
628
|
+
"section",
|
|
629
|
+
__spreadProps(__spreadValues({
|
|
630
|
+
className,
|
|
631
|
+
style: gridStyle,
|
|
632
|
+
"aria-label": "Expanded carousel grid"
|
|
633
|
+
}, props), {
|
|
634
|
+
children: React23__namespace.Children.map(children, (child, index) => {
|
|
635
|
+
const childKey = React23__namespace.isValidElement(child) && child.key != null ? child.key : index;
|
|
636
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: itemStyle, children: child }, childKey);
|
|
637
|
+
})
|
|
638
|
+
})
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
var CarouselItem = React23__namespace.forwardRef(
|
|
642
|
+
function CarouselItem2(_a, ref) {
|
|
643
|
+
var _b = _a, {
|
|
644
|
+
index,
|
|
645
|
+
totalItems,
|
|
646
|
+
layout = "multi-browse",
|
|
647
|
+
width,
|
|
648
|
+
minContentWidth,
|
|
649
|
+
maskClipPercent = 0,
|
|
650
|
+
parallaxOffset = 0,
|
|
651
|
+
isFocused = false,
|
|
652
|
+
isScrolling = false,
|
|
653
|
+
disabled = false,
|
|
654
|
+
className,
|
|
655
|
+
style,
|
|
656
|
+
children,
|
|
657
|
+
onClick,
|
|
658
|
+
onPointerDown
|
|
659
|
+
} = _b, props = __objRest(_b, [
|
|
660
|
+
"index",
|
|
661
|
+
"totalItems",
|
|
662
|
+
"layout",
|
|
663
|
+
"width",
|
|
664
|
+
"minContentWidth",
|
|
665
|
+
"maskClipPercent",
|
|
666
|
+
"parallaxOffset",
|
|
667
|
+
"isFocused",
|
|
668
|
+
"isScrolling",
|
|
669
|
+
"disabled",
|
|
670
|
+
"className",
|
|
671
|
+
"style",
|
|
672
|
+
"children",
|
|
673
|
+
"onClick",
|
|
674
|
+
"onPointerDown"
|
|
675
|
+
]);
|
|
676
|
+
const {
|
|
677
|
+
ripples,
|
|
678
|
+
onPointerDown: handleRipplePointerDown,
|
|
679
|
+
removeRipple
|
|
680
|
+
} = useRippleState();
|
|
681
|
+
const itemNumber = index + 1;
|
|
682
|
+
const ariaLabel = props["aria-label"] || `Item ${itemNumber} of ${totalItems}`;
|
|
683
|
+
const isFullScreen = layout === "full-screen";
|
|
684
|
+
const isCenterHero = layout === "center-aligned-hero";
|
|
685
|
+
const combinedStyle = __spreadValues({
|
|
686
|
+
width: isFullScreen ? "100%" : width ? `${width}px` : void 0,
|
|
687
|
+
height: isFullScreen ? "100%" : void 0,
|
|
688
|
+
flexShrink: 0
|
|
689
|
+
}, style);
|
|
690
|
+
const handlePointerDown = (e) => {
|
|
691
|
+
if (!disabled) {
|
|
692
|
+
handleRipplePointerDown(e);
|
|
693
|
+
}
|
|
694
|
+
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
695
|
+
};
|
|
696
|
+
const handleKeyDown = (e) => {
|
|
697
|
+
var _a2;
|
|
698
|
+
if (!disabled && (e.key === "Enter" || e.key === " ")) {
|
|
699
|
+
e.preventDefault();
|
|
700
|
+
onClick == null ? void 0 : onClick(e);
|
|
701
|
+
}
|
|
702
|
+
(_a2 = props.onKeyDown) == null ? void 0 : _a2.call(props, e);
|
|
703
|
+
};
|
|
704
|
+
return (
|
|
705
|
+
// biome-ignore lint/a11y/useSemanticElements: ARIA carousel pattern requires role="group" for slide items
|
|
706
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
707
|
+
"div",
|
|
708
|
+
__spreadProps(__spreadValues({
|
|
709
|
+
ref,
|
|
710
|
+
role: "group",
|
|
711
|
+
"aria-roledescription": "slide",
|
|
712
|
+
"aria-label": ariaLabel,
|
|
713
|
+
tabIndex: disabled ? -1 : isFocused ? 0 : -1,
|
|
714
|
+
className: cn(
|
|
715
|
+
// Base item styles: overflow-hidden + rounded 28px acts as MD3 keyline mask
|
|
716
|
+
"relative flex flex-col overflow-hidden rounded-[28px] cursor-pointer select-none box-border outline-none shrink-0",
|
|
717
|
+
// GPU Composition & Layout Containment
|
|
718
|
+
"will-change-[transform,clip-path] contain-[layout_paint_style] [user-select:none] [-webkit-user-drag:none] [&_img]:pointer-events-none [&_img]:select-none [&_img]:[-webkit-user-drag:none]",
|
|
719
|
+
// Scroll snap: center-aligned hero snaps to center, all others snap start
|
|
720
|
+
isCenterHero ? "snap-center" : "snap-start",
|
|
721
|
+
// Full-screen: no rounding, fill height
|
|
722
|
+
isFullScreen && "rounded-none",
|
|
723
|
+
// State layers via ::after pseudo-element
|
|
724
|
+
"after:absolute after:inset-0 after:rounded-[inherit] after:bg-black after:opacity-0 after:pointer-events-none after:z-2 after:transition-opacity after:duration-150 after:motion-reduce:transition-none",
|
|
725
|
+
"hover:after:opacity-[0.08]",
|
|
726
|
+
"active:after:opacity-[0.10]",
|
|
727
|
+
// Focus ring
|
|
728
|
+
"focus-visible:outline-[3px] focus-visible:outline-(--md-sys-color-secondary,#625b71) focus-visible:outline-offset-2 focus-visible:z-3",
|
|
729
|
+
// Disabled
|
|
730
|
+
disabled && "opacity-[0.38] pointer-events-none",
|
|
731
|
+
className
|
|
732
|
+
),
|
|
733
|
+
style: combinedStyle,
|
|
734
|
+
onPointerDown: handlePointerDown,
|
|
735
|
+
onKeyDown: handleKeyDown,
|
|
736
|
+
onClick: disabled ? void 0 : onClick
|
|
737
|
+
}, props), {
|
|
738
|
+
children: [
|
|
739
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
740
|
+
"div",
|
|
741
|
+
{
|
|
742
|
+
className: "w-full flex-1 flex flex-col will-change-transform select-none",
|
|
743
|
+
style: {
|
|
744
|
+
width: isFullScreen ? "100%" : minContentWidth ? `${minContentWidth}px` : "100%",
|
|
745
|
+
minWidth: isFullScreen ? "100%" : minContentWidth ? `${minContentWidth}px` : void 0,
|
|
746
|
+
transform: parallaxOffset !== 0 ? `translateX(${parallaxOffset}px)` : void 0
|
|
747
|
+
},
|
|
748
|
+
children
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ripple, { ripples, onRippleDone: removeRipple })
|
|
752
|
+
]
|
|
753
|
+
})
|
|
754
|
+
)
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
CarouselItem.displayName = "CarouselItem";
|
|
759
|
+
function useCarouselA11y({
|
|
760
|
+
totalItems,
|
|
761
|
+
onItemSelect,
|
|
762
|
+
onExitNavigation,
|
|
763
|
+
scrollToIndex
|
|
764
|
+
}) {
|
|
765
|
+
const [focusedIndex, setFocusedIndex] = React23.useState(0);
|
|
766
|
+
const handleKeyDown = React23.useCallback(
|
|
767
|
+
(event) => {
|
|
768
|
+
if (totalItems === 0) return;
|
|
769
|
+
switch (event.key) {
|
|
770
|
+
case "ArrowRight":
|
|
771
|
+
case "ArrowDown": {
|
|
772
|
+
if (event.key === "ArrowDown" && onExitNavigation) {
|
|
773
|
+
onExitNavigation();
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
event.preventDefault();
|
|
777
|
+
setFocusedIndex((prev) => {
|
|
778
|
+
const next = Math.min(totalItems - 1, prev + 1);
|
|
779
|
+
scrollToIndex == null ? void 0 : scrollToIndex(next);
|
|
780
|
+
return next;
|
|
781
|
+
});
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
case "ArrowLeft":
|
|
785
|
+
case "ArrowUp": {
|
|
786
|
+
if (event.key === "ArrowUp" && onExitNavigation) {
|
|
787
|
+
onExitNavigation();
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
event.preventDefault();
|
|
791
|
+
setFocusedIndex((prev) => {
|
|
792
|
+
const next = Math.max(0, prev - 1);
|
|
793
|
+
scrollToIndex == null ? void 0 : scrollToIndex(next);
|
|
794
|
+
return next;
|
|
795
|
+
});
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
case "Home": {
|
|
799
|
+
event.preventDefault();
|
|
800
|
+
setFocusedIndex(0);
|
|
801
|
+
scrollToIndex == null ? void 0 : scrollToIndex(0);
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
case "End": {
|
|
805
|
+
event.preventDefault();
|
|
806
|
+
const lastIndex = totalItems - 1;
|
|
807
|
+
setFocusedIndex(lastIndex);
|
|
808
|
+
scrollToIndex == null ? void 0 : scrollToIndex(lastIndex);
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
case " ":
|
|
812
|
+
case "Enter": {
|
|
813
|
+
event.preventDefault();
|
|
814
|
+
onItemSelect == null ? void 0 : onItemSelect(focusedIndex);
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
[totalItems, focusedIndex, onItemSelect, onExitNavigation, scrollToIndex]
|
|
820
|
+
);
|
|
821
|
+
const getItemA11yProps = React23.useCallback(
|
|
822
|
+
(index, customLabel) => {
|
|
823
|
+
const itemNumber = index + 1;
|
|
824
|
+
const defaultLabel = `Item ${itemNumber} of ${totalItems}`;
|
|
825
|
+
return {
|
|
826
|
+
role: "group",
|
|
827
|
+
"aria-roledescription": "slide",
|
|
828
|
+
"aria-label": customLabel ? `${customLabel} (${itemNumber} of ${totalItems})` : defaultLabel,
|
|
829
|
+
tabIndex: index === focusedIndex ? 0 : -1,
|
|
830
|
+
onFocus: () => setFocusedIndex(index)
|
|
831
|
+
};
|
|
832
|
+
},
|
|
833
|
+
[focusedIndex, totalItems]
|
|
834
|
+
);
|
|
835
|
+
return {
|
|
836
|
+
focusedIndex,
|
|
837
|
+
setFocusedIndex,
|
|
838
|
+
handleKeyDown,
|
|
839
|
+
getItemA11yProps
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// src/ui/carousel/carousel.tokens.ts
|
|
844
|
+
var CarouselTokens = {
|
|
845
|
+
/** Corner radius shape (M3 extraLarge shape: 28dp) */
|
|
846
|
+
containerRadius: 28,
|
|
847
|
+
/** Small item dimension limits (dp) */
|
|
848
|
+
smallItemMin: 40,
|
|
849
|
+
smallItemMax: 56,
|
|
850
|
+
/** Layout defaults (dp) */
|
|
851
|
+
itemSpacing: 8,
|
|
852
|
+
contentPadding: 16,
|
|
853
|
+
verticalPadding: 8,
|
|
854
|
+
/** Interactive state overlays */
|
|
855
|
+
hoverOpacity: 0.08,
|
|
856
|
+
focusOpacity: 0.1,
|
|
857
|
+
pressedOpacity: 0.1,
|
|
858
|
+
disabledOpacity: 0.38,
|
|
859
|
+
/** Focus indicator dimensions */
|
|
860
|
+
focusThickness: 3,
|
|
861
|
+
focusOffset: 2,
|
|
862
|
+
/** Touch target minimum size for accessibility (WCAG 2.1 AAA / M3) */
|
|
863
|
+
minTouchTargetSize: 48,
|
|
864
|
+
/** CSS Custom Property token maps for fallback and runtime injection */
|
|
865
|
+
cssVars: {
|
|
866
|
+
shape: "--carousel-item-shape",
|
|
867
|
+
spacing: "--carousel-item-spacing",
|
|
868
|
+
contentPadding: "--carousel-content-padding",
|
|
869
|
+
verticalPadding: "--carousel-vertical-padding",
|
|
870
|
+
smallMin: "--carousel-small-item-min",
|
|
871
|
+
smallMax: "--carousel-small-item-max",
|
|
872
|
+
hoverOpacity: "--carousel-hover-opacity",
|
|
873
|
+
focusThickness: "--carousel-focus-thickness",
|
|
874
|
+
focusOffset: "--carousel-focus-offset",
|
|
875
|
+
pressedOpacity: "--carousel-pressed-opacity",
|
|
876
|
+
disabledOpacity: "--carousel-disabled-opacity"
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
// src/ui/carousel/hooks/useCarouselKeylines.ts
|
|
881
|
+
function useCarouselKeylines({
|
|
882
|
+
containerWidth,
|
|
883
|
+
preferredItemWidth = 300,
|
|
884
|
+
layout = "multi-browse",
|
|
885
|
+
itemSpacing = CarouselTokens.itemSpacing,
|
|
886
|
+
contentPadding = CarouselTokens.contentPadding,
|
|
887
|
+
totalItems,
|
|
888
|
+
scrollX: _scrollX = 0
|
|
889
|
+
}) {
|
|
890
|
+
return React23.useMemo(() => {
|
|
891
|
+
const safeContainerWidth = Math.max(containerWidth, 100);
|
|
892
|
+
const smallWidth = Math.min(
|
|
893
|
+
Math.max(
|
|
894
|
+
CarouselTokens.smallItemMin,
|
|
895
|
+
Math.round(safeContainerWidth * 0.1)
|
|
896
|
+
),
|
|
897
|
+
CarouselTokens.smallItemMax
|
|
898
|
+
);
|
|
899
|
+
let largeWidth = preferredItemWidth;
|
|
900
|
+
let mediumWidth = Math.round(preferredItemWidth * 0.65);
|
|
901
|
+
switch (layout) {
|
|
902
|
+
case "hero": {
|
|
903
|
+
const availableWidth = safeContainerWidth - contentPadding * 2 - smallWidth - itemSpacing;
|
|
904
|
+
largeWidth = Math.max(160, availableWidth);
|
|
905
|
+
mediumWidth = largeWidth;
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
case "center-aligned-hero": {
|
|
909
|
+
const availableWidth = safeContainerWidth - contentPadding * 2 - smallWidth * 2 - itemSpacing * 2;
|
|
910
|
+
largeWidth = Math.max(160, availableWidth);
|
|
911
|
+
mediumWidth = largeWidth;
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
case "uncontained":
|
|
915
|
+
case "uncontained-multi-aspect": {
|
|
916
|
+
largeWidth = Math.min(
|
|
917
|
+
preferredItemWidth,
|
|
918
|
+
safeContainerWidth - contentPadding * 2
|
|
919
|
+
);
|
|
920
|
+
mediumWidth = largeWidth;
|
|
921
|
+
break;
|
|
922
|
+
}
|
|
923
|
+
case "full-screen": {
|
|
924
|
+
largeWidth = safeContainerWidth;
|
|
925
|
+
mediumWidth = safeContainerWidth;
|
|
926
|
+
break;
|
|
927
|
+
}
|
|
928
|
+
default: {
|
|
929
|
+
const maxLargeWidth = safeContainerWidth - contentPadding * 2 - smallWidth - itemSpacing;
|
|
930
|
+
largeWidth = Math.min(preferredItemWidth, Math.max(160, maxLargeWidth));
|
|
931
|
+
mediumWidth = Math.max(smallWidth + 16, Math.round(largeWidth * 0.65));
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
const keylines = [];
|
|
936
|
+
if (layout === "hero") {
|
|
937
|
+
const smallMask = Math.max(
|
|
938
|
+
0,
|
|
939
|
+
Math.min(
|
|
940
|
+
100,
|
|
941
|
+
Math.round((largeWidth - smallWidth) / largeWidth * 100)
|
|
942
|
+
)
|
|
943
|
+
);
|
|
944
|
+
keylines.push(
|
|
945
|
+
{
|
|
946
|
+
offset: contentPadding,
|
|
947
|
+
width: largeWidth,
|
|
948
|
+
type: "large",
|
|
949
|
+
maskClip: 0
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
offset: contentPadding + largeWidth + itemSpacing,
|
|
953
|
+
width: smallWidth,
|
|
954
|
+
type: "small",
|
|
955
|
+
maskClip: smallMask
|
|
956
|
+
}
|
|
957
|
+
);
|
|
958
|
+
} else if (layout === "center-aligned-hero") {
|
|
959
|
+
const smallMask = Math.max(
|
|
960
|
+
0,
|
|
961
|
+
Math.min(
|
|
962
|
+
100,
|
|
963
|
+
Math.round((largeWidth - smallWidth) / largeWidth * 100)
|
|
964
|
+
)
|
|
965
|
+
);
|
|
966
|
+
keylines.push(
|
|
967
|
+
{
|
|
968
|
+
offset: contentPadding,
|
|
969
|
+
width: smallWidth,
|
|
970
|
+
type: "small",
|
|
971
|
+
maskClip: smallMask
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
offset: contentPadding + smallWidth + itemSpacing,
|
|
975
|
+
width: largeWidth,
|
|
976
|
+
type: "large",
|
|
977
|
+
maskClip: 0
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
offset: contentPadding + smallWidth + itemSpacing + largeWidth + itemSpacing,
|
|
981
|
+
width: smallWidth,
|
|
982
|
+
type: "small",
|
|
983
|
+
maskClip: smallMask
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
} else if (layout === "multi-browse") {
|
|
987
|
+
const mediumMask = Math.max(
|
|
988
|
+
0,
|
|
989
|
+
Math.min(
|
|
990
|
+
100,
|
|
991
|
+
Math.round((largeWidth - mediumWidth) / largeWidth * 100)
|
|
992
|
+
)
|
|
993
|
+
);
|
|
994
|
+
const smallMask = Math.max(
|
|
995
|
+
0,
|
|
996
|
+
Math.min(
|
|
997
|
+
100,
|
|
998
|
+
Math.round((largeWidth - smallWidth) / largeWidth * 100)
|
|
999
|
+
)
|
|
1000
|
+
);
|
|
1001
|
+
const availableWidth = safeContainerWidth - contentPadding * 2;
|
|
1002
|
+
const numLarge = Math.max(
|
|
1003
|
+
1,
|
|
1004
|
+
Math.floor((availableWidth + itemSpacing) / (largeWidth + itemSpacing))
|
|
1005
|
+
);
|
|
1006
|
+
let offset = contentPadding;
|
|
1007
|
+
for (let k = 0; k < numLarge; k++) {
|
|
1008
|
+
keylines.push({
|
|
1009
|
+
offset,
|
|
1010
|
+
width: largeWidth,
|
|
1011
|
+
type: "large",
|
|
1012
|
+
maskClip: 0
|
|
1013
|
+
});
|
|
1014
|
+
offset += largeWidth + itemSpacing;
|
|
1015
|
+
}
|
|
1016
|
+
keylines.push({
|
|
1017
|
+
offset,
|
|
1018
|
+
width: mediumWidth,
|
|
1019
|
+
type: "medium",
|
|
1020
|
+
maskClip: mediumMask
|
|
1021
|
+
});
|
|
1022
|
+
offset += mediumWidth + itemSpacing;
|
|
1023
|
+
keylines.push({
|
|
1024
|
+
offset,
|
|
1025
|
+
width: smallWidth,
|
|
1026
|
+
type: "small",
|
|
1027
|
+
maskClip: smallMask
|
|
1028
|
+
});
|
|
1029
|
+
} else {
|
|
1030
|
+
keylines.push({
|
|
1031
|
+
offset: contentPadding,
|
|
1032
|
+
width: largeWidth,
|
|
1033
|
+
type: "large",
|
|
1034
|
+
maskClip: 0
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
const getItemRestWidth = (i) => {
|
|
1038
|
+
if (layout === "full-screen") return safeContainerWidth;
|
|
1039
|
+
if (layout === "uncontained") return largeWidth;
|
|
1040
|
+
if (layout === "uncontained-multi-aspect") {
|
|
1041
|
+
const ratios = [1.77, 1.33, 1, 0.56];
|
|
1042
|
+
const ratio = ratios[i % ratios.length];
|
|
1043
|
+
return Math.round(Math.min(largeWidth, 220 * ratio));
|
|
1044
|
+
}
|
|
1045
|
+
if (layout === "hero") return i === 0 ? largeWidth : smallWidth;
|
|
1046
|
+
if (layout === "center-aligned-hero")
|
|
1047
|
+
return i === 0 || i === totalItems - 1 ? smallWidth : largeWidth;
|
|
1048
|
+
const pattern = [largeWidth, largeWidth, mediumWidth, smallWidth];
|
|
1049
|
+
return pattern[i % pattern.length];
|
|
1050
|
+
};
|
|
1051
|
+
const snapPositions = [];
|
|
1052
|
+
let currentOffset = 0;
|
|
1053
|
+
const itemLayoutWidth = layout === "full-screen" ? safeContainerWidth : largeWidth;
|
|
1054
|
+
for (let i = 0; i < totalItems; i++) {
|
|
1055
|
+
snapPositions.push(currentOffset);
|
|
1056
|
+
currentOffset += itemLayoutWidth + itemSpacing;
|
|
1057
|
+
}
|
|
1058
|
+
const getItemWidth = (_index) => {
|
|
1059
|
+
if (layout === "full-screen") return safeContainerWidth;
|
|
1060
|
+
return largeWidth;
|
|
1061
|
+
};
|
|
1062
|
+
const getItemMaskClip = (index) => {
|
|
1063
|
+
if (layout === "full-screen" || layout === "uncontained" || layout === "uncontained-multi-aspect") {
|
|
1064
|
+
return 0;
|
|
1065
|
+
}
|
|
1066
|
+
const itemW = getItemRestWidth(index);
|
|
1067
|
+
if (itemW >= largeWidth || largeWidth <= 0) return 0;
|
|
1068
|
+
return Math.max(
|
|
1069
|
+
0,
|
|
1070
|
+
Math.min(100, Math.round((largeWidth - itemW) / largeWidth * 100))
|
|
1071
|
+
);
|
|
1072
|
+
};
|
|
1073
|
+
const getItemParallaxOffset = (index) => {
|
|
1074
|
+
const maskClip = getItemMaskClip(index);
|
|
1075
|
+
if (maskClip <= 0) return 0;
|
|
1076
|
+
return calculateParallaxOffset(0, maskClip, largeWidth);
|
|
1077
|
+
};
|
|
1078
|
+
let maxAccumulatedShift = 0;
|
|
1079
|
+
if (layout === "hero") {
|
|
1080
|
+
maxAccumulatedShift = Math.max(
|
|
1081
|
+
0,
|
|
1082
|
+
(totalItems - 1) * (largeWidth - smallWidth)
|
|
1083
|
+
);
|
|
1084
|
+
} else if (layout === "center-aligned-hero") {
|
|
1085
|
+
maxAccumulatedShift = Math.max(
|
|
1086
|
+
0,
|
|
1087
|
+
Math.min(totalItems, 2) * (largeWidth - smallWidth)
|
|
1088
|
+
);
|
|
1089
|
+
} else if (layout === "multi-browse") {
|
|
1090
|
+
const availableWidth = safeContainerWidth - contentPadding * 2;
|
|
1091
|
+
const numLarge = Math.max(
|
|
1092
|
+
1,
|
|
1093
|
+
Math.floor((availableWidth + itemSpacing) / (largeWidth + itemSpacing))
|
|
1094
|
+
);
|
|
1095
|
+
const nonLargeItems = Math.max(0, totalItems - numLarge);
|
|
1096
|
+
if (nonLargeItems > 0) {
|
|
1097
|
+
const mediumClipped = largeWidth - mediumWidth;
|
|
1098
|
+
const smallClipped = largeWidth - smallWidth;
|
|
1099
|
+
const numSmall = Math.max(0, nonLargeItems - 1);
|
|
1100
|
+
maxAccumulatedShift = mediumClipped + numSmall * smallClipped;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
return {
|
|
1104
|
+
largeWidth,
|
|
1105
|
+
mediumWidth,
|
|
1106
|
+
smallWidth,
|
|
1107
|
+
keylines,
|
|
1108
|
+
snapPositions,
|
|
1109
|
+
maxAccumulatedShift,
|
|
1110
|
+
getItemWidth,
|
|
1111
|
+
getItemMaskClip,
|
|
1112
|
+
getItemParallaxOffset
|
|
1113
|
+
};
|
|
1114
|
+
}, [
|
|
1115
|
+
containerWidth,
|
|
1116
|
+
preferredItemWidth,
|
|
1117
|
+
layout,
|
|
1118
|
+
itemSpacing,
|
|
1119
|
+
contentPadding,
|
|
1120
|
+
totalItems
|
|
1121
|
+
]);
|
|
1122
|
+
}
|
|
1123
|
+
function calculateMaskClipForOffset(itemLeftInViewport, containerWidth, largeWidth, mediumWidth, smallWidth, contentPadding = 16, layout = "multi-browse") {
|
|
1124
|
+
if (layout === "full-screen" || layout === "uncontained" || layout === "uncontained-multi-aspect" || largeWidth <= 0) {
|
|
1125
|
+
return 0;
|
|
1126
|
+
}
|
|
1127
|
+
const mediumMask = Math.max(
|
|
1128
|
+
0,
|
|
1129
|
+
Math.min(100, (largeWidth - mediumWidth) / largeWidth * 100)
|
|
1130
|
+
);
|
|
1131
|
+
const smallMask = Math.max(
|
|
1132
|
+
0,
|
|
1133
|
+
Math.min(100, (largeWidth - smallWidth) / largeWidth * 100)
|
|
1134
|
+
);
|
|
1135
|
+
const trailingFocalThreshold = containerWidth - contentPadding - mediumWidth - (largeWidth - mediumWidth);
|
|
1136
|
+
const trailingMediumThreshold = containerWidth - contentPadding - smallWidth;
|
|
1137
|
+
const trailingEndThreshold = containerWidth - contentPadding;
|
|
1138
|
+
const leadingThreshold = contentPadding;
|
|
1139
|
+
if (itemLeftInViewport < leadingThreshold) {
|
|
1140
|
+
const dist = leadingThreshold - itemLeftInViewport;
|
|
1141
|
+
const progress = Math.min(1, Math.max(0, dist / largeWidth));
|
|
1142
|
+
return Math.min(100, Math.max(0, progress * smallMask));
|
|
1143
|
+
}
|
|
1144
|
+
if (itemLeftInViewport > trailingFocalThreshold) {
|
|
1145
|
+
if (itemLeftInViewport < trailingMediumThreshold) {
|
|
1146
|
+
const range2 = Math.max(
|
|
1147
|
+
1,
|
|
1148
|
+
trailingMediumThreshold - trailingFocalThreshold
|
|
1149
|
+
);
|
|
1150
|
+
const progress2 = Math.min(
|
|
1151
|
+
1,
|
|
1152
|
+
Math.max(0, (itemLeftInViewport - trailingFocalThreshold) / range2)
|
|
1153
|
+
);
|
|
1154
|
+
return progress2 * mediumMask;
|
|
1155
|
+
}
|
|
1156
|
+
const range = Math.max(1, trailingEndThreshold - trailingMediumThreshold);
|
|
1157
|
+
const progress = Math.min(
|
|
1158
|
+
1,
|
|
1159
|
+
Math.max(0, (itemLeftInViewport - trailingMediumThreshold) / range)
|
|
1160
|
+
);
|
|
1161
|
+
return mediumMask + progress * (smallMask - mediumMask);
|
|
1162
|
+
}
|
|
1163
|
+
return 0;
|
|
1164
|
+
}
|
|
1165
|
+
function calculateParallaxOffset(_itemLeftInViewport, maskClipPercent, largeWidth) {
|
|
1166
|
+
if (maskClipPercent <= 0 || largeWidth <= 0) return 0;
|
|
1167
|
+
return -Math.round(maskClipPercent / 100 * (largeWidth * 0.2));
|
|
1168
|
+
}
|
|
1169
|
+
function CarouselScrollClient(_a) {
|
|
1170
|
+
var _b = _a, {
|
|
1171
|
+
children,
|
|
1172
|
+
items,
|
|
1173
|
+
renderItem,
|
|
1174
|
+
layout = "multi-browse",
|
|
1175
|
+
preferredItemWidth = 300,
|
|
1176
|
+
itemSpacing = 8,
|
|
1177
|
+
contentPadding = 16,
|
|
1178
|
+
verticalPadding = 8,
|
|
1179
|
+
userScrollEnabled = true,
|
|
1180
|
+
totalItemsCount,
|
|
1181
|
+
className,
|
|
1182
|
+
style
|
|
1183
|
+
} = _b, props = __objRest(_b, [
|
|
1184
|
+
"children",
|
|
1185
|
+
"items",
|
|
1186
|
+
"renderItem",
|
|
1187
|
+
"layout",
|
|
1188
|
+
"preferredItemWidth",
|
|
1189
|
+
"itemSpacing",
|
|
1190
|
+
"contentPadding",
|
|
1191
|
+
"verticalPadding",
|
|
1192
|
+
"userScrollEnabled",
|
|
1193
|
+
"totalItemsCount",
|
|
1194
|
+
"className",
|
|
1195
|
+
"style"
|
|
1196
|
+
]);
|
|
1197
|
+
const trackRef = React23__namespace.useRef(null);
|
|
1198
|
+
const [containerWidth, setContainerWidth] = React23__namespace.useState(600);
|
|
1199
|
+
const rafIdRef = React23__namespace.useRef(null);
|
|
1200
|
+
const isDraggingRef = React23__namespace.useRef(false);
|
|
1201
|
+
const hasMovedRef = React23__namespace.useRef(false);
|
|
1202
|
+
const startPosRef = React23__namespace.useRef(0);
|
|
1203
|
+
const startScrollRef = React23__namespace.useRef(0);
|
|
1204
|
+
const keylines = useCarouselKeylines({
|
|
1205
|
+
containerWidth,
|
|
1206
|
+
preferredItemWidth,
|
|
1207
|
+
layout,
|
|
1208
|
+
itemSpacing,
|
|
1209
|
+
contentPadding,
|
|
1210
|
+
totalItems: totalItemsCount
|
|
1211
|
+
});
|
|
1212
|
+
const handleScroll = React23__namespace.useCallback(() => {
|
|
1213
|
+
if (rafIdRef.current !== null) return;
|
|
1214
|
+
rafIdRef.current = requestAnimationFrame(() => {
|
|
1215
|
+
var _a2, _b2;
|
|
1216
|
+
const track = trackRef.current;
|
|
1217
|
+
if (track) {
|
|
1218
|
+
const scrollVal = layout === "full-screen" ? track.scrollTop : track.scrollLeft;
|
|
1219
|
+
track.style.setProperty("--carousel-scroll-left", `${scrollVal}px`);
|
|
1220
|
+
if (layout !== "full-screen") {
|
|
1221
|
+
const prefersReducedMotion = typeof window !== "undefined" && ((_b2 = (_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, "(prefers-reduced-motion: reduce)")) == null ? void 0 : _b2.matches);
|
|
1222
|
+
let accumulatedShift = 0;
|
|
1223
|
+
const items2 = track.children;
|
|
1224
|
+
for (let i = 0; i < items2.length; i++) {
|
|
1225
|
+
const itemEl = items2[i];
|
|
1226
|
+
if (!itemEl || itemEl.getAttribute("role") !== "group") continue;
|
|
1227
|
+
if (prefersReducedMotion) {
|
|
1228
|
+
itemEl.style.clipPath = "none";
|
|
1229
|
+
itemEl.style.transform = "none";
|
|
1230
|
+
const innerContent2 = itemEl.firstElementChild;
|
|
1231
|
+
if (innerContent2) innerContent2.style.transform = "none";
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
const nativeOffset = itemEl.offsetLeft - scrollVal;
|
|
1235
|
+
const visualOffset = nativeOffset - accumulatedShift;
|
|
1236
|
+
const maskPercent = calculateMaskClipForOffset(
|
|
1237
|
+
visualOffset,
|
|
1238
|
+
containerWidth,
|
|
1239
|
+
keylines.largeWidth,
|
|
1240
|
+
keylines.mediumWidth,
|
|
1241
|
+
keylines.smallWidth,
|
|
1242
|
+
contentPadding,
|
|
1243
|
+
layout
|
|
1244
|
+
);
|
|
1245
|
+
const clippedPixels = maskPercent / 100 * keylines.largeWidth;
|
|
1246
|
+
itemEl.style.transform = accumulatedShift > 0 ? `translateX(${-accumulatedShift}px)` : "none";
|
|
1247
|
+
itemEl.style.clipPath = maskPercent > 0 ? `inset(0px ${maskPercent}% 0px 0px round 28px)` : "none";
|
|
1248
|
+
const innerContent = itemEl.firstElementChild;
|
|
1249
|
+
if (innerContent) {
|
|
1250
|
+
const parallaxX = calculateParallaxOffset(
|
|
1251
|
+
visualOffset,
|
|
1252
|
+
maskPercent,
|
|
1253
|
+
keylines.largeWidth
|
|
1254
|
+
);
|
|
1255
|
+
innerContent.style.transform = parallaxX !== 0 ? `translateX(${parallaxX}px)` : "none";
|
|
1256
|
+
}
|
|
1257
|
+
accumulatedShift += clippedPixels;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
rafIdRef.current = null;
|
|
1262
|
+
});
|
|
1263
|
+
}, [
|
|
1264
|
+
layout,
|
|
1265
|
+
containerWidth,
|
|
1266
|
+
keylines.largeWidth,
|
|
1267
|
+
keylines.mediumWidth,
|
|
1268
|
+
keylines.smallWidth,
|
|
1269
|
+
contentPadding
|
|
1270
|
+
]);
|
|
1271
|
+
React23__namespace.useEffect(() => {
|
|
1272
|
+
const track = trackRef.current;
|
|
1273
|
+
if (!track) return;
|
|
1274
|
+
const updateWidth = () => {
|
|
1275
|
+
if (track.clientWidth > 0) {
|
|
1276
|
+
setContainerWidth(track.clientWidth);
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
updateWidth();
|
|
1280
|
+
const observer = new ResizeObserver(updateWidth);
|
|
1281
|
+
observer.observe(track);
|
|
1282
|
+
return () => observer.disconnect();
|
|
1283
|
+
}, []);
|
|
1284
|
+
React23__namespace.useEffect(() => {
|
|
1285
|
+
handleScroll();
|
|
1286
|
+
}, [handleScroll]);
|
|
1287
|
+
React23__namespace.useEffect(() => {
|
|
1288
|
+
return () => {
|
|
1289
|
+
if (rafIdRef.current !== null) {
|
|
1290
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
1291
|
+
}
|
|
1292
|
+
};
|
|
1293
|
+
}, []);
|
|
1294
|
+
const handlePointerDown = React23__namespace.useCallback(
|
|
1295
|
+
(e) => {
|
|
1296
|
+
var _a2, _b2;
|
|
1297
|
+
if (!userScrollEnabled || e.button !== 0) return;
|
|
1298
|
+
const track = trackRef.current;
|
|
1299
|
+
if (!track) return;
|
|
1300
|
+
isDraggingRef.current = true;
|
|
1301
|
+
hasMovedRef.current = false;
|
|
1302
|
+
startPosRef.current = layout === "full-screen" ? e.clientY : e.clientX;
|
|
1303
|
+
startScrollRef.current = layout === "full-screen" ? track.scrollTop : track.scrollLeft;
|
|
1304
|
+
try {
|
|
1305
|
+
(_b2 = (_a2 = e.target).setPointerCapture) == null ? void 0 : _b2.call(_a2, e.pointerId);
|
|
1306
|
+
} catch (e2) {
|
|
1307
|
+
}
|
|
1308
|
+
},
|
|
1309
|
+
[userScrollEnabled, layout]
|
|
1310
|
+
);
|
|
1311
|
+
const handlePointerMove = React23__namespace.useCallback(
|
|
1312
|
+
(e) => {
|
|
1313
|
+
if (!isDraggingRef.current || !trackRef.current) return;
|
|
1314
|
+
const currentPos = layout === "full-screen" ? e.clientY : e.clientX;
|
|
1315
|
+
const delta = currentPos - startPosRef.current;
|
|
1316
|
+
if (Math.abs(delta) > 4) {
|
|
1317
|
+
hasMovedRef.current = true;
|
|
1318
|
+
}
|
|
1319
|
+
if (hasMovedRef.current) {
|
|
1320
|
+
if (layout === "full-screen") {
|
|
1321
|
+
trackRef.current.scrollTop = startScrollRef.current - delta;
|
|
1322
|
+
} else {
|
|
1323
|
+
trackRef.current.scrollLeft = startScrollRef.current - delta;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
[layout]
|
|
1328
|
+
);
|
|
1329
|
+
const handlePointerUp = React23__namespace.useCallback(
|
|
1330
|
+
(e) => {
|
|
1331
|
+
var _a2, _b2;
|
|
1332
|
+
if (!isDraggingRef.current) return;
|
|
1333
|
+
isDraggingRef.current = false;
|
|
1334
|
+
try {
|
|
1335
|
+
(_b2 = (_a2 = e.target).releasePointerCapture) == null ? void 0 : _b2.call(_a2, e.pointerId);
|
|
1336
|
+
} catch (e2) {
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
[]
|
|
1340
|
+
);
|
|
1341
|
+
const handleClickCapture = React23__namespace.useCallback((e) => {
|
|
1342
|
+
if (hasMovedRef.current) {
|
|
1343
|
+
e.stopPropagation();
|
|
1344
|
+
e.preventDefault();
|
|
1345
|
+
hasMovedRef.current = false;
|
|
1346
|
+
}
|
|
1347
|
+
}, []);
|
|
1348
|
+
const scrollToIndex = React23__namespace.useCallback(
|
|
1349
|
+
(index) => {
|
|
1350
|
+
const track = trackRef.current;
|
|
1351
|
+
if (!track) return;
|
|
1352
|
+
const itemEl = track.children[index];
|
|
1353
|
+
if (!itemEl) return;
|
|
1354
|
+
const targetPos = Math.max(0, itemEl.offsetLeft - contentPadding);
|
|
1355
|
+
track.scrollTo({
|
|
1356
|
+
left: targetPos,
|
|
1357
|
+
behavior: "smooth"
|
|
1358
|
+
});
|
|
1359
|
+
},
|
|
1360
|
+
[contentPadding]
|
|
1361
|
+
);
|
|
1362
|
+
const { focusedIndex, handleKeyDown, getItemA11yProps } = useCarouselA11y({
|
|
1363
|
+
totalItems: totalItemsCount,
|
|
1364
|
+
scrollToIndex
|
|
1365
|
+
});
|
|
1366
|
+
const isFullScreen = layout === "full-screen";
|
|
1367
|
+
const isHero = layout === "hero" || layout === "center-aligned-hero";
|
|
1368
|
+
const trackClasses = cn(
|
|
1369
|
+
// Base layout & GPU containment
|
|
1370
|
+
"relative box-border select-none [contain:layout_style]",
|
|
1371
|
+
userScrollEnabled && "cursor-grab active:cursor-grabbing",
|
|
1372
|
+
// Scrollbar hide
|
|
1373
|
+
"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1374
|
+
// Full-screen: vertical snap column
|
|
1375
|
+
isFullScreen ? "flex flex-col flex-1 min-h-0 overflow-x-hidden overflow-y-auto p-0 gap-0 [scroll-snap-type:y_mandatory] [touch-action:pan-y]" : "flex flex-row items-stretch overflow-x-auto overflow-y-hidden [-webkit-overflow-scrolling:touch] [touch-action:pan-x]",
|
|
1376
|
+
// Snap for hero/center-aligned-hero
|
|
1377
|
+
isHero && !isFullScreen && "[scroll-snap-type:x_mandatory]",
|
|
1378
|
+
// Disabled
|
|
1379
|
+
!userScrollEnabled && "overflow-x-hidden pointer-events-none [touch-action:none]",
|
|
1380
|
+
className
|
|
1381
|
+
);
|
|
1382
|
+
const trackStyle = isFullScreen ? __spreadValues({}, style) : __spreadValues({
|
|
1383
|
+
paddingLeft: `${contentPadding}px`,
|
|
1384
|
+
paddingRight: layout === "uncontained" || layout === "uncontained-multi-aspect" ? 0 : `${contentPadding}px`,
|
|
1385
|
+
scrollPaddingLeft: `${contentPadding}px`,
|
|
1386
|
+
scrollPaddingRight: `${contentPadding}px`,
|
|
1387
|
+
paddingTop: `${verticalPadding}px`,
|
|
1388
|
+
paddingBottom: `${verticalPadding}px`,
|
|
1389
|
+
gap: `${itemSpacing}px`
|
|
1390
|
+
}, style);
|
|
1391
|
+
const renderSlides = () => {
|
|
1392
|
+
if (items && renderItem) {
|
|
1393
|
+
return items.map((item, index) => {
|
|
1394
|
+
const itemWidth = keylines.largeWidth;
|
|
1395
|
+
const maskClip = keylines.getItemMaskClip(index);
|
|
1396
|
+
const parallax = keylines.getItemParallaxOffset(index);
|
|
1397
|
+
const a11yProps = getItemA11yProps(index);
|
|
1398
|
+
const itemKey = typeof item === "object" && item !== null && "id" in item ? item.id : typeof item === "object" && item !== null && "key" in item ? item.key : index;
|
|
1399
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1400
|
+
CarouselItem,
|
|
1401
|
+
__spreadProps(__spreadValues({
|
|
1402
|
+
index,
|
|
1403
|
+
totalItems: totalItemsCount,
|
|
1404
|
+
layout,
|
|
1405
|
+
width: itemWidth,
|
|
1406
|
+
minContentWidth: keylines.largeWidth,
|
|
1407
|
+
maskClipPercent: maskClip,
|
|
1408
|
+
parallaxOffset: parallax,
|
|
1409
|
+
isFocused: focusedIndex === index
|
|
1410
|
+
}, a11yProps), {
|
|
1411
|
+
children: renderItem(item, index)
|
|
1412
|
+
}),
|
|
1413
|
+
itemKey
|
|
1414
|
+
);
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
return React23__namespace.Children.map(children, (child, index) => {
|
|
1418
|
+
if (!React23__namespace.isValidElement(child)) return child;
|
|
1419
|
+
const itemWidth = keylines.largeWidth;
|
|
1420
|
+
const maskClip = keylines.getItemMaskClip(index);
|
|
1421
|
+
const parallax = keylines.getItemParallaxOffset(index);
|
|
1422
|
+
const a11yProps = getItemA11yProps(index);
|
|
1423
|
+
const childKey = child.key != null ? child.key : index;
|
|
1424
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1425
|
+
CarouselItem,
|
|
1426
|
+
__spreadProps(__spreadValues({
|
|
1427
|
+
index,
|
|
1428
|
+
totalItems: totalItemsCount,
|
|
1429
|
+
layout,
|
|
1430
|
+
width: itemWidth,
|
|
1431
|
+
minContentWidth: keylines.largeWidth,
|
|
1432
|
+
maskClipPercent: maskClip,
|
|
1433
|
+
parallaxOffset: parallax,
|
|
1434
|
+
isFocused: focusedIndex === index
|
|
1435
|
+
}, a11yProps), {
|
|
1436
|
+
children: child
|
|
1437
|
+
}),
|
|
1438
|
+
childKey
|
|
1439
|
+
);
|
|
1440
|
+
});
|
|
1441
|
+
};
|
|
1442
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1443
|
+
"section",
|
|
1444
|
+
__spreadProps(__spreadValues({
|
|
1445
|
+
ref: trackRef,
|
|
1446
|
+
"aria-roledescription": "carousel",
|
|
1447
|
+
"aria-label": props["aria-label"] || "Content carousel",
|
|
1448
|
+
tabIndex: 0,
|
|
1449
|
+
className: trackClasses,
|
|
1450
|
+
style: trackStyle,
|
|
1451
|
+
onScroll: handleScroll,
|
|
1452
|
+
onPointerDown: handlePointerDown,
|
|
1453
|
+
onPointerMove: handlePointerMove,
|
|
1454
|
+
onPointerUp: handlePointerUp,
|
|
1455
|
+
onPointerCancel: handlePointerUp,
|
|
1456
|
+
onClickCapture: handleClickCapture,
|
|
1457
|
+
onKeyDown: handleKeyDown
|
|
1458
|
+
}, props), {
|
|
1459
|
+
children: [
|
|
1460
|
+
renderSlides(),
|
|
1461
|
+
!isFullScreen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1462
|
+
"div",
|
|
1463
|
+
{
|
|
1464
|
+
"aria-hidden": "true",
|
|
1465
|
+
className: "shrink-0 pointer-events-none",
|
|
1466
|
+
style: {
|
|
1467
|
+
width: 0,
|
|
1468
|
+
marginRight: keylines.maxAccumulatedShift > 0 ? `-${keylines.maxAccumulatedShift}px` : void 0
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
)
|
|
1472
|
+
]
|
|
1473
|
+
})
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
function Carousel(_a) {
|
|
1477
|
+
var _b = _a, {
|
|
1478
|
+
children,
|
|
1479
|
+
items,
|
|
1480
|
+
renderItem,
|
|
1481
|
+
layout = "multi-browse",
|
|
1482
|
+
preferredItemWidth = 300,
|
|
1483
|
+
itemSpacing = 8,
|
|
1484
|
+
contentPadding = 16,
|
|
1485
|
+
verticalPadding = 8,
|
|
1486
|
+
isExpanded: controlledExpanded,
|
|
1487
|
+
onShowAllClick,
|
|
1488
|
+
showAllLabel = "Show all",
|
|
1489
|
+
userScrollEnabled = true,
|
|
1490
|
+
className,
|
|
1491
|
+
style
|
|
1492
|
+
} = _b, props = __objRest(_b, [
|
|
1493
|
+
"children",
|
|
1494
|
+
"items",
|
|
1495
|
+
"renderItem",
|
|
1496
|
+
"layout",
|
|
1497
|
+
"preferredItemWidth",
|
|
1498
|
+
"itemSpacing",
|
|
1499
|
+
"contentPadding",
|
|
1500
|
+
"verticalPadding",
|
|
1501
|
+
"isExpanded",
|
|
1502
|
+
"onShowAllClick",
|
|
1503
|
+
"showAllLabel",
|
|
1504
|
+
"userScrollEnabled",
|
|
1505
|
+
"className",
|
|
1506
|
+
"style"
|
|
1507
|
+
]);
|
|
1508
|
+
const [internalExpanded, setInternalExpanded] = React23__namespace.useState(false);
|
|
1509
|
+
const isExpanded = controlledExpanded != null ? controlledExpanded : internalExpanded;
|
|
1510
|
+
const totalItemsCount = React23__namespace.useMemo(() => {
|
|
1511
|
+
if (items) return items.length;
|
|
1512
|
+
return React23__namespace.Children.count(children);
|
|
1513
|
+
}, [items, children]);
|
|
1514
|
+
const handleShowAllToggle = React23__namespace.useCallback(() => {
|
|
1515
|
+
if (onShowAllClick) {
|
|
1516
|
+
onShowAllClick();
|
|
1517
|
+
} else {
|
|
1518
|
+
setInternalExpanded((prev) => !prev);
|
|
1519
|
+
}
|
|
1520
|
+
}, [onShowAllClick]);
|
|
1521
|
+
const isFullScreen = layout === "full-screen";
|
|
1522
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1523
|
+
"div",
|
|
1524
|
+
{
|
|
1525
|
+
className: cn(
|
|
1526
|
+
"relative w-full flex flex-col gap-3 box-border min-h-0",
|
|
1527
|
+
// Full-screen: propagate height to track
|
|
1528
|
+
isFullScreen && "flex-1",
|
|
1529
|
+
className
|
|
1530
|
+
),
|
|
1531
|
+
style,
|
|
1532
|
+
children: [
|
|
1533
|
+
!isFullScreen && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1534
|
+
"div",
|
|
1535
|
+
{
|
|
1536
|
+
className: "flex items-center justify-between",
|
|
1537
|
+
style: { padding: `0 ${contentPadding}px` },
|
|
1538
|
+
children: [
|
|
1539
|
+
props["aria-label"] && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "m-0 text-(length:--md-sys-typescale-title-medium-size,1.125rem) font-medium text-(--md-sys-color-on-surface,currentColor)", children: props["aria-label"] }),
|
|
1540
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1541
|
+
"button",
|
|
1542
|
+
{
|
|
1543
|
+
type: "button",
|
|
1544
|
+
className: cn(
|
|
1545
|
+
"inline-flex items-center justify-center min-h-12 min-w-12 px-4 py-2",
|
|
1546
|
+
"rounded-[20px] border border-(--md-sys-color-outline-variant,rgba(121,116,126,0.3))",
|
|
1547
|
+
"bg-transparent text-(--md-sys-color-primary,#6750a4) font-medium text-[0.875rem]",
|
|
1548
|
+
"cursor-pointer outline-none transition-colors duration-200",
|
|
1549
|
+
"hover:bg-(--md-sys-color-surface-container-high,rgba(103,80,164,0.08))",
|
|
1550
|
+
"focus-visible:outline-[3px] focus-visible:outline-(--md-sys-color-secondary,#625b71) focus-visible:outline-offset-2"
|
|
1551
|
+
),
|
|
1552
|
+
onClick: handleShowAllToggle,
|
|
1553
|
+
"aria-expanded": isExpanded,
|
|
1554
|
+
"aria-label": isExpanded ? "Collapse carousel view" : `${showAllLabel} (${totalItemsCount} items)`,
|
|
1555
|
+
children: isExpanded ? "Show carousel" : showAllLabel
|
|
1556
|
+
}
|
|
1557
|
+
)
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
),
|
|
1561
|
+
isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1562
|
+
CarouselGrid,
|
|
1563
|
+
{
|
|
1564
|
+
items,
|
|
1565
|
+
renderItem,
|
|
1566
|
+
preferredItemWidth,
|
|
1567
|
+
children
|
|
1568
|
+
}
|
|
1569
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1570
|
+
CarouselScrollClient,
|
|
1571
|
+
__spreadProps(__spreadValues({
|
|
1572
|
+
items,
|
|
1573
|
+
renderItem,
|
|
1574
|
+
layout,
|
|
1575
|
+
preferredItemWidth,
|
|
1576
|
+
itemSpacing,
|
|
1577
|
+
contentPadding,
|
|
1578
|
+
verticalPadding,
|
|
1579
|
+
userScrollEnabled,
|
|
1580
|
+
totalItemsCount
|
|
1581
|
+
}, props), {
|
|
1582
|
+
children
|
|
1583
|
+
})
|
|
1584
|
+
)
|
|
1585
|
+
]
|
|
1586
|
+
}
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
326
1589
|
var SHAPE_KEY_TIMES = "0; 0.14; 0.14; 0.29; 0.29; 0.43; 0.43; 0.57; 0.57; 0.71; 0.71; 0.86; 0.86; 1";
|
|
327
1590
|
var SHAPE_KEY_SPLINES = [
|
|
328
1591
|
"0.5 0.2 0 0.8",
|
|
@@ -368,11 +1631,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
368
1631
|
var ROTATE_VALUES = "0 24 24; 154 24 24; 309 24 24; 463 24 24; 617 24 24; 771 24 24; 926 24 24; 1080 24 24";
|
|
369
1632
|
var DETERMINATE_CIRCLE = "M24 7 C34.49 7 41 13.51 41 24 C41 34.49 34.49 41 24 41 C13.51 41 7 34.49 7 24 C7 13.51 13.51 7 24 7 Z";
|
|
370
1633
|
var DETERMINATE_SOFT_BURST = "M20.9 10.4 21.4 9.5 21.9 8.7 22.5 7.8 23.2 7.2 24.2 7 25.1 7.4 25.7 8.1 26.2 9 26.8 9.8 27.3 10.6 28.1 11.2 29 11.3 30 11 30.9 10.6 31.8 10.3 32.8 9.9 33.7 10 34.5 10.6 34.9 11.5 34.8 12.5 34.8 13.5 34.7 14.5 34.7 15.5 35.2 16.3 36 16.8 37 17.1 37.9 17.3 38.9 17.5 39.8 17.9 40.4 18.7 40.5 19.7 40 20.5 39.4 21.3 38.7 22 38.1 22.8 37.6 23.7 37.7 24.6 38.3 25.5 38.9 26.2 39.6 27 40.2 27.7 40.5 28.7 40.3 29.6 39.5 30.3 38.6 30.6 37.6 30.8 36.7 31 35.7 31.3 35 31.9 34.6 32.8 34.7 33.8 34.8 34.8 34.9 35.8 34.8 36.8 34.3 37.6 33.4 38.1 32.4 38 31.5 37.6 30.6 37.2 29.7 36.9 28.7 36.6 27.8 36.9 27.1 37.6 26.6 38.5 26.1 39.3 25.5 40.2 24.8 40.8 23.8 41 22.9 40.6 22.3 39.9 21.8 39 21.2 38.2 20.7 37.4 19.9 36.8 19 36.7 18 37 17.1 37.4 16.2 37.7 15.2 38.1 14.3 38 13.5 37.4 13.1 36.5 13.2 35.5 13.2 34.5 13.3 33.5 13.3 32.5 12.8 31.7 12 31.2 11 31 10.1 30.7 9.1 30.5 8.2 30.1 7.6 29.3 7.5 28.3 8 27.5 8.7 26.7 9.3 26 9.9 25.2 10.4 24.3 10.3 23.4 9.7 22.5 9.1 21.8 8.4 21 7.8 20.3 7.5 19.3 7.7 18.4 8.5 17.7 9.4 17.4 10.4 17.2 11.3 17 12.3 16.7 13 16.1 13.4 15.2 13.3 14.2 13.2 13.2 13.1 12.2 13.2 11.2 13.7 10.4 14.6 9.9 15.6 10 16.5 10.4 17.4 10.8 18.3 11.1 19.3 11.4 20.2 11.1Z";
|
|
371
|
-
var IndeterminateSvg =
|
|
1634
|
+
var IndeterminateSvg = React23__namespace.memo(function IndeterminateSvg2({
|
|
372
1635
|
size
|
|
373
1636
|
}) {
|
|
374
|
-
const [ready, setReady] =
|
|
375
|
-
|
|
1637
|
+
const [ready, setReady] = React23__namespace.useState(false);
|
|
1638
|
+
React23__namespace.useEffect(() => {
|
|
376
1639
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
377
1640
|
return () => cancelAnimationFrame(raf);
|
|
378
1641
|
}, []);
|
|
@@ -417,7 +1680,7 @@ var IndeterminateSvg = React18__namespace.memo(function IndeterminateSvg2({
|
|
|
417
1680
|
}
|
|
418
1681
|
);
|
|
419
1682
|
});
|
|
420
|
-
var DeterminateSvg =
|
|
1683
|
+
var DeterminateSvg = React23__namespace.memo(function DeterminateSvg2({
|
|
421
1684
|
size,
|
|
422
1685
|
progress
|
|
423
1686
|
}) {
|
|
@@ -442,7 +1705,7 @@ var DeterminateSvg = React18__namespace.memo(function DeterminateSvg2({
|
|
|
442
1705
|
}
|
|
443
1706
|
);
|
|
444
1707
|
});
|
|
445
|
-
var LoadingIndicator =
|
|
1708
|
+
var LoadingIndicator = React23__namespace.forwardRef(
|
|
446
1709
|
(_a, ref) => {
|
|
447
1710
|
var _b = _a, {
|
|
448
1711
|
variant = "uncontained",
|
|
@@ -510,7 +1773,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
|
|
|
510
1773
|
function easeInOutCubic(x) {
|
|
511
1774
|
return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
|
|
512
1775
|
}
|
|
513
|
-
function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
1776
|
+
function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
|
|
514
1777
|
const circumference = 2 * Math.PI * radius;
|
|
515
1778
|
const numWaves = Math.max(
|
|
516
1779
|
3,
|
|
@@ -518,8 +1781,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
518
1781
|
);
|
|
519
1782
|
const steps = numWaves * 4;
|
|
520
1783
|
const dt = 2 * Math.PI / steps;
|
|
521
|
-
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
|
|
522
|
-
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
|
|
1784
|
+
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
|
|
1785
|
+
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
|
|
523
1786
|
const xAt = (t) => center + rAt(t) * Math.cos(t);
|
|
524
1787
|
const yAt = (t) => center + rAt(t) * Math.sin(t);
|
|
525
1788
|
const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
|
|
@@ -577,22 +1840,25 @@ var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
|
577
1840
|
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
578
1841
|
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
579
1842
|
var PROGRESS_CYCLE_DURATION = 1500;
|
|
580
|
-
var CircularProgress =
|
|
1843
|
+
var CircularProgress = React23__namespace.forwardRef(
|
|
581
1844
|
(_a, ref) => {
|
|
582
1845
|
var _b = _a, {
|
|
583
1846
|
value,
|
|
584
1847
|
size = 48,
|
|
585
1848
|
trackHeight = 4,
|
|
586
1849
|
shape = "flat",
|
|
1850
|
+
trackShape = "flat",
|
|
587
1851
|
amplitude,
|
|
588
1852
|
wavelength,
|
|
589
1853
|
gapSize = 4,
|
|
1854
|
+
waveSpeed = 1,
|
|
590
1855
|
crawlerSpeed = 1,
|
|
591
1856
|
color,
|
|
592
1857
|
trackColor,
|
|
593
1858
|
showTrack = "auto",
|
|
594
1859
|
minProgress = DEFAULT_MIN_PROGRESS,
|
|
595
1860
|
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
1861
|
+
determinateAnimation = "md3",
|
|
596
1862
|
amplitudeRange,
|
|
597
1863
|
className,
|
|
598
1864
|
"aria-label": ariaLabel
|
|
@@ -601,15 +1867,18 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
601
1867
|
"size",
|
|
602
1868
|
"trackHeight",
|
|
603
1869
|
"shape",
|
|
1870
|
+
"trackShape",
|
|
604
1871
|
"amplitude",
|
|
605
1872
|
"wavelength",
|
|
606
1873
|
"gapSize",
|
|
1874
|
+
"waveSpeed",
|
|
607
1875
|
"crawlerSpeed",
|
|
608
1876
|
"color",
|
|
609
1877
|
"trackColor",
|
|
610
1878
|
"showTrack",
|
|
611
1879
|
"minProgress",
|
|
612
1880
|
"maxProgress",
|
|
1881
|
+
"determinateAnimation",
|
|
613
1882
|
"amplitudeRange",
|
|
614
1883
|
"className",
|
|
615
1884
|
"aria-label"
|
|
@@ -622,21 +1891,22 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
622
1891
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
623
1892
|
const isWavy = shape === "wavy";
|
|
624
1893
|
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
1894
|
+
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
625
1895
|
const BASELINE_SIZE = 48;
|
|
626
1896
|
const scaleFactor = size / BASELINE_SIZE;
|
|
627
|
-
const effectiveAmplitude =
|
|
1897
|
+
const effectiveAmplitude = React23__namespace.useMemo(
|
|
628
1898
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
629
1899
|
[amplitude, scaleFactor]
|
|
630
1900
|
);
|
|
631
|
-
const effectiveWavelength =
|
|
1901
|
+
const effectiveWavelength = React23__namespace.useMemo(
|
|
632
1902
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
633
1903
|
[wavelength, scaleFactor]
|
|
634
1904
|
);
|
|
635
|
-
const resolvedAmplitudeRange =
|
|
1905
|
+
const resolvedAmplitudeRange = React23__namespace.useMemo(
|
|
636
1906
|
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
637
1907
|
[amplitudeRange, effectiveAmplitude]
|
|
638
1908
|
);
|
|
639
|
-
const wavyActivePath =
|
|
1909
|
+
const wavyActivePath = React23__namespace.useMemo(
|
|
640
1910
|
() => isWavy ? generateWavyCircularPath(
|
|
641
1911
|
center,
|
|
642
1912
|
radius,
|
|
@@ -645,8 +1915,8 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
645
1915
|
) : null,
|
|
646
1916
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
647
1917
|
);
|
|
648
|
-
const circumference =
|
|
649
|
-
const gapForTrack =
|
|
1918
|
+
const circumference = React23__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
1919
|
+
const gapForTrack = React23__namespace.useMemo(
|
|
650
1920
|
() => (gapSize + trackHeight) / circumference,
|
|
651
1921
|
[gapSize, trackHeight, circumference]
|
|
652
1922
|
);
|
|
@@ -654,19 +1924,50 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
654
1924
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
655
1925
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
656
1926
|
const ActiveCircleElem = react.m.circle;
|
|
657
|
-
const
|
|
658
|
-
const
|
|
659
|
-
const
|
|
660
|
-
const
|
|
661
|
-
const
|
|
662
|
-
const
|
|
663
|
-
const
|
|
664
|
-
|
|
1927
|
+
const indeterminateSvgRef = React23__namespace.useRef(null);
|
|
1928
|
+
const indeterminateTrackRef = React23__namespace.useRef(null);
|
|
1929
|
+
const indeterminateActiveRef = React23__namespace.useRef(null);
|
|
1930
|
+
const indeterminateWavyTrackPathRef = React23__namespace.useRef(null);
|
|
1931
|
+
const indeterminateWavyActivePathRef = React23__namespace.useRef(null);
|
|
1932
|
+
const determinateWavyActivePathRef = React23__namespace.useRef(null);
|
|
1933
|
+
const determinateWavyTrackPathRef = React23__namespace.useRef(null);
|
|
1934
|
+
const cachedPathLengthRef = React23__namespace.useRef(0);
|
|
1935
|
+
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
1936
|
+
const amplitudeMV = react.useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
1937
|
+
React23__namespace.useEffect(() => {
|
|
1938
|
+
if (isDeterminate) {
|
|
1939
|
+
react.animate(fractionMV, clampedValue / 100, {
|
|
1940
|
+
duration: 0.4,
|
|
1941
|
+
ease: [0.2, 0, 0, 1]
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
}, [clampedValue, isDeterminate, fractionMV]);
|
|
1945
|
+
React23__namespace.useEffect(() => {
|
|
1946
|
+
if (!isDeterminate || !isWavy) return;
|
|
1947
|
+
const fraction = clampedValue / 100;
|
|
1948
|
+
let targetAmp = effectiveAmplitude;
|
|
1949
|
+
if (determinateAnimation === "md3") {
|
|
1950
|
+
targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
|
|
1951
|
+
}
|
|
1952
|
+
react.animate(amplitudeMV, targetAmp, {
|
|
1953
|
+
type: "spring",
|
|
1954
|
+
bounce: 0,
|
|
1955
|
+
duration: 0.5
|
|
1956
|
+
});
|
|
1957
|
+
}, [
|
|
1958
|
+
clampedValue,
|
|
1959
|
+
isDeterminate,
|
|
1960
|
+
isWavy,
|
|
1961
|
+
effectiveAmplitude,
|
|
1962
|
+
amplitudeMV,
|
|
1963
|
+
determinateAnimation
|
|
1964
|
+
]);
|
|
1965
|
+
React23__namespace.useLayoutEffect(() => {
|
|
665
1966
|
if (!isWavy || !wavyActivePath) {
|
|
666
1967
|
cachedPathLengthRef.current = circumference;
|
|
667
1968
|
return;
|
|
668
1969
|
}
|
|
669
|
-
const el = indeterminateActiveRef.current;
|
|
1970
|
+
const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
|
|
670
1971
|
if (el && "getTotalLength" in el) {
|
|
671
1972
|
try {
|
|
672
1973
|
const len = el.getTotalLength();
|
|
@@ -680,7 +1981,65 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
680
1981
|
cachedPathLengthRef.current = circumference;
|
|
681
1982
|
}, [isWavy, circumference, wavyActivePath]);
|
|
682
1983
|
react.useAnimationFrame((time) => {
|
|
683
|
-
|
|
1984
|
+
const safeWaveSpeed = Math.max(0.1, waveSpeed);
|
|
1985
|
+
const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
|
|
1986
|
+
if (isDeterminate) {
|
|
1987
|
+
if (isWavy) {
|
|
1988
|
+
const currentAmp = amplitudeMV.get();
|
|
1989
|
+
const dynamicPath = generateWavyCircularPath(
|
|
1990
|
+
center,
|
|
1991
|
+
radius,
|
|
1992
|
+
currentAmp,
|
|
1993
|
+
effectiveWavelength,
|
|
1994
|
+
wavePhase
|
|
1995
|
+
);
|
|
1996
|
+
if (determinateWavyActivePathRef.current) {
|
|
1997
|
+
determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
1998
|
+
}
|
|
1999
|
+
if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
2000
|
+
determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
2001
|
+
}
|
|
2002
|
+
const pathEl = determinateWavyActivePathRef.current;
|
|
2003
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
2004
|
+
if (pathEl) {
|
|
2005
|
+
try {
|
|
2006
|
+
const len = pathEl.getTotalLength();
|
|
2007
|
+
if (len > 0) totalLen = len;
|
|
2008
|
+
} catch (e) {
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
|
|
2012
|
+
const activeLen = totalLen * activeFrac;
|
|
2013
|
+
if (determinateWavyActivePathRef.current) {
|
|
2014
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
2015
|
+
"stroke-dasharray",
|
|
2016
|
+
`${activeLen} ${totalLen}`
|
|
2017
|
+
);
|
|
2018
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
2019
|
+
"stroke-dashoffset",
|
|
2020
|
+
"0"
|
|
2021
|
+
);
|
|
2022
|
+
}
|
|
2023
|
+
if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
2024
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
2025
|
+
const trackStartFrac = activeFrac + gapFrac;
|
|
2026
|
+
const trackLen = Math.max(
|
|
2027
|
+
1e-3,
|
|
2028
|
+
totalLen * (1 - activeFrac - 2 * gapFrac)
|
|
2029
|
+
);
|
|
2030
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
2031
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
2032
|
+
"stroke-dasharray",
|
|
2033
|
+
`${trackLen} ${totalLen}`
|
|
2034
|
+
);
|
|
2035
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
2036
|
+
"stroke-dashoffset",
|
|
2037
|
+
`${trackOff}`
|
|
2038
|
+
);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
return;
|
|
2042
|
+
}
|
|
684
2043
|
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
685
2044
|
const scaledTime = time * safeCrawlerSpeed;
|
|
686
2045
|
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
@@ -715,7 +2074,8 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
715
2074
|
center,
|
|
716
2075
|
radius,
|
|
717
2076
|
currentAmplitude,
|
|
718
|
-
effectiveWavelength
|
|
2077
|
+
effectiveWavelength,
|
|
2078
|
+
wavePhase
|
|
719
2079
|
);
|
|
720
2080
|
if (indeterminateWavyActivePathRef.current) {
|
|
721
2081
|
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
@@ -810,7 +2170,7 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
810
2170
|
style: { width: size, height: size }
|
|
811
2171
|
}, restProps), {
|
|
812
2172
|
children: /* @__PURE__ */ jsxRuntime.jsxs(react.LazyMotion, { features: react.domMax, strict: true, children: [
|
|
813
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2173
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
814
2174
|
"svg",
|
|
815
2175
|
{
|
|
816
2176
|
width: size,
|
|
@@ -818,8 +2178,18 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
818
2178
|
viewBox: `0 0 ${size} ${size}`,
|
|
819
2179
|
"aria-hidden": "true",
|
|
820
2180
|
style: { transform: "rotate(-90deg)", overflow: "visible" },
|
|
821
|
-
children: [
|
|
822
|
-
|
|
2181
|
+
children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2182
|
+
shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2183
|
+
"path",
|
|
2184
|
+
{
|
|
2185
|
+
ref: determinateWavyTrackPathRef,
|
|
2186
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
2187
|
+
fill: "none",
|
|
2188
|
+
stroke: bgTrackColor,
|
|
2189
|
+
strokeWidth: trackHeight,
|
|
2190
|
+
strokeLinecap: "round"
|
|
2191
|
+
}
|
|
2192
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
823
2193
|
react.m.circle,
|
|
824
2194
|
{
|
|
825
2195
|
cx: center,
|
|
@@ -828,28 +2198,52 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
828
2198
|
fill: "none",
|
|
829
2199
|
stroke: bgTrackColor,
|
|
830
2200
|
strokeWidth: trackHeight,
|
|
831
|
-
initial: {
|
|
832
|
-
|
|
2201
|
+
initial: {
|
|
2202
|
+
pathLength: trackLength,
|
|
2203
|
+
pathOffset: trackOffset
|
|
2204
|
+
},
|
|
2205
|
+
animate: {
|
|
2206
|
+
pathLength: trackLength,
|
|
2207
|
+
pathOffset: trackOffset
|
|
2208
|
+
},
|
|
833
2209
|
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
834
2210
|
strokeLinecap: "round"
|
|
835
2211
|
}
|
|
836
|
-
)
|
|
837
|
-
|
|
838
|
-
|
|
2212
|
+
)),
|
|
2213
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2214
|
+
"path",
|
|
839
2215
|
{
|
|
2216
|
+
ref: determinateWavyActivePathRef,
|
|
840
2217
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
841
2218
|
fill: "none",
|
|
842
2219
|
stroke: activeColor,
|
|
843
2220
|
strokeWidth: trackHeight,
|
|
844
|
-
strokeLinecap: "round"
|
|
845
|
-
initial: { pathLength: 0 },
|
|
846
|
-
animate: { pathLength: clampedValue / 100 },
|
|
847
|
-
transition: {
|
|
848
|
-
duration: 0.4,
|
|
849
|
-
ease: [0.2, 0, 0, 1]
|
|
850
|
-
}
|
|
2221
|
+
strokeLinecap: "round"
|
|
851
2222
|
}
|
|
852
|
-
)
|
|
2223
|
+
)
|
|
2224
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2226
|
+
react.m.circle,
|
|
2227
|
+
{
|
|
2228
|
+
cx: center,
|
|
2229
|
+
cy: center,
|
|
2230
|
+
r: radius,
|
|
2231
|
+
fill: "none",
|
|
2232
|
+
stroke: bgTrackColor,
|
|
2233
|
+
strokeWidth: trackHeight,
|
|
2234
|
+
initial: {
|
|
2235
|
+
pathLength: trackLength,
|
|
2236
|
+
pathOffset: trackOffset
|
|
2237
|
+
},
|
|
2238
|
+
animate: {
|
|
2239
|
+
pathLength: trackLength,
|
|
2240
|
+
pathOffset: trackOffset
|
|
2241
|
+
},
|
|
2242
|
+
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
2243
|
+
strokeLinecap: "round"
|
|
2244
|
+
}
|
|
2245
|
+
),
|
|
2246
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
853
2247
|
ActiveCircleElem,
|
|
854
2248
|
{
|
|
855
2249
|
cx: center,
|
|
@@ -866,8 +2260,8 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
866
2260
|
ease: [0.2, 0, 0, 1]
|
|
867
2261
|
}
|
|
868
2262
|
}
|
|
869
|
-
)
|
|
870
|
-
]
|
|
2263
|
+
)
|
|
2264
|
+
] }) : null
|
|
871
2265
|
}
|
|
872
2266
|
),
|
|
873
2267
|
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -945,9 +2339,9 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
945
2339
|
);
|
|
946
2340
|
CircularProgress.displayName = "CircularProgress";
|
|
947
2341
|
function useContainerWidth() {
|
|
948
|
-
const [width, setWidth] =
|
|
949
|
-
const observerRef =
|
|
950
|
-
const ref =
|
|
2342
|
+
const [width, setWidth] = React23__namespace.useState(0);
|
|
2343
|
+
const observerRef = React23__namespace.useRef(null);
|
|
2344
|
+
const ref = React23__namespace.useCallback((node) => {
|
|
951
2345
|
if (observerRef.current) {
|
|
952
2346
|
observerRef.current.disconnect();
|
|
953
2347
|
observerRef.current = null;
|
|
@@ -961,7 +2355,7 @@ function useContainerWidth() {
|
|
|
961
2355
|
observerRef.current = obs;
|
|
962
2356
|
}
|
|
963
2357
|
}, []);
|
|
964
|
-
|
|
2358
|
+
React23__namespace.useEffect(() => {
|
|
965
2359
|
return () => {
|
|
966
2360
|
if (observerRef.current) {
|
|
967
2361
|
observerRef.current.disconnect();
|
|
@@ -971,7 +2365,7 @@ function useContainerWidth() {
|
|
|
971
2365
|
return [ref, width];
|
|
972
2366
|
}
|
|
973
2367
|
function useMergedRef(...refs) {
|
|
974
|
-
return
|
|
2368
|
+
return React23__namespace.useCallback(
|
|
975
2369
|
(node) => {
|
|
976
2370
|
for (const ref of refs) {
|
|
977
2371
|
if (typeof ref === "function") {
|
|
@@ -985,7 +2379,7 @@ function useMergedRef(...refs) {
|
|
|
985
2379
|
[refs]
|
|
986
2380
|
);
|
|
987
2381
|
}
|
|
988
|
-
var FlatLinearTrack =
|
|
2382
|
+
var FlatLinearTrack = React23__namespace.memo(function FlatLinearTrack2({
|
|
989
2383
|
trackHeight,
|
|
990
2384
|
activeColor,
|
|
991
2385
|
trackColor,
|
|
@@ -1061,7 +2455,7 @@ var FlatLinearTrack = React18__namespace.memo(function FlatLinearTrack2({
|
|
|
1061
2455
|
}
|
|
1062
2456
|
);
|
|
1063
2457
|
});
|
|
1064
|
-
var WavyLinearTrack =
|
|
2458
|
+
var WavyLinearTrack = React23__namespace.memo(function WavyLinearTrack2({
|
|
1065
2459
|
trackHeight,
|
|
1066
2460
|
svgHeight,
|
|
1067
2461
|
amplitude,
|
|
@@ -1080,13 +2474,13 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
1080
2474
|
}) {
|
|
1081
2475
|
const isDeterminate = typeof value === "number";
|
|
1082
2476
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1083
|
-
const titleId =
|
|
2477
|
+
const titleId = React23__namespace.useId();
|
|
1084
2478
|
const [containerRef, width] = useContainerWidth();
|
|
1085
|
-
const activePathRef =
|
|
1086
|
-
const trackPathRef =
|
|
2479
|
+
const activePathRef = React23__namespace.useRef(null);
|
|
2480
|
+
const trackPathRef = React23__namespace.useRef(null);
|
|
1087
2481
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
1088
2482
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1089
|
-
|
|
2483
|
+
React23__namespace.useEffect(() => {
|
|
1090
2484
|
if (isDeterminate) {
|
|
1091
2485
|
const fraction = clampedValue / 100;
|
|
1092
2486
|
let targetAmp = amplitude;
|
|
@@ -1274,7 +2668,7 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
1274
2668
|
}
|
|
1275
2669
|
);
|
|
1276
2670
|
});
|
|
1277
|
-
var LinearProgress =
|
|
2671
|
+
var LinearProgress = React23__namespace.forwardRef(
|
|
1278
2672
|
(_a, ref) => {
|
|
1279
2673
|
var _b = _a, {
|
|
1280
2674
|
value,
|
|
@@ -1315,10 +2709,10 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1315
2709
|
]);
|
|
1316
2710
|
const isDeterminate = value !== void 0;
|
|
1317
2711
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1318
|
-
const containerRef =
|
|
2712
|
+
const containerRef = React23__namespace.useRef(null);
|
|
1319
2713
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1320
|
-
const [isRtl, setIsRtl] =
|
|
1321
|
-
|
|
2714
|
+
const [isRtl, setIsRtl] = React23__namespace.useState(false);
|
|
2715
|
+
React23__namespace.useEffect(() => {
|
|
1322
2716
|
if (containerRef.current) {
|
|
1323
2717
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1324
2718
|
setIsRtl(dir === "rtl");
|
|
@@ -1326,16 +2720,16 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1326
2720
|
}, []);
|
|
1327
2721
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1328
2722
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1329
|
-
const effectiveAmplitude =
|
|
1330
|
-
const svgHeight =
|
|
2723
|
+
const effectiveAmplitude = React23__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
2724
|
+
const svgHeight = React23__namespace.useMemo(
|
|
1331
2725
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1332
2726
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1333
2727
|
);
|
|
1334
|
-
const shouldShowStop =
|
|
2728
|
+
const shouldShowStop = React23__namespace.useMemo(
|
|
1335
2729
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1336
2730
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1337
2731
|
);
|
|
1338
|
-
const stopSize =
|
|
2732
|
+
const stopSize = React23__namespace.useMemo(
|
|
1339
2733
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1340
2734
|
[trackHeight]
|
|
1341
2735
|
);
|
|
@@ -1410,7 +2804,7 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1410
2804
|
}
|
|
1411
2805
|
);
|
|
1412
2806
|
LinearProgress.displayName = "LinearProgress";
|
|
1413
|
-
var ProgressIndicator =
|
|
2807
|
+
var ProgressIndicator = React23__namespace.forwardRef((props, ref) => {
|
|
1414
2808
|
if (props.variant === "circular") {
|
|
1415
2809
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1416
2810
|
}
|
|
@@ -1664,7 +3058,7 @@ function AnimatedIconSlot({
|
|
|
1664
3058
|
}
|
|
1665
3059
|
);
|
|
1666
3060
|
}
|
|
1667
|
-
var ButtonComponent =
|
|
3061
|
+
var ButtonComponent = React23__namespace.forwardRef(
|
|
1668
3062
|
(_a, ref) => {
|
|
1669
3063
|
var _b = _a, {
|
|
1670
3064
|
className,
|
|
@@ -1730,9 +3124,9 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1730
3124
|
borderWidth: outlineWidth != null ? outlineWidth : colorStyle === "outlined" ? sizeTokens.outlineWidth : 0,
|
|
1731
3125
|
borderStyle: colorStyle === "outlined" ? "solid" : void 0
|
|
1732
3126
|
}, style);
|
|
1733
|
-
const labelText =
|
|
3127
|
+
const labelText = React23__namespace.useMemo(() => {
|
|
1734
3128
|
if (asChild) {
|
|
1735
|
-
const child =
|
|
3129
|
+
const child = React23__namespace.Children.only(children);
|
|
1736
3130
|
return child.props.children;
|
|
1737
3131
|
}
|
|
1738
3132
|
return children;
|
|
@@ -1740,8 +3134,8 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1740
3134
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
1741
3135
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1742
3136
|
const motionRadius = react.useMotionValue(animateRadius);
|
|
1743
|
-
const asChildRef =
|
|
1744
|
-
const mergedRef =
|
|
3137
|
+
const asChildRef = React23__namespace.useRef(null);
|
|
3138
|
+
const mergedRef = React23__namespace.useCallback(
|
|
1745
3139
|
(node) => {
|
|
1746
3140
|
asChildRef.current = node;
|
|
1747
3141
|
if (typeof ref === "function") ref(node);
|
|
@@ -1750,14 +3144,14 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1750
3144
|
},
|
|
1751
3145
|
[ref]
|
|
1752
3146
|
);
|
|
1753
|
-
|
|
3147
|
+
React23__namespace.useEffect(() => {
|
|
1754
3148
|
if (!asChild) return;
|
|
1755
3149
|
return motionRadius.on("change", (v) => {
|
|
1756
3150
|
if (asChildRef.current)
|
|
1757
3151
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
1758
3152
|
});
|
|
1759
3153
|
}, [motionRadius, asChild]);
|
|
1760
|
-
|
|
3154
|
+
React23__namespace.useEffect(() => {
|
|
1761
3155
|
if (!asChild) return;
|
|
1762
3156
|
const controls = springAnimate(motionRadius, animateRadius);
|
|
1763
3157
|
return () => controls.stop();
|
|
@@ -1765,14 +3159,14 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1765
3159
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1766
3160
|
disabled: loading
|
|
1767
3161
|
});
|
|
1768
|
-
const handleClick =
|
|
3162
|
+
const handleClick = React23__namespace.useCallback(
|
|
1769
3163
|
(e) => {
|
|
1770
3164
|
if (loading) return e.preventDefault();
|
|
1771
3165
|
onClick == null ? void 0 : onClick(e);
|
|
1772
3166
|
},
|
|
1773
3167
|
[loading, onClick]
|
|
1774
3168
|
);
|
|
1775
|
-
const handleKeyDown =
|
|
3169
|
+
const handleKeyDown = React23__namespace.useCallback(
|
|
1776
3170
|
(e) => {
|
|
1777
3171
|
if (loading) return;
|
|
1778
3172
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -1851,17 +3245,17 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1851
3245
|
isSelected && selectedIcon ? "selected-icon" : "icon"
|
|
1852
3246
|
) })
|
|
1853
3247
|
] });
|
|
1854
|
-
const handleAsChildPointerDown =
|
|
3248
|
+
const handleAsChildPointerDown = React23__namespace.useCallback(
|
|
1855
3249
|
(e) => {
|
|
1856
3250
|
springAnimate(motionRadius, pressedRadius);
|
|
1857
3251
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
1858
3252
|
},
|
|
1859
3253
|
[motionRadius, pressedRadius, onPointerDown]
|
|
1860
3254
|
);
|
|
1861
|
-
const handleAsChildPointerUp =
|
|
3255
|
+
const handleAsChildPointerUp = React23__namespace.useCallback(() => {
|
|
1862
3256
|
springAnimate(motionRadius, animateRadius);
|
|
1863
3257
|
}, [motionRadius, animateRadius]);
|
|
1864
|
-
const handlePointerDown =
|
|
3258
|
+
const handlePointerDown = React23__namespace.useCallback(
|
|
1865
3259
|
(e) => {
|
|
1866
3260
|
onPointerDown(e);
|
|
1867
3261
|
},
|
|
@@ -1871,7 +3265,7 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1871
3265
|
const strippedProps = __spreadValues({}, restProps);
|
|
1872
3266
|
for (const key of MOTION_PROP_KEYS) delete strippedProps[key];
|
|
1873
3267
|
const htmlProps = strippedProps;
|
|
1874
|
-
const child =
|
|
3268
|
+
const child = React23__namespace.Children.only(children);
|
|
1875
3269
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1876
3270
|
reactSlot.Slot,
|
|
1877
3271
|
__spreadProps(__spreadValues({
|
|
@@ -1888,7 +3282,7 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1888
3282
|
}),
|
|
1889
3283
|
className: buttonClassName
|
|
1890
3284
|
}, htmlProps), {
|
|
1891
|
-
children:
|
|
3285
|
+
children: React23__namespace.cloneElement(child, { children: innerContent })
|
|
1892
3286
|
})
|
|
1893
3287
|
) });
|
|
1894
3288
|
}
|
|
@@ -1916,13 +3310,13 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1916
3310
|
}
|
|
1917
3311
|
);
|
|
1918
3312
|
ButtonComponent.displayName = "Button";
|
|
1919
|
-
var Button =
|
|
3313
|
+
var Button = React23__namespace.memo(ButtonComponent);
|
|
1920
3314
|
var VARIANT_FONT = {
|
|
1921
3315
|
outlined: "'Material Symbols Outlined'",
|
|
1922
3316
|
rounded: "'Material Symbols Rounded'",
|
|
1923
3317
|
sharp: "'Material Symbols Sharp'"
|
|
1924
3318
|
};
|
|
1925
|
-
var IconComponent =
|
|
3319
|
+
var IconComponent = React23__namespace.forwardRef(
|
|
1926
3320
|
(_a, ref) => {
|
|
1927
3321
|
var _b = _a, {
|
|
1928
3322
|
name,
|
|
@@ -1988,8 +3382,8 @@ var IconComponent = React18__namespace.forwardRef(
|
|
|
1988
3382
|
}
|
|
1989
3383
|
);
|
|
1990
3384
|
IconComponent.displayName = "Icon";
|
|
1991
|
-
var Icon =
|
|
1992
|
-
var ScrollArea =
|
|
3385
|
+
var Icon = React23__namespace.memo(IconComponent);
|
|
3386
|
+
var ScrollArea = React23__namespace.forwardRef(
|
|
1993
3387
|
(_a, ref) => {
|
|
1994
3388
|
var _b = _a, {
|
|
1995
3389
|
className,
|
|
@@ -2010,15 +3404,15 @@ var ScrollArea = React18__namespace.forwardRef(
|
|
|
2010
3404
|
"viewportRef",
|
|
2011
3405
|
"viewportProps"
|
|
2012
3406
|
]);
|
|
2013
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2014
|
-
|
|
3407
|
+
const [isTouchDevice, setIsTouchDevice] = React23__namespace.useState(false);
|
|
3408
|
+
React23__namespace.useEffect(() => {
|
|
2015
3409
|
if (typeof window !== "undefined") {
|
|
2016
3410
|
setIsTouchDevice(
|
|
2017
3411
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2018
3412
|
);
|
|
2019
3413
|
}
|
|
2020
3414
|
}, []);
|
|
2021
|
-
const resolvedType =
|
|
3415
|
+
const resolvedType = React23__namespace.useMemo(() => {
|
|
2022
3416
|
if (type === "hover" && isTouchDevice) {
|
|
2023
3417
|
return "scroll";
|
|
2024
3418
|
}
|
|
@@ -2069,7 +3463,7 @@ var ScrollArea = React18__namespace.forwardRef(
|
|
|
2069
3463
|
}
|
|
2070
3464
|
);
|
|
2071
3465
|
ScrollArea.displayName = "ScrollArea";
|
|
2072
|
-
var ScrollAreaScrollbar =
|
|
3466
|
+
var ScrollAreaScrollbar = React23__namespace.forwardRef((_a, ref) => {
|
|
2073
3467
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2074
3468
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2075
3469
|
RadixScrollArea__namespace.Scrollbar,
|
|
@@ -2099,7 +3493,7 @@ var ScrollAreaScrollbar = React18__namespace.forwardRef((_a, ref) => {
|
|
|
2099
3493
|
);
|
|
2100
3494
|
});
|
|
2101
3495
|
ScrollAreaScrollbar.displayName = RadixScrollArea__namespace.Scrollbar.displayName;
|
|
2102
|
-
var ScrollAreaCorner =
|
|
3496
|
+
var ScrollAreaCorner = React23__namespace.forwardRef((_a, ref) => {
|
|
2103
3497
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2104
3498
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2105
3499
|
RadixScrollArea__namespace.Corner,
|
|
@@ -2194,7 +3588,7 @@ function mapDomToReact(node, key) {
|
|
|
2194
3588
|
props[propName] = attr.value;
|
|
2195
3589
|
}
|
|
2196
3590
|
}
|
|
2197
|
-
return
|
|
3591
|
+
return React23.createElement(
|
|
2198
3592
|
tagName,
|
|
2199
3593
|
props,
|
|
2200
3594
|
Array.from(el.childNodes).map((child, i) => mapDomToReact(child, i))
|
|
@@ -2203,8 +3597,8 @@ function mapDomToReact(node, key) {
|
|
|
2203
3597
|
return null;
|
|
2204
3598
|
}
|
|
2205
3599
|
function CodeContent({ html, code }) {
|
|
2206
|
-
const [parsedContent, setParsedContent] =
|
|
2207
|
-
|
|
3600
|
+
const [parsedContent, setParsedContent] = React23.useState(null);
|
|
3601
|
+
React23.useEffect(() => {
|
|
2208
3602
|
if (html) {
|
|
2209
3603
|
const parser = new DOMParser();
|
|
2210
3604
|
const doc = parser.parseFromString(html, "text/html");
|
|
@@ -2234,8 +3628,8 @@ function CodeBlock({
|
|
|
2234
3628
|
className,
|
|
2235
3629
|
html
|
|
2236
3630
|
}) {
|
|
2237
|
-
const [copied, setCopied] =
|
|
2238
|
-
const handleCopy =
|
|
3631
|
+
const [copied, setCopied] = React23.useState(false);
|
|
3632
|
+
const handleCopy = React23.useCallback(async () => {
|
|
2239
3633
|
try {
|
|
2240
3634
|
await navigator.clipboard.writeText(code);
|
|
2241
3635
|
setCopied(true);
|
|
@@ -2295,7 +3689,7 @@ function buildWavePath(startX, endX, amplitude = 2, wavelength = 32, yCenter = 4
|
|
|
2295
3689
|
}
|
|
2296
3690
|
return d;
|
|
2297
3691
|
}
|
|
2298
|
-
var DividerImpl =
|
|
3692
|
+
var DividerImpl = React23__namespace.forwardRef(
|
|
2299
3693
|
(_a, ref) => {
|
|
2300
3694
|
var _b = _a, {
|
|
2301
3695
|
variant = "full-bleed",
|
|
@@ -2304,7 +3698,7 @@ var DividerImpl = React18__namespace.forwardRef(
|
|
|
2304
3698
|
insetStart = "standard",
|
|
2305
3699
|
waveConfig,
|
|
2306
3700
|
decorative = false,
|
|
2307
|
-
animate:
|
|
3701
|
+
animate: animate4 = true,
|
|
2308
3702
|
className,
|
|
2309
3703
|
style
|
|
2310
3704
|
} = _b, props = __objRest(_b, [
|
|
@@ -2320,7 +3714,7 @@ var DividerImpl = React18__namespace.forwardRef(
|
|
|
2320
3714
|
]);
|
|
2321
3715
|
var _a2, _b2, _c;
|
|
2322
3716
|
const reducedMotion = react.useReducedMotion();
|
|
2323
|
-
const shouldAnimate =
|
|
3717
|
+
const shouldAnimate = animate4 && !reducedMotion;
|
|
2324
3718
|
const effectiveShape = shape === "wavy" && orientation === "vertical" ? "flat" : shape;
|
|
2325
3719
|
if (shape === "wavy" && orientation === "vertical") {
|
|
2326
3720
|
console.warn(
|
|
@@ -2415,9 +3809,9 @@ var DividerImpl = React18__namespace.forwardRef(
|
|
|
2415
3809
|
}
|
|
2416
3810
|
);
|
|
2417
3811
|
DividerImpl.displayName = "Divider";
|
|
2418
|
-
var Divider =
|
|
2419
|
-
var ListContext =
|
|
2420
|
-
var useListContext = () =>
|
|
3812
|
+
var Divider = React23__namespace.memo(DividerImpl);
|
|
3813
|
+
var ListContext = React23__namespace.createContext(null);
|
|
3814
|
+
var useListContext = () => React23__namespace.useContext(ListContext);
|
|
2421
3815
|
var LIST_TOKENS = {
|
|
2422
3816
|
oneLineHeight: 56,
|
|
2423
3817
|
twoLineHeight: 72,
|
|
@@ -2482,9 +3876,9 @@ function resolveItemId(item) {
|
|
|
2482
3876
|
return String(item);
|
|
2483
3877
|
}
|
|
2484
3878
|
function isListItem(child) {
|
|
2485
|
-
return
|
|
3879
|
+
return React23__namespace.isValidElement(child) && child.props != null && typeof child.props === "object" && "value" in child.props;
|
|
2486
3880
|
}
|
|
2487
|
-
var ListImpl =
|
|
3881
|
+
var ListImpl = React23__namespace.forwardRef(
|
|
2488
3882
|
(_a, ref) => {
|
|
2489
3883
|
var _b = _a, {
|
|
2490
3884
|
className,
|
|
@@ -2515,12 +3909,12 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2515
3909
|
"innerRadius",
|
|
2516
3910
|
"children"
|
|
2517
3911
|
]);
|
|
2518
|
-
const listRef =
|
|
2519
|
-
const [draggedOrder, setDraggedOrder] =
|
|
3912
|
+
const listRef = React23__namespace.useRef(null);
|
|
3913
|
+
const [draggedOrder, setDraggedOrder] = React23__namespace.useState(
|
|
2520
3914
|
null
|
|
2521
3915
|
);
|
|
2522
|
-
|
|
2523
|
-
const [selectedState, setSelectedState] =
|
|
3916
|
+
React23__namespace.useImperativeHandle(ref, () => listRef.current);
|
|
3917
|
+
const [selectedState, setSelectedState] = React23__namespace.useState(
|
|
2524
3918
|
() => {
|
|
2525
3919
|
var _a2;
|
|
2526
3920
|
const initialValue = (_a2 = value != null ? value : defaultValue) != null ? _a2 : [];
|
|
@@ -2530,13 +3924,13 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2530
3924
|
}
|
|
2531
3925
|
);
|
|
2532
3926
|
const isControlled = value !== void 0;
|
|
2533
|
-
const selectedValues =
|
|
3927
|
+
const selectedValues = React23__namespace.useMemo(() => {
|
|
2534
3928
|
if (isControlled) {
|
|
2535
3929
|
return new Set(Array.isArray(value) ? value : value ? [value] : []);
|
|
2536
3930
|
}
|
|
2537
3931
|
return selectedState;
|
|
2538
3932
|
}, [isControlled, value, selectedState]);
|
|
2539
|
-
const onItemChange =
|
|
3933
|
+
const onItemChange = React23__namespace.useCallback(
|
|
2540
3934
|
(itemValue, selected) => {
|
|
2541
3935
|
const nextSet = new Set(selectedValues);
|
|
2542
3936
|
if (selectionMode === "single-select") {
|
|
@@ -2568,11 +3962,11 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2568
3962
|
coordinateGetter: sortable.sortableKeyboardCoordinates
|
|
2569
3963
|
})
|
|
2570
3964
|
);
|
|
2571
|
-
const itemIds =
|
|
3965
|
+
const itemIds = React23__namespace.useMemo(
|
|
2572
3966
|
() => items ? items.map(resolveItemId) : [],
|
|
2573
3967
|
[items]
|
|
2574
3968
|
);
|
|
2575
|
-
const currentOrder =
|
|
3969
|
+
const currentOrder = React23__namespace.useMemo(
|
|
2576
3970
|
() => draggedOrder || itemIds,
|
|
2577
3971
|
[draggedOrder, itemIds]
|
|
2578
3972
|
);
|
|
@@ -2632,20 +4026,20 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2632
4026
|
}
|
|
2633
4027
|
(_a2 = focusableItems[nextIndex]) == null ? void 0 : _a2.focus();
|
|
2634
4028
|
};
|
|
2635
|
-
const childrenArray =
|
|
4029
|
+
const childrenArray = React23__namespace.Children.toArray(children);
|
|
2636
4030
|
const listItemCount = childrenArray.filter(isListItem).length;
|
|
2637
4031
|
let currentListItemIndex = 0;
|
|
2638
|
-
const processedChildren =
|
|
4032
|
+
const processedChildren = React23__namespace.Children.map(children, (child) => {
|
|
2639
4033
|
if (!isListItem(child)) return child;
|
|
2640
4034
|
const childValue = child.props.value;
|
|
2641
4035
|
const index = reorderable && currentOrder.length > 0 ? currentOrder.indexOf(String(childValue)) : currentListItemIndex;
|
|
2642
4036
|
currentListItemIndex++;
|
|
2643
|
-
return
|
|
4037
|
+
return React23__namespace.cloneElement(
|
|
2644
4038
|
child,
|
|
2645
4039
|
{ _listIndex: index }
|
|
2646
4040
|
);
|
|
2647
4041
|
});
|
|
2648
|
-
const contextValue =
|
|
4042
|
+
const contextValue = React23__namespace.useMemo(
|
|
2649
4043
|
() => ({
|
|
2650
4044
|
selectionMode,
|
|
2651
4045
|
variant,
|
|
@@ -2669,7 +4063,7 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2669
4063
|
innerRadius
|
|
2670
4064
|
]
|
|
2671
4065
|
);
|
|
2672
|
-
const dndId =
|
|
4066
|
+
const dndId = React23__namespace.useId();
|
|
2673
4067
|
const isListbox = selectionMode === "single-select" || selectionMode === "multi-select";
|
|
2674
4068
|
const role = isListbox ? "listbox" : "list";
|
|
2675
4069
|
const ariaMultiselectable = selectionMode === "multi-select" ? true : void 0;
|
|
@@ -2716,13 +4110,13 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2716
4110
|
}
|
|
2717
4111
|
);
|
|
2718
4112
|
ListImpl.displayName = "List";
|
|
2719
|
-
var List =
|
|
4113
|
+
var List = React23__namespace.memo(ListImpl);
|
|
2720
4114
|
var INSET_CLASSES = {
|
|
2721
4115
|
icon: "pl-[56px]",
|
|
2722
4116
|
avatar: "pl-[72px]",
|
|
2723
4117
|
custom: "pl-4"
|
|
2724
4118
|
};
|
|
2725
|
-
var ListDividerImpl =
|
|
4119
|
+
var ListDividerImpl = React23__namespace.forwardRef(
|
|
2726
4120
|
(_a, ref) => {
|
|
2727
4121
|
var _b = _a, { className, inset = false, insetType = "avatar" } = _b, props = __objRest(_b, ["className", "inset", "insetType"]);
|
|
2728
4122
|
const insetClass = inset ? INSET_CLASSES[insetType] : "";
|
|
@@ -2747,7 +4141,7 @@ var ListDividerImpl = React18__namespace.forwardRef(
|
|
|
2747
4141
|
}
|
|
2748
4142
|
);
|
|
2749
4143
|
ListDividerImpl.displayName = "ListDivider";
|
|
2750
|
-
var ListDivider =
|
|
4144
|
+
var ListDivider = React23__namespace.memo(ListDividerImpl);
|
|
2751
4145
|
var MD3_STANDARD = [0.2, 0, 0, 1];
|
|
2752
4146
|
var MD3_FAST_EFFECTS = [0.3, 0, 1, 1];
|
|
2753
4147
|
var CHECKMARK_PATH = "M 4.5 9.5 L 7.5 12.5 L 13.5 5.5";
|
|
@@ -2761,7 +4155,7 @@ var NEXT_STATE = {
|
|
|
2761
4155
|
checked: "indeterminate",
|
|
2762
4156
|
indeterminate: "unchecked"
|
|
2763
4157
|
};
|
|
2764
|
-
var CheckboxVisual =
|
|
4158
|
+
var CheckboxVisual = React23__namespace.memo(function CheckboxVisual2({
|
|
2765
4159
|
isSelected,
|
|
2766
4160
|
isIndeterminate,
|
|
2767
4161
|
containerBg,
|
|
@@ -2832,7 +4226,7 @@ var CheckboxVisual = React18__namespace.memo(function CheckboxVisual2({
|
|
|
2832
4226
|
);
|
|
2833
4227
|
});
|
|
2834
4228
|
function useMergedRef2(externalRef, internalRef) {
|
|
2835
|
-
return
|
|
4229
|
+
return React23__namespace.useCallback(
|
|
2836
4230
|
(node) => {
|
|
2837
4231
|
internalRef.current = node;
|
|
2838
4232
|
if (!externalRef) return;
|
|
@@ -2845,7 +4239,7 @@ function useMergedRef2(externalRef, internalRef) {
|
|
|
2845
4239
|
[externalRef, internalRef]
|
|
2846
4240
|
);
|
|
2847
4241
|
}
|
|
2848
|
-
var CheckboxComponent =
|
|
4242
|
+
var CheckboxComponent = React23__namespace.forwardRef(
|
|
2849
4243
|
({
|
|
2850
4244
|
checked,
|
|
2851
4245
|
defaultChecked = false,
|
|
@@ -2867,20 +4261,20 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
2867
4261
|
}, ref) => {
|
|
2868
4262
|
var _a;
|
|
2869
4263
|
const prefersReduced = (_a = react.useReducedMotion()) != null ? _a : false;
|
|
2870
|
-
const generatedId =
|
|
4264
|
+
const generatedId = React23__namespace.useId();
|
|
2871
4265
|
const inputId = idProp != null ? idProp : label ? `checkbox-${generatedId}` : void 0;
|
|
2872
|
-
const [internalState, setInternalState] =
|
|
4266
|
+
const [internalState, setInternalState] = React23__namespace.useState(
|
|
2873
4267
|
() => defaultChecked ? "checked" : "unchecked"
|
|
2874
4268
|
);
|
|
2875
4269
|
const isControlled = stateProp !== void 0 || checked !== void 0;
|
|
2876
4270
|
const baseState = isControlled ? resolveState(checked, false, stateProp) : internalState;
|
|
2877
4271
|
const effectiveState = indeterminate ? "indeterminate" : baseState;
|
|
2878
|
-
const [ripples, setRipples] =
|
|
2879
|
-
const removeRipple =
|
|
4272
|
+
const [ripples, setRipples] = React23__namespace.useState([]);
|
|
4273
|
+
const removeRipple = React23__namespace.useCallback(
|
|
2880
4274
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
2881
4275
|
[]
|
|
2882
4276
|
);
|
|
2883
|
-
const onPointerDown =
|
|
4277
|
+
const onPointerDown = React23__namespace.useCallback(
|
|
2884
4278
|
(e) => {
|
|
2885
4279
|
if (disabled) return;
|
|
2886
4280
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -2894,7 +4288,7 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
2894
4288
|
},
|
|
2895
4289
|
[disabled]
|
|
2896
4290
|
);
|
|
2897
|
-
const handleChange =
|
|
4291
|
+
const handleChange = React23__namespace.useCallback(
|
|
2898
4292
|
(e) => {
|
|
2899
4293
|
if (disabled) return;
|
|
2900
4294
|
if (stateProp !== void 0) {
|
|
@@ -2920,9 +4314,9 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
2920
4314
|
onCheckedChange
|
|
2921
4315
|
]
|
|
2922
4316
|
);
|
|
2923
|
-
const inputRef =
|
|
4317
|
+
const inputRef = React23__namespace.useRef(null);
|
|
2924
4318
|
const mergedRef = useMergedRef2(ref, inputRef);
|
|
2925
|
-
|
|
4319
|
+
React23__namespace.useEffect(() => {
|
|
2926
4320
|
if (inputRef.current) {
|
|
2927
4321
|
inputRef.current.indeterminate = effectiveState === "indeterminate";
|
|
2928
4322
|
}
|
|
@@ -3047,19 +4441,19 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
3047
4441
|
}
|
|
3048
4442
|
);
|
|
3049
4443
|
CheckboxComponent.displayName = "Checkbox";
|
|
3050
|
-
var Checkbox =
|
|
3051
|
-
var TriStateCheckboxComponent =
|
|
4444
|
+
var Checkbox = React23__namespace.memo(CheckboxComponent);
|
|
4445
|
+
var TriStateCheckboxComponent = React23__namespace.forwardRef((_a, ref) => {
|
|
3052
4446
|
var _b = _a, { state, onStateChange } = _b, rest = __objRest(_b, ["state", "onStateChange"]);
|
|
3053
4447
|
return /* @__PURE__ */ jsxRuntime.jsx(Checkbox, __spreadValues({ ref, state, onStateChange }, rest));
|
|
3054
4448
|
});
|
|
3055
4449
|
TriStateCheckboxComponent.displayName = "TriStateCheckbox";
|
|
3056
|
-
|
|
4450
|
+
React23__namespace.memo(TriStateCheckboxComponent);
|
|
3057
4451
|
var MD3_FAST_EFFECTS2 = [0.3, 0, 1, 1];
|
|
3058
|
-
var RadioGroupContext =
|
|
4452
|
+
var RadioGroupContext = React23__namespace.createContext(
|
|
3059
4453
|
null
|
|
3060
4454
|
);
|
|
3061
4455
|
function useMergedRef3(externalRef, internalRef) {
|
|
3062
|
-
return
|
|
4456
|
+
return React23__namespace.useCallback(
|
|
3063
4457
|
(node) => {
|
|
3064
4458
|
internalRef.current = node;
|
|
3065
4459
|
if (!externalRef) return;
|
|
@@ -3072,7 +4466,7 @@ function useMergedRef3(externalRef, internalRef) {
|
|
|
3072
4466
|
[externalRef, internalRef]
|
|
3073
4467
|
);
|
|
3074
4468
|
}
|
|
3075
|
-
var RadioVisual =
|
|
4469
|
+
var RadioVisual = React23__namespace.memo(function RadioVisual2({
|
|
3076
4470
|
isSelected,
|
|
3077
4471
|
disabled,
|
|
3078
4472
|
error,
|
|
@@ -3125,7 +4519,7 @@ var RadioVisual = React18__namespace.memo(function RadioVisual2({
|
|
|
3125
4519
|
}
|
|
3126
4520
|
);
|
|
3127
4521
|
});
|
|
3128
|
-
var RadioButtonComponent =
|
|
4522
|
+
var RadioButtonComponent = React23__namespace.forwardRef(
|
|
3129
4523
|
({
|
|
3130
4524
|
selected,
|
|
3131
4525
|
defaultSelected = false,
|
|
@@ -3144,23 +4538,23 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3144
4538
|
required: requiredProp
|
|
3145
4539
|
}, ref) => {
|
|
3146
4540
|
var _a, _b;
|
|
3147
|
-
const group =
|
|
4541
|
+
const group = React23__namespace.useContext(RadioGroupContext);
|
|
3148
4542
|
const prefersReduced = (_a = react.useReducedMotion()) != null ? _a : false;
|
|
3149
|
-
const generatedId =
|
|
4543
|
+
const generatedId = React23__namespace.useId();
|
|
3150
4544
|
const inputId = idProp != null ? idProp : label ? `radio-${generatedId}` : void 0;
|
|
3151
4545
|
const name = (_b = group == null ? void 0 : group.name) != null ? _b : nameProp;
|
|
3152
4546
|
const disabled = (group == null ? void 0 : group.disabled) || disabledProp;
|
|
3153
4547
|
const error = (group == null ? void 0 : group.error) || errorProp || color === "error";
|
|
3154
4548
|
const required = (group == null ? void 0 : group.required) || requiredProp;
|
|
3155
|
-
const [internalSelected, setInternalSelected] =
|
|
4549
|
+
const [internalSelected, setInternalSelected] = React23__namespace.useState(defaultSelected);
|
|
3156
4550
|
const isControlled = selected !== void 0;
|
|
3157
4551
|
const isSelected = group ? group.selectedValue === value : isControlled ? selected != null ? selected : false : internalSelected;
|
|
3158
|
-
const [ripples, setRipples] =
|
|
3159
|
-
const removeRipple =
|
|
4552
|
+
const [ripples, setRipples] = React23__namespace.useState([]);
|
|
4553
|
+
const removeRipple = React23__namespace.useCallback(
|
|
3160
4554
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
3161
4555
|
[]
|
|
3162
4556
|
);
|
|
3163
|
-
const onPointerDown =
|
|
4557
|
+
const onPointerDown = React23__namespace.useCallback(
|
|
3164
4558
|
(e) => {
|
|
3165
4559
|
if (disabled) return;
|
|
3166
4560
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -3174,12 +4568,12 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3174
4568
|
},
|
|
3175
4569
|
[disabled]
|
|
3176
4570
|
);
|
|
3177
|
-
const [isHovered, setIsHovered] =
|
|
3178
|
-
const onPointerEnter =
|
|
4571
|
+
const [isHovered, setIsHovered] = React23__namespace.useState(false);
|
|
4572
|
+
const onPointerEnter = React23__namespace.useCallback(() => {
|
|
3179
4573
|
if (!disabled) setIsHovered(true);
|
|
3180
4574
|
}, [disabled]);
|
|
3181
|
-
const onPointerLeave =
|
|
3182
|
-
const handleChange =
|
|
4575
|
+
const onPointerLeave = React23__namespace.useCallback(() => setIsHovered(false), []);
|
|
4576
|
+
const handleChange = React23__namespace.useCallback(
|
|
3183
4577
|
(_e) => {
|
|
3184
4578
|
if (disabled || onClick === null) return;
|
|
3185
4579
|
if (group) {
|
|
@@ -3193,7 +4587,7 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3193
4587
|
},
|
|
3194
4588
|
[disabled, onClick, group, value, isControlled]
|
|
3195
4589
|
);
|
|
3196
|
-
const inputRef =
|
|
4590
|
+
const inputRef = React23__namespace.useRef(null);
|
|
3197
4591
|
const mergedRef = useMergedRef3(ref, inputRef);
|
|
3198
4592
|
const stateLayerBg = error ? "before:bg-m3-error" : "before:bg-m3-primary";
|
|
3199
4593
|
const stateLayerClass = cn(
|
|
@@ -3304,8 +4698,8 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3304
4698
|
}
|
|
3305
4699
|
);
|
|
3306
4700
|
RadioButtonComponent.displayName = "RadioButton";
|
|
3307
|
-
var RadioButton =
|
|
3308
|
-
var RadioGroupComponent =
|
|
4701
|
+
var RadioButton = React23__namespace.memo(RadioButtonComponent);
|
|
4702
|
+
var RadioGroupComponent = React23__namespace.forwardRef(
|
|
3309
4703
|
({
|
|
3310
4704
|
name,
|
|
3311
4705
|
value: valueProp,
|
|
@@ -3320,19 +4714,19 @@ var RadioGroupComponent = React18__namespace.forwardRef(
|
|
|
3320
4714
|
children,
|
|
3321
4715
|
className
|
|
3322
4716
|
}, ref) => {
|
|
3323
|
-
const [internalValue, setInternalValue] =
|
|
4717
|
+
const [internalValue, setInternalValue] = React23__namespace.useState(defaultValue);
|
|
3324
4718
|
const isControlled = valueProp !== void 0;
|
|
3325
4719
|
const selectedValue = isControlled ? valueProp : internalValue;
|
|
3326
|
-
const handleValueChange =
|
|
4720
|
+
const handleValueChange = React23__namespace.useCallback(
|
|
3327
4721
|
(val) => {
|
|
3328
4722
|
if (!isControlled) setInternalValue(val);
|
|
3329
4723
|
onValueChange == null ? void 0 : onValueChange(val);
|
|
3330
4724
|
},
|
|
3331
4725
|
[isControlled, onValueChange]
|
|
3332
4726
|
);
|
|
3333
|
-
const groupRef =
|
|
4727
|
+
const groupRef = React23__namespace.useRef(null);
|
|
3334
4728
|
const mergedRef = useMergedRef3(ref, groupRef);
|
|
3335
|
-
const onKeyDown =
|
|
4729
|
+
const onKeyDown = React23__namespace.useCallback(
|
|
3336
4730
|
(e) => {
|
|
3337
4731
|
var _a, _b;
|
|
3338
4732
|
if (disabled) return;
|
|
@@ -3356,7 +4750,7 @@ var RadioGroupComponent = React18__namespace.forwardRef(
|
|
|
3356
4750
|
},
|
|
3357
4751
|
[disabled, handleValueChange]
|
|
3358
4752
|
);
|
|
3359
|
-
const contextValue =
|
|
4753
|
+
const contextValue = React23__namespace.useMemo(
|
|
3360
4754
|
() => ({
|
|
3361
4755
|
name,
|
|
3362
4756
|
selectedValue,
|
|
@@ -3391,7 +4785,7 @@ var RadioGroupComponent = React18__namespace.forwardRef(
|
|
|
3391
4785
|
}
|
|
3392
4786
|
);
|
|
3393
4787
|
RadioGroupComponent.displayName = "RadioGroup";
|
|
3394
|
-
|
|
4788
|
+
React23__namespace.memo(RadioGroupComponent);
|
|
3395
4789
|
|
|
3396
4790
|
// src/ui/switch/switch.tokens.ts
|
|
3397
4791
|
var SwitchTokens = {
|
|
@@ -3469,7 +4863,7 @@ function isIconVisible(thumbContent, icons, showOnlySelectedIcon, checked) {
|
|
|
3469
4863
|
if (icons) return true;
|
|
3470
4864
|
return showOnlySelectedIcon && checked;
|
|
3471
4865
|
}
|
|
3472
|
-
var SwitchVisual =
|
|
4866
|
+
var SwitchVisual = React23__namespace.memo(function SwitchVisual2({
|
|
3473
4867
|
checked,
|
|
3474
4868
|
disabled,
|
|
3475
4869
|
isPressed,
|
|
@@ -3589,7 +4983,7 @@ var SwitchVisual = React18__namespace.memo(function SwitchVisual2({
|
|
|
3589
4983
|
}
|
|
3590
4984
|
);
|
|
3591
4985
|
});
|
|
3592
|
-
var SwitchComponent =
|
|
4986
|
+
var SwitchComponent = React23__namespace.forwardRef(
|
|
3593
4987
|
({
|
|
3594
4988
|
checked,
|
|
3595
4989
|
onCheckedChange,
|
|
@@ -3607,16 +5001,16 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3607
5001
|
}, ref) => {
|
|
3608
5002
|
var _a;
|
|
3609
5003
|
const prefersReduced = (_a = react.useReducedMotion()) != null ? _a : false;
|
|
3610
|
-
const [isPressed, setIsPressed] =
|
|
3611
|
-
const [isHovered, setIsHovered] =
|
|
3612
|
-
const [isFocused, setIsFocused] =
|
|
3613
|
-
const [ripples, setRipples] =
|
|
3614
|
-
const generatedId =
|
|
5004
|
+
const [isPressed, setIsPressed] = React23__namespace.useState(false);
|
|
5005
|
+
const [isHovered, setIsHovered] = React23__namespace.useState(false);
|
|
5006
|
+
const [isFocused, setIsFocused] = React23__namespace.useState(false);
|
|
5007
|
+
const [ripples, setRipples] = React23__namespace.useState([]);
|
|
5008
|
+
const generatedId = React23__namespace.useId();
|
|
3615
5009
|
const switchId = label ? `switch-${generatedId}` : void 0;
|
|
3616
|
-
const handleClick =
|
|
5010
|
+
const handleClick = React23__namespace.useCallback(() => {
|
|
3617
5011
|
if (!disabled) onCheckedChange(!checked);
|
|
3618
5012
|
}, [disabled, checked, onCheckedChange]);
|
|
3619
|
-
const handleKeyDown =
|
|
5013
|
+
const handleKeyDown = React23__namespace.useCallback(
|
|
3620
5014
|
(e) => {
|
|
3621
5015
|
if (disabled) return;
|
|
3622
5016
|
if (e.key === " " || e.key === "Enter") {
|
|
@@ -3626,7 +5020,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3626
5020
|
},
|
|
3627
5021
|
[disabled, checked, onCheckedChange]
|
|
3628
5022
|
);
|
|
3629
|
-
const handlePointerDown =
|
|
5023
|
+
const handlePointerDown = React23__namespace.useCallback(
|
|
3630
5024
|
(e) => {
|
|
3631
5025
|
if (disabled) return;
|
|
3632
5026
|
setIsPressed(true);
|
|
@@ -3641,19 +5035,19 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3641
5035
|
},
|
|
3642
5036
|
[disabled]
|
|
3643
5037
|
);
|
|
3644
|
-
const handlePointerUp =
|
|
5038
|
+
const handlePointerUp = React23__namespace.useCallback(() => {
|
|
3645
5039
|
setIsPressed(false);
|
|
3646
5040
|
}, []);
|
|
3647
|
-
const handlePointerEnter =
|
|
5041
|
+
const handlePointerEnter = React23__namespace.useCallback(() => {
|
|
3648
5042
|
if (!disabled) setIsHovered(true);
|
|
3649
5043
|
}, [disabled]);
|
|
3650
|
-
const handlePointerLeave =
|
|
5044
|
+
const handlePointerLeave = React23__namespace.useCallback(() => {
|
|
3651
5045
|
setIsHovered(false);
|
|
3652
5046
|
setIsPressed(false);
|
|
3653
5047
|
}, []);
|
|
3654
|
-
const handleFocus =
|
|
3655
|
-
const handleBlur =
|
|
3656
|
-
const removeRipple =
|
|
5048
|
+
const handleFocus = React23__namespace.useCallback(() => setIsFocused(true), []);
|
|
5049
|
+
const handleBlur = React23__namespace.useCallback(() => setIsFocused(false), []);
|
|
5050
|
+
const removeRipple = React23__namespace.useCallback(
|
|
3657
5051
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
3658
5052
|
[]
|
|
3659
5053
|
);
|
|
@@ -3679,7 +5073,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3679
5073
|
onFocus: handleFocus,
|
|
3680
5074
|
onBlur: handleBlur,
|
|
3681
5075
|
className: cn(
|
|
3682
|
-
"relative inline-flex items-center justify-center cursor-pointer select-none",
|
|
5076
|
+
"relative inline-flex items-center justify-center cursor-pointer select-none shrink-0",
|
|
3683
5077
|
// Touch target: 48×48 minimum (pad around 32px track)
|
|
3684
5078
|
"min-w-12 min-h-12",
|
|
3685
5079
|
// Focus ring — MD3 FocusIndicatorColor = secondary
|
|
@@ -3689,7 +5083,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3689
5083
|
disabled && "pointer-events-none cursor-not-allowed",
|
|
3690
5084
|
!label && className
|
|
3691
5085
|
),
|
|
3692
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative overflow-hidden rounded-full", children: [
|
|
5086
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative overflow-hidden rounded-full shrink-0", children: [
|
|
3693
5087
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3694
5088
|
SwitchVisual,
|
|
3695
5089
|
{
|
|
@@ -3738,7 +5132,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3738
5132
|
}
|
|
3739
5133
|
);
|
|
3740
5134
|
SwitchComponent.displayName = "Switch";
|
|
3741
|
-
var Switch =
|
|
5135
|
+
var Switch = React23__namespace.memo(SwitchComponent);
|
|
3742
5136
|
|
|
3743
5137
|
// src/ui/lists/list-utils.ts
|
|
3744
5138
|
function getListItemHeight(hasOverline, supportingTextLines) {
|
|
@@ -3878,7 +5272,7 @@ function renderSwitchTrailing({
|
|
|
3878
5272
|
trailingClass
|
|
3879
5273
|
}) {
|
|
3880
5274
|
const isSelectingMode = selectionMode === "single-select" || selectionMode === "multi-select";
|
|
3881
|
-
const switchElement =
|
|
5275
|
+
const switchElement = React23__namespace.isValidElement(trailingContent) ? (() => {
|
|
3882
5276
|
const trailingProps = trailingContent.props;
|
|
3883
5277
|
const checkedValue = !isSelectingMode && trailingProps.checked !== void 0 ? trailingProps.checked : isSelected;
|
|
3884
5278
|
const disabledValue = trailingProps.disabled !== void 0 ? disabled || trailingProps.disabled : disabled;
|
|
@@ -3889,7 +5283,7 @@ function renderSwitchTrailing({
|
|
|
3889
5283
|
onItemChange(value, checked);
|
|
3890
5284
|
}
|
|
3891
5285
|
};
|
|
3892
|
-
return
|
|
5286
|
+
return React23__namespace.cloneElement(
|
|
3893
5287
|
trailingContent,
|
|
3894
5288
|
{ checked: checkedValue, disabled: disabledValue, onCheckedChange }
|
|
3895
5289
|
);
|
|
@@ -3914,7 +5308,7 @@ function renderSwitchTrailing({
|
|
|
3914
5308
|
)
|
|
3915
5309
|
);
|
|
3916
5310
|
}
|
|
3917
|
-
var ListItemImpl =
|
|
5311
|
+
var ListItemImpl = React23__namespace.forwardRef(
|
|
3918
5312
|
(_a, ref) => {
|
|
3919
5313
|
var _b = _a, {
|
|
3920
5314
|
className,
|
|
@@ -3970,9 +5364,9 @@ var ListItemImpl = React18__namespace.forwardRef(
|
|
|
3970
5364
|
});
|
|
3971
5365
|
const reorderable = (_e = context == null ? void 0 : context.reorderable) != null ? _e : false;
|
|
3972
5366
|
const isSelected = selected !== void 0 ? selected : (_f = context == null ? void 0 : context.selectedValues.has(value)) != null ? _f : false;
|
|
3973
|
-
const [isHovered, setIsHovered] =
|
|
3974
|
-
const [isFocused, setIsFocused] =
|
|
3975
|
-
const [isPressed, setIsPressed] =
|
|
5367
|
+
const [isHovered, setIsHovered] = React23__namespace.useState(false);
|
|
5368
|
+
const [isFocused, setIsFocused] = React23__namespace.useState(false);
|
|
5369
|
+
const [isPressed, setIsPressed] = React23__namespace.useState(false);
|
|
3976
5370
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3977
5371
|
disabled
|
|
3978
5372
|
});
|
|
@@ -3984,8 +5378,8 @@ var ListItemImpl = React18__namespace.forwardRef(
|
|
|
3984
5378
|
transition,
|
|
3985
5379
|
isDragging
|
|
3986
5380
|
} = sortable.useSortable({ id: value, disabled: !reorderable });
|
|
3987
|
-
const itemRef =
|
|
3988
|
-
const setRefs =
|
|
5381
|
+
const itemRef = React23__namespace.useRef(null);
|
|
5382
|
+
const setRefs = React23__namespace.useCallback(
|
|
3989
5383
|
(node) => {
|
|
3990
5384
|
itemRef.current = node;
|
|
3991
5385
|
setNodeRef(node);
|
|
@@ -4438,7 +5832,7 @@ var ListItemImpl = React18__namespace.forwardRef(
|
|
|
4438
5832
|
}
|
|
4439
5833
|
);
|
|
4440
5834
|
ListItemImpl.displayName = "ListItem";
|
|
4441
|
-
var ListItem =
|
|
5835
|
+
var ListItem = React23__namespace.memo(ListItemImpl);
|
|
4442
5836
|
var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface", {
|
|
4443
5837
|
variants: {
|
|
4444
5838
|
variant: {
|
|
@@ -4464,10 +5858,10 @@ var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface"
|
|
|
4464
5858
|
variant: "body-md"
|
|
4465
5859
|
}
|
|
4466
5860
|
});
|
|
4467
|
-
var Text =
|
|
5861
|
+
var Text = React23__namespace.forwardRef(
|
|
4468
5862
|
(_a, ref) => {
|
|
4469
5863
|
var _b = _a, { className, variant, as: Component, color, weight, style } = _b, props = __objRest(_b, ["className", "variant", "as", "color", "weight", "style"]);
|
|
4470
|
-
const defaultComponent =
|
|
5864
|
+
const defaultComponent = React23__namespace.useMemo(() => {
|
|
4471
5865
|
const v = variant ? String(variant).toLowerCase() : "";
|
|
4472
5866
|
if (v.startsWith("display") || v.startsWith("headline")) return "h1";
|
|
4473
5867
|
if (v.startsWith("title")) return "h2";
|
|
@@ -4491,9 +5885,9 @@ function TableOfContents({
|
|
|
4491
5885
|
className,
|
|
4492
5886
|
scrollAreaProps
|
|
4493
5887
|
}) {
|
|
4494
|
-
const [activeId, setActiveId] =
|
|
4495
|
-
const itemIds =
|
|
4496
|
-
|
|
5888
|
+
const [activeId, setActiveId] = React23.useState("");
|
|
5889
|
+
const itemIds = React23.useMemo(() => items.map((i) => i.id), [items]);
|
|
5890
|
+
React23.useEffect(() => {
|
|
4497
5891
|
if (typeof IntersectionObserver === "undefined") return;
|
|
4498
5892
|
const observer = new IntersectionObserver(
|
|
4499
5893
|
(entries) => {
|
|
@@ -4510,7 +5904,7 @@ function TableOfContents({
|
|
|
4510
5904
|
}
|
|
4511
5905
|
return () => observer.disconnect();
|
|
4512
5906
|
}, [itemIds]);
|
|
4513
|
-
const handleClick =
|
|
5907
|
+
const handleClick = React23.useCallback(
|
|
4514
5908
|
(e, id) => {
|
|
4515
5909
|
var _a;
|
|
4516
5910
|
e.preventDefault();
|
|
@@ -5264,9 +6658,9 @@ var TOKEN_TO_PROP = {
|
|
|
5264
6658
|
};
|
|
5265
6659
|
var defaultTokens = new TypographyTokens();
|
|
5266
6660
|
var defaultTypography = new Typography();
|
|
5267
|
-
var TypographyContext =
|
|
6661
|
+
var TypographyContext = React23.createContext(defaultTypography);
|
|
5268
6662
|
function useTypography() {
|
|
5269
|
-
return
|
|
6663
|
+
return React23.useContext(TypographyContext);
|
|
5270
6664
|
}
|
|
5271
6665
|
function TypographyProvider({
|
|
5272
6666
|
children,
|
|
@@ -5274,7 +6668,7 @@ function TypographyProvider({
|
|
|
5274
6668
|
fontFamily,
|
|
5275
6669
|
fontVariationAxes
|
|
5276
6670
|
}) {
|
|
5277
|
-
const value =
|
|
6671
|
+
const value = React23.useMemo(() => {
|
|
5278
6672
|
if (typography) return typography;
|
|
5279
6673
|
if (fontFamily || fontVariationAxes) {
|
|
5280
6674
|
return new Typography(
|
|
@@ -5287,6 +6681,15 @@ function TypographyProvider({
|
|
|
5287
6681
|
}
|
|
5288
6682
|
|
|
5289
6683
|
exports.Card = Card;
|
|
6684
|
+
exports.CardContent = CardContent;
|
|
6685
|
+
exports.CardFooter = CardFooter;
|
|
6686
|
+
exports.CardHeader = CardHeader;
|
|
6687
|
+
exports.CardMedia = CardMedia;
|
|
6688
|
+
exports.Carousel = Carousel;
|
|
6689
|
+
exports.CarouselGrid = CarouselGrid;
|
|
6690
|
+
exports.CarouselItem = CarouselItem;
|
|
6691
|
+
exports.CarouselScrollClient = CarouselScrollClient;
|
|
6692
|
+
exports.CarouselTokens = CarouselTokens;
|
|
5290
6693
|
exports.CodeBlock = CodeBlock;
|
|
5291
6694
|
exports.DEFAULT_FONT_VARIATION_AXES = DEFAULT_FONT_VARIATION_AXES;
|
|
5292
6695
|
exports.Divider = Divider;
|
|
@@ -5296,6 +6699,7 @@ exports.ListContext = ListContext;
|
|
|
5296
6699
|
exports.ListDivider = ListDivider;
|
|
5297
6700
|
exports.ListItem = ListItem;
|
|
5298
6701
|
exports.MD3_EXPRESSIVE_FONT_VARIATION = MD3_EXPRESSIVE_FONT_VARIATION;
|
|
6702
|
+
exports.SHADOW = SHADOW;
|
|
5299
6703
|
exports.ScrollArea = ScrollArea;
|
|
5300
6704
|
exports.ScrollAreaScrollbar = ScrollAreaScrollbar;
|
|
5301
6705
|
exports.TableOfContents = TableOfContents;
|
|
@@ -5306,12 +6710,18 @@ exports.TypographyContext = TypographyContext;
|
|
|
5306
6710
|
exports.TypographyKeyTokens = TypographyKeyTokens;
|
|
5307
6711
|
exports.TypographyProvider = TypographyProvider;
|
|
5308
6712
|
exports.TypographyTokens = TypographyTokens;
|
|
6713
|
+
exports.VARIANT_ELEVATION = VARIANT_ELEVATION;
|
|
5309
6714
|
exports.buildWavePath = buildWavePath;
|
|
6715
|
+
exports.cardVariants = cardVariants;
|
|
5310
6716
|
exports.getExpressiveShape = getExpressiveShape;
|
|
5311
6717
|
exports.getListItemHeight = getListItemHeight;
|
|
6718
|
+
exports.resolveElevationShadow = resolveElevationShadow;
|
|
5312
6719
|
exports.serializeFontVariationAxes = serializeFontVariationAxes;
|
|
5313
6720
|
exports.shouldTopAlign = shouldTopAlign;
|
|
5314
6721
|
exports.typographyVariants = typographyVariants;
|
|
6722
|
+
exports.useCardElevation = useCardElevation;
|
|
6723
|
+
exports.useCarouselA11y = useCarouselA11y;
|
|
6724
|
+
exports.useCarouselKeylines = useCarouselKeylines;
|
|
5315
6725
|
exports.useListContext = useListContext;
|
|
5316
6726
|
exports.useTypography = useTypography;
|
|
5317
6727
|
//# sourceMappingURL=layout.js.map
|