@bug-on/m3-expressive 1.3.1 → 1.3.3
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 +113 -60
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- 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 +9 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +9 -7
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +2 -1
- package/dist/feedback.d.ts +2 -1
- package/dist/feedback.js +11 -8
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +11 -9
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +4 -3
- package/dist/forms.d.ts +4 -3
- package/dist/forms.js +5084 -2987
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +5083 -2989
- 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 +13 -83
- package/dist/index.d.ts +13 -83
- package/dist/index.js +2843 -1210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2692 -1072
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +496 -37
- package/dist/layout.d.ts +496 -37
- package/dist/layout.js +1537 -238
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +1509 -226
- 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 +28 -296
- package/dist/navigation.d.ts +28 -296
- package/dist/navigation.js +584 -288
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +576 -282
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- 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-DTQJjzsB.d.ts → split-button-trailing-uncheckable-CGzk7KcG.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-CIVEYgjY.d.mts → split-button-trailing-uncheckable-gAz6OAIi.d.mts} +1 -1
- package/dist/{text-field-Ear3hCSq.d.mts → text-field-4OlT9o8s.d.mts} +155 -5
- package/dist/{text-field-CiOmDM_8.d.ts → text-field-DARNdj14.d.ts} +155 -5
- package/llms-full.txt +255 -0
- package/llms.txt +102 -0
- package/package.json +10 -5
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",
|
|
@@ -577,7 +1840,7 @@ 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,
|
|
@@ -631,19 +1894,19 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
631
1894
|
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
632
1895
|
const BASELINE_SIZE = 48;
|
|
633
1896
|
const scaleFactor = size / BASELINE_SIZE;
|
|
634
|
-
const effectiveAmplitude =
|
|
1897
|
+
const effectiveAmplitude = React23__namespace.useMemo(
|
|
635
1898
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
636
1899
|
[amplitude, scaleFactor]
|
|
637
1900
|
);
|
|
638
|
-
const effectiveWavelength =
|
|
1901
|
+
const effectiveWavelength = React23__namespace.useMemo(
|
|
639
1902
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
640
1903
|
[wavelength, scaleFactor]
|
|
641
1904
|
);
|
|
642
|
-
const resolvedAmplitudeRange =
|
|
1905
|
+
const resolvedAmplitudeRange = React23__namespace.useMemo(
|
|
643
1906
|
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
644
1907
|
[amplitudeRange, effectiveAmplitude]
|
|
645
1908
|
);
|
|
646
|
-
const wavyActivePath =
|
|
1909
|
+
const wavyActivePath = React23__namespace.useMemo(
|
|
647
1910
|
() => isWavy ? generateWavyCircularPath(
|
|
648
1911
|
center,
|
|
649
1912
|
radius,
|
|
@@ -652,8 +1915,8 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
652
1915
|
) : null,
|
|
653
1916
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
654
1917
|
);
|
|
655
|
-
const circumference =
|
|
656
|
-
const gapForTrack =
|
|
1918
|
+
const circumference = React23__namespace.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
1919
|
+
const gapForTrack = React23__namespace.useMemo(
|
|
657
1920
|
() => (gapSize + trackHeight) / circumference,
|
|
658
1921
|
[gapSize, trackHeight, circumference]
|
|
659
1922
|
);
|
|
@@ -661,17 +1924,17 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
661
1924
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
662
1925
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
663
1926
|
const ActiveCircleElem = react.m.circle;
|
|
664
|
-
const indeterminateSvgRef =
|
|
665
|
-
const indeterminateTrackRef =
|
|
666
|
-
const indeterminateActiveRef =
|
|
667
|
-
const indeterminateWavyTrackPathRef =
|
|
668
|
-
const indeterminateWavyActivePathRef =
|
|
669
|
-
const determinateWavyActivePathRef =
|
|
670
|
-
const determinateWavyTrackPathRef =
|
|
671
|
-
const cachedPathLengthRef =
|
|
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);
|
|
672
1935
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
673
1936
|
const amplitudeMV = react.useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
674
|
-
|
|
1937
|
+
React23__namespace.useEffect(() => {
|
|
675
1938
|
if (isDeterminate) {
|
|
676
1939
|
react.animate(fractionMV, clampedValue / 100, {
|
|
677
1940
|
duration: 0.4,
|
|
@@ -679,7 +1942,7 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
679
1942
|
});
|
|
680
1943
|
}
|
|
681
1944
|
}, [clampedValue, isDeterminate, fractionMV]);
|
|
682
|
-
|
|
1945
|
+
React23__namespace.useEffect(() => {
|
|
683
1946
|
if (!isDeterminate || !isWavy) return;
|
|
684
1947
|
const fraction = clampedValue / 100;
|
|
685
1948
|
let targetAmp = effectiveAmplitude;
|
|
@@ -699,7 +1962,7 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
699
1962
|
amplitudeMV,
|
|
700
1963
|
determinateAnimation
|
|
701
1964
|
]);
|
|
702
|
-
|
|
1965
|
+
React23__namespace.useLayoutEffect(() => {
|
|
703
1966
|
if (!isWavy || !wavyActivePath) {
|
|
704
1967
|
cachedPathLengthRef.current = circumference;
|
|
705
1968
|
return;
|
|
@@ -1076,9 +2339,9 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
1076
2339
|
);
|
|
1077
2340
|
CircularProgress.displayName = "CircularProgress";
|
|
1078
2341
|
function useContainerWidth() {
|
|
1079
|
-
const [width, setWidth] =
|
|
1080
|
-
const observerRef =
|
|
1081
|
-
const ref =
|
|
2342
|
+
const [width, setWidth] = React23__namespace.useState(0);
|
|
2343
|
+
const observerRef = React23__namespace.useRef(null);
|
|
2344
|
+
const ref = React23__namespace.useCallback((node) => {
|
|
1082
2345
|
if (observerRef.current) {
|
|
1083
2346
|
observerRef.current.disconnect();
|
|
1084
2347
|
observerRef.current = null;
|
|
@@ -1092,7 +2355,7 @@ function useContainerWidth() {
|
|
|
1092
2355
|
observerRef.current = obs;
|
|
1093
2356
|
}
|
|
1094
2357
|
}, []);
|
|
1095
|
-
|
|
2358
|
+
React23__namespace.useEffect(() => {
|
|
1096
2359
|
return () => {
|
|
1097
2360
|
if (observerRef.current) {
|
|
1098
2361
|
observerRef.current.disconnect();
|
|
@@ -1102,7 +2365,7 @@ function useContainerWidth() {
|
|
|
1102
2365
|
return [ref, width];
|
|
1103
2366
|
}
|
|
1104
2367
|
function useMergedRef(...refs) {
|
|
1105
|
-
return
|
|
2368
|
+
return React23__namespace.useCallback(
|
|
1106
2369
|
(node) => {
|
|
1107
2370
|
for (const ref of refs) {
|
|
1108
2371
|
if (typeof ref === "function") {
|
|
@@ -1116,7 +2379,7 @@ function useMergedRef(...refs) {
|
|
|
1116
2379
|
[refs]
|
|
1117
2380
|
);
|
|
1118
2381
|
}
|
|
1119
|
-
var FlatLinearTrack =
|
|
2382
|
+
var FlatLinearTrack = React23__namespace.memo(function FlatLinearTrack2({
|
|
1120
2383
|
trackHeight,
|
|
1121
2384
|
activeColor,
|
|
1122
2385
|
trackColor,
|
|
@@ -1192,7 +2455,7 @@ var FlatLinearTrack = React18__namespace.memo(function FlatLinearTrack2({
|
|
|
1192
2455
|
}
|
|
1193
2456
|
);
|
|
1194
2457
|
});
|
|
1195
|
-
var WavyLinearTrack =
|
|
2458
|
+
var WavyLinearTrack = React23__namespace.memo(function WavyLinearTrack2({
|
|
1196
2459
|
trackHeight,
|
|
1197
2460
|
svgHeight,
|
|
1198
2461
|
amplitude,
|
|
@@ -1211,13 +2474,13 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
1211
2474
|
}) {
|
|
1212
2475
|
const isDeterminate = typeof value === "number";
|
|
1213
2476
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
1214
|
-
const titleId =
|
|
2477
|
+
const titleId = React23__namespace.useId();
|
|
1215
2478
|
const [containerRef, width] = useContainerWidth();
|
|
1216
|
-
const activePathRef =
|
|
1217
|
-
const trackPathRef =
|
|
2479
|
+
const activePathRef = React23__namespace.useRef(null);
|
|
2480
|
+
const trackPathRef = React23__namespace.useRef(null);
|
|
1218
2481
|
const amplitudeMV = react.useMotionValue(amplitude);
|
|
1219
2482
|
const fractionMV = react.useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
1220
|
-
|
|
2483
|
+
React23__namespace.useEffect(() => {
|
|
1221
2484
|
if (isDeterminate) {
|
|
1222
2485
|
const fraction = clampedValue / 100;
|
|
1223
2486
|
let targetAmp = amplitude;
|
|
@@ -1405,7 +2668,7 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
1405
2668
|
}
|
|
1406
2669
|
);
|
|
1407
2670
|
});
|
|
1408
|
-
var LinearProgress =
|
|
2671
|
+
var LinearProgress = React23__namespace.forwardRef(
|
|
1409
2672
|
(_a, ref) => {
|
|
1410
2673
|
var _b = _a, {
|
|
1411
2674
|
value,
|
|
@@ -1446,10 +2709,10 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1446
2709
|
]);
|
|
1447
2710
|
const isDeterminate = value !== void 0;
|
|
1448
2711
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
1449
|
-
const containerRef =
|
|
2712
|
+
const containerRef = React23__namespace.useRef(null);
|
|
1450
2713
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
1451
|
-
const [isRtl, setIsRtl] =
|
|
1452
|
-
|
|
2714
|
+
const [isRtl, setIsRtl] = React23__namespace.useState(false);
|
|
2715
|
+
React23__namespace.useEffect(() => {
|
|
1453
2716
|
if (containerRef.current) {
|
|
1454
2717
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
1455
2718
|
setIsRtl(dir === "rtl");
|
|
@@ -1457,16 +2720,16 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1457
2720
|
}, []);
|
|
1458
2721
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1459
2722
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1460
|
-
const effectiveAmplitude =
|
|
1461
|
-
const svgHeight =
|
|
2723
|
+
const effectiveAmplitude = React23__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
2724
|
+
const svgHeight = React23__namespace.useMemo(
|
|
1462
2725
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1463
2726
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1464
2727
|
);
|
|
1465
|
-
const shouldShowStop =
|
|
2728
|
+
const shouldShowStop = React23__namespace.useMemo(
|
|
1466
2729
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1467
2730
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1468
2731
|
);
|
|
1469
|
-
const stopSize =
|
|
2732
|
+
const stopSize = React23__namespace.useMemo(
|
|
1470
2733
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
1471
2734
|
[trackHeight]
|
|
1472
2735
|
);
|
|
@@ -1541,7 +2804,7 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1541
2804
|
}
|
|
1542
2805
|
);
|
|
1543
2806
|
LinearProgress.displayName = "LinearProgress";
|
|
1544
|
-
var ProgressIndicator =
|
|
2807
|
+
var ProgressIndicator = React23__namespace.forwardRef((props, ref) => {
|
|
1545
2808
|
if (props.variant === "circular") {
|
|
1546
2809
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
1547
2810
|
}
|
|
@@ -1795,7 +3058,7 @@ function AnimatedIconSlot({
|
|
|
1795
3058
|
}
|
|
1796
3059
|
);
|
|
1797
3060
|
}
|
|
1798
|
-
var ButtonComponent =
|
|
3061
|
+
var ButtonComponent = React23__namespace.forwardRef(
|
|
1799
3062
|
(_a, ref) => {
|
|
1800
3063
|
var _b = _a, {
|
|
1801
3064
|
className,
|
|
@@ -1861,9 +3124,9 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1861
3124
|
borderWidth: outlineWidth != null ? outlineWidth : colorStyle === "outlined" ? sizeTokens.outlineWidth : 0,
|
|
1862
3125
|
borderStyle: colorStyle === "outlined" ? "solid" : void 0
|
|
1863
3126
|
}, style);
|
|
1864
|
-
const labelText =
|
|
3127
|
+
const labelText = React23__namespace.useMemo(() => {
|
|
1865
3128
|
if (asChild) {
|
|
1866
|
-
const child =
|
|
3129
|
+
const child = React23__namespace.Children.only(children);
|
|
1867
3130
|
return child.props.children;
|
|
1868
3131
|
}
|
|
1869
3132
|
return children;
|
|
@@ -1871,8 +3134,8 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1871
3134
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
1872
3135
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
1873
3136
|
const motionRadius = react.useMotionValue(animateRadius);
|
|
1874
|
-
const asChildRef =
|
|
1875
|
-
const mergedRef =
|
|
3137
|
+
const asChildRef = React23__namespace.useRef(null);
|
|
3138
|
+
const mergedRef = React23__namespace.useCallback(
|
|
1876
3139
|
(node) => {
|
|
1877
3140
|
asChildRef.current = node;
|
|
1878
3141
|
if (typeof ref === "function") ref(node);
|
|
@@ -1881,14 +3144,14 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1881
3144
|
},
|
|
1882
3145
|
[ref]
|
|
1883
3146
|
);
|
|
1884
|
-
|
|
3147
|
+
React23__namespace.useEffect(() => {
|
|
1885
3148
|
if (!asChild) return;
|
|
1886
3149
|
return motionRadius.on("change", (v) => {
|
|
1887
3150
|
if (asChildRef.current)
|
|
1888
3151
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
1889
3152
|
});
|
|
1890
3153
|
}, [motionRadius, asChild]);
|
|
1891
|
-
|
|
3154
|
+
React23__namespace.useEffect(() => {
|
|
1892
3155
|
if (!asChild) return;
|
|
1893
3156
|
const controls = springAnimate(motionRadius, animateRadius);
|
|
1894
3157
|
return () => controls.stop();
|
|
@@ -1896,14 +3159,14 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1896
3159
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
1897
3160
|
disabled: loading
|
|
1898
3161
|
});
|
|
1899
|
-
const handleClick =
|
|
3162
|
+
const handleClick = React23__namespace.useCallback(
|
|
1900
3163
|
(e) => {
|
|
1901
3164
|
if (loading) return e.preventDefault();
|
|
1902
3165
|
onClick == null ? void 0 : onClick(e);
|
|
1903
3166
|
},
|
|
1904
3167
|
[loading, onClick]
|
|
1905
3168
|
);
|
|
1906
|
-
const handleKeyDown =
|
|
3169
|
+
const handleKeyDown = React23__namespace.useCallback(
|
|
1907
3170
|
(e) => {
|
|
1908
3171
|
if (loading) return;
|
|
1909
3172
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -1982,17 +3245,17 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
1982
3245
|
isSelected && selectedIcon ? "selected-icon" : "icon"
|
|
1983
3246
|
) })
|
|
1984
3247
|
] });
|
|
1985
|
-
const handleAsChildPointerDown =
|
|
3248
|
+
const handleAsChildPointerDown = React23__namespace.useCallback(
|
|
1986
3249
|
(e) => {
|
|
1987
3250
|
springAnimate(motionRadius, pressedRadius);
|
|
1988
3251
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
1989
3252
|
},
|
|
1990
3253
|
[motionRadius, pressedRadius, onPointerDown]
|
|
1991
3254
|
);
|
|
1992
|
-
const handleAsChildPointerUp =
|
|
3255
|
+
const handleAsChildPointerUp = React23__namespace.useCallback(() => {
|
|
1993
3256
|
springAnimate(motionRadius, animateRadius);
|
|
1994
3257
|
}, [motionRadius, animateRadius]);
|
|
1995
|
-
const handlePointerDown =
|
|
3258
|
+
const handlePointerDown = React23__namespace.useCallback(
|
|
1996
3259
|
(e) => {
|
|
1997
3260
|
onPointerDown(e);
|
|
1998
3261
|
},
|
|
@@ -2002,7 +3265,7 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
2002
3265
|
const strippedProps = __spreadValues({}, restProps);
|
|
2003
3266
|
for (const key of MOTION_PROP_KEYS) delete strippedProps[key];
|
|
2004
3267
|
const htmlProps = strippedProps;
|
|
2005
|
-
const child =
|
|
3268
|
+
const child = React23__namespace.Children.only(children);
|
|
2006
3269
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2007
3270
|
reactSlot.Slot,
|
|
2008
3271
|
__spreadProps(__spreadValues({
|
|
@@ -2019,7 +3282,7 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
2019
3282
|
}),
|
|
2020
3283
|
className: buttonClassName
|
|
2021
3284
|
}, htmlProps), {
|
|
2022
|
-
children:
|
|
3285
|
+
children: React23__namespace.cloneElement(child, { children: innerContent })
|
|
2023
3286
|
})
|
|
2024
3287
|
) });
|
|
2025
3288
|
}
|
|
@@ -2047,13 +3310,13 @@ var ButtonComponent = React18__namespace.forwardRef(
|
|
|
2047
3310
|
}
|
|
2048
3311
|
);
|
|
2049
3312
|
ButtonComponent.displayName = "Button";
|
|
2050
|
-
var Button =
|
|
3313
|
+
var Button = React23__namespace.memo(ButtonComponent);
|
|
2051
3314
|
var VARIANT_FONT = {
|
|
2052
3315
|
outlined: "'Material Symbols Outlined'",
|
|
2053
3316
|
rounded: "'Material Symbols Rounded'",
|
|
2054
3317
|
sharp: "'Material Symbols Sharp'"
|
|
2055
3318
|
};
|
|
2056
|
-
var IconComponent =
|
|
3319
|
+
var IconComponent = React23__namespace.forwardRef(
|
|
2057
3320
|
(_a, ref) => {
|
|
2058
3321
|
var _b = _a, {
|
|
2059
3322
|
name,
|
|
@@ -2119,8 +3382,8 @@ var IconComponent = React18__namespace.forwardRef(
|
|
|
2119
3382
|
}
|
|
2120
3383
|
);
|
|
2121
3384
|
IconComponent.displayName = "Icon";
|
|
2122
|
-
var Icon =
|
|
2123
|
-
var ScrollArea =
|
|
3385
|
+
var Icon = React23__namespace.memo(IconComponent);
|
|
3386
|
+
var ScrollArea = React23__namespace.forwardRef(
|
|
2124
3387
|
(_a, ref) => {
|
|
2125
3388
|
var _b = _a, {
|
|
2126
3389
|
className,
|
|
@@ -2141,15 +3404,15 @@ var ScrollArea = React18__namespace.forwardRef(
|
|
|
2141
3404
|
"viewportRef",
|
|
2142
3405
|
"viewportProps"
|
|
2143
3406
|
]);
|
|
2144
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
2145
|
-
|
|
3407
|
+
const [isTouchDevice, setIsTouchDevice] = React23__namespace.useState(false);
|
|
3408
|
+
React23__namespace.useEffect(() => {
|
|
2146
3409
|
if (typeof window !== "undefined") {
|
|
2147
3410
|
setIsTouchDevice(
|
|
2148
3411
|
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2149
3412
|
);
|
|
2150
3413
|
}
|
|
2151
3414
|
}, []);
|
|
2152
|
-
const resolvedType =
|
|
3415
|
+
const resolvedType = React23__namespace.useMemo(() => {
|
|
2153
3416
|
if (type === "hover" && isTouchDevice) {
|
|
2154
3417
|
return "scroll";
|
|
2155
3418
|
}
|
|
@@ -2200,7 +3463,7 @@ var ScrollArea = React18__namespace.forwardRef(
|
|
|
2200
3463
|
}
|
|
2201
3464
|
);
|
|
2202
3465
|
ScrollArea.displayName = "ScrollArea";
|
|
2203
|
-
var ScrollAreaScrollbar =
|
|
3466
|
+
var ScrollAreaScrollbar = React23__namespace.forwardRef((_a, ref) => {
|
|
2204
3467
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2205
3468
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2206
3469
|
RadixScrollArea__namespace.Scrollbar,
|
|
@@ -2230,7 +3493,7 @@ var ScrollAreaScrollbar = React18__namespace.forwardRef((_a, ref) => {
|
|
|
2230
3493
|
);
|
|
2231
3494
|
});
|
|
2232
3495
|
ScrollAreaScrollbar.displayName = RadixScrollArea__namespace.Scrollbar.displayName;
|
|
2233
|
-
var ScrollAreaCorner =
|
|
3496
|
+
var ScrollAreaCorner = React23__namespace.forwardRef((_a, ref) => {
|
|
2234
3497
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2235
3498
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2236
3499
|
RadixScrollArea__namespace.Corner,
|
|
@@ -2325,7 +3588,7 @@ function mapDomToReact(node, key) {
|
|
|
2325
3588
|
props[propName] = attr.value;
|
|
2326
3589
|
}
|
|
2327
3590
|
}
|
|
2328
|
-
return
|
|
3591
|
+
return React23.createElement(
|
|
2329
3592
|
tagName,
|
|
2330
3593
|
props,
|
|
2331
3594
|
Array.from(el.childNodes).map((child, i) => mapDomToReact(child, i))
|
|
@@ -2334,8 +3597,8 @@ function mapDomToReact(node, key) {
|
|
|
2334
3597
|
return null;
|
|
2335
3598
|
}
|
|
2336
3599
|
function CodeContent({ html, code }) {
|
|
2337
|
-
const [parsedContent, setParsedContent] =
|
|
2338
|
-
|
|
3600
|
+
const [parsedContent, setParsedContent] = React23.useState(null);
|
|
3601
|
+
React23.useEffect(() => {
|
|
2339
3602
|
if (html) {
|
|
2340
3603
|
const parser = new DOMParser();
|
|
2341
3604
|
const doc = parser.parseFromString(html, "text/html");
|
|
@@ -2365,8 +3628,8 @@ function CodeBlock({
|
|
|
2365
3628
|
className,
|
|
2366
3629
|
html
|
|
2367
3630
|
}) {
|
|
2368
|
-
const [copied, setCopied] =
|
|
2369
|
-
const handleCopy =
|
|
3631
|
+
const [copied, setCopied] = React23.useState(false);
|
|
3632
|
+
const handleCopy = React23.useCallback(async () => {
|
|
2370
3633
|
try {
|
|
2371
3634
|
await navigator.clipboard.writeText(code);
|
|
2372
3635
|
setCopied(true);
|
|
@@ -2426,7 +3689,7 @@ function buildWavePath(startX, endX, amplitude = 2, wavelength = 32, yCenter = 4
|
|
|
2426
3689
|
}
|
|
2427
3690
|
return d;
|
|
2428
3691
|
}
|
|
2429
|
-
var DividerImpl =
|
|
3692
|
+
var DividerImpl = React23__namespace.forwardRef(
|
|
2430
3693
|
(_a, ref) => {
|
|
2431
3694
|
var _b = _a, {
|
|
2432
3695
|
variant = "full-bleed",
|
|
@@ -2546,9 +3809,9 @@ var DividerImpl = React18__namespace.forwardRef(
|
|
|
2546
3809
|
}
|
|
2547
3810
|
);
|
|
2548
3811
|
DividerImpl.displayName = "Divider";
|
|
2549
|
-
var Divider =
|
|
2550
|
-
var ListContext =
|
|
2551
|
-
var useListContext = () =>
|
|
3812
|
+
var Divider = React23__namespace.memo(DividerImpl);
|
|
3813
|
+
var ListContext = React23__namespace.createContext(null);
|
|
3814
|
+
var useListContext = () => React23__namespace.useContext(ListContext);
|
|
2552
3815
|
var LIST_TOKENS = {
|
|
2553
3816
|
oneLineHeight: 56,
|
|
2554
3817
|
twoLineHeight: 72,
|
|
@@ -2613,9 +3876,9 @@ function resolveItemId(item) {
|
|
|
2613
3876
|
return String(item);
|
|
2614
3877
|
}
|
|
2615
3878
|
function isListItem(child) {
|
|
2616
|
-
return
|
|
3879
|
+
return React23__namespace.isValidElement(child) && child.props != null && typeof child.props === "object" && "value" in child.props;
|
|
2617
3880
|
}
|
|
2618
|
-
var ListImpl =
|
|
3881
|
+
var ListImpl = React23__namespace.forwardRef(
|
|
2619
3882
|
(_a, ref) => {
|
|
2620
3883
|
var _b = _a, {
|
|
2621
3884
|
className,
|
|
@@ -2646,12 +3909,12 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2646
3909
|
"innerRadius",
|
|
2647
3910
|
"children"
|
|
2648
3911
|
]);
|
|
2649
|
-
const listRef =
|
|
2650
|
-
const [draggedOrder, setDraggedOrder] =
|
|
3912
|
+
const listRef = React23__namespace.useRef(null);
|
|
3913
|
+
const [draggedOrder, setDraggedOrder] = React23__namespace.useState(
|
|
2651
3914
|
null
|
|
2652
3915
|
);
|
|
2653
|
-
|
|
2654
|
-
const [selectedState, setSelectedState] =
|
|
3916
|
+
React23__namespace.useImperativeHandle(ref, () => listRef.current);
|
|
3917
|
+
const [selectedState, setSelectedState] = React23__namespace.useState(
|
|
2655
3918
|
() => {
|
|
2656
3919
|
var _a2;
|
|
2657
3920
|
const initialValue = (_a2 = value != null ? value : defaultValue) != null ? _a2 : [];
|
|
@@ -2661,13 +3924,13 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2661
3924
|
}
|
|
2662
3925
|
);
|
|
2663
3926
|
const isControlled = value !== void 0;
|
|
2664
|
-
const selectedValues =
|
|
3927
|
+
const selectedValues = React23__namespace.useMemo(() => {
|
|
2665
3928
|
if (isControlled) {
|
|
2666
3929
|
return new Set(Array.isArray(value) ? value : value ? [value] : []);
|
|
2667
3930
|
}
|
|
2668
3931
|
return selectedState;
|
|
2669
3932
|
}, [isControlled, value, selectedState]);
|
|
2670
|
-
const onItemChange =
|
|
3933
|
+
const onItemChange = React23__namespace.useCallback(
|
|
2671
3934
|
(itemValue, selected) => {
|
|
2672
3935
|
const nextSet = new Set(selectedValues);
|
|
2673
3936
|
if (selectionMode === "single-select") {
|
|
@@ -2699,11 +3962,11 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2699
3962
|
coordinateGetter: sortable.sortableKeyboardCoordinates
|
|
2700
3963
|
})
|
|
2701
3964
|
);
|
|
2702
|
-
const itemIds =
|
|
3965
|
+
const itemIds = React23__namespace.useMemo(
|
|
2703
3966
|
() => items ? items.map(resolveItemId) : [],
|
|
2704
3967
|
[items]
|
|
2705
3968
|
);
|
|
2706
|
-
const currentOrder =
|
|
3969
|
+
const currentOrder = React23__namespace.useMemo(
|
|
2707
3970
|
() => draggedOrder || itemIds,
|
|
2708
3971
|
[draggedOrder, itemIds]
|
|
2709
3972
|
);
|
|
@@ -2763,20 +4026,20 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2763
4026
|
}
|
|
2764
4027
|
(_a2 = focusableItems[nextIndex]) == null ? void 0 : _a2.focus();
|
|
2765
4028
|
};
|
|
2766
|
-
const childrenArray =
|
|
4029
|
+
const childrenArray = React23__namespace.Children.toArray(children);
|
|
2767
4030
|
const listItemCount = childrenArray.filter(isListItem).length;
|
|
2768
4031
|
let currentListItemIndex = 0;
|
|
2769
|
-
const processedChildren =
|
|
4032
|
+
const processedChildren = React23__namespace.Children.map(children, (child) => {
|
|
2770
4033
|
if (!isListItem(child)) return child;
|
|
2771
4034
|
const childValue = child.props.value;
|
|
2772
4035
|
const index = reorderable && currentOrder.length > 0 ? currentOrder.indexOf(String(childValue)) : currentListItemIndex;
|
|
2773
4036
|
currentListItemIndex++;
|
|
2774
|
-
return
|
|
4037
|
+
return React23__namespace.cloneElement(
|
|
2775
4038
|
child,
|
|
2776
4039
|
{ _listIndex: index }
|
|
2777
4040
|
);
|
|
2778
4041
|
});
|
|
2779
|
-
const contextValue =
|
|
4042
|
+
const contextValue = React23__namespace.useMemo(
|
|
2780
4043
|
() => ({
|
|
2781
4044
|
selectionMode,
|
|
2782
4045
|
variant,
|
|
@@ -2800,7 +4063,7 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2800
4063
|
innerRadius
|
|
2801
4064
|
]
|
|
2802
4065
|
);
|
|
2803
|
-
const dndId =
|
|
4066
|
+
const dndId = React23__namespace.useId();
|
|
2804
4067
|
const isListbox = selectionMode === "single-select" || selectionMode === "multi-select";
|
|
2805
4068
|
const role = isListbox ? "listbox" : "list";
|
|
2806
4069
|
const ariaMultiselectable = selectionMode === "multi-select" ? true : void 0;
|
|
@@ -2847,13 +4110,13 @@ var ListImpl = React18__namespace.forwardRef(
|
|
|
2847
4110
|
}
|
|
2848
4111
|
);
|
|
2849
4112
|
ListImpl.displayName = "List";
|
|
2850
|
-
var List =
|
|
4113
|
+
var List = React23__namespace.memo(ListImpl);
|
|
2851
4114
|
var INSET_CLASSES = {
|
|
2852
4115
|
icon: "pl-[56px]",
|
|
2853
4116
|
avatar: "pl-[72px]",
|
|
2854
4117
|
custom: "pl-4"
|
|
2855
4118
|
};
|
|
2856
|
-
var ListDividerImpl =
|
|
4119
|
+
var ListDividerImpl = React23__namespace.forwardRef(
|
|
2857
4120
|
(_a, ref) => {
|
|
2858
4121
|
var _b = _a, { className, inset = false, insetType = "avatar" } = _b, props = __objRest(_b, ["className", "inset", "insetType"]);
|
|
2859
4122
|
const insetClass = inset ? INSET_CLASSES[insetType] : "";
|
|
@@ -2878,7 +4141,7 @@ var ListDividerImpl = React18__namespace.forwardRef(
|
|
|
2878
4141
|
}
|
|
2879
4142
|
);
|
|
2880
4143
|
ListDividerImpl.displayName = "ListDivider";
|
|
2881
|
-
var ListDivider =
|
|
4144
|
+
var ListDivider = React23__namespace.memo(ListDividerImpl);
|
|
2882
4145
|
var MD3_STANDARD = [0.2, 0, 0, 1];
|
|
2883
4146
|
var MD3_FAST_EFFECTS = [0.3, 0, 1, 1];
|
|
2884
4147
|
var CHECKMARK_PATH = "M 4.5 9.5 L 7.5 12.5 L 13.5 5.5";
|
|
@@ -2892,7 +4155,7 @@ var NEXT_STATE = {
|
|
|
2892
4155
|
checked: "indeterminate",
|
|
2893
4156
|
indeterminate: "unchecked"
|
|
2894
4157
|
};
|
|
2895
|
-
var CheckboxVisual =
|
|
4158
|
+
var CheckboxVisual = React23__namespace.memo(function CheckboxVisual2({
|
|
2896
4159
|
isSelected,
|
|
2897
4160
|
isIndeterminate,
|
|
2898
4161
|
containerBg,
|
|
@@ -2963,7 +4226,7 @@ var CheckboxVisual = React18__namespace.memo(function CheckboxVisual2({
|
|
|
2963
4226
|
);
|
|
2964
4227
|
});
|
|
2965
4228
|
function useMergedRef2(externalRef, internalRef) {
|
|
2966
|
-
return
|
|
4229
|
+
return React23__namespace.useCallback(
|
|
2967
4230
|
(node) => {
|
|
2968
4231
|
internalRef.current = node;
|
|
2969
4232
|
if (!externalRef) return;
|
|
@@ -2976,7 +4239,7 @@ function useMergedRef2(externalRef, internalRef) {
|
|
|
2976
4239
|
[externalRef, internalRef]
|
|
2977
4240
|
);
|
|
2978
4241
|
}
|
|
2979
|
-
var CheckboxComponent =
|
|
4242
|
+
var CheckboxComponent = React23__namespace.forwardRef(
|
|
2980
4243
|
({
|
|
2981
4244
|
checked,
|
|
2982
4245
|
defaultChecked = false,
|
|
@@ -2998,20 +4261,20 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
2998
4261
|
}, ref) => {
|
|
2999
4262
|
var _a;
|
|
3000
4263
|
const prefersReduced = (_a = react.useReducedMotion()) != null ? _a : false;
|
|
3001
|
-
const generatedId =
|
|
4264
|
+
const generatedId = React23__namespace.useId();
|
|
3002
4265
|
const inputId = idProp != null ? idProp : label ? `checkbox-${generatedId}` : void 0;
|
|
3003
|
-
const [internalState, setInternalState] =
|
|
4266
|
+
const [internalState, setInternalState] = React23__namespace.useState(
|
|
3004
4267
|
() => defaultChecked ? "checked" : "unchecked"
|
|
3005
4268
|
);
|
|
3006
4269
|
const isControlled = stateProp !== void 0 || checked !== void 0;
|
|
3007
4270
|
const baseState = isControlled ? resolveState(checked, false, stateProp) : internalState;
|
|
3008
4271
|
const effectiveState = indeterminate ? "indeterminate" : baseState;
|
|
3009
|
-
const [ripples, setRipples] =
|
|
3010
|
-
const removeRipple =
|
|
4272
|
+
const [ripples, setRipples] = React23__namespace.useState([]);
|
|
4273
|
+
const removeRipple = React23__namespace.useCallback(
|
|
3011
4274
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
3012
4275
|
[]
|
|
3013
4276
|
);
|
|
3014
|
-
const onPointerDown =
|
|
4277
|
+
const onPointerDown = React23__namespace.useCallback(
|
|
3015
4278
|
(e) => {
|
|
3016
4279
|
if (disabled) return;
|
|
3017
4280
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -3025,7 +4288,7 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
3025
4288
|
},
|
|
3026
4289
|
[disabled]
|
|
3027
4290
|
);
|
|
3028
|
-
const handleChange =
|
|
4291
|
+
const handleChange = React23__namespace.useCallback(
|
|
3029
4292
|
(e) => {
|
|
3030
4293
|
if (disabled) return;
|
|
3031
4294
|
if (stateProp !== void 0) {
|
|
@@ -3051,9 +4314,9 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
3051
4314
|
onCheckedChange
|
|
3052
4315
|
]
|
|
3053
4316
|
);
|
|
3054
|
-
const inputRef =
|
|
4317
|
+
const inputRef = React23__namespace.useRef(null);
|
|
3055
4318
|
const mergedRef = useMergedRef2(ref, inputRef);
|
|
3056
|
-
|
|
4319
|
+
React23__namespace.useEffect(() => {
|
|
3057
4320
|
if (inputRef.current) {
|
|
3058
4321
|
inputRef.current.indeterminate = effectiveState === "indeterminate";
|
|
3059
4322
|
}
|
|
@@ -3178,19 +4441,19 @@ var CheckboxComponent = React18__namespace.forwardRef(
|
|
|
3178
4441
|
}
|
|
3179
4442
|
);
|
|
3180
4443
|
CheckboxComponent.displayName = "Checkbox";
|
|
3181
|
-
var Checkbox =
|
|
3182
|
-
var TriStateCheckboxComponent =
|
|
4444
|
+
var Checkbox = React23__namespace.memo(CheckboxComponent);
|
|
4445
|
+
var TriStateCheckboxComponent = React23__namespace.forwardRef((_a, ref) => {
|
|
3183
4446
|
var _b = _a, { state, onStateChange } = _b, rest = __objRest(_b, ["state", "onStateChange"]);
|
|
3184
4447
|
return /* @__PURE__ */ jsxRuntime.jsx(Checkbox, __spreadValues({ ref, state, onStateChange }, rest));
|
|
3185
4448
|
});
|
|
3186
4449
|
TriStateCheckboxComponent.displayName = "TriStateCheckbox";
|
|
3187
|
-
|
|
4450
|
+
React23__namespace.memo(TriStateCheckboxComponent);
|
|
3188
4451
|
var MD3_FAST_EFFECTS2 = [0.3, 0, 1, 1];
|
|
3189
|
-
var RadioGroupContext =
|
|
4452
|
+
var RadioGroupContext = React23__namespace.createContext(
|
|
3190
4453
|
null
|
|
3191
4454
|
);
|
|
3192
4455
|
function useMergedRef3(externalRef, internalRef) {
|
|
3193
|
-
return
|
|
4456
|
+
return React23__namespace.useCallback(
|
|
3194
4457
|
(node) => {
|
|
3195
4458
|
internalRef.current = node;
|
|
3196
4459
|
if (!externalRef) return;
|
|
@@ -3203,7 +4466,7 @@ function useMergedRef3(externalRef, internalRef) {
|
|
|
3203
4466
|
[externalRef, internalRef]
|
|
3204
4467
|
);
|
|
3205
4468
|
}
|
|
3206
|
-
var RadioVisual =
|
|
4469
|
+
var RadioVisual = React23__namespace.memo(function RadioVisual2({
|
|
3207
4470
|
isSelected,
|
|
3208
4471
|
disabled,
|
|
3209
4472
|
error,
|
|
@@ -3256,7 +4519,7 @@ var RadioVisual = React18__namespace.memo(function RadioVisual2({
|
|
|
3256
4519
|
}
|
|
3257
4520
|
);
|
|
3258
4521
|
});
|
|
3259
|
-
var RadioButtonComponent =
|
|
4522
|
+
var RadioButtonComponent = React23__namespace.forwardRef(
|
|
3260
4523
|
({
|
|
3261
4524
|
selected,
|
|
3262
4525
|
defaultSelected = false,
|
|
@@ -3275,23 +4538,23 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3275
4538
|
required: requiredProp
|
|
3276
4539
|
}, ref) => {
|
|
3277
4540
|
var _a, _b;
|
|
3278
|
-
const group =
|
|
4541
|
+
const group = React23__namespace.useContext(RadioGroupContext);
|
|
3279
4542
|
const prefersReduced = (_a = react.useReducedMotion()) != null ? _a : false;
|
|
3280
|
-
const generatedId =
|
|
4543
|
+
const generatedId = React23__namespace.useId();
|
|
3281
4544
|
const inputId = idProp != null ? idProp : label ? `radio-${generatedId}` : void 0;
|
|
3282
4545
|
const name = (_b = group == null ? void 0 : group.name) != null ? _b : nameProp;
|
|
3283
4546
|
const disabled = (group == null ? void 0 : group.disabled) || disabledProp;
|
|
3284
4547
|
const error = (group == null ? void 0 : group.error) || errorProp || color === "error";
|
|
3285
4548
|
const required = (group == null ? void 0 : group.required) || requiredProp;
|
|
3286
|
-
const [internalSelected, setInternalSelected] =
|
|
4549
|
+
const [internalSelected, setInternalSelected] = React23__namespace.useState(defaultSelected);
|
|
3287
4550
|
const isControlled = selected !== void 0;
|
|
3288
4551
|
const isSelected = group ? group.selectedValue === value : isControlled ? selected != null ? selected : false : internalSelected;
|
|
3289
|
-
const [ripples, setRipples] =
|
|
3290
|
-
const removeRipple =
|
|
4552
|
+
const [ripples, setRipples] = React23__namespace.useState([]);
|
|
4553
|
+
const removeRipple = React23__namespace.useCallback(
|
|
3291
4554
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
3292
4555
|
[]
|
|
3293
4556
|
);
|
|
3294
|
-
const onPointerDown =
|
|
4557
|
+
const onPointerDown = React23__namespace.useCallback(
|
|
3295
4558
|
(e) => {
|
|
3296
4559
|
if (disabled) return;
|
|
3297
4560
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -3305,12 +4568,12 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3305
4568
|
},
|
|
3306
4569
|
[disabled]
|
|
3307
4570
|
);
|
|
3308
|
-
const [isHovered, setIsHovered] =
|
|
3309
|
-
const onPointerEnter =
|
|
4571
|
+
const [isHovered, setIsHovered] = React23__namespace.useState(false);
|
|
4572
|
+
const onPointerEnter = React23__namespace.useCallback(() => {
|
|
3310
4573
|
if (!disabled) setIsHovered(true);
|
|
3311
4574
|
}, [disabled]);
|
|
3312
|
-
const onPointerLeave =
|
|
3313
|
-
const handleChange =
|
|
4575
|
+
const onPointerLeave = React23__namespace.useCallback(() => setIsHovered(false), []);
|
|
4576
|
+
const handleChange = React23__namespace.useCallback(
|
|
3314
4577
|
(_e) => {
|
|
3315
4578
|
if (disabled || onClick === null) return;
|
|
3316
4579
|
if (group) {
|
|
@@ -3324,7 +4587,7 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3324
4587
|
},
|
|
3325
4588
|
[disabled, onClick, group, value, isControlled]
|
|
3326
4589
|
);
|
|
3327
|
-
const inputRef =
|
|
4590
|
+
const inputRef = React23__namespace.useRef(null);
|
|
3328
4591
|
const mergedRef = useMergedRef3(ref, inputRef);
|
|
3329
4592
|
const stateLayerBg = error ? "before:bg-m3-error" : "before:bg-m3-primary";
|
|
3330
4593
|
const stateLayerClass = cn(
|
|
@@ -3435,8 +4698,8 @@ var RadioButtonComponent = React18__namespace.forwardRef(
|
|
|
3435
4698
|
}
|
|
3436
4699
|
);
|
|
3437
4700
|
RadioButtonComponent.displayName = "RadioButton";
|
|
3438
|
-
var RadioButton =
|
|
3439
|
-
var RadioGroupComponent =
|
|
4701
|
+
var RadioButton = React23__namespace.memo(RadioButtonComponent);
|
|
4702
|
+
var RadioGroupComponent = React23__namespace.forwardRef(
|
|
3440
4703
|
({
|
|
3441
4704
|
name,
|
|
3442
4705
|
value: valueProp,
|
|
@@ -3451,19 +4714,19 @@ var RadioGroupComponent = React18__namespace.forwardRef(
|
|
|
3451
4714
|
children,
|
|
3452
4715
|
className
|
|
3453
4716
|
}, ref) => {
|
|
3454
|
-
const [internalValue, setInternalValue] =
|
|
4717
|
+
const [internalValue, setInternalValue] = React23__namespace.useState(defaultValue);
|
|
3455
4718
|
const isControlled = valueProp !== void 0;
|
|
3456
4719
|
const selectedValue = isControlled ? valueProp : internalValue;
|
|
3457
|
-
const handleValueChange =
|
|
4720
|
+
const handleValueChange = React23__namespace.useCallback(
|
|
3458
4721
|
(val) => {
|
|
3459
4722
|
if (!isControlled) setInternalValue(val);
|
|
3460
4723
|
onValueChange == null ? void 0 : onValueChange(val);
|
|
3461
4724
|
},
|
|
3462
4725
|
[isControlled, onValueChange]
|
|
3463
4726
|
);
|
|
3464
|
-
const groupRef =
|
|
4727
|
+
const groupRef = React23__namespace.useRef(null);
|
|
3465
4728
|
const mergedRef = useMergedRef3(ref, groupRef);
|
|
3466
|
-
const onKeyDown =
|
|
4729
|
+
const onKeyDown = React23__namespace.useCallback(
|
|
3467
4730
|
(e) => {
|
|
3468
4731
|
var _a, _b;
|
|
3469
4732
|
if (disabled) return;
|
|
@@ -3487,7 +4750,7 @@ var RadioGroupComponent = React18__namespace.forwardRef(
|
|
|
3487
4750
|
},
|
|
3488
4751
|
[disabled, handleValueChange]
|
|
3489
4752
|
);
|
|
3490
|
-
const contextValue =
|
|
4753
|
+
const contextValue = React23__namespace.useMemo(
|
|
3491
4754
|
() => ({
|
|
3492
4755
|
name,
|
|
3493
4756
|
selectedValue,
|
|
@@ -3522,7 +4785,7 @@ var RadioGroupComponent = React18__namespace.forwardRef(
|
|
|
3522
4785
|
}
|
|
3523
4786
|
);
|
|
3524
4787
|
RadioGroupComponent.displayName = "RadioGroup";
|
|
3525
|
-
|
|
4788
|
+
React23__namespace.memo(RadioGroupComponent);
|
|
3526
4789
|
|
|
3527
4790
|
// src/ui/switch/switch.tokens.ts
|
|
3528
4791
|
var SwitchTokens = {
|
|
@@ -3600,7 +4863,7 @@ function isIconVisible(thumbContent, icons, showOnlySelectedIcon, checked) {
|
|
|
3600
4863
|
if (icons) return true;
|
|
3601
4864
|
return showOnlySelectedIcon && checked;
|
|
3602
4865
|
}
|
|
3603
|
-
var SwitchVisual =
|
|
4866
|
+
var SwitchVisual = React23__namespace.memo(function SwitchVisual2({
|
|
3604
4867
|
checked,
|
|
3605
4868
|
disabled,
|
|
3606
4869
|
isPressed,
|
|
@@ -3720,7 +4983,7 @@ var SwitchVisual = React18__namespace.memo(function SwitchVisual2({
|
|
|
3720
4983
|
}
|
|
3721
4984
|
);
|
|
3722
4985
|
});
|
|
3723
|
-
var SwitchComponent =
|
|
4986
|
+
var SwitchComponent = React23__namespace.forwardRef(
|
|
3724
4987
|
({
|
|
3725
4988
|
checked,
|
|
3726
4989
|
onCheckedChange,
|
|
@@ -3738,16 +5001,16 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3738
5001
|
}, ref) => {
|
|
3739
5002
|
var _a;
|
|
3740
5003
|
const prefersReduced = (_a = react.useReducedMotion()) != null ? _a : false;
|
|
3741
|
-
const [isPressed, setIsPressed] =
|
|
3742
|
-
const [isHovered, setIsHovered] =
|
|
3743
|
-
const [isFocused, setIsFocused] =
|
|
3744
|
-
const [ripples, setRipples] =
|
|
3745
|
-
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();
|
|
3746
5009
|
const switchId = label ? `switch-${generatedId}` : void 0;
|
|
3747
|
-
const handleClick =
|
|
5010
|
+
const handleClick = React23__namespace.useCallback(() => {
|
|
3748
5011
|
if (!disabled) onCheckedChange(!checked);
|
|
3749
5012
|
}, [disabled, checked, onCheckedChange]);
|
|
3750
|
-
const handleKeyDown =
|
|
5013
|
+
const handleKeyDown = React23__namespace.useCallback(
|
|
3751
5014
|
(e) => {
|
|
3752
5015
|
if (disabled) return;
|
|
3753
5016
|
if (e.key === " " || e.key === "Enter") {
|
|
@@ -3757,7 +5020,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3757
5020
|
},
|
|
3758
5021
|
[disabled, checked, onCheckedChange]
|
|
3759
5022
|
);
|
|
3760
|
-
const handlePointerDown =
|
|
5023
|
+
const handlePointerDown = React23__namespace.useCallback(
|
|
3761
5024
|
(e) => {
|
|
3762
5025
|
if (disabled) return;
|
|
3763
5026
|
setIsPressed(true);
|
|
@@ -3772,19 +5035,19 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3772
5035
|
},
|
|
3773
5036
|
[disabled]
|
|
3774
5037
|
);
|
|
3775
|
-
const handlePointerUp =
|
|
5038
|
+
const handlePointerUp = React23__namespace.useCallback(() => {
|
|
3776
5039
|
setIsPressed(false);
|
|
3777
5040
|
}, []);
|
|
3778
|
-
const handlePointerEnter =
|
|
5041
|
+
const handlePointerEnter = React23__namespace.useCallback(() => {
|
|
3779
5042
|
if (!disabled) setIsHovered(true);
|
|
3780
5043
|
}, [disabled]);
|
|
3781
|
-
const handlePointerLeave =
|
|
5044
|
+
const handlePointerLeave = React23__namespace.useCallback(() => {
|
|
3782
5045
|
setIsHovered(false);
|
|
3783
5046
|
setIsPressed(false);
|
|
3784
5047
|
}, []);
|
|
3785
|
-
const handleFocus =
|
|
3786
|
-
const handleBlur =
|
|
3787
|
-
const removeRipple =
|
|
5048
|
+
const handleFocus = React23__namespace.useCallback(() => setIsFocused(true), []);
|
|
5049
|
+
const handleBlur = React23__namespace.useCallback(() => setIsFocused(false), []);
|
|
5050
|
+
const removeRipple = React23__namespace.useCallback(
|
|
3788
5051
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
3789
5052
|
[]
|
|
3790
5053
|
);
|
|
@@ -3810,7 +5073,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3810
5073
|
onFocus: handleFocus,
|
|
3811
5074
|
onBlur: handleBlur,
|
|
3812
5075
|
className: cn(
|
|
3813
|
-
"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",
|
|
3814
5077
|
// Touch target: 48×48 minimum (pad around 32px track)
|
|
3815
5078
|
"min-w-12 min-h-12",
|
|
3816
5079
|
// Focus ring — MD3 FocusIndicatorColor = secondary
|
|
@@ -3820,7 +5083,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3820
5083
|
disabled && "pointer-events-none cursor-not-allowed",
|
|
3821
5084
|
!label && className
|
|
3822
5085
|
),
|
|
3823
|
-
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: [
|
|
3824
5087
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3825
5088
|
SwitchVisual,
|
|
3826
5089
|
{
|
|
@@ -3869,7 +5132,7 @@ var SwitchComponent = React18__namespace.forwardRef(
|
|
|
3869
5132
|
}
|
|
3870
5133
|
);
|
|
3871
5134
|
SwitchComponent.displayName = "Switch";
|
|
3872
|
-
var Switch =
|
|
5135
|
+
var Switch = React23__namespace.memo(SwitchComponent);
|
|
3873
5136
|
|
|
3874
5137
|
// src/ui/lists/list-utils.ts
|
|
3875
5138
|
function getListItemHeight(hasOverline, supportingTextLines) {
|
|
@@ -4009,7 +5272,7 @@ function renderSwitchTrailing({
|
|
|
4009
5272
|
trailingClass
|
|
4010
5273
|
}) {
|
|
4011
5274
|
const isSelectingMode = selectionMode === "single-select" || selectionMode === "multi-select";
|
|
4012
|
-
const switchElement =
|
|
5275
|
+
const switchElement = React23__namespace.isValidElement(trailingContent) ? (() => {
|
|
4013
5276
|
const trailingProps = trailingContent.props;
|
|
4014
5277
|
const checkedValue = !isSelectingMode && trailingProps.checked !== void 0 ? trailingProps.checked : isSelected;
|
|
4015
5278
|
const disabledValue = trailingProps.disabled !== void 0 ? disabled || trailingProps.disabled : disabled;
|
|
@@ -4020,7 +5283,7 @@ function renderSwitchTrailing({
|
|
|
4020
5283
|
onItemChange(value, checked);
|
|
4021
5284
|
}
|
|
4022
5285
|
};
|
|
4023
|
-
return
|
|
5286
|
+
return React23__namespace.cloneElement(
|
|
4024
5287
|
trailingContent,
|
|
4025
5288
|
{ checked: checkedValue, disabled: disabledValue, onCheckedChange }
|
|
4026
5289
|
);
|
|
@@ -4045,7 +5308,7 @@ function renderSwitchTrailing({
|
|
|
4045
5308
|
)
|
|
4046
5309
|
);
|
|
4047
5310
|
}
|
|
4048
|
-
var ListItemImpl =
|
|
5311
|
+
var ListItemImpl = React23__namespace.forwardRef(
|
|
4049
5312
|
(_a, ref) => {
|
|
4050
5313
|
var _b = _a, {
|
|
4051
5314
|
className,
|
|
@@ -4101,9 +5364,9 @@ var ListItemImpl = React18__namespace.forwardRef(
|
|
|
4101
5364
|
});
|
|
4102
5365
|
const reorderable = (_e = context == null ? void 0 : context.reorderable) != null ? _e : false;
|
|
4103
5366
|
const isSelected = selected !== void 0 ? selected : (_f = context == null ? void 0 : context.selectedValues.has(value)) != null ? _f : false;
|
|
4104
|
-
const [isHovered, setIsHovered] =
|
|
4105
|
-
const [isFocused, setIsFocused] =
|
|
4106
|
-
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);
|
|
4107
5370
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
4108
5371
|
disabled
|
|
4109
5372
|
});
|
|
@@ -4115,8 +5378,8 @@ var ListItemImpl = React18__namespace.forwardRef(
|
|
|
4115
5378
|
transition,
|
|
4116
5379
|
isDragging
|
|
4117
5380
|
} = sortable.useSortable({ id: value, disabled: !reorderable });
|
|
4118
|
-
const itemRef =
|
|
4119
|
-
const setRefs =
|
|
5381
|
+
const itemRef = React23__namespace.useRef(null);
|
|
5382
|
+
const setRefs = React23__namespace.useCallback(
|
|
4120
5383
|
(node) => {
|
|
4121
5384
|
itemRef.current = node;
|
|
4122
5385
|
setNodeRef(node);
|
|
@@ -4569,7 +5832,7 @@ var ListItemImpl = React18__namespace.forwardRef(
|
|
|
4569
5832
|
}
|
|
4570
5833
|
);
|
|
4571
5834
|
ListItemImpl.displayName = "ListItem";
|
|
4572
|
-
var ListItem =
|
|
5835
|
+
var ListItem = React23__namespace.memo(ListItemImpl);
|
|
4573
5836
|
var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface", {
|
|
4574
5837
|
variants: {
|
|
4575
5838
|
variant: {
|
|
@@ -4595,10 +5858,10 @@ var typographyVariants = classVarianceAuthority.cva("m-0 p-0 text-m3-on-surface"
|
|
|
4595
5858
|
variant: "body-md"
|
|
4596
5859
|
}
|
|
4597
5860
|
});
|
|
4598
|
-
var Text =
|
|
5861
|
+
var Text = React23__namespace.forwardRef(
|
|
4599
5862
|
(_a, ref) => {
|
|
4600
5863
|
var _b = _a, { className, variant, as: Component, color, weight, style } = _b, props = __objRest(_b, ["className", "variant", "as", "color", "weight", "style"]);
|
|
4601
|
-
const defaultComponent =
|
|
5864
|
+
const defaultComponent = React23__namespace.useMemo(() => {
|
|
4602
5865
|
const v = variant ? String(variant).toLowerCase() : "";
|
|
4603
5866
|
if (v.startsWith("display") || v.startsWith("headline")) return "h1";
|
|
4604
5867
|
if (v.startsWith("title")) return "h2";
|
|
@@ -4620,12 +5883,15 @@ Text.displayName = "Text";
|
|
|
4620
5883
|
function TableOfContents({
|
|
4621
5884
|
items,
|
|
4622
5885
|
className,
|
|
4623
|
-
scrollAreaProps
|
|
5886
|
+
scrollAreaProps,
|
|
5887
|
+
scrollContainerRef
|
|
4624
5888
|
}) {
|
|
4625
|
-
const [activeId, setActiveId] =
|
|
4626
|
-
const itemIds =
|
|
4627
|
-
|
|
5889
|
+
const [activeId, setActiveId] = React23.useState("");
|
|
5890
|
+
const itemIds = React23.useMemo(() => items.map((i) => i.id), [items]);
|
|
5891
|
+
React23.useEffect(() => {
|
|
5892
|
+
var _a;
|
|
4628
5893
|
if (typeof IntersectionObserver === "undefined") return;
|
|
5894
|
+
const root = (_a = scrollContainerRef == null ? void 0 : scrollContainerRef.current) != null ? _a : null;
|
|
4629
5895
|
const observer = new IntersectionObserver(
|
|
4630
5896
|
(entries) => {
|
|
4631
5897
|
for (const entry of entries) {
|
|
@@ -4633,19 +5899,20 @@ function TableOfContents({
|
|
|
4633
5899
|
}
|
|
4634
5900
|
},
|
|
4635
5901
|
// rootMargin: top offset ~100px (fixed header), bottom -80% (early switch)
|
|
4636
|
-
{ rootMargin: "-100px 0% -80% 0%" }
|
|
5902
|
+
{ root, rootMargin: "-100px 0% -80% 0%" }
|
|
4637
5903
|
);
|
|
4638
5904
|
for (const id of itemIds) {
|
|
4639
5905
|
const el = document.getElementById(id);
|
|
4640
5906
|
if (el) observer.observe(el);
|
|
4641
5907
|
}
|
|
4642
5908
|
return () => observer.disconnect();
|
|
4643
|
-
}, [itemIds]);
|
|
4644
|
-
const handleClick =
|
|
5909
|
+
}, [itemIds, scrollContainerRef]);
|
|
5910
|
+
const handleClick = React23.useCallback(
|
|
4645
5911
|
(e, id) => {
|
|
4646
|
-
var _a;
|
|
4647
5912
|
e.preventDefault();
|
|
4648
|
-
|
|
5913
|
+
const target = document.getElementById(id);
|
|
5914
|
+
if (!target) return;
|
|
5915
|
+
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
4649
5916
|
},
|
|
4650
5917
|
[]
|
|
4651
5918
|
);
|
|
@@ -4662,19 +5929,35 @@ function TableOfContents({
|
|
|
4662
5929
|
type: "hover"
|
|
4663
5930
|
}, scrollAreaProps), {
|
|
4664
5931
|
className: cn("flex-1 min-h-0", scrollAreaProps == null ? void 0 : scrollAreaProps.className),
|
|
4665
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
"
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
5932
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2 pr-4", children: items.map((item) => {
|
|
5933
|
+
var _a;
|
|
5934
|
+
const depth = (_a = item.depth) != null ? _a : 1;
|
|
5935
|
+
const isSubItem = depth > 1;
|
|
5936
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5937
|
+
"li",
|
|
5938
|
+
{
|
|
5939
|
+
className: cn(
|
|
5940
|
+
isSubItem && "pl-3.5 border-l border-m3-outline-variant/40 ml-1"
|
|
5941
|
+
),
|
|
5942
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5943
|
+
"a",
|
|
5944
|
+
{
|
|
5945
|
+
href: `#${item.id}`,
|
|
5946
|
+
onClick: (e) => handleClick(e, item.id),
|
|
5947
|
+
"aria-current": activeId === item.id ? "true" : void 0,
|
|
5948
|
+
className: cn(
|
|
5949
|
+
"transition-colors hover:text-m3-primary block truncate",
|
|
5950
|
+
isSubItem ? "text-xs py-0.5 leading-relaxed" : "text-sm py-1 font-medium leading-snug",
|
|
5951
|
+
activeId === item.id ? "text-m3-primary font-bold" : "text-m3-on-surface-variant"
|
|
5952
|
+
),
|
|
5953
|
+
title: item.label,
|
|
5954
|
+
children: item.label
|
|
5955
|
+
}
|
|
5956
|
+
)
|
|
5957
|
+
},
|
|
5958
|
+
item.id
|
|
5959
|
+
);
|
|
5960
|
+
}) })
|
|
4678
5961
|
})
|
|
4679
5962
|
)
|
|
4680
5963
|
]
|
|
@@ -5395,9 +6678,9 @@ var TOKEN_TO_PROP = {
|
|
|
5395
6678
|
};
|
|
5396
6679
|
var defaultTokens = new TypographyTokens();
|
|
5397
6680
|
var defaultTypography = new Typography();
|
|
5398
|
-
var TypographyContext =
|
|
6681
|
+
var TypographyContext = React23.createContext(defaultTypography);
|
|
5399
6682
|
function useTypography() {
|
|
5400
|
-
return
|
|
6683
|
+
return React23.useContext(TypographyContext);
|
|
5401
6684
|
}
|
|
5402
6685
|
function TypographyProvider({
|
|
5403
6686
|
children,
|
|
@@ -5405,7 +6688,7 @@ function TypographyProvider({
|
|
|
5405
6688
|
fontFamily,
|
|
5406
6689
|
fontVariationAxes
|
|
5407
6690
|
}) {
|
|
5408
|
-
const value =
|
|
6691
|
+
const value = React23.useMemo(() => {
|
|
5409
6692
|
if (typography) return typography;
|
|
5410
6693
|
if (fontFamily || fontVariationAxes) {
|
|
5411
6694
|
return new Typography(
|
|
@@ -5418,6 +6701,15 @@ function TypographyProvider({
|
|
|
5418
6701
|
}
|
|
5419
6702
|
|
|
5420
6703
|
exports.Card = Card;
|
|
6704
|
+
exports.CardContent = CardContent;
|
|
6705
|
+
exports.CardFooter = CardFooter;
|
|
6706
|
+
exports.CardHeader = CardHeader;
|
|
6707
|
+
exports.CardMedia = CardMedia;
|
|
6708
|
+
exports.Carousel = Carousel;
|
|
6709
|
+
exports.CarouselGrid = CarouselGrid;
|
|
6710
|
+
exports.CarouselItem = CarouselItem;
|
|
6711
|
+
exports.CarouselScrollClient = CarouselScrollClient;
|
|
6712
|
+
exports.CarouselTokens = CarouselTokens;
|
|
5421
6713
|
exports.CodeBlock = CodeBlock;
|
|
5422
6714
|
exports.DEFAULT_FONT_VARIATION_AXES = DEFAULT_FONT_VARIATION_AXES;
|
|
5423
6715
|
exports.Divider = Divider;
|
|
@@ -5427,6 +6719,7 @@ exports.ListContext = ListContext;
|
|
|
5427
6719
|
exports.ListDivider = ListDivider;
|
|
5428
6720
|
exports.ListItem = ListItem;
|
|
5429
6721
|
exports.MD3_EXPRESSIVE_FONT_VARIATION = MD3_EXPRESSIVE_FONT_VARIATION;
|
|
6722
|
+
exports.SHADOW = SHADOW;
|
|
5430
6723
|
exports.ScrollArea = ScrollArea;
|
|
5431
6724
|
exports.ScrollAreaScrollbar = ScrollAreaScrollbar;
|
|
5432
6725
|
exports.TableOfContents = TableOfContents;
|
|
@@ -5437,12 +6730,18 @@ exports.TypographyContext = TypographyContext;
|
|
|
5437
6730
|
exports.TypographyKeyTokens = TypographyKeyTokens;
|
|
5438
6731
|
exports.TypographyProvider = TypographyProvider;
|
|
5439
6732
|
exports.TypographyTokens = TypographyTokens;
|
|
6733
|
+
exports.VARIANT_ELEVATION = VARIANT_ELEVATION;
|
|
5440
6734
|
exports.buildWavePath = buildWavePath;
|
|
6735
|
+
exports.cardVariants = cardVariants;
|
|
5441
6736
|
exports.getExpressiveShape = getExpressiveShape;
|
|
5442
6737
|
exports.getListItemHeight = getListItemHeight;
|
|
6738
|
+
exports.resolveElevationShadow = resolveElevationShadow;
|
|
5443
6739
|
exports.serializeFontVariationAxes = serializeFontVariationAxes;
|
|
5444
6740
|
exports.shouldTopAlign = shouldTopAlign;
|
|
5445
6741
|
exports.typographyVariants = typographyVariants;
|
|
6742
|
+
exports.useCardElevation = useCardElevation;
|
|
6743
|
+
exports.useCarouselA11y = useCarouselA11y;
|
|
6744
|
+
exports.useCarouselKeylines = useCarouselKeylines;
|
|
5446
6745
|
exports.useListContext = useListContext;
|
|
5447
6746
|
exports.useTypography = useTypography;
|
|
5448
6747
|
//# sourceMappingURL=layout.js.map
|