@dmsi/wedgekit-react 0.0.551 → 0.0.552
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/package.json +2 -3
- package/src/brand.css +0 -125
- package/src/classNames.ts +0 -174
- package/src/components/AccessChangerTabItem.tsx +0 -71
- package/src/components/Accordion.tsx +0 -108
- package/src/components/Alert.tsx +0 -81
- package/src/components/Breadcrumbs.tsx +0 -142
- package/src/components/Button.tsx +0 -216
- package/src/components/CalendarRange.tsx +0 -628
- package/src/components/Caption.tsx +0 -144
- package/src/components/Card.tsx +0 -88
- package/src/components/Checkbox.tsx +0 -206
- package/src/components/CompactImagesPreview.tsx +0 -135
- package/src/components/ContentTab.tsx +0 -84
- package/src/components/ContentTabs.tsx +0 -136
- package/src/components/DMSiLogo.tsx +0 -33
- package/src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx +0 -35
- package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +0 -74
- package/src/components/DataGrid/PinnedColumns.tsx +0 -183
- package/src/components/DataGrid/TableBody/LoadingCell.tsx +0 -44
- package/src/components/DataGrid/TableBody/TableBodyRow.tsx +0 -157
- package/src/components/DataGrid/TableBody/index.tsx +0 -185
- package/src/components/DataGrid/index.tsx +0 -756
- package/src/components/DataGrid/types.ts +0 -98
- package/src/components/DataGrid/utils.tsx +0 -15
- package/src/components/DataGridCell.tsx +0 -526
- package/src/components/DataTable.tsx +0 -881
- package/src/components/DateInput.tsx +0 -306
- package/src/components/DateRangeInput.tsx +0 -758
- package/src/components/DebugJson.tsx +0 -28
- package/src/components/Display.tsx +0 -66
- package/src/components/EditingContext.tsx +0 -43
- package/src/components/EmptyCartIcon.tsx +0 -18
- package/src/components/FilterGroup.tsx +0 -264
- package/src/components/FullViewportBox.tsx +0 -19
- package/src/components/Grid.tsx +0 -97
- package/src/components/Heading.tsx +0 -72
- package/src/components/HorizontalDivider.tsx +0 -22
- package/src/components/Icon.tsx +0 -39
- package/src/components/ImagePlaceholder.tsx +0 -22
- package/src/components/Input.tsx +0 -609
- package/src/components/InputGroup.tsx +0 -59
- package/src/components/Label.tsx +0 -46
- package/src/components/Link.tsx +0 -117
- package/src/components/List.tsx +0 -18
- package/src/components/ListGroup.tsx +0 -82
- package/src/components/LiveChatComponent.tsx +0 -56
- package/src/components/LoadingScrim.tsx +0 -33
- package/src/components/LogoAgilityTopBar.tsx +0 -54
- package/src/components/LogoDMSiTopBar.tsx +0 -33
- package/src/components/LogoMillworkTopBar.tsx +0 -119
- package/src/components/MainBar.tsx +0 -91
- package/src/components/MaxViewportBox.tsx +0 -19
- package/src/components/Menu.tsx +0 -316
- package/src/components/MenuOption.tsx +0 -330
- package/src/components/MobileDataGrid/ColumnList.tsx +0 -66
- package/src/components/MobileDataGrid/ColumnSelector/index.tsx +0 -97
- package/src/components/MobileDataGrid/GridContextProvider/GridContext.tsx +0 -25
- package/src/components/MobileDataGrid/GridContextProvider/index.tsx +0 -132
- package/src/components/MobileDataGrid/GridContextProvider/useGridContext.ts +0 -10
- package/src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx +0 -27
- package/src/components/MobileDataGrid/MobileDataGridCard/index.tsx +0 -138
- package/src/components/MobileDataGrid/MobileDataGridHeader.tsx +0 -81
- package/src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx +0 -42
- package/src/components/MobileDataGrid/RowDetailModalProvider/index.tsx +0 -68
- package/src/components/MobileDataGrid/dataGridReducer.ts +0 -55
- package/src/components/MobileDataGrid/index.tsx +0 -92
- package/src/components/MobileDataGrid/types.ts +0 -4
- package/src/components/Modal.tsx +0 -312
- package/src/components/ModalButtons.tsx +0 -62
- package/src/components/ModalContent.tsx +0 -31
- package/src/components/ModalHeader.tsx +0 -78
- package/src/components/ModalScrim.tsx +0 -42
- package/src/components/NavigationTab.tsx +0 -95
- package/src/components/NavigationTabs.tsx +0 -70
- package/src/components/NestedMenu.tsx +0 -131
- package/src/components/Notification.tsx +0 -128
- package/src/components/OptionPill.tsx +0 -139
- package/src/components/OrderCheckIcon.tsx +0 -19
- package/src/components/PDFViewer/DownloadIcon.tsx +0 -25
- package/src/components/PDFViewer/PDFElement.tsx +0 -90
- package/src/components/PDFViewer/PDFNavigation.tsx +0 -68
- package/src/components/PDFViewer/PDFPage.tsx +0 -34
- package/src/components/PDFViewer/index.tsx +0 -128
- package/src/components/Pagination.tsx +0 -182
- package/src/components/Paragraph.tsx +0 -55
- package/src/components/Password.tsx +0 -62
- package/src/components/ProductImagePreview/CarouselPagination.tsx +0 -54
- package/src/components/ProductImagePreview/MobileImageCarousel.tsx +0 -226
- package/src/components/ProductImagePreview/ProductPrimaryImage.tsx +0 -219
- package/src/components/ProductImagePreview/Thumbnail.tsx +0 -55
- package/src/components/ProductImagePreview/ZoomWindow.tsx +0 -136
- package/src/components/ProductImagePreview/index.tsx +0 -182
- package/src/components/ProductImagePreview/useProductImagePreview.ts +0 -211
- package/src/components/ProjectBar.tsx +0 -82
- package/src/components/Radio.tsx +0 -146
- package/src/components/Search.tsx +0 -152
- package/src/components/SearchResultImage/index.tsx +0 -39
- package/src/components/Select.tsx +0 -114
- package/src/components/SideMenu.tsx +0 -30
- package/src/components/SideMenuGroup.tsx +0 -95
- package/src/components/SideMenuItem.tsx +0 -109
- package/src/components/SimpleTable.tsx +0 -77
- package/src/components/SkeletonParagraph.tsx +0 -31
- package/src/components/Spinner.tsx +0 -32
- package/src/components/Stack.tsx +0 -347
- package/src/components/StatusPill.tsx +0 -59
- package/src/components/Stepper.tsx +0 -128
- package/src/components/Subheader.tsx +0 -50
- package/src/components/Surface.tsx +0 -37
- package/src/components/Swatch.tsx +0 -1341
- package/src/components/Textarea.tsx +0 -102
- package/src/components/Theme.tsx +0 -27
- package/src/components/Time.tsx +0 -460
- package/src/components/Toast.tsx +0 -268
- package/src/components/Tooltip.tsx +0 -159
- package/src/components/TopBar.tsx +0 -139
- package/src/components/Upload.tsx +0 -107
- package/src/components/WorldpayIframe.tsx +0 -7
- package/src/components/index.ts +0 -34
- package/src/components/useMenuSystem.tsx +0 -456
- package/src/components/useMounted.tsx +0 -14
- package/src/darkmode.css +0 -278
- package/src/fonts.css +0 -23
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useInfiniteScroll.tsx +0 -40
- package/src/hooks/useKeydown.ts +0 -42
- package/src/hooks/useMatchesMedia.ts +0 -18
- package/src/hooks/useTableLayout.ts +0 -106
- package/src/index.css +0 -800
- package/src/index.tsx +0 -5
- package/src/types.ts +0 -150
- package/src/utils/date.ts +0 -236
- package/src/utils/formatting.tsx +0 -81
- package/src/utils/index.ts +0 -4
- package/src/utils/mergeObjectArrays.ts +0 -18
- package/src/utils.ts +0 -24
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React, { useLayoutEffect, useState } from "react";
|
|
4
|
-
import clsx from "clsx";
|
|
5
|
-
import { Link } from "./Link";
|
|
6
|
-
import { Icon } from "./Icon";
|
|
7
|
-
|
|
8
|
-
type BreadcrumbsProps = {
|
|
9
|
-
asCardStyle?: boolean;
|
|
10
|
-
path?: string; // Optional override for SSR / testing
|
|
11
|
-
crumbs: BreadcrumbProps[];
|
|
12
|
-
id?: string;
|
|
13
|
-
testid?: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type BreadcrumbProps = {
|
|
17
|
-
href: string;
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
onClick?: () => void; // Optional click handler
|
|
20
|
-
id?: string;
|
|
21
|
-
testid?: string;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const Breadcrumb = ({
|
|
25
|
-
href,
|
|
26
|
-
children,
|
|
27
|
-
onClick,
|
|
28
|
-
id,
|
|
29
|
-
testid,
|
|
30
|
-
}: BreadcrumbProps) => {
|
|
31
|
-
const linkPadding = clsx(
|
|
32
|
-
"!text-text-link-normal whitespace-nowrap",
|
|
33
|
-
"py-mobile-component-padding",
|
|
34
|
-
"desktop:py-desktop-component-padding",
|
|
35
|
-
"compact:py-desktop-compact-component-padding",
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<li key={href} id={id} data-testid={testid} className="flex items-center">
|
|
40
|
-
<Link
|
|
41
|
-
id={id ? `${id}-link` : undefined}
|
|
42
|
-
data-testid={testid ? `${testid}-link` : undefined}
|
|
43
|
-
className={clsx(linkPadding, "!text-caption-desktop")}
|
|
44
|
-
href={href}
|
|
45
|
-
typographyStyle="caption"
|
|
46
|
-
onClick={onClick}
|
|
47
|
-
>
|
|
48
|
-
{children}
|
|
49
|
-
</Link>
|
|
50
|
-
</li>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const Chevron = () => (
|
|
55
|
-
<li className="flex items-center" aria-hidden="true">
|
|
56
|
-
<Icon name="chevron_right" size={16} />
|
|
57
|
-
</li>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
export const Breadcrumbs = ({
|
|
61
|
-
asCardStyle,
|
|
62
|
-
id,
|
|
63
|
-
testid,
|
|
64
|
-
crumbs,
|
|
65
|
-
}: BreadcrumbsProps) => {
|
|
66
|
-
const scrollableElement = React.useRef<HTMLElement | null>(null);
|
|
67
|
-
const [isOverflow, setIsOverflow] = useState(false);
|
|
68
|
-
|
|
69
|
-
useLayoutEffect(() => {
|
|
70
|
-
scrollableElement.current?.scrollTo({
|
|
71
|
-
left: scrollableElement.current?.scrollWidth ?? 0,
|
|
72
|
-
behavior: "instant",
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
updateOverflow();
|
|
76
|
-
}, [scrollableElement, crumbs]);
|
|
77
|
-
|
|
78
|
-
const updateOverflow = () => {
|
|
79
|
-
if (!scrollableElement.current) return;
|
|
80
|
-
|
|
81
|
-
setIsOverflow(
|
|
82
|
-
scrollableElement.current.scrollWidth !==
|
|
83
|
-
scrollableElement.current.clientWidth &&
|
|
84
|
-
scrollableElement.current.scrollLeft > 0,
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<nav
|
|
90
|
-
id={id}
|
|
91
|
-
data-testid={testid}
|
|
92
|
-
className={clsx(
|
|
93
|
-
"relative select-none flex items-center max-w-full w-full",
|
|
94
|
-
{
|
|
95
|
-
"bg-white rounded-base shadow-4 px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding":
|
|
96
|
-
asCardStyle,
|
|
97
|
-
"px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding":
|
|
98
|
-
!asCardStyle,
|
|
99
|
-
},
|
|
100
|
-
)}
|
|
101
|
-
aria-label="Breadcrumb"
|
|
102
|
-
>
|
|
103
|
-
<div
|
|
104
|
-
className={clsx(
|
|
105
|
-
isOverflow ? "opacity-100" : "opacity-0",
|
|
106
|
-
"absolute left-6 top-0 h-full w-12 bg-gradient-to-r from-white to-transparent pointer-events-none z-10 transition",
|
|
107
|
-
)}
|
|
108
|
-
/>
|
|
109
|
-
|
|
110
|
-
<ol
|
|
111
|
-
id={id ? `${id}-list` : undefined}
|
|
112
|
-
data-testid={testid ? `${testid}-list` : undefined}
|
|
113
|
-
className="flex items-center overflow-x-scroll"
|
|
114
|
-
style={{ scrollbarWidth: "none" }}
|
|
115
|
-
onScroll={updateOverflow}
|
|
116
|
-
ref={(el) => {
|
|
117
|
-
scrollableElement.current = el;
|
|
118
|
-
}}
|
|
119
|
-
>
|
|
120
|
-
{crumbs.map((crumb, index) => {
|
|
121
|
-
const { href, children, onClick } = crumb;
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<React.Fragment key={index}>
|
|
125
|
-
{index > 0 && <Chevron />}
|
|
126
|
-
<Breadcrumb
|
|
127
|
-
href={href}
|
|
128
|
-
onClick={onClick}
|
|
129
|
-
id={id ? `${id}-crumb-${index}` : undefined}
|
|
130
|
-
testid={testid ? `${testid}-crumb-${index}` : undefined}
|
|
131
|
-
>
|
|
132
|
-
{children}
|
|
133
|
-
</Breadcrumb>
|
|
134
|
-
</React.Fragment>
|
|
135
|
-
);
|
|
136
|
-
})}
|
|
137
|
-
</ol>
|
|
138
|
-
</nav>
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
Breadcrumbs.displayName = "Breadcrumbs";
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import { ReactNode, ButtonHTMLAttributes } from "react";
|
|
3
|
-
import {
|
|
4
|
-
baseTransition,
|
|
5
|
-
componentGap,
|
|
6
|
-
componentPaddingMinus2pxBorder,
|
|
7
|
-
componentPaddingXUsingComponentGap,
|
|
8
|
-
paddingUsingComponentGap,
|
|
9
|
-
typography,
|
|
10
|
-
} from "../classNames";
|
|
11
|
-
import { AsProps } from "../types";
|
|
12
|
-
type Tags = "a" | "button" | React.ElementType;
|
|
13
|
-
|
|
14
|
-
type BaseButtonProps = Omit<
|
|
15
|
-
ButtonHTMLAttributes<HTMLButtonElement>,
|
|
16
|
-
"children"
|
|
17
|
-
> & {
|
|
18
|
-
as?: Tags;
|
|
19
|
-
variant?:
|
|
20
|
-
| "primary"
|
|
21
|
-
| "secondary"
|
|
22
|
-
| "tertiary"
|
|
23
|
-
| "primary-critical"
|
|
24
|
-
| "secondary-critical"
|
|
25
|
-
| "tertiary-critical"
|
|
26
|
-
| "navigation";
|
|
27
|
-
iconOnly?: boolean;
|
|
28
|
-
block?: boolean;
|
|
29
|
-
className?: string;
|
|
30
|
-
classNameLabel?: string;
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
colorClassName?: string;
|
|
33
|
-
href?: string;
|
|
34
|
-
id?: string;
|
|
35
|
-
testid?: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// At least one of leftIcon, rightIcon, or children must be provided
|
|
39
|
-
type RequireAtLeastOneContent =
|
|
40
|
-
| { leftIcon: ReactNode; rightIcon?: ReactNode; children?: ReactNode }
|
|
41
|
-
| { rightIcon: ReactNode; leftIcon?: ReactNode; children?: ReactNode }
|
|
42
|
-
| { children: ReactNode; leftIcon?: ReactNode; rightIcon?: ReactNode };
|
|
43
|
-
|
|
44
|
-
export type ButtonProps = BaseButtonProps & RequireAtLeastOneContent;
|
|
45
|
-
|
|
46
|
-
export const Button = ({
|
|
47
|
-
variant = "primary",
|
|
48
|
-
as = "button",
|
|
49
|
-
block,
|
|
50
|
-
leftIcon,
|
|
51
|
-
rightIcon,
|
|
52
|
-
className,
|
|
53
|
-
classNameLabel,
|
|
54
|
-
disabled = false,
|
|
55
|
-
children,
|
|
56
|
-
iconOnly = false,
|
|
57
|
-
colorClassName,
|
|
58
|
-
href,
|
|
59
|
-
id,
|
|
60
|
-
testid,
|
|
61
|
-
...props
|
|
62
|
-
}: AsProps<Tags> & ButtonProps) => {
|
|
63
|
-
const primaryVariantStyles =
|
|
64
|
-
variant === "primary" &&
|
|
65
|
-
clsx(
|
|
66
|
-
colorClassName?.trim()
|
|
67
|
-
? colorClassName
|
|
68
|
-
: "text-text-on-action-primary-normal",
|
|
69
|
-
"bg-background-action-primary-normal border-background-action-primary-normal",
|
|
70
|
-
"hover:bg-background-action-primary-hover hover:border-background-action-primary-hover",
|
|
71
|
-
"focus:bg-background-action-primary-hover focus:border-background-action-primary-hover focus:outline-0",
|
|
72
|
-
"active:bg-background-action-primary-active active:border-background-action-primary-active",
|
|
73
|
-
"disabled:bg-background-action-primary-disabled disabled:border-background-action-primary-disabled disabled:text-text-on-action-primary-disabled",
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const secondaryVariantStyles =
|
|
77
|
-
variant === "secondary" &&
|
|
78
|
-
clsx(
|
|
79
|
-
colorClassName?.trim()
|
|
80
|
-
? colorClassName
|
|
81
|
-
: "text-text-action-primary-normal",
|
|
82
|
-
"bg-background-action-secondary-normal border-border-action-normal",
|
|
83
|
-
"hover:bg-background-action-secondary-hover hover:border-border-action-hover hover:text-text-action-primary-hover",
|
|
84
|
-
"focus:bg-background-action-secondary-hover focus:border-border-action-hover focus:text-text-action-primary-hover focus:outline-0",
|
|
85
|
-
"active:bg-background-action-secondary-active active:border-border-action-active active:text-text-action-primary-active",
|
|
86
|
-
"disabled:bg-background-action-primary-disabled disabled:border-border-action-disabled disabled:text-text-action-primary-disabled",
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const tertiaryVariantStyles =
|
|
90
|
-
variant === "tertiary" &&
|
|
91
|
-
clsx(
|
|
92
|
-
"bg-transparent border-transparent",
|
|
93
|
-
iconOnly
|
|
94
|
-
? colorClassName?.trim()
|
|
95
|
-
? colorClassName
|
|
96
|
-
: "text-icon-action-primary-normal"
|
|
97
|
-
: colorClassName?.trim()
|
|
98
|
-
? colorClassName
|
|
99
|
-
: "text-text-action-primary-normal",
|
|
100
|
-
"bg-transparent border-transparent",
|
|
101
|
-
"hover:bg-background-action-secondary-hover hover:border-background-action-secondary-hover hover:text-text-action-primary-hover",
|
|
102
|
-
"focus:bg-background-action-secondary-hover focus:border-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
|
|
103
|
-
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
104
|
-
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled",
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
const primaryCriticalVariantStyles =
|
|
108
|
-
variant === "primary-critical" &&
|
|
109
|
-
clsx(
|
|
110
|
-
colorClassName?.trim()
|
|
111
|
-
? colorClassName
|
|
112
|
-
: "text-text-on-action-primary-normal",
|
|
113
|
-
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
114
|
-
"hover:bg-background-action-critical-primary-hover hover:border-background-action-critical-primary-hover",
|
|
115
|
-
"focus:bg-background-action-critical-primary-hover focus:border-background-action-critical-primary-hover focus:outline-0",
|
|
116
|
-
"active:bg-background-action-critical-primary-active active:border-background-action-critical-primary-active",
|
|
117
|
-
"disabled:bg-background-action-critical-primary-disabled disabled:border-background-action-critical-primary-disabled disabled:text-text-on-action-primary-disabled",
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
const secondaryCriticalVariantStyles =
|
|
121
|
-
variant === "secondary-critical" &&
|
|
122
|
-
clsx(
|
|
123
|
-
colorClassName?.trim()
|
|
124
|
-
? colorClassName
|
|
125
|
-
: "text-text-action-critical-normal",
|
|
126
|
-
"bg-background-action-critical-secondary-normal border-border-action-critical-normal",
|
|
127
|
-
"hover:bg-background-action-critical-secondary-hover hover:border-border-action-critical-hover hover:text-text-action-critical-hover",
|
|
128
|
-
"focus:bg-background-action-critical-secondary-hover focus:border-border-action-critical-hover focus:text-text-action-critical-hover focus:outline-0",
|
|
129
|
-
"active:bg-background-action-critical-secondary-active active:border-border-action-critical-active active:text-text-action-critical-active",
|
|
130
|
-
"disabled:bg-background-action-critical-disabled disabled:border-border-action-critical-disabled disabled:text-text-action-critical-disabled",
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
const tertiaryCriticalVariantStyles =
|
|
134
|
-
variant === "tertiary-critical" &&
|
|
135
|
-
clsx(
|
|
136
|
-
colorClassName?.trim()
|
|
137
|
-
? colorClassName
|
|
138
|
-
: "text-text-action-critical-normal",
|
|
139
|
-
"bg-transparent border-transparent text-text-action-critical-normal",
|
|
140
|
-
"hover:bg-background-action-critical-secondary-hover hover:border-background-action-critical-secondary-hover hover:text-text-action-critical-hover",
|
|
141
|
-
"focus:bg-background-action-critical-secondary-hover focus:border-background-action-critical-secondary-hover focus:text-text-action-critical-hover focus:outline-0",
|
|
142
|
-
"active:bg-background-action-critical-secondary-active active:border-background-action-critical-secondary-active active:text-text-action-critical-active",
|
|
143
|
-
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-critical-disabled",
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const navigationVarianStyles =
|
|
147
|
-
variant === "navigation" &&
|
|
148
|
-
clsx(
|
|
149
|
-
colorClassName?.trim()
|
|
150
|
-
? colorClassName
|
|
151
|
-
: "text-text-action-primary-normal",
|
|
152
|
-
"bg-transparent",
|
|
153
|
-
"hover:bg-background-action-secondary-hover hover:text-text-action-primary-hover",
|
|
154
|
-
"focus:bg-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
|
|
155
|
-
"active:bg-background-action-secondary-active active:text-text-action-primary-active",
|
|
156
|
-
"disabled:bg-transparent disabled:text-text-on-action-primary-disabled",
|
|
157
|
-
"flex-col",
|
|
158
|
-
paddingUsingComponentGap,
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const notNavigationVariantStyles =
|
|
162
|
-
variant !== "navigation" &&
|
|
163
|
-
clsx("border-2 flex-row", componentPaddingMinus2pxBorder, componentGap);
|
|
164
|
-
|
|
165
|
-
const buttonClasses = clsx(
|
|
166
|
-
disabled ? "cursor-default" : "cursor-pointer",
|
|
167
|
-
block ? "w-full" : "w-fit",
|
|
168
|
-
baseTransition,
|
|
169
|
-
"rounded-sm whitespace-nowrap inline-flex items-center justify-center group/btn",
|
|
170
|
-
primaryVariantStyles,
|
|
171
|
-
secondaryVariantStyles,
|
|
172
|
-
tertiaryVariantStyles,
|
|
173
|
-
primaryCriticalVariantStyles,
|
|
174
|
-
secondaryCriticalVariantStyles,
|
|
175
|
-
tertiaryCriticalVariantStyles,
|
|
176
|
-
|
|
177
|
-
navigationVarianStyles,
|
|
178
|
-
notNavigationVariantStyles,
|
|
179
|
-
className,
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
const labelClasses = clsx(
|
|
183
|
-
"min-h-6 flex items-center justify-center",
|
|
184
|
-
classNameLabel,
|
|
185
|
-
componentPaddingXUsingComponentGap,
|
|
186
|
-
typography.buttonLabel,
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
const Element = href && !as ? "a" : as;
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<Element
|
|
193
|
-
id={id}
|
|
194
|
-
data-testid={testid}
|
|
195
|
-
type={Element === "button" ? "button" : undefined}
|
|
196
|
-
className={buttonClasses}
|
|
197
|
-
{...props}
|
|
198
|
-
onClick={props.onClick}
|
|
199
|
-
disabled={disabled}
|
|
200
|
-
href={href}
|
|
201
|
-
data-theme={variant === "navigation" ? "brand" : undefined}
|
|
202
|
-
>
|
|
203
|
-
{leftIcon && leftIcon}
|
|
204
|
-
|
|
205
|
-
{!iconOnly && children && (
|
|
206
|
-
<span id={id ? `${id}-label` : undefined} data-testid={testid ? `${testid}-label` : undefined} className={labelClasses}>
|
|
207
|
-
{children}
|
|
208
|
-
</span>
|
|
209
|
-
)}
|
|
210
|
-
|
|
211
|
-
{rightIcon && rightIcon}
|
|
212
|
-
</Element>
|
|
213
|
-
);
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
Button.displayName = "Button";
|