@nkanish/liquidglass-ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -8
- package/THIRD_PARTY_NOTICES.md +41 -0
- package/dist/index.cjs +1113 -449
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -2
- package/dist/index.d.ts +64 -2
- package/dist/index.js +1014 -339
- package/dist/index.js.map +1 -1
- package/package.json +11 -7
package/dist/index.cjs
CHANGED
|
@@ -77,8 +77,9 @@ __export(index_exports, {
|
|
|
77
77
|
ToastProvider: () => ToastProvider,
|
|
78
78
|
Toggle: () => Toggle,
|
|
79
79
|
Tooltip: () => Tooltip,
|
|
80
|
-
clamp: () =>
|
|
80
|
+
clamp: () => clamp2,
|
|
81
81
|
cleanupFilters: () => cleanupFilters,
|
|
82
|
+
clearGlisseCache: () => clearGlisseCache,
|
|
82
83
|
cn: () => cn,
|
|
83
84
|
createLensFilter: () => createLensFilter,
|
|
84
85
|
createRefractionFilter: () => createRefractionFilter,
|
|
@@ -95,12 +96,14 @@ __export(index_exports, {
|
|
|
95
96
|
throttle: () => throttle,
|
|
96
97
|
useControllable: () => useControllable,
|
|
97
98
|
useGlass: () => useGlass,
|
|
99
|
+
useGlisseEffect: () => useGlisseEffect,
|
|
98
100
|
useId: () => useId,
|
|
99
101
|
useMounted: () => useMounted,
|
|
100
102
|
usePointerPosition: () => usePointerPosition,
|
|
101
103
|
usePressedState: () => usePressedState,
|
|
102
104
|
useReducedMotion: () => useReducedMotion,
|
|
103
105
|
useReducedTransparency: () => useReducedTransparency,
|
|
106
|
+
useRefraction: () => useRefraction,
|
|
104
107
|
useSidebar: () => useSidebar,
|
|
105
108
|
useTheme: () => useTheme,
|
|
106
109
|
useToast: () => useToast
|
|
@@ -110,6 +113,13 @@ module.exports = __toCommonJS(index_exports);
|
|
|
110
113
|
// src/components/GlassProvider.tsx
|
|
111
114
|
var import_react = require("react");
|
|
112
115
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
116
|
+
var DEFAULT_REFRACTION = {
|
|
117
|
+
enabled: true,
|
|
118
|
+
depth: 8,
|
|
119
|
+
dome: 4,
|
|
120
|
+
shine: 0.3,
|
|
121
|
+
lightAngle: 225
|
|
122
|
+
};
|
|
113
123
|
var GlassContext = (0, import_react.createContext)(null);
|
|
114
124
|
function getSystemTheme() {
|
|
115
125
|
if (typeof window === "undefined") return "light";
|
|
@@ -131,6 +141,10 @@ function GlassProvider({
|
|
|
131
141
|
return theme;
|
|
132
142
|
});
|
|
133
143
|
const [config, setConfigState] = (0, import_react.useState)(initialConfig);
|
|
144
|
+
const refraction = {
|
|
145
|
+
...DEFAULT_REFRACTION,
|
|
146
|
+
...config.refraction
|
|
147
|
+
};
|
|
134
148
|
const setTheme = (newTheme) => {
|
|
135
149
|
setThemeState(newTheme);
|
|
136
150
|
if (typeof window !== "undefined") {
|
|
@@ -178,7 +192,8 @@ function GlassProvider({
|
|
|
178
192
|
resolvedTheme,
|
|
179
193
|
setTheme,
|
|
180
194
|
config,
|
|
181
|
-
setConfig
|
|
195
|
+
setConfig,
|
|
196
|
+
refraction
|
|
182
197
|
},
|
|
183
198
|
children
|
|
184
199
|
}
|
|
@@ -195,9 +210,16 @@ function useTheme() {
|
|
|
195
210
|
const { theme, resolvedTheme, setTheme } = useGlass();
|
|
196
211
|
return { theme, resolvedTheme, setTheme };
|
|
197
212
|
}
|
|
213
|
+
function useRefraction() {
|
|
214
|
+
const context = (0, import_react.useContext)(GlassContext);
|
|
215
|
+
if (!context) {
|
|
216
|
+
return DEFAULT_REFRACTION;
|
|
217
|
+
}
|
|
218
|
+
return context.refraction;
|
|
219
|
+
}
|
|
198
220
|
|
|
199
221
|
// src/components/Glass.tsx
|
|
200
|
-
var
|
|
222
|
+
var import_react5 = require("react");
|
|
201
223
|
|
|
202
224
|
// src/utils/cn.ts
|
|
203
225
|
function cn(...inputs) {
|
|
@@ -281,34 +303,482 @@ function useReducedMotion() {
|
|
|
281
303
|
return reducedMotion;
|
|
282
304
|
}
|
|
283
305
|
|
|
284
|
-
// src/
|
|
306
|
+
// src/hooks/use-glisse-effect.ts
|
|
307
|
+
var import_react4 = require("react");
|
|
285
308
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
309
|
+
var DEFAULT_LIGHT = {
|
|
310
|
+
angle: 225,
|
|
311
|
+
glow: 0.4,
|
|
312
|
+
spread: 0.5,
|
|
313
|
+
glowPower: 2,
|
|
314
|
+
edge: 0.5,
|
|
315
|
+
edgeWidth: 1.5,
|
|
316
|
+
edgePower: 1
|
|
317
|
+
};
|
|
318
|
+
var DEFAULT_LENS = {
|
|
319
|
+
depth: 8,
|
|
320
|
+
dome: 4,
|
|
321
|
+
splay: 0.85,
|
|
322
|
+
relative: false
|
|
323
|
+
};
|
|
324
|
+
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
325
|
+
var erf = (x) => Math.tanh(1.7724538509 * x);
|
|
326
|
+
function distance(x, y, halfWidth, halfHeight, radius) {
|
|
327
|
+
const qx = Math.abs(x) - halfWidth + radius;
|
|
328
|
+
const qy = Math.abs(y) - halfHeight + radius;
|
|
329
|
+
return Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) + Math.min(Math.max(qx, qy), 0) - radius;
|
|
330
|
+
}
|
|
331
|
+
function arc(sag, half) {
|
|
332
|
+
const r = (half * half + sag * sag) / (2 * sag);
|
|
333
|
+
let sum = 0;
|
|
334
|
+
for (let i = 0; i <= 200; i++) {
|
|
335
|
+
const x = i / 200 * half;
|
|
336
|
+
const s = x / Math.sqrt(r * r - x * x);
|
|
337
|
+
sum += i === 0 || i === 200 ? s / 2 : s;
|
|
338
|
+
}
|
|
339
|
+
const mean = sum / 200;
|
|
340
|
+
return { radius: r, scale: mean > 0 ? 0.5 / mean : 1 };
|
|
341
|
+
}
|
|
342
|
+
function slopeAt(x, curve) {
|
|
343
|
+
const inside = Math.min(x, 0.999 * curve.radius);
|
|
344
|
+
return inside / Math.sqrt(curve.radius * curve.radius - inside * inside) * curve.scale;
|
|
345
|
+
}
|
|
346
|
+
function grey(data, i, value, alpha = 255) {
|
|
347
|
+
data[i] = data[i + 1] = data[i + 2] = value;
|
|
348
|
+
data[i + 3] = alpha;
|
|
349
|
+
}
|
|
350
|
+
function lensMap(shape, options, light, density) {
|
|
351
|
+
const { width, height } = shape;
|
|
352
|
+
const halfWidth = width / 2;
|
|
353
|
+
const halfHeight = height / 2;
|
|
354
|
+
const radius = clamp(shape.radius, 0, Math.min(halfWidth, halfHeight));
|
|
355
|
+
const columns = Math.max(1, Math.round(width * density));
|
|
356
|
+
const rows = Math.max(1, Math.round(height * density));
|
|
357
|
+
const pullAcross = new Uint8ClampedArray(columns * rows * 4);
|
|
358
|
+
const pullDown = new Uint8ClampedArray(columns * rows * 4);
|
|
359
|
+
const caught = new Uint8ClampedArray(columns * rows * 4);
|
|
360
|
+
const share = options.relative ? Math.min(width, height) : 1;
|
|
361
|
+
const depth = options.depth * share;
|
|
362
|
+
const dome = options.dome * share;
|
|
363
|
+
const { splay } = options;
|
|
364
|
+
const innerWidth = Math.max(0, halfWidth - depth);
|
|
365
|
+
const innerHeight = Math.max(0, halfHeight - depth);
|
|
366
|
+
const innerRadius = clamp(radius, 0, Math.min(innerWidth, innerHeight));
|
|
367
|
+
const ramp = depth > 0 ? 1 / (depth * Math.SQRT2) : 1e6;
|
|
368
|
+
const sag = Math.max(0.01, Math.min(dome, Math.min(halfWidth, halfHeight) - 1));
|
|
369
|
+
const across = dome > 0 ? arc(sag, halfWidth) : null;
|
|
370
|
+
const down = dome > 0 ? arc(sag, halfHeight) : null;
|
|
371
|
+
const reach = 0.5 * Math.min(halfWidth, halfHeight);
|
|
372
|
+
const cos = Math.cos(light.angle * Math.PI / 180);
|
|
373
|
+
const sin = Math.sin(light.angle * Math.PI / 180);
|
|
374
|
+
const glowStart = (1 - light.spread) * Math.SQRT2;
|
|
375
|
+
const glowRange = light.spread * Math.SQRT2;
|
|
376
|
+
for (let row = 0; row < rows; row++) {
|
|
377
|
+
for (let column = 0; column < columns; column++) {
|
|
378
|
+
const i = (row * columns + column) * 4;
|
|
379
|
+
const x = (column + 0.5) / columns * width - halfWidth;
|
|
380
|
+
const y = (row + 0.5) / rows * height - halfHeight;
|
|
381
|
+
const edge = distance(x, y, halfWidth, halfHeight, radius);
|
|
382
|
+
if (edge >= 0) {
|
|
383
|
+
grey(pullAcross, i, 128);
|
|
384
|
+
grey(pullDown, i, 128);
|
|
385
|
+
grey(caught, i, 128, 0);
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
const ax = Math.abs(x);
|
|
389
|
+
const ay = Math.abs(y);
|
|
390
|
+
let dx = across ? Math.sign(x) * slopeAt(ax, across) : clamp(x / halfWidth, -1, 1);
|
|
391
|
+
let dy = down ? Math.sign(y) * slopeAt(ay, down) : clamp(y / halfHeight, -1, 1);
|
|
392
|
+
if (splay < 1 && reach > 0) {
|
|
393
|
+
const keepX = Math.max(0, 1 - (halfHeight - ay) / reach) * (1 - splay);
|
|
394
|
+
const keepY = Math.max(0, 1 - (halfWidth - ax) / reach) * (1 - splay);
|
|
395
|
+
if (keepX > 1e-3 || keepY > 1e-3) {
|
|
396
|
+
const before = Math.hypot(dx, dy);
|
|
397
|
+
dx *= 1 - keepX;
|
|
398
|
+
dy *= 1 - keepY;
|
|
399
|
+
const after = Math.hypot(dx, dy);
|
|
400
|
+
if (after > 1e-3) {
|
|
401
|
+
dx *= before / after;
|
|
402
|
+
dy *= before / after;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const falloff = 0.5 * (1 + erf(distance(x, y, innerWidth, innerHeight, innerRadius) * ramp));
|
|
407
|
+
grey(pullAcross, i, Math.round((0.5 - 0.5 * dx * falloff) * 255));
|
|
408
|
+
grey(pullDown, i, Math.round((0.5 - 0.5 * dy * falloff) * 255));
|
|
409
|
+
const facing = Math.abs(clamp(x / halfWidth, -1, 1) * cos + clamp(y / halfHeight, -1, 1) * sin);
|
|
410
|
+
const glow = glowRange > 1e-3 ? light.glow * Math.pow(clamp((facing - glowStart) / glowRange, 0, 1), light.glowPower) * falloff : 0;
|
|
411
|
+
const rim = light.edge * Math.max(0, 1 + edge / light.edgeWidth) * Math.pow(facing, light.edgePower);
|
|
412
|
+
const amount = Math.min(1, glow + rim);
|
|
413
|
+
const bends = Math.min(1, falloff * 20, -edge);
|
|
414
|
+
grey(caught, i, Math.round(127 * amount + 128), Math.round(255 * bends));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return { columns, rows, across: pullAcross, down: pullDown, light: caught };
|
|
418
|
+
}
|
|
419
|
+
var encodedCache = /* @__PURE__ */ new Map();
|
|
420
|
+
function encode(key, draw) {
|
|
421
|
+
const cached = encodedCache.get(key);
|
|
422
|
+
if (cached) return cached;
|
|
423
|
+
const map = draw();
|
|
424
|
+
const canvas = document.createElement("canvas");
|
|
425
|
+
canvas.width = map.columns;
|
|
426
|
+
canvas.height = map.rows;
|
|
427
|
+
const context = canvas.getContext("2d");
|
|
428
|
+
if (!context) return null;
|
|
429
|
+
const image = context.createImageData(map.columns, map.rows);
|
|
430
|
+
const png = (data) => {
|
|
431
|
+
image.data.set(data);
|
|
432
|
+
context.putImageData(image, 0, 0);
|
|
433
|
+
return canvas.toDataURL();
|
|
434
|
+
};
|
|
435
|
+
const result = {
|
|
436
|
+
across: png(map.across),
|
|
437
|
+
down: png(map.down),
|
|
438
|
+
light: png(map.light)
|
|
439
|
+
};
|
|
440
|
+
encodedCache.set(key, result);
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
function svg(tag, attrs = {}) {
|
|
444
|
+
const el = document.createElementNS(SVG_NS, tag);
|
|
445
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
446
|
+
el.setAttribute(key, String(value));
|
|
447
|
+
}
|
|
448
|
+
return el;
|
|
449
|
+
}
|
|
450
|
+
var CHANNELS = [
|
|
451
|
+
"1 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
|
|
452
|
+
"0 0 0 0 0 0 1 0 0 0 0 0 0 0 0",
|
|
453
|
+
"0 0 0 0 0 0 0 0 0 0 0 0 1 0 0"
|
|
454
|
+
];
|
|
455
|
+
function isWebKit() {
|
|
456
|
+
if (typeof navigator === "undefined") return false;
|
|
457
|
+
return /AppleWebKit\//.test(navigator.userAgent) && !/Chrom(?:e|ium)\//.test(navigator.userAgent);
|
|
458
|
+
}
|
|
459
|
+
function supportsDisplacementMap() {
|
|
460
|
+
if (typeof document === "undefined") return false;
|
|
461
|
+
try {
|
|
462
|
+
const el = document.createElementNS(SVG_NS, "feDisplacementMap");
|
|
463
|
+
return !!el && el.namespaceURI === SVG_NS && "scale" in el;
|
|
464
|
+
} catch {
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
function buildFilter(lenses, box) {
|
|
469
|
+
const unit = box ? "objectBoundingBox" : "userSpaceOnUse";
|
|
470
|
+
const filter = svg("filter", {
|
|
471
|
+
filterUnits: unit,
|
|
472
|
+
primitiveUnits: unit,
|
|
473
|
+
"color-interpolation-filters": "sRGB"
|
|
474
|
+
});
|
|
475
|
+
if (box) {
|
|
476
|
+
filter.setAttribute("x", "0");
|
|
477
|
+
filter.setAttribute("y", "0");
|
|
478
|
+
filter.setAttribute("width", "1");
|
|
479
|
+
filter.setAttribute("height", "1");
|
|
480
|
+
}
|
|
481
|
+
const single = lenses.length === 1;
|
|
482
|
+
lenses.forEach(({ maps, shine }, k) => {
|
|
483
|
+
const merged = (name) => single ? name : `${name}-${k}`;
|
|
484
|
+
const image = (href, result) => svg("feImage", { href, preserveAspectRatio: "none", result });
|
|
485
|
+
filter.append(
|
|
486
|
+
image(maps.across, `across-${k}`),
|
|
487
|
+
image(maps.down, `down-${k}`),
|
|
488
|
+
image(maps.light, merged("raw")),
|
|
489
|
+
svg("feFlood", { "flood-color": "rgb(128, 128, 128)", result: `neutral-${k}` })
|
|
490
|
+
);
|
|
491
|
+
for (const pull of ["across", "down"]) {
|
|
492
|
+
const half = svg("feComponentTransfer", {
|
|
493
|
+
in: `${pull}-grey-${k}`,
|
|
494
|
+
result: `${pull}-pull-${k}`
|
|
495
|
+
});
|
|
496
|
+
half.append(svg("feFuncA", { type: "linear", slope: 0, intercept: 0.5 }));
|
|
497
|
+
filter.append(
|
|
498
|
+
svg("feComposite", {
|
|
499
|
+
in: `${pull}-${k}`,
|
|
500
|
+
in2: `neutral-${k}`,
|
|
501
|
+
operator: "over",
|
|
502
|
+
result: `${pull}-grey-${k}`
|
|
503
|
+
}),
|
|
504
|
+
half
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
CHANNELS.forEach((_, i) => {
|
|
508
|
+
filter.append(
|
|
509
|
+
svg("feDisplacementMap", {
|
|
510
|
+
in: "SourceGraphic",
|
|
511
|
+
in2: `across-pull-${k}`,
|
|
512
|
+
xChannelSelector: "R",
|
|
513
|
+
yChannelSelector: "A",
|
|
514
|
+
result: `across-${k}-${i}`
|
|
515
|
+
}),
|
|
516
|
+
svg("feDisplacementMap", {
|
|
517
|
+
in: `across-${k}-${i}`,
|
|
518
|
+
in2: `down-pull-${k}`,
|
|
519
|
+
xChannelSelector: "A",
|
|
520
|
+
yChannelSelector: "R",
|
|
521
|
+
result: `ray-${k}-${i}`
|
|
522
|
+
})
|
|
523
|
+
);
|
|
524
|
+
});
|
|
525
|
+
CHANNELS.forEach((channel, i) => {
|
|
526
|
+
filter.append(
|
|
527
|
+
svg("feColorMatrix", {
|
|
528
|
+
in: `ray-${k}-${i}`,
|
|
529
|
+
type: "matrix",
|
|
530
|
+
values: `${channel} 0 0 0 0.3333 0`,
|
|
531
|
+
result: `light-${k}-${i}`
|
|
532
|
+
})
|
|
533
|
+
);
|
|
534
|
+
});
|
|
535
|
+
filter.append(
|
|
536
|
+
svg("feComposite", {
|
|
537
|
+
in: `light-${k}-0`,
|
|
538
|
+
in2: `light-${k}-1`,
|
|
539
|
+
operator: "arithmetic",
|
|
540
|
+
k2: 1,
|
|
541
|
+
k3: 1,
|
|
542
|
+
result: `light-${k}-01`
|
|
543
|
+
}),
|
|
544
|
+
svg("feComposite", {
|
|
545
|
+
in: `light-${k}-01`,
|
|
546
|
+
in2: `light-${k}-2`,
|
|
547
|
+
operator: "arithmetic",
|
|
548
|
+
k2: 1,
|
|
549
|
+
k3: 1,
|
|
550
|
+
result: `spread-${k}`
|
|
551
|
+
}),
|
|
552
|
+
svg("feColorMatrix", {
|
|
553
|
+
in: `spread-${k}`,
|
|
554
|
+
type: "matrix",
|
|
555
|
+
values: "3 0 0 0 0 0 3 0 0 0 0 0 3 0 0 0 0 0 1 0",
|
|
556
|
+
result: `bent-${k}`
|
|
557
|
+
})
|
|
558
|
+
);
|
|
559
|
+
const bent = `bent-${k}`;
|
|
560
|
+
let lit = bent;
|
|
561
|
+
if (shine > 0) {
|
|
562
|
+
const white = `0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ${-128 / 255}`;
|
|
563
|
+
filter.append(
|
|
564
|
+
svg("feColorMatrix", {
|
|
565
|
+
in: merged("raw"),
|
|
566
|
+
type: "matrix",
|
|
567
|
+
values: white,
|
|
568
|
+
result: `glint-${k}`
|
|
569
|
+
}),
|
|
570
|
+
svg("feComposite", {
|
|
571
|
+
in: `glint-${k}`,
|
|
572
|
+
in2: bent,
|
|
573
|
+
operator: "arithmetic",
|
|
574
|
+
k2: shine,
|
|
575
|
+
k3: 1,
|
|
576
|
+
result: `lit-${k}`
|
|
577
|
+
})
|
|
578
|
+
);
|
|
579
|
+
lit = `lit-${k}`;
|
|
580
|
+
} else if (shine < 0) {
|
|
581
|
+
const row = `0 0 ${shine} 0 ${1 - 128 * shine / 255}`;
|
|
582
|
+
filter.append(
|
|
583
|
+
svg("feColorMatrix", {
|
|
584
|
+
in: merged("raw"),
|
|
585
|
+
type: "matrix",
|
|
586
|
+
values: `${row} ${row} ${row} 0 0 0 0 1`,
|
|
587
|
+
result: `shade-${k}`
|
|
588
|
+
}),
|
|
589
|
+
svg("feComposite", {
|
|
590
|
+
in: `shade-${k}`,
|
|
591
|
+
in2: bent,
|
|
592
|
+
operator: "arithmetic",
|
|
593
|
+
k1: 1,
|
|
594
|
+
result: `lit-${k}`
|
|
595
|
+
})
|
|
596
|
+
);
|
|
597
|
+
lit = `lit-${k}`;
|
|
598
|
+
}
|
|
599
|
+
filter.append(
|
|
600
|
+
svg("feComposite", {
|
|
601
|
+
in: lit,
|
|
602
|
+
in2: merged("raw"),
|
|
603
|
+
operator: "in",
|
|
604
|
+
result: merged("inside")
|
|
605
|
+
})
|
|
606
|
+
);
|
|
607
|
+
});
|
|
608
|
+
filter.append(
|
|
609
|
+
svg("feComposite", {
|
|
610
|
+
in: "SourceGraphic",
|
|
611
|
+
in2: "raw",
|
|
612
|
+
operator: "out",
|
|
613
|
+
result: "outside"
|
|
614
|
+
}),
|
|
615
|
+
svg("feComposite", {
|
|
616
|
+
in: "inside",
|
|
617
|
+
in2: "outside",
|
|
618
|
+
operator: "arithmetic",
|
|
619
|
+
k2: 1,
|
|
620
|
+
k3: 1,
|
|
621
|
+
result: "seen"
|
|
622
|
+
})
|
|
623
|
+
);
|
|
624
|
+
return filter;
|
|
625
|
+
}
|
|
626
|
+
var filterIdCounter = 0;
|
|
286
627
|
var filterContainer = null;
|
|
287
|
-
var filterCounter = 0;
|
|
288
628
|
function getFilterContainer() {
|
|
289
|
-
if (filterContainer &&
|
|
629
|
+
if (filterContainer && filterContainer.isConnected) {
|
|
290
630
|
return filterContainer;
|
|
291
631
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
632
|
+
let container = document.getElementById("lg-glisse-filters");
|
|
633
|
+
if (!container) {
|
|
634
|
+
container = document.createElement("div");
|
|
635
|
+
container.id = "lg-glisse-filters";
|
|
636
|
+
container.innerHTML = '<svg aria-hidden="true" style="position:absolute;width:0;height:0;overflow:hidden;pointer-events:none"><defs></defs></svg>';
|
|
637
|
+
document.body.appendChild(container);
|
|
638
|
+
}
|
|
639
|
+
filterContainer = container;
|
|
640
|
+
return container;
|
|
641
|
+
}
|
|
642
|
+
function useGlisseEffect(ref, options = {}) {
|
|
643
|
+
const {
|
|
644
|
+
enabled = true,
|
|
645
|
+
depth = DEFAULT_LENS.depth,
|
|
646
|
+
dome = DEFAULT_LENS.dome,
|
|
647
|
+
splay = DEFAULT_LENS.splay,
|
|
648
|
+
shine = 0.3,
|
|
649
|
+
density = 0.5,
|
|
650
|
+
lightAngle = DEFAULT_LIGHT.angle
|
|
651
|
+
} = options;
|
|
652
|
+
const [filterUrl, setFilterUrl] = (0, import_react4.useState)(null);
|
|
653
|
+
const [isReady, setIsReady] = (0, import_react4.useState)(false);
|
|
654
|
+
const filterRef = (0, import_react4.useRef)(null);
|
|
655
|
+
const currentFilterId = (0, import_react4.useRef)(null);
|
|
656
|
+
const lastDimensions = (0, import_react4.useRef)(null);
|
|
657
|
+
const rafRef = (0, import_react4.useRef)(null);
|
|
658
|
+
const supportsRef = (0, import_react4.useRef)(null);
|
|
659
|
+
const cleanup = (0, import_react4.useCallback)(() => {
|
|
660
|
+
if (rafRef.current != null) {
|
|
661
|
+
cancelAnimationFrame(rafRef.current);
|
|
662
|
+
rafRef.current = null;
|
|
663
|
+
}
|
|
664
|
+
if (filterRef.current) {
|
|
665
|
+
filterRef.current.remove();
|
|
666
|
+
filterRef.current = null;
|
|
667
|
+
}
|
|
668
|
+
currentFilterId.current = null;
|
|
669
|
+
setFilterUrl(null);
|
|
670
|
+
setIsReady(false);
|
|
671
|
+
}, []);
|
|
672
|
+
const updateFilter = (0, import_react4.useCallback)((el) => {
|
|
673
|
+
if (!enabled || typeof document === "undefined") {
|
|
674
|
+
cleanup();
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (supportsRef.current === null) {
|
|
678
|
+
supportsRef.current = supportsDisplacementMap();
|
|
679
|
+
}
|
|
680
|
+
if (!supportsRef.current) {
|
|
681
|
+
setFilterUrl(null);
|
|
682
|
+
setIsReady(true);
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
const rect = el.getBoundingClientRect();
|
|
686
|
+
const width = Math.max(1, Math.round(rect.width));
|
|
687
|
+
const height = Math.max(1, Math.round(rect.height));
|
|
688
|
+
const computedStyle = getComputedStyle(el);
|
|
689
|
+
const radius = parseFloat(computedStyle.borderRadius) || 0;
|
|
690
|
+
if (lastDimensions.current) {
|
|
691
|
+
const { width: lw, height: lh, radius: lr } = lastDimensions.current;
|
|
692
|
+
if (Math.abs(width - lw) < 2 && Math.abs(height - lh) < 2 && Math.abs(radius - lr) < 1) {
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
lastDimensions.current = { width, height, radius };
|
|
697
|
+
const shape = { width, height, radius };
|
|
698
|
+
const lensOpts = { depth, dome, splay, relative: false };
|
|
699
|
+
const lightOpts = { ...DEFAULT_LIGHT, angle: lightAngle };
|
|
700
|
+
const cacheKey = `${width}:${height}:${radius}:${depth}:${dome}:${splay}:${lightAngle}:${density}`;
|
|
701
|
+
const maps = encode(cacheKey, () => lensMap(shape, lensOpts, lightOpts, density));
|
|
702
|
+
if (!maps) {
|
|
703
|
+
cleanup();
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
const lensConfig = { maps, shine };
|
|
707
|
+
const webKit = isWebKit();
|
|
708
|
+
const filter = buildFilter([lensConfig], webKit);
|
|
709
|
+
const filterId = `lg-glisse-${++filterIdCounter}`;
|
|
710
|
+
filter.id = filterId;
|
|
711
|
+
const container = getFilterContainer();
|
|
712
|
+
const defs = container.querySelector("defs");
|
|
713
|
+
if (filterRef.current) {
|
|
714
|
+
filterRef.current.remove();
|
|
715
|
+
}
|
|
716
|
+
defs.appendChild(filter);
|
|
717
|
+
filterRef.current = filter;
|
|
718
|
+
currentFilterId.current = filterId;
|
|
719
|
+
setFilterUrl(`url(#${filterId})`);
|
|
720
|
+
setIsReady(true);
|
|
721
|
+
}, [enabled, depth, dome, splay, shine, density, lightAngle, cleanup]);
|
|
722
|
+
(0, import_react4.useEffect)(() => {
|
|
723
|
+
if (!enabled || typeof document === "undefined" || typeof ResizeObserver === "undefined") {
|
|
724
|
+
cleanup();
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const el = ref.current;
|
|
728
|
+
if (!el) return;
|
|
729
|
+
updateFilter(el);
|
|
730
|
+
const observer = new ResizeObserver(() => {
|
|
731
|
+
if (rafRef.current != null) return;
|
|
732
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
733
|
+
rafRef.current = null;
|
|
734
|
+
if (ref.current) updateFilter(ref.current);
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
observer.observe(el);
|
|
738
|
+
return () => {
|
|
739
|
+
observer.disconnect();
|
|
740
|
+
cleanup();
|
|
741
|
+
};
|
|
742
|
+
}, [ref, enabled, updateFilter, cleanup]);
|
|
743
|
+
const rimGradient = `linear-gradient(${lightAngle + 90}deg,
|
|
744
|
+
rgba(255,255,255,0.12) 0%,
|
|
745
|
+
rgba(255,255,255,0.06) 30%,
|
|
746
|
+
transparent 50%,
|
|
747
|
+
rgba(0,0,0,0.04) 100%)`;
|
|
748
|
+
return { filterUrl, rimGradient, isReady };
|
|
749
|
+
}
|
|
750
|
+
function clearGlisseCache() {
|
|
751
|
+
encodedCache.clear();
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// src/core/svg-filters.ts
|
|
755
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
756
|
+
var filterContainer2 = null;
|
|
757
|
+
var filterCounter = 0;
|
|
758
|
+
function getFilterContainer2() {
|
|
759
|
+
if (filterContainer2 && document.body.contains(filterContainer2)) {
|
|
760
|
+
return filterContainer2;
|
|
761
|
+
}
|
|
762
|
+
filterContainer2 = document.createElementNS(SVG_NS2, "svg");
|
|
763
|
+
filterContainer2.setAttribute("aria-hidden", "true");
|
|
764
|
+
filterContainer2.style.cssText = `
|
|
295
765
|
position: absolute;
|
|
296
766
|
width: 0;
|
|
297
767
|
height: 0;
|
|
298
768
|
overflow: hidden;
|
|
299
769
|
pointer-events: none;
|
|
300
770
|
`;
|
|
301
|
-
const defs = document.createElementNS(
|
|
302
|
-
|
|
303
|
-
document.body.appendChild(
|
|
304
|
-
return
|
|
771
|
+
const defs = document.createElementNS(SVG_NS2, "defs");
|
|
772
|
+
filterContainer2.appendChild(defs);
|
|
773
|
+
document.body.appendChild(filterContainer2);
|
|
774
|
+
return filterContainer2;
|
|
305
775
|
}
|
|
306
776
|
function getDefs() {
|
|
307
|
-
const container =
|
|
777
|
+
const container = getFilterContainer2();
|
|
308
778
|
return container.querySelector("defs");
|
|
309
779
|
}
|
|
310
780
|
function createSVGElement(tag, attrs = {}) {
|
|
311
|
-
const el = document.createElementNS(
|
|
781
|
+
const el = document.createElementNS(SVG_NS2, tag);
|
|
312
782
|
for (const [key, value] of Object.entries(attrs)) {
|
|
313
783
|
el.setAttribute(key, String(value));
|
|
314
784
|
}
|
|
@@ -555,9 +1025,9 @@ function createSpecularHighlight(x, y, radius = 200, intensity = 0.08) {
|
|
|
555
1025
|
)`;
|
|
556
1026
|
}
|
|
557
1027
|
function cleanupFilters() {
|
|
558
|
-
if (
|
|
559
|
-
|
|
560
|
-
|
|
1028
|
+
if (filterContainer2) {
|
|
1029
|
+
filterContainer2.remove();
|
|
1030
|
+
filterContainer2 = null;
|
|
561
1031
|
}
|
|
562
1032
|
filterCounter = 0;
|
|
563
1033
|
}
|
|
@@ -568,14 +1038,20 @@ function supportsBackdropFilter() {
|
|
|
568
1038
|
return CSS.supports("backdrop-filter", "blur(1px)") || CSS.supports("-webkit-backdrop-filter", "blur(1px)");
|
|
569
1039
|
}
|
|
570
1040
|
function supportsSVGFilters() {
|
|
571
|
-
if (typeof document === "undefined") return false;
|
|
572
|
-
|
|
573
|
-
|
|
1041
|
+
if (typeof document === "undefined" || typeof window === "undefined") return false;
|
|
1042
|
+
try {
|
|
1043
|
+
const svg2 = document.createElementNS(SVG_NS2, "svg");
|
|
1044
|
+
if (!(svg2 instanceof SVGElement)) return false;
|
|
1045
|
+
const displace = document.createElementNS(SVG_NS2, "feDisplacementMap");
|
|
1046
|
+
return !!displace && displace.namespaceURI === SVG_NS2 && "scale" in displace;
|
|
1047
|
+
} catch {
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
574
1050
|
}
|
|
575
1051
|
|
|
576
1052
|
// src/components/Glass.tsx
|
|
577
1053
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
578
|
-
var Glass = (0,
|
|
1054
|
+
var Glass = (0, import_react5.forwardRef)(
|
|
579
1055
|
({
|
|
580
1056
|
className,
|
|
581
1057
|
style,
|
|
@@ -585,14 +1061,31 @@ var Glass = (0, import_react4.forwardRef)(
|
|
|
585
1061
|
tint,
|
|
586
1062
|
interactive = false,
|
|
587
1063
|
rimLight = false,
|
|
588
|
-
|
|
1064
|
+
refraction,
|
|
1065
|
+
refractionDepth,
|
|
1066
|
+
refractionDome,
|
|
1067
|
+
shine,
|
|
1068
|
+
lightAngle,
|
|
589
1069
|
children,
|
|
590
1070
|
...props
|
|
591
1071
|
}, ref) => {
|
|
592
|
-
const localRef = (0,
|
|
1072
|
+
const localRef = (0, import_react5.useRef)(null);
|
|
593
1073
|
const combinedRef = ref || localRef;
|
|
594
1074
|
const reducedMotion = useReducedMotion();
|
|
595
1075
|
const pointerPosition = usePointerPosition(combinedRef, { enabled: interactive && !reducedMotion });
|
|
1076
|
+
const globalRefraction = useRefraction();
|
|
1077
|
+
const shouldRefract = refraction ?? globalRefraction.enabled;
|
|
1078
|
+
const depth = refractionDepth ?? globalRefraction.depth;
|
|
1079
|
+
const dome = refractionDome ?? globalRefraction.dome;
|
|
1080
|
+
const shineValue = shine ?? globalRefraction.shine;
|
|
1081
|
+
const angle = lightAngle ?? globalRefraction.lightAngle;
|
|
1082
|
+
const { filterUrl, rimGradient: glisseRim, isReady } = useGlisseEffect(combinedRef, {
|
|
1083
|
+
enabled: shouldRefract && !reducedMotion,
|
|
1084
|
+
depth,
|
|
1085
|
+
dome,
|
|
1086
|
+
shine: shineValue,
|
|
1087
|
+
lightAngle: angle
|
|
1088
|
+
});
|
|
596
1089
|
const customStyles = {
|
|
597
1090
|
...style
|
|
598
1091
|
};
|
|
@@ -605,8 +1098,13 @@ var Glass = (0, import_react4.forwardRef)(
|
|
|
605
1098
|
if (tint) {
|
|
606
1099
|
customStyles.backgroundColor = tint;
|
|
607
1100
|
}
|
|
608
|
-
if (
|
|
609
|
-
customStyles.backgroundImage =
|
|
1101
|
+
if (shouldRefract && isReady) {
|
|
1102
|
+
customStyles.backgroundImage = glisseRim;
|
|
1103
|
+
} else if (rimLight) {
|
|
1104
|
+
customStyles.backgroundImage = createRimLightGradient({ intensity: 0.15, angle });
|
|
1105
|
+
}
|
|
1106
|
+
if (shouldRefract && filterUrl && isReady) {
|
|
1107
|
+
customStyles.filter = filterUrl;
|
|
610
1108
|
}
|
|
611
1109
|
if (interactive && pointerPosition.isInside) {
|
|
612
1110
|
customStyles["--lg-pointer-x"] = `${pointerPosition.percentX}%`;
|
|
@@ -625,6 +1123,7 @@ var Glass = (0, import_react4.forwardRef)(
|
|
|
625
1123
|
className: cn(variantClasses[variant], className),
|
|
626
1124
|
style: customStyles,
|
|
627
1125
|
"data-hover": interactive && pointerPosition.isInside ? "" : void 0,
|
|
1126
|
+
"data-rim": shouldRefract && isReady ? "" : void 0,
|
|
628
1127
|
...props,
|
|
629
1128
|
children
|
|
630
1129
|
}
|
|
@@ -634,7 +1133,7 @@ var Glass = (0, import_react4.forwardRef)(
|
|
|
634
1133
|
Glass.displayName = "Glass";
|
|
635
1134
|
|
|
636
1135
|
// src/components/GlassCard.tsx
|
|
637
|
-
var
|
|
1136
|
+
var import_react6 = require("react");
|
|
638
1137
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
639
1138
|
var paddingMap = {
|
|
640
1139
|
none: "0",
|
|
@@ -643,13 +1142,13 @@ var paddingMap = {
|
|
|
643
1142
|
lg: "24px"
|
|
644
1143
|
};
|
|
645
1144
|
var radiusMap = {
|
|
646
|
-
sm: "
|
|
647
|
-
md: "
|
|
648
|
-
lg: "
|
|
649
|
-
xl: "
|
|
650
|
-
full: "
|
|
1145
|
+
sm: "8px",
|
|
1146
|
+
md: "12px",
|
|
1147
|
+
lg: "16px",
|
|
1148
|
+
xl: "20px",
|
|
1149
|
+
full: "9999px"
|
|
651
1150
|
};
|
|
652
|
-
var GlassCard = (0,
|
|
1151
|
+
var GlassCard = (0, import_react6.forwardRef)(
|
|
653
1152
|
({
|
|
654
1153
|
className,
|
|
655
1154
|
style,
|
|
@@ -657,14 +1156,25 @@ var GlassCard = (0, import_react5.forwardRef)(
|
|
|
657
1156
|
padding = "md",
|
|
658
1157
|
radius = "lg",
|
|
659
1158
|
hoverable = false,
|
|
1159
|
+
disableRefraction = false,
|
|
660
1160
|
children,
|
|
661
1161
|
...props
|
|
662
1162
|
}, ref) => {
|
|
1163
|
+
const localRef = (0, import_react6.useRef)(null);
|
|
1164
|
+
const combinedRef = ref || localRef;
|
|
1165
|
+
const reducedMotion = useReducedMotion();
|
|
1166
|
+
const { filterUrl, rimGradient, isReady } = useGlisseEffect(combinedRef, {
|
|
1167
|
+
enabled: !disableRefraction && !reducedMotion
|
|
1168
|
+
});
|
|
663
1169
|
const customStyles = {
|
|
664
1170
|
padding: paddingMap[padding],
|
|
665
1171
|
borderRadius: radiusMap[radius],
|
|
666
1172
|
...style
|
|
667
1173
|
};
|
|
1174
|
+
if (isReady && filterUrl) {
|
|
1175
|
+
customStyles.filter = filterUrl;
|
|
1176
|
+
customStyles.backgroundImage = rimGradient;
|
|
1177
|
+
}
|
|
668
1178
|
const baseClasses = cn(
|
|
669
1179
|
"lg-glass",
|
|
670
1180
|
variant === "elevated" && "lg-glass-elevated",
|
|
@@ -672,61 +1182,61 @@ var GlassCard = (0, import_react5.forwardRef)(
|
|
|
672
1182
|
hoverable && "transition-transform hover:scale-[1.02] hover:shadow-lg cursor-pointer",
|
|
673
1183
|
className
|
|
674
1184
|
);
|
|
675
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref, className: baseClasses, style: customStyles, ...props, children });
|
|
1185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: combinedRef, className: baseClasses, style: customStyles, ...props, children });
|
|
676
1186
|
}
|
|
677
1187
|
);
|
|
678
1188
|
GlassCard.displayName = "GlassCard";
|
|
679
1189
|
|
|
680
1190
|
// src/components/Button.tsx
|
|
681
|
-
var
|
|
1191
|
+
var import_react8 = require("react");
|
|
682
1192
|
|
|
683
1193
|
// src/hooks/use-pressed-state.ts
|
|
684
|
-
var
|
|
1194
|
+
var import_react7 = require("react");
|
|
685
1195
|
function usePressedState(options = {}) {
|
|
686
1196
|
const { disabled = false, onPressStart, onPressEnd } = options;
|
|
687
|
-
const [isPressed, setIsPressed] = (0,
|
|
688
|
-
const pointerIdRef = (0,
|
|
689
|
-
const handlePressStart = (0,
|
|
1197
|
+
const [isPressed, setIsPressed] = (0, import_react7.useState)(false);
|
|
1198
|
+
const pointerIdRef = (0, import_react7.useRef)(null);
|
|
1199
|
+
const handlePressStart = (0, import_react7.useCallback)(() => {
|
|
690
1200
|
if (disabled) return;
|
|
691
1201
|
setIsPressed(true);
|
|
692
1202
|
onPressStart?.();
|
|
693
1203
|
}, [disabled, onPressStart]);
|
|
694
|
-
const handlePressEnd = (0,
|
|
1204
|
+
const handlePressEnd = (0, import_react7.useCallback)(() => {
|
|
695
1205
|
setIsPressed(false);
|
|
696
1206
|
onPressEnd?.();
|
|
697
1207
|
}, [onPressEnd]);
|
|
698
|
-
const onPointerDown = (0,
|
|
1208
|
+
const onPointerDown = (0, import_react7.useCallback)((e) => {
|
|
699
1209
|
if (disabled || pointerIdRef.current !== null) return;
|
|
700
1210
|
pointerIdRef.current = e.pointerId;
|
|
701
1211
|
handlePressStart();
|
|
702
1212
|
e.target.setPointerCapture?.(e.pointerId);
|
|
703
1213
|
}, [disabled, handlePressStart]);
|
|
704
|
-
const onPointerUp = (0,
|
|
1214
|
+
const onPointerUp = (0, import_react7.useCallback)((e) => {
|
|
705
1215
|
if (pointerIdRef.current !== e.pointerId) return;
|
|
706
1216
|
pointerIdRef.current = null;
|
|
707
1217
|
handlePressEnd();
|
|
708
1218
|
}, [handlePressEnd]);
|
|
709
|
-
const onPointerCancel = (0,
|
|
1219
|
+
const onPointerCancel = (0, import_react7.useCallback)((e) => {
|
|
710
1220
|
if (pointerIdRef.current !== e.pointerId) return;
|
|
711
1221
|
pointerIdRef.current = null;
|
|
712
1222
|
handlePressEnd();
|
|
713
1223
|
}, [handlePressEnd]);
|
|
714
|
-
const onPointerLeave = (0,
|
|
1224
|
+
const onPointerLeave = (0, import_react7.useCallback)((e) => {
|
|
715
1225
|
if (pointerIdRef.current !== e.pointerId) return;
|
|
716
1226
|
}, []);
|
|
717
|
-
const onKeyDown = (0,
|
|
1227
|
+
const onKeyDown = (0, import_react7.useCallback)((e) => {
|
|
718
1228
|
if (disabled) return;
|
|
719
1229
|
if (e.key === " " || e.key === "Enter") {
|
|
720
1230
|
e.preventDefault();
|
|
721
1231
|
handlePressStart();
|
|
722
1232
|
}
|
|
723
1233
|
}, [disabled, handlePressStart]);
|
|
724
|
-
const onKeyUp = (0,
|
|
1234
|
+
const onKeyUp = (0, import_react7.useCallback)((e) => {
|
|
725
1235
|
if (e.key === " " || e.key === "Enter") {
|
|
726
1236
|
handlePressEnd();
|
|
727
1237
|
}
|
|
728
1238
|
}, [handlePressEnd]);
|
|
729
|
-
(0,
|
|
1239
|
+
(0, import_react7.useEffect)(() => {
|
|
730
1240
|
return () => {
|
|
731
1241
|
pointerIdRef.current = null;
|
|
732
1242
|
};
|
|
@@ -772,7 +1282,7 @@ var sizeStyles = {
|
|
|
772
1282
|
gap: "10px"
|
|
773
1283
|
}
|
|
774
1284
|
};
|
|
775
|
-
var Button = (0,
|
|
1285
|
+
var Button = (0, import_react8.forwardRef)(
|
|
776
1286
|
({
|
|
777
1287
|
className,
|
|
778
1288
|
style,
|
|
@@ -785,23 +1295,38 @@ var Button = (0, import_react7.forwardRef)(
|
|
|
785
1295
|
loading = false,
|
|
786
1296
|
fullWidth = false,
|
|
787
1297
|
disabled,
|
|
1298
|
+
disableRefraction = false,
|
|
788
1299
|
children,
|
|
789
1300
|
...props
|
|
790
1301
|
}, ref) => {
|
|
1302
|
+
const localRef = (0, import_react8.useRef)(null);
|
|
1303
|
+
const combinedRef = ref || localRef;
|
|
791
1304
|
const { isPressed, pressHandlers } = usePressedState({ disabled: disabled || loading });
|
|
792
|
-
const
|
|
1305
|
+
const reducedMotion = useReducedMotion();
|
|
1306
|
+
const sizeConfig14 = sizeStyles[size];
|
|
1307
|
+
const shouldRefract = variant === "glass" && !disableRefraction && !reducedMotion;
|
|
1308
|
+
const { filterUrl, rimGradient, isReady } = useGlisseEffect(combinedRef, {
|
|
1309
|
+
enabled: shouldRefract,
|
|
1310
|
+
depth: 6,
|
|
1311
|
+
dome: 3,
|
|
1312
|
+
shine: 0.25
|
|
1313
|
+
});
|
|
793
1314
|
const customStyles = {
|
|
794
|
-
height:
|
|
795
|
-
padding: icon && !children ? "0" :
|
|
796
|
-
fontSize:
|
|
797
|
-
borderRadius:
|
|
798
|
-
gap:
|
|
799
|
-
width: icon && !children ?
|
|
1315
|
+
height: sizeConfig14.height,
|
|
1316
|
+
padding: icon && !children ? "0" : sizeConfig14.padding,
|
|
1317
|
+
fontSize: sizeConfig14.fontSize,
|
|
1318
|
+
borderRadius: sizeConfig14.borderRadius,
|
|
1319
|
+
gap: sizeConfig14.gap,
|
|
1320
|
+
width: icon && !children ? sizeConfig14.height : fullWidth ? "100%" : void 0,
|
|
800
1321
|
...style
|
|
801
1322
|
};
|
|
802
1323
|
if (tint && !destructive) {
|
|
803
1324
|
customStyles["--lg-tint"] = tint;
|
|
804
1325
|
}
|
|
1326
|
+
if (shouldRefract && isReady && filterUrl) {
|
|
1327
|
+
customStyles.filter = filterUrl;
|
|
1328
|
+
customStyles.backgroundImage = rimGradient;
|
|
1329
|
+
}
|
|
805
1330
|
const baseClasses = cn(
|
|
806
1331
|
"lg-glass lg-interactive lg-focus-ring",
|
|
807
1332
|
"inline-flex items-center justify-center",
|
|
@@ -827,7 +1352,7 @@ var Button = (0, import_react7.forwardRef)(
|
|
|
827
1352
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
828
1353
|
"button",
|
|
829
1354
|
{
|
|
830
|
-
ref,
|
|
1355
|
+
ref: combinedRef,
|
|
831
1356
|
className: baseClasses,
|
|
832
1357
|
style: { ...customStyles, ...variantStyles2 },
|
|
833
1358
|
disabled: disabled || loading,
|
|
@@ -842,8 +1367,8 @@ var Button = (0, import_react7.forwardRef)(
|
|
|
842
1367
|
{
|
|
843
1368
|
className: "animate-spin",
|
|
844
1369
|
style: {
|
|
845
|
-
width:
|
|
846
|
-
height:
|
|
1370
|
+
width: sizeConfig14.iconSize,
|
|
1371
|
+
height: sizeConfig14.iconSize,
|
|
847
1372
|
border: "2px solid currentColor",
|
|
848
1373
|
borderTopColor: "transparent",
|
|
849
1374
|
borderRadius: "50%"
|
|
@@ -854,7 +1379,7 @@ var Button = (0, import_react7.forwardRef)(
|
|
|
854
1379
|
"span",
|
|
855
1380
|
{
|
|
856
1381
|
className: "flex items-center justify-center",
|
|
857
|
-
style: { width:
|
|
1382
|
+
style: { width: sizeConfig14.iconSize, height: sizeConfig14.iconSize },
|
|
858
1383
|
children: icon
|
|
859
1384
|
}
|
|
860
1385
|
),
|
|
@@ -863,7 +1388,7 @@ var Button = (0, import_react7.forwardRef)(
|
|
|
863
1388
|
"span",
|
|
864
1389
|
{
|
|
865
1390
|
className: "flex items-center justify-center",
|
|
866
|
-
style: { width:
|
|
1391
|
+
style: { width: sizeConfig14.iconSize, height: sizeConfig14.iconSize },
|
|
867
1392
|
children: icon
|
|
868
1393
|
}
|
|
869
1394
|
)
|
|
@@ -875,14 +1400,14 @@ var Button = (0, import_react7.forwardRef)(
|
|
|
875
1400
|
Button.displayName = "Button";
|
|
876
1401
|
|
|
877
1402
|
// src/components/IconButton.tsx
|
|
878
|
-
var
|
|
1403
|
+
var import_react9 = require("react");
|
|
879
1404
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
880
1405
|
var sizeStyles2 = {
|
|
881
1406
|
sm: { size: "32px", iconSize: "16px" },
|
|
882
1407
|
md: { size: "40px", iconSize: "20px" },
|
|
883
1408
|
lg: { size: "48px", iconSize: "24px" }
|
|
884
1409
|
};
|
|
885
|
-
var IconButton = (0,
|
|
1410
|
+
var IconButton = (0, import_react9.forwardRef)(
|
|
886
1411
|
({
|
|
887
1412
|
className,
|
|
888
1413
|
style,
|
|
@@ -896,10 +1421,10 @@ var IconButton = (0, import_react8.forwardRef)(
|
|
|
896
1421
|
...props
|
|
897
1422
|
}, ref) => {
|
|
898
1423
|
const { isPressed, pressHandlers } = usePressedState({ disabled: disabled || loading });
|
|
899
|
-
const
|
|
1424
|
+
const sizeConfig14 = sizeStyles2[size];
|
|
900
1425
|
const customStyles = {
|
|
901
|
-
width:
|
|
902
|
-
height:
|
|
1426
|
+
width: sizeConfig14.size,
|
|
1427
|
+
height: sizeConfig14.size,
|
|
903
1428
|
borderRadius: "50%",
|
|
904
1429
|
...style
|
|
905
1430
|
};
|
|
@@ -936,8 +1461,8 @@ var IconButton = (0, import_react8.forwardRef)(
|
|
|
936
1461
|
{
|
|
937
1462
|
className: "animate-spin",
|
|
938
1463
|
style: {
|
|
939
|
-
width:
|
|
940
|
-
height:
|
|
1464
|
+
width: sizeConfig14.iconSize,
|
|
1465
|
+
height: sizeConfig14.iconSize,
|
|
941
1466
|
border: "2px solid currentColor",
|
|
942
1467
|
borderTopColor: "transparent",
|
|
943
1468
|
borderRadius: "50%"
|
|
@@ -947,7 +1472,7 @@ var IconButton = (0, import_react8.forwardRef)(
|
|
|
947
1472
|
"span",
|
|
948
1473
|
{
|
|
949
1474
|
className: "flex items-center justify-center",
|
|
950
|
-
style: { width:
|
|
1475
|
+
style: { width: sizeConfig14.iconSize, height: sizeConfig14.iconSize },
|
|
951
1476
|
children: icon
|
|
952
1477
|
}
|
|
953
1478
|
)
|
|
@@ -958,16 +1483,16 @@ var IconButton = (0, import_react8.forwardRef)(
|
|
|
958
1483
|
IconButton.displayName = "IconButton";
|
|
959
1484
|
|
|
960
1485
|
// src/components/Toggle.tsx
|
|
961
|
-
var
|
|
1486
|
+
var import_react11 = require("react");
|
|
962
1487
|
|
|
963
1488
|
// src/hooks/use-controllable.ts
|
|
964
|
-
var
|
|
1489
|
+
var import_react10 = require("react");
|
|
965
1490
|
function useControllable(options) {
|
|
966
1491
|
const { value: controlledValue, defaultValue, onChange } = options;
|
|
967
1492
|
const isControlled = controlledValue !== void 0;
|
|
968
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
1493
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react10.useState)(defaultValue);
|
|
969
1494
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
970
|
-
const setValue = (0,
|
|
1495
|
+
const setValue = (0, import_react10.useCallback)((newValue) => {
|
|
971
1496
|
if (!isControlled) {
|
|
972
1497
|
setUncontrolledValue(newValue);
|
|
973
1498
|
}
|
|
@@ -978,9 +1503,9 @@ function useControllable(options) {
|
|
|
978
1503
|
function useControllableBoolean(options) {
|
|
979
1504
|
const { checked, defaultChecked = false, onCheckedChange } = options;
|
|
980
1505
|
const isControlled = checked !== void 0;
|
|
981
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
1506
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react10.useState)(defaultChecked);
|
|
982
1507
|
const value = isControlled ? checked : uncontrolledValue;
|
|
983
|
-
const setValue = (0,
|
|
1508
|
+
const setValue = (0, import_react10.useCallback)((newValue) => {
|
|
984
1509
|
if (!isControlled) {
|
|
985
1510
|
setUncontrolledValue(newValue);
|
|
986
1511
|
}
|
|
@@ -996,7 +1521,7 @@ var sizeConfig = {
|
|
|
996
1521
|
md: { size: 40, padding: "0 12px", fontSize: 14, iconSize: 20 },
|
|
997
1522
|
lg: { size: 48, padding: "0 16px", fontSize: 16, iconSize: 24 }
|
|
998
1523
|
};
|
|
999
|
-
var Toggle = (0,
|
|
1524
|
+
var Toggle = (0, import_react11.forwardRef)(
|
|
1000
1525
|
({
|
|
1001
1526
|
className,
|
|
1002
1527
|
style,
|
|
@@ -1074,14 +1599,14 @@ var Toggle = (0, import_react10.forwardRef)(
|
|
|
1074
1599
|
Toggle.displayName = "Toggle";
|
|
1075
1600
|
|
|
1076
1601
|
// src/components/Input.tsx
|
|
1077
|
-
var
|
|
1602
|
+
var import_react12 = require("react");
|
|
1078
1603
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1079
1604
|
var sizeConfig2 = {
|
|
1080
1605
|
sm: { height: 32, padding: "0 10px", fontSize: 13, iconSize: 14, borderRadius: 16 },
|
|
1081
1606
|
md: { height: 40, padding: "0 14px", fontSize: 14, iconSize: 16, borderRadius: 20 },
|
|
1082
1607
|
lg: { height: 48, padding: "0 18px", fontSize: 16, iconSize: 18, borderRadius: 24 }
|
|
1083
1608
|
};
|
|
1084
|
-
var Input = (0,
|
|
1609
|
+
var Input = (0, import_react12.forwardRef)(
|
|
1085
1610
|
({
|
|
1086
1611
|
className,
|
|
1087
1612
|
style,
|
|
@@ -1102,7 +1627,7 @@ var Input = (0, import_react11.forwardRef)(
|
|
|
1102
1627
|
defaultValue,
|
|
1103
1628
|
onChange: onValueChange
|
|
1104
1629
|
});
|
|
1105
|
-
const [isFocused, setIsFocused] = (0,
|
|
1630
|
+
const [isFocused, setIsFocused] = (0, import_react12.useState)(false);
|
|
1106
1631
|
const config = sizeConfig2[size];
|
|
1107
1632
|
const handleChange = (e) => {
|
|
1108
1633
|
setValue(e.target.value);
|
|
@@ -1189,9 +1714,9 @@ var Input = (0, import_react11.forwardRef)(
|
|
|
1189
1714
|
Input.displayName = "Input";
|
|
1190
1715
|
|
|
1191
1716
|
// src/components/Textarea.tsx
|
|
1192
|
-
var
|
|
1717
|
+
var import_react13 = require("react");
|
|
1193
1718
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1194
|
-
var Textarea = (0,
|
|
1719
|
+
var Textarea = (0, import_react13.forwardRef)(
|
|
1195
1720
|
({
|
|
1196
1721
|
className,
|
|
1197
1722
|
style,
|
|
@@ -1209,7 +1734,7 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1209
1734
|
defaultValue,
|
|
1210
1735
|
onChange: onValueChange
|
|
1211
1736
|
});
|
|
1212
|
-
const [isFocused, setIsFocused] = (0,
|
|
1737
|
+
const [isFocused, setIsFocused] = (0, import_react13.useState)(false);
|
|
1213
1738
|
const handleChange = (e) => {
|
|
1214
1739
|
setValue(e.target.value);
|
|
1215
1740
|
};
|
|
@@ -1262,13 +1787,13 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1262
1787
|
Textarea.displayName = "Textarea";
|
|
1263
1788
|
|
|
1264
1789
|
// src/components/SearchField.tsx
|
|
1265
|
-
var
|
|
1790
|
+
var import_react14 = require("react");
|
|
1266
1791
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1267
1792
|
var SearchIcon = () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { width: "100%", height: "100%", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1268
1793
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
1269
1794
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "m21 21-4.35-4.35" })
|
|
1270
1795
|
] });
|
|
1271
|
-
var SearchField = (0,
|
|
1796
|
+
var SearchField = (0, import_react14.forwardRef)(
|
|
1272
1797
|
({ placeholder = "Search", clearable = true, ...props }, ref) => {
|
|
1273
1798
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1274
1799
|
Input,
|
|
@@ -1286,14 +1811,14 @@ var SearchField = (0, import_react13.forwardRef)(
|
|
|
1286
1811
|
SearchField.displayName = "SearchField";
|
|
1287
1812
|
|
|
1288
1813
|
// src/components/Select.tsx
|
|
1289
|
-
var
|
|
1814
|
+
var import_react16 = require("react");
|
|
1290
1815
|
var import_react_dom = require("react-dom");
|
|
1291
1816
|
|
|
1292
1817
|
// src/hooks/use-id.ts
|
|
1293
|
-
var
|
|
1818
|
+
var import_react15 = require("react");
|
|
1294
1819
|
var idCounter = 0;
|
|
1295
1820
|
function useId(providedId) {
|
|
1296
|
-
const reactId = (0,
|
|
1821
|
+
const reactId = (0, import_react15.useId)();
|
|
1297
1822
|
if (providedId) {
|
|
1298
1823
|
return providedId;
|
|
1299
1824
|
}
|
|
@@ -1307,7 +1832,7 @@ var sizeConfig3 = {
|
|
|
1307
1832
|
md: { height: 40, padding: "0 14px", fontSize: 14, borderRadius: 20 },
|
|
1308
1833
|
lg: { height: 48, padding: "0 18px", fontSize: 16, borderRadius: 24 }
|
|
1309
1834
|
};
|
|
1310
|
-
var Select = (0,
|
|
1835
|
+
var Select = (0, import_react16.forwardRef)(
|
|
1311
1836
|
({
|
|
1312
1837
|
className,
|
|
1313
1838
|
style,
|
|
@@ -1327,23 +1852,23 @@ var Select = (0, import_react15.forwardRef)(
|
|
|
1327
1852
|
defaultValue,
|
|
1328
1853
|
onChange: onValueChange
|
|
1329
1854
|
});
|
|
1330
|
-
const [isOpen, setIsOpen] = (0,
|
|
1331
|
-
const [focusedIndex, setFocusedIndex] = (0,
|
|
1332
|
-
const triggerRef = (0,
|
|
1333
|
-
const menuRef = (0,
|
|
1855
|
+
const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
|
|
1856
|
+
const [focusedIndex, setFocusedIndex] = (0, import_react16.useState)(-1);
|
|
1857
|
+
const triggerRef = (0, import_react16.useRef)(null);
|
|
1858
|
+
const menuRef = (0, import_react16.useRef)(null);
|
|
1334
1859
|
const reducedMotion = useReducedMotion();
|
|
1335
1860
|
const id = useId(providedId);
|
|
1336
1861
|
const menuId = `${id}-menu`;
|
|
1337
1862
|
const config = sizeConfig3[size];
|
|
1338
1863
|
const selectedOption = options.find((opt) => opt.value === value);
|
|
1339
|
-
const updateMenuPosition = (0,
|
|
1864
|
+
const updateMenuPosition = (0, import_react16.useCallback)(() => {
|
|
1340
1865
|
if (!triggerRef.current || !menuRef.current) return;
|
|
1341
1866
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
1342
1867
|
menuRef.current.style.top = `${rect.bottom + window.scrollY + 4}px`;
|
|
1343
1868
|
menuRef.current.style.left = `${rect.left + window.scrollX}px`;
|
|
1344
1869
|
menuRef.current.style.width = `${rect.width}px`;
|
|
1345
1870
|
}, []);
|
|
1346
|
-
(0,
|
|
1871
|
+
(0, import_react16.useEffect)(() => {
|
|
1347
1872
|
if (isOpen) {
|
|
1348
1873
|
updateMenuPosition();
|
|
1349
1874
|
window.addEventListener("scroll", updateMenuPosition, true);
|
|
@@ -1354,7 +1879,7 @@ var Select = (0, import_react15.forwardRef)(
|
|
|
1354
1879
|
window.removeEventListener("resize", updateMenuPosition);
|
|
1355
1880
|
};
|
|
1356
1881
|
}, [isOpen, updateMenuPosition]);
|
|
1357
|
-
(0,
|
|
1882
|
+
(0, import_react16.useEffect)(() => {
|
|
1358
1883
|
if (!isOpen) return;
|
|
1359
1884
|
const handleClickOutside = (e) => {
|
|
1360
1885
|
if (triggerRef.current?.contains(e.target) || menuRef.current?.contains(e.target)) {
|
|
@@ -1515,14 +2040,14 @@ var Select = (0, import_react15.forwardRef)(
|
|
|
1515
2040
|
Select.displayName = "Select";
|
|
1516
2041
|
|
|
1517
2042
|
// src/components/Checkbox.tsx
|
|
1518
|
-
var
|
|
2043
|
+
var import_react17 = require("react");
|
|
1519
2044
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1520
2045
|
var sizeConfig4 = {
|
|
1521
2046
|
sm: { size: 16, iconSize: 10, borderRadius: 4 },
|
|
1522
2047
|
md: { size: 20, iconSize: 12, borderRadius: 5 },
|
|
1523
2048
|
lg: { size: 24, iconSize: 14, borderRadius: 6 }
|
|
1524
2049
|
};
|
|
1525
|
-
var Checkbox = (0,
|
|
2050
|
+
var Checkbox = (0, import_react17.forwardRef)(
|
|
1526
2051
|
({
|
|
1527
2052
|
className,
|
|
1528
2053
|
style,
|
|
@@ -1609,9 +2134,9 @@ var Checkbox = (0, import_react16.forwardRef)(
|
|
|
1609
2134
|
Checkbox.displayName = "Checkbox";
|
|
1610
2135
|
|
|
1611
2136
|
// src/components/Radio.tsx
|
|
1612
|
-
var
|
|
2137
|
+
var import_react18 = require("react");
|
|
1613
2138
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1614
|
-
var RadioGroupContext = (0,
|
|
2139
|
+
var RadioGroupContext = (0, import_react18.createContext)(null);
|
|
1615
2140
|
function RadioGroup({
|
|
1616
2141
|
children,
|
|
1617
2142
|
name,
|
|
@@ -1658,7 +2183,7 @@ var sizeConfig5 = {
|
|
|
1658
2183
|
md: { size: 20, dotSize: 8 },
|
|
1659
2184
|
lg: { size: 24, dotSize: 10 }
|
|
1660
2185
|
};
|
|
1661
|
-
var Radio = (0,
|
|
2186
|
+
var Radio = (0, import_react18.forwardRef)(
|
|
1662
2187
|
({
|
|
1663
2188
|
className,
|
|
1664
2189
|
style,
|
|
@@ -1668,7 +2193,7 @@ var Radio = (0, import_react17.forwardRef)(
|
|
|
1668
2193
|
disabled: disabledProp,
|
|
1669
2194
|
...props
|
|
1670
2195
|
}, ref) => {
|
|
1671
|
-
const group = (0,
|
|
2196
|
+
const group = (0, import_react18.useContext)(RadioGroupContext);
|
|
1672
2197
|
const size = sizeProp ?? group?.size ?? "md";
|
|
1673
2198
|
const disabled = disabledProp ?? group?.disabled;
|
|
1674
2199
|
const isChecked = group ? group.value === value : false;
|
|
@@ -1737,14 +2262,21 @@ var Radio = (0, import_react17.forwardRef)(
|
|
|
1737
2262
|
Radio.displayName = "Radio";
|
|
1738
2263
|
|
|
1739
2264
|
// src/components/Switch.tsx
|
|
1740
|
-
var
|
|
2265
|
+
var import_react19 = require("react");
|
|
1741
2266
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1742
|
-
var
|
|
1743
|
-
sm:
|
|
1744
|
-
md:
|
|
1745
|
-
lg:
|
|
2267
|
+
var SCALE_BY_SIZE = {
|
|
2268
|
+
sm: 0.3,
|
|
2269
|
+
md: 0.375,
|
|
2270
|
+
lg: 0.5
|
|
1746
2271
|
};
|
|
1747
|
-
var
|
|
2272
|
+
var THUMB_SHADOW = `
|
|
2273
|
+
0 6px 24px rgba(0,0,0,0.2),
|
|
2274
|
+
inset 0 0 0 1.5px rgba(255,255,255,0.5),
|
|
2275
|
+
inset 0 2px 1px rgba(255,255,255,0.45),
|
|
2276
|
+
inset 2px 7px 24px rgba(0,0,0,0.09),
|
|
2277
|
+
inset -2px -7px 24px rgba(255,255,255,0.16)
|
|
2278
|
+
`;
|
|
2279
|
+
var Switch = (0, import_react19.forwardRef)(
|
|
1748
2280
|
({
|
|
1749
2281
|
className,
|
|
1750
2282
|
style,
|
|
@@ -1754,93 +2286,152 @@ var Switch = (0, import_react18.forwardRef)(
|
|
|
1754
2286
|
size = "md",
|
|
1755
2287
|
disabled,
|
|
1756
2288
|
...props
|
|
1757
|
-
},
|
|
2289
|
+
}, forwardedRef) => {
|
|
1758
2290
|
const [checked, setChecked] = useControllableBoolean({
|
|
1759
2291
|
checked: controlledChecked,
|
|
1760
2292
|
defaultChecked,
|
|
1761
2293
|
onCheckedChange
|
|
1762
2294
|
});
|
|
1763
|
-
const [lift, setLift] = (0,
|
|
2295
|
+
const [lift, setLift] = (0, import_react19.useState)(0);
|
|
1764
2296
|
const reducedMotion = useReducedMotion();
|
|
1765
|
-
const
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
2297
|
+
const rootRef = (0, import_react19.useRef)(null);
|
|
2298
|
+
const thumbRef = (0, import_react19.useRef)(null);
|
|
2299
|
+
const gestureRef = (0, import_react19.useRef)(null);
|
|
2300
|
+
(0, import_react19.useImperativeHandle)(forwardedRef, () => rootRef.current);
|
|
2301
|
+
const scale = SCALE_BY_SIZE[size];
|
|
2302
|
+
const travel = 57.9 * scale;
|
|
2303
|
+
const width = 160 * scale;
|
|
2304
|
+
const height = 67 * scale;
|
|
2305
|
+
const thumbWidth = 146 * scale;
|
|
2306
|
+
const thumbHeight = 92 * scale;
|
|
2307
|
+
const thumbScale = 0.65 + lift * 0.25;
|
|
2308
|
+
const thumbX = checked ? travel : 0;
|
|
2309
|
+
const { filterUrl, rimGradient, isReady } = useGlisseEffect(thumbRef, {
|
|
2310
|
+
enabled: !reducedMotion,
|
|
2311
|
+
depth: 2,
|
|
2312
|
+
dome: 6,
|
|
2313
|
+
splay: 0.4,
|
|
2314
|
+
shine: 0.3
|
|
1770
2315
|
});
|
|
1771
2316
|
const handleClick = () => {
|
|
1772
|
-
if (!disabled) {
|
|
2317
|
+
if (!disabled && !gestureRef.current) {
|
|
1773
2318
|
setChecked(!checked);
|
|
1774
2319
|
}
|
|
1775
2320
|
};
|
|
1776
|
-
const
|
|
1777
|
-
|
|
1778
|
-
|
|
2321
|
+
const handlePointerDown = (e) => {
|
|
2322
|
+
if (disabled || e.button !== 0) return;
|
|
2323
|
+
e.preventDefault();
|
|
2324
|
+
gestureRef.current = {
|
|
2325
|
+
id: e.pointerId,
|
|
2326
|
+
x: e.clientX,
|
|
2327
|
+
from: checked ? 1 : 0
|
|
2328
|
+
};
|
|
2329
|
+
rootRef.current?.setPointerCapture(e.pointerId);
|
|
2330
|
+
if (!reducedMotion) setLift(1);
|
|
2331
|
+
};
|
|
2332
|
+
const handlePointerUp = (e) => {
|
|
2333
|
+
if (gestureRef.current?.id !== e.pointerId) return;
|
|
2334
|
+
const gesture = gestureRef.current;
|
|
2335
|
+
gestureRef.current = null;
|
|
2336
|
+
setLift(0);
|
|
2337
|
+
const dx = e.clientX - gesture.x;
|
|
2338
|
+
if (Math.abs(dx) > 4) {
|
|
2339
|
+
const value = gesture.from + dx / travel;
|
|
2340
|
+
setChecked(value > 0.5);
|
|
2341
|
+
} else {
|
|
2342
|
+
setChecked(!checked);
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
const handlePointerCancel = () => {
|
|
2346
|
+
gestureRef.current = null;
|
|
2347
|
+
setLift(0);
|
|
2348
|
+
};
|
|
2349
|
+
const rootStyles = {
|
|
2350
|
+
width,
|
|
2351
|
+
height,
|
|
1779
2352
|
...style
|
|
1780
2353
|
};
|
|
1781
2354
|
const thumbStyles = {
|
|
1782
|
-
"
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
2355
|
+
position: "absolute",
|
|
2356
|
+
top: "50%",
|
|
2357
|
+
left: -21.95 * scale,
|
|
2358
|
+
width: thumbWidth,
|
|
2359
|
+
height: thumbHeight,
|
|
2360
|
+
transform: `translate(${thumbX}px, -50%) scale(${thumbScale})`,
|
|
2361
|
+
transition: reducedMotion ? "none" : "transform 200ms cubic-bezier(.25,.1,.25,1)",
|
|
2362
|
+
borderRadius: 9999,
|
|
2363
|
+
backdropFilter: `blur(${2 * (1 - lift) + 0.5 * lift}px) brightness(${1 + 0.15 * (1 - lift)}) saturate(1.5)`,
|
|
2364
|
+
WebkitBackdropFilter: `blur(${2 * (1 - lift) + 0.5 * lift}px) brightness(${1 + 0.15 * (1 - lift)}) saturate(1.5)`,
|
|
2365
|
+
boxShadow: THUMB_SHADOW,
|
|
2366
|
+
pointerEvents: "none",
|
|
2367
|
+
...isReady && filterUrl ? { filter: filterUrl, backgroundImage: rimGradient } : {}
|
|
1787
2368
|
};
|
|
1788
2369
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1789
2370
|
"button",
|
|
1790
2371
|
{
|
|
1791
|
-
ref,
|
|
2372
|
+
ref: rootRef,
|
|
2373
|
+
type: "button",
|
|
1792
2374
|
role: "switch",
|
|
1793
2375
|
"aria-checked": checked,
|
|
1794
2376
|
className: cn(
|
|
1795
|
-
"lg-
|
|
1796
|
-
"
|
|
1797
|
-
"
|
|
2377
|
+
"lg-focus-ring relative inline-flex items-center shrink-0",
|
|
2378
|
+
"p-0 border-0 rounded-full cursor-pointer touch-pan-y",
|
|
2379
|
+
"bg-transparent",
|
|
1798
2380
|
disabled && "opacity-35 cursor-default",
|
|
1799
2381
|
className
|
|
1800
2382
|
),
|
|
1801
|
-
style:
|
|
2383
|
+
style: rootStyles,
|
|
1802
2384
|
disabled,
|
|
1803
2385
|
onClick: handleClick,
|
|
1804
|
-
|
|
2386
|
+
onPointerDown: handlePointerDown,
|
|
2387
|
+
onPointerUp: handlePointerUp,
|
|
2388
|
+
onPointerCancel: handlePointerCancel,
|
|
1805
2389
|
...props,
|
|
1806
2390
|
children: [
|
|
1807
2391
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1808
2392
|
"span",
|
|
1809
2393
|
{
|
|
1810
|
-
|
|
1811
|
-
style: {
|
|
1812
|
-
backgroundColor: checked ? "var(--lg-on)" : "var(--lg-track)",
|
|
1813
|
-
transition: reducedMotion ? "none" : "background-color 200ms var(--lg-ease)"
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
),
|
|
1817
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1818
|
-
"span",
|
|
1819
|
-
{
|
|
1820
|
-
className: "absolute rounded-full",
|
|
1821
|
-
style: {
|
|
1822
|
-
...thumbStyles,
|
|
1823
|
-
left: 2,
|
|
1824
|
-
top: "50%",
|
|
1825
|
-
marginTop: -(config.thumbSize + lift * 4) / 2,
|
|
1826
|
-
backdropFilter: `blur(${2 * (1 - lift) + 0.5 * lift}px) brightness(${1 + 0.15 * (1 - lift)}) saturate(1.5)`,
|
|
1827
|
-
boxShadow: `
|
|
1828
|
-
0 6px 24px rgb(0 0 0 / 0.2),
|
|
1829
|
-
inset 0 0 0 1.5px rgb(255 255 255 / 0.5),
|
|
1830
|
-
inset 0 2px 1px rgb(255 255 255 / 0.45)
|
|
1831
|
-
`
|
|
1832
|
-
},
|
|
2394
|
+
"aria-hidden": true,
|
|
2395
|
+
style: { position: "absolute", inset: "-6px -12px", pointerEvents: "none" },
|
|
1833
2396
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1834
2397
|
"span",
|
|
1835
2398
|
{
|
|
1836
|
-
className: "absolute inset-0 rounded-full bg-white",
|
|
1837
2399
|
style: {
|
|
1838
|
-
|
|
1839
|
-
|
|
2400
|
+
position: "absolute",
|
|
2401
|
+
inset: "6px 12px",
|
|
2402
|
+
borderRadius: 9999,
|
|
2403
|
+
backgroundColor: "var(--lg-track)"
|
|
2404
|
+
},
|
|
2405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2406
|
+
"span",
|
|
2407
|
+
{
|
|
2408
|
+
style: {
|
|
2409
|
+
position: "absolute",
|
|
2410
|
+
inset: 0,
|
|
2411
|
+
borderRadius: 9999,
|
|
2412
|
+
backgroundColor: "var(--lg-on)",
|
|
2413
|
+
opacity: checked ? 1 : 0,
|
|
2414
|
+
transition: reducedMotion ? "none" : "opacity 200ms cubic-bezier(.25,.1,.25,1)"
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
)
|
|
1840
2418
|
}
|
|
1841
2419
|
)
|
|
1842
2420
|
}
|
|
1843
|
-
)
|
|
2421
|
+
),
|
|
2422
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { ref: thumbRef, "aria-hidden": true, style: thumbStyles, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2423
|
+
"span",
|
|
2424
|
+
{
|
|
2425
|
+
"aria-hidden": true,
|
|
2426
|
+
style: {
|
|
2427
|
+
position: "absolute",
|
|
2428
|
+
inset: 0,
|
|
2429
|
+
borderRadius: "inherit",
|
|
2430
|
+
backgroundColor: "#fff",
|
|
2431
|
+
opacity: 1 - lift * 0.85
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
) })
|
|
1844
2435
|
]
|
|
1845
2436
|
}
|
|
1846
2437
|
);
|
|
@@ -1849,10 +2440,10 @@ var Switch = (0, import_react18.forwardRef)(
|
|
|
1849
2440
|
Switch.displayName = "Switch";
|
|
1850
2441
|
|
|
1851
2442
|
// src/components/Slider.tsx
|
|
1852
|
-
var
|
|
2443
|
+
var import_react20 = require("react");
|
|
1853
2444
|
|
|
1854
2445
|
// src/utils/index.ts
|
|
1855
|
-
function
|
|
2446
|
+
function clamp2(value, min, max) {
|
|
1856
2447
|
return Math.min(Math.max(value, min), max);
|
|
1857
2448
|
}
|
|
1858
2449
|
function lerp(start, end, t) {
|
|
@@ -1889,7 +2480,14 @@ function isBrowser() {
|
|
|
1889
2480
|
|
|
1890
2481
|
// src/components/Slider.tsx
|
|
1891
2482
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1892
|
-
var
|
|
2483
|
+
var THUMB_SHADOW2 = `
|
|
2484
|
+
0 6px 24px rgba(0,0,0,0.2),
|
|
2485
|
+
inset 0 0 0 1.5px rgba(255,255,255,0.5),
|
|
2486
|
+
inset 0 2px 1px rgba(255,255,255,0.45),
|
|
2487
|
+
inset 2px 7px 24px rgba(0,0,0,0.09),
|
|
2488
|
+
inset -2px -7px 24px rgba(255,255,255,0.16)
|
|
2489
|
+
`;
|
|
2490
|
+
var Slider = (0, import_react20.forwardRef)(
|
|
1893
2491
|
({
|
|
1894
2492
|
className,
|
|
1895
2493
|
style,
|
|
@@ -1909,19 +2507,30 @@ var Slider = (0, import_react19.forwardRef)(
|
|
|
1909
2507
|
defaultValue,
|
|
1910
2508
|
onChange: onValueChange
|
|
1911
2509
|
});
|
|
1912
|
-
const [lift, setLift] = (0,
|
|
1913
|
-
const [isDragging, setIsDragging] = (0,
|
|
2510
|
+
const [lift, setLift] = (0, import_react20.useState)(0);
|
|
2511
|
+
const [isDragging, setIsDragging] = (0, import_react20.useState)(false);
|
|
1914
2512
|
const reducedMotion = useReducedMotion();
|
|
1915
|
-
const
|
|
2513
|
+
const thumbRef = (0, import_react20.useRef)(null);
|
|
1916
2514
|
const currentValue = value ?? defaultValue;
|
|
1917
2515
|
const progress = mapRange(currentValue, min, max, 0, 1);
|
|
1918
|
-
const
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
2516
|
+
const thumbScale = 0.6 + lift * 0.4;
|
|
2517
|
+
const { filterUrl, rimGradient, isReady } = useGlisseEffect(thumbRef, {
|
|
2518
|
+
enabled: !reducedMotion,
|
|
2519
|
+
depth: 2,
|
|
2520
|
+
dome: 6,
|
|
2521
|
+
splay: 0.4,
|
|
2522
|
+
shine: 0.3
|
|
2523
|
+
});
|
|
2524
|
+
const handlePointerDown = (0, import_react20.useCallback)(
|
|
2525
|
+
(e) => {
|
|
2526
|
+
if (disabled) return;
|
|
2527
|
+
setIsDragging(true);
|
|
2528
|
+
if (!reducedMotion) setLift(1);
|
|
2529
|
+
e.target.setPointerCapture(e.pointerId);
|
|
2530
|
+
},
|
|
2531
|
+
[disabled, reducedMotion]
|
|
2532
|
+
);
|
|
2533
|
+
const handlePointerUp = (0, import_react20.useCallback)(() => {
|
|
1925
2534
|
setIsDragging(false);
|
|
1926
2535
|
setLift(0);
|
|
1927
2536
|
}, []);
|
|
@@ -1929,75 +2538,64 @@ var Slider = (0, import_react19.forwardRef)(
|
|
|
1929
2538
|
setValue(parseFloat(e.target.value));
|
|
1930
2539
|
};
|
|
1931
2540
|
const thumbStyles = {
|
|
1932
|
-
"
|
|
1933
|
-
|
|
1934
|
-
left: `calc(${progress
|
|
1935
|
-
width:
|
|
1936
|
-
height:
|
|
1937
|
-
transform: `scale(${
|
|
1938
|
-
|
|
2541
|
+
position: "absolute",
|
|
2542
|
+
top: 0,
|
|
2543
|
+
left: `calc((100% - 36px) * ${progress} - 12px)`,
|
|
2544
|
+
width: 60,
|
|
2545
|
+
height: 40,
|
|
2546
|
+
transform: `scale(${thumbScale})`,
|
|
2547
|
+
transformOrigin: "center center",
|
|
2548
|
+
transition: reducedMotion || isDragging ? "none" : "transform 150ms cubic-bezier(.25,.1,.25,1), left 50ms linear",
|
|
2549
|
+
borderRadius: 9999,
|
|
2550
|
+
backdropFilter: `blur(${2 * (1 - lift) + 0.5 * lift}px) brightness(${1 + 0.15 * (1 - lift)}) saturate(1.5)`,
|
|
2551
|
+
WebkitBackdropFilter: `blur(${2 * (1 - lift) + 0.5 * lift}px) brightness(${1 + 0.15 * (1 - lift)}) saturate(1.5)`,
|
|
2552
|
+
boxShadow: THUMB_SHADOW2,
|
|
2553
|
+
pointerEvents: "none",
|
|
2554
|
+
...isReady && filterUrl ? { filter: filterUrl, backgroundImage: rimGradient } : {}
|
|
1939
2555
|
};
|
|
1940
2556
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1941
2557
|
"div",
|
|
1942
2558
|
{
|
|
1943
|
-
|
|
1944
|
-
className: cn(
|
|
1945
|
-
"relative w-full h-10",
|
|
1946
|
-
disabled && "opacity-35",
|
|
1947
|
-
className
|
|
1948
|
-
),
|
|
2559
|
+
className: cn("relative w-full h-10", disabled && "opacity-35", className),
|
|
1949
2560
|
style,
|
|
1950
2561
|
children: [
|
|
1951
2562
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1952
2563
|
"div",
|
|
1953
2564
|
{
|
|
1954
|
-
className: "absolute rounded-
|
|
2565
|
+
className: "absolute rounded-[3px] pointer-events-none",
|
|
1955
2566
|
style: {
|
|
1956
2567
|
top: 17,
|
|
1957
2568
|
left: 0,
|
|
1958
2569
|
right: 0,
|
|
1959
2570
|
height: 6,
|
|
1960
2571
|
backgroundColor: "var(--lg-rail)"
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
),
|
|
1964
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1965
|
-
"div",
|
|
1966
|
-
{
|
|
1967
|
-
className: "absolute rounded-full",
|
|
1968
|
-
style: {
|
|
1969
|
-
top: 17,
|
|
1970
|
-
left: 0,
|
|
1971
|
-
width: `calc(${progress * 100}%)`,
|
|
1972
|
-
height: 6,
|
|
1973
|
-
backgroundColor: "var(--lg-fill)",
|
|
1974
|
-
transition: isDragging ? "none" : "width 50ms linear"
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
),
|
|
1978
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1979
|
-
"div",
|
|
1980
|
-
{
|
|
1981
|
-
className: "absolute rounded-full pointer-events-none",
|
|
1982
|
-
style: {
|
|
1983
|
-
...thumbStyles,
|
|
1984
|
-
top: 2,
|
|
1985
|
-
backdropFilter: `blur(${2 * (1 - lift) + 0.5 * lift}px) brightness(${1 + 0.15 * (1 - lift)}) saturate(1.5)`,
|
|
1986
|
-
boxShadow: `
|
|
1987
|
-
0 6px 24px rgb(0 0 0 / 0.2),
|
|
1988
|
-
inset 0 0 0 1.5px rgb(255 255 255 / 0.5),
|
|
1989
|
-
inset 0 2px 1px rgb(255 255 255 / 0.45)
|
|
1990
|
-
`
|
|
1991
2572
|
},
|
|
1992
2573
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1993
2574
|
"span",
|
|
1994
2575
|
{
|
|
1995
|
-
className: "
|
|
1996
|
-
style: {
|
|
2576
|
+
className: "block h-full rounded-[inherit]",
|
|
2577
|
+
style: {
|
|
2578
|
+
width: `calc((100% - 36px) * ${progress} + 18px)`,
|
|
2579
|
+
backgroundColor: "var(--lg-fill)",
|
|
2580
|
+
transition: isDragging ? "none" : "width 50ms linear"
|
|
2581
|
+
}
|
|
1997
2582
|
}
|
|
1998
2583
|
)
|
|
1999
2584
|
}
|
|
2000
2585
|
),
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: thumbRef, "aria-hidden": true, style: thumbStyles, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2587
|
+
"span",
|
|
2588
|
+
{
|
|
2589
|
+
"aria-hidden": true,
|
|
2590
|
+
style: {
|
|
2591
|
+
position: "absolute",
|
|
2592
|
+
inset: 0,
|
|
2593
|
+
borderRadius: "inherit",
|
|
2594
|
+
backgroundColor: "#fff",
|
|
2595
|
+
opacity: 1 - lift * 0.85
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
) }),
|
|
2001
2599
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2002
2600
|
"input",
|
|
2003
2601
|
{
|
|
@@ -2024,7 +2622,7 @@ var Slider = (0, import_react19.forwardRef)(
|
|
|
2024
2622
|
showValue && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2025
2623
|
"div",
|
|
2026
2624
|
{
|
|
2027
|
-
className: "absolute text-xs font-medium text-center",
|
|
2625
|
+
className: "absolute text-xs font-medium text-center pointer-events-none",
|
|
2028
2626
|
style: {
|
|
2029
2627
|
left: `${progress * 100}%`,
|
|
2030
2628
|
top: -20,
|
|
@@ -2042,9 +2640,9 @@ var Slider = (0, import_react19.forwardRef)(
|
|
|
2042
2640
|
Slider.displayName = "Slider";
|
|
2043
2641
|
|
|
2044
2642
|
// src/components/TabBar.tsx
|
|
2045
|
-
var
|
|
2643
|
+
var import_react21 = require("react");
|
|
2046
2644
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2047
|
-
var TabBar = (0,
|
|
2645
|
+
var TabBar = (0, import_react21.forwardRef)(
|
|
2048
2646
|
({
|
|
2049
2647
|
className,
|
|
2050
2648
|
style,
|
|
@@ -2062,13 +2660,31 @@ var TabBar = (0, import_react20.forwardRef)(
|
|
|
2062
2660
|
defaultValue: defaultValue ?? items[0]?.value ?? null,
|
|
2063
2661
|
onChange: onValueChange
|
|
2064
2662
|
});
|
|
2065
|
-
const [lift, setLift] = (0,
|
|
2663
|
+
const [lift, setLift] = (0, import_react21.useState)(0);
|
|
2066
2664
|
const reducedMotion = useReducedMotion();
|
|
2665
|
+
const containerRef = (0, import_react21.useRef)(null);
|
|
2666
|
+
const lensRef = (0, import_react21.useRef)(null);
|
|
2067
2667
|
const selectedIndex = items.findIndex((item) => item.value === value);
|
|
2068
2668
|
const hasIcons = items.some((item) => item.icon);
|
|
2069
2669
|
const tabWidth = hasIcons ? 72 : 84;
|
|
2070
2670
|
const tabHeight = hasIcons ? 52 : 32;
|
|
2071
2671
|
const inset = 4;
|
|
2672
|
+
const lensGrowX = hasIcons ? 24 : 27;
|
|
2673
|
+
const lensGrowY = hasIcons ? 16 : 20;
|
|
2674
|
+
const { filterUrl: containerFilter, rimGradient: containerRim, isReady: containerReady } = useGlisseEffect(containerRef, {
|
|
2675
|
+
enabled: !reducedMotion,
|
|
2676
|
+
depth: 6,
|
|
2677
|
+
dome: 3
|
|
2678
|
+
});
|
|
2679
|
+
const { filterUrl: lensFilter, rimGradient: lensRim, isReady: lensReady } = useGlisseEffect(
|
|
2680
|
+
lensRef,
|
|
2681
|
+
{
|
|
2682
|
+
enabled: !reducedMotion && lift > 0.01,
|
|
2683
|
+
depth: 4,
|
|
2684
|
+
dome: 3,
|
|
2685
|
+
splay: 0.5
|
|
2686
|
+
}
|
|
2687
|
+
);
|
|
2072
2688
|
const handleSelect = (itemValue) => {
|
|
2073
2689
|
setValue(itemValue);
|
|
2074
2690
|
};
|
|
@@ -2078,45 +2694,47 @@ var TabBar = (0, import_react20.forwardRef)(
|
|
|
2078
2694
|
const handlePointerUp = () => {
|
|
2079
2695
|
setLift(0);
|
|
2080
2696
|
};
|
|
2697
|
+
const setRefs = (node) => {
|
|
2698
|
+
containerRef.current = node;
|
|
2699
|
+
if (typeof ref === "function") ref(node);
|
|
2700
|
+
else if (ref) ref.current = node;
|
|
2701
|
+
};
|
|
2081
2702
|
const containerStyles = {
|
|
2082
2703
|
padding: inset,
|
|
2083
2704
|
borderRadius: tabHeight / 2 + inset,
|
|
2705
|
+
...containerReady && containerFilter ? { filter: containerFilter, backgroundImage: containerRim } : {},
|
|
2084
2706
|
...style
|
|
2085
2707
|
};
|
|
2086
2708
|
const lensStyles = {
|
|
2087
|
-
"--lg-lift": lift,
|
|
2088
2709
|
position: "absolute",
|
|
2089
|
-
top: inset,
|
|
2090
|
-
left: inset,
|
|
2091
|
-
width: tabWidth + lift *
|
|
2092
|
-
height: tabHeight + lift *
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2710
|
+
top: inset - lift * lensGrowY / 2,
|
|
2711
|
+
left: inset - lift * lensGrowX / 2,
|
|
2712
|
+
width: tabWidth + lift * lensGrowX,
|
|
2713
|
+
height: tabHeight + lift * lensGrowY,
|
|
2714
|
+
borderRadius: (tabHeight + lift * lensGrowY) / 2,
|
|
2715
|
+
transform: `translateX(${Math.max(0, selectedIndex) * tabWidth}px)`,
|
|
2716
|
+
transition: reducedMotion ? "none" : "transform 200ms cubic-bezier(.25,.1,.25,1), width 150ms cubic-bezier(.25,.1,.25,1), height 150ms cubic-bezier(.25,.1,.25,1), top 150ms, left 150ms, background-color 140ms",
|
|
2717
|
+
backgroundColor: lift > 0.5 ? "var(--lg-lens)" : "var(--lg-selection)",
|
|
2718
|
+
boxShadow: lift > 0.5 ? `0 ${7 / (1 + lift * 0.5)}px ${11 / (1 + lift * 0.5)}px var(--lg-lens-drop)` : "none",
|
|
2719
|
+
pointerEvents: "none",
|
|
2720
|
+
zIndex: lift > 0.5 ? 2 : 0,
|
|
2721
|
+
...lensReady && lensFilter ? { filter: lensFilter, backgroundImage: lensRim } : {}
|
|
2100
2722
|
};
|
|
2101
2723
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2102
2724
|
"nav",
|
|
2103
2725
|
{
|
|
2104
|
-
ref,
|
|
2726
|
+
ref: setRefs,
|
|
2105
2727
|
role: "tablist",
|
|
2106
2728
|
"aria-label": ariaLabel,
|
|
2107
|
-
className: cn(
|
|
2108
|
-
"lg-glass lg-interactive",
|
|
2109
|
-
"relative inline-flex",
|
|
2110
|
-
className
|
|
2111
|
-
),
|
|
2729
|
+
className: cn("lg-glass lg-interactive", "relative inline-flex", className),
|
|
2112
2730
|
style: containerStyles,
|
|
2113
2731
|
onPointerDown: handlePointerDown,
|
|
2114
2732
|
onPointerUp: handlePointerUp,
|
|
2115
2733
|
onPointerCancel: handlePointerUp,
|
|
2116
2734
|
...props,
|
|
2117
2735
|
children: [
|
|
2118
|
-
selectedIndex >= 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", {
|
|
2119
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "relative flex z-
|
|
2736
|
+
selectedIndex >= 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: lensRef, "aria-hidden": true, style: lensStyles }),
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "relative flex z-[1]", children: items.map((item) => {
|
|
2120
2738
|
const isSelected = item.value === value;
|
|
2121
2739
|
const TabElement = item.href && LinkComponent ? LinkComponent : "button";
|
|
2122
2740
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
@@ -2125,6 +2743,7 @@ var TabBar = (0, import_react20.forwardRef)(
|
|
|
2125
2743
|
role: "tab",
|
|
2126
2744
|
"aria-selected": isSelected,
|
|
2127
2745
|
href: item.href,
|
|
2746
|
+
type: TabElement === "button" ? "button" : void 0,
|
|
2128
2747
|
onClick: () => handleSelect(item.value),
|
|
2129
2748
|
className: cn(
|
|
2130
2749
|
"flex flex-col items-center justify-center",
|
|
@@ -2153,14 +2772,14 @@ var TabBar = (0, import_react20.forwardRef)(
|
|
|
2153
2772
|
TabBar.displayName = "TabBar";
|
|
2154
2773
|
|
|
2155
2774
|
// src/components/SegmentedControl.tsx
|
|
2156
|
-
var
|
|
2775
|
+
var import_react22 = require("react");
|
|
2157
2776
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2158
|
-
var
|
|
2777
|
+
var sizeConfig6 = {
|
|
2159
2778
|
sm: { height: 28, padding: 2, fontSize: 12, segmentWidth: 72 },
|
|
2160
2779
|
md: { height: 32, padding: 2, fontSize: 13, segmentWidth: 84 },
|
|
2161
2780
|
lg: { height: 40, padding: 3, fontSize: 14, segmentWidth: 100 }
|
|
2162
2781
|
};
|
|
2163
|
-
var SegmentedControl = (0,
|
|
2782
|
+
var SegmentedControl = (0, import_react22.forwardRef)(
|
|
2164
2783
|
({
|
|
2165
2784
|
className,
|
|
2166
2785
|
style,
|
|
@@ -2177,9 +2796,9 @@ var SegmentedControl = (0, import_react21.forwardRef)(
|
|
|
2177
2796
|
defaultValue: defaultValue ?? items[0]?.value ?? null,
|
|
2178
2797
|
onChange: onValueChange
|
|
2179
2798
|
});
|
|
2180
|
-
const [lift, setLift] = (0,
|
|
2799
|
+
const [lift, setLift] = (0, import_react22.useState)(0);
|
|
2181
2800
|
const reducedMotion = useReducedMotion();
|
|
2182
|
-
const config =
|
|
2801
|
+
const config = sizeConfig6[size];
|
|
2183
2802
|
const selectedIndex = items.findIndex((item) => item.value === value);
|
|
2184
2803
|
const handleSelect = (itemValue, disabled) => {
|
|
2185
2804
|
if (disabled) return;
|
|
@@ -2268,10 +2887,10 @@ var SegmentedControl = (0, import_react21.forwardRef)(
|
|
|
2268
2887
|
SegmentedControl.displayName = "SegmentedControl";
|
|
2269
2888
|
|
|
2270
2889
|
// src/components/Tabs.tsx
|
|
2271
|
-
var
|
|
2890
|
+
var import_react23 = require("react");
|
|
2272
2891
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2273
|
-
var TabsContext = (0,
|
|
2274
|
-
var Tabs = (0,
|
|
2892
|
+
var TabsContext = (0, import_react23.createContext)(null);
|
|
2893
|
+
var Tabs = (0, import_react23.forwardRef)(
|
|
2275
2894
|
({
|
|
2276
2895
|
className,
|
|
2277
2896
|
value: controlledValue,
|
|
@@ -2302,7 +2921,7 @@ var Tabs = (0, import_react22.forwardRef)(
|
|
|
2302
2921
|
}
|
|
2303
2922
|
);
|
|
2304
2923
|
Tabs.displayName = "Tabs";
|
|
2305
|
-
var TabsList = (0,
|
|
2924
|
+
var TabsList = (0, import_react23.forwardRef)(
|
|
2306
2925
|
({ className, children, ...props }, ref) => {
|
|
2307
2926
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2308
2927
|
"div",
|
|
@@ -2320,9 +2939,9 @@ var TabsList = (0, import_react22.forwardRef)(
|
|
|
2320
2939
|
}
|
|
2321
2940
|
);
|
|
2322
2941
|
TabsList.displayName = "TabsList";
|
|
2323
|
-
var TabsTrigger = (0,
|
|
2942
|
+
var TabsTrigger = (0, import_react23.forwardRef)(
|
|
2324
2943
|
({ className, value, disabled = false, children, ...props }, ref) => {
|
|
2325
|
-
const context = (0,
|
|
2944
|
+
const context = (0, import_react23.useContext)(TabsContext);
|
|
2326
2945
|
if (!context) throw new Error("TabsTrigger must be used within Tabs");
|
|
2327
2946
|
const { value: selectedValue, onChange, baseId } = context;
|
|
2328
2947
|
const isSelected = selectedValue === value;
|
|
@@ -2356,9 +2975,9 @@ var TabsTrigger = (0, import_react22.forwardRef)(
|
|
|
2356
2975
|
}
|
|
2357
2976
|
);
|
|
2358
2977
|
TabsTrigger.displayName = "TabsTrigger";
|
|
2359
|
-
var TabsContent = (0,
|
|
2978
|
+
var TabsContent = (0, import_react23.forwardRef)(
|
|
2360
2979
|
({ className, value, children, ...props }, ref) => {
|
|
2361
|
-
const context = (0,
|
|
2980
|
+
const context = (0, import_react23.useContext)(TabsContext);
|
|
2362
2981
|
if (!context) throw new Error("TabsContent must be used within Tabs");
|
|
2363
2982
|
const { value: selectedValue, baseId } = context;
|
|
2364
2983
|
const isSelected = selectedValue === value;
|
|
@@ -2386,9 +3005,9 @@ var TabsContent = (0, import_react22.forwardRef)(
|
|
|
2386
3005
|
TabsContent.displayName = "TabsContent";
|
|
2387
3006
|
|
|
2388
3007
|
// src/components/Navbar.tsx
|
|
2389
|
-
var
|
|
3008
|
+
var import_react24 = require("react");
|
|
2390
3009
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2391
|
-
var Navbar = (0,
|
|
3010
|
+
var Navbar = (0, import_react24.forwardRef)(
|
|
2392
3011
|
({
|
|
2393
3012
|
className,
|
|
2394
3013
|
style,
|
|
@@ -2423,7 +3042,7 @@ var Navbar = (0, import_react23.forwardRef)(
|
|
|
2423
3042
|
}
|
|
2424
3043
|
);
|
|
2425
3044
|
Navbar.displayName = "Navbar";
|
|
2426
|
-
var NavbarLink = (0,
|
|
3045
|
+
var NavbarLink = (0, import_react24.forwardRef)(
|
|
2427
3046
|
({ className, href, active = false, children, ...props }, ref) => {
|
|
2428
3047
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2429
3048
|
"a",
|
|
@@ -2446,24 +3065,24 @@ var NavbarLink = (0, import_react23.forwardRef)(
|
|
|
2446
3065
|
NavbarLink.displayName = "NavbarLink";
|
|
2447
3066
|
|
|
2448
3067
|
// src/components/Sidebar.tsx
|
|
2449
|
-
var
|
|
3068
|
+
var import_react25 = require("react");
|
|
2450
3069
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2451
|
-
var SidebarContext = (0,
|
|
3070
|
+
var SidebarContext = (0, import_react25.createContext)(null);
|
|
2452
3071
|
function useSidebar() {
|
|
2453
|
-
const context = (0,
|
|
3072
|
+
const context = (0, import_react25.useContext)(SidebarContext);
|
|
2454
3073
|
if (!context) {
|
|
2455
3074
|
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
2456
3075
|
}
|
|
2457
3076
|
return context;
|
|
2458
3077
|
}
|
|
2459
3078
|
function SidebarProvider({ children, defaultCollapsed = false }) {
|
|
2460
|
-
const [isCollapsed, setCollapsed] = (0,
|
|
2461
|
-
const toggleCollapsed = (0,
|
|
3079
|
+
const [isCollapsed, setCollapsed] = (0, import_react25.useState)(defaultCollapsed);
|
|
3080
|
+
const toggleCollapsed = (0, import_react25.useCallback)(() => {
|
|
2462
3081
|
setCollapsed((prev) => !prev);
|
|
2463
3082
|
}, []);
|
|
2464
3083
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SidebarContext.Provider, { value: { isCollapsed, toggleCollapsed, setCollapsed }, children });
|
|
2465
3084
|
}
|
|
2466
|
-
var Sidebar = (0,
|
|
3085
|
+
var Sidebar = (0, import_react25.forwardRef)(
|
|
2467
3086
|
({
|
|
2468
3087
|
className,
|
|
2469
3088
|
style,
|
|
@@ -2496,7 +3115,7 @@ var Sidebar = (0, import_react24.forwardRef)(
|
|
|
2496
3115
|
}
|
|
2497
3116
|
);
|
|
2498
3117
|
Sidebar.displayName = "Sidebar";
|
|
2499
|
-
var SidebarHeader = (0,
|
|
3118
|
+
var SidebarHeader = (0, import_react25.forwardRef)(
|
|
2500
3119
|
({ className, children, ...props }, ref) => {
|
|
2501
3120
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2502
3121
|
"div",
|
|
@@ -2514,7 +3133,7 @@ var SidebarHeader = (0, import_react24.forwardRef)(
|
|
|
2514
3133
|
}
|
|
2515
3134
|
);
|
|
2516
3135
|
SidebarHeader.displayName = "SidebarHeader";
|
|
2517
|
-
var SidebarContent = (0,
|
|
3136
|
+
var SidebarContent = (0, import_react25.forwardRef)(
|
|
2518
3137
|
({ className, children, ...props }, ref) => {
|
|
2519
3138
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2520
3139
|
"div",
|
|
@@ -2528,7 +3147,7 @@ var SidebarContent = (0, import_react24.forwardRef)(
|
|
|
2528
3147
|
}
|
|
2529
3148
|
);
|
|
2530
3149
|
SidebarContent.displayName = "SidebarContent";
|
|
2531
|
-
var SidebarItem = (0,
|
|
3150
|
+
var SidebarItem = (0, import_react25.forwardRef)(
|
|
2532
3151
|
({ className, icon, label, active = false, href, onClick, ...props }, ref) => {
|
|
2533
3152
|
const { isCollapsed } = useSidebar();
|
|
2534
3153
|
const sharedProps = {
|
|
@@ -2553,7 +3172,7 @@ var SidebarItem = (0, import_react24.forwardRef)(
|
|
|
2553
3172
|
}
|
|
2554
3173
|
);
|
|
2555
3174
|
SidebarItem.displayName = "SidebarItem";
|
|
2556
|
-
var SidebarGroup = (0,
|
|
3175
|
+
var SidebarGroup = (0, import_react25.forwardRef)(
|
|
2557
3176
|
({ className, title, children, ...props }, ref) => {
|
|
2558
3177
|
const { isCollapsed } = useSidebar();
|
|
2559
3178
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref, className: cn("mb-4", className), ...props, children: [
|
|
@@ -2565,20 +3184,20 @@ var SidebarGroup = (0, import_react24.forwardRef)(
|
|
|
2565
3184
|
SidebarGroup.displayName = "SidebarGroup";
|
|
2566
3185
|
|
|
2567
3186
|
// src/components/Dock.tsx
|
|
2568
|
-
var
|
|
3187
|
+
var import_react26 = require("react");
|
|
2569
3188
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2570
|
-
var Dock = (0,
|
|
3189
|
+
var Dock = (0, import_react26.forwardRef)(
|
|
2571
3190
|
({
|
|
2572
3191
|
className,
|
|
2573
3192
|
style,
|
|
2574
3193
|
items,
|
|
2575
3194
|
magnification = 1.5,
|
|
2576
|
-
distance = 100,
|
|
3195
|
+
distance: distance2 = 100,
|
|
2577
3196
|
direction = "bottom",
|
|
2578
3197
|
...props
|
|
2579
3198
|
}, ref) => {
|
|
2580
|
-
const [mouseX, setMouseX] = (0,
|
|
2581
|
-
const containerRef = (0,
|
|
3199
|
+
const [mouseX, setMouseX] = (0, import_react26.useState)(null);
|
|
3200
|
+
const containerRef = (0, import_react26.useRef)(null);
|
|
2582
3201
|
const reducedMotion = useReducedMotion();
|
|
2583
3202
|
const handleMouseMove = (e) => {
|
|
2584
3203
|
if (reducedMotion) return;
|
|
@@ -2598,8 +3217,8 @@ var Dock = (0, import_react25.forwardRef)(
|
|
|
2598
3217
|
const startX = (containerRef.current?.offsetWidth || 0) / 2 - totalWidth / 2;
|
|
2599
3218
|
const iconCenter = startX + index * (iconSize + gap) + iconSize / 2;
|
|
2600
3219
|
const distanceFromMouse = Math.abs(mouseX - iconCenter);
|
|
2601
|
-
if (distanceFromMouse >
|
|
2602
|
-
const scale = 1 + (magnification - 1) * (1 - distanceFromMouse /
|
|
3220
|
+
if (distanceFromMouse > distance2) return 1;
|
|
3221
|
+
const scale = 1 + (magnification - 1) * (1 - distanceFromMouse / distance2);
|
|
2603
3222
|
return scale;
|
|
2604
3223
|
};
|
|
2605
3224
|
const isHorizontal = direction === "bottom";
|
|
@@ -2674,17 +3293,17 @@ var Dock = (0, import_react25.forwardRef)(
|
|
|
2674
3293
|
Dock.displayName = "Dock";
|
|
2675
3294
|
|
|
2676
3295
|
// src/components/Modal.tsx
|
|
2677
|
-
var
|
|
3296
|
+
var import_react27 = require("react");
|
|
2678
3297
|
var import_react_dom2 = require("react-dom");
|
|
2679
3298
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2680
|
-
var
|
|
3299
|
+
var sizeConfig7 = {
|
|
2681
3300
|
sm: { maxWidth: 400 },
|
|
2682
3301
|
md: { maxWidth: 500 },
|
|
2683
3302
|
lg: { maxWidth: 640 },
|
|
2684
3303
|
xl: { maxWidth: 800 },
|
|
2685
3304
|
full: { maxWidth: "90vw" }
|
|
2686
3305
|
};
|
|
2687
|
-
var Modal = (0,
|
|
3306
|
+
var Modal = (0, import_react27.forwardRef)(
|
|
2688
3307
|
({
|
|
2689
3308
|
className,
|
|
2690
3309
|
style,
|
|
@@ -2697,12 +3316,17 @@ var Modal = (0, import_react26.forwardRef)(
|
|
|
2697
3316
|
closeOnOverlayClick = true,
|
|
2698
3317
|
closeOnEscape = true,
|
|
2699
3318
|
showCloseButton = true,
|
|
3319
|
+
disableRefraction = false,
|
|
2700
3320
|
...props
|
|
2701
3321
|
}, ref) => {
|
|
2702
3322
|
const reducedMotion = useReducedMotion();
|
|
2703
|
-
const
|
|
2704
|
-
const
|
|
2705
|
-
const
|
|
3323
|
+
const localRef = (0, import_react27.useRef)(null);
|
|
3324
|
+
const combinedRef = ref || localRef;
|
|
3325
|
+
const config = sizeConfig7[size];
|
|
3326
|
+
const { filterUrl, rimGradient, isReady } = useGlisseEffect(combinedRef, {
|
|
3327
|
+
enabled: open && !disableRefraction && !reducedMotion
|
|
3328
|
+
});
|
|
3329
|
+
const handleClose = (0, import_react27.useCallback)(() => {
|
|
2706
3330
|
onOpenChange(false);
|
|
2707
3331
|
}, [onOpenChange]);
|
|
2708
3332
|
const handleOverlayClick = (e) => {
|
|
@@ -2710,23 +3334,32 @@ var Modal = (0, import_react26.forwardRef)(
|
|
|
2710
3334
|
handleClose();
|
|
2711
3335
|
}
|
|
2712
3336
|
};
|
|
2713
|
-
const handleKeyDown = (0,
|
|
3337
|
+
const handleKeyDown = (0, import_react27.useCallback)((e) => {
|
|
2714
3338
|
if (closeOnEscape && e.key === "Escape") {
|
|
2715
3339
|
handleClose();
|
|
2716
3340
|
}
|
|
2717
3341
|
}, [closeOnEscape, handleClose]);
|
|
2718
|
-
(0,
|
|
3342
|
+
(0, import_react27.useEffect)(() => {
|
|
2719
3343
|
if (open) {
|
|
2720
3344
|
document.addEventListener("keydown", handleKeyDown);
|
|
2721
3345
|
document.body.style.overflow = "hidden";
|
|
2722
|
-
|
|
3346
|
+
combinedRef.current?.focus();
|
|
2723
3347
|
}
|
|
2724
3348
|
return () => {
|
|
2725
3349
|
document.removeEventListener("keydown", handleKeyDown);
|
|
2726
3350
|
document.body.style.overflow = "";
|
|
2727
3351
|
};
|
|
2728
|
-
}, [open, handleKeyDown]);
|
|
3352
|
+
}, [open, handleKeyDown, combinedRef]);
|
|
2729
3353
|
if (!open) return null;
|
|
3354
|
+
const modalStyles = {
|
|
3355
|
+
maxWidth: config.maxWidth,
|
|
3356
|
+
borderRadius: 24,
|
|
3357
|
+
...style
|
|
3358
|
+
};
|
|
3359
|
+
if (isReady && filterUrl) {
|
|
3360
|
+
modalStyles.filter = filterUrl;
|
|
3361
|
+
modalStyles.backgroundImage = rimGradient;
|
|
3362
|
+
}
|
|
2730
3363
|
const modalContent = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2731
3364
|
"div",
|
|
2732
3365
|
{
|
|
@@ -2743,7 +3376,7 @@ var Modal = (0, import_react26.forwardRef)(
|
|
|
2743
3376
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2744
3377
|
"div",
|
|
2745
3378
|
{
|
|
2746
|
-
ref:
|
|
3379
|
+
ref: combinedRef,
|
|
2747
3380
|
tabIndex: -1,
|
|
2748
3381
|
className: cn(
|
|
2749
3382
|
"lg-glass lg-glass-elevated lg-text",
|
|
@@ -2751,11 +3384,7 @@ var Modal = (0, import_react26.forwardRef)(
|
|
|
2751
3384
|
!reducedMotion && "animate-[lg-scale-in_200ms_var(--lg-ease-spring)]",
|
|
2752
3385
|
className
|
|
2753
3386
|
),
|
|
2754
|
-
style:
|
|
2755
|
-
maxWidth: config.maxWidth,
|
|
2756
|
-
borderRadius: 24,
|
|
2757
|
-
...style
|
|
2758
|
-
},
|
|
3387
|
+
style: modalStyles,
|
|
2759
3388
|
...props,
|
|
2760
3389
|
children: [
|
|
2761
3390
|
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -2804,7 +3433,7 @@ var Modal = (0, import_react26.forwardRef)(
|
|
|
2804
3433
|
}
|
|
2805
3434
|
);
|
|
2806
3435
|
Modal.displayName = "Modal";
|
|
2807
|
-
var ModalFooter = (0,
|
|
3436
|
+
var ModalFooter = (0, import_react27.forwardRef)(
|
|
2808
3437
|
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2809
3438
|
"div",
|
|
2810
3439
|
{
|
|
@@ -2822,16 +3451,16 @@ var ModalFooter = (0, import_react26.forwardRef)(
|
|
|
2822
3451
|
ModalFooter.displayName = "ModalFooter";
|
|
2823
3452
|
|
|
2824
3453
|
// src/components/Sheet.tsx
|
|
2825
|
-
var
|
|
3454
|
+
var import_react28 = require("react");
|
|
2826
3455
|
var import_react_dom3 = require("react-dom");
|
|
2827
3456
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2828
|
-
var
|
|
3457
|
+
var sizeConfig8 = {
|
|
2829
3458
|
sm: { width: 320, height: 300 },
|
|
2830
3459
|
md: { width: 400, height: 400 },
|
|
2831
3460
|
lg: { width: 500, height: 500 },
|
|
2832
3461
|
full: { width: "100%", height: "85vh" }
|
|
2833
3462
|
};
|
|
2834
|
-
var Sheet = (0,
|
|
3463
|
+
var Sheet = (0, import_react28.forwardRef)(
|
|
2835
3464
|
({
|
|
2836
3465
|
className,
|
|
2837
3466
|
style,
|
|
@@ -2841,12 +3470,17 @@ var Sheet = (0, import_react27.forwardRef)(
|
|
|
2841
3470
|
side = "bottom",
|
|
2842
3471
|
size = "md",
|
|
2843
3472
|
showHandle = true,
|
|
3473
|
+
disableRefraction = false,
|
|
2844
3474
|
...props
|
|
2845
3475
|
}, ref) => {
|
|
2846
3476
|
const reducedMotion = useReducedMotion();
|
|
2847
|
-
const
|
|
2848
|
-
const
|
|
2849
|
-
const
|
|
3477
|
+
const localRef = (0, import_react28.useRef)(null);
|
|
3478
|
+
const combinedRef = ref || localRef;
|
|
3479
|
+
const config = sizeConfig8[size];
|
|
3480
|
+
const { filterUrl, rimGradient, isReady } = useGlisseEffect(combinedRef, {
|
|
3481
|
+
enabled: open && !disableRefraction && !reducedMotion
|
|
3482
|
+
});
|
|
3483
|
+
const handleClose = (0, import_react28.useCallback)(() => {
|
|
2850
3484
|
onOpenChange(false);
|
|
2851
3485
|
}, [onOpenChange]);
|
|
2852
3486
|
const handleOverlayClick = (e) => {
|
|
@@ -2854,12 +3488,12 @@ var Sheet = (0, import_react27.forwardRef)(
|
|
|
2854
3488
|
handleClose();
|
|
2855
3489
|
}
|
|
2856
3490
|
};
|
|
2857
|
-
const handleKeyDown = (0,
|
|
3491
|
+
const handleKeyDown = (0, import_react28.useCallback)((e) => {
|
|
2858
3492
|
if (e.key === "Escape") {
|
|
2859
3493
|
handleClose();
|
|
2860
3494
|
}
|
|
2861
3495
|
}, [handleClose]);
|
|
2862
|
-
(0,
|
|
3496
|
+
(0, import_react28.useEffect)(() => {
|
|
2863
3497
|
if (open) {
|
|
2864
3498
|
document.addEventListener("keydown", handleKeyDown);
|
|
2865
3499
|
document.body.style.overflow = "hidden";
|
|
@@ -2870,7 +3504,6 @@ var Sheet = (0, import_react27.forwardRef)(
|
|
|
2870
3504
|
};
|
|
2871
3505
|
}, [open, handleKeyDown]);
|
|
2872
3506
|
if (!open) return null;
|
|
2873
|
-
const isHorizontal = side === "left" || side === "right";
|
|
2874
3507
|
const sheetStyles = {
|
|
2875
3508
|
position: "fixed",
|
|
2876
3509
|
zIndex: 50,
|
|
@@ -2912,6 +3545,10 @@ var Sheet = (0, import_react27.forwardRef)(
|
|
|
2912
3545
|
},
|
|
2913
3546
|
...style
|
|
2914
3547
|
};
|
|
3548
|
+
if (isReady && filterUrl) {
|
|
3549
|
+
sheetStyles.filter = filterUrl;
|
|
3550
|
+
sheetStyles.backgroundImage = rimGradient;
|
|
3551
|
+
}
|
|
2915
3552
|
const animationClass = reducedMotion ? "" : {
|
|
2916
3553
|
bottom: "animate-[lg-slide-up_300ms_var(--lg-ease-spring)]",
|
|
2917
3554
|
top: "animate-[lg-slide-down_300ms_var(--lg-ease-spring)]",
|
|
@@ -2932,7 +3569,7 @@ var Sheet = (0, import_react27.forwardRef)(
|
|
|
2932
3569
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2933
3570
|
"div",
|
|
2934
3571
|
{
|
|
2935
|
-
ref:
|
|
3572
|
+
ref: combinedRef,
|
|
2936
3573
|
className: cn(
|
|
2937
3574
|
"lg-glass lg-glass-elevated lg-text",
|
|
2938
3575
|
"overflow-auto",
|
|
@@ -2960,10 +3597,10 @@ var Sheet = (0, import_react27.forwardRef)(
|
|
|
2960
3597
|
Sheet.displayName = "Sheet";
|
|
2961
3598
|
|
|
2962
3599
|
// src/components/Menu.tsx
|
|
2963
|
-
var
|
|
3600
|
+
var import_react29 = require("react");
|
|
2964
3601
|
var import_react_dom4 = require("react-dom");
|
|
2965
3602
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2966
|
-
var Menu = (0,
|
|
3603
|
+
var Menu = (0, import_react29.forwardRef)(
|
|
2967
3604
|
({
|
|
2968
3605
|
className,
|
|
2969
3606
|
items,
|
|
@@ -2972,10 +3609,10 @@ var Menu = (0, import_react28.forwardRef)(
|
|
|
2972
3609
|
"aria-label": ariaLabel,
|
|
2973
3610
|
...props
|
|
2974
3611
|
}, ref) => {
|
|
2975
|
-
const [isOpen, setIsOpen] = (0,
|
|
2976
|
-
const [position, setPosition] = (0,
|
|
2977
|
-
const triggerRef = (0,
|
|
2978
|
-
const menuRef = (0,
|
|
3612
|
+
const [isOpen, setIsOpen] = (0, import_react29.useState)(false);
|
|
3613
|
+
const [position, setPosition] = (0, import_react29.useState)({ top: 0, left: 0 });
|
|
3614
|
+
const triggerRef = (0, import_react29.useRef)(null);
|
|
3615
|
+
const menuRef = (0, import_react29.useRef)(null);
|
|
2979
3616
|
const reducedMotion = useReducedMotion();
|
|
2980
3617
|
const updatePosition = () => {
|
|
2981
3618
|
if (!triggerRef.current || !menuRef.current) return;
|
|
@@ -2991,7 +3628,7 @@ var Menu = (0, import_react28.forwardRef)(
|
|
|
2991
3628
|
left: left + window.scrollX
|
|
2992
3629
|
});
|
|
2993
3630
|
};
|
|
2994
|
-
(0,
|
|
3631
|
+
(0, import_react29.useEffect)(() => {
|
|
2995
3632
|
if (isOpen) {
|
|
2996
3633
|
updatePosition();
|
|
2997
3634
|
const handleClickOutside = (e) => {
|
|
@@ -3094,7 +3731,7 @@ var Menu = (0, import_react28.forwardRef)(
|
|
|
3094
3731
|
Menu.displayName = "Menu";
|
|
3095
3732
|
|
|
3096
3733
|
// src/components/Tooltip.tsx
|
|
3097
|
-
var
|
|
3734
|
+
var import_react30 = require("react");
|
|
3098
3735
|
var import_react_dom5 = require("react-dom");
|
|
3099
3736
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3100
3737
|
function Tooltip({
|
|
@@ -3105,11 +3742,11 @@ function Tooltip({
|
|
|
3105
3742
|
delay = 200,
|
|
3106
3743
|
disabled = false
|
|
3107
3744
|
}) {
|
|
3108
|
-
const [isOpen, setIsOpen] = (0,
|
|
3109
|
-
const [position, setPosition] = (0,
|
|
3110
|
-
const triggerRef = (0,
|
|
3111
|
-
const tooltipRef = (0,
|
|
3112
|
-
const timeoutRef = (0,
|
|
3745
|
+
const [isOpen, setIsOpen] = (0, import_react30.useState)(false);
|
|
3746
|
+
const [position, setPosition] = (0, import_react30.useState)({ top: 0, left: 0 });
|
|
3747
|
+
const triggerRef = (0, import_react30.useRef)(null);
|
|
3748
|
+
const tooltipRef = (0, import_react30.useRef)(null);
|
|
3749
|
+
const timeoutRef = (0, import_react30.useRef)();
|
|
3113
3750
|
const reducedMotion = useReducedMotion();
|
|
3114
3751
|
const updatePosition = () => {
|
|
3115
3752
|
if (!triggerRef.current || !tooltipRef.current) return;
|
|
@@ -3149,7 +3786,7 @@ function Tooltip({
|
|
|
3149
3786
|
}
|
|
3150
3787
|
setPosition({ top: top + window.scrollY, left: left + window.scrollX });
|
|
3151
3788
|
};
|
|
3152
|
-
(0,
|
|
3789
|
+
(0, import_react30.useEffect)(() => {
|
|
3153
3790
|
if (isOpen) {
|
|
3154
3791
|
updatePosition();
|
|
3155
3792
|
window.addEventListener("scroll", updatePosition, true);
|
|
@@ -3168,8 +3805,8 @@ function Tooltip({
|
|
|
3168
3805
|
clearTimeout(timeoutRef.current);
|
|
3169
3806
|
setIsOpen(false);
|
|
3170
3807
|
};
|
|
3171
|
-
const child = (0,
|
|
3172
|
-
const trigger = (0,
|
|
3808
|
+
const child = (0, import_react30.isValidElement)(children) ? children : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children });
|
|
3809
|
+
const trigger = (0, import_react30.cloneElement)(child, {
|
|
3173
3810
|
ref: triggerRef,
|
|
3174
3811
|
onMouseEnter: handleMouseEnter,
|
|
3175
3812
|
onMouseLeave: handleMouseLeave,
|
|
@@ -3204,7 +3841,7 @@ function Tooltip({
|
|
|
3204
3841
|
}
|
|
3205
3842
|
|
|
3206
3843
|
// src/components/Toast.tsx
|
|
3207
|
-
var
|
|
3844
|
+
var import_react31 = require("react");
|
|
3208
3845
|
var import_react_dom6 = require("react-dom");
|
|
3209
3846
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3210
3847
|
var variantIcons = {
|
|
@@ -3229,7 +3866,7 @@ var variantIcons = {
|
|
|
3229
3866
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
3230
3867
|
] })
|
|
3231
3868
|
};
|
|
3232
|
-
var Toast = (0,
|
|
3869
|
+
var Toast = (0, import_react31.forwardRef)(
|
|
3233
3870
|
({
|
|
3234
3871
|
className,
|
|
3235
3872
|
style,
|
|
@@ -3244,8 +3881,8 @@ var Toast = (0, import_react30.forwardRef)(
|
|
|
3244
3881
|
...props
|
|
3245
3882
|
}, ref) => {
|
|
3246
3883
|
const reducedMotion = useReducedMotion();
|
|
3247
|
-
const [isLeaving, setIsLeaving] = (0,
|
|
3248
|
-
(0,
|
|
3884
|
+
const [isLeaving, setIsLeaving] = (0, import_react31.useState)(false);
|
|
3885
|
+
(0, import_react31.useEffect)(() => {
|
|
3249
3886
|
if (duration > 0) {
|
|
3250
3887
|
const timer = setTimeout(() => {
|
|
3251
3888
|
setIsLeaving(true);
|
|
@@ -3304,19 +3941,19 @@ var Toast = (0, import_react30.forwardRef)(
|
|
|
3304
3941
|
}
|
|
3305
3942
|
);
|
|
3306
3943
|
Toast.displayName = "Toast";
|
|
3307
|
-
var ToastContext = (0,
|
|
3944
|
+
var ToastContext = (0, import_react31.createContext)(null);
|
|
3308
3945
|
var toastId = 0;
|
|
3309
3946
|
function ToastProvider({ children }) {
|
|
3310
|
-
const [toasts, setToasts] = (0,
|
|
3311
|
-
const toast = (0,
|
|
3947
|
+
const [toasts, setToasts] = (0, import_react31.useState)([]);
|
|
3948
|
+
const toast = (0, import_react31.useCallback)((props) => {
|
|
3312
3949
|
const id = `toast-${++toastId}`;
|
|
3313
3950
|
setToasts((prev) => [...prev, { ...props, id }]);
|
|
3314
3951
|
return id;
|
|
3315
3952
|
}, []);
|
|
3316
|
-
const dismiss = (0,
|
|
3953
|
+
const dismiss = (0, import_react31.useCallback)((id) => {
|
|
3317
3954
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
3318
3955
|
}, []);
|
|
3319
|
-
const dismissAll = (0,
|
|
3956
|
+
const dismissAll = (0, import_react31.useCallback)(() => {
|
|
3320
3957
|
setToasts([]);
|
|
3321
3958
|
}, []);
|
|
3322
3959
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(ToastContext.Provider, { value: { toasts, toast, dismiss, dismissAll }, children: [
|
|
@@ -3328,7 +3965,7 @@ function ToastProvider({ children }) {
|
|
|
3328
3965
|
] });
|
|
3329
3966
|
}
|
|
3330
3967
|
function useToast() {
|
|
3331
|
-
const context = (0,
|
|
3968
|
+
const context = (0, import_react31.useContext)(ToastContext);
|
|
3332
3969
|
if (!context) {
|
|
3333
3970
|
throw new Error("useToast must be used within a ToastProvider");
|
|
3334
3971
|
}
|
|
@@ -3337,7 +3974,7 @@ function useToast() {
|
|
|
3337
3974
|
}
|
|
3338
3975
|
|
|
3339
3976
|
// src/components/Alert.tsx
|
|
3340
|
-
var
|
|
3977
|
+
var import_react32 = require("react");
|
|
3341
3978
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3342
3979
|
var variantConfig = {
|
|
3343
3980
|
default: {
|
|
@@ -3376,7 +4013,7 @@ var variantConfig = {
|
|
|
3376
4013
|
borderColor: "var(--lg-destructive)"
|
|
3377
4014
|
}
|
|
3378
4015
|
};
|
|
3379
|
-
var Alert = (0,
|
|
4016
|
+
var Alert = (0, import_react32.forwardRef)(
|
|
3380
4017
|
({
|
|
3381
4018
|
className,
|
|
3382
4019
|
style,
|
|
@@ -3437,7 +4074,7 @@ var Alert = (0, import_react31.forwardRef)(
|
|
|
3437
4074
|
Alert.displayName = "Alert";
|
|
3438
4075
|
|
|
3439
4076
|
// src/components/Progress.tsx
|
|
3440
|
-
var
|
|
4077
|
+
var import_react33 = require("react");
|
|
3441
4078
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3442
4079
|
var linearSizeConfig = {
|
|
3443
4080
|
sm: { height: 4, borderRadius: 2 },
|
|
@@ -3449,7 +4086,7 @@ var circularSizeConfig = {
|
|
|
3449
4086
|
md: { size: 40, strokeWidth: 4 },
|
|
3450
4087
|
lg: { size: 56, strokeWidth: 5 }
|
|
3451
4088
|
};
|
|
3452
|
-
var Progress = (0,
|
|
4089
|
+
var Progress = (0, import_react33.forwardRef)(
|
|
3453
4090
|
({
|
|
3454
4091
|
className,
|
|
3455
4092
|
style,
|
|
@@ -3462,7 +4099,7 @@ var Progress = (0, import_react32.forwardRef)(
|
|
|
3462
4099
|
indeterminate = false,
|
|
3463
4100
|
...props
|
|
3464
4101
|
}, ref) => {
|
|
3465
|
-
const percentage =
|
|
4102
|
+
const percentage = clamp2(value / max * 100, 0, 100);
|
|
3466
4103
|
const fillColor = color || "var(--lg-fill)";
|
|
3467
4104
|
if (variant === "circular") {
|
|
3468
4105
|
const config2 = circularSizeConfig[size];
|
|
@@ -3594,14 +4231,14 @@ var Progress = (0, import_react32.forwardRef)(
|
|
|
3594
4231
|
Progress.displayName = "Progress";
|
|
3595
4232
|
|
|
3596
4233
|
// src/components/Spinner.tsx
|
|
3597
|
-
var
|
|
4234
|
+
var import_react34 = require("react");
|
|
3598
4235
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3599
4236
|
var sizeMap = {
|
|
3600
4237
|
sm: 16,
|
|
3601
4238
|
md: 24,
|
|
3602
4239
|
lg: 32
|
|
3603
4240
|
};
|
|
3604
|
-
var Spinner = (0,
|
|
4241
|
+
var Spinner = (0, import_react34.forwardRef)(
|
|
3605
4242
|
({
|
|
3606
4243
|
className,
|
|
3607
4244
|
style,
|
|
@@ -3668,7 +4305,7 @@ var Spinner = (0, import_react33.forwardRef)(
|
|
|
3668
4305
|
Spinner.displayName = "Spinner";
|
|
3669
4306
|
|
|
3670
4307
|
// src/components/Badge.tsx
|
|
3671
|
-
var
|
|
4308
|
+
var import_react35 = require("react");
|
|
3672
4309
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3673
4310
|
var variantStyles = {
|
|
3674
4311
|
default: {
|
|
@@ -3698,12 +4335,12 @@ var variantStyles = {
|
|
|
3698
4335
|
border: "1px solid var(--lg-edge-strong)"
|
|
3699
4336
|
}
|
|
3700
4337
|
};
|
|
3701
|
-
var
|
|
4338
|
+
var sizeConfig9 = {
|
|
3702
4339
|
sm: { height: 18, padding: "0 6px", fontSize: 10, dotSize: 6 },
|
|
3703
4340
|
md: { height: 22, padding: "0 8px", fontSize: 11, dotSize: 8 },
|
|
3704
4341
|
lg: { height: 26, padding: "0 10px", fontSize: 12, dotSize: 10 }
|
|
3705
4342
|
};
|
|
3706
|
-
var Badge = (0,
|
|
4343
|
+
var Badge = (0, import_react35.forwardRef)(
|
|
3707
4344
|
({
|
|
3708
4345
|
className,
|
|
3709
4346
|
style,
|
|
@@ -3714,7 +4351,7 @@ var Badge = (0, import_react34.forwardRef)(
|
|
|
3714
4351
|
children,
|
|
3715
4352
|
...props
|
|
3716
4353
|
}, ref) => {
|
|
3717
|
-
const config =
|
|
4354
|
+
const config = sizeConfig9[size];
|
|
3718
4355
|
const variantStyle = variantStyles[variant];
|
|
3719
4356
|
if (dot) {
|
|
3720
4357
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -3762,9 +4399,9 @@ var Badge = (0, import_react34.forwardRef)(
|
|
|
3762
4399
|
Badge.displayName = "Badge";
|
|
3763
4400
|
|
|
3764
4401
|
// src/components/Avatar.tsx
|
|
3765
|
-
var
|
|
4402
|
+
var import_react36 = require("react");
|
|
3766
4403
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3767
|
-
var
|
|
4404
|
+
var sizeConfig10 = {
|
|
3768
4405
|
xs: { size: 24, fontSize: 10, statusSize: 6 },
|
|
3769
4406
|
sm: { size: 32, fontSize: 12, statusSize: 8 },
|
|
3770
4407
|
md: { size: 40, fontSize: 14, statusSize: 10 },
|
|
@@ -3780,7 +4417,7 @@ var statusColors = {
|
|
|
3780
4417
|
function getInitials(name) {
|
|
3781
4418
|
return name.split(" ").map((part) => part[0]).join("").toUpperCase().slice(0, 2);
|
|
3782
4419
|
}
|
|
3783
|
-
var Avatar = (0,
|
|
4420
|
+
var Avatar = (0, import_react36.forwardRef)(
|
|
3784
4421
|
({
|
|
3785
4422
|
className,
|
|
3786
4423
|
style,
|
|
@@ -3792,8 +4429,8 @@ var Avatar = (0, import_react35.forwardRef)(
|
|
|
3792
4429
|
status,
|
|
3793
4430
|
...props
|
|
3794
4431
|
}, ref) => {
|
|
3795
|
-
const [imageError, setImageError] = (0,
|
|
3796
|
-
const config =
|
|
4432
|
+
const [imageError, setImageError] = (0, import_react36.useState)(false);
|
|
4433
|
+
const config = sizeConfig10[size];
|
|
3797
4434
|
const showFallback = !src || imageError;
|
|
3798
4435
|
const avatarStyles = {
|
|
3799
4436
|
width: config.size,
|
|
@@ -3848,14 +4485,14 @@ var Avatar = (0, import_react35.forwardRef)(
|
|
|
3848
4485
|
Avatar.displayName = "Avatar";
|
|
3849
4486
|
|
|
3850
4487
|
// src/components/Chip.tsx
|
|
3851
|
-
var
|
|
4488
|
+
var import_react37 = require("react");
|
|
3852
4489
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3853
|
-
var
|
|
4490
|
+
var sizeConfig11 = {
|
|
3854
4491
|
sm: { height: 24, padding: "0 8px", fontSize: 11, iconSize: 14 },
|
|
3855
4492
|
md: { height: 32, padding: "0 12px", fontSize: 13, iconSize: 16 },
|
|
3856
4493
|
lg: { height: 40, padding: "0 16px", fontSize: 14, iconSize: 18 }
|
|
3857
4494
|
};
|
|
3858
|
-
var Chip = (0,
|
|
4495
|
+
var Chip = (0, import_react37.forwardRef)(
|
|
3859
4496
|
({
|
|
3860
4497
|
className,
|
|
3861
4498
|
style,
|
|
@@ -3870,7 +4507,7 @@ var Chip = (0, import_react36.forwardRef)(
|
|
|
3870
4507
|
children,
|
|
3871
4508
|
...props
|
|
3872
4509
|
}, ref) => {
|
|
3873
|
-
const config =
|
|
4510
|
+
const config = sizeConfig11[size];
|
|
3874
4511
|
const isClickable = !!onClick;
|
|
3875
4512
|
const chipStyles = {
|
|
3876
4513
|
height: config.height,
|
|
@@ -3947,10 +4584,10 @@ var Chip = (0, import_react36.forwardRef)(
|
|
|
3947
4584
|
Chip.displayName = "Chip";
|
|
3948
4585
|
|
|
3949
4586
|
// src/components/Accordion.tsx
|
|
3950
|
-
var
|
|
4587
|
+
var import_react38 = require("react");
|
|
3951
4588
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3952
|
-
var AccordionContext = (0,
|
|
3953
|
-
var Accordion = (0,
|
|
4589
|
+
var AccordionContext = (0, import_react38.createContext)(null);
|
|
4590
|
+
var Accordion = (0, import_react38.forwardRef)(
|
|
3954
4591
|
({
|
|
3955
4592
|
className,
|
|
3956
4593
|
type = "single",
|
|
@@ -3959,13 +4596,13 @@ var Accordion = (0, import_react37.forwardRef)(
|
|
|
3959
4596
|
children,
|
|
3960
4597
|
...props
|
|
3961
4598
|
}, ref) => {
|
|
3962
|
-
const [expandedItems, setExpandedItems] = (0,
|
|
4599
|
+
const [expandedItems, setExpandedItems] = (0, import_react38.useState)(() => {
|
|
3963
4600
|
if (defaultValue) {
|
|
3964
4601
|
return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
3965
4602
|
}
|
|
3966
4603
|
return [];
|
|
3967
4604
|
});
|
|
3968
|
-
const toggleItem = (0,
|
|
4605
|
+
const toggleItem = (0, import_react38.useCallback)((value) => {
|
|
3969
4606
|
setExpandedItems((prev) => {
|
|
3970
4607
|
const isExpanded = prev.includes(value);
|
|
3971
4608
|
if (type === "single") {
|
|
@@ -3991,10 +4628,10 @@ var Accordion = (0, import_react37.forwardRef)(
|
|
|
3991
4628
|
}
|
|
3992
4629
|
);
|
|
3993
4630
|
Accordion.displayName = "Accordion";
|
|
3994
|
-
var AccordionItemContext = (0,
|
|
3995
|
-
var AccordionItem = (0,
|
|
4631
|
+
var AccordionItemContext = (0, import_react38.createContext)(null);
|
|
4632
|
+
var AccordionItem = (0, import_react38.forwardRef)(
|
|
3996
4633
|
({ className, value, disabled = false, children, ...props }, ref) => {
|
|
3997
|
-
const context = (0,
|
|
4634
|
+
const context = (0, import_react38.useContext)(AccordionContext);
|
|
3998
4635
|
if (!context) throw new Error("AccordionItem must be used within Accordion");
|
|
3999
4636
|
const isExpanded = context.expandedItems.includes(value);
|
|
4000
4637
|
const id = useId();
|
|
@@ -4018,10 +4655,10 @@ var AccordionItem = (0, import_react37.forwardRef)(
|
|
|
4018
4655
|
}
|
|
4019
4656
|
);
|
|
4020
4657
|
AccordionItem.displayName = "AccordionItem";
|
|
4021
|
-
var AccordionTrigger = (0,
|
|
4658
|
+
var AccordionTrigger = (0, import_react38.forwardRef)(
|
|
4022
4659
|
({ className, children, ...props }, ref) => {
|
|
4023
|
-
const accordionContext = (0,
|
|
4024
|
-
const itemContext = (0,
|
|
4660
|
+
const accordionContext = (0, import_react38.useContext)(AccordionContext);
|
|
4661
|
+
const itemContext = (0, import_react38.useContext)(AccordionItemContext);
|
|
4025
4662
|
const reducedMotion = useReducedMotion();
|
|
4026
4663
|
if (!accordionContext || !itemContext) {
|
|
4027
4664
|
throw new Error("AccordionTrigger must be used within AccordionItem");
|
|
@@ -4073,9 +4710,9 @@ var AccordionTrigger = (0, import_react37.forwardRef)(
|
|
|
4073
4710
|
}
|
|
4074
4711
|
);
|
|
4075
4712
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
4076
|
-
var AccordionContent = (0,
|
|
4713
|
+
var AccordionContent = (0, import_react38.forwardRef)(
|
|
4077
4714
|
({ className, children, ...props }, ref) => {
|
|
4078
|
-
const itemContext = (0,
|
|
4715
|
+
const itemContext = (0, import_react38.useContext)(AccordionItemContext);
|
|
4079
4716
|
const reducedMotion = useReducedMotion();
|
|
4080
4717
|
if (!itemContext) {
|
|
4081
4718
|
throw new Error("AccordionContent must be used within AccordionItem");
|
|
@@ -4104,9 +4741,9 @@ var AccordionContent = (0, import_react37.forwardRef)(
|
|
|
4104
4741
|
AccordionContent.displayName = "AccordionContent";
|
|
4105
4742
|
|
|
4106
4743
|
// src/components/Separator.tsx
|
|
4107
|
-
var
|
|
4744
|
+
var import_react39 = require("react");
|
|
4108
4745
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4109
|
-
var Separator = (0,
|
|
4746
|
+
var Separator = (0, import_react39.forwardRef)(
|
|
4110
4747
|
({
|
|
4111
4748
|
className,
|
|
4112
4749
|
orientation = "horizontal",
|
|
@@ -4132,9 +4769,9 @@ var Separator = (0, import_react38.forwardRef)(
|
|
|
4132
4769
|
Separator.displayName = "Separator";
|
|
4133
4770
|
|
|
4134
4771
|
// src/components/Skeleton.tsx
|
|
4135
|
-
var
|
|
4772
|
+
var import_react40 = require("react");
|
|
4136
4773
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4137
|
-
var Skeleton = (0,
|
|
4774
|
+
var Skeleton = (0, import_react40.forwardRef)(
|
|
4138
4775
|
({
|
|
4139
4776
|
className,
|
|
4140
4777
|
style,
|
|
@@ -4178,16 +4815,16 @@ var Skeleton = (0, import_react39.forwardRef)(
|
|
|
4178
4815
|
Skeleton.displayName = "Skeleton";
|
|
4179
4816
|
|
|
4180
4817
|
// src/components/Drawer.tsx
|
|
4181
|
-
var
|
|
4818
|
+
var import_react41 = require("react");
|
|
4182
4819
|
var import_react_dom7 = require("react-dom");
|
|
4183
4820
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4184
|
-
var
|
|
4821
|
+
var sizeConfig12 = {
|
|
4185
4822
|
sm: 280,
|
|
4186
4823
|
md: 320,
|
|
4187
4824
|
lg: 400,
|
|
4188
4825
|
xl: 500
|
|
4189
4826
|
};
|
|
4190
|
-
var Drawer = (0,
|
|
4827
|
+
var Drawer = (0, import_react41.forwardRef)(
|
|
4191
4828
|
({
|
|
4192
4829
|
className,
|
|
4193
4830
|
style,
|
|
@@ -4204,11 +4841,11 @@ var Drawer = (0, import_react40.forwardRef)(
|
|
|
4204
4841
|
...props
|
|
4205
4842
|
}, ref) => {
|
|
4206
4843
|
const reducedMotion = useReducedMotion();
|
|
4207
|
-
const drawerRef = (0,
|
|
4844
|
+
const drawerRef = (0, import_react41.useRef)(null);
|
|
4208
4845
|
const titleId = useId();
|
|
4209
4846
|
const descId = useId();
|
|
4210
|
-
const width =
|
|
4211
|
-
const handleClose = (0,
|
|
4847
|
+
const width = sizeConfig12[size];
|
|
4848
|
+
const handleClose = (0, import_react41.useCallback)(() => {
|
|
4212
4849
|
onOpenChange(false);
|
|
4213
4850
|
}, [onOpenChange]);
|
|
4214
4851
|
const handleOverlayClick = (e) => {
|
|
@@ -4216,12 +4853,12 @@ var Drawer = (0, import_react40.forwardRef)(
|
|
|
4216
4853
|
handleClose();
|
|
4217
4854
|
}
|
|
4218
4855
|
};
|
|
4219
|
-
const handleKeyDown = (0,
|
|
4856
|
+
const handleKeyDown = (0, import_react41.useCallback)((e) => {
|
|
4220
4857
|
if (closeOnEscape && e.key === "Escape") {
|
|
4221
4858
|
handleClose();
|
|
4222
4859
|
}
|
|
4223
4860
|
}, [closeOnEscape, handleClose]);
|
|
4224
|
-
(0,
|
|
4861
|
+
(0, import_react41.useEffect)(() => {
|
|
4225
4862
|
if (open) {
|
|
4226
4863
|
document.addEventListener("keydown", handleKeyDown);
|
|
4227
4864
|
document.body.style.overflow = "hidden";
|
|
@@ -4318,7 +4955,7 @@ var Drawer = (0, import_react40.forwardRef)(
|
|
|
4318
4955
|
Drawer.displayName = "Drawer";
|
|
4319
4956
|
|
|
4320
4957
|
// src/components/Popover.tsx
|
|
4321
|
-
var
|
|
4958
|
+
var import_react42 = require("react");
|
|
4322
4959
|
var import_react_dom8 = require("react-dom");
|
|
4323
4960
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4324
4961
|
function Popover({
|
|
@@ -4334,15 +4971,15 @@ function Popover({
|
|
|
4334
4971
|
closeOnEscape = true,
|
|
4335
4972
|
trigger = "click"
|
|
4336
4973
|
}) {
|
|
4337
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
4974
|
+
const [internalOpen, setInternalOpen] = (0, import_react42.useState)(defaultOpen);
|
|
4338
4975
|
const open = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
4339
4976
|
const setOpen = controlledOpen !== void 0 ? onOpenChange : setInternalOpen;
|
|
4340
|
-
const [position, setPosition] = (0,
|
|
4341
|
-
const triggerRef = (0,
|
|
4342
|
-
const popoverRef = (0,
|
|
4977
|
+
const [position, setPosition] = (0, import_react42.useState)({ top: 0, left: 0 });
|
|
4978
|
+
const triggerRef = (0, import_react42.useRef)(null);
|
|
4979
|
+
const popoverRef = (0, import_react42.useRef)(null);
|
|
4343
4980
|
const reducedMotion = useReducedMotion();
|
|
4344
4981
|
const popoverId = useId();
|
|
4345
|
-
const updatePosition = (0,
|
|
4982
|
+
const updatePosition = (0, import_react42.useCallback)(() => {
|
|
4346
4983
|
if (!triggerRef.current || !popoverRef.current) return;
|
|
4347
4984
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
4348
4985
|
const popoverRect = popoverRef.current.getBoundingClientRect();
|
|
@@ -4381,7 +5018,7 @@ function Popover({
|
|
|
4381
5018
|
top = Math.max(8, Math.min(top, window.innerHeight - popoverRect.height - 8));
|
|
4382
5019
|
setPosition({ top: top + window.scrollY, left: left + window.scrollX });
|
|
4383
5020
|
}, [side, align, sideOffset]);
|
|
4384
|
-
(0,
|
|
5021
|
+
(0, import_react42.useEffect)(() => {
|
|
4385
5022
|
if (open) {
|
|
4386
5023
|
updatePosition();
|
|
4387
5024
|
window.addEventListener("scroll", updatePosition, true);
|
|
@@ -4392,7 +5029,7 @@ function Popover({
|
|
|
4392
5029
|
window.removeEventListener("resize", updatePosition);
|
|
4393
5030
|
};
|
|
4394
5031
|
}, [open, updatePosition]);
|
|
4395
|
-
(0,
|
|
5032
|
+
(0, import_react42.useEffect)(() => {
|
|
4396
5033
|
if (!open) return;
|
|
4397
5034
|
const handleClickOutside = (e) => {
|
|
4398
5035
|
if (closeOnClickOutside && !triggerRef.current?.contains(e.target) && !popoverRef.current?.contains(e.target)) {
|
|
@@ -4433,8 +5070,8 @@ function Popover({
|
|
|
4433
5070
|
setOpen(false);
|
|
4434
5071
|
}
|
|
4435
5072
|
};
|
|
4436
|
-
const child = (0,
|
|
4437
|
-
const triggerElement = (0,
|
|
5073
|
+
const child = (0, import_react42.isValidElement)(children) ? children : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children });
|
|
5074
|
+
const triggerElement = (0, import_react42.cloneElement)(child, {
|
|
4438
5075
|
ref: triggerRef,
|
|
4439
5076
|
onClick: handleTriggerClick,
|
|
4440
5077
|
onKeyDown: handleTriggerKeyDown,
|
|
@@ -4476,7 +5113,7 @@ function Popover({
|
|
|
4476
5113
|
}
|
|
4477
5114
|
|
|
4478
5115
|
// src/components/ContextMenu.tsx
|
|
4479
|
-
var
|
|
5116
|
+
var import_react43 = require("react");
|
|
4480
5117
|
var import_react_dom9 = require("react-dom");
|
|
4481
5118
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4482
5119
|
function ContextMenu({
|
|
@@ -4485,14 +5122,14 @@ function ContextMenu({
|
|
|
4485
5122
|
disabled = false,
|
|
4486
5123
|
onOpenChange
|
|
4487
5124
|
}) {
|
|
4488
|
-
const [open, setOpen] = (0,
|
|
4489
|
-
const [position, setPosition] = (0,
|
|
4490
|
-
const [focusedIndex, setFocusedIndex] = (0,
|
|
4491
|
-
const menuRef = (0,
|
|
4492
|
-
const triggerRef = (0,
|
|
5125
|
+
const [open, setOpen] = (0, import_react43.useState)(false);
|
|
5126
|
+
const [position, setPosition] = (0, import_react43.useState)({ x: 0, y: 0 });
|
|
5127
|
+
const [focusedIndex, setFocusedIndex] = (0, import_react43.useState)(-1);
|
|
5128
|
+
const menuRef = (0, import_react43.useRef)(null);
|
|
5129
|
+
const triggerRef = (0, import_react43.useRef)(null);
|
|
4493
5130
|
const reducedMotion = useReducedMotion();
|
|
4494
5131
|
const menuId = useId();
|
|
4495
|
-
const handleOpenChange = (0,
|
|
5132
|
+
const handleOpenChange = (0, import_react43.useCallback)((isOpen) => {
|
|
4496
5133
|
setOpen(isOpen);
|
|
4497
5134
|
onOpenChange?.(isOpen);
|
|
4498
5135
|
if (!isOpen) {
|
|
@@ -4520,7 +5157,7 @@ function ContextMenu({
|
|
|
4520
5157
|
item.onSelect?.();
|
|
4521
5158
|
handleOpenChange(false);
|
|
4522
5159
|
};
|
|
4523
|
-
const handleKeyDown = (0,
|
|
5160
|
+
const handleKeyDown = (0, import_react43.useCallback)((e) => {
|
|
4524
5161
|
if (!open) return;
|
|
4525
5162
|
const selectableItems = items.filter((item) => item !== "separator" && !item.disabled);
|
|
4526
5163
|
switch (e.key) {
|
|
@@ -4551,7 +5188,7 @@ function ContextMenu({
|
|
|
4551
5188
|
break;
|
|
4552
5189
|
}
|
|
4553
5190
|
}, [open, items, focusedIndex, handleOpenChange]);
|
|
4554
|
-
(0,
|
|
5191
|
+
(0, import_react43.useEffect)(() => {
|
|
4555
5192
|
if (open) {
|
|
4556
5193
|
document.addEventListener("keydown", handleKeyDown);
|
|
4557
5194
|
const handleClickOutside = (e) => {
|
|
@@ -4567,8 +5204,8 @@ function ContextMenu({
|
|
|
4567
5204
|
};
|
|
4568
5205
|
}
|
|
4569
5206
|
}, [open, handleKeyDown, handleOpenChange]);
|
|
4570
|
-
const child = (0,
|
|
4571
|
-
const triggerElement = (0,
|
|
5207
|
+
const child = (0, import_react43.isValidElement)(children) ? children : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children });
|
|
5208
|
+
const triggerElement = (0, import_react43.cloneElement)(child, {
|
|
4572
5209
|
ref: triggerRef,
|
|
4573
5210
|
onContextMenu: handleContextMenu
|
|
4574
5211
|
});
|
|
@@ -4648,7 +5285,7 @@ function ContextMenu({
|
|
|
4648
5285
|
}
|
|
4649
5286
|
|
|
4650
5287
|
// src/components/CommandPalette.tsx
|
|
4651
|
-
var
|
|
5288
|
+
var import_react44 = require("react");
|
|
4652
5289
|
var import_react_dom10 = require("react-dom");
|
|
4653
5290
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4654
5291
|
function CommandPalette({
|
|
@@ -4659,14 +5296,14 @@ function CommandPalette({
|
|
|
4659
5296
|
emptyMessage = "No results found.",
|
|
4660
5297
|
groups = {}
|
|
4661
5298
|
}) {
|
|
4662
|
-
const [query, setQuery] = (0,
|
|
4663
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4664
|
-
const inputRef = (0,
|
|
4665
|
-
const listRef = (0,
|
|
5299
|
+
const [query, setQuery] = (0, import_react44.useState)("");
|
|
5300
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react44.useState)(0);
|
|
5301
|
+
const inputRef = (0, import_react44.useRef)(null);
|
|
5302
|
+
const listRef = (0, import_react44.useRef)(null);
|
|
4666
5303
|
const reducedMotion = useReducedMotion();
|
|
4667
5304
|
const dialogId = useId();
|
|
4668
5305
|
const listboxId = useId();
|
|
4669
|
-
const filteredItems = (0,
|
|
5306
|
+
const filteredItems = (0, import_react44.useMemo)(() => {
|
|
4670
5307
|
if (!query.trim()) return items.filter((item) => !item.disabled);
|
|
4671
5308
|
const lowerQuery = query.toLowerCase();
|
|
4672
5309
|
return items.filter((item) => {
|
|
@@ -4677,7 +5314,7 @@ function CommandPalette({
|
|
|
4677
5314
|
return matchLabel || matchDesc || matchKeywords;
|
|
4678
5315
|
});
|
|
4679
5316
|
}, [items, query]);
|
|
4680
|
-
const groupedItems = (0,
|
|
5317
|
+
const groupedItems = (0, import_react44.useMemo)(() => {
|
|
4681
5318
|
const grouped = {};
|
|
4682
5319
|
filteredItems.forEach((item) => {
|
|
4683
5320
|
const group = item.group || "_default";
|
|
@@ -4686,19 +5323,19 @@ function CommandPalette({
|
|
|
4686
5323
|
});
|
|
4687
5324
|
return grouped;
|
|
4688
5325
|
}, [filteredItems]);
|
|
4689
|
-
const flattenedItems = (0,
|
|
5326
|
+
const flattenedItems = (0, import_react44.useMemo)(() => {
|
|
4690
5327
|
return Object.values(groupedItems).flat();
|
|
4691
5328
|
}, [groupedItems]);
|
|
4692
|
-
const handleClose = (0,
|
|
5329
|
+
const handleClose = (0, import_react44.useCallback)(() => {
|
|
4693
5330
|
onOpenChange(false);
|
|
4694
5331
|
setQuery("");
|
|
4695
5332
|
setSelectedIndex(0);
|
|
4696
5333
|
}, [onOpenChange]);
|
|
4697
|
-
const handleSelect = (0,
|
|
5334
|
+
const handleSelect = (0, import_react44.useCallback)((item) => {
|
|
4698
5335
|
item.onSelect();
|
|
4699
5336
|
handleClose();
|
|
4700
5337
|
}, [handleClose]);
|
|
4701
|
-
const handleKeyDown = (0,
|
|
5338
|
+
const handleKeyDown = (0, import_react44.useCallback)((e) => {
|
|
4702
5339
|
switch (e.key) {
|
|
4703
5340
|
case "ArrowDown":
|
|
4704
5341
|
e.preventDefault();
|
|
@@ -4724,7 +5361,7 @@ function CommandPalette({
|
|
|
4724
5361
|
break;
|
|
4725
5362
|
}
|
|
4726
5363
|
}, [flattenedItems, selectedIndex, handleSelect, handleClose]);
|
|
4727
|
-
(0,
|
|
5364
|
+
(0, import_react44.useEffect)(() => {
|
|
4728
5365
|
if (open) {
|
|
4729
5366
|
inputRef.current?.focus();
|
|
4730
5367
|
const handleGlobalKeyDown = (e) => {
|
|
@@ -4740,10 +5377,10 @@ function CommandPalette({
|
|
|
4740
5377
|
};
|
|
4741
5378
|
}
|
|
4742
5379
|
}, [open, handleClose]);
|
|
4743
|
-
(0,
|
|
5380
|
+
(0, import_react44.useEffect)(() => {
|
|
4744
5381
|
setSelectedIndex(0);
|
|
4745
5382
|
}, [query]);
|
|
4746
|
-
(0,
|
|
5383
|
+
(0, import_react44.useEffect)(() => {
|
|
4747
5384
|
const selectedElement = listRef.current?.querySelector('[data-selected="true"]');
|
|
4748
5385
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
4749
5386
|
}, [selectedIndex]);
|
|
@@ -4752,7 +5389,8 @@ function CommandPalette({
|
|
|
4752
5389
|
"div",
|
|
4753
5390
|
{
|
|
4754
5391
|
className: cn(
|
|
4755
|
-
"fixed inset-0 z-50 flex items-start justify-center
|
|
5392
|
+
"fixed inset-0 z-50 flex items-stretch sm:items-start justify-center",
|
|
5393
|
+
"p-0 sm:p-4 sm:pt-[12vh]",
|
|
4756
5394
|
"bg-black/40 backdrop-blur-sm",
|
|
4757
5395
|
!reducedMotion && "animate-[lg-fade-in_150ms_ease-out]"
|
|
4758
5396
|
),
|
|
@@ -4765,13 +5403,14 @@ function CommandPalette({
|
|
|
4765
5403
|
"aria-labelledby": dialogId,
|
|
4766
5404
|
className: cn(
|
|
4767
5405
|
"lg-glass lg-glass-elevated lg-text",
|
|
4768
|
-
"w-full max-w-[540px] overflow-hidden",
|
|
5406
|
+
"w-full sm:max-w-[540px] overflow-hidden",
|
|
5407
|
+
"h-full sm:h-auto max-h-full sm:max-h-[min(80vh,640px)]",
|
|
5408
|
+
"flex flex-col rounded-none sm:rounded-2xl",
|
|
4769
5409
|
!reducedMotion && "animate-[lg-scale-in_150ms_var(--lg-ease-spring)]"
|
|
4770
5410
|
),
|
|
4771
|
-
style: { borderRadius: 16 },
|
|
4772
5411
|
children: [
|
|
4773
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-3 px-4
|
|
4774
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "var(--lg-muted)", strokeWidth: "2", children: [
|
|
5412
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-3 px-3 sm:px-4 min-h-[56px] border-b border-[var(--lg-separator)] shrink-0", children: [
|
|
5413
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "var(--lg-muted)", strokeWidth: "2", "aria-hidden": true, children: [
|
|
4775
5414
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
4776
5415
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "m21 21-4.35-4.35" })
|
|
4777
5416
|
] }),
|
|
@@ -4779,7 +5418,11 @@ function CommandPalette({
|
|
|
4779
5418
|
"input",
|
|
4780
5419
|
{
|
|
4781
5420
|
ref: inputRef,
|
|
4782
|
-
type: "
|
|
5421
|
+
type: "search",
|
|
5422
|
+
enterKeyHint: "search",
|
|
5423
|
+
autoComplete: "off",
|
|
5424
|
+
autoCorrect: "off",
|
|
5425
|
+
spellCheck: false,
|
|
4783
5426
|
value: query,
|
|
4784
5427
|
onChange: (e) => setQuery(e.target.value),
|
|
4785
5428
|
onKeyDown: handleKeyDown,
|
|
@@ -4789,13 +5432,29 @@ function CommandPalette({
|
|
|
4789
5432
|
"aria-controls": listboxId,
|
|
4790
5433
|
"aria-activedescendant": flattenedItems[selectedIndex]?.id,
|
|
4791
5434
|
className: cn(
|
|
4792
|
-
"flex-1 bg-transparent border-0 outline-none",
|
|
5435
|
+
"flex-1 min-w-0 bg-transparent border-0 outline-none",
|
|
4793
5436
|
"text-base placeholder:text-[var(--lg-muted)]"
|
|
4794
5437
|
),
|
|
4795
|
-
style: { color: "var(--lg-foreground)" }
|
|
5438
|
+
style: { color: "var(--lg-foreground)", fontSize: 16 }
|
|
4796
5439
|
}
|
|
4797
5440
|
),
|
|
4798
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5442
|
+
"button",
|
|
5443
|
+
{
|
|
5444
|
+
type: "button",
|
|
5445
|
+
onClick: handleClose,
|
|
5446
|
+
className: "inline-flex items-center justify-center rounded-lg text-[var(--lg-muted)] border-0 bg-transparent cursor-pointer",
|
|
5447
|
+
style: { minWidth: 44, minHeight: 44 },
|
|
5448
|
+
"aria-label": "Close search",
|
|
5449
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5450
|
+
"kbd",
|
|
5451
|
+
{
|
|
5452
|
+
className: "px-2 py-1 text-xs rounded bg-[var(--lg-glass)] text-[var(--lg-muted)] pointer-events-none",
|
|
5453
|
+
children: "ESC"
|
|
5454
|
+
}
|
|
5455
|
+
)
|
|
5456
|
+
}
|
|
5457
|
+
)
|
|
4799
5458
|
] }),
|
|
4800
5459
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4801
5460
|
"div",
|
|
@@ -4803,7 +5462,8 @@ function CommandPalette({
|
|
|
4803
5462
|
ref: listRef,
|
|
4804
5463
|
role: "listbox",
|
|
4805
5464
|
id: listboxId,
|
|
4806
|
-
className: "
|
|
5465
|
+
className: "flex-1 overflow-auto overscroll-contain p-2 min-h-0",
|
|
5466
|
+
style: { maxHeight: "min(70dvh, 480px)" },
|
|
4807
5467
|
children: flattenedItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "px-4 py-8 text-center text-sm text-[var(--lg-muted)]", children: emptyMessage }) : Object.entries(groupedItems).map(([group, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
4808
5468
|
group !== "_default" && groups[group] && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "px-3 py-2 text-xs font-medium text-[var(--lg-muted)] uppercase tracking-wider", children: groups[group] }),
|
|
4809
5469
|
groupItems.map((item) => {
|
|
@@ -4818,18 +5478,19 @@ function CommandPalette({
|
|
|
4818
5478
|
onClick: () => handleSelect(item),
|
|
4819
5479
|
onMouseEnter: () => setSelectedIndex(flattenedItems.indexOf(item)),
|
|
4820
5480
|
className: cn(
|
|
4821
|
-
"w-full flex items-center gap-3 px-3
|
|
5481
|
+
"w-full flex items-center gap-3 px-3 rounded-lg",
|
|
4822
5482
|
"border-0 bg-transparent text-left cursor-pointer",
|
|
4823
5483
|
"transition-colors",
|
|
4824
5484
|
isSelected && "bg-[var(--lg-highlight)]"
|
|
4825
5485
|
),
|
|
5486
|
+
style: { minHeight: 44 },
|
|
4826
5487
|
children: [
|
|
4827
5488
|
item.icon && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "flex-shrink-0 w-5 h-5 text-[var(--lg-muted)]", children: item.icon }),
|
|
4828
5489
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
4829
5490
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "text-sm font-medium", style: { color: "var(--lg-foreground)" }, children: item.label }),
|
|
4830
5491
|
item.description && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "text-xs text-[var(--lg-muted)] truncate", children: item.description })
|
|
4831
5492
|
] }),
|
|
4832
|
-
item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("kbd", { className: "px-2 py-0.5 text-xs rounded bg-[var(--lg-glass)] text-[var(--lg-muted)]", children: item.shortcut })
|
|
5493
|
+
item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("kbd", { className: "hidden sm:inline px-2 py-0.5 text-xs rounded bg-[var(--lg-glass)] text-[var(--lg-muted)]", children: item.shortcut })
|
|
4833
5494
|
]
|
|
4834
5495
|
},
|
|
4835
5496
|
item.id
|
|
@@ -4847,9 +5508,9 @@ function CommandPalette({
|
|
|
4847
5508
|
}
|
|
4848
5509
|
|
|
4849
5510
|
// src/components/Carousel.tsx
|
|
4850
|
-
var
|
|
5511
|
+
var import_react45 = require("react");
|
|
4851
5512
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4852
|
-
var Carousel = (0,
|
|
5513
|
+
var Carousel = (0, import_react45.forwardRef)(
|
|
4853
5514
|
({
|
|
4854
5515
|
className,
|
|
4855
5516
|
style,
|
|
@@ -4863,15 +5524,15 @@ var Carousel = (0, import_react44.forwardRef)(
|
|
|
4863
5524
|
gap = 16,
|
|
4864
5525
|
...props
|
|
4865
5526
|
}, ref) => {
|
|
4866
|
-
const [currentIndex, setCurrentIndex] = (0,
|
|
4867
|
-
const [isHovered, setIsHovered] = (0,
|
|
4868
|
-
const containerRef = (0,
|
|
5527
|
+
const [currentIndex, setCurrentIndex] = (0, import_react45.useState)(0);
|
|
5528
|
+
const [isHovered, setIsHovered] = (0, import_react45.useState)(false);
|
|
5529
|
+
const containerRef = (0, import_react45.useRef)(null);
|
|
4869
5530
|
const reducedMotion = useReducedMotion();
|
|
4870
5531
|
const carouselId = useId();
|
|
4871
|
-
const slides =
|
|
5532
|
+
const slides = import_react45.Children.toArray(children);
|
|
4872
5533
|
const totalSlides = slides.length;
|
|
4873
5534
|
const maxIndex = Math.max(0, totalSlides - slidesToShow);
|
|
4874
|
-
const goToSlide = (0,
|
|
5535
|
+
const goToSlide = (0, import_react45.useCallback)((index) => {
|
|
4875
5536
|
if (loop) {
|
|
4876
5537
|
if (index < 0) index = maxIndex;
|
|
4877
5538
|
if (index > maxIndex) index = 0;
|
|
@@ -4880,13 +5541,13 @@ var Carousel = (0, import_react44.forwardRef)(
|
|
|
4880
5541
|
}
|
|
4881
5542
|
setCurrentIndex(index);
|
|
4882
5543
|
}, [loop, maxIndex]);
|
|
4883
|
-
const goToPrevious = (0,
|
|
5544
|
+
const goToPrevious = (0, import_react45.useCallback)(() => {
|
|
4884
5545
|
goToSlide(currentIndex - 1);
|
|
4885
5546
|
}, [currentIndex, goToSlide]);
|
|
4886
|
-
const goToNext = (0,
|
|
5547
|
+
const goToNext = (0, import_react45.useCallback)(() => {
|
|
4887
5548
|
goToSlide(currentIndex + 1);
|
|
4888
5549
|
}, [currentIndex, goToSlide]);
|
|
4889
|
-
(0,
|
|
5550
|
+
(0, import_react45.useEffect)(() => {
|
|
4890
5551
|
if (autoPlay && !isHovered && !reducedMotion) {
|
|
4891
5552
|
const timer = setInterval(goToNext, autoPlayInterval);
|
|
4892
5553
|
return () => clearInterval(timer);
|
|
@@ -5029,9 +5690,9 @@ var Carousel = (0, import_react44.forwardRef)(
|
|
|
5029
5690
|
Carousel.displayName = "Carousel";
|
|
5030
5691
|
|
|
5031
5692
|
// src/components/FloatingActionButton.tsx
|
|
5032
|
-
var
|
|
5693
|
+
var import_react46 = require("react");
|
|
5033
5694
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5034
|
-
var
|
|
5695
|
+
var sizeConfig13 = {
|
|
5035
5696
|
sm: { size: 40, iconSize: 20 },
|
|
5036
5697
|
md: { size: 56, iconSize: 24 },
|
|
5037
5698
|
lg: { size: 72, iconSize: 32 }
|
|
@@ -5043,7 +5704,7 @@ var positionStyles = {
|
|
|
5043
5704
|
"top-right": { top: 24, right: 24 },
|
|
5044
5705
|
"top-left": { top: 24, left: 24 }
|
|
5045
5706
|
};
|
|
5046
|
-
var FloatingActionButton = (0,
|
|
5707
|
+
var FloatingActionButton = (0, import_react46.forwardRef)(
|
|
5047
5708
|
({
|
|
5048
5709
|
className,
|
|
5049
5710
|
style,
|
|
@@ -5056,10 +5717,10 @@ var FloatingActionButton = (0, import_react45.forwardRef)(
|
|
|
5056
5717
|
disabled,
|
|
5057
5718
|
...props
|
|
5058
5719
|
}, ref) => {
|
|
5059
|
-
const [isHovered, setIsHovered] = (0,
|
|
5720
|
+
const [isHovered, setIsHovered] = (0, import_react46.useState)(false);
|
|
5060
5721
|
const { isPressed, pressHandlers } = usePressedState({ disabled });
|
|
5061
5722
|
const reducedMotion = useReducedMotion();
|
|
5062
|
-
const config =
|
|
5723
|
+
const config = sizeConfig13[size];
|
|
5063
5724
|
const fabStyles = {
|
|
5064
5725
|
position: "fixed",
|
|
5065
5726
|
zIndex: 40,
|
|
@@ -5118,7 +5779,7 @@ var FloatingActionButton = (0, import_react45.forwardRef)(
|
|
|
5118
5779
|
FloatingActionButton.displayName = "FloatingActionButton";
|
|
5119
5780
|
|
|
5120
5781
|
// src/components/DatePicker.tsx
|
|
5121
|
-
var
|
|
5782
|
+
var import_react47 = require("react");
|
|
5122
5783
|
var import_react_dom11 = require("react-dom");
|
|
5123
5784
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5124
5785
|
var DAYS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
@@ -5138,7 +5799,7 @@ function isDateDisabled(date, minDate, maxDate) {
|
|
|
5138
5799
|
if (maxDate && date > maxDate) return true;
|
|
5139
5800
|
return false;
|
|
5140
5801
|
}
|
|
5141
|
-
var DatePicker = (0,
|
|
5802
|
+
var DatePicker = (0, import_react47.forwardRef)(
|
|
5142
5803
|
({
|
|
5143
5804
|
className,
|
|
5144
5805
|
style,
|
|
@@ -5153,17 +5814,17 @@ var DatePicker = (0, import_react46.forwardRef)(
|
|
|
5153
5814
|
formatDate = (date) => date.toLocaleDateString(locale, { year: "numeric", month: "long", day: "numeric" }),
|
|
5154
5815
|
...props
|
|
5155
5816
|
}, ref) => {
|
|
5156
|
-
const [internalValue, setInternalValue] = (0,
|
|
5817
|
+
const [internalValue, setInternalValue] = (0, import_react47.useState)(defaultValue || null);
|
|
5157
5818
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
5158
|
-
const [isOpen, setIsOpen] = (0,
|
|
5159
|
-
const [viewDate, setViewDate] = (0,
|
|
5160
|
-
const [focusedDate, setFocusedDate] = (0,
|
|
5161
|
-
const triggerRef = (0,
|
|
5162
|
-
const calendarRef = (0,
|
|
5819
|
+
const [isOpen, setIsOpen] = (0, import_react47.useState)(false);
|
|
5820
|
+
const [viewDate, setViewDate] = (0, import_react47.useState)(() => value || /* @__PURE__ */ new Date());
|
|
5821
|
+
const [focusedDate, setFocusedDate] = (0, import_react47.useState)(null);
|
|
5822
|
+
const triggerRef = (0, import_react47.useRef)(null);
|
|
5823
|
+
const calendarRef = (0, import_react47.useRef)(null);
|
|
5163
5824
|
const reducedMotion = useReducedMotion();
|
|
5164
5825
|
const inputId = useId();
|
|
5165
5826
|
const calendarId = useId();
|
|
5166
|
-
const setValue = (0,
|
|
5827
|
+
const setValue = (0, import_react47.useCallback)((date) => {
|
|
5167
5828
|
if (controlledValue === void 0) {
|
|
5168
5829
|
setInternalValue(date);
|
|
5169
5830
|
}
|
|
@@ -5181,7 +5842,7 @@ var DatePicker = (0, import_react46.forwardRef)(
|
|
|
5181
5842
|
const handleNextMonth = () => {
|
|
5182
5843
|
setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1));
|
|
5183
5844
|
};
|
|
5184
|
-
(0,
|
|
5845
|
+
(0, import_react47.useEffect)(() => {
|
|
5185
5846
|
if (!isOpen) return;
|
|
5186
5847
|
const handleKeyDown = (e) => {
|
|
5187
5848
|
if (e.key === "Escape") {
|
|
@@ -5240,14 +5901,14 @@ var DatePicker = (0, import_react46.forwardRef)(
|
|
|
5240
5901
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5241
5902
|
};
|
|
5242
5903
|
}, [isOpen, value]);
|
|
5243
|
-
(0,
|
|
5904
|
+
(0, import_react47.useEffect)(() => {
|
|
5244
5905
|
if (isOpen && triggerRef.current && calendarRef.current) {
|
|
5245
5906
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
5246
5907
|
calendarRef.current.style.top = `${rect.bottom + window.scrollY + 8}px`;
|
|
5247
5908
|
calendarRef.current.style.left = `${rect.left + window.scrollX}px`;
|
|
5248
5909
|
}
|
|
5249
5910
|
}, [isOpen]);
|
|
5250
|
-
const days = (0,
|
|
5911
|
+
const days = (0, import_react47.useMemo)(() => {
|
|
5251
5912
|
const year = viewDate.getFullYear();
|
|
5252
5913
|
const month = viewDate.getMonth();
|
|
5253
5914
|
const daysInMonth = getDaysInMonth(year, month);
|
|
@@ -5414,15 +6075,15 @@ var DatePicker = (0, import_react46.forwardRef)(
|
|
|
5414
6075
|
DatePicker.displayName = "DatePicker";
|
|
5415
6076
|
|
|
5416
6077
|
// src/hooks/use-reduced-transparency.ts
|
|
5417
|
-
var
|
|
6078
|
+
var import_react48 = require("react");
|
|
5418
6079
|
var QUERY2 = "(prefers-reduced-transparency: reduce)";
|
|
5419
6080
|
function getInitialState2() {
|
|
5420
6081
|
if (typeof window === "undefined") return false;
|
|
5421
6082
|
return window.matchMedia(QUERY2).matches;
|
|
5422
6083
|
}
|
|
5423
6084
|
function useReducedTransparency() {
|
|
5424
|
-
const [reducedTransparency, setReducedTransparency] = (0,
|
|
5425
|
-
(0,
|
|
6085
|
+
const [reducedTransparency, setReducedTransparency] = (0, import_react48.useState)(getInitialState2);
|
|
6086
|
+
(0, import_react48.useEffect)(() => {
|
|
5426
6087
|
const mediaQuery = window.matchMedia(QUERY2);
|
|
5427
6088
|
const handler = (event) => {
|
|
5428
6089
|
setReducedTransparency(event.matches);
|
|
@@ -5437,10 +6098,10 @@ function useReducedTransparency() {
|
|
|
5437
6098
|
}
|
|
5438
6099
|
|
|
5439
6100
|
// src/hooks/use-mounted.ts
|
|
5440
|
-
var
|
|
6101
|
+
var import_react49 = require("react");
|
|
5441
6102
|
function useMounted() {
|
|
5442
|
-
const [mounted, setMounted] = (0,
|
|
5443
|
-
(0,
|
|
6103
|
+
const [mounted, setMounted] = (0, import_react49.useState)(false);
|
|
6104
|
+
(0, import_react49.useEffect)(() => {
|
|
5444
6105
|
setMounted(true);
|
|
5445
6106
|
}, []);
|
|
5446
6107
|
return mounted;
|
|
@@ -5506,6 +6167,7 @@ function useMounted() {
|
|
|
5506
6167
|
Tooltip,
|
|
5507
6168
|
clamp,
|
|
5508
6169
|
cleanupFilters,
|
|
6170
|
+
clearGlisseCache,
|
|
5509
6171
|
cn,
|
|
5510
6172
|
createLensFilter,
|
|
5511
6173
|
createRefractionFilter,
|
|
@@ -5522,12 +6184,14 @@ function useMounted() {
|
|
|
5522
6184
|
throttle,
|
|
5523
6185
|
useControllable,
|
|
5524
6186
|
useGlass,
|
|
6187
|
+
useGlisseEffect,
|
|
5525
6188
|
useId,
|
|
5526
6189
|
useMounted,
|
|
5527
6190
|
usePointerPosition,
|
|
5528
6191
|
usePressedState,
|
|
5529
6192
|
useReducedMotion,
|
|
5530
6193
|
useReducedTransparency,
|
|
6194
|
+
useRefraction,
|
|
5531
6195
|
useSidebar,
|
|
5532
6196
|
useTheme,
|
|
5533
6197
|
useToast
|