@drivenets/design-system 0.0.1
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/CHANGELOG.md +9 -0
- package/LICENSE +201 -0
- package/dist/index.cjs +5394 -0
- package/dist/index.css +1 -0
- package/dist/index.d.cts +9157 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +9157 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5335 -0
- package/dist/index.js.map +1 -0
- package/package.json +104 -0
- package/src/components/ds-alert-banner/ds-alert-banner.module.scss +116 -0
- package/src/components/ds-alert-banner/ds-alert-banner.tsx +115 -0
- package/src/components/ds-alert-banner/ds-alert-banner.types.tsx +47 -0
- package/src/components/ds-alert-banner/index.tsx +2 -0
- package/src/components/ds-breadcrumb/ds-breadcrumb.module.scss +99 -0
- package/src/components/ds-breadcrumb/ds-breadcrumb.tsx +94 -0
- package/src/components/ds-breadcrumb/ds-breadcrumb.types.tsx +32 -0
- package/src/components/ds-breadcrumb/index.tsx +2 -0
- package/src/components/ds-button/ds-button.tsx +12 -0
- package/src/components/ds-button/ds-button.types.ts +6 -0
- package/src/components/ds-button/index.ts +2 -0
- package/src/components/ds-button/versions/ds-button-legacy/ds-button-legacy.module.scss +257 -0
- package/src/components/ds-button/versions/ds-button-legacy/ds-button-legacy.tsx +34 -0
- package/src/components/ds-button/versions/ds-button-legacy/ds-button-legacy.types.ts +41 -0
- package/src/components/ds-button/versions/ds-button-legacy/index.ts +2 -0
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.module.scss +580 -0
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.tsx +49 -0
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.types.ts +41 -0
- package/src/components/ds-button/versions/ds-button-new/index.ts +2 -0
- package/src/components/ds-checkbox/ds-checkbox.module.scss +130 -0
- package/src/components/ds-checkbox/ds-checkbox.tsx +55 -0
- package/src/components/ds-checkbox/ds-checkbox.types.tsx +27 -0
- package/src/components/ds-checkbox/index.tsx +2 -0
- package/src/components/ds-chip/ds-chip.module.scss +71 -0
- package/src/components/ds-chip/ds-chip.tsx +73 -0
- package/src/components/ds-chip/ds-chip.types.tsx +46 -0
- package/src/components/ds-chip/index.tsx +2 -0
- package/src/components/ds-chip-group/ds-chip-group.module.scss +59 -0
- package/src/components/ds-chip-group/ds-chip-group.tsx +122 -0
- package/src/components/ds-chip-group/ds-chip-group.types.ts +52 -0
- package/src/components/ds-chip-group/hooks/use-chip-row-calculation.ts +76 -0
- package/src/components/ds-chip-group/index.ts +2 -0
- package/src/components/ds-confirmation/ds-confirmation.module.scss +58 -0
- package/src/components/ds-confirmation/ds-confirmation.tsx +121 -0
- package/src/components/ds-confirmation/ds-confirmation.types.tsx +28 -0
- package/src/components/ds-confirmation/index.ts +2 -0
- package/src/components/ds-dialog/ds-dialog.module.scss +50 -0
- package/src/components/ds-dialog/ds-dialog.tsx +70 -0
- package/src/components/ds-dialog/ds-dialog.types.tsx +48 -0
- package/src/components/ds-dialog/index.tsx +2 -0
- package/src/components/ds-drawer/ds-drawer.module.scss +212 -0
- package/src/components/ds-drawer/ds-drawer.tsx +160 -0
- package/src/components/ds-drawer/ds-drawer.types.tsx +54 -0
- package/src/components/ds-drawer/index.ts +2 -0
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.module.scss +123 -0
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +396 -0
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.types.tsx +262 -0
- package/src/components/ds-dropdown-menu/index.tsx +2 -0
- package/src/components/ds-expandable-text-input/ds-expandable-text-input.module.scss +70 -0
- package/src/components/ds-expandable-text-input/ds-expandable-text-input.tsx +106 -0
- package/src/components/ds-expandable-text-input/ds-expandable-text-input.types.tsx +19 -0
- package/src/components/ds-expandable-text-input/index.ts +2 -0
- package/src/components/ds-file-upload/components/file-upload/file-upload.module.scss +90 -0
- package/src/components/ds-file-upload/components/file-upload/file-upload.tsx +106 -0
- package/src/components/ds-file-upload/components/file-upload/file-upload.types.tsx +94 -0
- package/src/components/ds-file-upload/components/file-upload/index.ts +2 -0
- package/src/components/ds-file-upload/components/file-upload-item/file-upload-item.module.scss +125 -0
- package/src/components/ds-file-upload/components/file-upload-item/file-upload-item.tsx +143 -0
- package/src/components/ds-file-upload/components/file-upload-item/file-upload-item.types.tsx +26 -0
- package/src/components/ds-file-upload/components/file-upload-item/index.ts +2 -0
- package/src/components/ds-file-upload/ds-file-upload-api.types.ts +38 -0
- package/src/components/ds-file-upload/ds-file-upload.tsx +46 -0
- package/src/components/ds-file-upload/ds-file-upload.types.tsx +54 -0
- package/src/components/ds-file-upload/errors/file-upload-errors.ts +27 -0
- package/src/components/ds-file-upload/hooks/index.ts +2 -0
- package/src/components/ds-file-upload/hooks/use-file-upload.ts +350 -0
- package/src/components/ds-file-upload/index.ts +7 -0
- package/src/components/ds-file-upload/types/accept-types.ts +106 -0
- package/src/components/ds-file-upload/utils/accept-utils.ts +25 -0
- package/src/components/ds-file-upload/utils/constants.ts +21 -0
- package/src/components/ds-file-upload/utils/file-factory.ts +18 -0
- package/src/components/ds-file-upload/utils/format-file-size.ts +15 -0
- package/src/components/ds-file-upload/utils/generate-helper-text.ts +39 -0
- package/src/components/ds-file-upload/utils/get-error-message.ts +17 -0
- package/src/components/ds-file-upload/utils/is-file-equal.ts +8 -0
- package/src/components/ds-form-control/ds-form-control.module.scss +135 -0
- package/src/components/ds-form-control/ds-form-control.tsx +94 -0
- package/src/components/ds-form-control/ds-form-control.types.tsx +58 -0
- package/src/components/ds-form-control/index.tsx +2 -0
- package/src/components/ds-grid/ds-grid.module.scss +0 -0
- package/src/components/ds-grid/ds-grid.tsx +43 -0
- package/src/components/ds-grid/ds-grid.types.ts +55 -0
- package/src/components/ds-grid/index.ts +2 -0
- package/src/components/ds-icon/ds-icon.module.scss +25 -0
- package/src/components/ds-icon/ds-icon.tsx +33 -0
- package/src/components/ds-icon/ds-icon.types.ts +53 -0
- package/src/components/ds-icon/index.ts +2 -0
- package/src/components/ds-icon/material-icons.ts +6203 -0
- package/src/components/ds-modal/ds-modal.module.scss +100 -0
- package/src/components/ds-modal/ds-modal.tsx +136 -0
- package/src/components/ds-modal/ds-modal.types.tsx +44 -0
- package/src/components/ds-modal/index.tsx +2 -0
- package/src/components/ds-number-input/ds-number-input.module.scss +15 -0
- package/src/components/ds-number-input/ds-number-input.tsx +74 -0
- package/src/components/ds-number-input/ds-number-input.types.tsx +76 -0
- package/src/components/ds-number-input/index.tsx +2 -0
- package/src/components/ds-panel/ds-panel.module.scss +95 -0
- package/src/components/ds-panel/ds-panel.tsx +46 -0
- package/src/components/ds-panel/ds-panel.types.ts +17 -0
- package/src/components/ds-panel/index.tsx +2 -0
- package/src/components/ds-password-input/ds-password-input.module.scss +10 -0
- package/src/components/ds-password-input/ds-password-input.tsx +67 -0
- package/src/components/ds-password-input/ds-password-input.types.tsx +62 -0
- package/src/components/ds-password-input/index.tsx +2 -0
- package/src/components/ds-popover/ds-popover.module.scss +23 -0
- package/src/components/ds-popover/ds-popover.tsx +33 -0
- package/src/components/ds-popover/ds-popover.types.tsx +24 -0
- package/src/components/ds-popover/index.tsx +2 -0
- package/src/components/ds-radio-group/ds-radio-group.module.scss +138 -0
- package/src/components/ds-radio-group/ds-radio-group.tsx +115 -0
- package/src/components/ds-radio-group/ds-radio-group.types.tsx +93 -0
- package/src/components/ds-radio-group/index.tsx +2 -0
- package/src/components/ds-select/ds-select.module.scss +66 -0
- package/src/components/ds-select/ds-select.tsx +239 -0
- package/src/components/ds-select/ds-select.types.tsx +80 -0
- package/src/components/ds-select/index.tsx +2 -0
- package/src/components/ds-select/select-items-chips.tsx +56 -0
- package/src/components/ds-smart-tabs/ds-smart-tabs.module.scss +69 -0
- package/src/components/ds-smart-tabs/ds-smart-tabs.tsx +113 -0
- package/src/components/ds-smart-tabs/ds-smart-tabs.types.tsx +74 -0
- package/src/components/ds-smart-tabs/index.tsx +2 -0
- package/src/components/ds-spinner/ds-spinner.module.scss +39 -0
- package/src/components/ds-spinner/ds-spinner.tsx +51 -0
- package/src/components/ds-spinner/ds-spinner.types.tsx +20 -0
- package/src/components/ds-spinner/index.tsx +2 -0
- package/src/components/ds-status-badge/ds-status-badge.module.scss +79 -0
- package/src/components/ds-status-badge/ds-status-badge.tsx +42 -0
- package/src/components/ds-status-badge/ds-status-badge.types.tsx +46 -0
- package/src/components/ds-status-badge/index.tsx +2 -0
- package/src/components/ds-stepper/components/ds-step-content.tsx +32 -0
- package/src/components/ds-stepper/components/ds-step-description.tsx +6 -0
- package/src/components/ds-stepper/components/ds-step-label.tsx +6 -0
- package/src/components/ds-stepper/components/ds-step-next-button.tsx +13 -0
- package/src/components/ds-stepper/components/ds-step.tsx +59 -0
- package/src/components/ds-stepper/ds-stepper.module.scss +134 -0
- package/src/components/ds-stepper/ds-stepper.tsx +34 -0
- package/src/components/ds-stepper/ds-stepper.types.ts +12 -0
- package/src/components/ds-stepper/hooks/use-stepper.ts +20 -0
- package/src/components/ds-stepper/hooks/use-steps.ts +18 -0
- package/src/components/ds-stepper/index.tsx +6 -0
- package/src/components/ds-system-status/ds-system-status.module.scss +87 -0
- package/src/components/ds-system-status/ds-system-status.tsx +33 -0
- package/src/components/ds-system-status/ds-system-status.types.tsx +37 -0
- package/src/components/ds-system-status/index.tsx +10 -0
- package/src/components/ds-table/components/core-table/core-table.module.scss +32 -0
- package/src/components/ds-table/components/core-table/core-table.tsx +83 -0
- package/src/components/ds-table/components/core-table/index.ts +1 -0
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +115 -0
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.tsx +70 -0
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.types.ts +41 -0
- package/src/components/ds-table/components/ds-table-bulk-actions/index.ts +2 -0
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.module.scss +53 -0
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.tsx +95 -0
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.types.ts +67 -0
- package/src/components/ds-table/components/ds-table-cell/index.ts +2 -0
- package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +81 -0
- package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +99 -0
- package/src/components/ds-table/components/ds-table-header/ds-table-header.types.ts +11 -0
- package/src/components/ds-table/components/ds-table-header/index.ts +2 -0
- package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +137 -0
- package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +205 -0
- package/src/components/ds-table/components/ds-table-row/ds-table-row.types.ts +22 -0
- package/src/components/ds-table/components/ds-table-row/index.ts +2 -0
- package/src/components/ds-table/context/ds-table-context.tsx +39 -0
- package/src/components/ds-table/ds-table.module.scss +60 -0
- package/src/components/ds-table/ds-table.tsx +312 -0
- package/src/components/ds-table/ds-table.types.ts +377 -0
- package/src/components/ds-table/filters/adapters/create-checkbox-filter-adapter.tsx +116 -0
- package/src/components/ds-table/filters/adapters/create-dual-range-filter-adapter.tsx +171 -0
- package/src/components/ds-table/filters/adapters/create-filter-adapter.ts +131 -0
- package/src/components/ds-table/filters/adapters/index.ts +12 -0
- package/src/components/ds-table/filters/components/checkbox-filter/checkbox-filter.tsx +43 -0
- package/src/components/ds-table/filters/components/checkbox-filter/index.ts +2 -0
- package/src/components/ds-table/filters/components/range-filter/index.ts +2 -0
- package/src/components/ds-table/filters/components/range-filter/range-filter.module.scss +25 -0
- package/src/components/ds-table/filters/components/range-filter/range-filter.tsx +79 -0
- package/src/components/ds-table/filters/hooks/index.ts +1 -0
- package/src/components/ds-table/filters/hooks/use-table-filters.ts +234 -0
- package/src/components/ds-table/filters/index.ts +50 -0
- package/src/components/ds-table/filters/types/filter-adapter.types.ts +111 -0
- package/src/components/ds-table/hooks/use-drag-and-drop.tsx +107 -0
- package/src/components/ds-table/index.ts +4 -0
- package/src/components/ds-table/styles/_variables.scss +17 -0
- package/src/components/ds-table/styles/shared/ds-table-shared.module.scss +16 -0
- package/src/components/ds-table/utils/column-styling.ts +30 -0
- package/src/components/ds-table/utils/create-columns-grid-template.ts +23 -0
- package/src/components/ds-table/utils/merge-refs.ts +15 -0
- package/src/components/ds-table/utils/story-data-generator.ts +91 -0
- package/src/components/ds-text-input/ds-text-input.module.scss +27 -0
- package/src/components/ds-text-input/ds-text-input.tsx +75 -0
- package/src/components/ds-text-input/ds-text-input.types.tsx +110 -0
- package/src/components/ds-text-input/index.ts +2 -0
- package/src/components/ds-textarea/ds-textarea.module.scss +5 -0
- package/src/components/ds-textarea/ds-textarea.tsx +49 -0
- package/src/components/ds-textarea/ds-textarea.types.tsx +67 -0
- package/src/components/ds-textarea/index.tsx +2 -0
- package/src/components/ds-toast/ds-toast-context.tsx +79 -0
- package/src/components/ds-toast/ds-toast.module.scss +134 -0
- package/src/components/ds-toast/ds-toast.tsx +54 -0
- package/src/components/ds-toast/ds-toast.types.tsx +53 -0
- package/src/components/ds-toast/index.ts +3 -0
- package/src/components/ds-tooltip/ds-tooltip.module.scss +19 -0
- package/src/components/ds-tooltip/ds-tooltip.tsx +33 -0
- package/src/components/ds-tooltip/ds-tooltip.types.tsx +12 -0
- package/src/components/ds-tooltip/index.tsx +2 -0
- package/src/components/ds-typography/ds-typography.config.ts +32 -0
- package/src/components/ds-typography/ds-typography.module.scss +93 -0
- package/src/components/ds-typography/ds-typography.tsx +27 -0
- package/src/components/ds-typography/ds-typography.types.tsx +27 -0
- package/src/components/ds-typography/index.tsx +2 -0
- package/src/components/ds-vertical-tabs/ds-vertical-tabs.module.scss +60 -0
- package/src/components/ds-vertical-tabs/ds-vertical-tabs.tsx +80 -0
- package/src/components/ds-vertical-tabs/ds-vertical-tabs.types.ts +69 -0
- package/src/components/ds-vertical-tabs/index.ts +7 -0
- package/src/index.ts +34 -0
- package/src/styles/_colors.scss +65 -0
- package/src/styles/_grid.scss +111 -0
- package/src/styles/_mixin.scss +1 -0
- package/src/styles/_reset.scss +38 -0
- package/src/styles/_root.scss +390 -0
- package/src/styles/_scrollbars.scss +41 -0
- package/src/styles/_spacing.scss +47 -0
- package/src/styles/_typography.scss +301 -0
- package/src/styles/_utilities.scss +33 -0
- package/src/styles/_variables.scss +44 -0
- package/src/styles/mixins/_bounding-box.scss +53 -0
- package/src/styles/mixins/_list.scss +74 -0
- package/src/styles/shared/_dropdown.scss +89 -0
- package/src/styles/shared/_input.scss +365 -0
- package/src/styles/shared/_modal.scss +123 -0
- package/src/styles/styles.scss +12 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@use '../../styles/shared/modal' as shared;
|
|
2
|
+
|
|
3
|
+
$pad-x: 24px;
|
|
4
|
+
$pad-y: 16px;
|
|
5
|
+
$max-width: 90vw;
|
|
6
|
+
$max-height: 90vh;
|
|
7
|
+
|
|
8
|
+
.overlay {
|
|
9
|
+
@include shared.overlay-base;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.modal {
|
|
13
|
+
@include shared.modal-base;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.content {
|
|
17
|
+
@include shared.content-base;
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.header,
|
|
22
|
+
.footer,
|
|
23
|
+
.body {
|
|
24
|
+
padding: $pad-y $pad-x;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.header {
|
|
28
|
+
@include shared.header-base;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.footer {
|
|
32
|
+
@include shared.footer-base;
|
|
33
|
+
display: flex;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.title {
|
|
37
|
+
@include shared.title-base;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.body {
|
|
41
|
+
@include shared.body-base;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.actions {
|
|
45
|
+
@include shared.actions-base;
|
|
46
|
+
margin-left: auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// width classes derived from DS grid
|
|
50
|
+
.modal {
|
|
51
|
+
inline-size: min(var(--col-span-6), $max-width);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.modal.cols-1 {
|
|
55
|
+
inline-size: min(var(--col-span-1), $max-width);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.modal.cols-2 {
|
|
59
|
+
inline-size: min(var(--col-span-2), $max-width);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.modal.cols-3 {
|
|
63
|
+
inline-size: min(var(--col-span-3), $max-width);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.modal.cols-4 {
|
|
67
|
+
inline-size: min(var(--col-span-4), $max-width);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.modal.cols-5 {
|
|
71
|
+
inline-size: min(var(--col-span-5), $max-width);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.modal.cols-6 {
|
|
75
|
+
inline-size: min(var(--col-span-6), $max-width);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.modal.cols-7 {
|
|
79
|
+
inline-size: min(var(--col-span-7), $max-width);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.modal.cols-8 {
|
|
83
|
+
inline-size: min(var(--col-span-8), $max-width);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.modal.cols-9 {
|
|
87
|
+
inline-size: min(var(--col-span-9), $max-width);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.modal.cols-10 {
|
|
91
|
+
inline-size: min(var(--col-span-10), $max-width);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.modal.cols-11 {
|
|
95
|
+
inline-size: min(var(--col-span-11), $max-width);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.modal.cols-12 {
|
|
99
|
+
inline-size: min(var(--col-span-12), $max-width);
|
|
100
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { Dialog } from '@ark-ui/react/dialog';
|
|
3
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import type { DsModalProps } from './ds-modal.types';
|
|
6
|
+
import styles from './ds-modal.module.scss';
|
|
7
|
+
import { DsIcon } from '../ds-icon';
|
|
8
|
+
import { DsTypography } from '../ds-typography';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Composable modal dialog.
|
|
12
|
+
* Supports custom header, footer, and body content with grid-based sizing.
|
|
13
|
+
* Use columns prop to control modal width (1-12 grid columns).
|
|
14
|
+
*/
|
|
15
|
+
const DsModal = ({
|
|
16
|
+
open,
|
|
17
|
+
onOpenChange,
|
|
18
|
+
columns = 6,
|
|
19
|
+
style,
|
|
20
|
+
className,
|
|
21
|
+
modal = true,
|
|
22
|
+
closeOnEscape,
|
|
23
|
+
closeOnInteractOutside = false,
|
|
24
|
+
children,
|
|
25
|
+
}: DsModalProps) => {
|
|
26
|
+
const handleOpenChange = (details: { open: boolean }) => {
|
|
27
|
+
onOpenChange(details.open);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Dialog.Root
|
|
32
|
+
open={open}
|
|
33
|
+
onOpenChange={handleOpenChange}
|
|
34
|
+
modal={modal}
|
|
35
|
+
closeOnEscape={closeOnEscape}
|
|
36
|
+
closeOnInteractOutside={closeOnInteractOutside}
|
|
37
|
+
>
|
|
38
|
+
<Portal>
|
|
39
|
+
<Dialog.Backdrop className={styles.overlay} />
|
|
40
|
+
<Dialog.Positioner>
|
|
41
|
+
<Dialog.Content
|
|
42
|
+
style={style}
|
|
43
|
+
className={classNames(styles.modal, styles[`cols-${String(columns)}`], className)}
|
|
44
|
+
>
|
|
45
|
+
<div className={classNames(styles.content)}>{children}</div>
|
|
46
|
+
</Dialog.Content>
|
|
47
|
+
</Dialog.Positioner>
|
|
48
|
+
</Portal>
|
|
49
|
+
</Dialog.Root>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const Header = ({
|
|
54
|
+
style,
|
|
55
|
+
className,
|
|
56
|
+
children,
|
|
57
|
+
}: {
|
|
58
|
+
style?: CSSProperties;
|
|
59
|
+
className?: string;
|
|
60
|
+
children: ReactNode;
|
|
61
|
+
}) => (
|
|
62
|
+
<div style={style} className={classNames(styles.header, className)}>
|
|
63
|
+
{children}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const Title = ({
|
|
68
|
+
style,
|
|
69
|
+
className,
|
|
70
|
+
children,
|
|
71
|
+
}: {
|
|
72
|
+
style?: CSSProperties;
|
|
73
|
+
className?: string;
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
}) => (
|
|
76
|
+
<Dialog.Title className={classNames(styles.title, className)} style={style} asChild>
|
|
77
|
+
<DsTypography variant="heading3">{children}</DsTypography>
|
|
78
|
+
</Dialog.Title>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const CloseTrigger = ({ style, className }: { style?: CSSProperties; className?: string }) => (
|
|
82
|
+
<Dialog.CloseTrigger style={style} className={className}>
|
|
83
|
+
<DsIcon icon="close" size="small"></DsIcon>
|
|
84
|
+
</Dialog.CloseTrigger>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const Body = ({
|
|
88
|
+
style,
|
|
89
|
+
className,
|
|
90
|
+
children,
|
|
91
|
+
}: {
|
|
92
|
+
style?: CSSProperties;
|
|
93
|
+
className?: string;
|
|
94
|
+
children: ReactNode;
|
|
95
|
+
}) => (
|
|
96
|
+
<div style={style} className={classNames(styles.body, className)}>
|
|
97
|
+
{children}
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const Footer = ({
|
|
102
|
+
style,
|
|
103
|
+
className,
|
|
104
|
+
children,
|
|
105
|
+
}: {
|
|
106
|
+
style?: CSSProperties;
|
|
107
|
+
className?: string;
|
|
108
|
+
children: ReactNode;
|
|
109
|
+
}) => (
|
|
110
|
+
<div style={style} className={classNames(styles.footer, className)}>
|
|
111
|
+
{children}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const Actions = ({
|
|
116
|
+
style,
|
|
117
|
+
className,
|
|
118
|
+
children,
|
|
119
|
+
}: {
|
|
120
|
+
style?: CSSProperties;
|
|
121
|
+
className?: string;
|
|
122
|
+
children: ReactNode;
|
|
123
|
+
}) => (
|
|
124
|
+
<div style={style} className={classNames(styles.actions, className)}>
|
|
125
|
+
{children}
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
DsModal.Header = Header;
|
|
130
|
+
DsModal.Title = Title;
|
|
131
|
+
DsModal.CloseTrigger = CloseTrigger;
|
|
132
|
+
DsModal.Body = Body;
|
|
133
|
+
DsModal.Footer = Footer;
|
|
134
|
+
DsModal.Actions = Actions;
|
|
135
|
+
|
|
136
|
+
export default DsModal;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { UseDialogProps as DialogProps } from '@ark-ui/react/dialog';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Available column sizes for modal width
|
|
6
|
+
*/
|
|
7
|
+
export type DsModalColumns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Props for the DsModal component
|
|
11
|
+
*/
|
|
12
|
+
export interface DsModalProps extends Pick<
|
|
13
|
+
DialogProps,
|
|
14
|
+
'modal' | 'closeOnEscape' | 'closeOnInteractOutside'
|
|
15
|
+
> {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the modal is open
|
|
18
|
+
*/
|
|
19
|
+
open: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Callback when modal open state changes
|
|
22
|
+
* @param open - whether the modal is open
|
|
23
|
+
*/
|
|
24
|
+
onOpenChange: (open: boolean) => void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Number of grid columns for modal width
|
|
28
|
+
* @default 6
|
|
29
|
+
*/
|
|
30
|
+
columns?: DsModalColumns;
|
|
31
|
+
/**
|
|
32
|
+
* Optional inline styles to apply to the component
|
|
33
|
+
*/
|
|
34
|
+
style?: CSSProperties;
|
|
35
|
+
/**
|
|
36
|
+
* Additional CSS class name
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Modal body content
|
|
42
|
+
*/
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { NumberInput } from '@ark-ui/react';
|
|
4
|
+
import styles from './ds-number-input.module.scss';
|
|
5
|
+
import type { DsNumberInputProps } from './ds-number-input.types';
|
|
6
|
+
import { DsIcon } from '../ds-icon';
|
|
7
|
+
|
|
8
|
+
const DsNumberInput: FC<DsNumberInputProps> = ({
|
|
9
|
+
id,
|
|
10
|
+
ref,
|
|
11
|
+
name,
|
|
12
|
+
size = 'default',
|
|
13
|
+
onBlur,
|
|
14
|
+
onChange,
|
|
15
|
+
onValueChange,
|
|
16
|
+
className,
|
|
17
|
+
style = {},
|
|
18
|
+
placeholder,
|
|
19
|
+
disabled = false,
|
|
20
|
+
min,
|
|
21
|
+
max,
|
|
22
|
+
step,
|
|
23
|
+
value,
|
|
24
|
+
defaultValue,
|
|
25
|
+
}) => {
|
|
26
|
+
const containerClass = classNames(
|
|
27
|
+
styles.textInputContainer,
|
|
28
|
+
{
|
|
29
|
+
[styles.small]: size === 'small',
|
|
30
|
+
[styles.default]: size === 'default',
|
|
31
|
+
},
|
|
32
|
+
className,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<NumberInput.Root
|
|
37
|
+
id={id}
|
|
38
|
+
min={min}
|
|
39
|
+
max={max}
|
|
40
|
+
step={step}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
value={typeof value !== 'undefined' ? String(value) : undefined}
|
|
43
|
+
defaultValue={typeof defaultValue !== 'undefined' ? String(defaultValue) : undefined}
|
|
44
|
+
onValueChange={(details) => onValueChange?.(details.valueAsNumber)}
|
|
45
|
+
>
|
|
46
|
+
<NumberInput.Control asChild>
|
|
47
|
+
<div className={containerClass} style={style}>
|
|
48
|
+
<NumberInput.DecrementTrigger asChild>
|
|
49
|
+
<button type="button" className={classNames(styles.iconButton)} aria-label="Decrease value">
|
|
50
|
+
<DsIcon icon="remove" size="tiny" />
|
|
51
|
+
</button>
|
|
52
|
+
</NumberInput.DecrementTrigger>
|
|
53
|
+
|
|
54
|
+
<NumberInput.Input
|
|
55
|
+
ref={ref}
|
|
56
|
+
name={name}
|
|
57
|
+
className={classNames(styles.input)}
|
|
58
|
+
placeholder={placeholder}
|
|
59
|
+
onBlur={onBlur}
|
|
60
|
+
onChange={onChange}
|
|
61
|
+
></NumberInput.Input>
|
|
62
|
+
|
|
63
|
+
<NumberInput.IncrementTrigger asChild>
|
|
64
|
+
<button type="button" className={classNames(styles.iconButton)} aria-label="Increase value">
|
|
65
|
+
<DsIcon icon="add" size="tiny" />
|
|
66
|
+
</button>
|
|
67
|
+
</NumberInput.IncrementTrigger>
|
|
68
|
+
</div>
|
|
69
|
+
</NumberInput.Control>
|
|
70
|
+
</NumberInput.Root>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default DsNumberInput;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface DsNumberInputProps {
|
|
4
|
+
/**
|
|
5
|
+
* Unique identifier for the input field
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The ref to the input field
|
|
10
|
+
*/
|
|
11
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the input field
|
|
14
|
+
*/
|
|
15
|
+
name?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The size of the input field
|
|
18
|
+
* @default default
|
|
19
|
+
*/
|
|
20
|
+
size?: 'small' | 'default';
|
|
21
|
+
/**
|
|
22
|
+
* Event handler called when the input field loses focus
|
|
23
|
+
*
|
|
24
|
+
* @param event
|
|
25
|
+
*/
|
|
26
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Callback when the value changes (native input onChange event)
|
|
29
|
+
* This is provided for compatibility but onValueChange is preferred
|
|
30
|
+
*/
|
|
31
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Value change event handler (provides just the number value)
|
|
34
|
+
* This is the preferred way to handle value changes
|
|
35
|
+
*/
|
|
36
|
+
onValueChange?: (value: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Additional CSS class names
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Additional styles to apply to the component
|
|
43
|
+
*/
|
|
44
|
+
style?: React.CSSProperties;
|
|
45
|
+
/**
|
|
46
|
+
* The placeholder text
|
|
47
|
+
*/
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the number input is disabled
|
|
51
|
+
*/
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The minimum value of the number input
|
|
55
|
+
*/
|
|
56
|
+
min?: number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* The maximum value of the number input
|
|
59
|
+
* @default Number.MAX_SAFE_INTEGER
|
|
60
|
+
*/
|
|
61
|
+
max?: number | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The amount to increment or decrement the value by
|
|
64
|
+
* @default 1
|
|
65
|
+
*/
|
|
66
|
+
step?: number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* The controlled value of the input
|
|
69
|
+
*/
|
|
70
|
+
value?: number | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The initial value of the input when rendered.
|
|
73
|
+
* Use when you don't need to control the value of the input.
|
|
74
|
+
*/
|
|
75
|
+
defaultValue?: number | undefined;
|
|
76
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
background: var(--white);
|
|
4
|
+
padding: var(--spacing-6);
|
|
5
|
+
width: 340px;
|
|
6
|
+
border-inline-end: 1px solid transparent;
|
|
7
|
+
|
|
8
|
+
&[data-state='open']:hover,
|
|
9
|
+
&[data-state='open']:focus-within {
|
|
10
|
+
border-color: var(--color-border);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&[data-state='closed'] {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.variantFloating {
|
|
18
|
+
position: absolute;
|
|
19
|
+
inset-inline-start: var(--spacing-3);
|
|
20
|
+
top: var(--spacing-3);
|
|
21
|
+
border: none;
|
|
22
|
+
border-radius: var(--spacing-2);
|
|
23
|
+
filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.22));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.disablePadding {
|
|
27
|
+
padding: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.trigger {
|
|
32
|
+
--size: 28px;
|
|
33
|
+
|
|
34
|
+
position: absolute;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
user-select: none;
|
|
37
|
+
display: none;
|
|
38
|
+
height: var(--size);
|
|
39
|
+
width: var(--size);
|
|
40
|
+
padding: 1px;
|
|
41
|
+
border: 1px solid var(--color-border-secondary);
|
|
42
|
+
border-radius: 100%;
|
|
43
|
+
background: var(--white);
|
|
44
|
+
color: var(--color-icon-secondary);
|
|
45
|
+
top: var(--spacing-6);
|
|
46
|
+
inset-inline-start: 100%;
|
|
47
|
+
margin-inline-start: calc(var(--size) / -2);
|
|
48
|
+
|
|
49
|
+
&[data-state='closed'],
|
|
50
|
+
&.triggerCollapsed {
|
|
51
|
+
rotate: y 180deg;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.root:hover &,
|
|
55
|
+
.root:focus-within & {
|
|
56
|
+
display: flex;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:hover,
|
|
60
|
+
&:focus {
|
|
61
|
+
color: var(--color-icon-primary);
|
|
62
|
+
border-color: var(--color-border-action-primary);
|
|
63
|
+
outline: none;
|
|
64
|
+
background: var(--color-background-action-tertiary);
|
|
65
|
+
|
|
66
|
+
.root:has(&) {
|
|
67
|
+
border-color: var(--color-border-action-primary);
|
|
68
|
+
|
|
69
|
+
// Add an inset single-sided border on hover without affecting the layout.
|
|
70
|
+
&.variantDocked[data-state='open']::before {
|
|
71
|
+
content: '';
|
|
72
|
+
display: block;
|
|
73
|
+
position: absolute;
|
|
74
|
+
height: 100%;
|
|
75
|
+
width: 1px;
|
|
76
|
+
top: 0;
|
|
77
|
+
inset-inline-end: 0;
|
|
78
|
+
background: var(--color-border-action-primary);
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Increase surface size for better clickability.
|
|
85
|
+
&::after {
|
|
86
|
+
content: '';
|
|
87
|
+
position: absolute;
|
|
88
|
+
inset: calc(-1 * var(--spacing-1));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.root.variantFloating & {
|
|
92
|
+
top: 50%;
|
|
93
|
+
transform: translateY(-50%);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import styles from './ds-panel.module.scss';
|
|
4
|
+
import { DsIcon } from '../ds-icon';
|
|
5
|
+
import type { DsPanelCollapseButtonProps, DsPanelProps } from './ds-panel.types';
|
|
6
|
+
|
|
7
|
+
export function DsPanel({
|
|
8
|
+
open,
|
|
9
|
+
onOpenChange,
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
slotProps,
|
|
13
|
+
variant = 'docked',
|
|
14
|
+
disablePadding = false,
|
|
15
|
+
...props
|
|
16
|
+
}: DsPanelProps) {
|
|
17
|
+
return (
|
|
18
|
+
<Collapsible.Root
|
|
19
|
+
open={open}
|
|
20
|
+
onOpenChange={onOpenChange}
|
|
21
|
+
className={classnames(styles.root, className, {
|
|
22
|
+
[styles.variantDocked]: variant === 'docked',
|
|
23
|
+
[styles.variantFloating]: variant === 'floating',
|
|
24
|
+
[styles.disablePadding]: disablePadding,
|
|
25
|
+
})}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
<DsPanelCollapseButton {...slotProps?.collapseButton} />
|
|
29
|
+
{children}
|
|
30
|
+
</Collapsible.Root>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function DsPanelCollapseButton({ collapsed, ...props }: DsPanelCollapseButtonProps) {
|
|
35
|
+
return (
|
|
36
|
+
<Collapsible.Trigger
|
|
37
|
+
className={classnames(styles.trigger, {
|
|
38
|
+
[styles.triggerCollapsed]: collapsed,
|
|
39
|
+
})}
|
|
40
|
+
aria-label="Toggle panel"
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
<DsIcon icon="arrow_circle_left" variant="outlined" />
|
|
44
|
+
</Collapsible.Trigger>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
|
+
|
|
3
|
+
export type DsPanelVariant = 'docked' | 'floating';
|
|
4
|
+
|
|
5
|
+
export type DsPanelProps = Omit<Collapsible.CollapsibleProps, 'onOpenChange'> & {
|
|
6
|
+
variant?: DsPanelVariant;
|
|
7
|
+
disablePadding?: boolean;
|
|
8
|
+
slotProps?: {
|
|
9
|
+
collapseButton?: DsPanelCollapseButtonProps;
|
|
10
|
+
};
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type DsPanelCollapseButtonProps = {
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
collapsed?: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { PasswordInput } from '@ark-ui/react';
|
|
4
|
+
import styles from './ds-password-input.module.scss';
|
|
5
|
+
import type { DsPasswordInputProps } from './ds-password-input.types';
|
|
6
|
+
import { DsIcon } from '../ds-icon';
|
|
7
|
+
|
|
8
|
+
const DsPasswordInput: FC<DsPasswordInputProps> = ({
|
|
9
|
+
id,
|
|
10
|
+
ref,
|
|
11
|
+
name,
|
|
12
|
+
size = 'default',
|
|
13
|
+
onBlur,
|
|
14
|
+
onChange,
|
|
15
|
+
onValueChange,
|
|
16
|
+
className,
|
|
17
|
+
style = {},
|
|
18
|
+
value,
|
|
19
|
+
defaultValue,
|
|
20
|
+
placeholder,
|
|
21
|
+
disabled = false,
|
|
22
|
+
}) => {
|
|
23
|
+
const containerClass = classNames(
|
|
24
|
+
styles.textInputContainer,
|
|
25
|
+
{
|
|
26
|
+
[styles.small]: size === 'small',
|
|
27
|
+
[styles.default]: size === 'default',
|
|
28
|
+
},
|
|
29
|
+
className,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<PasswordInput.Root disabled={disabled}>
|
|
34
|
+
<PasswordInput.Control>
|
|
35
|
+
<div className={containerClass} style={style}>
|
|
36
|
+
<PasswordInput.Input asChild>
|
|
37
|
+
<input
|
|
38
|
+
id={id}
|
|
39
|
+
ref={ref}
|
|
40
|
+
name={name}
|
|
41
|
+
className={classNames(styles.input)}
|
|
42
|
+
value={value}
|
|
43
|
+
defaultValue={defaultValue}
|
|
44
|
+
placeholder={placeholder}
|
|
45
|
+
onBlur={onBlur}
|
|
46
|
+
onChange={(event) => {
|
|
47
|
+
onChange?.(event);
|
|
48
|
+
onValueChange?.(event.target.value);
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
</PasswordInput.Input>
|
|
52
|
+
|
|
53
|
+
<PasswordInput.VisibilityTrigger className={styles.trigger} aria-label="Toggle password visibility">
|
|
54
|
+
<PasswordInput.Indicator
|
|
55
|
+
className={styles.indicator}
|
|
56
|
+
fallback={<DsIcon icon="visibility_off" size="tiny" />}
|
|
57
|
+
>
|
|
58
|
+
<DsIcon icon="visibility" size="tiny" />
|
|
59
|
+
</PasswordInput.Indicator>
|
|
60
|
+
</PasswordInput.VisibilityTrigger>
|
|
61
|
+
</div>
|
|
62
|
+
</PasswordInput.Control>
|
|
63
|
+
</PasswordInput.Root>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default DsPasswordInput;
|