@trackunit/react-components 0.1.249 → 0.1.251
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/index.cjs.js +163 -116
- package/index.esm.js +160 -117
- package/package.json +1 -1
- package/src/components/DayPicker/DayPickerPopover.d.ts +2 -2
- package/src/components/Modal/Modal.d.ts +4 -0
- package/src/components/Modal/Modal.variants.d.ts +1 -0
- package/src/components/Modal/ModalBackdrop.d.ts +2 -1
- package/src/components/buttons/Button/Button.d.ts +8 -2
- package/src/components/buttons/IconButton/IconButton.d.ts +2 -2
- package/src/components/buttons/shared/Button.variants.d.ts +12 -2
- package/src/components/buttons/shared/ButtonProps.d.ts +3 -8
package/index.cjs.js
CHANGED
|
@@ -485,68 +485,74 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
485
485
|
"focus:ring",
|
|
486
486
|
"focus:ring-inset",
|
|
487
487
|
"focus:outline-none",
|
|
488
|
+
"focus:ring-primary-600",
|
|
488
489
|
"disabled:cursor-not-allowed",
|
|
489
|
-
"text-sm",
|
|
490
490
|
"font-medium",
|
|
491
491
|
"align-middle",
|
|
492
|
+
"rounded-md",
|
|
492
493
|
], {
|
|
493
494
|
variants: {
|
|
494
|
-
|
|
495
|
+
variant: {
|
|
495
496
|
primary: [
|
|
497
|
+
"text-white",
|
|
496
498
|
"bg-primary-600",
|
|
499
|
+
"hover:bg-primary-700",
|
|
500
|
+
"active:bg-primary-800",
|
|
501
|
+
"disabled:bg-slate-400",
|
|
502
|
+
"disabled:text-slate-200",
|
|
503
|
+
],
|
|
504
|
+
"primary-danger": [
|
|
497
505
|
"text-white",
|
|
498
|
-
"
|
|
499
|
-
"
|
|
500
|
-
"
|
|
501
|
-
"disabled:hover:bg-slate-400",
|
|
506
|
+
"bg-danger-600",
|
|
507
|
+
"hover:bg-danger-700",
|
|
508
|
+
"active:bg-danger-800",
|
|
502
509
|
"disabled:bg-slate-400",
|
|
503
510
|
"disabled:text-slate-200",
|
|
504
511
|
],
|
|
505
512
|
secondary: [
|
|
506
|
-
"
|
|
507
|
-
"
|
|
508
|
-
"
|
|
509
|
-
"
|
|
510
|
-
"
|
|
511
|
-
"
|
|
512
|
-
"
|
|
513
|
-
"
|
|
514
|
-
"disabled:text-secondary-400",
|
|
515
|
-
],
|
|
516
|
-
danger: [
|
|
517
|
-
"bg-danger-600",
|
|
518
|
-
"text-white",
|
|
519
|
-
"hover:bg-danger-800",
|
|
520
|
-
"active:bg-danger-700",
|
|
521
|
-
"focus:ring-danger-300",
|
|
513
|
+
"bg-white",
|
|
514
|
+
"border",
|
|
515
|
+
"border-slate-300",
|
|
516
|
+
"text-slate-600",
|
|
517
|
+
"hover:bg-slate-100",
|
|
518
|
+
"hover:text-slate-700",
|
|
519
|
+
"active:bg-slate-200",
|
|
520
|
+
"active:text-slate-800",
|
|
522
521
|
"disabled:bg-slate-200",
|
|
523
|
-
"disabled:hover:bg-slate-200",
|
|
524
|
-
"disabled:text-slate-400",
|
|
525
|
-
],
|
|
526
|
-
warning: [
|
|
527
|
-
"bg-warning-50",
|
|
528
|
-
"text-warning-600",
|
|
529
|
-
"hover:bg-warning-200",
|
|
530
|
-
"hover:text-warning-800",
|
|
531
|
-
"active:text-warning-700",
|
|
532
|
-
"active:bg-warning-100",
|
|
533
|
-
"focus:ring-warning-300",
|
|
534
|
-
"disabled:bg-warning-50",
|
|
535
|
-
"disabled:hover:bg-warning-50",
|
|
536
522
|
"disabled:text-slate-400",
|
|
537
523
|
],
|
|
538
|
-
|
|
524
|
+
"secondary-danger": [
|
|
539
525
|
"bg-white",
|
|
540
526
|
"border",
|
|
541
|
-
"text-slate-600",
|
|
542
|
-
"active:bg-slate-100",
|
|
543
|
-
"active:text-slate-700",
|
|
544
|
-
"focus:ring-slate-300",
|
|
545
|
-
"hover:bg-slate-200",
|
|
546
|
-
"hover:text-slate-800",
|
|
547
527
|
"border-slate-300",
|
|
548
|
-
"
|
|
549
|
-
"
|
|
528
|
+
"text-danger-600",
|
|
529
|
+
"hover:bg-danger-100",
|
|
530
|
+
"hover:text-danger-700",
|
|
531
|
+
"hover:border-danger-700",
|
|
532
|
+
"active:bg-danger-200",
|
|
533
|
+
"active:text-danger-800",
|
|
534
|
+
"active:border-danger-800",
|
|
535
|
+
"disabled:bg-slate-300",
|
|
536
|
+
"disabled:text-slate-400",
|
|
537
|
+
],
|
|
538
|
+
ghost: [
|
|
539
|
+
"bg-transparent",
|
|
540
|
+
"text-primary-600",
|
|
541
|
+
"hover:bg-black/5",
|
|
542
|
+
"hover:text-primary-700",
|
|
543
|
+
"active:bg-black/10",
|
|
544
|
+
"active:text-primary-800",
|
|
545
|
+
"disabled:bg-transparent",
|
|
546
|
+
"disabled:text-slate-400",
|
|
547
|
+
],
|
|
548
|
+
"ghost-neutral": [
|
|
549
|
+
"bg-transparent",
|
|
550
|
+
"text-slate-600",
|
|
551
|
+
"hover:bg-black/5",
|
|
552
|
+
"hover:text-slate-700",
|
|
553
|
+
"active:bg-black/10",
|
|
554
|
+
"active:text-slate-800",
|
|
555
|
+
"disabled:bg-transparent",
|
|
550
556
|
"disabled:text-slate-400",
|
|
551
557
|
],
|
|
552
558
|
},
|
|
@@ -566,9 +572,17 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
566
572
|
* So we need to add padding to the min-height calculation. Two times the vertical
|
|
567
573
|
* padding aka py-1 * 2 aka --spacing-1 * 2 aka spacing-2 (for small).
|
|
568
574
|
*/
|
|
569
|
-
small: ["py-1", "
|
|
570
|
-
medium: ["py-1.5", "
|
|
571
|
-
large: [
|
|
575
|
+
small: ["px-2", "py-1.5", "gap-1", "h-7", "text-xs", "min-h-[calc(var(--line-height-sm)+var(--spacing-2))]"],
|
|
576
|
+
medium: ["px-3", "py-1.5", "gap-2", "h-8", "text-sm", "min-h-[calc(var(--line-height-sm)+var(--spacing-3))]"],
|
|
577
|
+
large: [
|
|
578
|
+
"px-4",
|
|
579
|
+
"py-2",
|
|
580
|
+
"h-10",
|
|
581
|
+
"gap-2",
|
|
582
|
+
"text-base",
|
|
583
|
+
"rounded-lg",
|
|
584
|
+
"min-h-[calc(var(--line-height-sm)+var(--spacing-4))]",
|
|
585
|
+
],
|
|
572
586
|
},
|
|
573
587
|
rounded: {
|
|
574
588
|
true: ["rounded-full"],
|
|
@@ -586,9 +600,9 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
586
600
|
true: ["cursor-not-allowed", "pointer-events-none", "bg-slate-200", "hover:bg-slate-200", "text-slate-400"],
|
|
587
601
|
false: [],
|
|
588
602
|
},
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
603
|
+
loading: {
|
|
604
|
+
true: ["bg-transparent"],
|
|
605
|
+
false: [],
|
|
592
606
|
},
|
|
593
607
|
},
|
|
594
608
|
compoundVariants: [
|
|
@@ -608,88 +622,105 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
608
622
|
className: ["p-2"],
|
|
609
623
|
},
|
|
610
624
|
{
|
|
611
|
-
|
|
612
|
-
variant: "
|
|
613
|
-
className: [
|
|
614
|
-
"text-primary-600",
|
|
615
|
-
"hover:text-primary-700",
|
|
616
|
-
"active:bg-primary-700",
|
|
617
|
-
"focus:ring-primary-300",
|
|
618
|
-
"hover:bg-primary-500/10",
|
|
619
|
-
],
|
|
625
|
+
loading: true,
|
|
626
|
+
variant: "primary",
|
|
627
|
+
className: ['disabled:bg-primary-600'],
|
|
620
628
|
},
|
|
621
629
|
{
|
|
622
|
-
|
|
623
|
-
variant: "
|
|
624
|
-
className: [
|
|
625
|
-
"text-secondary-600",
|
|
626
|
-
"hover:text-secondary-800",
|
|
627
|
-
"active:text-secondary-700",
|
|
628
|
-
"active:bg-black/10",
|
|
629
|
-
"focus:ring-secondary-300",
|
|
630
|
-
"hover:bg-black/5",
|
|
631
|
-
],
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
color: "warning",
|
|
635
|
-
variant: "transparent",
|
|
636
|
-
className: [
|
|
637
|
-
"text-warning-600",
|
|
638
|
-
"active:bg-warning-500/20",
|
|
639
|
-
"focus:ring-warning-300",
|
|
640
|
-
"hover:bg-warning-500/10",
|
|
641
|
-
],
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
color: "danger",
|
|
645
|
-
variant: "transparent",
|
|
646
|
-
className: ["text-danger-600", "active:bg-danger-600/10", "focus:ring-danger-300", "hover:bg-danger-600/10"],
|
|
630
|
+
loading: true,
|
|
631
|
+
variant: "primary-danger",
|
|
632
|
+
className: ["disabled:bg-danger-600"],
|
|
647
633
|
},
|
|
648
634
|
{
|
|
649
|
-
|
|
650
|
-
variant: "
|
|
651
|
-
className: ["
|
|
635
|
+
loading: true,
|
|
636
|
+
variant: "secondary",
|
|
637
|
+
className: ["disabled:bg-white"],
|
|
652
638
|
},
|
|
653
639
|
{
|
|
654
|
-
|
|
655
|
-
variant: "
|
|
656
|
-
className: ["
|
|
640
|
+
loading: true,
|
|
641
|
+
variant: "secondary-danger",
|
|
642
|
+
className: ["disabled:bg-white"],
|
|
657
643
|
},
|
|
658
644
|
],
|
|
659
645
|
defaultVariants: {
|
|
660
|
-
|
|
646
|
+
variant: "primary",
|
|
661
647
|
size: "medium",
|
|
662
648
|
rounded: false,
|
|
663
649
|
fullWidth: false,
|
|
664
650
|
square: false,
|
|
665
651
|
disabled: false,
|
|
666
|
-
|
|
652
|
+
},
|
|
653
|
+
});
|
|
654
|
+
const cvaButtonSpinnerContainer = cssClassVarianceUtilities.cvaMerge(["p-0", "h-auto"]);
|
|
655
|
+
const cvaButtonSpinner = cssClassVarianceUtilities.cvaMerge([], {
|
|
656
|
+
variants: {
|
|
657
|
+
variant: {
|
|
658
|
+
primary: ["border-white/[0.32]", "border-b-white"],
|
|
659
|
+
"primary-danger": ["border-white/[0.32]", "border-b-white"],
|
|
660
|
+
secondary: ['h-3.5', 'w-3.5'],
|
|
661
|
+
"secondary-danger": ['h-3.5', 'w-3.5'],
|
|
662
|
+
ghost: [],
|
|
663
|
+
"ghost-neutral": [],
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
defaultVariants: {
|
|
667
|
+
variant: "primary",
|
|
668
|
+
},
|
|
669
|
+
});
|
|
670
|
+
const cvaButtonPrefixSuffix = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"], {
|
|
671
|
+
variants: {
|
|
672
|
+
size: {
|
|
673
|
+
small: ["h-4"],
|
|
674
|
+
medium: ["h-4"],
|
|
675
|
+
large: ["h-5"],
|
|
676
|
+
},
|
|
677
|
+
},
|
|
678
|
+
defaultVariants: {
|
|
679
|
+
size: "medium",
|
|
680
|
+
},
|
|
681
|
+
});
|
|
682
|
+
const cvaIconButton = cssClassVarianceUtilities.cvaMerge([], {
|
|
683
|
+
variants: {
|
|
684
|
+
size: {
|
|
685
|
+
small: ["p-1.5", "w-7", "h-7"],
|
|
686
|
+
medium: ["p-2", "w-8", "h-8"],
|
|
687
|
+
large: ["p-2.5", "w-10", "h-10"],
|
|
688
|
+
},
|
|
689
|
+
},
|
|
690
|
+
defaultVariants: {
|
|
691
|
+
size: "medium",
|
|
667
692
|
},
|
|
668
693
|
});
|
|
669
694
|
|
|
670
695
|
/**
|
|
671
|
-
* Buttons allow users to
|
|
672
|
-
|
|
696
|
+
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.
|
|
697
|
+
*
|
|
698
|
+
* ### When to use
|
|
699
|
+
* Use buttons to communicate actions users can take and to allow users to interact with the page. Each page should have one primary button, and any remaining calls to action should be represented as lower emphasis buttons.
|
|
700
|
+
*
|
|
701
|
+
* ### When not to use
|
|
702
|
+
* Do not use buttons as navigational elements. Instead, use [Links](https://www.notion.so/Links-49638788b6c042698b40b94a318361f1?pvs=21) when the desired action is to take the user to a new page.
|
|
703
|
+
*
|
|
673
704
|
* @param {ButtonProps} props - The props for the Button component
|
|
674
705
|
* @returns {JSX.Element} Button component
|
|
675
706
|
*/
|
|
676
707
|
const Button = React__namespace.forwardRef((_a, ref) => {
|
|
677
|
-
var { onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix,
|
|
708
|
+
var { onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, renderAs = "button", circular } = _a, rest = __rest(_a, ["onClick", "children", "loading", "disabled", "className", "fullWidth", "prefix", "suffix", "variant", "type", "size", "square", "dataTestId", "title", "role", "tabIndex", "renderAs", "circular"]);
|
|
678
709
|
return React__namespace.createElement(renderAs, Object.assign({ ref,
|
|
679
710
|
title,
|
|
680
711
|
type,
|
|
681
712
|
role,
|
|
682
713
|
onClick,
|
|
683
|
-
tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square,
|
|
714
|
+
tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square, variant, loading, fullWidth, className }), "aria-label": title, "data-testid": dataTestId }, rest), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [loading ? (jsxRuntime.jsx(Spinner, { size: "small", centering: "vertically", containerClassName: cvaButtonSpinnerContainer(), className: cvaButtonSpinner({ variant }) })) : null, prefix && !loading ? jsxRuntime.jsx("div", { className: cvaButtonPrefixSuffix({ size: size }), children: prefix }) : null, children, suffix && !loading ? jsxRuntime.jsx("div", { className: cvaButtonPrefixSuffix({ size: size }), children: suffix }) : null] }));
|
|
684
715
|
});
|
|
685
716
|
Button.displayName = "Button";
|
|
686
717
|
|
|
687
718
|
/**
|
|
688
|
-
*
|
|
719
|
+
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
|
|
689
720
|
*/
|
|
690
721
|
const IconButton = React__namespace.forwardRef((_a, ref) => {
|
|
691
|
-
var { icon, size = "
|
|
692
|
-
return (jsxRuntime.jsx(Button, Object.assign({ size: size, prefix: !loading ? icon : undefined, square: square, loading: loading, disabled: disabled || loading, ref: ref }, rest)));
|
|
722
|
+
var { icon, size = "medium", square = true, loading, disabled, className } = _a, rest = __rest(_a, ["icon", "size", "square", "loading", "disabled", "className"]);
|
|
723
|
+
return (jsxRuntime.jsx(Button, Object.assign({ size: size, prefix: !loading ? icon : undefined, square: square, loading: loading, disabled: disabled || loading, ref: ref, className: cvaIconButton({ size: size, className }) }, rest)));
|
|
693
724
|
});
|
|
694
725
|
IconButton.displayName = "IconButton";
|
|
695
726
|
|
|
@@ -722,6 +753,16 @@ const cvaAlertContentContainer = cssClassVarianceUtilities.cvaMerge(["flex", "fl
|
|
|
722
753
|
const cvaAlertCloseButtonContainer = cssClassVarianceUtilities.cvaMerge(["flex", "self-start", "w-min", "shrink-0"]);
|
|
723
754
|
const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["self-start", "shrink-0", "grid", "w-min", "hidden", "@2xs:block"]);
|
|
724
755
|
|
|
756
|
+
const getSecondaryActionVariant = (color) => {
|
|
757
|
+
switch (color) {
|
|
758
|
+
case "danger":
|
|
759
|
+
return "secondary-danger";
|
|
760
|
+
case "warning":
|
|
761
|
+
return "ghost-neutral";
|
|
762
|
+
default:
|
|
763
|
+
return "ghost";
|
|
764
|
+
}
|
|
765
|
+
};
|
|
725
766
|
/**
|
|
726
767
|
* The Alert component should be used to inform the user of important information.
|
|
727
768
|
|
|
@@ -747,9 +788,9 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
747
788
|
const getButtonColor = () => {
|
|
748
789
|
switch (color) {
|
|
749
790
|
case "danger":
|
|
750
|
-
return "danger";
|
|
791
|
+
return "primary-danger";
|
|
751
792
|
case "warning":
|
|
752
|
-
return "
|
|
793
|
+
return "secondary-danger";
|
|
753
794
|
default:
|
|
754
795
|
return "primary";
|
|
755
796
|
}
|
|
@@ -761,7 +802,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
761
802
|
(_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
762
803
|
}
|
|
763
804
|
}, [ref, autoScroll]);
|
|
764
|
-
return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsxs("div", { className: cvaAlertContentContainer(), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? jsxRuntime.jsx(Text, { weight: "bold", children: title }) : null, children ? (jsxRuntime.jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer(), children: jsxRuntime.jsx(IconButton, { size: "small", variant: "
|
|
805
|
+
return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsxs("div", { className: cvaAlertContentContainer(), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? jsxRuntime.jsx(Text, { weight: "bold", children: title }) : null, children ? (jsxRuntime.jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer(), children: jsxRuntime.jsx(IconButton, { size: "small", variant: "ghost-neutral", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }), primaryAction || secondaryAction ? (jsxRuntime.jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction ? (jsxRuntime.jsx(Button, { size: "small", variant: getSecondaryActionVariant(color), onClick: secondaryAction.onClick, loading: secondaryAction.loading, children: secondaryAction.label })) : null, primaryAction ? (jsxRuntime.jsx(Button, { size: "small", variant: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction.loading, children: primaryAction.label })) : null] })) : null] }));
|
|
765
806
|
};
|
|
766
807
|
|
|
767
808
|
const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1004,7 +1045,7 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
|
|
|
1004
1045
|
density,
|
|
1005
1046
|
border: hideSeparator ? "borderless" : "default",
|
|
1006
1047
|
className,
|
|
1007
|
-
}), children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading ? (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxRuntime.jsxs("div", { className: "flex gap-x-2 gap-y-1", children: [actions, onClose ? (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "
|
|
1048
|
+
}), children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading ? (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxRuntime.jsxs("div", { className: "flex gap-x-2 gap-y-1", children: [actions, onClose ? (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "ghost-neutral", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" })) : null] })] }) }));
|
|
1008
1049
|
};
|
|
1009
1050
|
|
|
1010
1051
|
const cvaCollapse = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1048,7 +1089,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
1048
1089
|
}
|
|
1049
1090
|
setExpanded(!expanded);
|
|
1050
1091
|
}, [expanded, onToggle]);
|
|
1051
|
-
return (jsxRuntime.jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaCollapseHeader({ expanded }), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: [jsxRuntime.jsxs("div", { className: cvaCollapseLabelContainer(), children: [jsxRuntime.jsx(Text, { type: "span", weight: "bold", children: label }), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { name: "ChevronUpDown", size: "small" }), size: "medium", variant: "
|
|
1092
|
+
return (jsxRuntime.jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaCollapseHeader({ expanded }), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: [jsxRuntime.jsxs("div", { className: cvaCollapseLabelContainer(), children: [jsxRuntime.jsx(Text, { type: "span", weight: "bold", children: label }), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { name: "ChevronUpDown", size: "small" }), size: "medium", variant: "ghost-neutral" })] }), headerAddon ? headerAddon : null] }), jsxRuntime.jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
|
|
1052
1093
|
};
|
|
1053
1094
|
const Collapsible = ({ children, expanded, id }) => {
|
|
1054
1095
|
const [ref, { height }] = reactUse.useMeasure();
|
|
@@ -1277,7 +1318,7 @@ const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
|
|
|
1277
1318
|
* @returns {JSX.Element} DayPickerPopover component
|
|
1278
1319
|
*/
|
|
1279
1320
|
const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, onDaySelect, color = "secondary", placement, size = "small", buttonContent, language, }) => {
|
|
1280
|
-
return (jsxRuntime.jsxs(Popover, { placement: placement, children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(Button, {
|
|
1321
|
+
return (jsxRuntime.jsxs(Popover, { placement: placement, children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(Button, { variant: color, size: size, className: className, prefix: jsxRuntime.jsx(Icon, { name: "Calendar", size: "small" }), dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "show-day-picker", children: buttonContent }) }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx(Card, { children: jsxRuntime.jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) }) })] }));
|
|
1281
1322
|
};
|
|
1282
1323
|
|
|
1283
1324
|
/**
|
|
@@ -1791,7 +1832,7 @@ const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
|
1791
1832
|
size: "small",
|
|
1792
1833
|
circular: true,
|
|
1793
1834
|
square: true,
|
|
1794
|
-
|
|
1835
|
+
variant: "secondary",
|
|
1795
1836
|
}, customButton, customPortalId, children, }) => {
|
|
1796
1837
|
const actionMenuRef = React.useRef(null);
|
|
1797
1838
|
return (jsxRuntime.jsx("div", { ref: actionMenuRef, className: cvaMoreMenu({ className }), "data-testid": dataTestId, children: jsxRuntime.jsxs(Popover, Object.assign({}, popoverProps, { children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsxRuntime.jsx(Icon, Object.assign({ name: "EllipsisHorizontal" }, iconProps)) })) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] })) }));
|
|
@@ -1814,7 +1855,6 @@ const cvaModalBackdrop = cssClassVarianceUtilities.cvaMerge([
|
|
|
1814
1855
|
"left-0",
|
|
1815
1856
|
"w-full",
|
|
1816
1857
|
"h-full",
|
|
1817
|
-
"bg-black/50",
|
|
1818
1858
|
"z-20",
|
|
1819
1859
|
"invisible",
|
|
1820
1860
|
"opacity-0",
|
|
@@ -1825,6 +1865,10 @@ const cvaModalBackdrop = cssClassVarianceUtilities.cvaMerge([
|
|
|
1825
1865
|
true: "animate-modal-fade",
|
|
1826
1866
|
false: "",
|
|
1827
1867
|
},
|
|
1868
|
+
noShadow: {
|
|
1869
|
+
true: "",
|
|
1870
|
+
false: "bg-black/50",
|
|
1871
|
+
},
|
|
1828
1872
|
},
|
|
1829
1873
|
});
|
|
1830
1874
|
|
|
@@ -1834,9 +1878,9 @@ const cvaModalBackdrop = cssClassVarianceUtilities.cvaMerge([
|
|
|
1834
1878
|
* @param {ModalBackdropProps} props - The props for the ModalBackdrop component
|
|
1835
1879
|
* @returns {JSX.Element} ModalBackdrop component
|
|
1836
1880
|
*/
|
|
1837
|
-
const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
1881
|
+
const ModalBackdrop = ({ children, isVisible, onClick, noShadow }) => {
|
|
1838
1882
|
const ref = React__namespace.useRef(null);
|
|
1839
|
-
return (jsxRuntime.jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible }), onMouseDown: e => {
|
|
1883
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible, noShadow }), onMouseDown: e => {
|
|
1840
1884
|
// only react on click on backdrop - accessing first child to get around styled element element
|
|
1841
1885
|
if (ref.current !== null && e.target === ref.current.children[0]) {
|
|
1842
1886
|
onClick();
|
|
@@ -1850,10 +1894,10 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
|
1850
1894
|
* - The modal component provides a foundation for creating dialogs, lightboxes, etc.
|
|
1851
1895
|
|
|
1852
1896
|
*/
|
|
1853
|
-
const Modal = React__namespace.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
|
|
1897
|
+
const Modal = React__namespace.forwardRef(({ isOpen, children, dataTestId, className, role = "", noBackdropShadow = false, onDismissClick = () => {
|
|
1854
1898
|
return;
|
|
1855
1899
|
}, }, ref) => {
|
|
1856
|
-
return (jsxRuntime.jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, children: isOpen ? (jsxRuntime.jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsxRuntime.jsx(Card, { dataTestId: dataTestId, className: cvaModalCard({ className }), children: children }) })) : null }));
|
|
1900
|
+
return (jsxRuntime.jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, noShadow: noBackdropShadow, children: isOpen ? (jsxRuntime.jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsxRuntime.jsx(Card, { dataTestId: dataTestId, className: cvaModalCard({ className }), children: children }) })) : null }));
|
|
1857
1901
|
});
|
|
1858
1902
|
Modal.displayName = "Modal";
|
|
1859
1903
|
|
|
@@ -1943,7 +1987,7 @@ const PageHeader = ({ className, dataTestId, action, showLoading, description, l
|
|
|
1943
1987
|
return (jsxRuntime.jsxs("div", { className: cvaPageHeaderContainer({
|
|
1944
1988
|
className,
|
|
1945
1989
|
withBorder: !tabsList,
|
|
1946
|
-
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsxRuntime.jsx(IconButton, { to: backTo, renderAs: reactRouterDom.Link,
|
|
1990
|
+
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsxRuntime.jsx(IconButton, { to: backTo, renderAs: reactRouterDom.Link, variant: "ghost-neutral", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }) })) : undefined, jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxRuntime.jsxs("div", { className: cvaPageHeaderDescriptionAndLinkContainer(), children: [jsxRuntime.jsx(Tooltip, { label: description, dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: "QuestionMarkCircle" }, placement: "bottom" }), link ? (jsxRuntime.jsxs(reactRouterDom.Link, { to: link, "data-testid": "tooltip-link", target: "_blank", className: cvaPageHeaderLink(), children: [linkText, jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] })) : undefined] }), tag && !showLoading ? (jsxRuntime.jsx(Tag, { dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, color: tagColor, children: tag })) : undefined, showLoading ? (jsxRuntime.jsx(Spinner, { dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined, centering: "vertically" })) : null, action] }), children ? jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
|
|
1947
1991
|
};
|
|
1948
1992
|
|
|
1949
1993
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -1992,9 +2036,9 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
1992
2036
|
if (loading) {
|
|
1993
2037
|
return (jsxRuntime.jsx("div", { className: cvaPagination({ className }), children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) }));
|
|
1994
2038
|
}
|
|
1995
|
-
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small",
|
|
2039
|
+
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", variant: "ghost-neutral" }), !cursorBase && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount ? getTranslatedCount(pageCount) : null })] })), jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
1996
2040
|
? !canNextPage || false
|
|
1997
|
-
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small",
|
|
2041
|
+
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small", variant: "ghost-neutral" })] }));
|
|
1998
2042
|
};
|
|
1999
2043
|
|
|
2000
2044
|
function useConfirmExit(confirmExit, when = true) {
|
|
@@ -2189,8 +2233,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2189
2233
|
});
|
|
2190
2234
|
}) }), overflowItemCount > 0 ? (jsxRuntime.jsx(MoreMenu, Object.assign({ iconButtonProps: {
|
|
2191
2235
|
circular: false,
|
|
2192
|
-
variant: "
|
|
2193
|
-
color: "secondary",
|
|
2236
|
+
variant: "ghost-neutral",
|
|
2194
2237
|
}, popoverProps: { placement: "bottom-end" } }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsxRuntime.jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId ? `${dataTestId}-menu-list` : undefined, children: React__default["default"].Children.map(children, child => {
|
|
2195
2238
|
return itemOverflowMap[child.props.id]
|
|
2196
2239
|
? React__default["default"].cloneElement(child, {
|
|
@@ -3072,7 +3115,11 @@ exports.Tooltip = Tooltip;
|
|
|
3072
3115
|
exports.ValueBar = ValueBar;
|
|
3073
3116
|
exports.WidgetBody = WidgetBody;
|
|
3074
3117
|
exports.cvaButton = cvaButton;
|
|
3118
|
+
exports.cvaButtonPrefixSuffix = cvaButtonPrefixSuffix;
|
|
3119
|
+
exports.cvaButtonSpinner = cvaButtonSpinner;
|
|
3120
|
+
exports.cvaButtonSpinnerContainer = cvaButtonSpinnerContainer;
|
|
3075
3121
|
exports.cvaClickable = cvaClickable;
|
|
3122
|
+
exports.cvaIconButton = cvaIconButton;
|
|
3076
3123
|
exports.cvaIndicator = cvaIndicator;
|
|
3077
3124
|
exports.cvaIndicatorIcon = cvaIndicatorIcon;
|
|
3078
3125
|
exports.cvaIndicatorIconBackground = cvaIndicatorIconBackground;
|
package/index.esm.js
CHANGED
|
@@ -454,68 +454,74 @@ const cvaButton = cvaMerge([
|
|
|
454
454
|
"focus:ring",
|
|
455
455
|
"focus:ring-inset",
|
|
456
456
|
"focus:outline-none",
|
|
457
|
+
"focus:ring-primary-600",
|
|
457
458
|
"disabled:cursor-not-allowed",
|
|
458
|
-
"text-sm",
|
|
459
459
|
"font-medium",
|
|
460
460
|
"align-middle",
|
|
461
|
+
"rounded-md",
|
|
461
462
|
], {
|
|
462
463
|
variants: {
|
|
463
|
-
|
|
464
|
+
variant: {
|
|
464
465
|
primary: [
|
|
466
|
+
"text-white",
|
|
465
467
|
"bg-primary-600",
|
|
468
|
+
"hover:bg-primary-700",
|
|
469
|
+
"active:bg-primary-800",
|
|
470
|
+
"disabled:bg-slate-400",
|
|
471
|
+
"disabled:text-slate-200",
|
|
472
|
+
],
|
|
473
|
+
"primary-danger": [
|
|
466
474
|
"text-white",
|
|
467
|
-
"
|
|
468
|
-
"
|
|
469
|
-
"
|
|
470
|
-
"disabled:hover:bg-slate-400",
|
|
475
|
+
"bg-danger-600",
|
|
476
|
+
"hover:bg-danger-700",
|
|
477
|
+
"active:bg-danger-800",
|
|
471
478
|
"disabled:bg-slate-400",
|
|
472
479
|
"disabled:text-slate-200",
|
|
473
480
|
],
|
|
474
481
|
secondary: [
|
|
475
|
-
"
|
|
476
|
-
"
|
|
477
|
-
"
|
|
478
|
-
"
|
|
479
|
-
"
|
|
480
|
-
"
|
|
481
|
-
"
|
|
482
|
-
"
|
|
483
|
-
"disabled:text-secondary-400",
|
|
484
|
-
],
|
|
485
|
-
danger: [
|
|
486
|
-
"bg-danger-600",
|
|
487
|
-
"text-white",
|
|
488
|
-
"hover:bg-danger-800",
|
|
489
|
-
"active:bg-danger-700",
|
|
490
|
-
"focus:ring-danger-300",
|
|
482
|
+
"bg-white",
|
|
483
|
+
"border",
|
|
484
|
+
"border-slate-300",
|
|
485
|
+
"text-slate-600",
|
|
486
|
+
"hover:bg-slate-100",
|
|
487
|
+
"hover:text-slate-700",
|
|
488
|
+
"active:bg-slate-200",
|
|
489
|
+
"active:text-slate-800",
|
|
491
490
|
"disabled:bg-slate-200",
|
|
492
|
-
"disabled:hover:bg-slate-200",
|
|
493
|
-
"disabled:text-slate-400",
|
|
494
|
-
],
|
|
495
|
-
warning: [
|
|
496
|
-
"bg-warning-50",
|
|
497
|
-
"text-warning-600",
|
|
498
|
-
"hover:bg-warning-200",
|
|
499
|
-
"hover:text-warning-800",
|
|
500
|
-
"active:text-warning-700",
|
|
501
|
-
"active:bg-warning-100",
|
|
502
|
-
"focus:ring-warning-300",
|
|
503
|
-
"disabled:bg-warning-50",
|
|
504
|
-
"disabled:hover:bg-warning-50",
|
|
505
491
|
"disabled:text-slate-400",
|
|
506
492
|
],
|
|
507
|
-
|
|
493
|
+
"secondary-danger": [
|
|
508
494
|
"bg-white",
|
|
509
495
|
"border",
|
|
510
|
-
"text-slate-600",
|
|
511
|
-
"active:bg-slate-100",
|
|
512
|
-
"active:text-slate-700",
|
|
513
|
-
"focus:ring-slate-300",
|
|
514
|
-
"hover:bg-slate-200",
|
|
515
|
-
"hover:text-slate-800",
|
|
516
496
|
"border-slate-300",
|
|
517
|
-
"
|
|
518
|
-
"
|
|
497
|
+
"text-danger-600",
|
|
498
|
+
"hover:bg-danger-100",
|
|
499
|
+
"hover:text-danger-700",
|
|
500
|
+
"hover:border-danger-700",
|
|
501
|
+
"active:bg-danger-200",
|
|
502
|
+
"active:text-danger-800",
|
|
503
|
+
"active:border-danger-800",
|
|
504
|
+
"disabled:bg-slate-300",
|
|
505
|
+
"disabled:text-slate-400",
|
|
506
|
+
],
|
|
507
|
+
ghost: [
|
|
508
|
+
"bg-transparent",
|
|
509
|
+
"text-primary-600",
|
|
510
|
+
"hover:bg-black/5",
|
|
511
|
+
"hover:text-primary-700",
|
|
512
|
+
"active:bg-black/10",
|
|
513
|
+
"active:text-primary-800",
|
|
514
|
+
"disabled:bg-transparent",
|
|
515
|
+
"disabled:text-slate-400",
|
|
516
|
+
],
|
|
517
|
+
"ghost-neutral": [
|
|
518
|
+
"bg-transparent",
|
|
519
|
+
"text-slate-600",
|
|
520
|
+
"hover:bg-black/5",
|
|
521
|
+
"hover:text-slate-700",
|
|
522
|
+
"active:bg-black/10",
|
|
523
|
+
"active:text-slate-800",
|
|
524
|
+
"disabled:bg-transparent",
|
|
519
525
|
"disabled:text-slate-400",
|
|
520
526
|
],
|
|
521
527
|
},
|
|
@@ -535,9 +541,17 @@ const cvaButton = cvaMerge([
|
|
|
535
541
|
* So we need to add padding to the min-height calculation. Two times the vertical
|
|
536
542
|
* padding aka py-1 * 2 aka --spacing-1 * 2 aka spacing-2 (for small).
|
|
537
543
|
*/
|
|
538
|
-
small: ["py-1", "
|
|
539
|
-
medium: ["py-1.5", "
|
|
540
|
-
large: [
|
|
544
|
+
small: ["px-2", "py-1.5", "gap-1", "h-7", "text-xs", "min-h-[calc(var(--line-height-sm)+var(--spacing-2))]"],
|
|
545
|
+
medium: ["px-3", "py-1.5", "gap-2", "h-8", "text-sm", "min-h-[calc(var(--line-height-sm)+var(--spacing-3))]"],
|
|
546
|
+
large: [
|
|
547
|
+
"px-4",
|
|
548
|
+
"py-2",
|
|
549
|
+
"h-10",
|
|
550
|
+
"gap-2",
|
|
551
|
+
"text-base",
|
|
552
|
+
"rounded-lg",
|
|
553
|
+
"min-h-[calc(var(--line-height-sm)+var(--spacing-4))]",
|
|
554
|
+
],
|
|
541
555
|
},
|
|
542
556
|
rounded: {
|
|
543
557
|
true: ["rounded-full"],
|
|
@@ -555,9 +569,9 @@ const cvaButton = cvaMerge([
|
|
|
555
569
|
true: ["cursor-not-allowed", "pointer-events-none", "bg-slate-200", "hover:bg-slate-200", "text-slate-400"],
|
|
556
570
|
false: [],
|
|
557
571
|
},
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
572
|
+
loading: {
|
|
573
|
+
true: ["bg-transparent"],
|
|
574
|
+
false: [],
|
|
561
575
|
},
|
|
562
576
|
},
|
|
563
577
|
compoundVariants: [
|
|
@@ -577,88 +591,105 @@ const cvaButton = cvaMerge([
|
|
|
577
591
|
className: ["p-2"],
|
|
578
592
|
},
|
|
579
593
|
{
|
|
580
|
-
|
|
581
|
-
variant: "
|
|
582
|
-
className: [
|
|
583
|
-
"text-primary-600",
|
|
584
|
-
"hover:text-primary-700",
|
|
585
|
-
"active:bg-primary-700",
|
|
586
|
-
"focus:ring-primary-300",
|
|
587
|
-
"hover:bg-primary-500/10",
|
|
588
|
-
],
|
|
594
|
+
loading: true,
|
|
595
|
+
variant: "primary",
|
|
596
|
+
className: ['disabled:bg-primary-600'],
|
|
589
597
|
},
|
|
590
598
|
{
|
|
591
|
-
|
|
592
|
-
variant: "
|
|
593
|
-
className: [
|
|
594
|
-
"text-secondary-600",
|
|
595
|
-
"hover:text-secondary-800",
|
|
596
|
-
"active:text-secondary-700",
|
|
597
|
-
"active:bg-black/10",
|
|
598
|
-
"focus:ring-secondary-300",
|
|
599
|
-
"hover:bg-black/5",
|
|
600
|
-
],
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
color: "warning",
|
|
604
|
-
variant: "transparent",
|
|
605
|
-
className: [
|
|
606
|
-
"text-warning-600",
|
|
607
|
-
"active:bg-warning-500/20",
|
|
608
|
-
"focus:ring-warning-300",
|
|
609
|
-
"hover:bg-warning-500/10",
|
|
610
|
-
],
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
color: "danger",
|
|
614
|
-
variant: "transparent",
|
|
615
|
-
className: ["text-danger-600", "active:bg-danger-600/10", "focus:ring-danger-300", "hover:bg-danger-600/10"],
|
|
599
|
+
loading: true,
|
|
600
|
+
variant: "primary-danger",
|
|
601
|
+
className: ["disabled:bg-danger-600"],
|
|
616
602
|
},
|
|
617
603
|
{
|
|
618
|
-
|
|
619
|
-
variant: "
|
|
620
|
-
className: ["
|
|
604
|
+
loading: true,
|
|
605
|
+
variant: "secondary",
|
|
606
|
+
className: ["disabled:bg-white"],
|
|
621
607
|
},
|
|
622
608
|
{
|
|
623
|
-
|
|
624
|
-
variant: "
|
|
625
|
-
className: ["
|
|
609
|
+
loading: true,
|
|
610
|
+
variant: "secondary-danger",
|
|
611
|
+
className: ["disabled:bg-white"],
|
|
626
612
|
},
|
|
627
613
|
],
|
|
628
614
|
defaultVariants: {
|
|
629
|
-
|
|
615
|
+
variant: "primary",
|
|
630
616
|
size: "medium",
|
|
631
617
|
rounded: false,
|
|
632
618
|
fullWidth: false,
|
|
633
619
|
square: false,
|
|
634
620
|
disabled: false,
|
|
635
|
-
|
|
621
|
+
},
|
|
622
|
+
});
|
|
623
|
+
const cvaButtonSpinnerContainer = cvaMerge(["p-0", "h-auto"]);
|
|
624
|
+
const cvaButtonSpinner = cvaMerge([], {
|
|
625
|
+
variants: {
|
|
626
|
+
variant: {
|
|
627
|
+
primary: ["border-white/[0.32]", "border-b-white"],
|
|
628
|
+
"primary-danger": ["border-white/[0.32]", "border-b-white"],
|
|
629
|
+
secondary: ['h-3.5', 'w-3.5'],
|
|
630
|
+
"secondary-danger": ['h-3.5', 'w-3.5'],
|
|
631
|
+
ghost: [],
|
|
632
|
+
"ghost-neutral": [],
|
|
633
|
+
},
|
|
634
|
+
},
|
|
635
|
+
defaultVariants: {
|
|
636
|
+
variant: "primary",
|
|
637
|
+
},
|
|
638
|
+
});
|
|
639
|
+
const cvaButtonPrefixSuffix = cvaMerge(["flex", "items-center"], {
|
|
640
|
+
variants: {
|
|
641
|
+
size: {
|
|
642
|
+
small: ["h-4"],
|
|
643
|
+
medium: ["h-4"],
|
|
644
|
+
large: ["h-5"],
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
defaultVariants: {
|
|
648
|
+
size: "medium",
|
|
649
|
+
},
|
|
650
|
+
});
|
|
651
|
+
const cvaIconButton = cvaMerge([], {
|
|
652
|
+
variants: {
|
|
653
|
+
size: {
|
|
654
|
+
small: ["p-1.5", "w-7", "h-7"],
|
|
655
|
+
medium: ["p-2", "w-8", "h-8"],
|
|
656
|
+
large: ["p-2.5", "w-10", "h-10"],
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
defaultVariants: {
|
|
660
|
+
size: "medium",
|
|
636
661
|
},
|
|
637
662
|
});
|
|
638
663
|
|
|
639
664
|
/**
|
|
640
|
-
* Buttons allow users to
|
|
641
|
-
|
|
665
|
+
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.
|
|
666
|
+
*
|
|
667
|
+
* ### When to use
|
|
668
|
+
* Use buttons to communicate actions users can take and to allow users to interact with the page. Each page should have one primary button, and any remaining calls to action should be represented as lower emphasis buttons.
|
|
669
|
+
*
|
|
670
|
+
* ### When not to use
|
|
671
|
+
* Do not use buttons as navigational elements. Instead, use [Links](https://www.notion.so/Links-49638788b6c042698b40b94a318361f1?pvs=21) when the desired action is to take the user to a new page.
|
|
672
|
+
*
|
|
642
673
|
* @param {ButtonProps} props - The props for the Button component
|
|
643
674
|
* @returns {JSX.Element} Button component
|
|
644
675
|
*/
|
|
645
676
|
const Button = React.forwardRef((_a, ref) => {
|
|
646
|
-
var { onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix,
|
|
677
|
+
var { onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, renderAs = "button", circular } = _a, rest = __rest(_a, ["onClick", "children", "loading", "disabled", "className", "fullWidth", "prefix", "suffix", "variant", "type", "size", "square", "dataTestId", "title", "role", "tabIndex", "renderAs", "circular"]);
|
|
647
678
|
return React.createElement(renderAs, Object.assign({ ref,
|
|
648
679
|
title,
|
|
649
680
|
type,
|
|
650
681
|
role,
|
|
651
682
|
onClick,
|
|
652
|
-
tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square,
|
|
683
|
+
tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square, variant, loading, fullWidth, className }), "aria-label": title, "data-testid": dataTestId }, rest), jsxs(Fragment, { children: [loading ? (jsx(Spinner, { size: "small", centering: "vertically", containerClassName: cvaButtonSpinnerContainer(), className: cvaButtonSpinner({ variant }) })) : null, prefix && !loading ? jsx("div", { className: cvaButtonPrefixSuffix({ size: size }), children: prefix }) : null, children, suffix && !loading ? jsx("div", { className: cvaButtonPrefixSuffix({ size: size }), children: suffix }) : null] }));
|
|
653
684
|
});
|
|
654
685
|
Button.displayName = "Button";
|
|
655
686
|
|
|
656
687
|
/**
|
|
657
|
-
*
|
|
688
|
+
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
|
|
658
689
|
*/
|
|
659
690
|
const IconButton = React.forwardRef((_a, ref) => {
|
|
660
|
-
var { icon, size = "
|
|
661
|
-
return (jsx(Button, Object.assign({ size: size, prefix: !loading ? icon : undefined, square: square, loading: loading, disabled: disabled || loading, ref: ref }, rest)));
|
|
691
|
+
var { icon, size = "medium", square = true, loading, disabled, className } = _a, rest = __rest(_a, ["icon", "size", "square", "loading", "disabled", "className"]);
|
|
692
|
+
return (jsx(Button, Object.assign({ size: size, prefix: !loading ? icon : undefined, square: square, loading: loading, disabled: disabled || loading, ref: ref, className: cvaIconButton({ size: size, className }) }, rest)));
|
|
662
693
|
});
|
|
663
694
|
IconButton.displayName = "IconButton";
|
|
664
695
|
|
|
@@ -691,6 +722,16 @@ const cvaAlertContentContainer = cvaMerge(["flex", "flex-row", "h-full", "gap-2"
|
|
|
691
722
|
const cvaAlertCloseButtonContainer = cvaMerge(["flex", "self-start", "w-min", "shrink-0"]);
|
|
692
723
|
const cvaAlertIconContainer = cvaMerge(["self-start", "shrink-0", "grid", "w-min", "hidden", "@2xs:block"]);
|
|
693
724
|
|
|
725
|
+
const getSecondaryActionVariant = (color) => {
|
|
726
|
+
switch (color) {
|
|
727
|
+
case "danger":
|
|
728
|
+
return "secondary-danger";
|
|
729
|
+
case "warning":
|
|
730
|
+
return "ghost-neutral";
|
|
731
|
+
default:
|
|
732
|
+
return "ghost";
|
|
733
|
+
}
|
|
734
|
+
};
|
|
694
735
|
/**
|
|
695
736
|
* The Alert component should be used to inform the user of important information.
|
|
696
737
|
|
|
@@ -716,9 +757,9 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
716
757
|
const getButtonColor = () => {
|
|
717
758
|
switch (color) {
|
|
718
759
|
case "danger":
|
|
719
|
-
return "danger";
|
|
760
|
+
return "primary-danger";
|
|
720
761
|
case "warning":
|
|
721
|
-
return "
|
|
762
|
+
return "secondary-danger";
|
|
722
763
|
default:
|
|
723
764
|
return "primary";
|
|
724
765
|
}
|
|
@@ -730,7 +771,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
730
771
|
(_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
731
772
|
}
|
|
732
773
|
}, [ref, autoScroll]);
|
|
733
|
-
return (jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxs("div", { className: cvaAlertContentContainer(), children: [jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxs("div", { className: cvaContent(), children: [title ? jsx(Text, { weight: "bold", children: title }) : null, children ? (jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsx("div", { className: cvaAlertCloseButtonContainer(), children: jsx(IconButton, { size: "small", variant: "
|
|
774
|
+
return (jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxs("div", { className: cvaAlertContentContainer(), children: [jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxs("div", { className: cvaContent(), children: [title ? jsx(Text, { weight: "bold", children: title }) : null, children ? (jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsx("div", { className: cvaAlertCloseButtonContainer(), children: jsx(IconButton, { size: "small", variant: "ghost-neutral", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }), primaryAction || secondaryAction ? (jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction ? (jsx(Button, { size: "small", variant: getSecondaryActionVariant(color), onClick: secondaryAction.onClick, loading: secondaryAction.loading, children: secondaryAction.label })) : null, primaryAction ? (jsx(Button, { size: "small", variant: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction.loading, children: primaryAction.label })) : null] })) : null] }));
|
|
734
775
|
};
|
|
735
776
|
|
|
736
777
|
const cvaBadge = cvaMerge([
|
|
@@ -973,7 +1014,7 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
|
|
|
973
1014
|
density,
|
|
974
1015
|
border: hideSeparator ? "borderless" : "default",
|
|
975
1016
|
className,
|
|
976
|
-
}), children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxs("div", { className: "flex gap-x-2 gap-y-1", children: [actions, onClose ? (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "
|
|
1017
|
+
}), children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxs("div", { className: "flex gap-x-2 gap-y-1", children: [actions, onClose ? (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "ghost-neutral", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" })) : null] })] }) }));
|
|
977
1018
|
};
|
|
978
1019
|
|
|
979
1020
|
const cvaCollapse = cvaMerge([
|
|
@@ -1017,7 +1058,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
1017
1058
|
}
|
|
1018
1059
|
setExpanded(!expanded);
|
|
1019
1060
|
}, [expanded, onToggle]);
|
|
1020
|
-
return (jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaCollapseHeader({ expanded }), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: [jsxs("div", { className: cvaCollapseLabelContainer(), children: [jsx(Text, { type: "span", weight: "bold", children: label }), jsx(IconButton, { icon: jsx(Icon, { name: "ChevronUpDown", size: "small" }), size: "medium", variant: "
|
|
1061
|
+
return (jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaCollapseHeader({ expanded }), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: [jsxs("div", { className: cvaCollapseLabelContainer(), children: [jsx(Text, { type: "span", weight: "bold", children: label }), jsx(IconButton, { icon: jsx(Icon, { name: "ChevronUpDown", size: "small" }), size: "medium", variant: "ghost-neutral" })] }), headerAddon ? headerAddon : null] }), jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
|
|
1021
1062
|
};
|
|
1022
1063
|
const Collapsible = ({ children, expanded, id }) => {
|
|
1023
1064
|
const [ref, { height }] = useMeasure();
|
|
@@ -1246,7 +1287,7 @@ const PopoverTrigger = forwardRef(function PopoverTrigger(_a, propRef) {
|
|
|
1246
1287
|
* @returns {JSX.Element} DayPickerPopover component
|
|
1247
1288
|
*/
|
|
1248
1289
|
const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, onDaySelect, color = "secondary", placement, size = "small", buttonContent, language, }) => {
|
|
1249
|
-
return (jsxs(Popover, { placement: placement, children: [jsx(PopoverTrigger, { children: jsx(Button, {
|
|
1290
|
+
return (jsxs(Popover, { placement: placement, children: [jsx(PopoverTrigger, { children: jsx(Button, { variant: color, size: size, className: className, prefix: jsx(Icon, { name: "Calendar", size: "small" }), dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "show-day-picker", children: buttonContent }) }), jsx(PopoverContent, { children: jsx(Card, { children: jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) }) })] }));
|
|
1250
1291
|
};
|
|
1251
1292
|
|
|
1252
1293
|
/**
|
|
@@ -1760,7 +1801,7 @@ const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
|
1760
1801
|
size: "small",
|
|
1761
1802
|
circular: true,
|
|
1762
1803
|
square: true,
|
|
1763
|
-
|
|
1804
|
+
variant: "secondary",
|
|
1764
1805
|
}, customButton, customPortalId, children, }) => {
|
|
1765
1806
|
const actionMenuRef = useRef(null);
|
|
1766
1807
|
return (jsx("div", { ref: actionMenuRef, className: cvaMoreMenu({ className }), "data-testid": dataTestId, children: jsxs(Popover, Object.assign({}, popoverProps, { children: [jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsx(Icon, Object.assign({ name: "EllipsisHorizontal" }, iconProps)) })) }), jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] })) }));
|
|
@@ -1783,7 +1824,6 @@ const cvaModalBackdrop = cvaMerge([
|
|
|
1783
1824
|
"left-0",
|
|
1784
1825
|
"w-full",
|
|
1785
1826
|
"h-full",
|
|
1786
|
-
"bg-black/50",
|
|
1787
1827
|
"z-20",
|
|
1788
1828
|
"invisible",
|
|
1789
1829
|
"opacity-0",
|
|
@@ -1794,6 +1834,10 @@ const cvaModalBackdrop = cvaMerge([
|
|
|
1794
1834
|
true: "animate-modal-fade",
|
|
1795
1835
|
false: "",
|
|
1796
1836
|
},
|
|
1837
|
+
noShadow: {
|
|
1838
|
+
true: "",
|
|
1839
|
+
false: "bg-black/50",
|
|
1840
|
+
},
|
|
1797
1841
|
},
|
|
1798
1842
|
});
|
|
1799
1843
|
|
|
@@ -1803,9 +1847,9 @@ const cvaModalBackdrop = cvaMerge([
|
|
|
1803
1847
|
* @param {ModalBackdropProps} props - The props for the ModalBackdrop component
|
|
1804
1848
|
* @returns {JSX.Element} ModalBackdrop component
|
|
1805
1849
|
*/
|
|
1806
|
-
const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
1850
|
+
const ModalBackdrop = ({ children, isVisible, onClick, noShadow }) => {
|
|
1807
1851
|
const ref = React.useRef(null);
|
|
1808
|
-
return (jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible }), onMouseDown: e => {
|
|
1852
|
+
return (jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible, noShadow }), onMouseDown: e => {
|
|
1809
1853
|
// only react on click on backdrop - accessing first child to get around styled element element
|
|
1810
1854
|
if (ref.current !== null && e.target === ref.current.children[0]) {
|
|
1811
1855
|
onClick();
|
|
@@ -1819,10 +1863,10 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
|
1819
1863
|
* - The modal component provides a foundation for creating dialogs, lightboxes, etc.
|
|
1820
1864
|
|
|
1821
1865
|
*/
|
|
1822
|
-
const Modal = React.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
|
|
1866
|
+
const Modal = React.forwardRef(({ isOpen, children, dataTestId, className, role = "", noBackdropShadow = false, onDismissClick = () => {
|
|
1823
1867
|
return;
|
|
1824
1868
|
}, }, ref) => {
|
|
1825
|
-
return (jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, children: isOpen ? (jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsx(Card, { dataTestId: dataTestId, className: cvaModalCard({ className }), children: children }) })) : null }));
|
|
1869
|
+
return (jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, noShadow: noBackdropShadow, children: isOpen ? (jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsx(Card, { dataTestId: dataTestId, className: cvaModalCard({ className }), children: children }) })) : null }));
|
|
1826
1870
|
});
|
|
1827
1871
|
Modal.displayName = "Modal";
|
|
1828
1872
|
|
|
@@ -1912,7 +1956,7 @@ const PageHeader = ({ className, dataTestId, action, showLoading, description, l
|
|
|
1912
1956
|
return (jsxs("div", { className: cvaPageHeaderContainer({
|
|
1913
1957
|
className,
|
|
1914
1958
|
withBorder: !tabsList,
|
|
1915
|
-
}), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeader(), children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsx(IconButton, { to: backTo, renderAs: Link,
|
|
1959
|
+
}), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeader(), children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsx(IconButton, { to: backTo, renderAs: Link, variant: "ghost-neutral", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })) : undefined, jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxs("div", { className: cvaPageHeaderDescriptionAndLinkContainer(), children: [jsx(Tooltip, { label: description, dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: "QuestionMarkCircle" }, placement: "bottom" }), link ? (jsxs(Link, { to: link, "data-testid": "tooltip-link", target: "_blank", className: cvaPageHeaderLink(), children: [linkText, jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] })) : undefined] }), tag && !showLoading ? (jsx(Tag, { dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, color: tagColor, children: tag })) : undefined, showLoading ? (jsx(Spinner, { dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined, centering: "vertically" })) : null, action] }), children ? jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
|
|
1916
1960
|
};
|
|
1917
1961
|
|
|
1918
1962
|
const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -1961,9 +2005,9 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
1961
2005
|
if (loading) {
|
|
1962
2006
|
return (jsx("div", { className: cvaPagination({ className }), children: jsx(SkeletonLines, { height: 16, width: 150 }) }));
|
|
1963
2007
|
}
|
|
1964
|
-
return (jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small",
|
|
2008
|
+
return (jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", variant: "ghost-neutral" }), !cursorBase && (jsxs(Fragment, { children: [jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount ? getTranslatedCount(pageCount) : null })] })), jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
1965
2009
|
? !canNextPage || false
|
|
1966
|
-
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small",
|
|
2010
|
+
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small", variant: "ghost-neutral" })] }));
|
|
1967
2011
|
};
|
|
1968
2012
|
|
|
1969
2013
|
function useConfirmExit(confirmExit, when = true) {
|
|
@@ -2158,8 +2202,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2158
2202
|
});
|
|
2159
2203
|
}) }), overflowItemCount > 0 ? (jsx(MoreMenu, Object.assign({ iconButtonProps: {
|
|
2160
2204
|
circular: false,
|
|
2161
|
-
variant: "
|
|
2162
|
-
color: "secondary",
|
|
2205
|
+
variant: "ghost-neutral",
|
|
2163
2206
|
}, popoverProps: { placement: "bottom-end" } }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId ? `${dataTestId}-menu-list` : undefined, children: React__default.Children.map(children, child => {
|
|
2164
2207
|
return itemOverflowMap[child.props.id]
|
|
2165
2208
|
? React__default.cloneElement(child, {
|
|
@@ -2990,4 +3033,4 @@ const useVisibilityChange = ({ onChange, targetState = "hidden" }) => {
|
|
|
2990
3033
|
}, [onChange, targetState]);
|
|
2991
3034
|
};
|
|
2992
3035
|
|
|
2993
|
-
export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PackageNameStoryComponent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, Tooltip, ValueBar, WidgetBody, cvaButton, cvaClickable, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useVisibilityChange };
|
|
3036
|
+
export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PackageNameStoryComponent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, Tooltip, ValueBar, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useVisibilityChange };
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { Matcher } from "react-day-picker";
|
|
3
3
|
import { CommonProps, Size } from "../../common/CommonProps";
|
|
4
4
|
import { PopoverPlacement } from "../Popover";
|
|
5
|
-
import {
|
|
5
|
+
import { ButtonVariant } from "../buttons";
|
|
6
6
|
export interface DayPickerPopoverProps extends CommonProps {
|
|
7
7
|
disabledDays?: Matcher | Matcher[] | undefined;
|
|
8
8
|
onDaySelect: (day: Date) => void;
|
|
9
9
|
selectedDay?: Date;
|
|
10
|
-
color?:
|
|
10
|
+
color?: ButtonVariant;
|
|
11
11
|
size?: Size;
|
|
12
12
|
placement?: PopoverPlacement;
|
|
13
13
|
buttonContent: JSX.Element;
|
|
@@ -21,6 +21,10 @@ export interface ModalProps extends CommonProps {
|
|
|
21
21
|
* Aria role to be applied to element
|
|
22
22
|
*/
|
|
23
23
|
role?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Whether modal has backdrop shadow or not
|
|
26
|
+
*/
|
|
27
|
+
noBackdropShadow?: boolean;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* - Modals are used to present critical information or request user input needed to complete a user's workflow.
|
|
@@ -2,4 +2,5 @@ export declare const cvaModalContainer: (props?: import("class-variance-authorit
|
|
|
2
2
|
export declare const cvaModalCard: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
3
|
export declare const cvaModalBackdrop: (props?: ({
|
|
4
4
|
show?: boolean | null | undefined;
|
|
5
|
+
noShadow?: boolean | null | undefined;
|
|
5
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -3,6 +3,7 @@ export interface ModalBackdropProps {
|
|
|
3
3
|
onClick: () => void;
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
isVisible?: boolean;
|
|
6
|
+
noShadow?: boolean;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* The Backdrop for the modal.
|
|
@@ -10,4 +11,4 @@ export interface ModalBackdropProps {
|
|
|
10
11
|
* @param {ModalBackdropProps} props - The props for the ModalBackdrop component
|
|
11
12
|
* @returns {JSX.Element} ModalBackdrop component
|
|
12
13
|
*/
|
|
13
|
-
export declare const ModalBackdrop: ({ children, isVisible, onClick }: ModalBackdropProps) => JSX.Element;
|
|
14
|
+
export declare const ModalBackdrop: ({ children, isVisible, onClick, noShadow }: ModalBackdropProps) => JSX.Element;
|
|
@@ -36,8 +36,14 @@ export interface ButtonProps extends ButtonCommonProps {
|
|
|
36
36
|
name?: string;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Buttons allow users to
|
|
40
|
-
|
|
39
|
+
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.
|
|
40
|
+
*
|
|
41
|
+
* ### When to use
|
|
42
|
+
* Use buttons to communicate actions users can take and to allow users to interact with the page. Each page should have one primary button, and any remaining calls to action should be represented as lower emphasis buttons.
|
|
43
|
+
*
|
|
44
|
+
* ### When not to use
|
|
45
|
+
* Do not use buttons as navigational elements. Instead, use [Links](https://www.notion.so/Links-49638788b6c042698b40b94a318361f1?pvs=21) when the desired action is to take the user to a new page.
|
|
46
|
+
*
|
|
41
47
|
* @param {ButtonProps} props - The props for the Button component
|
|
42
48
|
* @returns {JSX.Element} Button component
|
|
43
49
|
*/
|
|
@@ -13,11 +13,11 @@ export interface IconButtonProps extends ButtonCommonProps {
|
|
|
13
13
|
*/
|
|
14
14
|
renderAs?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
|
|
15
15
|
/**
|
|
16
|
-
* The size of the button. Defaults to "
|
|
16
|
+
* The size of the button. Defaults to "medium".
|
|
17
17
|
*/
|
|
18
18
|
size?: Size;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
|
|
22
22
|
*/
|
|
23
23
|
export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
export declare const cvaButton: (props?: ({
|
|
2
|
-
|
|
2
|
+
variant?: "primary" | "primary-danger" | "secondary" | "secondary-danger" | "ghost" | "ghost-neutral" | null | undefined;
|
|
3
3
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
4
4
|
rounded?: boolean | null | undefined;
|
|
5
5
|
fullWidth?: boolean | null | undefined;
|
|
6
6
|
square?: boolean | null | undefined;
|
|
7
7
|
disabled?: boolean | null | undefined;
|
|
8
|
-
|
|
8
|
+
loading?: boolean | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
|
+
export declare const cvaButtonSpinnerContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
11
|
+
export declare const cvaButtonSpinner: (props?: ({
|
|
12
|
+
variant?: "primary" | "primary-danger" | "secondary" | "secondary-danger" | "ghost" | "ghost-neutral" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
14
|
+
export declare const cvaButtonPrefixSuffix: (props?: ({
|
|
15
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
17
|
+
export declare const cvaIconButton: (props?: ({
|
|
18
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
9
19
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { GeneralColors
|
|
2
|
+
import { GeneralColors } from "@trackunit/ui-design-tokens";
|
|
3
3
|
import { CommonProps, Size } from "../../../common/CommonProps";
|
|
4
|
-
export type ButtonVariant = "
|
|
5
|
-
export type ButtonColor = Extract<GeneralColors, "primary" | "secondary"> | Extract<IntentColors, "warning" | "danger"> | "tertiary";
|
|
4
|
+
export type ButtonVariant = Extract<GeneralColors, "primary" | "secondary"> | "primary-danger" | "secondary-danger" | "ghost" | "ghost-neutral";
|
|
6
5
|
export type ButtonType = "button" | "submit";
|
|
7
6
|
export interface ButtonCommonProps extends CommonProps {
|
|
8
7
|
/**
|
|
@@ -30,11 +29,7 @@ export interface ButtonCommonProps extends CommonProps {
|
|
|
30
29
|
*/
|
|
31
30
|
square?: boolean;
|
|
32
31
|
/**
|
|
33
|
-
* The button's variant. Values are
|
|
34
|
-
*/
|
|
35
|
-
color?: ButtonColor;
|
|
36
|
-
/**
|
|
37
|
-
* The variant of the button.
|
|
32
|
+
* The button's variant. Values are primary, secondary, primary-danger, secondary-danger, ghost and ghost-neutral.
|
|
38
33
|
*/
|
|
39
34
|
variant?: ButtonVariant;
|
|
40
35
|
/**
|