@rovula/ui 0.1.7 → 0.1.9
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/dist/cjs/bundle.css +273 -126
- package/dist/cjs/bundle.js +1545 -1545
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/AlertDialog/AlertDialog.stories.d.ts +3 -0
- package/dist/cjs/types/components/Dialog/Dialog.d.ts +7 -1
- package/dist/cjs/types/components/Dialog/Dialog.stories.d.ts +3 -0
- package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +2 -0
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +2 -0
- package/dist/cjs/types/components/Form/Field.d.ts +26 -0
- package/dist/cjs/types/components/Form/FieldMessage.d.ts +7 -0
- package/dist/cjs/types/components/Form/Form.d.ts +49 -11
- package/dist/cjs/types/components/Form/Form.stories.d.ts +23 -0
- package/dist/cjs/types/components/Form/ValidationHintList.d.ts +20 -0
- package/dist/cjs/types/components/Form/ValidationHintList.stories.d.ts +9 -0
- package/dist/cjs/types/components/Form/index.d.ts +10 -0
- package/dist/cjs/types/components/Form/useOptionBridge.d.ts +17 -0
- package/dist/cjs/types/components/OtpInput/OtpInput.d.ts +17 -0
- package/dist/cjs/types/components/OtpInput/OtpInput.stories.d.ts +15 -0
- package/dist/cjs/types/components/OtpInput/OtpInputGroup.d.ts +25 -0
- package/dist/cjs/types/components/OtpInput/index.d.ts +5 -0
- package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +3 -0
- package/dist/cjs/types/index.d.ts +5 -0
- package/dist/cjs/types/theme/ThemeColorCoverageRuntime.stories.d.ts +10 -0
- package/dist/cjs/types/utils/colors.d.ts +84 -0
- package/dist/components/ActionButton/ActionButton.stories.js +2 -2
- package/dist/components/ActionButton/ActionButton.styles.js +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +6 -6
- package/dist/components/AlertDialog/AlertDialog.stories.js +3 -0
- package/dist/components/Avatar/Avatar.stories.js +1 -1
- package/dist/components/Avatar/Avatar.styles.js +1 -1
- package/dist/components/Avatar/AvatarBase.js +1 -1
- package/dist/components/Avatar/AvatarGroup.stories.js +1 -1
- package/dist/components/Button/Buttons.stories.js +2 -2
- package/dist/components/Calendar/Calendar.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +17 -7
- package/dist/components/Collapsible/Collapsible.styles.js +1 -1
- package/dist/components/DataTable/DataTable.js +2 -2
- package/dist/components/Dialog/Dialog.js +12 -7
- package/dist/components/Dialog/Dialog.stories.js +90 -2
- package/dist/components/Dropdown/Dropdown.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +3 -3
- package/dist/components/FocusedScrollView/FocusedScrollView.stories.js +6 -6
- package/dist/components/Form/Field.js +60 -0
- package/dist/components/Form/FieldMessage.js +24 -0
- package/dist/components/Form/Form.js +73 -41
- package/dist/components/Form/Form.stories.js +221 -0
- package/dist/components/Form/ValidationHintList.js +30 -0
- package/dist/components/Form/ValidationHintList.stories.js +50 -0
- package/dist/components/Form/index.js +5 -0
- package/dist/components/Form/useOptionBridge.js +27 -0
- package/dist/components/InputFilter/InputFilter.js +5 -4
- package/dist/components/InputFilter/InputFilter.stories.js +1 -1
- package/dist/components/InputFilter/InputFilter.styles.js +14 -1
- package/dist/components/Label/Label.styles.js +1 -1
- package/dist/components/Menu/Menu.js +2 -2
- package/dist/components/NumberInput/NumberInput.stories.js +1 -1
- package/dist/components/OtpInput/OtpInput.js +118 -0
- package/dist/components/OtpInput/OtpInput.stories.js +60 -0
- package/dist/components/OtpInput/OtpInputGroup.js +23 -0
- package/dist/components/OtpInput/index.js +3 -0
- package/dist/components/PasswordInput/PasswordInput.stories.js +1 -1
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.stories.js +2 -2
- package/dist/components/Search/Search.js +13 -1
- package/dist/components/Search/Search.stories.js +1 -1
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider.stories.js +5 -5
- package/dist/components/Switch/Switch.stories.js +2 -2
- package/dist/components/Table/Table.js +5 -5
- package/dist/components/Tabs/Tabs.js +12 -9
- package/dist/components/Tabs/Tabs.stories.js +1 -1
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/Text/Text.stories.js +1 -1
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextArea/TextArea.styles.js +3 -3
- package/dist/components/TextInput/TextInput.js +3 -2
- package/dist/components/TextInput/TextInput.stories.js +3 -3
- package/dist/components/TextInput/TextInput.styles.js +41 -19
- package/dist/components/Toast/Toast.js +4 -2
- package/dist/components/Toast/Toast.stories.js +1 -1
- package/dist/components/Toast/Toast.styles.js +4 -4
- package/dist/components/Toast/Toaster.js +2 -2
- package/dist/components/Tree/Tree.stories.js +1 -1
- package/dist/components/Tree/TreeItem.js +1 -1
- package/dist/esm/bundle.css +273 -126
- package/dist/esm/bundle.js +1545 -1545
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/AlertDialog/AlertDialog.stories.d.ts +3 -0
- package/dist/esm/types/components/Dialog/Dialog.d.ts +7 -1
- package/dist/esm/types/components/Dialog/Dialog.stories.d.ts +3 -0
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +2 -0
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +2 -0
- package/dist/esm/types/components/Form/Field.d.ts +26 -0
- package/dist/esm/types/components/Form/FieldMessage.d.ts +7 -0
- package/dist/esm/types/components/Form/Form.d.ts +49 -11
- package/dist/esm/types/components/Form/Form.stories.d.ts +23 -0
- package/dist/esm/types/components/Form/ValidationHintList.d.ts +20 -0
- package/dist/esm/types/components/Form/ValidationHintList.stories.d.ts +9 -0
- package/dist/esm/types/components/Form/index.d.ts +10 -0
- package/dist/esm/types/components/Form/useOptionBridge.d.ts +17 -0
- package/dist/esm/types/components/OtpInput/OtpInput.d.ts +17 -0
- package/dist/esm/types/components/OtpInput/OtpInput.stories.d.ts +15 -0
- package/dist/esm/types/components/OtpInput/OtpInputGroup.d.ts +25 -0
- package/dist/esm/types/components/OtpInput/index.d.ts +5 -0
- package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +3 -0
- package/dist/esm/types/index.d.ts +5 -0
- package/dist/esm/types/theme/ThemeColorCoverageRuntime.stories.d.ts +10 -0
- package/dist/esm/types/utils/colors.d.ts +84 -0
- package/dist/index.d.ts +248 -2
- package/dist/index.js +3 -0
- package/dist/src/theme/global.css +340 -151
- package/dist/theme/ThemeColorCoverageRuntime.stories.js +91 -0
- package/dist/utils/colors.js +92 -0
- package/package.json +4 -2
- package/src/components/ActionButton/ActionButton.stories.tsx +6 -6
- package/src/components/ActionButton/ActionButton.styles.ts +1 -1
- package/src/components/AlertDialog/AlertDialog.stories.tsx +22 -0
- package/src/components/AlertDialog/AlertDialog.tsx +6 -6
- package/src/components/Avatar/Avatar.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.styles.ts +1 -1
- package/src/components/Avatar/AvatarBase.tsx +1 -1
- package/src/components/Avatar/AvatarGroup.stories.tsx +1 -1
- package/src/components/Button/Buttons.stories.tsx +10 -10
- package/src/components/Calendar/Calendar.tsx +3 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +35 -12
- package/src/components/Checkbox/Checkbox.tsx +7 -5
- package/src/components/Collapsible/Collapsible.styles.ts +1 -1
- package/src/components/DataTable/DataTable.tsx +2 -2
- package/src/components/Dialog/Dialog.stories.tsx +173 -0
- package/src/components/Dialog/Dialog.tsx +32 -15
- package/src/components/Dropdown/Dropdown.styles.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +16 -14
- package/src/components/DropdownMenu/DropdownMenu.tsx +3 -3
- package/src/components/FocusedScrollView/FocusedScrollView.stories.tsx +10 -10
- package/src/components/Form/Field.tsx +160 -0
- package/src/components/Form/FieldMessage.tsx +38 -0
- package/src/components/Form/Form.docs.mdx +67 -0
- package/src/components/Form/Form.stories.tsx +490 -0
- package/src/components/Form/Form.tsx +185 -87
- package/src/components/Form/README.md +284 -0
- package/src/components/Form/ValidationHintList.stories.tsx +118 -0
- package/src/components/Form/ValidationHintList.tsx +95 -0
- package/src/components/Form/index.ts +28 -0
- package/src/components/Form/useOptionBridge.ts +55 -0
- package/src/components/InputFilter/InputFilter.stories.tsx +1 -1
- package/src/components/InputFilter/InputFilter.styles.ts +14 -1
- package/src/components/InputFilter/InputFilter.tsx +33 -28
- package/src/components/Label/Label.styles.ts +2 -2
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/Menu/Menu.tsx +12 -12
- package/src/components/NumberInput/NumberInput.stories.tsx +1 -1
- package/src/components/OtpInput/OtpInput.stories.tsx +168 -0
- package/src/components/OtpInput/OtpInput.tsx +223 -0
- package/src/components/OtpInput/OtpInputGroup.tsx +74 -0
- package/src/components/OtpInput/index.ts +5 -0
- package/src/components/PasswordInput/PasswordInput.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.stories.tsx +4 -4
- package/src/components/RadioGroup/RadioGroup.tsx +2 -1
- package/src/components/Search/Search.stories.tsx +1 -1
- package/src/components/Search/Search.tsx +6 -2
- package/src/components/Slider/Slider.stories.tsx +7 -7
- package/src/components/Slider/Slider.tsx +1 -1
- package/src/components/Switch/Switch.stories.tsx +4 -4
- package/src/components/Table/Table.tsx +5 -5
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +29 -18
- package/src/components/Text/Text.stories.tsx +1 -1
- package/src/components/Text/Text.tsx +1 -1
- package/src/components/TextArea/TextArea.stories.tsx +1 -1
- package/src/components/TextArea/TextArea.styles.ts +3 -3
- package/src/components/TextInput/TextInput.stories.tsx +7 -7
- package/src/components/TextInput/TextInput.styles.ts +42 -19
- package/src/components/TextInput/TextInput.tsx +3 -1
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.styles.tsx +7 -7
- package/src/components/Toast/Toast.tsx +5 -4
- package/src/components/Toast/Toaster.tsx +17 -20
- package/src/components/Tree/Tree.stories.tsx +1 -1
- package/src/components/Tree/TreeItem.tsx +1 -1
- package/src/index.ts +5 -0
- package/src/theme/ThemeColorCoverageRuntime.stories.tsx +236 -0
- package/src/theme/direct-token-migration-plan.md +121 -0
- package/src/theme/figma-mcp-check-report.md +225 -0
- package/src/theme/figma-mcp-component-checklist.json +1250 -0
- package/src/theme/presets/colors.js +155 -44
- package/src/theme/themes/xspector/components/loading.css +2 -2
- package/src/theme/tokens/color.css +3 -3
- package/src/theme/tokens/components/action-button.css +1 -1
- package/src/theme/tokens/components/dropdown-menu.css +3 -3
- package/src/theme/tokens/components/loading.css +2 -2
- package/src/theme/tokens/components/switch.css +1 -1
- package/src/theme/utils.js +164 -25
- package/src/utils/colors.ts +92 -0
|
@@ -127,7 +127,7 @@ export function DataTable<TData, TValue>({
|
|
|
127
127
|
desc: <ArrowDownIcon className="ml-3 h-4 w-4" />,
|
|
128
128
|
}[header.column.getIsSorted() as string] ??
|
|
129
129
|
(header.column.getCanSort() ? (
|
|
130
|
-
<ArrowsUpDownIcon className="ml-3 h-4 w-4 text-text-
|
|
130
|
+
<ArrowsUpDownIcon className="ml-3 h-4 w-4 text-text-g-contrast-high" />
|
|
131
131
|
) : null)}
|
|
132
132
|
</div>
|
|
133
133
|
</TableHead>
|
|
@@ -155,7 +155,7 @@ export function DataTable<TData, TValue>({
|
|
|
155
155
|
<TableRow className="h-full self-stretch">
|
|
156
156
|
<TableCell
|
|
157
157
|
colSpan={columns.length}
|
|
158
|
-
className="typography-body1 text-text-
|
|
158
|
+
className="typography-body1 text-text-g-contrast-medium text-center h-full"
|
|
159
159
|
>
|
|
160
160
|
<div className="flex flex-1 h-full flex-col items-center justify-center gap-3">
|
|
161
161
|
<ClipboardDocumentListIcon className="w-8 text-secondary-120" />
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import * as yup from "yup";
|
|
3
4
|
import {
|
|
4
5
|
Dialog,
|
|
5
6
|
DialogContent,
|
|
6
7
|
DialogDescription,
|
|
8
|
+
DialogBody,
|
|
7
9
|
DialogFooter,
|
|
8
10
|
DialogHeader,
|
|
9
11
|
DialogTitle,
|
|
@@ -12,6 +14,8 @@ import {
|
|
|
12
14
|
import Button from "../Button/Button";
|
|
13
15
|
import { Label } from "../Label/Label";
|
|
14
16
|
import { Input } from "../Input/Input";
|
|
17
|
+
import { Field, Form, ValidationHintList, ValidationHintRule } from "../Form";
|
|
18
|
+
import PasswordInput from "../PasswordInput";
|
|
15
19
|
|
|
16
20
|
const meta = {
|
|
17
21
|
title: "Components/Dialog",
|
|
@@ -116,3 +120,172 @@ export const Demo = {
|
|
|
116
120
|
);
|
|
117
121
|
},
|
|
118
122
|
} satisfies StoryObj;
|
|
123
|
+
|
|
124
|
+
const passwordHints = [
|
|
125
|
+
{
|
|
126
|
+
id: "min-length",
|
|
127
|
+
label: "Minimum 12 characters",
|
|
128
|
+
validate: (values: ChangePasswordFormValues) =>
|
|
129
|
+
values.newPassword.length >= 12,
|
|
130
|
+
when: (values: ChangePasswordFormValues) => Boolean(values.newPassword),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "lower-and-upper",
|
|
134
|
+
label: "At least a lower and upper case",
|
|
135
|
+
validate: (values: ChangePasswordFormValues) =>
|
|
136
|
+
/[a-z]/.test(values.newPassword) && /[A-Z]/.test(values.newPassword),
|
|
137
|
+
when: (values: ChangePasswordFormValues) => Boolean(values.newPassword),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "special",
|
|
141
|
+
label: "At least 1 special character",
|
|
142
|
+
validate: (values: ChangePasswordFormValues) =>
|
|
143
|
+
/[^A-Za-z0-9]/.test(values.newPassword),
|
|
144
|
+
when: (values: ChangePasswordFormValues) => Boolean(values.newPassword),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "numeral",
|
|
148
|
+
label: "At least 1 numeral",
|
|
149
|
+
validate: (values: ChangePasswordFormValues) =>
|
|
150
|
+
/\d/.test(values.newPassword),
|
|
151
|
+
when: (values: ChangePasswordFormValues) => Boolean(values.newPassword),
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "capital",
|
|
155
|
+
label: "At least 1 capital letter",
|
|
156
|
+
validate: (values: ChangePasswordFormValues) =>
|
|
157
|
+
/[A-Z]/.test(values.newPassword),
|
|
158
|
+
when: (values: ChangePasswordFormValues) => Boolean(values.newPassword),
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: "match",
|
|
162
|
+
label: "Password and confirmation are matching",
|
|
163
|
+
validate: (values: ChangePasswordFormValues) =>
|
|
164
|
+
Boolean(values.newPassword) &&
|
|
165
|
+
values.newPassword === values.confirmPassword,
|
|
166
|
+
when: (values: ChangePasswordFormValues) =>
|
|
167
|
+
Boolean(values.newPassword) && Boolean(values.confirmPassword),
|
|
168
|
+
},
|
|
169
|
+
] satisfies ValidationHintRule<ChangePasswordFormValues>[];
|
|
170
|
+
|
|
171
|
+
type ChangePasswordFormValues = {
|
|
172
|
+
newPassword: string;
|
|
173
|
+
confirmPassword: string;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const changePasswordSchema = yup.object({
|
|
177
|
+
newPassword: yup
|
|
178
|
+
.string()
|
|
179
|
+
.required("New password is required")
|
|
180
|
+
.min(12, "Password must be at least 12 characters")
|
|
181
|
+
.matches(/[a-z]/, "Password must include a lowercase letter")
|
|
182
|
+
.matches(/[A-Z]/, "Password must include an uppercase letter")
|
|
183
|
+
.matches(/\d/, "Password must include a numeral")
|
|
184
|
+
.matches(/[^A-Za-z0-9]/, "Password must include a special character"),
|
|
185
|
+
confirmPassword: yup
|
|
186
|
+
.string()
|
|
187
|
+
.required("Please confirm your password")
|
|
188
|
+
.oneOf([yup.ref("newPassword")], "Passwords must match"),
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
export const FigmaChangePassword = {
|
|
192
|
+
render: () => {
|
|
193
|
+
return (
|
|
194
|
+
<div className="flex w-full">
|
|
195
|
+
<Dialog defaultOpen>
|
|
196
|
+
<DialogContent className="min-h-[686px] max-w-[650px]">
|
|
197
|
+
<Form<ChangePasswordFormValues>
|
|
198
|
+
className="contents"
|
|
199
|
+
defaultValues={{
|
|
200
|
+
newPassword: "",
|
|
201
|
+
confirmPassword: "",
|
|
202
|
+
}}
|
|
203
|
+
mode="onTouched"
|
|
204
|
+
validationSchema={changePasswordSchema}
|
|
205
|
+
onSubmit={(values) => {
|
|
206
|
+
// eslint-disable-next-line no-console
|
|
207
|
+
console.log("Change password submit:", values);
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
{({ formState, watch }) => {
|
|
211
|
+
const newPassword = watch("newPassword");
|
|
212
|
+
const confirmPassword = watch("confirmPassword");
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<>
|
|
216
|
+
<DialogHeader>
|
|
217
|
+
<DialogTitle>Welcome!</DialogTitle>
|
|
218
|
+
<DialogDescription>
|
|
219
|
+
Please create a new password to replace the temporary
|
|
220
|
+
password.
|
|
221
|
+
</DialogDescription>
|
|
222
|
+
</DialogHeader>
|
|
223
|
+
|
|
224
|
+
<DialogBody>
|
|
225
|
+
<div className="flex flex-col gap-4">
|
|
226
|
+
<Field<ChangePasswordFormValues, "newPassword">
|
|
227
|
+
name="newPassword"
|
|
228
|
+
component={PasswordInput}
|
|
229
|
+
componentProps={{
|
|
230
|
+
id: "new-password",
|
|
231
|
+
label: "New password",
|
|
232
|
+
type: "password",
|
|
233
|
+
required: true,
|
|
234
|
+
fullwidth: true,
|
|
235
|
+
size: "lg",
|
|
236
|
+
}}
|
|
237
|
+
/>
|
|
238
|
+
<Field<ChangePasswordFormValues, "confirmPassword">
|
|
239
|
+
name="confirmPassword"
|
|
240
|
+
component={PasswordInput}
|
|
241
|
+
componentProps={{
|
|
242
|
+
id: "confirm-password",
|
|
243
|
+
label: "Confirm password",
|
|
244
|
+
type: "password",
|
|
245
|
+
required: true,
|
|
246
|
+
fullwidth: true,
|
|
247
|
+
size: "lg",
|
|
248
|
+
}}
|
|
249
|
+
/>
|
|
250
|
+
|
|
251
|
+
<ValidationHintList<ChangePasswordFormValues>
|
|
252
|
+
values={{
|
|
253
|
+
newPassword: newPassword || "",
|
|
254
|
+
confirmPassword: confirmPassword || "",
|
|
255
|
+
}}
|
|
256
|
+
rules={passwordHints}
|
|
257
|
+
/>
|
|
258
|
+
</div>
|
|
259
|
+
</DialogBody>
|
|
260
|
+
|
|
261
|
+
<DialogFooter>
|
|
262
|
+
<Button
|
|
263
|
+
type="button"
|
|
264
|
+
variant="outline"
|
|
265
|
+
color="primary"
|
|
266
|
+
size="lg"
|
|
267
|
+
fullwidth={false}
|
|
268
|
+
>
|
|
269
|
+
Back
|
|
270
|
+
</Button>
|
|
271
|
+
<Button
|
|
272
|
+
type="submit"
|
|
273
|
+
size="lg"
|
|
274
|
+
fullwidth={false}
|
|
275
|
+
className="w-[180px]"
|
|
276
|
+
disabled={!formState.isValid || formState.isSubmitting}
|
|
277
|
+
isLoading={formState.isSubmitting}
|
|
278
|
+
>
|
|
279
|
+
Save changes
|
|
280
|
+
</Button>
|
|
281
|
+
</DialogFooter>
|
|
282
|
+
</>
|
|
283
|
+
);
|
|
284
|
+
}}
|
|
285
|
+
</Form>
|
|
286
|
+
</DialogContent>
|
|
287
|
+
</Dialog>
|
|
288
|
+
</div>
|
|
289
|
+
);
|
|
290
|
+
},
|
|
291
|
+
} satisfies StoryObj;
|
|
@@ -21,8 +21,8 @@ const DialogOverlay = React.forwardRef<
|
|
|
21
21
|
<DialogPrimitive.Overlay
|
|
22
22
|
ref={ref}
|
|
23
23
|
className={cn(
|
|
24
|
-
"fixed inset-0 z-50 bg-
|
|
25
|
-
className
|
|
24
|
+
"fixed inset-0 z-50 bg-modal-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
25
|
+
className,
|
|
26
26
|
)}
|
|
27
27
|
{...props}
|
|
28
28
|
/>
|
|
@@ -44,15 +44,15 @@ const DialogContent = React.forwardRef<
|
|
|
44
44
|
closeButtonClassName,
|
|
45
45
|
...props
|
|
46
46
|
},
|
|
47
|
-
ref
|
|
47
|
+
ref,
|
|
48
48
|
) => (
|
|
49
49
|
<DialogPortal>
|
|
50
50
|
<DialogOverlay />
|
|
51
51
|
<DialogPrimitive.Content
|
|
52
52
|
ref={ref}
|
|
53
53
|
className={cn(
|
|
54
|
-
"fixed
|
|
55
|
-
className
|
|
54
|
+
"fixed left-[50%] top-[50%] z-50 flex w-[calc(100%-32px)] max-w-[650px] translate-x-[-50%] translate-y-[-50%] flex-col rounded-md bg-modal-surface p-8 text-text-g-contrast-medium shadow-[0px_12px_24px_-4px_rgba(0,0,0,0.12)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
|
|
55
|
+
className,
|
|
56
56
|
)}
|
|
57
57
|
{...props}
|
|
58
58
|
>
|
|
@@ -60,8 +60,8 @@ const DialogContent = React.forwardRef<
|
|
|
60
60
|
{showCloseButton && (
|
|
61
61
|
<DialogPrimitive.Close
|
|
62
62
|
className={cn(
|
|
63
|
-
"absolute right-
|
|
64
|
-
closeButtonClassName
|
|
63
|
+
"absolute right-8 top-8 rounded-sm opacity-70 ring-offset-bg-bg1 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-input-active-stroke focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-primary data-[state=open]:text-state-primary-text-solid",
|
|
64
|
+
closeButtonClassName,
|
|
65
65
|
)}
|
|
66
66
|
>
|
|
67
67
|
<XMarkIcon className="h-4 w-4" />
|
|
@@ -70,7 +70,7 @@ const DialogContent = React.forwardRef<
|
|
|
70
70
|
)}
|
|
71
71
|
</DialogPrimitive.Content>
|
|
72
72
|
</DialogPortal>
|
|
73
|
-
)
|
|
73
|
+
),
|
|
74
74
|
);
|
|
75
75
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
76
76
|
|
|
@@ -78,15 +78,25 @@ const DialogHeader = ({
|
|
|
78
78
|
className,
|
|
79
79
|
...props
|
|
80
80
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
81
|
+
<div className={cn("flex flex-col gap-2 text-left", className)} {...props} />
|
|
82
|
+
);
|
|
83
|
+
DialogHeader.displayName = "DialogHeader";
|
|
84
|
+
|
|
85
|
+
const DialogBody = ({
|
|
86
|
+
className,
|
|
87
|
+
scrollable = false,
|
|
88
|
+
...props
|
|
89
|
+
}: React.HTMLAttributes<HTMLDivElement> & { scrollable?: boolean }) => (
|
|
81
90
|
<div
|
|
82
91
|
className={cn(
|
|
83
|
-
"flex flex-
|
|
84
|
-
|
|
92
|
+
"flex flex-1 min-h-0 flex-col mt-8",
|
|
93
|
+
scrollable && "overflow-y-auto",
|
|
94
|
+
className,
|
|
85
95
|
)}
|
|
86
96
|
{...props}
|
|
87
97
|
/>
|
|
88
98
|
);
|
|
89
|
-
|
|
99
|
+
DialogBody.displayName = "DialogBody";
|
|
90
100
|
|
|
91
101
|
const DialogFooter = ({
|
|
92
102
|
className,
|
|
@@ -94,8 +104,8 @@ const DialogFooter = ({
|
|
|
94
104
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
95
105
|
<div
|
|
96
106
|
className={cn(
|
|
97
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:
|
|
98
|
-
className
|
|
107
|
+
"flex flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-end sm:gap-6",
|
|
108
|
+
className,
|
|
99
109
|
)}
|
|
100
110
|
{...props}
|
|
101
111
|
/>
|
|
@@ -108,7 +118,10 @@ const DialogTitle = React.forwardRef<
|
|
|
108
118
|
>(({ className, ...props }, ref) => (
|
|
109
119
|
<DialogPrimitive.Title
|
|
110
120
|
ref={ref}
|
|
111
|
-
className={cn(
|
|
121
|
+
className={cn(
|
|
122
|
+
"typography-h4 tracking-tight text-text-contrast-max",
|
|
123
|
+
className,
|
|
124
|
+
)}
|
|
112
125
|
{...props}
|
|
113
126
|
/>
|
|
114
127
|
));
|
|
@@ -120,7 +133,10 @@ const DialogDescription = React.forwardRef<
|
|
|
120
133
|
>(({ className, ...props }, ref) => (
|
|
121
134
|
<DialogPrimitive.Description
|
|
122
135
|
ref={ref}
|
|
123
|
-
className={cn(
|
|
136
|
+
className={cn(
|
|
137
|
+
"typography-subtitle1 text-text-g-contrast-medium",
|
|
138
|
+
className,
|
|
139
|
+
)}
|
|
124
140
|
{...props}
|
|
125
141
|
/>
|
|
126
142
|
));
|
|
@@ -134,6 +150,7 @@ export {
|
|
|
134
150
|
DialogTrigger,
|
|
135
151
|
DialogContent,
|
|
136
152
|
DialogHeader,
|
|
153
|
+
DialogBody,
|
|
137
154
|
DialogFooter,
|
|
138
155
|
DialogTitle,
|
|
139
156
|
DialogDescription,
|
|
@@ -50,6 +50,7 @@ export type DropdownProps = {
|
|
|
50
50
|
optionContainerClassName?: string;
|
|
51
51
|
optionItemClassName?: string;
|
|
52
52
|
optionNotFoundItemClassName?: string;
|
|
53
|
+
segmentedInput?: boolean;
|
|
53
54
|
options: Options[];
|
|
54
55
|
value?: Options;
|
|
55
56
|
onChangeText?: InputProps["onChange"];
|
|
@@ -88,9 +89,10 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
88
89
|
optionContainerClassName,
|
|
89
90
|
optionItemClassName,
|
|
90
91
|
optionNotFoundItemClassName,
|
|
92
|
+
segmentedInput = true,
|
|
91
93
|
...props
|
|
92
94
|
},
|
|
93
|
-
ref
|
|
95
|
+
ref,
|
|
94
96
|
) => {
|
|
95
97
|
const _id = id || `${label}-select`;
|
|
96
98
|
|
|
@@ -136,7 +138,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
136
138
|
clearMismatchValue(event as any);
|
|
137
139
|
}
|
|
138
140
|
},
|
|
139
|
-
[onChangeText]
|
|
141
|
+
[onChangeText],
|
|
140
142
|
);
|
|
141
143
|
|
|
142
144
|
const handleOptionClick = useCallback(
|
|
@@ -146,14 +148,14 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
146
148
|
onSelect?.(option);
|
|
147
149
|
setIsFocused(false);
|
|
148
150
|
},
|
|
149
|
-
[onSelect]
|
|
151
|
+
[onSelect],
|
|
150
152
|
);
|
|
151
153
|
|
|
152
154
|
const optionsFiltered = useMemo(() => {
|
|
153
155
|
return options.filter(
|
|
154
156
|
(option) =>
|
|
155
157
|
!filterMode ||
|
|
156
|
-
option.label?.toLowerCase().includes(textValue?.toLowerCase())
|
|
158
|
+
option.label?.toLowerCase().includes(textValue?.toLowerCase()),
|
|
157
159
|
);
|
|
158
160
|
}, [options, filterMode, textValue]);
|
|
159
161
|
|
|
@@ -236,7 +238,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
236
238
|
"bg-[var(--dropdown-menu-selected-bg)] text-[var(--dropdown-menu-selected-text)] typography-subtitle5":
|
|
237
239
|
selectedOption?.value === option.value,
|
|
238
240
|
},
|
|
239
|
-
optionItemClassName
|
|
241
|
+
optionItemClassName,
|
|
240
242
|
),
|
|
241
243
|
})}
|
|
242
244
|
</Fragment>
|
|
@@ -263,7 +265,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
263
265
|
key="not-found"
|
|
264
266
|
className={cn(
|
|
265
267
|
"px-4 py-14 text-center text-input-text",
|
|
266
|
-
optionNotFoundItemClassName
|
|
268
|
+
optionNotFoundItemClassName,
|
|
267
269
|
)}
|
|
268
270
|
>
|
|
269
271
|
Not found
|
|
@@ -286,7 +288,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
286
288
|
className={cn(
|
|
287
289
|
"absolute mt-1 w-full max-h-60 overflow-y-auto",
|
|
288
290
|
!usePortal && (isAbove ? "bottom-full mb-1" : "top-full mt-1"),
|
|
289
|
-
optionContainerClassName
|
|
291
|
+
optionContainerClassName,
|
|
290
292
|
)}
|
|
291
293
|
style={dropdownStyles}
|
|
292
294
|
/>
|
|
@@ -298,14 +300,14 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
298
300
|
setIsFocused(true);
|
|
299
301
|
props?.onFocus?.(e);
|
|
300
302
|
},
|
|
301
|
-
[props?.onFocus]
|
|
303
|
+
[props?.onFocus],
|
|
302
304
|
);
|
|
303
305
|
|
|
304
306
|
const clearMismatchValue = useCallback(
|
|
305
307
|
(e: React.FocusEvent<HTMLInputElement, Element>) => {
|
|
306
308
|
const matchSelectedValue = optionsFiltered.find(
|
|
307
309
|
(opt) =>
|
|
308
|
-
opt.value === e.target?.value || opt.label === e.target?.value
|
|
310
|
+
opt.value === e.target?.value || opt.label === e.target?.value,
|
|
309
311
|
);
|
|
310
312
|
const isMatchSelectedValue = !!matchSelectedValue;
|
|
311
313
|
|
|
@@ -329,7 +331,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
329
331
|
setTextValue(option.label);
|
|
330
332
|
onSelect?.(option);
|
|
331
333
|
},
|
|
332
|
-
[optionsFiltered, textValue]
|
|
334
|
+
[optionsFiltered, textValue],
|
|
333
335
|
);
|
|
334
336
|
|
|
335
337
|
const handleOnBlur = useCallback(
|
|
@@ -338,7 +340,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
338
340
|
clearMismatchValue(e);
|
|
339
341
|
props?.onBlur?.(e);
|
|
340
342
|
},
|
|
341
|
-
[props?.onBlur, clearMismatchValue]
|
|
343
|
+
[props?.onBlur, clearMismatchValue],
|
|
342
344
|
);
|
|
343
345
|
|
|
344
346
|
const handleOnKeyDown = useCallback(
|
|
@@ -346,7 +348,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
346
348
|
keyCode.current = e.code;
|
|
347
349
|
props?.onKeyDown?.(e);
|
|
348
350
|
},
|
|
349
|
-
[props?.onKeyDown]
|
|
351
|
+
[props?.onKeyDown],
|
|
350
352
|
);
|
|
351
353
|
|
|
352
354
|
return (
|
|
@@ -377,7 +379,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
377
379
|
id={_id}
|
|
378
380
|
disabled={disabled}
|
|
379
381
|
size={size}
|
|
380
|
-
className={customInputVariant({ size })}
|
|
382
|
+
className={segmentedInput ? customInputVariant({ size }) : undefined}
|
|
381
383
|
onFocus={handleOnFocus}
|
|
382
384
|
onBlur={handleOnBlur}
|
|
383
385
|
onKeyDown={handleOnKeyDown}
|
|
@@ -392,7 +394,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
392
394
|
))}
|
|
393
395
|
</div>
|
|
394
396
|
);
|
|
395
|
-
}
|
|
397
|
+
},
|
|
396
398
|
);
|
|
397
399
|
|
|
398
400
|
export default Dropdown;
|
|
@@ -52,7 +52,7 @@ const DropdownMenuSubContent = React.forwardRef<
|
|
|
52
52
|
<DropdownMenuPrimitive.SubContent
|
|
53
53
|
ref={ref}
|
|
54
54
|
className={cn(
|
|
55
|
-
"z-50 min-w-[154px] overflow-hidden rounded-md bg-
|
|
55
|
+
"z-50 min-w-[154px] overflow-hidden rounded-md bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
56
56
|
className
|
|
57
57
|
)}
|
|
58
58
|
{...props}
|
|
@@ -74,7 +74,7 @@ const DropdownMenuContent = React.forwardRef<
|
|
|
74
74
|
ref={ref}
|
|
75
75
|
sideOffset={sideOffset}
|
|
76
76
|
className={cn(
|
|
77
|
-
"z-50 min-w-[154px] overflow-hidden rounded-md bg-
|
|
77
|
+
"z-50 min-w-[154px] overflow-hidden rounded-md bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
78
78
|
className
|
|
79
79
|
)}
|
|
80
80
|
{...props}
|
|
@@ -174,7 +174,7 @@ const DropdownMenuLabel = React.forwardRef<
|
|
|
174
174
|
<DropdownMenuPrimitive.Label
|
|
175
175
|
ref={ref}
|
|
176
176
|
className={cn(
|
|
177
|
-
"px-3 py-2 typography-small4 text-text-
|
|
177
|
+
"px-3 py-2 typography-small4 text-text-g-contrast-medium",
|
|
178
178
|
inset && "pl-8",
|
|
179
179
|
className
|
|
180
180
|
)}
|
|
@@ -27,19 +27,19 @@ export const VerticalScroll: Story = {
|
|
|
27
27
|
<div className="flex gap-2">
|
|
28
28
|
<button
|
|
29
29
|
onClick={() => setSelected("item-5")}
|
|
30
|
-
className="px-3 py-1 bg-primary text-
|
|
30
|
+
className="px-3 py-1 bg-primary text-state-primary-text-solid rounded"
|
|
31
31
|
>
|
|
32
32
|
Scroll to Item 5
|
|
33
33
|
</button>
|
|
34
34
|
<button
|
|
35
35
|
onClick={() => setSelected("item-20")}
|
|
36
|
-
className="px-3 py-1 bg-primary text-
|
|
36
|
+
className="px-3 py-1 bg-primary text-state-primary-text-solid rounded"
|
|
37
37
|
>
|
|
38
38
|
Scroll to Item 20
|
|
39
39
|
</button>
|
|
40
40
|
<button
|
|
41
41
|
onClick={() => setSelected("item-29")}
|
|
42
|
-
className="px-3 py-1 bg-primary text-
|
|
42
|
+
className="px-3 py-1 bg-primary text-state-primary-text-solid rounded"
|
|
43
43
|
>
|
|
44
44
|
Scroll to Item 30
|
|
45
45
|
</button>
|
|
@@ -51,8 +51,8 @@ export const VerticalScroll: Story = {
|
|
|
51
51
|
key={`item-${index + 1}`}
|
|
52
52
|
className={`px-4 py-2 ${
|
|
53
53
|
selected === `item-${index + 1}`
|
|
54
|
-
? "bg-secondary text-secondary-
|
|
55
|
-
: "bg-
|
|
54
|
+
? "bg-secondary text-state-secondary-text-solid"
|
|
55
|
+
: "bg-bg-bg1"
|
|
56
56
|
}`}
|
|
57
57
|
>
|
|
58
58
|
{item}
|
|
@@ -76,19 +76,19 @@ export const HorizontalScroll: Story = {
|
|
|
76
76
|
<div className="flex gap-2">
|
|
77
77
|
<button
|
|
78
78
|
onClick={() => setSelected("item-5")}
|
|
79
|
-
className="px-3 py-1 bg-primary text-
|
|
79
|
+
className="px-3 py-1 bg-primary text-state-primary-text-solid rounded"
|
|
80
80
|
>
|
|
81
81
|
Scroll to Item 5
|
|
82
82
|
</button>
|
|
83
83
|
<button
|
|
84
84
|
onClick={() => setSelected("item-15")}
|
|
85
|
-
className="px-3 py-1 bg-primary text-
|
|
85
|
+
className="px-3 py-1 bg-primary text-state-primary-text-solid rounded"
|
|
86
86
|
>
|
|
87
87
|
Scroll to Item 15
|
|
88
88
|
</button>
|
|
89
89
|
<button
|
|
90
90
|
onClick={() => setSelected("item-25")}
|
|
91
|
-
className="px-3 py-1 bg-primary text-
|
|
91
|
+
className="px-3 py-1 bg-primary text-state-primary-text-solid rounded"
|
|
92
92
|
>
|
|
93
93
|
Scroll to Item 25
|
|
94
94
|
</button>
|
|
@@ -100,8 +100,8 @@ export const HorizontalScroll: Story = {
|
|
|
100
100
|
key={`item-${index + 1}`}
|
|
101
101
|
className={`inline-block w-28 h-12 mx-2 text-center leading-[3rem] rounded ${
|
|
102
102
|
selected === `item-${index + 1}`
|
|
103
|
-
? "bg-secondary text-secondary-
|
|
104
|
-
: "bg-
|
|
103
|
+
? "bg-secondary text-state-secondary-text-solid"
|
|
104
|
+
: "bg-transparent-grey2-16"
|
|
105
105
|
}`}
|
|
106
106
|
>
|
|
107
107
|
{item}
|