mado-ui 0.5.4 → 0.5.7
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/css/index.css +283 -8
- package/dist/components/drop-down.d.ts +12 -12
- package/dist/components/drop-down.d.ts.map +1 -1
- package/dist/components/form/human-verification.d.ts +15 -0
- package/dist/components/form/human-verification.d.ts.map +1 -0
- package/dist/components/form/input/date/views/calendar-view.d.ts +2 -0
- package/dist/components/form/input/date/views/calendar-view.d.ts.map +1 -0
- package/dist/components/form/input/date/views/clock-view.d.ts +2 -0
- package/dist/components/form/input/date/views/clock-view.d.ts.map +1 -0
- package/dist/components/form/input/date/views/dropdown-view.d.ts +2 -0
- package/dist/components/form/input/date/views/dropdown-view.d.ts.map +1 -0
- package/dist/components/form/input/date/views/rotary-view.d.ts +2 -0
- package/dist/components/form/input/date/views/rotary-view.d.ts.map +1 -0
- package/dist/components/form/input/date/views/view-handler.d.ts +21 -0
- package/dist/components/form/input/date/views/view-handler.d.ts.map +1 -0
- package/dist/components/form/input/index.d.ts +24 -24
- package/dist/components/form/input/index.d.ts.map +1 -1
- package/dist/components/form/input/input-types.d.ts +102 -0
- package/dist/components/form/input/input-types.d.ts.map +1 -0
- package/dist/components/form/input/number-input.d.ts +4 -0
- package/dist/components/form/input/number-input.d.ts.map +1 -0
- package/dist/components/form/input/text-input.d.ts +36 -0
- package/dist/components/form/input/text-input.d.ts.map +1 -0
- package/dist/components/form/select.d.ts +41 -0
- package/dist/components/form/select.d.ts.map +1 -0
- package/dist/components/link.d.ts +14 -13
- package/dist/components/link.d.ts.map +1 -1
- package/dist/components/tooltip.d.ts +7 -7
- package/dist/components/tooltip.d.ts.map +1 -1
- package/dist/components/video.d.ts +6 -6
- package/dist/components/video.d.ts.map +1 -1
- package/dist/components.d.ts +50 -49
- package/dist/components.esm.js +600 -459
- package/dist/components.esm.js.map +1 -1
- package/dist/components.js +598 -456
- package/dist/components.js.map +1 -1
- package/dist/graphics/index.d.ts +2 -0
- package/dist/graphics/index.d.ts.map +1 -0
- package/dist/graphics/social-media/facebook-logo.d.ts +33 -0
- package/dist/graphics/social-media/facebook-logo.d.ts.map +1 -0
- package/dist/graphics/social-media/google-logo.d.ts +13 -0
- package/dist/graphics/social-media/google-logo.d.ts.map +1 -0
- package/dist/graphics/social-media/index.d.ts +8 -0
- package/dist/graphics/social-media/index.d.ts.map +1 -0
- package/dist/graphics/social-media/instagram-logo.d.ts +13 -0
- package/dist/graphics/social-media/instagram-logo.d.ts.map +1 -0
- package/dist/graphics/social-media/linkedin-logo.d.ts +26 -0
- package/dist/graphics/social-media/linkedin-logo.d.ts.map +1 -0
- package/dist/graphics/social-media/tiktok-logo.d.ts +26 -0
- package/dist/graphics/social-media/tiktok-logo.d.ts.map +1 -0
- package/dist/graphics/social-media/x-logo.d.ts +6 -0
- package/dist/graphics/social-media/x-logo.d.ts.map +1 -0
- package/dist/graphics/social-media/youtube-logo.d.ts +26 -0
- package/dist/graphics/social-media/youtube-logo.d.ts.map +1 -0
- package/dist/graphics.d.ts +141 -0
- package/dist/graphics.d.ts.map +1 -0
- package/dist/graphics.esm.js +241 -0
- package/dist/graphics.esm.js.map +1 -0
- package/dist/graphics.js +249 -0
- package/dist/graphics.js.map +1 -0
- package/dist/icons/index.d.ts +142 -143
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/square-and-arrow-up-right.d.ts +3 -0
- package/dist/icons/square-and-arrow-up-right.d.ts.map +1 -0
- package/dist/icons/square-and-pencil.d.ts +2 -2
- package/dist/icons/square-and-pencil.d.ts.map +1 -1
- package/dist/icons.d.ts +2 -4
- package/dist/icons.esm.js +2 -6
- package/dist/icons.esm.js.map +1 -1
- package/dist/icons.js +1 -6
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +50 -49
- package/dist/index.esm.js +600 -459
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +598 -456
- package/dist/index.js.map +1 -1
- package/dist/utils/string-manipulation.d.ts +23 -1
- package/dist/utils/string-manipulation.d.ts.map +1 -1
- package/dist/utils.d.ts +24 -2
- package/dist/utils.esm.js +76 -18
- package/dist/utils.esm.js.map +1 -1
- package/dist/utils.js +78 -17
- package/dist/utils.js.map +1 -1
- package/package.json +24 -32
- package/dist/components/mado-ui-provider.d.ts +0 -1
- package/dist/hooks/use-anime-scope.d.ts +0 -15
- package/dist/icons/square-and-pencil-fill.d.ts +0 -3
- package/dist/icons/square-and-pencil-fill.d.ts.map +0 -1
- package/dist/types.esm.js +0 -2
- package/dist/types.esm.js.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -395,13 +395,14 @@ function isPhoneNumber(tel) {
|
|
|
395
395
|
* @returns {string} string formatted
|
|
396
396
|
*/
|
|
397
397
|
function formatPhoneNumber(phoneNumber, options) {
|
|
398
|
-
const format = options?.format ||
|
|
399
|
-
if (format !==
|
|
400
|
-
phoneNumber = phoneNumber.replace(/\D/g,
|
|
398
|
+
const format = options?.format || "standard";
|
|
399
|
+
if (format !== "none") {
|
|
400
|
+
phoneNumber = phoneNumber.replace(/\D/g, "").slice(-10);
|
|
401
|
+
}
|
|
401
402
|
switch (format) {
|
|
402
|
-
case
|
|
403
|
+
case "dot":
|
|
403
404
|
phoneNumber = phoneNumber
|
|
404
|
-
.split(
|
|
405
|
+
.split("")
|
|
405
406
|
.map((char, index) => {
|
|
406
407
|
if (index === 2)
|
|
407
408
|
return `${char}.`;
|
|
@@ -409,11 +410,11 @@ function formatPhoneNumber(phoneNumber, options) {
|
|
|
409
410
|
return `${char}.`;
|
|
410
411
|
return char;
|
|
411
412
|
})
|
|
412
|
-
.join(
|
|
413
|
+
.join("");
|
|
413
414
|
break;
|
|
414
|
-
case
|
|
415
|
+
case "hyphenated":
|
|
415
416
|
phoneNumber = phoneNumber
|
|
416
|
-
.split(
|
|
417
|
+
.split("")
|
|
417
418
|
.map((char, index) => {
|
|
418
419
|
if (index === 2)
|
|
419
420
|
return `${char}-`;
|
|
@@ -421,11 +422,11 @@ function formatPhoneNumber(phoneNumber, options) {
|
|
|
421
422
|
return `${char}-`;
|
|
422
423
|
return char;
|
|
423
424
|
})
|
|
424
|
-
.join(
|
|
425
|
+
.join("");
|
|
425
426
|
break;
|
|
426
|
-
case
|
|
427
|
+
case "space":
|
|
427
428
|
phoneNumber = phoneNumber
|
|
428
|
-
.split(
|
|
429
|
+
.split("")
|
|
429
430
|
.map((char, index) => {
|
|
430
431
|
if (index === 2)
|
|
431
432
|
return `${char} `;
|
|
@@ -433,11 +434,11 @@ function formatPhoneNumber(phoneNumber, options) {
|
|
|
433
434
|
return `${char} `;
|
|
434
435
|
return char;
|
|
435
436
|
})
|
|
436
|
-
.join(
|
|
437
|
+
.join("");
|
|
437
438
|
break;
|
|
438
|
-
case
|
|
439
|
+
case "standard":
|
|
439
440
|
phoneNumber = phoneNumber
|
|
440
|
-
.split(
|
|
441
|
+
.split("")
|
|
441
442
|
.map((char, index) => {
|
|
442
443
|
if (index === 0)
|
|
443
444
|
return `(${char}`;
|
|
@@ -447,9 +448,10 @@ function formatPhoneNumber(phoneNumber, options) {
|
|
|
447
448
|
return `${char}-`;
|
|
448
449
|
return char;
|
|
449
450
|
})
|
|
450
|
-
.join(
|
|
451
|
+
.join("");
|
|
451
452
|
}
|
|
452
|
-
return `${options?.countryCode ? `+${options?.countryCode} ` :
|
|
453
|
+
return `${options?.countryCode ? `+${options?.countryCode} ` : ""}` +
|
|
454
|
+
phoneNumber;
|
|
453
455
|
}
|
|
454
456
|
/**
|
|
455
457
|
* # To Lower Case
|
|
@@ -461,7 +463,7 @@ function formatPhoneNumber(phoneNumber, options) {
|
|
|
461
463
|
* @returns The lowercase version of the input string, with the replacements, if provided.
|
|
462
464
|
*/
|
|
463
465
|
function toLowerCase(str, [delimiter, joiner]) {
|
|
464
|
-
return str.toLowerCase().replaceAll(delimiter ||
|
|
466
|
+
return str.toLowerCase().replaceAll(delimiter || " ", joiner || " ");
|
|
465
467
|
}
|
|
466
468
|
|
|
467
469
|
function twSort(className) {
|
|
@@ -469,85 +471,93 @@ function twSort(className) {
|
|
|
469
471
|
}
|
|
470
472
|
|
|
471
473
|
function Anchor({ as, className, disabled, href, onClick, target, rel, ...props }) {
|
|
472
|
-
const isExternal = `${href}`.startsWith(
|
|
473
|
-
const handleClick = e => {
|
|
474
|
+
const isExternal = `${href}`.startsWith("http"), hasHash = `${href}`.includes("#");
|
|
475
|
+
const handleClick = (e) => {
|
|
474
476
|
if (disabled)
|
|
475
477
|
return e.preventDefault();
|
|
476
478
|
onClick?.(e);
|
|
477
479
|
setTimeout(() => history.replaceState({}, document.title, location.pathname), 100);
|
|
478
480
|
};
|
|
479
|
-
const AnchorElement = as ||
|
|
480
|
-
return (jsxRuntime.jsx(AnchorElement, { ...props, "aria-disabled": disabled, className: twMerge(className, disabled &&
|
|
481
|
-
? rel ===
|
|
482
|
-
? `${rel} noreferrer noopener`
|
|
483
|
-
: `${rel} prefetch`
|
|
481
|
+
const AnchorElement = as || "a";
|
|
482
|
+
return (jsxRuntime.jsx(AnchorElement, { ...props, "aria-disabled": disabled, className: twMerge(className, disabled && "pointer-events-none"), href: href, target: target || (isExternal ? "_blank" : "_self"), onClick: hasHash ? handleClick : onClick, rel: rel !== undefined
|
|
483
|
+
? rel === "nofollow" ? `${rel} noreferrer noopener` : `${rel} prefetch`
|
|
484
484
|
: isExternal
|
|
485
|
-
?
|
|
486
|
-
:
|
|
485
|
+
? "nofollow noreferrer noopener"
|
|
486
|
+
: "prefetch" }));
|
|
487
487
|
}
|
|
488
488
|
// * Styles
|
|
489
|
-
const baseClasses = twSort(
|
|
490
|
-
const lineStaticClasses = tailwindMerge.twJoin(baseClasses,
|
|
491
|
-
const lineClasses = tailwindMerge.twJoin(lineStaticClasses,
|
|
492
|
-
const scaleXClasses =
|
|
493
|
-
const scaleYClasses =
|
|
489
|
+
const baseClasses = twSort("isolate inline-block cursor-pointer duration-300 ease-exponential after:absolute after:left-1/2 after:-z-10 after:-translate-x-1/2 after:duration-500 active:scale-95 active:after:opacity-100");
|
|
490
|
+
const lineStaticClasses = tailwindMerge.twJoin(baseClasses, "whitespace-nowrap after:-bottom-0.5 after:w-[calc(100%+0.15rem)] after:rounded-full after:border-1 after:border-current");
|
|
491
|
+
const lineClasses = tailwindMerge.twJoin(lineStaticClasses, "whitespace-nowrap transition-transform after:transition-transform after:ease-exponential");
|
|
492
|
+
const scaleXClasses = "after:scale-x-0 pointer-fine:hover:after:scale-x-100 active:after:scale-x-100";
|
|
493
|
+
const scaleYClasses = "after:scale-y-0 pointer-fine:hover:after:scale-y-100 active:after:scale-y-100";
|
|
494
494
|
const lineNormalClasses = tailwindMerge.twJoin([
|
|
495
495
|
lineClasses,
|
|
496
496
|
scaleYClasses,
|
|
497
|
-
|
|
497
|
+
"after:origin-bottom after:translate-y-0.5 active:after:translate-y-0 pointer-fine:hover:after:translate-y-0",
|
|
498
|
+
]);
|
|
499
|
+
const lineLtrClasses = tailwindMerge.twJoin([
|
|
500
|
+
lineClasses,
|
|
501
|
+
scaleXClasses,
|
|
502
|
+
"after:origin-left",
|
|
503
|
+
]);
|
|
504
|
+
const lineRtlClasses = tailwindMerge.twJoin([
|
|
505
|
+
lineClasses,
|
|
506
|
+
scaleXClasses,
|
|
507
|
+
"after:origin-right",
|
|
498
508
|
]);
|
|
499
|
-
const lineLtrClasses = tailwindMerge.twJoin([lineClasses, scaleXClasses, 'after:origin-left']);
|
|
500
|
-
const lineRtlClasses = tailwindMerge.twJoin([lineClasses, scaleXClasses, 'after:origin-right']);
|
|
501
509
|
const lineCenterClasses = tailwindMerge.twJoin([lineClasses, scaleXClasses]);
|
|
502
510
|
const lineLiftClasses = tailwindMerge.twJoin([
|
|
503
511
|
lineClasses,
|
|
504
512
|
scaleYClasses,
|
|
505
|
-
|
|
513
|
+
"after:origin-bottom after:translate-y-1 after:scale-x-75 active:after:translate-y-0 active:after:scale-x-100 pointer-fine:hover:after:translate-y-0 pointer-fine:hover:after:scale-x-100",
|
|
506
514
|
]);
|
|
507
|
-
const fillClasses = tailwindMerge.twJoin(baseClasses,
|
|
515
|
+
const fillClasses = tailwindMerge.twJoin(baseClasses, "whitespace-nowrap transition-[transform,color] after:top-1/2 after:h-[calc(100%+0.05rem)] after:w-[calc(100%+0.25rem)] after:-translate-y-1/2 after:rounded after:ease-exponential active:text-zinc-50 pointer-fine:hover:text-zinc-50");
|
|
508
516
|
// Define theme-specific fill color transition classes
|
|
509
|
-
const getFillColorTransitionClasses = (theme =
|
|
510
|
-
let fillColorTransitionClasses = tailwindMerge.twJoin(fillClasses,
|
|
517
|
+
const getFillColorTransitionClasses = (theme = "blue", customTheme) => {
|
|
518
|
+
let fillColorTransitionClasses = tailwindMerge.twJoin(fillClasses, "transition-transform after:bg-(--theme-color)");
|
|
511
519
|
switch (theme) {
|
|
512
|
-
case
|
|
513
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
520
|
+
case "blue":
|
|
521
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-blue)]");
|
|
514
522
|
break;
|
|
515
|
-
case
|
|
516
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
523
|
+
case "brown":
|
|
524
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-brow)]");
|
|
517
525
|
break;
|
|
518
|
-
case
|
|
519
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
526
|
+
case "green":
|
|
527
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-green)]");
|
|
520
528
|
break;
|
|
521
|
-
case
|
|
522
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
529
|
+
case "grey":
|
|
530
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-grey)]");
|
|
523
531
|
break;
|
|
524
|
-
case
|
|
525
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
532
|
+
case "sky-blue":
|
|
533
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-sky-blue)]");
|
|
526
534
|
break;
|
|
527
|
-
case
|
|
528
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
535
|
+
case "magenta":
|
|
536
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-magenta)]");
|
|
529
537
|
break;
|
|
530
|
-
case
|
|
531
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
538
|
+
case "orange":
|
|
539
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-orange)]");
|
|
532
540
|
break;
|
|
533
|
-
case
|
|
534
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
541
|
+
case "pink":
|
|
542
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-pink)]");
|
|
535
543
|
break;
|
|
536
|
-
case
|
|
537
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
544
|
+
case "purple":
|
|
545
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-purple)]");
|
|
538
546
|
break;
|
|
539
|
-
case
|
|
540
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
547
|
+
case "red":
|
|
548
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-red)]");
|
|
541
549
|
break;
|
|
542
|
-
case
|
|
543
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
550
|
+
case "violet":
|
|
551
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-violet)]");
|
|
544
552
|
break;
|
|
545
|
-
case
|
|
546
|
-
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses,
|
|
553
|
+
case "yellow":
|
|
554
|
+
fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, "after:[--theme-color:var(--color-ui-yellow)]");
|
|
547
555
|
break;
|
|
548
|
-
case
|
|
549
|
-
if (customTheme && customTheme.themeColor &&
|
|
550
|
-
|
|
556
|
+
case "custom":
|
|
557
|
+
if (customTheme && customTheme.themeColor &&
|
|
558
|
+
!customTheme.themeColor.includes("after:[--theme-color:")) {
|
|
559
|
+
throw new Error("`customTheme.themeColor` must modify the `--theme-color` variable on the ::after pseudo element. Otherwise, please use `customTheme.classes`.");
|
|
560
|
+
}
|
|
551
561
|
fillColorTransitionClasses = customTheme.themeColor
|
|
552
562
|
? twMerge(fillColorTransitionClasses, customTheme.themeColor)
|
|
553
563
|
: twMerge(fillClasses, customTheme.classes);
|
|
@@ -556,48 +566,50 @@ const getFillColorTransitionClasses = (theme = 'blue', customTheme) => {
|
|
|
556
566
|
return fillColorTransitionClasses;
|
|
557
567
|
};
|
|
558
568
|
// Define theme-specific fill center classes
|
|
559
|
-
const getFillCenterClasses = (theme =
|
|
560
|
-
let fillCenterColorClasses = tailwindMerge.twJoin(fillClasses,
|
|
569
|
+
const getFillCenterClasses = (theme = "blue", customTheme) => {
|
|
570
|
+
let fillCenterColorClasses = tailwindMerge.twJoin(fillClasses, "after:scale-x-50 after:scale-y-[0.25] after:bg-(--theme-color)/0 after:transition-[transform,background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-(--theme-color) pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-(--theme-color)");
|
|
561
571
|
switch (theme) {
|
|
562
|
-
case
|
|
563
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
572
|
+
case "blue":
|
|
573
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-blue)]");
|
|
564
574
|
break;
|
|
565
|
-
case
|
|
566
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
575
|
+
case "brown":
|
|
576
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-brown)]");
|
|
567
577
|
break;
|
|
568
|
-
case
|
|
569
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
578
|
+
case "green":
|
|
579
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-green)]");
|
|
570
580
|
break;
|
|
571
|
-
case
|
|
572
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
581
|
+
case "grey":
|
|
582
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-grey)]");
|
|
573
583
|
break;
|
|
574
|
-
case
|
|
575
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
584
|
+
case "sky-blue":
|
|
585
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-sky-blue)]");
|
|
576
586
|
break;
|
|
577
|
-
case
|
|
578
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
587
|
+
case "magenta":
|
|
588
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-magenta)]");
|
|
579
589
|
break;
|
|
580
|
-
case
|
|
581
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
590
|
+
case "orange":
|
|
591
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-orange)]");
|
|
582
592
|
break;
|
|
583
|
-
case
|
|
584
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
593
|
+
case "pink":
|
|
594
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-pink)]");
|
|
585
595
|
break;
|
|
586
|
-
case
|
|
587
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
596
|
+
case "purple":
|
|
597
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-purple)]");
|
|
588
598
|
break;
|
|
589
|
-
case
|
|
590
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
599
|
+
case "red":
|
|
600
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-red)]");
|
|
591
601
|
break;
|
|
592
|
-
case
|
|
593
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
602
|
+
case "violet":
|
|
603
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-violet)]");
|
|
594
604
|
break;
|
|
595
|
-
case
|
|
596
|
-
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses,
|
|
605
|
+
case "yellow":
|
|
606
|
+
fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, "after:[--theme-color:var(--color-ui-yellow)]");
|
|
597
607
|
break;
|
|
598
|
-
case
|
|
599
|
-
if (customTheme && customTheme.themeColor &&
|
|
600
|
-
|
|
608
|
+
case "custom":
|
|
609
|
+
if (customTheme && customTheme.themeColor &&
|
|
610
|
+
!customTheme.themeColor.includes("after:[--theme-color:")) {
|
|
611
|
+
throw new Error("`customTheme.themeColor` must modify the `--theme-color` variable on the ::after pseudo element. Otherwise, please use `customTheme.classes`.");
|
|
612
|
+
}
|
|
601
613
|
fillCenterColorClasses = customTheme.themeColor
|
|
602
614
|
? twMerge(fillCenterColorClasses, customTheme.themeColor)
|
|
603
615
|
: twMerge(fillClasses, customTheme.classes);
|
|
@@ -605,58 +617,66 @@ const getFillCenterClasses = (theme = 'blue', customTheme) => {
|
|
|
605
617
|
}
|
|
606
618
|
return fillCenterColorClasses;
|
|
607
619
|
};
|
|
608
|
-
const multilineBaseClasses = twSort(
|
|
609
|
-
const multilineLineStaticClasses =
|
|
610
|
-
const multilineNormalClasses = twSort(
|
|
611
|
-
const multilineClasses = tailwindMerge.twJoin(multilineBaseClasses,
|
|
612
|
-
const multilineLineClasses = tailwindMerge.twJoin(multilineClasses,
|
|
613
|
-
const multilineXClasses = tailwindMerge.twJoin(multilineLineClasses,
|
|
614
|
-
const multilineLineRtlClasses = tailwindMerge.twJoin([
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
+
const multilineBaseClasses = twSort("bg-linear-to-r from-current to-current bg-no-repeat active:scale-95");
|
|
621
|
+
const multilineLineStaticClasses = "underline";
|
|
622
|
+
const multilineNormalClasses = twSort("underline-offset-1 active:underline pointer-fine:hover:underline");
|
|
623
|
+
const multilineClasses = tailwindMerge.twJoin(multilineBaseClasses, "duration-500 ease-exponential");
|
|
624
|
+
const multilineLineClasses = tailwindMerge.twJoin(multilineClasses, "bg-[position:0%_100%] px-px pb-px transition-[background-size]");
|
|
625
|
+
const multilineXClasses = tailwindMerge.twJoin(multilineLineClasses, "bg-[size:0%_2px] focus-visible:bg-[size:100%_2px] active:bg-[size:100%_2px] pointer-fine:hover:bg-[size:100%_2px]");
|
|
626
|
+
const multilineLineRtlClasses = tailwindMerge.twJoin([
|
|
627
|
+
multilineXClasses,
|
|
628
|
+
"bg-[position:100%_100%]",
|
|
629
|
+
]);
|
|
630
|
+
const multilineLineCenterClasses = tailwindMerge.twJoin([
|
|
631
|
+
multilineXClasses,
|
|
632
|
+
"bg-[position:50%_100%]",
|
|
633
|
+
]);
|
|
634
|
+
const multilineLineLiftClasses = tailwindMerge.twJoin(multilineLineClasses, "bg-[size:auto_0px] focus-visible:bg-[size:auto_2px] active:bg-[size:auto_2px] pointer-fine:hover:bg-[size:auto_2px]");
|
|
635
|
+
const multilineFillBaseClasses = tailwindMerge.twJoin(multilineBaseClasses, "rounded px-0.5 py-0.75 focus-visible:text-zinc-50 active:text-zinc-50 pointer-fine:hover:text-zinc-50");
|
|
636
|
+
const getMultilineFillColorClasses = (theme = "blue", customTheme) => {
|
|
637
|
+
let multilineFillColorClasses = tailwindMerge.twJoin(multilineFillBaseClasses, "from-(--theme-color) to-(--theme-color) transition-[background-size,color]");
|
|
620
638
|
switch (theme) {
|
|
621
|
-
case
|
|
622
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
639
|
+
case "blue":
|
|
640
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-blue)]");
|
|
623
641
|
break;
|
|
624
|
-
case
|
|
625
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
642
|
+
case "brown":
|
|
643
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-brown)]");
|
|
626
644
|
break;
|
|
627
|
-
case
|
|
628
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
645
|
+
case "green":
|
|
646
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-green)]");
|
|
629
647
|
break;
|
|
630
|
-
case
|
|
631
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
648
|
+
case "grey":
|
|
649
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-grey)]");
|
|
632
650
|
break;
|
|
633
|
-
case
|
|
634
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
651
|
+
case "sky-blue":
|
|
652
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-sky-blue)]");
|
|
635
653
|
break;
|
|
636
|
-
case
|
|
637
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
654
|
+
case "magenta":
|
|
655
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-magenta)]");
|
|
638
656
|
break;
|
|
639
|
-
case
|
|
640
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
657
|
+
case "orange":
|
|
658
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-orange)]");
|
|
641
659
|
break;
|
|
642
|
-
case
|
|
643
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
660
|
+
case "pink":
|
|
661
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-pink)]");
|
|
644
662
|
break;
|
|
645
|
-
case
|
|
646
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
663
|
+
case "purple":
|
|
664
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-purple)]");
|
|
647
665
|
break;
|
|
648
|
-
case
|
|
649
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
666
|
+
case "red":
|
|
667
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-red)]");
|
|
650
668
|
break;
|
|
651
|
-
case
|
|
652
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
669
|
+
case "violet":
|
|
670
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-violet)]");
|
|
653
671
|
break;
|
|
654
|
-
case
|
|
655
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
672
|
+
case "yellow":
|
|
673
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-yellow)]");
|
|
656
674
|
break;
|
|
657
|
-
case
|
|
658
|
-
if (customTheme && customTheme.themeColor &&
|
|
659
|
-
|
|
675
|
+
case "custom":
|
|
676
|
+
if (customTheme && customTheme.themeColor &&
|
|
677
|
+
!customTheme.themeColor.includes("[--theme-color:")) {
|
|
678
|
+
throw new Error("`customTheme.themeColor` must modify the `--theme-color` variable. Otherwise, please use `customTheme.classes`.");
|
|
679
|
+
}
|
|
660
680
|
multilineFillColorClasses = customTheme.themeColor
|
|
661
681
|
? twMerge(multilineFillColorClasses, customTheme.themeColor)
|
|
662
682
|
: twMerge(multilineFillBaseClasses, customTheme.classes);
|
|
@@ -664,48 +684,50 @@ const getMultilineFillColorClasses = (theme = 'blue', customTheme) => {
|
|
|
664
684
|
}
|
|
665
685
|
return multilineFillColorClasses;
|
|
666
686
|
};
|
|
667
|
-
const getMultilineFillClasses = (theme =
|
|
668
|
-
let multilineFillColorClasses = tailwindMerge.twJoin(multilineFillBaseClasses,
|
|
687
|
+
const getMultilineFillClasses = (theme = "blue", customTheme) => {
|
|
688
|
+
let multilineFillColorClasses = tailwindMerge.twJoin(multilineFillBaseClasses, "from-(--theme-color)/0 to-(--theme-color)/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size,background-image,color] focus-visible:from-(--theme-color) focus-visible:to-(--theme-color) focus-visible:bg-[size:100%_100%] active:from-(--theme-color) active:to-(--theme-color) active:bg-[size:100%_100%] contrast-more:from-(--theme-color)/0 pointer-fine:hover:from-(--theme-color) pointer-fine:hover:to-(--theme-color) pointer-fine:hover:bg-[size:100%_100%]");
|
|
669
689
|
switch (theme) {
|
|
670
|
-
case
|
|
671
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
690
|
+
case "blue":
|
|
691
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-blue)]");
|
|
672
692
|
break;
|
|
673
|
-
case
|
|
674
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
693
|
+
case "brown":
|
|
694
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-brown)]");
|
|
675
695
|
break;
|
|
676
|
-
case
|
|
677
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
696
|
+
case "green":
|
|
697
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-green)]");
|
|
678
698
|
break;
|
|
679
|
-
case
|
|
680
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
699
|
+
case "grey":
|
|
700
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-grey)]");
|
|
681
701
|
break;
|
|
682
|
-
case
|
|
683
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
702
|
+
case "sky-blue":
|
|
703
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-sky-blue)]");
|
|
684
704
|
break;
|
|
685
|
-
case
|
|
686
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
705
|
+
case "magenta":
|
|
706
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-magenta)]");
|
|
687
707
|
break;
|
|
688
|
-
case
|
|
689
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
708
|
+
case "orange":
|
|
709
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-orange)]");
|
|
690
710
|
break;
|
|
691
|
-
case
|
|
692
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
711
|
+
case "pink":
|
|
712
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-pink)]");
|
|
693
713
|
break;
|
|
694
|
-
case
|
|
695
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
714
|
+
case "purple":
|
|
715
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-purple)]");
|
|
696
716
|
break;
|
|
697
|
-
case
|
|
698
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
717
|
+
case "red":
|
|
718
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-red)]");
|
|
699
719
|
break;
|
|
700
|
-
case
|
|
701
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
720
|
+
case "violet":
|
|
721
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-violet)]");
|
|
702
722
|
break;
|
|
703
|
-
case
|
|
704
|
-
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses,
|
|
723
|
+
case "yellow":
|
|
724
|
+
multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, "[--theme-color:var(--color-ui-yellow)]");
|
|
705
725
|
break;
|
|
706
|
-
case
|
|
707
|
-
if (customTheme && customTheme.themeColor &&
|
|
708
|
-
|
|
726
|
+
case "custom":
|
|
727
|
+
if (customTheme && customTheme.themeColor &&
|
|
728
|
+
!customTheme.themeColor.includes("[--theme-color:")) {
|
|
729
|
+
throw new Error("`customTheme.themeColor` must modify the `--theme-color` variable. Otherwise, please use `customTheme.classes`.");
|
|
730
|
+
}
|
|
709
731
|
multilineFillColorClasses = customTheme.themeColor
|
|
710
732
|
? twMerge(multilineFillColorClasses, customTheme.themeColor)
|
|
711
733
|
: twMerge(multilineFillBaseClasses, customTheme.classes);
|
|
@@ -713,18 +735,76 @@ const getMultilineFillClasses = (theme = 'blue', customTheme) => {
|
|
|
713
735
|
}
|
|
714
736
|
return multilineFillColorClasses;
|
|
715
737
|
};
|
|
716
|
-
const getMultilineFillLiftClasses = (theme =
|
|
717
|
-
return tailwindMerge.twJoin(getMultilineFillColorClasses(theme, customTheme),
|
|
738
|
+
const getMultilineFillLiftClasses = (theme = "blue", customTheme) => {
|
|
739
|
+
return tailwindMerge.twJoin(getMultilineFillColorClasses(theme, customTheme), "bg-[size:auto_0px] bg-[position:50%_100%] focus-visible:bg-[size:auto_100%] active:bg-[size:auto_100%] pointer-fine:hover:bg-[size:auto_100%]");
|
|
718
740
|
};
|
|
719
|
-
const getMultilineFillXClasses = (theme =
|
|
720
|
-
return tailwindMerge.twJoin(getMultilineFillColorClasses(theme, customTheme),
|
|
741
|
+
const getMultilineFillXClasses = (theme = "blue", customTheme) => {
|
|
742
|
+
return tailwindMerge.twJoin(getMultilineFillColorClasses(theme, customTheme), "bg-[size:0%_100%] focus-visible:bg-[size:100%_100%] active:bg-[size:100%_100%] pointer-fine:hover:bg-[size:100%_100%]");
|
|
721
743
|
};
|
|
722
|
-
const getMultilineFillRtlClasses = (theme =
|
|
723
|
-
return tailwindMerge.twJoin(getMultilineFillXClasses(theme, customTheme),
|
|
744
|
+
const getMultilineFillRtlClasses = (theme = "blue", customTheme) => {
|
|
745
|
+
return tailwindMerge.twJoin(getMultilineFillXClasses(theme, customTheme), "bg-[position:100%_auto]");
|
|
724
746
|
};
|
|
725
|
-
const getMultilineFillCenterClasses = (theme =
|
|
726
|
-
return tailwindMerge.twJoin(getMultilineFillXClasses(theme, customTheme),
|
|
747
|
+
const getMultilineFillCenterClasses = (theme = "blue", customTheme) => {
|
|
748
|
+
return tailwindMerge.twJoin(getMultilineFillXClasses(theme, customTheme), "bg-[position:50%_auto]");
|
|
727
749
|
};
|
|
750
|
+
function getLinkClasses({ customTheme, theme, type }) {
|
|
751
|
+
switch (type) {
|
|
752
|
+
case "static":
|
|
753
|
+
return lineStaticClasses;
|
|
754
|
+
case "ltr":
|
|
755
|
+
return lineLtrClasses;
|
|
756
|
+
case "rtl":
|
|
757
|
+
return lineRtlClasses;
|
|
758
|
+
case "center":
|
|
759
|
+
return lineCenterClasses;
|
|
760
|
+
case "lift":
|
|
761
|
+
return lineLiftClasses;
|
|
762
|
+
case "fill":
|
|
763
|
+
return getFillCenterClasses(theme, customTheme);
|
|
764
|
+
case "fill-ltr":
|
|
765
|
+
return tailwindMerge.twJoin([
|
|
766
|
+
getFillColorTransitionClasses(theme, customTheme),
|
|
767
|
+
scaleXClasses,
|
|
768
|
+
"after:origin-left",
|
|
769
|
+
]);
|
|
770
|
+
case "fill-rtl":
|
|
771
|
+
return tailwindMerge.twJoin([
|
|
772
|
+
getFillColorTransitionClasses(theme, customTheme),
|
|
773
|
+
scaleXClasses,
|
|
774
|
+
"after:origin-right",
|
|
775
|
+
]);
|
|
776
|
+
case "fill-lift":
|
|
777
|
+
return tailwindMerge.twJoin([
|
|
778
|
+
getFillColorTransitionClasses(theme, customTheme),
|
|
779
|
+
scaleYClasses,
|
|
780
|
+
"after:origin-bottom",
|
|
781
|
+
]);
|
|
782
|
+
case "multiline":
|
|
783
|
+
return multilineNormalClasses;
|
|
784
|
+
case "multiline-static":
|
|
785
|
+
return multilineLineStaticClasses;
|
|
786
|
+
case "multiline-ltr":
|
|
787
|
+
return multilineXClasses;
|
|
788
|
+
case "multiline-rtl":
|
|
789
|
+
return multilineLineRtlClasses;
|
|
790
|
+
case "multiline-center":
|
|
791
|
+
return multilineLineCenterClasses;
|
|
792
|
+
case "multiline-lift":
|
|
793
|
+
return multilineLineLiftClasses;
|
|
794
|
+
case "multiline-fill":
|
|
795
|
+
return getMultilineFillClasses(theme, customTheme);
|
|
796
|
+
case "multiline-fill-ltr":
|
|
797
|
+
return getMultilineFillXClasses(theme, customTheme);
|
|
798
|
+
case "multiline-fill-rtl":
|
|
799
|
+
return getMultilineFillRtlClasses(theme, customTheme);
|
|
800
|
+
case "multiline-fill-center":
|
|
801
|
+
return getMultilineFillCenterClasses(theme, customTheme);
|
|
802
|
+
case "multiline-fill-lift":
|
|
803
|
+
return getMultilineFillLiftClasses(theme, customTheme);
|
|
804
|
+
default:
|
|
805
|
+
return lineNormalClasses;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
728
808
|
/**
|
|
729
809
|
* # Link
|
|
730
810
|
*
|
|
@@ -754,54 +834,8 @@ const getMultilineFillCenterClasses = (theme = 'blue', customTheme) => {
|
|
|
754
834
|
* @example
|
|
755
835
|
* <Link href='/about' type='fill-ltr' theme='red' title='About Us'>Learn more about our company</Link>
|
|
756
836
|
*/
|
|
757
|
-
function Link({ as, className, customTheme, theme =
|
|
758
|
-
const
|
|
759
|
-
switch (type) {
|
|
760
|
-
case 'static':
|
|
761
|
-
return lineStaticClasses;
|
|
762
|
-
case 'ltr':
|
|
763
|
-
return lineLtrClasses;
|
|
764
|
-
case 'rtl':
|
|
765
|
-
return lineRtlClasses;
|
|
766
|
-
case 'center':
|
|
767
|
-
return lineCenterClasses;
|
|
768
|
-
case 'lift':
|
|
769
|
-
return lineLiftClasses;
|
|
770
|
-
case 'fill':
|
|
771
|
-
return getFillCenterClasses(theme, customTheme);
|
|
772
|
-
case 'fill-ltr':
|
|
773
|
-
return tailwindMerge.twJoin([getFillColorTransitionClasses(theme, customTheme), scaleXClasses, 'after:origin-left']);
|
|
774
|
-
case 'fill-rtl':
|
|
775
|
-
return tailwindMerge.twJoin([getFillColorTransitionClasses(theme, customTheme), scaleXClasses, 'after:origin-right']);
|
|
776
|
-
case 'fill-lift':
|
|
777
|
-
return tailwindMerge.twJoin([getFillColorTransitionClasses(theme, customTheme), scaleYClasses, 'after:origin-bottom']);
|
|
778
|
-
case 'multiline':
|
|
779
|
-
return multilineNormalClasses;
|
|
780
|
-
case 'multiline-static':
|
|
781
|
-
return multilineLineStaticClasses;
|
|
782
|
-
case 'multiline-ltr':
|
|
783
|
-
return multilineXClasses;
|
|
784
|
-
case 'multiline-rtl':
|
|
785
|
-
return multilineLineRtlClasses;
|
|
786
|
-
case 'multiline-center':
|
|
787
|
-
return multilineLineCenterClasses;
|
|
788
|
-
case 'multiline-lift':
|
|
789
|
-
return multilineLineLiftClasses;
|
|
790
|
-
case 'multiline-fill':
|
|
791
|
-
return getMultilineFillClasses(theme, customTheme);
|
|
792
|
-
case 'multiline-fill-ltr':
|
|
793
|
-
return getMultilineFillXClasses(theme, customTheme);
|
|
794
|
-
case 'multiline-fill-rtl':
|
|
795
|
-
return getMultilineFillRtlClasses(theme, customTheme);
|
|
796
|
-
case 'multiline-fill-center':
|
|
797
|
-
return getMultilineFillCenterClasses(theme, customTheme);
|
|
798
|
-
case 'multiline-fill-lift':
|
|
799
|
-
return getMultilineFillLiftClasses(theme, customTheme);
|
|
800
|
-
default:
|
|
801
|
-
return lineNormalClasses;
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
const linkClasses = getLinkClasses();
|
|
837
|
+
function Link({ as, className, customTheme, theme = "blue", type, ...props }) {
|
|
838
|
+
const linkClasses = getLinkClasses({ customTheme, theme, type });
|
|
805
839
|
const LinkElement = as || Anchor;
|
|
806
840
|
return jsxRuntime.jsx(LinkElement, { ...props, className: twMerge(linkClasses, className) });
|
|
807
841
|
}
|
|
@@ -832,7 +866,9 @@ function Link({ as, className, customTheme, theme = 'blue', type, ...props }) {
|
|
|
832
866
|
*/
|
|
833
867
|
function createLink(config) {
|
|
834
868
|
return function ExtendedLink({ theme, className, customTheme, type, as, ...props }) {
|
|
835
|
-
const finalType = type !== undefined
|
|
869
|
+
const finalType = type !== undefined
|
|
870
|
+
? type
|
|
871
|
+
: config.type, finalTheme = theme !== undefined ? theme : config.defaultTheme;
|
|
836
872
|
const configClassName = config.className;
|
|
837
873
|
const shouldOverrideElement = !Boolean(as) && Boolean(config.as);
|
|
838
874
|
const linkProps = {
|
|
@@ -847,13 +883,17 @@ function createLink(config) {
|
|
|
847
883
|
else if (as) {
|
|
848
884
|
linkProps.as = as;
|
|
849
885
|
}
|
|
850
|
-
if (finalTheme && typeof finalTheme ===
|
|
886
|
+
if (finalTheme && typeof finalTheme === "string" && config.theme &&
|
|
887
|
+
finalTheme in config.theme) {
|
|
851
888
|
const extendedTheme = config.theme[finalTheme];
|
|
852
|
-
if (customTheme)
|
|
853
|
-
return (jsxRuntime.jsx(Link, { ...linkProps, theme:
|
|
889
|
+
if (customTheme) {
|
|
890
|
+
return (jsxRuntime.jsx(Link, { ...linkProps, theme: "custom", customTheme: customTheme, className: twMerge(configClassName, extendedTheme.className, className) }));
|
|
891
|
+
}
|
|
854
892
|
let resolvedCustomTheme;
|
|
855
893
|
if (extendedTheme.customTheme.themeColor) {
|
|
856
|
-
const isMultilineType = finalType
|
|
894
|
+
const isMultilineType = finalType
|
|
895
|
+
? finalType.includes("multiline")
|
|
896
|
+
: false;
|
|
857
897
|
resolvedCustomTheme = {
|
|
858
898
|
themeColor: isMultilineType
|
|
859
899
|
? extendedTheme.customTheme.themeColor.multilineFill
|
|
@@ -865,7 +905,7 @@ function createLink(config) {
|
|
|
865
905
|
classes: extendedTheme.customTheme.classes,
|
|
866
906
|
};
|
|
867
907
|
}
|
|
868
|
-
return (jsxRuntime.jsx(Link, { ...linkProps, theme:
|
|
908
|
+
return (jsxRuntime.jsx(Link, { ...linkProps, theme: "custom", customTheme: resolvedCustomTheme, className: twMerge(configClassName, extendedTheme.className, className) }));
|
|
869
909
|
}
|
|
870
910
|
return (jsxRuntime.jsx(Link, { ...linkProps, theme: finalTheme, className: twMerge(configClassName, className), customTheme: customTheme }));
|
|
871
911
|
};
|
|
@@ -1139,32 +1179,44 @@ function Details({ as = 'div', className, ...props }) {
|
|
|
1139
1179
|
}
|
|
1140
1180
|
|
|
1141
1181
|
function DropDownButton({ arrow = true, as, children, className, ...props }) {
|
|
1142
|
-
return (jsxRuntime.jsxs(react.MenuButton, { ...props, as: as ||
|
|
1143
|
-
(typeof arrow ===
|
|
1182
|
+
return (jsxRuntime.jsxs(react.MenuButton, { ...props, as: as || "button", className: tailwindMerge.twJoin("group/button", className), children: [children, arrow &&
|
|
1183
|
+
(typeof arrow === "boolean"
|
|
1184
|
+
? (jsxRuntime.jsx(ChevronDown, { className: "-top-px -mr-1 ml-2 w-4 animate-flip-again group-data-open/button:animate-flip" }))
|
|
1185
|
+
: arrow)] }));
|
|
1144
1186
|
}
|
|
1145
1187
|
function DropDownItem({ as, ...props }) {
|
|
1146
|
-
return jsxRuntime.jsx(react.MenuItem, { ...props, as: as ||
|
|
1188
|
+
return jsxRuntime.jsx(react.MenuItem, { ...props, as: as || "div" });
|
|
1147
1189
|
}
|
|
1148
1190
|
function DropDownItems({ anchor, children, className, containerClassName, style, ...props }) {
|
|
1149
1191
|
const getAnchorProps = () => {
|
|
1150
|
-
let initialAnchor = {
|
|
1192
|
+
let initialAnchor = {
|
|
1193
|
+
gap: "1rem",
|
|
1194
|
+
padding: "1rem",
|
|
1195
|
+
to: "bottom start",
|
|
1196
|
+
};
|
|
1151
1197
|
if (anchor) {
|
|
1152
|
-
if (typeof anchor ===
|
|
1198
|
+
if (typeof anchor === "string")
|
|
1153
1199
|
initialAnchor.to = anchor;
|
|
1154
|
-
if (typeof anchor ===
|
|
1200
|
+
if (typeof anchor === "object") {
|
|
1155
1201
|
initialAnchor = { ...initialAnchor, ...anchor };
|
|
1202
|
+
}
|
|
1156
1203
|
}
|
|
1157
1204
|
return initialAnchor;
|
|
1158
1205
|
};
|
|
1159
1206
|
const anchorProps = getAnchorProps();
|
|
1160
|
-
return (jsxRuntime.jsx(react.MenuItems, { ...props, anchor: anchorProps, className: twMerge(
|
|
1207
|
+
return (jsxRuntime.jsx(react.MenuItems, { ...props, anchor: anchorProps, className: twMerge("grid grid-rows-1fr rounded-xl shadow-xl transition-rows duration-500 ease-exponential not-data-open:not-data-enter:not-data-leave:grid-rows-0fr data-closed:grid-rows-0fr", containerClassName), static: props.static, style: { ...style, minWidth: "var(--button-width)" }, transition: true, children: (bag) => (jsxRuntime.jsx("div", { className: "overflow-y-scroll", children: jsxRuntime.jsx("div", { className: twMerge("rounded-xl bg-neutral-50/20 px-6 py-5 backdrop-blur-md backdrop-brightness-150", className), children: typeof children === "function" ? children(bag) : children }) })) }));
|
|
1161
1208
|
}
|
|
1162
1209
|
function DropDownSection({ children, label, labelProps, separatorAbove, separatorBelow, ...props }) {
|
|
1163
|
-
const { labelClassName, ...restLabelProps } = {
|
|
1164
|
-
|
|
1210
|
+
const { labelClassName, ...restLabelProps } = {
|
|
1211
|
+
labelClassName: labelProps?.className || "",
|
|
1212
|
+
...labelProps,
|
|
1213
|
+
};
|
|
1214
|
+
return (jsxRuntime.jsx(react.MenuSection, { ...props, children: (sectionBag) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [separatorAbove && jsxRuntime.jsx(DropDownSeparator, {}), label && (jsxRuntime.jsx(react.MenuHeading, { ...restLabelProps, className: (headingBag) => twMerge("text-[larger] font-bold text-current/80", typeof labelClassName === "function"
|
|
1215
|
+
? labelClassName(headingBag)
|
|
1216
|
+
: labelClassName), children: label })), typeof children === "function" ? children(sectionBag) : children, separatorBelow && jsxRuntime.jsx(DropDownSeparator, {})] })) }));
|
|
1165
1217
|
}
|
|
1166
1218
|
function DropDownSeparator({ as, className, ...props }) {
|
|
1167
|
-
return (jsxRuntime.jsx(react.MenuSeparator, { ...props, as: as ||
|
|
1219
|
+
return (jsxRuntime.jsx(react.MenuSeparator, { ...props, as: as || "div", className: (bag) => twMerge("my-4 block h-px rounded-full bg-neutral-950/20", typeof className === "function" ? className(bag) : className) }));
|
|
1168
1220
|
}
|
|
1169
1221
|
function DropDown(props) {
|
|
1170
1222
|
return jsxRuntime.jsx(react.Menu, { ...props });
|
|
@@ -2308,7 +2360,7 @@ function isOverflowElement(element) {
|
|
|
2308
2360
|
overflowX,
|
|
2309
2361
|
overflowY,
|
|
2310
2362
|
display
|
|
2311
|
-
} = getComputedStyle(element);
|
|
2363
|
+
} = getComputedStyle$1(element);
|
|
2312
2364
|
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
2313
2365
|
}
|
|
2314
2366
|
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
@@ -2330,7 +2382,7 @@ const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspect
|
|
|
2330
2382
|
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
2331
2383
|
function isContainingBlock(elementOrCss) {
|
|
2332
2384
|
const webkit = isWebKit();
|
|
2333
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2385
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
2334
2386
|
|
|
2335
2387
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2336
2388
|
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
@@ -2356,7 +2408,7 @@ const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#documen
|
|
|
2356
2408
|
function isLastTraversableNode(node) {
|
|
2357
2409
|
return lastTraversableNodeNames.has(getNodeName(node));
|
|
2358
2410
|
}
|
|
2359
|
-
function getComputedStyle(element) {
|
|
2411
|
+
function getComputedStyle$1(element) {
|
|
2360
2412
|
return getWindow(element).getComputedStyle(element);
|
|
2361
2413
|
}
|
|
2362
2414
|
function getNodeScroll(element) {
|
|
@@ -2418,7 +2470,7 @@ function getFrameElement(win) {
|
|
|
2418
2470
|
}
|
|
2419
2471
|
|
|
2420
2472
|
function getCssDimensions(element) {
|
|
2421
|
-
const css = getComputedStyle(element);
|
|
2473
|
+
const css = getComputedStyle$1(element);
|
|
2422
2474
|
// In testing environments, the `width` and `height` properties are empty
|
|
2423
2475
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
2424
2476
|
let width = parseFloat(css.width) || 0;
|
|
@@ -2523,7 +2575,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
2523
2575
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2524
2576
|
const iframeScale = getScale(currentIFrame);
|
|
2525
2577
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2526
|
-
const css = getComputedStyle(currentIFrame);
|
|
2578
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
2527
2579
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2528
2580
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2529
2581
|
x *= iframeScale.x;
|
|
@@ -2554,14 +2606,9 @@ function getWindowScrollBarX(element, rect) {
|
|
|
2554
2606
|
return rect.left + leftScroll;
|
|
2555
2607
|
}
|
|
2556
2608
|
|
|
2557
|
-
function getHTMLOffset(documentElement, scroll
|
|
2558
|
-
if (ignoreScrollbarX === void 0) {
|
|
2559
|
-
ignoreScrollbarX = false;
|
|
2560
|
-
}
|
|
2609
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
2561
2610
|
const htmlRect = documentElement.getBoundingClientRect();
|
|
2562
|
-
const x = htmlRect.left + scroll.scrollLeft - (
|
|
2563
|
-
// RTL <body> scrollbar.
|
|
2564
|
-
getWindowScrollBarX(documentElement, htmlRect));
|
|
2611
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
2565
2612
|
const y = htmlRect.top + scroll.scrollTop;
|
|
2566
2613
|
return {
|
|
2567
2614
|
x,
|
|
@@ -2600,7 +2647,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
2600
2647
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2601
2648
|
}
|
|
2602
2649
|
}
|
|
2603
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll
|
|
2650
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2604
2651
|
return {
|
|
2605
2652
|
width: rect.width * scale.x,
|
|
2606
2653
|
height: rect.height * scale.y,
|
|
@@ -2623,7 +2670,7 @@ function getDocumentRect(element) {
|
|
|
2623
2670
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2624
2671
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2625
2672
|
const y = -scroll.scrollTop;
|
|
2626
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
2673
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
2627
2674
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2628
2675
|
}
|
|
2629
2676
|
return {
|
|
@@ -2634,6 +2681,10 @@ function getDocumentRect(element) {
|
|
|
2634
2681
|
};
|
|
2635
2682
|
}
|
|
2636
2683
|
|
|
2684
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
2685
|
+
// calculation is affected by unusual styles.
|
|
2686
|
+
// Most scrollbars leave 15-18px of space.
|
|
2687
|
+
const SCROLLBAR_MAX = 25;
|
|
2637
2688
|
function getViewportRect(element, strategy) {
|
|
2638
2689
|
const win = getWindow(element);
|
|
2639
2690
|
const html = getDocumentElement(element);
|
|
@@ -2651,6 +2702,24 @@ function getViewportRect(element, strategy) {
|
|
|
2651
2702
|
y = visualViewport.offsetTop;
|
|
2652
2703
|
}
|
|
2653
2704
|
}
|
|
2705
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
2706
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
2707
|
+
// visual width of the <html> but this is not considered in the size
|
|
2708
|
+
// of `html.clientWidth`.
|
|
2709
|
+
if (windowScrollbarX <= 0) {
|
|
2710
|
+
const doc = html.ownerDocument;
|
|
2711
|
+
const body = doc.body;
|
|
2712
|
+
const bodyStyles = getComputedStyle(body);
|
|
2713
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
2714
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
2715
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
2716
|
+
width -= clippingStableScrollbarWidth;
|
|
2717
|
+
}
|
|
2718
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
2719
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
2720
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
2721
|
+
width += windowScrollbarX;
|
|
2722
|
+
}
|
|
2654
2723
|
return {
|
|
2655
2724
|
width,
|
|
2656
2725
|
height,
|
|
@@ -2701,7 +2770,7 @@ function hasFixedPositionAncestor(element, stopNode) {
|
|
|
2701
2770
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2702
2771
|
return false;
|
|
2703
2772
|
}
|
|
2704
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2773
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2705
2774
|
}
|
|
2706
2775
|
|
|
2707
2776
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -2714,12 +2783,12 @@ function getClippingElementAncestors(element, cache) {
|
|
|
2714
2783
|
}
|
|
2715
2784
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
2716
2785
|
let currentContainingBlockComputedStyle = null;
|
|
2717
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
2786
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
2718
2787
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2719
2788
|
|
|
2720
2789
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2721
2790
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2722
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
2791
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
2723
2792
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2724
2793
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2725
2794
|
currentContainingBlockComputedStyle = null;
|
|
@@ -2820,11 +2889,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
2820
2889
|
}
|
|
2821
2890
|
|
|
2822
2891
|
function isStaticPositioned(element) {
|
|
2823
|
-
return getComputedStyle(element).position === 'static';
|
|
2892
|
+
return getComputedStyle$1(element).position === 'static';
|
|
2824
2893
|
}
|
|
2825
2894
|
|
|
2826
2895
|
function getTrueOffsetParent(element, polyfill) {
|
|
2827
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
2896
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
2828
2897
|
return null;
|
|
2829
2898
|
}
|
|
2830
2899
|
if (polyfill) {
|
|
@@ -2885,7 +2954,7 @@ const getElementRects = async function (data) {
|
|
|
2885
2954
|
};
|
|
2886
2955
|
|
|
2887
2956
|
function isRTL(element) {
|
|
2888
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
2957
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
2889
2958
|
}
|
|
2890
2959
|
|
|
2891
2960
|
const platform = {
|
|
@@ -3461,19 +3530,20 @@ const arrow = (options, deps) => ({
|
|
|
3461
3530
|
|
|
3462
3531
|
function TooltipTrigger({ as, asChild = false, children, ...props }) {
|
|
3463
3532
|
const TooltipTriggerElement = as || react.Button;
|
|
3464
|
-
if (asChild && React.isValidElement(children))
|
|
3533
|
+
if (asChild && React.isValidElement(children)) {
|
|
3465
3534
|
return React.cloneElement(children, props);
|
|
3535
|
+
}
|
|
3466
3536
|
return jsxRuntime.jsx(TooltipTriggerElement, { ...props, children: children });
|
|
3467
3537
|
}
|
|
3468
3538
|
function TooltipPanel({ as, children, className, style, ...props }) {
|
|
3469
|
-
const TooltipPanelElement = as ||
|
|
3470
|
-
return (jsxRuntime.jsx(TooltipPanelElement, { ...props, className: twMerge(
|
|
3539
|
+
const TooltipPanelElement = as || "div";
|
|
3540
|
+
return (jsxRuntime.jsx(TooltipPanelElement, { ...props, className: twMerge("absolute top-0 left-0 z-50 w-max rounded-md bg-neutral-50 px-2 py-1 text-sm text-neutral-950 opacity-0 shadow-lg outline-1 outline-neutral-400 data-portal:fixed data-ready:animate-fade-in dark:bg-neutral-800 dark:text-neutral-50 dark:shadow-none dark:-outline-offset-1 dark:outline-neutral-600", className), style: style, children: children }));
|
|
3471
3541
|
}
|
|
3472
|
-
function Tooltip({ anchor =
|
|
3542
|
+
function Tooltip({ anchor = "top", arrow: arrow$1, arrowClassName, children, delay = 500, offset: offset$1 = 8, onClose, onOpen, portal, }) {
|
|
3473
3543
|
const [isOpen, setIsOpen] = React.useState(false), timeoutRef = React.useRef(undefined), arrowRef = React.useRef(null);
|
|
3474
|
-
const [bodyElement, setBodyElement] = React.useState(() => typeof window !==
|
|
3544
|
+
const [bodyElement, setBodyElement] = React.useState(() => typeof window !== "undefined" ? document.body : null);
|
|
3475
3545
|
React.useEffect(() => {
|
|
3476
|
-
if (typeof window !==
|
|
3546
|
+
if (typeof window !== "undefined" && !bodyElement) {
|
|
3477
3547
|
const documentBody = document.body;
|
|
3478
3548
|
setBodyElement(documentBody);
|
|
3479
3549
|
}
|
|
@@ -3490,10 +3560,12 @@ function Tooltip({ anchor = 'top', arrow: arrow$1, arrowClassName, children, del
|
|
|
3490
3560
|
elements.floating.style.maxWidth = width;
|
|
3491
3561
|
},
|
|
3492
3562
|
}),
|
|
3493
|
-
...(arrowRef.current
|
|
3563
|
+
...(arrowRef.current
|
|
3564
|
+
? [arrow({ element: arrowRef.current })]
|
|
3565
|
+
: []),
|
|
3494
3566
|
],
|
|
3495
3567
|
placement: anchor,
|
|
3496
|
-
strategy: portal ?
|
|
3568
|
+
strategy: portal ? "fixed" : "absolute",
|
|
3497
3569
|
whileElementsMounted: autoUpdate,
|
|
3498
3570
|
open: isOpen,
|
|
3499
3571
|
});
|
|
@@ -3520,37 +3592,41 @@ function Tooltip({ anchor = 'top', arrow: arrow$1, arrowClassName, children, del
|
|
|
3520
3592
|
clearTimeout(timeoutRef.current);
|
|
3521
3593
|
};
|
|
3522
3594
|
}, []);
|
|
3523
|
-
const content = typeof children ===
|
|
3595
|
+
const content = typeof children === "function"
|
|
3596
|
+
? children({ openTooltip, closeTooltip })
|
|
3597
|
+
: children;
|
|
3524
3598
|
const triggerElement = findComponentByType(content, TooltipTrigger), contentElement = findComponentByType(content, TooltipPanel);
|
|
3525
|
-
if (!contentElement)
|
|
3526
|
-
throw new Error(
|
|
3527
|
-
|
|
3528
|
-
|
|
3599
|
+
if (!contentElement) {
|
|
3600
|
+
throw new Error("TooltipPanel must be defined in Tooltip children");
|
|
3601
|
+
}
|
|
3602
|
+
if (!triggerElement && typeof children !== "function") {
|
|
3603
|
+
throw new Error("TooltipTrigger must be provided when not using render prop pattern");
|
|
3604
|
+
}
|
|
3529
3605
|
const arrowStyles = {};
|
|
3530
3606
|
const reversedAnchor = {
|
|
3531
|
-
top:
|
|
3532
|
-
right:
|
|
3533
|
-
bottom:
|
|
3534
|
-
left:
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3607
|
+
top: "bottom",
|
|
3608
|
+
right: "left",
|
|
3609
|
+
bottom: "top",
|
|
3610
|
+
left: "right",
|
|
3611
|
+
"top-start": "bottom left",
|
|
3612
|
+
"top-end": "bottom right",
|
|
3613
|
+
"right-start": "top left",
|
|
3614
|
+
"right-end": "bottom left",
|
|
3615
|
+
"bottom-start": "top left",
|
|
3616
|
+
"bottom-end": "top right",
|
|
3617
|
+
"left-start": "top right",
|
|
3618
|
+
"left-end": "bottom right",
|
|
3543
3619
|
}[placement];
|
|
3544
3620
|
if (middlewareData.arrow && arrow$1) {
|
|
3545
3621
|
const { x, y } = middlewareData.arrow;
|
|
3546
3622
|
const staticSide = {
|
|
3547
|
-
top:
|
|
3548
|
-
right:
|
|
3549
|
-
bottom:
|
|
3550
|
-
left:
|
|
3551
|
-
}[placement.split(
|
|
3623
|
+
top: "bottom",
|
|
3624
|
+
right: "left",
|
|
3625
|
+
bottom: "top",
|
|
3626
|
+
left: "right",
|
|
3627
|
+
}[placement.split("-")[0]];
|
|
3552
3628
|
if (staticSide) {
|
|
3553
|
-
arrowStyles[staticSide] =
|
|
3629
|
+
arrowStyles[staticSide] = "-4px";
|
|
3554
3630
|
if (x != null)
|
|
3555
3631
|
arrowStyles.left = `${x}px`;
|
|
3556
3632
|
if (y != null)
|
|
@@ -3559,68 +3635,68 @@ function Tooltip({ anchor = 'top', arrow: arrow$1, arrowClassName, children, del
|
|
|
3559
3635
|
}
|
|
3560
3636
|
const getArrowLocationClasses = () => {
|
|
3561
3637
|
switch (placement) {
|
|
3562
|
-
case
|
|
3563
|
-
case
|
|
3564
|
-
case
|
|
3565
|
-
return
|
|
3566
|
-
case
|
|
3567
|
-
case
|
|
3568
|
-
case
|
|
3569
|
-
return
|
|
3570
|
-
case
|
|
3571
|
-
case
|
|
3572
|
-
case
|
|
3573
|
-
return
|
|
3574
|
-
case
|
|
3575
|
-
case
|
|
3576
|
-
case
|
|
3577
|
-
return
|
|
3638
|
+
case "bottom":
|
|
3639
|
+
case "bottom-end":
|
|
3640
|
+
case "bottom-start":
|
|
3641
|
+
return "-translate-y-1";
|
|
3642
|
+
case "top":
|
|
3643
|
+
case "top-end":
|
|
3644
|
+
case "top-start":
|
|
3645
|
+
return "rotate-180 translate-y-1";
|
|
3646
|
+
case "left":
|
|
3647
|
+
case "left-end":
|
|
3648
|
+
case "left-start":
|
|
3649
|
+
return "rotate-90 translate-x-2";
|
|
3650
|
+
case "right":
|
|
3651
|
+
case "right-end":
|
|
3652
|
+
case "right-start":
|
|
3653
|
+
return "-rotate-90 -translate-x-2";
|
|
3578
3654
|
}
|
|
3579
3655
|
};
|
|
3580
3656
|
const arrowLocationClasses = getArrowLocationClasses();
|
|
3581
|
-
const handleMouseEnter = e => {
|
|
3657
|
+
const handleMouseEnter = (e) => {
|
|
3582
3658
|
openTooltip();
|
|
3583
3659
|
triggerElement?.props.onMouseEnter?.(e);
|
|
3584
3660
|
};
|
|
3585
|
-
const handleMouseLeave = e => {
|
|
3661
|
+
const handleMouseLeave = (e) => {
|
|
3586
3662
|
triggerElement?.props.onMouseLeave?.(e);
|
|
3587
3663
|
closeTooltip();
|
|
3588
3664
|
};
|
|
3589
|
-
const handleTouchStart = e => {
|
|
3665
|
+
const handleTouchStart = (e) => {
|
|
3590
3666
|
openTooltip();
|
|
3591
3667
|
triggerElement?.props.onTouchStart?.(e);
|
|
3592
3668
|
};
|
|
3593
|
-
const handleFocus = e => {
|
|
3669
|
+
const handleFocus = (e) => {
|
|
3594
3670
|
triggerElement?.props.onFocus?.(e);
|
|
3595
3671
|
openTooltip();
|
|
3596
3672
|
};
|
|
3597
|
-
const handleBlur = e => {
|
|
3673
|
+
const handleBlur = (e) => {
|
|
3598
3674
|
triggerElement?.props.onBlur?.(e);
|
|
3599
3675
|
closeTooltip();
|
|
3600
3676
|
};
|
|
3601
3677
|
const tooltipContent = (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isOpen &&
|
|
3602
3678
|
contentElement &&
|
|
3603
3679
|
React.cloneElement(contentElement, {
|
|
3604
|
-
children: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [contentElement.props.children, arrow$1 && (jsxRuntime.jsx(ArrowSvg, { className: twMerge(
|
|
3605
|
-
...(portal ? {
|
|
3606
|
-
...(isPositioned ? {
|
|
3680
|
+
children: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [contentElement.props.children, arrow$1 && (jsxRuntime.jsx(ArrowSvg, { className: twMerge("absolute", arrowLocationClasses, arrowClassName), style: arrowStyles, "data-tooltip-arrow": true }))] })),
|
|
3681
|
+
...(portal ? { "data-portal": true } : {}),
|
|
3682
|
+
...(isPositioned ? { "data-ready": true } : {}),
|
|
3607
3683
|
onMouseEnter: openTooltip,
|
|
3608
3684
|
onMouseLeave: closeTooltip,
|
|
3609
3685
|
onTouchStart: handleTouchStart,
|
|
3610
3686
|
ref: (node) => {
|
|
3611
3687
|
refs.setFloating(node);
|
|
3612
3688
|
if (node && arrow$1) {
|
|
3613
|
-
const arrowElement = node.querySelector(
|
|
3689
|
+
const arrowElement = node.querySelector("[data-tooltip-arrow]");
|
|
3614
3690
|
if (arrowElement)
|
|
3615
3691
|
arrowRef.current = arrowElement;
|
|
3616
3692
|
}
|
|
3617
3693
|
},
|
|
3618
|
-
role:
|
|
3694
|
+
role: "tooltip",
|
|
3619
3695
|
style: {
|
|
3620
3696
|
...contentElement.props.style,
|
|
3621
3697
|
...floatingStyles,
|
|
3622
3698
|
transformOrigin: reversedAnchor,
|
|
3623
|
-
pointerEvents:
|
|
3699
|
+
pointerEvents: "none",
|
|
3624
3700
|
},
|
|
3625
3701
|
}) }));
|
|
3626
3702
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [triggerElement &&
|
|
@@ -3630,42 +3706,46 @@ function Tooltip({ anchor = 'top', arrow: arrow$1, arrowClassName, children, del
|
|
|
3630
3706
|
onMouseLeave: handleMouseLeave,
|
|
3631
3707
|
onFocus: handleFocus,
|
|
3632
3708
|
onBlur: handleBlur,
|
|
3633
|
-
|
|
3634
|
-
}), portal
|
|
3709
|
+
"aria-describedby": isOpen ? "tooltip" : undefined,
|
|
3710
|
+
}), portal
|
|
3711
|
+
? bodyElement && ReactDOM.createPortal(tooltipContent, bodyElement)
|
|
3712
|
+
: tooltipContent] }));
|
|
3635
3713
|
}
|
|
3636
3714
|
function ArrowSvg({ className, ...props }) {
|
|
3637
|
-
return (jsxRuntime.jsxs("svg", { viewBox:
|
|
3715
|
+
return (jsxRuntime.jsxs("svg", { viewBox: "0 0 20 10", className: twMerge("h-2.5 w-5 fill-none", className), ...props, children: [jsxRuntime.jsx("path", { d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z", className: "fill-neutral-50 dark:fill-neutral-800" }), jsxRuntime.jsx("path", { d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z", className: "fill-neutral-400 dark:fill-none" }), jsxRuntime.jsx("path", { d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z", className: "dark:fill-neutral-600" })] }));
|
|
3638
3716
|
}
|
|
3639
3717
|
|
|
3640
3718
|
const specialCharacterRegex = new RegExp(/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~€‚ƒ„…†‡‰‹‘’“”•–—™›¡¢£¥§©«¬®°±¶º»¿×÷]/);
|
|
3641
3719
|
function Input({ checked, className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid = true, label, labelProps, max, min, name, onBlur, onChange, options, placeholder, ref, required = true, type, value, ...props }) {
|
|
3642
3720
|
const [formContext, formContextFunctions] = useFormContext(), [fieldsetContext, fieldsetContextFunctions] = useFieldsetContext(), [errorMessage, setErrorMessage] = React.useState(undefined);
|
|
3643
|
-
if (type ===
|
|
3644
|
-
placeholder =
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3721
|
+
if (type === "password" && !placeholder) {
|
|
3722
|
+
placeholder = "••••••••" + (required && !label ? "*" : "");
|
|
3723
|
+
}
|
|
3724
|
+
if (placeholder === "*")
|
|
3725
|
+
placeholder = name + (required && !label ? "*" : "");
|
|
3726
|
+
if (label === "*")
|
|
3648
3727
|
label = name;
|
|
3649
|
-
const uniqueID = React.useId(), fieldContextID = toLowerCase(name, [,
|
|
3728
|
+
const uniqueID = React.useId(), fieldContextID = toLowerCase(name, [, "_"]) + "§" + uniqueID;
|
|
3650
3729
|
const isInFieldset = fieldsetContext && !fieldsetContext.decorative;
|
|
3651
3730
|
const getFieldContextType = () => {
|
|
3652
3731
|
switch (type) {
|
|
3653
|
-
case
|
|
3654
|
-
return
|
|
3655
|
-
case
|
|
3656
|
-
return
|
|
3657
|
-
case
|
|
3658
|
-
return
|
|
3659
|
-
case
|
|
3660
|
-
return
|
|
3661
|
-
case
|
|
3662
|
-
return
|
|
3732
|
+
case "email":
|
|
3733
|
+
return "email";
|
|
3734
|
+
case "file":
|
|
3735
|
+
return "file";
|
|
3736
|
+
case "number":
|
|
3737
|
+
return "number";
|
|
3738
|
+
case "tel":
|
|
3739
|
+
return "tel";
|
|
3740
|
+
case "url":
|
|
3741
|
+
return "url";
|
|
3663
3742
|
default:
|
|
3664
|
-
return
|
|
3743
|
+
return "string";
|
|
3665
3744
|
}
|
|
3666
3745
|
};
|
|
3667
3746
|
const fieldContextType = getFieldContextType();
|
|
3668
|
-
const fieldContext = (isInFieldset ? fieldsetContext.fieldList : formContext)
|
|
3747
|
+
const fieldContext = (isInFieldset ? fieldsetContext.fieldList : formContext)
|
|
3748
|
+
?.find(({ id: fieldID }) => fieldID === fieldContextID);
|
|
3669
3749
|
React.useEffect(() => {
|
|
3670
3750
|
const initialFieldContext = defineField({
|
|
3671
3751
|
type: fieldContextType,
|
|
@@ -3673,7 +3753,7 @@ function Input({ checked, className, defaultValue, description, descriptionProps
|
|
|
3673
3753
|
invalid,
|
|
3674
3754
|
name,
|
|
3675
3755
|
required,
|
|
3676
|
-
value: value ? `${value}` : defaultValue ? `${defaultValue}` :
|
|
3756
|
+
value: value ? `${value}` : defaultValue ? `${defaultValue}` : "",
|
|
3677
3757
|
});
|
|
3678
3758
|
if (isInFieldset) {
|
|
3679
3759
|
fieldsetContextFunctions.registerField(initialFieldContext);
|
|
@@ -3687,57 +3767,71 @@ function Input({ checked, className, defaultValue, description, descriptionProps
|
|
|
3687
3767
|
};
|
|
3688
3768
|
}, [isInFieldset]);
|
|
3689
3769
|
const validateField = (validValue) => {
|
|
3690
|
-
const noValue = !validValue || validValue ===
|
|
3770
|
+
const noValue = !validValue || validValue === "";
|
|
3691
3771
|
if (!required && noValue)
|
|
3692
3772
|
return true;
|
|
3693
3773
|
const errorMessageList = [];
|
|
3694
3774
|
if (noValue) {
|
|
3695
|
-
errorMessageList.push(
|
|
3696
|
-
setErrorMessage(errorMessageList.join(
|
|
3775
|
+
errorMessageList.push("This field is required.");
|
|
3776
|
+
setErrorMessage(errorMessageList.join(" "));
|
|
3697
3777
|
return false;
|
|
3698
3778
|
}
|
|
3699
3779
|
switch (type) {
|
|
3700
|
-
case
|
|
3701
|
-
if (!isEmail(validValue))
|
|
3702
|
-
errorMessageList.push(
|
|
3780
|
+
case "email":
|
|
3781
|
+
if (!isEmail(validValue)) {
|
|
3782
|
+
errorMessageList.push("This is not a valid email.");
|
|
3783
|
+
}
|
|
3703
3784
|
break;
|
|
3704
|
-
case
|
|
3785
|
+
case "date":
|
|
3705
3786
|
const valueAsTime = new Date().getTime();
|
|
3706
|
-
if (min && !(min instanceof Date) && typeof min !==
|
|
3787
|
+
if (min && !(min instanceof Date) && typeof min !== "number") {
|
|
3707
3788
|
if (Array.isArray(min)) {
|
|
3708
|
-
const monthIndex = typeof min[1] ===
|
|
3789
|
+
const monthIndex = typeof min[1] === "number"
|
|
3790
|
+
? min[1] - 1
|
|
3791
|
+
: getMonthIndexFromName(min[1]);
|
|
3709
3792
|
min = new Date(min[0], monthIndex, min[2]);
|
|
3710
3793
|
}
|
|
3711
|
-
else if (
|
|
3712
|
-
const monthIndex = typeof min.month ===
|
|
3794
|
+
else if ("year" in min && "month" in min && "day" in min) {
|
|
3795
|
+
const monthIndex = typeof min.month === "number"
|
|
3796
|
+
? min.month - 1
|
|
3797
|
+
: getMonthIndexFromName(min.month);
|
|
3713
3798
|
min = new Date(min.year, monthIndex, min.day);
|
|
3714
3799
|
}
|
|
3715
|
-
if (valueAsTime < min.getTime())
|
|
3800
|
+
if (valueAsTime < min.getTime()) {
|
|
3716
3801
|
errorMessageList.push(`Value cannot be lower than ${getUserReadableDate(min)}.`);
|
|
3802
|
+
}
|
|
3717
3803
|
}
|
|
3718
|
-
if (max && !(max instanceof Date) && typeof max !==
|
|
3804
|
+
if (max && !(max instanceof Date) && typeof max !== "number") {
|
|
3719
3805
|
if (Array.isArray(max)) {
|
|
3720
|
-
const monthIndex = typeof max[1] ===
|
|
3806
|
+
const monthIndex = typeof max[1] === "number"
|
|
3807
|
+
? max[1] - 1
|
|
3808
|
+
: getMonthIndexFromName(max[1]);
|
|
3721
3809
|
max = new Date(max[0], monthIndex, max[2]);
|
|
3722
3810
|
}
|
|
3723
|
-
else if (
|
|
3724
|
-
const monthIndex = typeof max.month ===
|
|
3811
|
+
else if ("year" in max && "month" in max && "day" in max) {
|
|
3812
|
+
const monthIndex = typeof max.month === "number"
|
|
3813
|
+
? max.month - 1
|
|
3814
|
+
: getMonthIndexFromName(max.month);
|
|
3725
3815
|
max = new Date(max.year, monthIndex, max.day);
|
|
3726
3816
|
}
|
|
3727
|
-
if (valueAsTime > max.getTime())
|
|
3817
|
+
if (valueAsTime > max.getTime()) {
|
|
3728
3818
|
errorMessageList.push(`Value cannot be higher than ${getUserReadableDate(max)}.`);
|
|
3819
|
+
}
|
|
3729
3820
|
}
|
|
3730
3821
|
break;
|
|
3731
|
-
case
|
|
3822
|
+
case "number":
|
|
3732
3823
|
const valueAsNumber = Number(validValue);
|
|
3733
|
-
if (isNaN(valueAsNumber))
|
|
3734
|
-
errorMessageList.push(
|
|
3735
|
-
|
|
3824
|
+
if (isNaN(valueAsNumber)) {
|
|
3825
|
+
errorMessageList.push("This is not a valid number.");
|
|
3826
|
+
}
|
|
3827
|
+
if (typeof max === "number" && valueAsNumber > max) {
|
|
3736
3828
|
errorMessageList.push(`Value cannot be higher than ${max}.`);
|
|
3737
|
-
|
|
3829
|
+
}
|
|
3830
|
+
if (typeof min === "number" && valueAsNumber < min) {
|
|
3738
3831
|
errorMessageList.push(`Value cannot be lower than ${min}.`);
|
|
3832
|
+
}
|
|
3739
3833
|
break;
|
|
3740
|
-
case
|
|
3834
|
+
case "password":
|
|
3741
3835
|
if (options) {
|
|
3742
3836
|
const { matchPreviousInput, requireLowercaseCharacter, requireNumber, requireSpecialCharacter, requireUppercaseCharacter, } = options;
|
|
3743
3837
|
if (matchPreviousInput && formContext && formContext.length >= 2) {
|
|
@@ -3747,8 +3841,9 @@ function Input({ checked, className, defaultValue, description, descriptionProps
|
|
|
3747
3841
|
const previousInput = fieldsetContext.fieldList.find((_, index) => index === currentInputIndex - 1);
|
|
3748
3842
|
if (previousInput &&
|
|
3749
3843
|
isStringField(previousInput) &&
|
|
3750
|
-
previousInput.value !== validValue)
|
|
3751
|
-
errorMessageList.push(
|
|
3844
|
+
previousInput.value !== validValue) {
|
|
3845
|
+
errorMessageList.push("Passwords must match.");
|
|
3846
|
+
}
|
|
3752
3847
|
}
|
|
3753
3848
|
}
|
|
3754
3849
|
else {
|
|
@@ -3757,36 +3852,44 @@ function Input({ checked, className, defaultValue, description, descriptionProps
|
|
|
3757
3852
|
const previousInput = formContext.find((_, index) => index === currentInputIndex - 1);
|
|
3758
3853
|
if (previousInput &&
|
|
3759
3854
|
isStringField(previousInput) &&
|
|
3760
|
-
previousInput.value !== validValue)
|
|
3761
|
-
errorMessageList.push(
|
|
3855
|
+
previousInput.value !== validValue) {
|
|
3856
|
+
errorMessageList.push("Passwords must match.");
|
|
3857
|
+
}
|
|
3762
3858
|
}
|
|
3763
3859
|
}
|
|
3764
3860
|
}
|
|
3765
|
-
if (requireLowercaseCharacter && !/[a-z]/g.test(validValue))
|
|
3766
|
-
errorMessageList.push(
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
if (
|
|
3772
|
-
errorMessageList.push(
|
|
3861
|
+
if (requireLowercaseCharacter && !/[a-z]/g.test(validValue)) {
|
|
3862
|
+
errorMessageList.push("You must include a lowercase character.");
|
|
3863
|
+
}
|
|
3864
|
+
if (requireNumber && !/[0-9]/g.test(validValue)) {
|
|
3865
|
+
errorMessageList.push("You must include a number.");
|
|
3866
|
+
}
|
|
3867
|
+
if (requireSpecialCharacter && !specialCharacterRegex.test(validValue)) {
|
|
3868
|
+
errorMessageList.push("You must include a special character.");
|
|
3869
|
+
}
|
|
3870
|
+
if (requireUppercaseCharacter && !/[A-Z]/g.test(validValue)) {
|
|
3871
|
+
errorMessageList.push("You must include an uppercase character.");
|
|
3872
|
+
}
|
|
3773
3873
|
}
|
|
3774
3874
|
break;
|
|
3775
|
-
case
|
|
3776
|
-
if (!isPhoneNumber(validValue))
|
|
3777
|
-
errorMessageList.push(
|
|
3875
|
+
case "tel":
|
|
3876
|
+
if (!isPhoneNumber(validValue)) {
|
|
3877
|
+
errorMessageList.push("This is not a valid phone number.");
|
|
3878
|
+
}
|
|
3778
3879
|
break;
|
|
3779
3880
|
}
|
|
3780
|
-
if (props.maxLength && validValue.length > Number(props.maxLength))
|
|
3881
|
+
if (props.maxLength && validValue.length > Number(props.maxLength)) {
|
|
3781
3882
|
errorMessageList.push(`This may not have more than ${props.maxLength} characters.`);
|
|
3782
|
-
|
|
3883
|
+
}
|
|
3884
|
+
if (props.minLength && validValue.length < Number(props.minLength)) {
|
|
3783
3885
|
errorMessageList.push(`This must have at least ${props.minLength} characters.`);
|
|
3886
|
+
}
|
|
3784
3887
|
if (errorMessageList.length === 0)
|
|
3785
3888
|
return true;
|
|
3786
|
-
setErrorMessage(errorMessageList.join(
|
|
3889
|
+
setErrorMessage(errorMessageList.join(" "));
|
|
3787
3890
|
return false;
|
|
3788
3891
|
};
|
|
3789
|
-
const handleChange = e => {
|
|
3892
|
+
const handleChange = (e) => {
|
|
3790
3893
|
if (disabled) {
|
|
3791
3894
|
e.preventDefault();
|
|
3792
3895
|
return;
|
|
@@ -3799,11 +3902,14 @@ function Input({ checked, className, defaultValue, description, descriptionProps
|
|
|
3799
3902
|
});
|
|
3800
3903
|
}
|
|
3801
3904
|
else {
|
|
3802
|
-
formContextFunctions.updateField(fieldContextID, {
|
|
3905
|
+
formContextFunctions.updateField(fieldContextID, {
|
|
3906
|
+
value: newValue,
|
|
3907
|
+
invalid: validateField(newValue) === false,
|
|
3908
|
+
});
|
|
3803
3909
|
}
|
|
3804
3910
|
onChange?.(e);
|
|
3805
3911
|
};
|
|
3806
|
-
const handleBlur = e => {
|
|
3912
|
+
const handleBlur = (e) => {
|
|
3807
3913
|
if (disabled) {
|
|
3808
3914
|
e.preventDefault();
|
|
3809
3915
|
return;
|
|
@@ -3813,39 +3919,47 @@ function Input({ checked, className, defaultValue, description, descriptionProps
|
|
|
3813
3919
|
validateField(newValue);
|
|
3814
3920
|
let processedValue = newValue;
|
|
3815
3921
|
switch (type) {
|
|
3816
|
-
case
|
|
3922
|
+
case "email":
|
|
3817
3923
|
processedValue = newValue.toLowerCase();
|
|
3818
3924
|
break;
|
|
3819
|
-
case
|
|
3925
|
+
case "tel":
|
|
3820
3926
|
processedValue = formatPhoneNumber(newValue, options);
|
|
3821
3927
|
break;
|
|
3822
3928
|
}
|
|
3823
3929
|
if (isInFieldset) {
|
|
3824
|
-
fieldsetContextFunctions.updateField(fieldContextID, {
|
|
3930
|
+
fieldsetContextFunctions.updateField(fieldContextID, {
|
|
3931
|
+
value: processedValue,
|
|
3932
|
+
});
|
|
3825
3933
|
}
|
|
3826
3934
|
else {
|
|
3827
|
-
formContextFunctions.updateField(fieldContextID, {
|
|
3935
|
+
formContextFunctions.updateField(fieldContextID, {
|
|
3936
|
+
value: processedValue,
|
|
3937
|
+
});
|
|
3828
3938
|
}
|
|
3829
3939
|
onBlur?.(e);
|
|
3830
3940
|
};
|
|
3831
3941
|
const restFieldProps = fieldProps
|
|
3832
|
-
? Object.fromEntries(Object.entries(fieldProps).filter(([key]) => key !==
|
|
3942
|
+
? Object.fromEntries(Object.entries(fieldProps).filter(([key]) => key !== "className"))
|
|
3833
3943
|
: {};
|
|
3834
3944
|
const restLabelProps = labelProps
|
|
3835
|
-
? Object.fromEntries(Object.entries(labelProps).filter(([key]) => key !==
|
|
3945
|
+
? Object.fromEntries(Object.entries(labelProps).filter(([key]) => key !== "className"))
|
|
3836
3946
|
: {};
|
|
3837
3947
|
const restDescriptionProps = descriptionProps
|
|
3838
|
-
? Object.fromEntries(Object.entries(descriptionProps).filter(([key]) => key !==
|
|
3948
|
+
? Object.fromEntries(Object.entries(descriptionProps).filter(([key]) => key !== "className"))
|
|
3839
3949
|
: {};
|
|
3840
|
-
return (jsxRuntime.jsxs(react.Field, { ...restFieldProps, className: bag => twMerge(
|
|
3950
|
+
return (jsxRuntime.jsxs(react.Field, { ...restFieldProps, className: (bag) => twMerge("grid gap-1", typeof fieldProps?.className === "function"
|
|
3951
|
+
? fieldProps?.className(bag)
|
|
3952
|
+
: fieldProps?.className), disabled: disabled, children: [label && (jsxRuntime.jsx(react.Label, { ...restLabelProps, className: (bag) => twMerge("text-sm font-medium", required ? 'after:text-ui-red after:content-["_*"]' : "", typeof labelProps?.className === "function"
|
|
3953
|
+
? labelProps?.className(bag)
|
|
3954
|
+
: labelProps?.className), children: label })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(react.Input, { ...props, className: (bag) => twMerge(
|
|
3841
3955
|
// Base styles
|
|
3842
|
-
|
|
3956
|
+
"w-full rounded-xl border border-neutral-500/50 bg-neutral-100 py-1 pl-2 text-neutral-950 outline-offset-1 outline-ui-sky-blue/95 transition-[background-color] duration-300 ease-exponential dark:bg-neutral-700 dark:text-neutral-50",
|
|
3843
3957
|
// Pseudo styles
|
|
3844
|
-
|
|
3958
|
+
"focus-visible:bg-neutral-50 focus-visible:outline-3 active:bg-neutral-200 dark:focus-visible:bg-neutral-600 dark:active:bg-neutral-800 pointer-fine:hover:bg-neutral-50 pointer-fine:active:bg-neutral-200 dark:pointer-fine:hover:bg-neutral-600 dark:pointer-fine:active:bg-neutral-800",
|
|
3845
3959
|
// user-invalid styles
|
|
3846
|
-
|
|
3960
|
+
"user-invalid:border-ui-red user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-100))] user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-800))] dark:user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))] user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-100))] user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))]",
|
|
3847
3961
|
// Custom styles
|
|
3848
|
-
typeof className ===
|
|
3962
|
+
typeof className === "function" ? className(bag) : className), invalid: invalid, onBlur: handleBlur, onChange: handleChange, placeholder: placeholder, ref: ref, required: required, type: type, value: fieldContext?.value || "" }), fieldContext?.invalid && errorMessage && (jsxRuntime.jsxs(Tooltip, { anchor: "top-end", arrow: true, portal: true, children: [jsxRuntime.jsx(TooltipTrigger, { as: Button, className: "absolute top-1.25 right-1.25 z-10 size-6 min-w-0", padding: "none", rounded: "md", theme: "red", children: jsxRuntime.jsx(ExclamationmarkOctagon, { className: "absolute top-1/2 left-1/2 size-full -translate-x-1/2 -translate-y-1/2 scale-70" }) }), jsxRuntime.jsx(TooltipPanel, { children: errorMessage })] }))] }), description && (jsxRuntime.jsx(react.Description, { ...restDescriptionProps, className: (bag) => twMerge("text-xs", typeof descriptionProps?.className === "function"
|
|
3849
3963
|
? descriptionProps?.className(bag)
|
|
3850
3964
|
: descriptionProps?.className), children: description }))] }));
|
|
3851
3965
|
}
|
|
@@ -4356,12 +4470,14 @@ const MAX_PROGRESS = 100;
|
|
|
4356
4470
|
function Video({ autoPlay, className, controls = true, poster, ref, srcSet, title, ...props }) {
|
|
4357
4471
|
// * General/Core
|
|
4358
4472
|
const uniqueID = React.useId(), figureRef = React.useRef(null), videoPlayerRef = React.useRef(null), sortedSrcSet = srcSet.sort((a, b) => a.width - b.width);
|
|
4359
|
-
const primaryPoster = poster
|
|
4360
|
-
|
|
4473
|
+
const primaryPoster = poster
|
|
4474
|
+
? poster.find(({ primary }) => primary)?.src || poster[0].src
|
|
4475
|
+
: "";
|
|
4476
|
+
const preventDefaultEvent = (e) => e.preventDefault();
|
|
4361
4477
|
// * Play/Pause Controls
|
|
4362
4478
|
const [isPlaying, setIsPlaying] = React.useState(autoPlay);
|
|
4363
4479
|
const togglePlay = React.useCallback(() => {
|
|
4364
|
-
setIsPlaying(previous => {
|
|
4480
|
+
setIsPlaying((previous) => {
|
|
4365
4481
|
if (!previous)
|
|
4366
4482
|
videoPlayerRef.current?.play();
|
|
4367
4483
|
if (previous)
|
|
@@ -4392,22 +4508,25 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4392
4508
|
}, []);
|
|
4393
4509
|
const enterPictureInPicture = () => videoPlayerRef.current?.requestPictureInPicture();
|
|
4394
4510
|
React.useEffect(() => {
|
|
4395
|
-
if (typeof window ===
|
|
4511
|
+
if (typeof window === "undefined")
|
|
4396
4512
|
return;
|
|
4397
|
-
document.addEventListener(
|
|
4513
|
+
document.addEventListener("fullscreenchange", updateFullscreenState);
|
|
4398
4514
|
return () => {
|
|
4399
|
-
document.removeEventListener(
|
|
4515
|
+
document.removeEventListener("fullscreenchange", updateFullscreenState);
|
|
4400
4516
|
};
|
|
4401
4517
|
}, []);
|
|
4402
4518
|
// * Progress/Seeking Controls
|
|
4403
|
-
const [progress, setProgress] = React.useState(0), trackProgressStartTimeRef = React.useRef(0), [seekIndicator, setSeekIndicator] = React.useState({
|
|
4519
|
+
const [progress, setProgress] = React.useState(0), trackProgressStartTimeRef = React.useRef(0), [seekIndicator, setSeekIndicator] = React.useState({
|
|
4520
|
+
isInPlayedArea: false,
|
|
4521
|
+
position: 0,
|
|
4522
|
+
}), seekIndicatorMouseDownPositionRef = React.useRef(0), scrubberRef = React.useRef(null), [timeRemaining, setTimeRemaining] = React.useState(0);
|
|
4404
4523
|
const handleTimeUpdate = () => {
|
|
4405
4524
|
const videoPlayer = videoPlayerRef.current;
|
|
4406
4525
|
if (!videoPlayer)
|
|
4407
4526
|
return;
|
|
4408
4527
|
const { currentTime, duration } = videoPlayer;
|
|
4409
4528
|
const newProgress = (currentTime / duration) * 100;
|
|
4410
|
-
setProgress(prev => (Math.abs(prev - newProgress) > 0.1 ? newProgress : prev));
|
|
4529
|
+
setProgress((prev) => (Math.abs(prev - newProgress) > 0.1 ? newProgress : prev));
|
|
4411
4530
|
setTimeRemaining(duration - currentTime);
|
|
4412
4531
|
};
|
|
4413
4532
|
const handleProgressSlider = ({ x }) => {
|
|
@@ -4417,7 +4536,9 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4417
4536
|
const { duration } = videoPlayer, { width } = scrubber.getBoundingClientRect();
|
|
4418
4537
|
videoPlayer.fastSeek(Math.max(Math.min(trackProgressStartTimeRef.current + x / (width / duration), duration - 1), 0));
|
|
4419
4538
|
};
|
|
4420
|
-
const { trackPointerMovement: trackProgress } = usePointerMovement({
|
|
4539
|
+
const { trackPointerMovement: trackProgress } = usePointerMovement({
|
|
4540
|
+
onChange: handleProgressSlider,
|
|
4541
|
+
});
|
|
4421
4542
|
const initiateTrackProgress = (e) => {
|
|
4422
4543
|
const videoPlayer = videoPlayerRef.current;
|
|
4423
4544
|
if (!videoPlayer)
|
|
@@ -4425,7 +4546,7 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4425
4546
|
trackProgress(e);
|
|
4426
4547
|
trackProgressStartTimeRef.current = videoPlayer.currentTime;
|
|
4427
4548
|
};
|
|
4428
|
-
const handleSeekIndicatorMovement = e => {
|
|
4549
|
+
const handleSeekIndicatorMovement = (e) => {
|
|
4429
4550
|
const videoPlayer = videoPlayerRef.current;
|
|
4430
4551
|
if (!videoPlayer)
|
|
4431
4552
|
return;
|
|
@@ -4436,30 +4557,33 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4436
4557
|
setSeekIndicator({ isInPlayedArea, position });
|
|
4437
4558
|
};
|
|
4438
4559
|
const initializeSeeking = () => (seekIndicatorMouseDownPositionRef.current = seekIndicator.position);
|
|
4439
|
-
const handleSeekRelease = e => {
|
|
4560
|
+
const handleSeekRelease = (e) => {
|
|
4440
4561
|
const videoPlayer = videoPlayerRef.current;
|
|
4441
4562
|
if (!videoPlayer)
|
|
4442
4563
|
return;
|
|
4443
4564
|
const { duration } = videoPlayer, { currentTarget } = e, { width } = currentTarget.getBoundingClientRect();
|
|
4444
|
-
if (seekIndicatorMouseDownPositionRef.current === seekIndicator.position)
|
|
4565
|
+
if (seekIndicatorMouseDownPositionRef.current === seekIndicator.position) {
|
|
4445
4566
|
videoPlayer.fastSeek(Math.min(duration / (width / seekIndicatorMouseDownPositionRef.current), duration - 1));
|
|
4567
|
+
}
|
|
4446
4568
|
};
|
|
4447
4569
|
// * Skip Controls
|
|
4448
4570
|
const [skipDuration, setSkipDuration] = React.useState(10);
|
|
4449
4571
|
const getSkipAmount = () => {
|
|
4450
4572
|
const modifierKeyList = pressedKeyListRef.current;
|
|
4451
4573
|
let skipAmount = 10;
|
|
4452
|
-
if (modifierKeyList.includes(
|
|
4574
|
+
if (modifierKeyList.includes("alt")) {
|
|
4453
4575
|
if (modifierKeyList.length === 1)
|
|
4454
4576
|
skipAmount = 15;
|
|
4455
|
-
if (modifierKeyList.includes(
|
|
4577
|
+
if (modifierKeyList.includes("shift"))
|
|
4456
4578
|
skipAmount = 30;
|
|
4457
|
-
if (modifierKeyList.includes(
|
|
4579
|
+
if (modifierKeyList.includes("meta"))
|
|
4458
4580
|
skipAmount = 5;
|
|
4459
|
-
if (modifierKeyList.includes(
|
|
4581
|
+
if (modifierKeyList.includes("shift") && modifierKeyList.includes("meta"))
|
|
4460
4582
|
skipAmount = 60;
|
|
4461
|
-
if (modifierKeyList.includes(
|
|
4583
|
+
if (modifierKeyList.includes("shift") && modifierKeyList.includes("meta") &&
|
|
4584
|
+
modifierKeyList.includes("ctrl")) {
|
|
4462
4585
|
skipAmount = 90;
|
|
4586
|
+
}
|
|
4463
4587
|
}
|
|
4464
4588
|
if (skipAmount !== skipDuration)
|
|
4465
4589
|
setSkipDuration(skipAmount);
|
|
@@ -4483,7 +4607,7 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4483
4607
|
}, []);
|
|
4484
4608
|
// * Volume Controls
|
|
4485
4609
|
const [volume, setVolume] = React.useState(1), trackVolumeStartRef = React.useRef(0);
|
|
4486
|
-
const handleVolumeChange = e => {
|
|
4610
|
+
const handleVolumeChange = (e) => {
|
|
4487
4611
|
const { currentTarget } = e, { volume } = currentTarget;
|
|
4488
4612
|
setVolume(volume);
|
|
4489
4613
|
};
|
|
@@ -4493,7 +4617,9 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4493
4617
|
return;
|
|
4494
4618
|
videoPlayer.volume = Math.max(Math.min(trackVolumeStartRef.current + (y / 96) * -1, 1), 0);
|
|
4495
4619
|
};
|
|
4496
|
-
const { trackPointerMovement: trackVolume } = usePointerMovement({
|
|
4620
|
+
const { trackPointerMovement: trackVolume } = usePointerMovement({
|
|
4621
|
+
onChange: handleVolumeSlider,
|
|
4622
|
+
});
|
|
4497
4623
|
const initiateTrackVolume = (e) => {
|
|
4498
4624
|
const videoPlayer = videoPlayerRef.current;
|
|
4499
4625
|
if (!videoPlayer)
|
|
@@ -4532,23 +4658,23 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4532
4658
|
// * Keyboard Controls
|
|
4533
4659
|
const pressedKeyListRef = React.useRef([]), [pressedKeyList, setPressedKeyList] = React.useState([]);
|
|
4534
4660
|
const updateModifierKeys = React.useCallback(({ metaKey, altKey, shiftKey, ctrlKey, }) => {
|
|
4535
|
-
if ((metaKey && !pressedKeyListRef.current.includes(
|
|
4536
|
-
(altKey && !pressedKeyListRef.current.includes(
|
|
4537
|
-
(shiftKey && !pressedKeyListRef.current.includes(
|
|
4538
|
-
(ctrlKey && !pressedKeyListRef.current.includes(
|
|
4539
|
-
(!metaKey && pressedKeyListRef.current.includes(
|
|
4540
|
-
(!altKey && pressedKeyListRef.current.includes(
|
|
4541
|
-
(!shiftKey && pressedKeyListRef.current.includes(
|
|
4542
|
-
(!ctrlKey && pressedKeyListRef.current.includes(
|
|
4661
|
+
if ((metaKey && !pressedKeyListRef.current.includes("meta")) ||
|
|
4662
|
+
(altKey && !pressedKeyListRef.current.includes("alt")) ||
|
|
4663
|
+
(shiftKey && !pressedKeyListRef.current.includes("shift")) ||
|
|
4664
|
+
(ctrlKey && !pressedKeyListRef.current.includes("ctrl")) ||
|
|
4665
|
+
(!metaKey && pressedKeyListRef.current.includes("meta")) ||
|
|
4666
|
+
(!altKey && pressedKeyListRef.current.includes("alt")) ||
|
|
4667
|
+
(!shiftKey && pressedKeyListRef.current.includes("shift")) ||
|
|
4668
|
+
(!ctrlKey && pressedKeyListRef.current.includes("ctrl"))) {
|
|
4543
4669
|
const newPressedKeyList = [];
|
|
4544
4670
|
if (metaKey)
|
|
4545
|
-
newPressedKeyList.push(
|
|
4671
|
+
newPressedKeyList.push("meta");
|
|
4546
4672
|
if (altKey)
|
|
4547
|
-
newPressedKeyList.push(
|
|
4673
|
+
newPressedKeyList.push("alt");
|
|
4548
4674
|
if (shiftKey)
|
|
4549
|
-
newPressedKeyList.push(
|
|
4675
|
+
newPressedKeyList.push("shift");
|
|
4550
4676
|
if (ctrlKey)
|
|
4551
|
-
newPressedKeyList.push(
|
|
4677
|
+
newPressedKeyList.push("ctrl");
|
|
4552
4678
|
setPressedKeyList(newPressedKeyList);
|
|
4553
4679
|
pressedKeyListRef.current = newPressedKeyList;
|
|
4554
4680
|
getSkipAmount();
|
|
@@ -4557,27 +4683,29 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4557
4683
|
const handleKeydown = React.useCallback((e) => {
|
|
4558
4684
|
const { key, metaKey, altKey, shiftKey, ctrlKey } = e;
|
|
4559
4685
|
updateModifierKeys({ metaKey, altKey, shiftKey, ctrlKey });
|
|
4560
|
-
if (![
|
|
4686
|
+
if (![" ", "ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown", "f"].includes(key))
|
|
4561
4687
|
return;
|
|
4562
|
-
if ([
|
|
4688
|
+
if ([" ", "ArrowUp", "ArrowDown", "f"].includes(key) && !metaKey &&
|
|
4689
|
+
!altKey && !shiftKey && !ctrlKey) {
|
|
4563
4690
|
e.preventDefault();
|
|
4691
|
+
}
|
|
4564
4692
|
switch (key) {
|
|
4565
|
-
case
|
|
4693
|
+
case " ":
|
|
4566
4694
|
togglePlay();
|
|
4567
4695
|
break;
|
|
4568
|
-
case
|
|
4696
|
+
case "ArrowRight":
|
|
4569
4697
|
skipForward();
|
|
4570
4698
|
break;
|
|
4571
|
-
case
|
|
4699
|
+
case "ArrowLeft":
|
|
4572
4700
|
skipBack();
|
|
4573
4701
|
break;
|
|
4574
|
-
case
|
|
4702
|
+
case "ArrowUp":
|
|
4575
4703
|
increaseVolume();
|
|
4576
4704
|
break;
|
|
4577
|
-
case
|
|
4705
|
+
case "ArrowDown":
|
|
4578
4706
|
decreaseVolume();
|
|
4579
4707
|
break;
|
|
4580
|
-
case
|
|
4708
|
+
case "f":
|
|
4581
4709
|
requestFullscreen();
|
|
4582
4710
|
break;
|
|
4583
4711
|
}
|
|
@@ -4587,11 +4715,11 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4587
4715
|
updateModifierKeys({ metaKey, altKey, shiftKey, ctrlKey });
|
|
4588
4716
|
}, [updateModifierKeys]);
|
|
4589
4717
|
React.useEffect(() => {
|
|
4590
|
-
if (typeof window ===
|
|
4718
|
+
if (typeof window === "undefined")
|
|
4591
4719
|
return;
|
|
4592
4720
|
const controller = new AbortController(), signal = controller.signal;
|
|
4593
|
-
document.addEventListener(
|
|
4594
|
-
document.addEventListener(
|
|
4721
|
+
document.addEventListener("keydown", handleKeydown, { signal });
|
|
4722
|
+
document.addEventListener("keyup", handleKeyup, { signal });
|
|
4595
4723
|
return () => {
|
|
4596
4724
|
controller.abort();
|
|
4597
4725
|
};
|
|
@@ -4601,22 +4729,25 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4601
4729
|
// * Progressive Enhancement
|
|
4602
4730
|
const progressiveEnhancementSourceLengthRef = React.useRef(1);
|
|
4603
4731
|
const [progressiveEnhancementList, setProgressiveEnhancementList] = React.useState(sortedSrcSet.filter((_, index) => index < progressiveEnhancementSourceLengthRef.current));
|
|
4604
|
-
const handleProEnhance = e => {
|
|
4732
|
+
const handleProEnhance = (e) => {
|
|
4605
4733
|
const { currentTarget } = e, { currentSrc, currentTime } = currentTarget;
|
|
4606
|
-
const proEnhanceSrcLength = progressiveEnhancementSourceLengthRef.current +
|
|
4734
|
+
const proEnhanceSrcLength = progressiveEnhancementSourceLengthRef.current +
|
|
4735
|
+
1, updatedProEnhanceList = sortedSrcSet.filter((_, index) => index < proEnhanceSrcLength);
|
|
4607
4736
|
console.log(updatedProEnhanceList);
|
|
4608
4737
|
setProgressiveEnhancementList(updatedProEnhanceList);
|
|
4609
4738
|
progressiveEnhancementSourceLengthRef.current = proEnhanceSrcLength;
|
|
4610
|
-
const srcToCompare = typeof updatedProEnhanceList.at(-1)?.src ===
|
|
4739
|
+
const srcToCompare = typeof updatedProEnhanceList.at(-1)?.src === "string"
|
|
4611
4740
|
? updatedProEnhanceList.at(-1)?.src
|
|
4612
4741
|
: updatedProEnhanceList.at(-1)?.srcGroup;
|
|
4613
4742
|
if (!srcToCompare)
|
|
4614
4743
|
return;
|
|
4615
|
-
if ((Array.isArray(srcToCompare) &&
|
|
4744
|
+
if ((Array.isArray(srcToCompare) &&
|
|
4745
|
+
srcToCompare.every(({ src }) => src !== currentSrc)) ||
|
|
4616
4746
|
(!Array.isArray(srcToCompare) && srcToCompare !== currentSrc)) {
|
|
4617
|
-
const srcType = currentSrc.split(
|
|
4747
|
+
const srcType = currentSrc.split(".").at(-1);
|
|
4618
4748
|
const src = Array.isArray(srcToCompare)
|
|
4619
|
-
? srcToCompare.find(({ src }) => src.split(
|
|
4749
|
+
? srcToCompare.find(({ src }) => src.split(".").at(-1) === srcType)
|
|
4750
|
+
?.src || srcToCompare[0].src
|
|
4620
4751
|
: srcToCompare;
|
|
4621
4752
|
if (!src)
|
|
4622
4753
|
return;
|
|
@@ -4631,49 +4762,59 @@ function Video({ autoPlay, className, controls = true, poster, ref, srcSet, titl
|
|
|
4631
4762
|
if (!videoPlayer)
|
|
4632
4763
|
return;
|
|
4633
4764
|
const { videoHeight, videoWidth } = videoPlayer;
|
|
4634
|
-
const canvas = document.createElement(
|
|
4765
|
+
const canvas = document.createElement("canvas"), canvasContext = canvas.getContext("2d");
|
|
4635
4766
|
if (!canvasContext)
|
|
4636
4767
|
return;
|
|
4637
4768
|
canvas.width = videoWidth;
|
|
4638
4769
|
canvas.height = videoHeight;
|
|
4639
4770
|
canvasContext.drawImage(videoPlayer, 0, 0, canvas.width, canvas.height);
|
|
4640
|
-
canvas.toBlob(blob => {
|
|
4771
|
+
canvas.toBlob((blob) => {
|
|
4641
4772
|
if (!blob)
|
|
4642
4773
|
return;
|
|
4643
|
-
const url = URL.createObjectURL(blob), link = document.createElement(
|
|
4774
|
+
const url = URL.createObjectURL(blob), link = document.createElement("a");
|
|
4644
4775
|
link.href = url;
|
|
4645
4776
|
link.download = `${title}-frame-${Date.now()}.jpg`;
|
|
4646
4777
|
document.body.appendChild(link);
|
|
4647
4778
|
link.click();
|
|
4648
4779
|
document.body.removeChild(link);
|
|
4649
4780
|
URL.revokeObjectURL(url);
|
|
4650
|
-
},
|
|
4781
|
+
}, "image/jpeg", 0.9);
|
|
4651
4782
|
};
|
|
4652
|
-
return (jsxRuntime.jsxs("figure", { ...(showControls ? {
|
|
4783
|
+
return (jsxRuntime.jsxs("figure", { ...(showControls ? { "data-controls": true } : {}), ...(isFullscreen ? { "data-fullscreen": true } : {}), ...(isPlaying ? { "data-playing": true } : {}), ...Object.fromEntries(pressedKeyList.map((key) => [`data-${key}`, true])), className: twMerge("group/video isolate aspect-video w-full overflow-clip", className), onMouseEnter: displayControls, onMouseLeave: hideControls, ref: figureRef, children: [jsxRuntime.jsx("video", { ...props, className: "size-full object-cover", onLoad: handleProEnhance, onTimeUpdate: handleTimeUpdate, onVolumeChange: handleVolumeChange, poster: primaryPoster, ref: videoPlayerRef || ref, title: title, children: progressiveEnhancementList.map(({ width, ...source }) => {
|
|
4653
4784
|
if (source.srcGroup) {
|
|
4654
4785
|
const { srcGroup } = source;
|
|
4655
4786
|
return srcGroup.map(({ src, type }) => (jsxRuntime.jsx("source", { src: src, type: type }, `${title}${type}${width}${uniqueID}`)));
|
|
4656
4787
|
}
|
|
4657
4788
|
const { src, type } = source;
|
|
4658
|
-
return jsxRuntime.jsx("source", { src: src, type: type }, `${title}${type}${width}${uniqueID}`);
|
|
4659
|
-
}) }), controls && (jsxRuntime.jsxs("div", { className:
|
|
4789
|
+
return (jsxRuntime.jsx("source", { src: src, type: type }, `${title}${type}${width}${uniqueID}`));
|
|
4790
|
+
}) }), controls && (jsxRuntime.jsxs("div", { className: "absolute inset-0 isolate text-neutral-50 opacity-0 transition-opacity duration-1000 ease-exponential select-none group-data-controls/video:opacity-100", children: [jsxRuntime.jsxs("div", { className: "grid-flow-cols absolute top-1/2 left-1/2 grid -translate-x-1/2 -translate-y-1/2 place-items-center gap-2", children: [jsxRuntime.jsxs("button", { className: "col-start-1 col-end-2 row-start-0 row-end-1 grid size-16 rounded-full backdrop-blur-[1px] backdrop-brightness-101 transition-[scale,-webkit-backdrop-filter,backdrop-filter] duration-300 ease-exponential active:scale-95 active:backdrop-blur-[2px] active:backdrop-brightness-125 pointer-fine:hover:scale-105 pointer-fine:hover:backdrop-blur-xs pointer-fine:hover:backdrop-brightness-110 pointer-fine:active:scale-95 pointer-fine:active:backdrop-blur-[2px] pointer-fine:active:backdrop-brightness-125", onClick: togglePlay, onContextMenu: preventDefaultEvent, title: isPlaying ? "Pause" : "Play", children: [jsxRuntime.jsx(PauseFill, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-0 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 transition-[scale,opacity] duration-500 ease-exponential group-data-playing/video:scale-60 group-data-playing/video:opacity-100" }), jsxRuntime.jsx(PlayFill, { className: "-right-0.5 col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 transition-[scale,opacity] duration-500 ease-exponential group-data-playing/video:scale-0 group-data-playing/video:opacity-0" })] }), jsxRuntime.jsxs("button", { className: "col-start-0 col-end-1 row-start-0 row-end-1 grid size-12 rounded-full backdrop-blur-[1px] backdrop-brightness-101 transition-[scale,-webkit-backdrop-filter,backdrop-filter] duration-300 ease-exponential active:scale-95 active:backdrop-blur-[2px] active:backdrop-brightness-125 pointer-fine:hover:scale-105 pointer-fine:hover:backdrop-blur-xs pointer-fine:hover:backdrop-brightness-110 pointer-fine:active:scale-95 pointer-fine:active:backdrop-blur-[2px] pointer-fine:active:backdrop-brightness-125", onClick: skipBack, onContextMenu: preventDefaultEvent, title: `Skip Back ${skipDuration} Seconds`, children: [jsxRuntime.jsx(FiveArrowTriangleheadCounterclockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-meta/video:opacity-100 group-data-alt/video:group-data-meta/video:group-data-ctrl/video:opacity-0 group-data-alt/video:group-data-meta/video:group-data-shift/video:opacity-0" }), jsxRuntime.jsx(TenArrowTriangleheadCounterclockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:opacity-0 group-data-alt/video:group-data-ctrl/video:opacity-100 group-data-alt/video:group-data-shift/video:group-data-meta/video:group-data-ctrl/video:opacity-0" }), jsxRuntime.jsx(FifteenArrowTriangleheadCounterclockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:opacity-100 group-data-ctrl/video:opacity-0 group-data-meta/video:opacity-0 group-data-shift/video:opacity-0" }), jsxRuntime.jsx(ThirtyArrowTriangleheadCounterclockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-shift/video:opacity-100 group-data-alt/video:group-data-ctrl/video:group-data-shift/video:opacity-0 group-data-alt/video:group-data-meta/video:group-data-shift/video:opacity-0" }), jsxRuntime.jsx(SixtyArrowTriangleheadCounterclockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-shift/video:group-data-meta/video:opacity-100 group-data-alt/video:group-data-shift/video:group-data-meta/video:group-data-ctrl/video:opacity-0" }), jsxRuntime.jsx(NinetyArrowTriangleheadCounterclockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-shift/video:group-data-meta/video:group-data-ctrl/video:opacity-100" })] }), jsxRuntime.jsxs("button", { className: "col-start-2 col-end-3 row-start-0 row-end-1 grid size-12 rounded-full backdrop-blur-[1px] backdrop-brightness-101 transition-[scale,-webkit-backdrop-filter,backdrop-filter] duration-300 ease-exponential active:scale-95 active:backdrop-blur-[2px] active:backdrop-brightness-125 pointer-fine:hover:scale-105 pointer-fine:hover:backdrop-blur-xs pointer-fine:hover:backdrop-brightness-110 pointer-fine:active:scale-95 pointer-fine:active:backdrop-blur-[2px] pointer-fine:active:backdrop-brightness-125", onClick: skipForward, onContextMenu: preventDefaultEvent, title: `Skip Forward ${skipDuration} Seconds`, children: [jsxRuntime.jsx(FiveArrowTriangleheadClockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-meta/video:opacity-100 group-data-alt/video:group-data-meta/video:group-data-ctrl/video:opacity-0 group-data-alt/video:group-data-meta/video:group-data-shift/video:opacity-0" }), jsxRuntime.jsx(TenArrowTriangleheadClockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:opacity-0 group-data-alt/video:group-data-ctrl/video:opacity-100 group-data-alt/video:group-data-shift/video:group-data-meta/video:group-data-ctrl/video:opacity-0" }), jsxRuntime.jsx(FifteenArrowTriangleheadClockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:opacity-100 group-data-ctrl/video:opacity-0 group-data-meta/video:opacity-0 group-data-shift/video:opacity-0" }), jsxRuntime.jsx(ThirtyArrowTriangleheadClockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-shift/video:opacity-100 group-data-alt/video:group-data-ctrl/video:group-data-shift/video:opacity-0 group-data-alt/video:group-data-meta/video:group-data-shift/video:opacity-0" }), jsxRuntime.jsx(SixtyArrowTriangleheadClockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-shift/video:group-data-meta/video:opacity-100 group-data-alt/video:group-data-shift/video:group-data-meta/video:group-data-ctrl/video:opacity-0" }), jsxRuntime.jsx(NinetyArrowTriangleheadClockwise, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-60 opacity-0 drop-shadow-[0_.25rem_2rem] drop-shadow-neutral-950/75 group-data-alt/video:group-data-shift/video:group-data-meta/video:group-data-ctrl/video:opacity-100" })] })] }), jsxRuntime.jsxs("div", { className: "absolute inset-x-2 bottom-2 flex items-center gap-2 rounded-xl bg-neutral-900/50 px-2 py-1 shadow-2xl backdrop-blur-xs backdrop-brightness-110", children: [jsxRuntime.jsxs("div", { className: "group/scrubber h-2 w-max grow cursor-grab overflow-clip rounded-md bg-neutral-50/50 backdrop-blur-xs backdrop-brightness-110 transition-[height] duration-300 ease-exponential active:h-4 pointer-fine:hover:h-4 pointer-fine:active:h-4", onMouseDown: (e) => {
|
|
4660
4791
|
initiateTrackProgress(e);
|
|
4661
4792
|
initializeSeeking();
|
|
4662
|
-
}, onMouseMove: handleSeekIndicatorMovement, onMouseUp: handleSeekRelease, onTouchStart: initiateTrackProgress, ref: scrubberRef, children: [jsxRuntime.jsx("div", { "aria-hidden":
|
|
4793
|
+
}, onMouseMove: handleSeekIndicatorMovement, onMouseUp: handleSeekRelease, onTouchStart: initiateTrackProgress, ref: scrubberRef, children: [jsxRuntime.jsx("div", { "aria-hidden": "true", className: "absolute inset-0 grid transition-cols duration-100 ease-linear", style: { gridTemplateColumns: `${progress / MAX_PROGRESS}fr` }, children: jsxRuntime.jsx("div", { className: "overflow-hidden", children: jsxRuntime.jsxs("div", { className: "h-full bg-neutral-50/70 text-[1px] text-transparent backdrop-blur-xs backdrop-brightness-125", children: [progress, "/", MAX_PROGRESS] }) }) }), jsxRuntime.jsx("div", { ...(seekIndicator.isInPlayedArea
|
|
4794
|
+
? { "data-in-played-area": true }
|
|
4795
|
+
: {}), "aria-hidden": "true", className: "absolute inset-y-0 w-1 cursor-grab bg-neutral-50 opacity-0 transition-opacity duration-300 ease-exponential group-hover/scrubber:opacity-100 data-in-played-area:bg-neutral-500 pointer-coarse:hidden", style: { transform: `translateX(${seekIndicator.position}px)` }, children: "\u00A0" }), jsxRuntime.jsx("progress", { className: "sr-only", max: MAX_PROGRESS, value: progress })] }), jsxRuntime.jsx("span", { className: "block text-xs", children: timeRemaining / 60 >= 1
|
|
4663
4796
|
? `${Math.round(timeRemaining / 60)}:${Math.round((timeRemaining / 60 - Math.round(timeRemaining / 60)) * 60)
|
|
4664
4797
|
.toString()
|
|
4665
|
-
.padStart(2,
|
|
4798
|
+
.padStart(2, "0")}`
|
|
4666
4799
|
: Math.round(timeRemaining) === 60
|
|
4667
4800
|
? `1:00`
|
|
4668
|
-
: `0:${Math.round(timeRemaining).toString().padStart(2,
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4801
|
+
: `0:${Math.round(timeRemaining).toString().padStart(2, "0")}` }), jsxRuntime.jsxs(DropDown, { children: [jsxRuntime.jsx(DropDownButton, { arrow: false, className: "group/button flex size-6 items-center justify-center rounded-xs transition-transform duration-300 ease-exponential active:scale-95 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", title: "Volume", children: jsxRuntime.jsxs("svg", { viewBox: "0 0 64 47", className: "size-full scale-80 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75 transition-transform duration-300 ease-exponential", style: {
|
|
4802
|
+
translate: `${volume > 0.66
|
|
4803
|
+
? "0"
|
|
4804
|
+
: volume > 0.33
|
|
4805
|
+
? "2px"
|
|
4806
|
+
: volume > 0
|
|
4807
|
+
? "4px"
|
|
4808
|
+
: "6px"} 0`,
|
|
4809
|
+
}, children: [jsxRuntime.jsx("path", { d: "M25.707,44.076C27.257,44.076 28.39,42.947 28.39,41.387L28.39,4.841C28.39,3.307 27.257,2.025 25.656,2.025C24.542,2.025 23.767,2.512 22.558,3.666L12.393,13.203C12.251,13.345 12.047,13.436 11.818,13.436L4.99,13.436C1.759,13.436 0,15.195 0,18.654L0,27.525C0,30.953 1.759,32.737 4.99,32.737L11.818,32.737C12.047,32.737 12.251,32.808 12.393,32.95L22.558,42.583C23.666,43.615 24.593,44.076 25.707,44.076Z" }), jsxRuntime.jsx("path", { className: "transition-opacity duration-300 ease-exponential", d: "M36.874,33.192C37.684,33.728 38.797,33.566 39.439,32.64C41.265,30.222 42.371,26.683 42.371,23.026C42.371,19.368 41.265,15.855 39.439,13.411C38.797,12.485 37.684,12.323 36.874,12.885C35.923,13.553 35.761,14.721 36.505,15.713C37.901,17.607 38.662,20.249 38.662,23.026C38.662,25.802 37.876,28.419 36.505,30.338C35.786,31.355 35.923,32.498 36.874,33.192Z", style: { opacity: volume > 0 ? 1 : 0 } }), jsxRuntime.jsx("path", { className: "transition-opacity duration-300 ease-exponential", d: "M45.738,39.394C46.624,39.981 47.712,39.799 48.354,38.868C51.402,34.69 53.208,28.904 53.208,23.026C53.208,17.148 51.427,11.31 48.354,7.183C47.712,6.252 46.624,6.07 45.738,6.657C44.858,7.249 44.701,8.362 45.399,9.354C48.023,13.032 49.499,17.952 49.499,23.026C49.499,28.099 47.972,32.994 45.399,36.697C44.726,37.689 44.858,38.802 45.738,39.394Z", style: { opacity: volume > 0.33 ? 1 : 0 } }), jsxRuntime.jsx("path", { className: "transition-opacity duration-300 ease-exponential", d: "M54.679,45.708C55.514,46.32 56.683,46.082 57.315,45.121C61.498,39.091 64,31.447 64,23.026C64,14.604 61.422,6.986 57.315,0.93C56.683,-0.056 55.514,-0.269 54.679,0.343C53.804,0.956 53.668,2.079 54.33,3.071C58.012,8.514 60.342,15.379 60.342,23.026C60.342,30.647 58.012,37.562 54.33,42.98C53.668,43.972 53.804,45.095 54.679,45.708Z", style: { opacity: volume > 0.66 ? 1 : 0 } })] }) }), jsxRuntime.jsxs(DropDownItems, { anchor: {
|
|
4810
|
+
gap: ".5rem",
|
|
4811
|
+
padding: ".375rem",
|
|
4812
|
+
to: "top",
|
|
4813
|
+
}, className: "bg-neutral-900/50 px-1.5 py-1.5 text-neutral-50 backdrop-blur-xs backdrop-brightness-110", children: [jsxRuntime.jsx(DropDownItem, { as: "button", className: "flex size-6 items-center justify-center rounded-xs transition-transform duration-300 ease-exponential active:scale-95 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", onClick: increaseVolume, title: "Increase volume", children: jsxRuntime.jsx(SpeakerPlusFill, { className: "size-full scale-80 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75" }) }), jsxRuntime.jsx(DropDownSeparator, { "aria-label": "Volume slider", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": volume * 100, className: "mx-auto my-2 h-24 w-2 cursor-grab overflow-clip rounded-md bg-neutral-50/50 backdrop-blur-xs backdrop-brightness-110 transition-[width] duration-300 ease-exponential active:w-4 pointer-fine:hover:w-4 pointer-fine:active:w-4", onMouseDown: initiateTrackVolume, onTouchStart: initiateTrackVolume, role: "slider", children: jsxRuntime.jsx("div", { "aria-hidden": "true", className: "grid size-full rotate-180 transition-rows duration-300 ease-exponential", style: { gridTemplateRows: `${volume}fr` }, children: jsxRuntime.jsx("div", { className: "overflow-y-hidden", children: jsxRuntime.jsxs("div", { className: "size-full bg-neutral-50/70 text-[1px] text-transparent backdrop-blur-xs backdrop-brightness-125", children: [volume * 100, "%"] }) }) }) }), jsxRuntime.jsx(DropDownItem, { as: "button", className: "flex size-6 items-center justify-center rounded-xs transition-transform duration-300 ease-exponential active:scale-95 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", onClick: decreaseVolume, title: "Decrease volume", children: jsxRuntime.jsx(SpeakerMinusFill, { className: "size-full scale-80 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75" }) })] })] }), jsxRuntime.jsx("button", { className: "flex size-6 items-center justify-center rounded-xs transition-transform duration-300 ease-exponential active:scale-95 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", onClick: enterPictureInPicture, title: "Enter Picture-in-Picture", children: jsxRuntime.jsx(RectangleFillOnArrowDownForwardTopleadingRectangle, { className: "size-full scale-80 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75" }) }), jsxRuntime.jsx("button", { className: "flex size-6 items-center justify-center rounded-xs transition-transform duration-300 ease-exponential active:scale-95 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", onClick: handleRemotePlayback, title: "Remote Playback", children: jsxRuntime.jsx(RectangleTriangleUp, { className: "size-full scale-80 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75" }) }), jsxRuntime.jsxs(DropDown, { children: [jsxRuntime.jsx(DropDownButton, { arrow: false, className: "flex size-6 items-center justify-center rounded-xs transition-transform duration-300 ease-exponential active:scale-95 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", title: "Other Settings", children: jsxRuntime.jsx(GearshapeFill, { className: "size-full scale-80 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75" }) }), jsxRuntime.jsx(DropDownItems, { anchor: {
|
|
4814
|
+
gap: ".5rem",
|
|
4815
|
+
padding: ".375rem",
|
|
4816
|
+
to: "top end",
|
|
4817
|
+
}, className: "bg-neutral-900/50 px-1.5 py-1.5 text-neutral-50 backdrop-blur-xs backdrop-brightness-110", children: jsxRuntime.jsxs(DropDownItem, { as: "button", className: "flex items-center gap-2 rounded-lg px-1.5 py-0.5 text-sm drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75 transition-[scale,background-color,color] duration-300 ease-exponential active:scale-95 data-active:bg-neutral-50/90 data-active:text-neutral-950 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", onClick: captureCurrentFrame, children: [jsxRuntime.jsx(PhotoBadgeArrowDownFill, { className: "size-5" }), "Capture Current Frame"] }) })] }), jsxRuntime.jsxs("button", { className: "grid size-6 rounded-xs transition-transform duration-300 ease-exponential active:scale-95 pointer-fine:hover:scale-105 pointer-fine:active:scale-95", onClick: toggleFullscreen, title: `${isFullscreen ? "Exit" : "Enter"} Fullscreen`, children: [jsxRuntime.jsx(ArrowUpForwardAndArrowDownBackwardRectangle, { className: "col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-0 opacity-0 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75 transition-[scale,opacity] duration-500 ease-exponential group-data-fullscreen/video:scale-80 group-data-fullscreen/video:opacity-100" }), jsxRuntime.jsx(ArrowDownBackwardAndArrowUpForwardRectangle, { className: "-right-0.5 col-start-0 col-end-1 row-start-0 row-end-1 size-full scale-80 drop-shadow-[0_.125rem_1rem] drop-shadow-neutral-950/75 transition-[scale,opacity] duration-500 ease-exponential group-data-fullscreen/video:scale-0 group-data-fullscreen/video:opacity-0" })] })] }), jsxRuntime.jsx("div", { "aria-hidden": "true", className: "absolute inset-0 -z-10 text-[1px] text-transparent", onClick: togglePlay, onMouseMove: handleMouseMoveControls, onMouseLeave: clearMouseMoveControlsTimeout, children: isPlaying ? "Pause" : "Play" })] }))] }));
|
|
4677
4818
|
}
|
|
4678
4819
|
|
|
4679
4820
|
exports.Anchor = Anchor;
|
|
@@ -4708,4 +4849,5 @@ exports.TooltipTrigger = TooltipTrigger;
|
|
|
4708
4849
|
exports.Video = Video;
|
|
4709
4850
|
exports.createButton = createButton;
|
|
4710
4851
|
exports.createLink = createLink;
|
|
4852
|
+
exports.getLinkClasses = getLinkClasses;
|
|
4711
4853
|
//# sourceMappingURL=index.js.map
|