@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,76 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
import {
|
|
4
|
+
containerPaddingX,
|
|
5
|
+
layoutGap,
|
|
6
|
+
layoutGroupGap,
|
|
7
|
+
paddingYUsingLayoutGroupGap,
|
|
8
|
+
} from "../classNames";
|
|
9
|
+
import { useMatchesMobile } from "./useMatchesMedia";
|
|
10
|
+
|
|
11
|
+
type ProjectBarProps = {
|
|
12
|
+
left: ReactNode;
|
|
13
|
+
right: ReactNode;
|
|
14
|
+
mobileLeft: ReactNode;
|
|
15
|
+
mobileRight: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const ProjectBar = ({
|
|
19
|
+
left,
|
|
20
|
+
right,
|
|
21
|
+
mobileLeft,
|
|
22
|
+
mobileRight,
|
|
23
|
+
}: ComponentProps<"div"> & ProjectBarProps) => {
|
|
24
|
+
const isMobile = useMatchesMobile();
|
|
25
|
+
|
|
26
|
+
const tokenOverrides = isMobile
|
|
27
|
+
? {
|
|
28
|
+
"--color-background-primary-normal": "var(--color-brand-400)",
|
|
29
|
+
"--color-background-action-primary-normal": "var(--color-neutral-000)",
|
|
30
|
+
"--color-background-action-primary-hover": "var(--color-critical-100)",
|
|
31
|
+
"--color-background-action-primary-active": "var(--color-neutral-200)",
|
|
32
|
+
"--color-background-action-secondary-normal": "var(--color-brand-400)",
|
|
33
|
+
"--color-background-action-secondary-hover":
|
|
34
|
+
"var(--color-critical-100)",
|
|
35
|
+
|
|
36
|
+
"--color-text-on-action-primary-normal": "var(--color-brand-400)",
|
|
37
|
+
"--color-text-primary-normal": "var(--color-neutral-000)",
|
|
38
|
+
"--color-text-action-primary-normal": "var(--color-neutral-000)",
|
|
39
|
+
"--color-text-action-primary-hover": "var(--color-critical-500)",
|
|
40
|
+
"--color-text-action-primary-active": "var(--color-critical-300)",
|
|
41
|
+
|
|
42
|
+
"--color-border-action-normal": "var(--color-neutral-000)",
|
|
43
|
+
"--color-border-action-hover": "var(--color-critical-500)",
|
|
44
|
+
"--color-border-action-active": "var(--color-critical-300)",
|
|
45
|
+
}
|
|
46
|
+
: {};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
style={{ ...tokenOverrides } as React.CSSProperties}
|
|
51
|
+
className={clsx(
|
|
52
|
+
"flex items-center justify-between",
|
|
53
|
+
"bg-background-primary-normal",
|
|
54
|
+
paddingYUsingLayoutGroupGap,
|
|
55
|
+
containerPaddingX,
|
|
56
|
+
layoutGap,
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
<div className={clsx("hidden desktop:block flex-1 leading-[1]")}>
|
|
60
|
+
{left}
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div className={clsx("hidden desktop:flex items-center", layoutGroupGap)}>
|
|
64
|
+
{right}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div className={clsx("flex flex-col desktop:hidden")}>{mobileLeft}</div>
|
|
68
|
+
|
|
69
|
+
<div className={clsx("flex items-center desktop:hidden", layoutGroupGap)}>
|
|
70
|
+
{mobileRight}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
ProjectBar.displayName = "ProjectBar";
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { ComponentProps } from "react";
|
|
5
|
+
import { baseTransition } from "../classNames";
|
|
6
|
+
import { Paragraph } from "./Paragraph";
|
|
7
|
+
import { TextColorTokens } from "../types";
|
|
8
|
+
|
|
9
|
+
interface RadioProps
|
|
10
|
+
extends Omit<
|
|
11
|
+
ComponentProps<"input">,
|
|
12
|
+
"type" | "children" | "dangerouslySetInnerHTML"
|
|
13
|
+
> {
|
|
14
|
+
label?: string;
|
|
15
|
+
error?: boolean;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Radio = ({
|
|
20
|
+
className,
|
|
21
|
+
label,
|
|
22
|
+
error,
|
|
23
|
+
disabled,
|
|
24
|
+
checked,
|
|
25
|
+
readOnly,
|
|
26
|
+
...props
|
|
27
|
+
}: RadioProps) => {
|
|
28
|
+
const radioId = props.id;
|
|
29
|
+
|
|
30
|
+
const paragraphColor: TextColorTokens = disabled
|
|
31
|
+
? "text-primary-disabled"
|
|
32
|
+
: error
|
|
33
|
+
? "text-primary-error"
|
|
34
|
+
: "text-primary-normal";
|
|
35
|
+
|
|
36
|
+
const defaultClassName = clsx(
|
|
37
|
+
!error &&
|
|
38
|
+
!disabled &&
|
|
39
|
+
"border-border-primary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-focus:border-border-action-hover peer-focus:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active peer-checked:border-0 peer-checked:bg-background-action-secondary-hover",
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const errorClassName = clsx(
|
|
43
|
+
error &&
|
|
44
|
+
!disabled &&
|
|
45
|
+
"border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-focus:border-border-action-critical-hover peer-focus:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active peer-checked:bg-background-action-critical-secondary-hover peer-checked:border-0 ",
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const disabledClassName = clsx(
|
|
49
|
+
disabled &&
|
|
50
|
+
"peer-disabled:bg-background-action-secondary-disabled peer-disabled:border-border-primary-normal peer-checked:border-0",
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const readonlyClassName = clsx(
|
|
54
|
+
readOnly &&
|
|
55
|
+
"peer-read-only:bg-background-action-secondary-disabled peer-read-only:border-border-primary-normal peer-checked:border-0",
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<label
|
|
60
|
+
htmlFor={radioId}
|
|
61
|
+
className={clsx(
|
|
62
|
+
"flex items-center gap-desktop-component-gap",
|
|
63
|
+
disabled ? "cursor-default" : "cursor-pointer",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
<div className="relative">
|
|
68
|
+
<input
|
|
69
|
+
id={radioId}
|
|
70
|
+
type="radio"
|
|
71
|
+
className="sr-only peer"
|
|
72
|
+
disabled={disabled}
|
|
73
|
+
checked={checked}
|
|
74
|
+
readOnly={readOnly}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
<div
|
|
78
|
+
className={clsx(
|
|
79
|
+
"size-6 rounded-full border flex items-center justify-center",
|
|
80
|
+
baseTransition,
|
|
81
|
+
defaultClassName,
|
|
82
|
+
errorClassName,
|
|
83
|
+
disabledClassName,
|
|
84
|
+
readonlyClassName,
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
{checked && (
|
|
88
|
+
<RadioIcon
|
|
89
|
+
className={clsx(
|
|
90
|
+
"transition-colors",
|
|
91
|
+
!error &&
|
|
92
|
+
!disabled &&
|
|
93
|
+
"text-icon-on-action-secondary-normal hover:text-icon-on-action-secondary-hover active:text-icon-on-action-secondary-active peer-hover:text-icon-on-action-secondary-hover peer-focus:text-icon-on-action-secondary-hover peer-active:text-icon-on-action-secondary-active",
|
|
94
|
+
error &&
|
|
95
|
+
!disabled &&
|
|
96
|
+
"text-icon-action-critical-secondary-normal hover:text-icon-action-critical-secondary-hover active:text-icon-action-critical-secondary-active peer-hover:text-icon-action-critical-secondary-hover peer-focus:text-icon-action-critical-secondary-hover peer-active:text-icon-action-critical-secondary-active",
|
|
97
|
+
disabled && "text-icon-on-action-secondary-disabled",
|
|
98
|
+
readOnly && "text-icon-on-action-secondary-disabled",
|
|
99
|
+
)}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
{label && (
|
|
106
|
+
<Paragraph className="px-mobile-component-gap" color={paragraphColor}>
|
|
107
|
+
{label}
|
|
108
|
+
</Paragraph>
|
|
109
|
+
)}
|
|
110
|
+
</label>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
Radio.displayName = "Radio";
|
|
115
|
+
|
|
116
|
+
const RadioIcon = ({ className }: { className: string }) => {
|
|
117
|
+
return (
|
|
118
|
+
<svg
|
|
119
|
+
className={className}
|
|
120
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
121
|
+
width="24"
|
|
122
|
+
height="24"
|
|
123
|
+
viewBox="0 0 24 24"
|
|
124
|
+
fill="none"
|
|
125
|
+
>
|
|
126
|
+
<rect
|
|
127
|
+
x="1"
|
|
128
|
+
y="1"
|
|
129
|
+
width="22"
|
|
130
|
+
height="22"
|
|
131
|
+
rx="11"
|
|
132
|
+
stroke="currentColor"
|
|
133
|
+
strokeWidth="2"
|
|
134
|
+
/>
|
|
135
|
+
<rect x="4" y="4" width="16" height="16" rx="8" fill="currentColor" />
|
|
136
|
+
</svg>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
RadioIcon.displayName = "RadioIcon";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ReactNode,
|
|
4
|
+
RefObject,
|
|
5
|
+
useEffect,
|
|
6
|
+
useId,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { Input, InputBaseProps } from "./Input";
|
|
11
|
+
|
|
12
|
+
export interface SearchProps {
|
|
13
|
+
renderMenu?: (props: {
|
|
14
|
+
positionTo: RefObject<HTMLElement | null> | undefined;
|
|
15
|
+
show: boolean;
|
|
16
|
+
setShow: (value: boolean) => void;
|
|
17
|
+
topOffset?: number | null;
|
|
18
|
+
autoFocusOff?: boolean;
|
|
19
|
+
menuName?: string;
|
|
20
|
+
}) => ReactNode;
|
|
21
|
+
value?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Search = ({
|
|
25
|
+
label,
|
|
26
|
+
error,
|
|
27
|
+
children,
|
|
28
|
+
readOnly,
|
|
29
|
+
renderMenu,
|
|
30
|
+
onClick,
|
|
31
|
+
className,
|
|
32
|
+
wrapperClassName,
|
|
33
|
+
removeRoundness,
|
|
34
|
+
...props
|
|
35
|
+
}: Omit<InputBaseProps, "after"> & SearchProps) => {
|
|
36
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
37
|
+
const inputContainerRef = useRef(null);
|
|
38
|
+
const preventFocusOnInitialRender = useRef(true);
|
|
39
|
+
const [show, setShow] = useState(false);
|
|
40
|
+
const [clearing, setClearing] = useState(false);
|
|
41
|
+
const uniqueId = useId();
|
|
42
|
+
const searchMenuName = `search-menu-${uniqueId}`;
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (preventFocusOnInitialRender.current) {
|
|
46
|
+
preventFocusOnInitialRender.current = false;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
inputRef.current?.focus();
|
|
51
|
+
}, [props.value]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<Input
|
|
56
|
+
variant="search"
|
|
57
|
+
inputContainerRef={inputContainerRef}
|
|
58
|
+
ref={inputRef}
|
|
59
|
+
label={label}
|
|
60
|
+
wrapperClassName={wrapperClassName}
|
|
61
|
+
onClick={(e) => {
|
|
62
|
+
if (props.disabled || readOnly) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (clearing) {
|
|
67
|
+
setClearing(false);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
onClick?.(e);
|
|
72
|
+
setShow(!show)
|
|
73
|
+
}}
|
|
74
|
+
onClear={() => {
|
|
75
|
+
setClearing(true);
|
|
76
|
+
}}
|
|
77
|
+
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
78
|
+
setShow(true);
|
|
79
|
+
|
|
80
|
+
if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
|
|
83
|
+
const menu = document.querySelector<HTMLElement>(`[data-menu="${searchMenuName}"]`);
|
|
84
|
+
const selectedMenuOption = menu?.querySelector<HTMLElement>('[data-selected]');
|
|
85
|
+
|
|
86
|
+
if (selectedMenuOption) {
|
|
87
|
+
const allMenuOptions = Array.from(menu?.querySelectorAll<HTMLElement>('[role="menuitem"]') || []);
|
|
88
|
+
const currentIndex = allMenuOptions.indexOf(selectedMenuOption);
|
|
89
|
+
|
|
90
|
+
let targetOption: HTMLElement | undefined;
|
|
91
|
+
|
|
92
|
+
if (e.key === 'ArrowDown') {
|
|
93
|
+
targetOption = allMenuOptions[currentIndex + 1] || allMenuOptions[0]; // Wrap to first
|
|
94
|
+
} else {
|
|
95
|
+
targetOption = allMenuOptions[currentIndex - 1] || allMenuOptions[allMenuOptions.length - 1]; // Wrap to last
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
targetOption?.focus();
|
|
99
|
+
} else {
|
|
100
|
+
const toFocusMenuOption = e.key === 'ArrowDown'
|
|
101
|
+
? menu?.querySelector<HTMLElement>('[role="menuitem"]')
|
|
102
|
+
: menu?.querySelector<HTMLElement>('[role="menuitem"]:last-child');
|
|
103
|
+
|
|
104
|
+
toFocusMenuOption?.focus();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}}
|
|
108
|
+
error={error}
|
|
109
|
+
readOnly={readOnly}
|
|
110
|
+
removeRoundness={removeRoundness}
|
|
111
|
+
focus={show}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
{renderMenu
|
|
116
|
+
? renderMenu({
|
|
117
|
+
positionTo: inputContainerRef,
|
|
118
|
+
show,
|
|
119
|
+
setShow,
|
|
120
|
+
topOffset: props.caption ? -16 : null,
|
|
121
|
+
autoFocusOff: true,
|
|
122
|
+
menuName: searchMenuName
|
|
123
|
+
})
|
|
124
|
+
: children}
|
|
125
|
+
</>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
Search.displayName = "Search";
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ReactNode, RefObject, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { InputBase, InputBaseProps } from "./Input";
|
|
4
|
+
import { Icon } from "./Icon";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
|
|
7
|
+
export interface SelectProps {
|
|
8
|
+
renderMenu?: (props: {
|
|
9
|
+
positionTo: RefObject<HTMLElement | null> | undefined;
|
|
10
|
+
show: boolean;
|
|
11
|
+
setShow: (value: boolean) => void;
|
|
12
|
+
topOffset?: number | null;
|
|
13
|
+
}) => ReactNode;
|
|
14
|
+
displayValue?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Select = ({
|
|
18
|
+
label,
|
|
19
|
+
error,
|
|
20
|
+
children,
|
|
21
|
+
readOnly,
|
|
22
|
+
renderMenu,
|
|
23
|
+
onClick,
|
|
24
|
+
className,
|
|
25
|
+
wrapperClassName,
|
|
26
|
+
removeRoundness,
|
|
27
|
+
displayValue,
|
|
28
|
+
value,
|
|
29
|
+
...props
|
|
30
|
+
}: Omit<InputBaseProps, "after"> & SelectProps) => {
|
|
31
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
32
|
+
const inputContainerRef = useRef(null);
|
|
33
|
+
const preventFocusOnInitialRender = useRef(true);
|
|
34
|
+
const [show, setShow] = useState(false);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (preventFocusOnInitialRender.current) {
|
|
38
|
+
preventFocusOnInitialRender.current = false;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
inputRef.current?.focus();
|
|
43
|
+
}, [value]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<InputBase
|
|
48
|
+
inputContainerRef={inputContainerRef}
|
|
49
|
+
ref={inputRef}
|
|
50
|
+
label={label}
|
|
51
|
+
after={
|
|
52
|
+
!readOnly && (
|
|
53
|
+
<span
|
|
54
|
+
className={clsx(
|
|
55
|
+
props.disabled
|
|
56
|
+
? "text-icon-action-primary-disabled"
|
|
57
|
+
: "text-icon-action-primary-normal",
|
|
58
|
+
"contents",
|
|
59
|
+
)}
|
|
60
|
+
>
|
|
61
|
+
<Icon name="keyboard_arrow_down" />
|
|
62
|
+
</span>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
maxLength={0}
|
|
66
|
+
className={clsx("!caret-transparent !cursor-default", className)}
|
|
67
|
+
wrapperClassName={wrapperClassName}
|
|
68
|
+
onKeyDown={(e) => {
|
|
69
|
+
const openKeys = ["Enter", "Space", " "];
|
|
70
|
+
|
|
71
|
+
if (openKeys.includes(e.key)) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
(e.target as HTMLElement).click();
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
onClick={(e) => {
|
|
77
|
+
if (props.disabled || readOnly) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setShow(!show);
|
|
82
|
+
onClick?.(e);
|
|
83
|
+
}}
|
|
84
|
+
error={error}
|
|
85
|
+
readOnly={readOnly}
|
|
86
|
+
removeRoundness={removeRoundness}
|
|
87
|
+
focus={show}
|
|
88
|
+
{...props}
|
|
89
|
+
value={displayValue ?? value}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
{renderMenu
|
|
93
|
+
? renderMenu({
|
|
94
|
+
positionTo: inputContainerRef,
|
|
95
|
+
show,
|
|
96
|
+
setShow,
|
|
97
|
+
topOffset: props.caption ? -16 : null,
|
|
98
|
+
})
|
|
99
|
+
: children}
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
Select.displayName = "Select";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
|
|
4
|
+
type SideMenuProps = PropsWithChildren<{
|
|
5
|
+
cardStyle?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
|
|
8
|
+
export const SideMenu = ({ children, cardStyle = false }: SideMenuProps) => {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
className={clsx(
|
|
12
|
+
"flex flex-col",
|
|
13
|
+
cardStyle &&
|
|
14
|
+
"p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding rounded shadow-4 bg-background-primary-normal",
|
|
15
|
+
)}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
SideMenu.displayName = "SideMenu";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { PropsWithChildren, useEffect, useState } from "react";
|
|
5
|
+
import { Label } from "./Label";
|
|
6
|
+
import { baseTransition } from "../classNames";
|
|
7
|
+
import { Stack } from "./Stack";
|
|
8
|
+
import { Icon } from "./Icon";
|
|
9
|
+
|
|
10
|
+
export type SideMenuGroupProps = PropsWithChildren<{
|
|
11
|
+
label?: string;
|
|
12
|
+
groupIndentLevel?: 1 | 2 | 3 | 4;
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export const SideMenuGroup = ({
|
|
18
|
+
label,
|
|
19
|
+
groupIndentLevel = 1,
|
|
20
|
+
collapsed = false,
|
|
21
|
+
disabled = false,
|
|
22
|
+
children,
|
|
23
|
+
}: SideMenuGroupProps) => {
|
|
24
|
+
const [internalCollapsed, setInternalCollapsed] = useState(collapsed);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setInternalCollapsed(collapsed);
|
|
28
|
+
}, [collapsed]);
|
|
29
|
+
|
|
30
|
+
const toggleCollapse = () => {
|
|
31
|
+
if (!disabled) setInternalCollapsed((prev) => !prev);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const enabledDisabledStyles = disabled
|
|
35
|
+
? clsx("text-text-action-disabled pointer-events-none")
|
|
36
|
+
: clsx("text-text-primary-normal");
|
|
37
|
+
|
|
38
|
+
const additionalAttr = {
|
|
39
|
+
"data-disabled": disabled || null,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<div
|
|
45
|
+
className={clsx(
|
|
46
|
+
"group/sm-group flex rounded cursor-pointer",
|
|
47
|
+
"bg-transparent",
|
|
48
|
+
"hover:bg-background-action-secondary-hover hover:text-text-action-hover",
|
|
49
|
+
"active:bg-background-action-secondary-active active:text-text-action-active",
|
|
50
|
+
baseTransition,
|
|
51
|
+
enabledDisabledStyles,
|
|
52
|
+
)}
|
|
53
|
+
onClick={toggleCollapse}
|
|
54
|
+
{...additionalAttr}
|
|
55
|
+
>
|
|
56
|
+
<Stack horizontal items="center" sizing="component" padding>
|
|
57
|
+
{groupIndentLevel === 2 && <div className="pl-6" />}
|
|
58
|
+
{groupIndentLevel === 3 && <div className="pl-13" />}
|
|
59
|
+
{groupIndentLevel === 4 && <div className="pl-20" />}
|
|
60
|
+
|
|
61
|
+
<Icon
|
|
62
|
+
name="keyboard_arrow_down"
|
|
63
|
+
className={clsx(
|
|
64
|
+
"transition duration-100 ease-in-out",
|
|
65
|
+
"pointer-events-none",
|
|
66
|
+
{
|
|
67
|
+
"rotate-180": !internalCollapsed,
|
|
68
|
+
},
|
|
69
|
+
)}
|
|
70
|
+
size={24}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
<Label padded>{label}</Label>
|
|
74
|
+
</Stack>
|
|
75
|
+
</div>
|
|
76
|
+
{!internalCollapsed && children}
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
SideMenuGroup.displayName = "SideMenuGroup";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { baseTransition, componentPaddingMinus2pxBorder } from "../classNames";
|
|
3
|
+
import { Stack } from "./Stack";
|
|
4
|
+
import { Paragraph } from "./Paragraph";
|
|
5
|
+
|
|
6
|
+
export type SideMenuItemProps = {
|
|
7
|
+
label?: string;
|
|
8
|
+
leftIcon?: React.ReactNode;
|
|
9
|
+
rightIcon?: React.ReactNode;
|
|
10
|
+
href?: string;
|
|
11
|
+
groupIndentLevel?: 1 | 2 | 3 | 4 | 5;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const SideMenuItem = ({
|
|
18
|
+
label,
|
|
19
|
+
leftIcon,
|
|
20
|
+
rightIcon,
|
|
21
|
+
href,
|
|
22
|
+
groupIndentLevel,
|
|
23
|
+
selected = false,
|
|
24
|
+
disabled = false,
|
|
25
|
+
onClick,
|
|
26
|
+
}: SideMenuItemProps) => {
|
|
27
|
+
const unselectedStateStyles =
|
|
28
|
+
!selected && !disabled && clsx("border-transparent");
|
|
29
|
+
|
|
30
|
+
const unselectedDisabledStateStyles =
|
|
31
|
+
!selected && disabled && clsx("bg-transparent border-transparent");
|
|
32
|
+
|
|
33
|
+
const selectedStateStyles =
|
|
34
|
+
selected &&
|
|
35
|
+
!disabled &&
|
|
36
|
+
clsx(
|
|
37
|
+
"bg-background-action-secondary-hover border-border-action-normal",
|
|
38
|
+
"hover:border-border-action-hover",
|
|
39
|
+
"active:border-border-action-active",
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const selectedDisabledStateStyles =
|
|
43
|
+
selected &&
|
|
44
|
+
disabled &&
|
|
45
|
+
clsx(
|
|
46
|
+
"bg-background-action-secondary-disabled border-border-action-disabled",
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const enabledDisabledStyles = disabled
|
|
50
|
+
? clsx("text-text-action-disabled pointer-events-none")
|
|
51
|
+
: clsx("text-text-primary-normal");
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<a
|
|
55
|
+
href={href}
|
|
56
|
+
className={clsx(
|
|
57
|
+
"group flex w-full rounded border-2 cursor-pointer",
|
|
58
|
+
"hover:bg-background-action-secondary-hover hover:text-text-action-hover",
|
|
59
|
+
"active:bg-background-action-secondary-active active:text-text-action-active",
|
|
60
|
+
baseTransition,
|
|
61
|
+
componentPaddingMinus2pxBorder,
|
|
62
|
+
unselectedStateStyles,
|
|
63
|
+
unselectedDisabledStateStyles,
|
|
64
|
+
selectedStateStyles,
|
|
65
|
+
selectedDisabledStateStyles,
|
|
66
|
+
enabledDisabledStyles,
|
|
67
|
+
)}
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
>
|
|
70
|
+
<Stack horizontal items="center" sizing="component">
|
|
71
|
+
{groupIndentLevel === 2 && <div className="pl-6" />}
|
|
72
|
+
{groupIndentLevel === 3 && <div className="pl-13" />}
|
|
73
|
+
{groupIndentLevel === 4 && <div className="pl-20" />}
|
|
74
|
+
{groupIndentLevel === 5 && <div className="pl-27" />}
|
|
75
|
+
|
|
76
|
+
{leftIcon && leftIcon}
|
|
77
|
+
|
|
78
|
+
{!leftIcon && groupIndentLevel && <div className="w-6 h-6" />}
|
|
79
|
+
|
|
80
|
+
<Paragraph as="span" padded className="mr-auto !leading-6">
|
|
81
|
+
{label}
|
|
82
|
+
</Paragraph>
|
|
83
|
+
|
|
84
|
+
{rightIcon && rightIcon}
|
|
85
|
+
</Stack>
|
|
86
|
+
</a>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
SideMenuItem.displayName = "SideMenuItem";
|