@dmsi/wedgekit-react 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/chunk-27KIIUAR.js +59 -0
- package/dist/chunk-2G2E2JMA.js +123 -0
- package/dist/chunk-4C66DLIJ.js +51 -0
- package/dist/chunk-4RD5ZF2V.js +55 -0
- package/dist/chunk-4RJKB7LC.js +14 -0
- package/dist/chunk-4T7F5BZZ.js +26 -0
- package/dist/chunk-5GOBP2JS.js +53 -0
- package/dist/chunk-6ZY524ID.js +42 -0
- package/dist/chunk-AWQSSKCK.js +32 -0
- package/dist/chunk-BNHSAFMP.js +93 -0
- package/dist/chunk-BWRHL2AG.js +439 -0
- package/dist/chunk-DKKYR6DS.js +132 -0
- package/dist/chunk-E5ALT5W7.js +182 -0
- package/dist/chunk-FY7PTP6E.js +322 -0
- package/dist/chunk-GTCSRHPF.js +119 -0
- package/dist/chunk-I2UVVKQI.js +12 -0
- package/dist/chunk-IGQVA7SC.js +41 -0
- package/dist/chunk-K3IKUSZW.js +59 -0
- package/dist/chunk-KENSVWOY.js +151 -0
- package/dist/chunk-KX3O6GJ6.js +138 -0
- package/dist/chunk-L4UM372R.js +253 -0
- package/dist/chunk-ORMEWXMH.js +37 -0
- package/dist/chunk-Q3FKEKIN.js +23 -0
- package/dist/chunk-SEKKGFM6.js +28 -0
- package/dist/chunk-SY3HT54E.js +91 -0
- package/dist/chunk-TAW5ZZ4Z.js +346 -0
- package/dist/chunk-TRUPPHBQ.js +109 -0
- package/dist/chunk-TU55CHXU.js +30 -0
- package/dist/chunk-TWZZB4WO.js +114 -0
- package/dist/chunk-TYI74BSP.js +62 -0
- package/dist/chunk-U42SKNR6.js +104 -0
- package/dist/chunk-UU3FA6LV.js +72 -0
- package/dist/chunk-WVUIIBRR.js +51 -0
- package/dist/chunk-XUIPGYP5.js +39 -0
- package/dist/chunk-Z4UCFUF7.js +299 -0
- package/dist/components/Breadcrumbs.cjs +376 -0
- package/dist/components/Breadcrumbs.js +90 -0
- package/dist/components/Button.cjs +319 -0
- package/dist/components/Button.js +8 -0
- package/dist/components/CalendarRange.cjs +520 -0
- package/dist/components/CalendarRange.js +13 -0
- package/dist/components/Caption.cjs +283 -0
- package/dist/components/Caption.js +80 -0
- package/dist/components/Checkbox.cjs +378 -0
- package/dist/components/Checkbox.js +11 -0
- package/dist/components/ContentTab.cjs +382 -0
- package/dist/components/ContentTab.js +10 -0
- package/dist/components/ContentTabs.cjs +472 -0
- package/dist/components/ContentTabs.js +98 -0
- package/dist/components/DMSiLogo.cjs +79 -0
- package/dist/components/DMSiLogo.js +56 -0
- package/dist/components/DataGrid.cjs +3113 -0
- package/dist/components/DataGrid.js +758 -0
- package/dist/components/DataGridCell.cjs +1907 -0
- package/dist/components/DataGridCell.js +24 -0
- package/dist/components/DataTable.cjs +791 -0
- package/dist/components/DataTable.js +720 -0
- package/dist/components/DateInput.cjs +1130 -0
- package/dist/components/DateInput.js +170 -0
- package/dist/components/DateRangeInput.cjs +1131 -0
- package/dist/components/DateRangeInput.js +171 -0
- package/dist/components/DebugJson.cjs +50 -0
- package/dist/components/DebugJson.js +27 -0
- package/dist/components/Display.cjs +234 -0
- package/dist/components/Display.js +12 -0
- package/dist/components/EditingContext.cjs +73 -0
- package/dist/components/EditingContext.js +35 -0
- package/dist/components/FilterGroup.cjs +1431 -0
- package/dist/components/FilterGroup.js +231 -0
- package/dist/components/FullViewportBox.cjs +35 -0
- package/dist/components/FullViewportBox.js +12 -0
- package/dist/components/Grid.cjs +69 -0
- package/dist/components/Grid.js +36 -0
- package/dist/components/GridContainer.cjs +125 -0
- package/dist/components/GridContainer.js +92 -0
- package/dist/components/Heading.cjs +238 -0
- package/dist/components/Heading.js +14 -0
- package/dist/components/HorizontalDivider.cjs +33 -0
- package/dist/components/HorizontalDivider.js +10 -0
- package/dist/components/Icon.cjs +98 -0
- package/dist/components/Icon.js +7 -0
- package/dist/components/Input.cjs +672 -0
- package/dist/components/Input.js +21 -0
- package/dist/components/InputGroup.cjs +270 -0
- package/dist/components/InputGroup.js +60 -0
- package/dist/components/Label.cjs +223 -0
- package/dist/components/Label.js +8 -0
- package/dist/components/Link.cjs +262 -0
- package/dist/components/Link.js +8 -0
- package/dist/components/List.cjs +37 -0
- package/dist/components/List.js +14 -0
- package/dist/components/LiveChatComponent.cjs +63 -0
- package/dist/components/LiveChatComponent.js +40 -0
- package/dist/components/LogoAgilityTopBar.cjs +115 -0
- package/dist/components/LogoAgilityTopBar.js +92 -0
- package/dist/components/LogoDMSiTopBar.cjs +79 -0
- package/dist/components/LogoDMSiTopBar.js +7 -0
- package/dist/components/LogoMillworkTopBar.cjs +221 -0
- package/dist/components/LogoMillworkTopBar.js +198 -0
- package/dist/components/MainBar.cjs +211 -0
- package/dist/components/MainBar.js +65 -0
- package/dist/components/Menu.cjs +437 -0
- package/dist/components/Menu.js +11 -0
- package/dist/components/MenuOption.cjs +483 -0
- package/dist/components/MenuOption.js +13 -0
- package/dist/components/MobileDataGrid.cjs +658 -0
- package/dist/components/MobileDataGrid.js +125 -0
- package/dist/components/Modal.cjs +783 -0
- package/dist/components/Modal.js +245 -0
- package/dist/components/ModalButtons.cjs +385 -0
- package/dist/components/ModalButtons.js +10 -0
- package/dist/components/ModalContent.cjs +57 -0
- package/dist/components/ModalContent.js +7 -0
- package/dist/components/ModalHeader.cjs +426 -0
- package/dist/components/ModalHeader.js +11 -0
- package/dist/components/ModalScrim.cjs +64 -0
- package/dist/components/ModalScrim.js +7 -0
- package/dist/components/NavigationTab.cjs +431 -0
- package/dist/components/NavigationTab.js +10 -0
- package/dist/components/NavigationTabs.cjs +477 -0
- package/dist/components/NavigationTabs.js +56 -0
- package/dist/components/Notification.cjs +640 -0
- package/dist/components/Notification.js +117 -0
- package/dist/components/OptionPill.cjs +478 -0
- package/dist/components/OptionPill.js +11 -0
- package/dist/components/Paragraph.cjs +231 -0
- package/dist/components/Paragraph.js +8 -0
- package/dist/components/Password.cjs +700 -0
- package/dist/components/Password.js +53 -0
- package/dist/components/ProjectBar.cjs +242 -0
- package/dist/components/ProjectBar.js +63 -0
- package/dist/components/Radio.cjs +349 -0
- package/dist/components/Radio.js +131 -0
- package/dist/components/Search.cjs +767 -0
- package/dist/components/Search.js +12 -0
- package/dist/components/Select.cjs +758 -0
- package/dist/components/Select.js +12 -0
- package/dist/components/SideMenu.cjs +54 -0
- package/dist/components/SideMenu.js +21 -0
- package/dist/components/SideMenuGroup.cjs +422 -0
- package/dist/components/SideMenuGroup.js +83 -0
- package/dist/components/SideMenuItem.cjs +388 -0
- package/dist/components/SideMenuItem.js +70 -0
- package/dist/components/Stack.cjs +138 -0
- package/dist/components/Stack.js +7 -0
- package/dist/components/StatusPill.cjs +265 -0
- package/dist/components/StatusPill.js +52 -0
- package/dist/components/Stepper.cjs +885 -0
- package/dist/components/Stepper.js +105 -0
- package/dist/components/Subheader.cjs +226 -0
- package/dist/components/Subheader.js +8 -0
- package/dist/components/Surface.cjs +98 -0
- package/dist/components/Surface.js +40 -0
- package/dist/components/Swatch.cjs +1728 -0
- package/dist/components/Swatch.js +1319 -0
- package/dist/components/Textarea.cjs +269 -0
- package/dist/components/Textarea.js +96 -0
- package/dist/components/Theme.cjs +36 -0
- package/dist/components/Theme.js +7 -0
- package/dist/components/Time.cjs +1118 -0
- package/dist/components/Time.js +353 -0
- package/dist/components/Toast.cjs +644 -0
- package/dist/components/Toast.js +218 -0
- package/dist/components/Tooltip.cjs +273 -0
- package/dist/components/Tooltip.js +9 -0
- package/dist/components/TopBar.cjs +352 -0
- package/dist/components/TopBar.js +132 -0
- package/dist/components/useInfiniteScroll.cjs +57 -0
- package/dist/components/useInfiniteScroll.js +8 -0
- package/dist/components/useMatchesMedia.cjs +53 -0
- package/dist/components/useMatchesMedia.js +9 -0
- package/dist/components/useMenuSystem.cjs +358 -0
- package/dist/components/useMenuSystem.js +11 -0
- package/dist/components/useMounted.cjs +39 -0
- package/dist/components/useMounted.js +8 -0
- package/dist/fonts.css +21 -0
- package/dist/icons-light[FILL]-PPZXOLWS.woff2 +0 -0
- package/dist/icons-normal[FILL]-PPZXOLWS.woff2 +0 -0
- package/dist/index.css +4401 -0
- package/dist/open-sans-55T6A4JE.woff2 +0 -0
- package/dist/types.cjs +18 -0
- package/dist/types.js +0 -0
- package/package.json +66 -0
- package/src/brand.css +125 -0
- package/src/classNames.ts +144 -0
- package/src/components/Breadcrumbs.tsx +116 -0
- package/src/components/Button.tsx +210 -0
- package/src/components/CalendarRange.tsx +429 -0
- package/src/components/Caption.tsx +101 -0
- package/src/components/Checkbox.tsx +196 -0
- package/src/components/ContentTab.tsx +66 -0
- package/src/components/ContentTabs.tsx +103 -0
- package/src/components/DMSiLogo.tsx +32 -0
- package/src/components/DataGrid.tsx +948 -0
- package/src/components/DataGridCell.tsx +384 -0
- package/src/components/DataTable.tsx +835 -0
- package/src/components/DateInput.tsx +188 -0
- package/src/components/DateRangeInput.tsx +179 -0
- package/src/components/DebugJson.tsx +24 -0
- package/src/components/Display.tsx +60 -0
- package/src/components/EditingContext.tsx +40 -0
- package/src/components/FilterGroup.tsx +234 -0
- package/src/components/FullViewportBox.tsx +11 -0
- package/src/components/Grid.tsx +75 -0
- package/src/components/GridContainer.tsx +124 -0
- package/src/components/Heading.tsx +66 -0
- package/src/components/HorizontalDivider.tsx +3 -0
- package/src/components/Icon.tsx +36 -0
- package/src/components/Input.tsx +511 -0
- package/src/components/InputGroup.tsx +51 -0
- package/src/components/Label.tsx +40 -0
- package/src/components/Link.tsx +106 -0
- package/src/components/List.tsx +10 -0
- package/src/components/LiveChatComponent.tsx +56 -0
- package/src/components/LogoAgilityTopBar.tsx +53 -0
- package/src/components/LogoDMSiTopBar.tsx +32 -0
- package/src/components/LogoMillworkTopBar.tsx +118 -0
- package/src/components/MainBar.tsx +83 -0
- package/src/components/Menu.tsx +286 -0
- package/src/components/MenuOption.tsx +275 -0
- package/src/components/MobileDataGrid.tsx +135 -0
- package/src/components/Modal.tsx +271 -0
- package/src/components/ModalButtons.tsx +44 -0
- package/src/components/ModalContent.tsx +23 -0
- package/src/components/ModalHeader.tsx +41 -0
- package/src/components/ModalScrim.tsx +35 -0
- package/src/components/NavigationTab.tsx +89 -0
- package/src/components/NavigationTabs.tsx +63 -0
- package/src/components/Notification.tsx +120 -0
- package/src/components/OptionPill.tsx +114 -0
- package/src/components/Paragraph.tsx +49 -0
- package/src/components/Password.tsx +46 -0
- package/src/components/ProjectBar.tsx +76 -0
- package/src/components/Radio.tsx +140 -0
- package/src/components/Search.tsx +129 -0
- package/src/components/Select.tsx +104 -0
- package/src/components/SideMenu.tsx +21 -0
- package/src/components/SideMenuGroup.tsx +81 -0
- package/src/components/SideMenuItem.tsx +90 -0
- package/src/components/Stack.tsx +179 -0
- package/src/components/StatusPill.tsx +51 -0
- package/src/components/Stepper.tsx +91 -0
- package/src/components/Subheader.tsx +44 -0
- package/src/components/Surface.tsx +34 -0
- package/src/components/Swatch.tsx +1066 -0
- package/src/components/Textarea.tsx +101 -0
- package/src/components/Theme.tsx +13 -0
- package/src/components/Time.tsx +438 -0
- package/src/components/Toast.tsx +244 -0
- package/src/components/Tooltip.tsx +137 -0
- package/src/components/TopBar.tsx +124 -0
- package/src/components/useInfiniteScroll.tsx +40 -0
- package/src/components/useMatchesMedia.tsx +28 -0
- package/src/components/useMenuSystem.tsx +367 -0
- package/src/components/useMounted.tsx +14 -0
- package/src/darkmode.css +140 -0
- package/src/fonts.css +23 -0
- package/src/index.css +509 -0
- package/src/index.tsx +2 -0
- package/src/types.ts +149 -0
- package/src/utils/formatting.tsx +81 -0
- package/src/utils.ts +23 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import {
|
|
3
|
+
BackgroundColorTokens,
|
|
4
|
+
BorderColorTokens,
|
|
5
|
+
Elevation,
|
|
6
|
+
ItemsAlign,
|
|
7
|
+
JustifyAlign,
|
|
8
|
+
Sizing,
|
|
9
|
+
} from "../types";
|
|
10
|
+
import { ComponentProps, CSSProperties } from "react";
|
|
11
|
+
|
|
12
|
+
type StackProps = {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
horizontal?: boolean;
|
|
15
|
+
horizontalMobile?: boolean;
|
|
16
|
+
padding?: boolean;
|
|
17
|
+
paddingX?: boolean;
|
|
18
|
+
sizing?: Sizing;
|
|
19
|
+
flexShrink?: number;
|
|
20
|
+
flexGrow?: number;
|
|
21
|
+
elevation?: Elevation;
|
|
22
|
+
rounded?: boolean;
|
|
23
|
+
centered?: boolean;
|
|
24
|
+
width?: number | "full" | "fit";
|
|
25
|
+
maxWidth?: number;
|
|
26
|
+
minWidth?: number;
|
|
27
|
+
height?: number | "full";
|
|
28
|
+
maxHeight?: number;
|
|
29
|
+
borderColor?: BorderColorTokens;
|
|
30
|
+
backgroundColor?: BackgroundColorTokens;
|
|
31
|
+
overflowY?: "hidden" | "scroll" | "auto" | "inherit";
|
|
32
|
+
overflowX?: "hidden" | "scroll" | "auto" | "inherit";
|
|
33
|
+
zIndex?: number;
|
|
34
|
+
position?: CSSProperties['position'];
|
|
35
|
+
top?: number;
|
|
36
|
+
left?: number;
|
|
37
|
+
} & FlexProps &
|
|
38
|
+
Omit<ComponentProps<"div">, "className">;
|
|
39
|
+
|
|
40
|
+
export interface FlexProps {
|
|
41
|
+
items?: ItemsAlign;
|
|
42
|
+
justify?: JustifyAlign;
|
|
43
|
+
grow?: boolean;
|
|
44
|
+
flexGrow?: string | number;
|
|
45
|
+
flexShrink?: string | number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const useFlexClassNames = ({ items, justify, grow }: FlexProps) =>
|
|
49
|
+
clsx(
|
|
50
|
+
"flex",
|
|
51
|
+
items === "start" && "items-start",
|
|
52
|
+
grow && "grow",
|
|
53
|
+
items === "start" && "items-start",
|
|
54
|
+
items === "center" && "items-center",
|
|
55
|
+
items === "end" && "items-end",
|
|
56
|
+
items === "start-center" && "items-start desktop:items-center",
|
|
57
|
+
justify === "start" && "justify-start",
|
|
58
|
+
justify === "center" && "justify-center",
|
|
59
|
+
justify === "end" && "justify-end",
|
|
60
|
+
justify === "end" && "justify-end",
|
|
61
|
+
justify === "between" && "justify-between",
|
|
62
|
+
justify === "around" && "justify-around",
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
export const Stack = ({
|
|
66
|
+
children,
|
|
67
|
+
items,
|
|
68
|
+
justify,
|
|
69
|
+
grow,
|
|
70
|
+
padding,
|
|
71
|
+
paddingX,
|
|
72
|
+
horizontal,
|
|
73
|
+
horizontalMobile,
|
|
74
|
+
elevation = 0,
|
|
75
|
+
rounded,
|
|
76
|
+
centered,
|
|
77
|
+
width,
|
|
78
|
+
maxWidth,
|
|
79
|
+
minWidth,
|
|
80
|
+
height,
|
|
81
|
+
maxHeight,
|
|
82
|
+
borderColor,
|
|
83
|
+
backgroundColor,
|
|
84
|
+
sizing = "none",
|
|
85
|
+
overflowY = "inherit",
|
|
86
|
+
overflowX = "inherit",
|
|
87
|
+
flexShrink,
|
|
88
|
+
flexGrow,
|
|
89
|
+
position,
|
|
90
|
+
top,
|
|
91
|
+
left
|
|
92
|
+
}: StackProps) => {
|
|
93
|
+
const flexClassNames = useFlexClassNames({ items, justify, grow });
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div
|
|
97
|
+
style={{
|
|
98
|
+
height:
|
|
99
|
+
height === "full"
|
|
100
|
+
? "100%"
|
|
101
|
+
: height !== undefined
|
|
102
|
+
? `${height}px`
|
|
103
|
+
: undefined,
|
|
104
|
+
maxHeight: maxHeight !== undefined ? `${maxHeight}px` : undefined,
|
|
105
|
+
maxWidth: maxWidth !== undefined ? `${maxWidth}px` : undefined,
|
|
106
|
+
width:
|
|
107
|
+
width !== undefined && typeof width === "number"
|
|
108
|
+
? `${width}px`
|
|
109
|
+
: undefined,
|
|
110
|
+
minWidth: minWidth !== undefined ? `${minWidth}px` : undefined,
|
|
111
|
+
border: borderColor
|
|
112
|
+
? `1px solid var(--color-${borderColor})`
|
|
113
|
+
: undefined,
|
|
114
|
+
backgroundColor: backgroundColor
|
|
115
|
+
? `var(--color-${backgroundColor})`
|
|
116
|
+
: undefined,
|
|
117
|
+
flexGrow: flexGrow !== undefined ? flexGrow : undefined,
|
|
118
|
+
flexShrink: flexShrink !== undefined ? flexShrink : undefined,
|
|
119
|
+
position: position !== undefined ? position : undefined,
|
|
120
|
+
top: top !== undefined ? `${top}px` : undefined,
|
|
121
|
+
left: left !== undefined ? `${left}px` : undefined,
|
|
122
|
+
}}
|
|
123
|
+
className={clsx(
|
|
124
|
+
"scrollbar-thin",
|
|
125
|
+
width !== "fit" && "w-full",
|
|
126
|
+
width === "full" && "w-full",
|
|
127
|
+
centered && "mx-auto",
|
|
128
|
+
overflowY == "auto" && "overflow-y-auto",
|
|
129
|
+
overflowY == "hidden" && "overflow-y-hidden",
|
|
130
|
+
overflowY == "scroll" && "overflow-y-scroll",
|
|
131
|
+
overflowX == "auto" && "overflow-x-auto",
|
|
132
|
+
overflowX == "hidden" && "overflow-x-hidden",
|
|
133
|
+
overflowX == "scroll" && "overflow-x-scroll",
|
|
134
|
+
padding &&
|
|
135
|
+
sizing === "container" &&
|
|
136
|
+
"p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
|
|
137
|
+
padding &&
|
|
138
|
+
sizing === "layout" &&
|
|
139
|
+
"p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
|
|
140
|
+
padding &&
|
|
141
|
+
sizing === "layout-group" &&
|
|
142
|
+
"p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
|
|
143
|
+
padding &&
|
|
144
|
+
sizing === "component" &&
|
|
145
|
+
"p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding",
|
|
146
|
+
paddingX &&
|
|
147
|
+
sizing === "container" &&
|
|
148
|
+
"px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding",
|
|
149
|
+
paddingX &&
|
|
150
|
+
sizing === "layout" &&
|
|
151
|
+
"px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding",
|
|
152
|
+
paddingX &&
|
|
153
|
+
sizing === "layout-group" &&
|
|
154
|
+
"px-mobile-layout-group-padding desktop:px-desktop-layout-group-padding compact:px-desktop-compact-layout-group-padding",
|
|
155
|
+
paddingX &&
|
|
156
|
+
sizing === "component" &&
|
|
157
|
+
"px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding",
|
|
158
|
+
horizontal ? "desktop:flex-row" : "desktop:flex-col",
|
|
159
|
+
horizontalMobile ? "flex-row" : "flex-col",
|
|
160
|
+
flexClassNames,
|
|
161
|
+
sizing === "layout-group" &&
|
|
162
|
+
"gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
|
|
163
|
+
sizing === "layout" &&
|
|
164
|
+
"gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
|
|
165
|
+
sizing === "container" &&
|
|
166
|
+
"gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
|
|
167
|
+
sizing === "component" &&
|
|
168
|
+
"gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap",
|
|
169
|
+
elevation === 0 && "shadow-none",
|
|
170
|
+
elevation === 2 && "shadow-2",
|
|
171
|
+
elevation === 4 && "shadow-4",
|
|
172
|
+
elevation === 16 && "shadow-16",
|
|
173
|
+
rounded && "rounded",
|
|
174
|
+
)}
|
|
175
|
+
>
|
|
176
|
+
{children}
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { Label } from "./Label";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
|
|
5
|
+
type StatusPillProps = PropsWithChildren<{
|
|
6
|
+
intent?: "neutral" | "warning" | "success" | "critical";
|
|
7
|
+
state?: "in-progress" | "completed";
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export const StatusPill = ({
|
|
12
|
+
children,
|
|
13
|
+
state = "in-progress",
|
|
14
|
+
intent = "neutral",
|
|
15
|
+
...props
|
|
16
|
+
}: StatusPillProps) => {
|
|
17
|
+
const textColor = clsx(
|
|
18
|
+
state === "completed" && ["neutral", "critical"].includes(intent)
|
|
19
|
+
? "text-text-on-action-primary-normal"
|
|
20
|
+
: "text-neutral-500",
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const backgroundColor = clsx({
|
|
24
|
+
"bg-neutral-200": intent === "neutral" && state === "in-progress",
|
|
25
|
+
"bg-text-primary-normal": intent === "neutral" && state === "completed",
|
|
26
|
+
"bg-warning-200": intent === "warning" && state === "in-progress",
|
|
27
|
+
"bg-background-warning-normal":
|
|
28
|
+
intent === "warning" && state === "completed",
|
|
29
|
+
"bg-success-200": intent === "success" && state === "in-progress",
|
|
30
|
+
"bg-background-success-normal":
|
|
31
|
+
intent === "success" && state === "completed",
|
|
32
|
+
"bg-critical-200": intent === "critical" && state === "in-progress",
|
|
33
|
+
"bg-background-critical-normal":
|
|
34
|
+
intent === "critical" && state === "completed",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
{...props}
|
|
40
|
+
className={clsx(
|
|
41
|
+
"px-desktop-component-padding py-desktop-compact-component-padding rounded flex items-center",
|
|
42
|
+
textColor,
|
|
43
|
+
backgroundColor,
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<Label>{children}</Label>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
StatusPill.displayName = "StatusPill";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "./Button";
|
|
3
|
+
import { InputBase } from "./Input";
|
|
4
|
+
import { Icon } from "./Icon";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
|
|
7
|
+
type StepperProps = {
|
|
8
|
+
error?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
id?: string;
|
|
11
|
+
value: number;
|
|
12
|
+
setValue: React.Dispatch<React.SetStateAction<number>>;
|
|
13
|
+
onIncrease?: () => void;
|
|
14
|
+
onDecrease?: () => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Stepper = ({
|
|
18
|
+
error,
|
|
19
|
+
disabled,
|
|
20
|
+
value,
|
|
21
|
+
setValue,
|
|
22
|
+
onDecrease,
|
|
23
|
+
onIncrease,
|
|
24
|
+
...props
|
|
25
|
+
}: StepperProps) => {
|
|
26
|
+
function handleIncrease() {
|
|
27
|
+
setValue((prevVal) => prevVal + 1);
|
|
28
|
+
onIncrease?.();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleDecrease() {
|
|
32
|
+
setValue((prevVal) => prevVal - 1);
|
|
33
|
+
onDecrease?.();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="flex items-center gap-desktop-component-gap">
|
|
38
|
+
<Button
|
|
39
|
+
iconOnly
|
|
40
|
+
variant="tertiary"
|
|
41
|
+
leftIcon={
|
|
42
|
+
<span
|
|
43
|
+
className={clsx(
|
|
44
|
+
!disabled || (value > 0 && "text-icon-action-primary-normal"),
|
|
45
|
+
disabled || (value === 0 && "text-icon-action-primary-disabled"),
|
|
46
|
+
"contents",
|
|
47
|
+
)}
|
|
48
|
+
>
|
|
49
|
+
<Icon name="remove" />
|
|
50
|
+
</span>
|
|
51
|
+
}
|
|
52
|
+
onClick={handleDecrease}
|
|
53
|
+
disabled={disabled || value === 0}
|
|
54
|
+
/>
|
|
55
|
+
|
|
56
|
+
<div className="flex-1">
|
|
57
|
+
<InputBase
|
|
58
|
+
{...props}
|
|
59
|
+
id={props.id}
|
|
60
|
+
type="number"
|
|
61
|
+
align="center"
|
|
62
|
+
value={value}
|
|
63
|
+
onChange={(e) => setValue(+e.target.value)}
|
|
64
|
+
error={error}
|
|
65
|
+
disabled={disabled}
|
|
66
|
+
className="!w-6 !h-4.5 !px-0 disabled:!text-text-on-action-primary-disabled disabled:!bg-background-action-secondary-disabled disabled:!border-border-primary-normal"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<Button
|
|
71
|
+
iconOnly
|
|
72
|
+
variant="tertiary"
|
|
73
|
+
leftIcon={
|
|
74
|
+
<span
|
|
75
|
+
className={clsx(
|
|
76
|
+
!disabled && "text-icon-action-primary-normal",
|
|
77
|
+
disabled && "text-icon-action-primary-disabled",
|
|
78
|
+
"contents",
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
81
|
+
<Icon name="add" />
|
|
82
|
+
</span>
|
|
83
|
+
}
|
|
84
|
+
onClick={handleIncrease}
|
|
85
|
+
disabled={disabled}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
Stepper.displayName = "Stepper";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { AsProps, TextAttributes, TypographyProps } from "../types";
|
|
3
|
+
import { typography } from "../classNames";
|
|
4
|
+
|
|
5
|
+
type Tags = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "p";
|
|
6
|
+
|
|
7
|
+
type SubheaderProps = {
|
|
8
|
+
as?: Tags;
|
|
9
|
+
} & AsProps<Tags> &
|
|
10
|
+
TextAttributes &
|
|
11
|
+
TypographyProps;
|
|
12
|
+
|
|
13
|
+
export const Subheader = ({
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
as = "span",
|
|
17
|
+
align,
|
|
18
|
+
color,
|
|
19
|
+
tall,
|
|
20
|
+
...props
|
|
21
|
+
}: SubheaderProps) => {
|
|
22
|
+
const Element = as;
|
|
23
|
+
return (
|
|
24
|
+
<Element
|
|
25
|
+
className={clsx(
|
|
26
|
+
typography.subheader,
|
|
27
|
+
className,
|
|
28
|
+
align === "left" && "text-left",
|
|
29
|
+
align === "center" && "text-center",
|
|
30
|
+
align === "right" && "text-right",
|
|
31
|
+
tall && "!leading-6",
|
|
32
|
+
)}
|
|
33
|
+
style={{
|
|
34
|
+
...props.style,
|
|
35
|
+
color: color ? `var(--color-${color})` : undefined,
|
|
36
|
+
}}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</Element>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
Subheader.displayName = "Subheader";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { HTMLAttributes, PropsWithChildren } from "react";
|
|
3
|
+
|
|
4
|
+
type SurfaceProps = HTMLAttributes<HTMLDivElement> &
|
|
5
|
+
PropsWithChildren<{
|
|
6
|
+
className?: string;
|
|
7
|
+
elevation?: 0 | 2 | 4 | 16;
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
export const Surface = ({
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
elevation = 0,
|
|
14
|
+
...props
|
|
15
|
+
}: SurfaceProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
className={clsx(
|
|
19
|
+
"rounded-base",
|
|
20
|
+
{
|
|
21
|
+
"shadow-2": elevation === 2,
|
|
22
|
+
"shadow-4": elevation === 4,
|
|
23
|
+
"shadow-16": elevation === 16,
|
|
24
|
+
},
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
Surface.displayName = "Surface";
|