@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,196 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
import { baseTransition, componentGap } from "../classNames";
|
|
5
|
+
import { Icon } from "./Icon";
|
|
6
|
+
import { Paragraph } from "./Paragraph";
|
|
7
|
+
|
|
8
|
+
interface CheckboxProps
|
|
9
|
+
extends Omit<
|
|
10
|
+
ComponentProps<"input">,
|
|
11
|
+
"type" | "className" | "children" | "dangerouslySetInnerHTML"
|
|
12
|
+
> {
|
|
13
|
+
label?: string;
|
|
14
|
+
error?: boolean;
|
|
15
|
+
indeterminate?: boolean;
|
|
16
|
+
paragraphClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Checkbox = ({
|
|
20
|
+
label,
|
|
21
|
+
error,
|
|
22
|
+
disabled,
|
|
23
|
+
readOnly,
|
|
24
|
+
checked,
|
|
25
|
+
onChange,
|
|
26
|
+
indeterminate,
|
|
27
|
+
paragraphClassName,
|
|
28
|
+
...props
|
|
29
|
+
}: CheckboxProps) => {
|
|
30
|
+
const selected = indeterminate || checked;
|
|
31
|
+
|
|
32
|
+
const normalClassName = clsx(
|
|
33
|
+
!selected &&
|
|
34
|
+
!error &&
|
|
35
|
+
!disabled &&
|
|
36
|
+
!readOnly &&
|
|
37
|
+
"border-border-primary-normal bg-background-action-secondary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active",
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const normalSelectedClassName = clsx(
|
|
41
|
+
selected &&
|
|
42
|
+
!error &&
|
|
43
|
+
!disabled &&
|
|
44
|
+
!readOnly &&
|
|
45
|
+
"bg-background-action-primary-normal border-background-action-primary-normal peer-hover:bg-background-action-primary-hover peer-hover:border-background-action-primary-hover peer-active:bg-background-action-primary-active peer-active:border-background-action-primary-active",
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const errorClassName = clsx(
|
|
49
|
+
error &&
|
|
50
|
+
!selected &&
|
|
51
|
+
"bg-background-action-critical-secondary-normal border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active",
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const errorSelectedClassName = clsx(
|
|
55
|
+
error &&
|
|
56
|
+
selected &&
|
|
57
|
+
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal peer-hover:bg-background-action-critical-primary-hover peer-hover:border-background-action-critical-primary-hover peer-active:bg-background-action-critical-primary-active peer-active:border-background-action-critical-primary-active",
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const disabledClassName = clsx(
|
|
61
|
+
disabled &&
|
|
62
|
+
!readOnly &&
|
|
63
|
+
"border-border-primary-normal bg-background-action-secondary-disabled peer-checked:bg-icon-on-action-primary-disabled peer-checked:border-icon-on-action-primary-disabled",
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const readOnlyClassName = clsx(
|
|
67
|
+
readOnly &&
|
|
68
|
+
"border-transparent bg-transparent peer-checked:bg-transparent peer-checked:border-transparent",
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const checkColor = clsx(
|
|
72
|
+
selected &&
|
|
73
|
+
!disabled &&
|
|
74
|
+
!readOnly &&
|
|
75
|
+
"color-icon-on-action-primary-normal peer-hover:color-icon-on-action-primary-hover peer-active:color-icon-on-action-primary-active",
|
|
76
|
+
selected && disabled && "color-background-action-primary-disabled",
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<label
|
|
81
|
+
className={clsx(
|
|
82
|
+
"flex items-center",
|
|
83
|
+
componentGap,
|
|
84
|
+
(disabled || (readOnly && error) || readOnly) && "cursor-default",
|
|
85
|
+
!(readOnly && error) && !disabled && !readOnly && "cursor-pointer",
|
|
86
|
+
)}
|
|
87
|
+
>
|
|
88
|
+
<div className="relative">
|
|
89
|
+
<input
|
|
90
|
+
type="checkbox"
|
|
91
|
+
className="sr-only peer"
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
checked={selected}
|
|
94
|
+
onChange={handleOnChange}
|
|
95
|
+
id={props.id}
|
|
96
|
+
data-indeterminate={indeterminate}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
{error && (readOnly || disabled) ? (
|
|
101
|
+
<div className={clsx("size-6", "flex items-center justify-center")}>
|
|
102
|
+
{selected ? (
|
|
103
|
+
indeterminate ? (
|
|
104
|
+
<span className="text-icon-primary-normal contents">
|
|
105
|
+
<Icon name="question_mark" />
|
|
106
|
+
</span>
|
|
107
|
+
) : readOnly ? (
|
|
108
|
+
<span className="text-success-400 contents">
|
|
109
|
+
<Icon name="check" />
|
|
110
|
+
</span>
|
|
111
|
+
) : (
|
|
112
|
+
<span className="text-icon-on-action-primary-normal contents">
|
|
113
|
+
<Icon name="check" className="pointer-events-none" />
|
|
114
|
+
</span>
|
|
115
|
+
)
|
|
116
|
+
) : (
|
|
117
|
+
readOnly && (
|
|
118
|
+
<span className="text-icon-primary-normal contents">
|
|
119
|
+
<Icon name="close" />
|
|
120
|
+
</span>
|
|
121
|
+
)
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
) : (
|
|
125
|
+
<div
|
|
126
|
+
className={clsx(
|
|
127
|
+
"size-6 border rounded-base",
|
|
128
|
+
"flex items-center justify-center",
|
|
129
|
+
baseTransition,
|
|
130
|
+
normalClassName,
|
|
131
|
+
normalSelectedClassName,
|
|
132
|
+
errorClassName,
|
|
133
|
+
errorSelectedClassName,
|
|
134
|
+
disabledClassName,
|
|
135
|
+
readOnlyClassName,
|
|
136
|
+
checkColor,
|
|
137
|
+
)}
|
|
138
|
+
>
|
|
139
|
+
{selected ? (
|
|
140
|
+
indeterminate ? (
|
|
141
|
+
readOnly ? (
|
|
142
|
+
<span className="text-icon-primary-normal contents">
|
|
143
|
+
<Icon name="question_mark" />
|
|
144
|
+
</span>
|
|
145
|
+
) : (
|
|
146
|
+
<span className="text-icon-on-action-primary-normal contents">
|
|
147
|
+
<Icon name="remove" className="pointer-events-none" />
|
|
148
|
+
</span>
|
|
149
|
+
)
|
|
150
|
+
) : readOnly ? (
|
|
151
|
+
<span className="text-success-400 contents">
|
|
152
|
+
<Icon name="check" />
|
|
153
|
+
</span>
|
|
154
|
+
) : (
|
|
155
|
+
<span className="text-icon-on-action-primary-normal contents">
|
|
156
|
+
<Icon name="check" className="pointer-events-none" />
|
|
157
|
+
</span>
|
|
158
|
+
)
|
|
159
|
+
) : (
|
|
160
|
+
readOnly && (
|
|
161
|
+
<span className="text-icon-primary-normal contents">
|
|
162
|
+
<Icon name="close" />
|
|
163
|
+
</span>
|
|
164
|
+
)
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
167
|
+
)}
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
{label && (
|
|
171
|
+
<Paragraph
|
|
172
|
+
as="span"
|
|
173
|
+
padded
|
|
174
|
+
className={clsx(
|
|
175
|
+
"text-nowrap",
|
|
176
|
+
disabled && !error && "!text-text-primary-disabled",
|
|
177
|
+
error && !disabled && !readOnly && "!text-text-primary-error",
|
|
178
|
+
paragraphClassName,
|
|
179
|
+
)}
|
|
180
|
+
>
|
|
181
|
+
{label}
|
|
182
|
+
</Paragraph>
|
|
183
|
+
)}
|
|
184
|
+
</label>
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
function handleOnChange(e: React.ChangeEvent<HTMLInputElement>): void {
|
|
188
|
+
if (disabled || readOnly || (readOnly && error) || !onChange) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
onChange(e);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
Checkbox.displayName = "Checkbox";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import React, { ComponentPropsWithRef, useCallback, useState } from "react";
|
|
5
|
+
import { Button } from "./Button";
|
|
6
|
+
|
|
7
|
+
export type ContentTabProps = {
|
|
8
|
+
label?: string;
|
|
9
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
} & ComponentPropsWithRef<"button">;
|
|
13
|
+
|
|
14
|
+
export const ContentTab = ({
|
|
15
|
+
label,
|
|
16
|
+
selected = false,
|
|
17
|
+
className,
|
|
18
|
+
disabled = false,
|
|
19
|
+
onClick,
|
|
20
|
+
ref,
|
|
21
|
+
...props
|
|
22
|
+
}: ContentTabProps) => {
|
|
23
|
+
const [active, setActive] = useState(false);
|
|
24
|
+
|
|
25
|
+
const handleClick = useCallback(
|
|
26
|
+
(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
27
|
+
if (!disabled) {
|
|
28
|
+
onClick?.(e);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[onClick, disabled],
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const computedClassName = clsx(
|
|
35
|
+
"absolute left-0 right-0 bottom-0 transition-colors duration-200 ease-in-out hover:bg-border-action-hover z-10",
|
|
36
|
+
"rounded-px",
|
|
37
|
+
"h-0.5",
|
|
38
|
+
active && "bg-text-action-primary-active",
|
|
39
|
+
!active && !disabled && "bg-text-action-primary-normal",
|
|
40
|
+
!active && disabled && "bg-text-action-primary-disabled",
|
|
41
|
+
|
|
42
|
+
className,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className="relative">
|
|
47
|
+
<Button
|
|
48
|
+
ref={ref}
|
|
49
|
+
variant="tertiary"
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
onMouseDown={() => setActive(true)}
|
|
52
|
+
onMouseLeave={() => setActive(false)}
|
|
53
|
+
onMouseUp={() => setActive(false)}
|
|
54
|
+
onClick={handleClick}
|
|
55
|
+
role="tab"
|
|
56
|
+
aria-selected={selected}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
{label}
|
|
60
|
+
</Button>
|
|
61
|
+
{selected && <div className={computedClassName}> </div>}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
ContentTab.displayName = "ContentTab";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { ReactNode, useState, useRef, useCallback } from "react";
|
|
4
|
+
import { ContentTab } from "./ContentTab";
|
|
5
|
+
|
|
6
|
+
type Tab = {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type ContentTabsProps = {
|
|
13
|
+
tabs: Tab[];
|
|
14
|
+
onTabChange?: (tabId: string) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const afterClasses =
|
|
18
|
+
"after:absolute after:bottom-0 after:left-0 after:w-full after:h-0.5 after:bg-border-primary-normal z-0";
|
|
19
|
+
|
|
20
|
+
export const ContentTabs = ({ tabs, onTabChange }: ContentTabsProps) => {
|
|
21
|
+
const [selectedTab, setSelectedTab] = useState<string>(tabs[0]?.id || "");
|
|
22
|
+
const [focusedTabIndex, setFocusedTabIndex] = useState<number>(0);
|
|
23
|
+
const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);
|
|
24
|
+
|
|
25
|
+
const handleTabClick = useCallback(
|
|
26
|
+
(id: string, index: number) => {
|
|
27
|
+
setSelectedTab(id);
|
|
28
|
+
setFocusedTabIndex(index);
|
|
29
|
+
onTabChange?.(id);
|
|
30
|
+
},
|
|
31
|
+
[onTabChange],
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
35
|
+
let newIndex = focusedTabIndex;
|
|
36
|
+
if (e.key === "ArrowRight") {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
newIndex = (focusedTabIndex + 1) % tabs.length;
|
|
39
|
+
} else if (e.key === "ArrowLeft") {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
newIndex = (focusedTabIndex - 1 + tabs.length) % tabs.length;
|
|
42
|
+
} else {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const id = tabs[newIndex].id;
|
|
46
|
+
setSelectedTab(id);
|
|
47
|
+
onTabChange?.(id);
|
|
48
|
+
tabRefs.current[newIndex]?.focus();
|
|
49
|
+
setFocusedTabIndex(newIndex);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const selectedContent = tabs.find((tab) => tab.id === selectedTab)?.content;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div>
|
|
56
|
+
<div className="overflow-x-auto pb-2">
|
|
57
|
+
<div
|
|
58
|
+
role="tablist"
|
|
59
|
+
aria-orientation="horizontal"
|
|
60
|
+
className={clsx("flex relative", afterClasses)}
|
|
61
|
+
onKeyDown={handleKeyDown}
|
|
62
|
+
>
|
|
63
|
+
{tabs.map((tab, index) => {
|
|
64
|
+
const isSelected = selectedTab === tab.id;
|
|
65
|
+
return (
|
|
66
|
+
<ContentTab
|
|
67
|
+
key={tab.id}
|
|
68
|
+
id={`tab-${tab.id}`}
|
|
69
|
+
label={tab.label}
|
|
70
|
+
selected={isSelected}
|
|
71
|
+
onClick={() => handleTabClick(tab.id, index)}
|
|
72
|
+
onFocus={() => {
|
|
73
|
+
setSelectedTab(tab.id);
|
|
74
|
+
setFocusedTabIndex(index);
|
|
75
|
+
onTabChange?.(tab.id);
|
|
76
|
+
}}
|
|
77
|
+
className={clsx(!isSelected && afterClasses)}
|
|
78
|
+
role="tab"
|
|
79
|
+
aria-selected={isSelected}
|
|
80
|
+
aria-controls={`panel-${tab.id}`}
|
|
81
|
+
tabIndex={isSelected ? 0 : -1}
|
|
82
|
+
ref={(el) => {
|
|
83
|
+
tabRefs.current[index] = el;
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
})}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
<div
|
|
91
|
+
id={`panel-${selectedTab}`}
|
|
92
|
+
className="mt-2"
|
|
93
|
+
role="tabpanel"
|
|
94
|
+
aria-labelledby={`tab-${selectedTab}`}
|
|
95
|
+
tabIndex={0}
|
|
96
|
+
>
|
|
97
|
+
{selectedContent}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
ContentTabs.displayName = "ContentTabs";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function DMSiLogo() {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="107"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 107 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M10.1472 5.86855H22.261C24.0328 5.86855 25.2192 5.79792 26.2514 7.25517C27.1489 8.60833 27.4185 9.79792 27.2105 11.4336C27.0025 13.0693 26.5596 14.2291 25.4926 15.6529C24.9996 16.3295 24.3795 16.8648 23.6284 17.2552C22.6077 17.7533 21.9529 17.6827 20.9206 17.6827H8.69893V17.6381L8.00562 23.2589H20.7704C24.2755 23.2589 27.6496 22.5228 30.4807 19.9949C33.0999 17.6827 34.6444 14.8128 35.0489 11.612C35.4918 8.12506 34.6406 5.72357 32.2948 3.3035C29.8875 0.775615 26.8793 0.362976 23.2278 0.362976H10.8328L10.1472 5.92803V5.86855Z"
|
|
12
|
+
fill="#1D1E1E"
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
d="M45.7143 0.960477L45.3484 3.9233L45.437 3.64077C46.9276 1.46605 49.2772 0.618469 51.8771 0.618469C54.6042 0.618469 56.3567 1.62219 57.4082 3.91958C59.2263 1.53668 61.5527 0.618469 64.4531 0.618469C66.3135 0.618469 67.9544 1.16122 69.0868 2.45862C70.485 4.04598 70.2192 6.1352 69.9342 8.3917L68.0083 23.2356H60.5705L62.3462 9.28018C62.5234 7.901 62.5041 6.35453 60.5128 6.35453C58.0862 6.35453 57.6085 8.52925 57.389 10.2393L55.7366 23.2319H48.2025L49.9782 9.27646C50.1477 7.93817 49.9897 6.22442 48.1255 6.22442C46.0918 6.22442 45.4408 7.6891 45.2367 9.27646L43.461 23.2319H35.3453L38.2072 0.960477H45.7143Z"
|
|
16
|
+
fill="#1D1E1E"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M97.4234 0.336578L96.6954 6.39234H103.474L96.2755 9.54104L94.5076 23.2734H103.255L106.175 0.336578H97.4234Z"
|
|
20
|
+
fill="#1D1E1E"
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
d="M91.03 10.4126C89.3545 9.34573 86.6082 9.04833 84.6092 8.79182C83.9158 8.70632 83.1339 8.49814 82.4059 8.29368C82.1286 8.23792 81.8705 8.16729 81.6317 8.07807C81.5431 8.05204 81.443 8.02231 81.3583 8C81.1618 7.95539 80.9461 7.81041 80.7535 7.61338C80.353 7.30855 80.1141 6.94424 80.1141 6.54647C80.1141 6.35688 80.1835 6.17844 80.2836 6.00372C80.2952 5.98513 80.3029 5.97026 80.3144 5.95167C80.7921 5.20446 82.1248 4.66543 83.7117 4.66543C85.626 4.66543 87.1821 5.44981 87.29 6.43866H94.7393C93.7571 2.34572 89.0772 0 84.8326 0C82.3135 0 79.1204 0.342007 76.7439 1.66171C74.4598 2.94052 72.8228 4.66914 72.5069 7.14126C71.7674 12.9405 77.1945 14.026 81.8436 14.6654C82.1017 14.6952 82.6062 14.8141 83.157 15.0037C84.5976 15.2974 85.6183 16.026 85.6183 16.8848C85.6183 17.8773 84.2509 18.6989 82.4522 18.8699C82.2442 18.9145 82.0593 18.9368 81.9168 18.9368C80.7689 18.9368 79.987 18.8625 79.4131 18.487C78.689 18.197 78.1613 17.777 77.9726 17.29H70.165C71.205 22.3234 75.8387 24 80.534 24C85.6145 24 92.6747 22.2491 93.4412 16.2342C93.6801 14.3494 93.0099 11.7286 91.0378 10.4089L91.03 10.4126Z"
|
|
24
|
+
fill="#1D1E1E"
|
|
25
|
+
/>
|
|
26
|
+
<path
|
|
27
|
+
d="M1.85771 9.54941H16.9027L0.825439 16.9174L1.85771 9.54941Z"
|
|
28
|
+
fill="#0077C8"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
);
|
|
32
|
+
}
|