@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,62 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface DsPasswordInputProps {
|
|
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 string value)
|
|
34
|
+
* This is the preferred way to handle value changes
|
|
35
|
+
*/
|
|
36
|
+
onValueChange?: (value: string) => 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
|
+
* The current value (for controlled usage)
|
|
51
|
+
*/
|
|
52
|
+
value?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The initial value of the input when rendered.
|
|
55
|
+
* Use when you don't need to control the value of the input.
|
|
56
|
+
*/
|
|
57
|
+
defaultValue?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the password input is disabled
|
|
60
|
+
*/
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@use '../../styles/typography';
|
|
2
|
+
|
|
3
|
+
.content {
|
|
4
|
+
width: max-content;
|
|
5
|
+
// approx. 2 columns (64 * 2)
|
|
6
|
+
min-width: 128px;
|
|
7
|
+
// approx. 6 columns (64 * 6)
|
|
8
|
+
max-width: 384px;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 12px;
|
|
12
|
+
box-shadow: 0 1.25px 4px 0 rgba(0, 0, 0, 0.25);
|
|
13
|
+
border-radius: 2px;
|
|
14
|
+
background: var(--white);
|
|
15
|
+
padding: 12px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.arrow {
|
|
19
|
+
fill: var(--white);
|
|
20
|
+
filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.1));
|
|
21
|
+
width: 18px;
|
|
22
|
+
height: 10px;
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import * as Popover from '@radix-ui/react-popover';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styles from './ds-popover.module.scss';
|
|
5
|
+
import type { DsPopoverProps } from './ds-popover.types';
|
|
6
|
+
|
|
7
|
+
const DsPopover: React.FC<DsPopoverProps> = ({
|
|
8
|
+
trigger,
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
align = 'center',
|
|
12
|
+
side = 'top',
|
|
13
|
+
}) => {
|
|
14
|
+
return (
|
|
15
|
+
<Popover.Root>
|
|
16
|
+
<Popover.Trigger asChild>{trigger}</Popover.Trigger>
|
|
17
|
+
<Popover.Portal>
|
|
18
|
+
<Popover.Content
|
|
19
|
+
side={side}
|
|
20
|
+
align={align}
|
|
21
|
+
sideOffset={8}
|
|
22
|
+
collisionPadding={16}
|
|
23
|
+
className={classNames(styles.content, className)}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
<Popover.Arrow className={styles.arrow} />
|
|
27
|
+
</Popover.Content>
|
|
28
|
+
</Popover.Portal>
|
|
29
|
+
</Popover.Root>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default DsPopover;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface DsPopoverProps {
|
|
4
|
+
/**
|
|
5
|
+
* The element that triggers the popover
|
|
6
|
+
*/
|
|
7
|
+
trigger: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The content to be rendered inside the popover
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Additional CSS class names
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The alignment of the popover content
|
|
18
|
+
*/
|
|
19
|
+
align?: 'start' | 'center' | 'end';
|
|
20
|
+
/**
|
|
21
|
+
* The position of the popover relative to the trigger element
|
|
22
|
+
*/
|
|
23
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
24
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
@use '../../styles/typography';
|
|
2
|
+
|
|
3
|
+
.radioGroupRoot {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 12px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.radioItemContainer {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 4px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
padding-right: 1px;
|
|
16
|
+
border: 1px solid transparent;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
|
|
19
|
+
&:has([data-disabled]) {
|
|
20
|
+
cursor: not-allowed;
|
|
21
|
+
|
|
22
|
+
.labelInfo {
|
|
23
|
+
color: var(--color-secondary-500-net-4);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:has([data-state='checked']:focus-visible) {
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
border-color: var(--color-primary-700-net-1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:has([data-state='unchecked']:focus-visible) {
|
|
33
|
+
border-color: var(--color-primary-800);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:has(.labelInfo) {
|
|
37
|
+
margin-bottom: 4px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.radioItem {
|
|
42
|
+
all: unset;
|
|
43
|
+
position: relative;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
border: 2px solid transparent;
|
|
48
|
+
border-radius: 50%;
|
|
49
|
+
transition:
|
|
50
|
+
background-color 0.2s ease-in-out,
|
|
51
|
+
border-color 0.2s ease-in-out;
|
|
52
|
+
|
|
53
|
+
.radioItemWrapper {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
height: 16px;
|
|
58
|
+
width: 16px;
|
|
59
|
+
border: 2px solid var(--color-secondary-500-net-4);
|
|
60
|
+
padding: 2px;
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
background: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&[data-state='checked'],
|
|
66
|
+
[data-state='checked'] > & {
|
|
67
|
+
.radioItemWrapper {
|
|
68
|
+
border-color: var(--color-primary-700-default);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:hover {
|
|
72
|
+
border-color: var(--color-primary-100);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&[data-state='checked'][data-disabled],
|
|
77
|
+
[data-state='checked'][data-disabled] > & {
|
|
78
|
+
.radioIndicator {
|
|
79
|
+
background: var(--color-secondary-300);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&[data-state='unchecked'],
|
|
84
|
+
[data-state='unchecked'] > & {
|
|
85
|
+
&:hover {
|
|
86
|
+
border-color: var(--color-secondary-100);
|
|
87
|
+
background-color: var(--color-secondary-100);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&[data-disabled],
|
|
92
|
+
[data-disabled] > & {
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
|
|
95
|
+
& + label {
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.radioItemWrapper {
|
|
100
|
+
border-color: var(--color-secondary-300);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.radioIndicator {
|
|
106
|
+
width: 8px;
|
|
107
|
+
height: 8px;
|
|
108
|
+
background: var(--color-primary-700-default);
|
|
109
|
+
border-radius: 50%;
|
|
110
|
+
|
|
111
|
+
&[data-part='indicator'] {
|
|
112
|
+
opacity: 0;
|
|
113
|
+
transform: scale(0);
|
|
114
|
+
transition:
|
|
115
|
+
opacity 0.15s ease-in-out,
|
|
116
|
+
transform 0.15s ease-in-out;
|
|
117
|
+
|
|
118
|
+
[data-state='checked'] & {
|
|
119
|
+
opacity: 1;
|
|
120
|
+
transform: scale(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.radioLabel {
|
|
126
|
+
@include typography.body-sm-reg;
|
|
127
|
+
color: var(--color-secondary-800);
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.labelInfo {
|
|
132
|
+
@include typography.body-xs-reg;
|
|
133
|
+
@include typography.ellipsis;
|
|
134
|
+
position: absolute;
|
|
135
|
+
color: var(--color-secondary-600-net-2);
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
width: 100%;
|
|
138
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
|
+
import { RadioGroup } from '@ark-ui/react/radio-group';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import styles from './ds-radio-group.module.scss';
|
|
6
|
+
import type {
|
|
7
|
+
DsRadioGroupItemProps,
|
|
8
|
+
DsRadioGroupLegacyProps,
|
|
9
|
+
DsRadioGroupRootProps,
|
|
10
|
+
} from './ds-radio-group.types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Root component - provides radio group context
|
|
14
|
+
*/
|
|
15
|
+
const Root: React.FC<DsRadioGroupRootProps> = ({ className, children, onValueChange, ...props }) => (
|
|
16
|
+
<RadioGroup.Root
|
|
17
|
+
className={classNames(styles.radioGroupRoot, className)}
|
|
18
|
+
onValueChange={(details) => onValueChange?.(details.value)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</RadioGroup.Root>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Item component - renders a single radio button with optional label
|
|
27
|
+
*/
|
|
28
|
+
const Item: React.FC<DsRadioGroupItemProps> = ({
|
|
29
|
+
value,
|
|
30
|
+
label,
|
|
31
|
+
labelInfo,
|
|
32
|
+
className,
|
|
33
|
+
style,
|
|
34
|
+
children,
|
|
35
|
+
...props
|
|
36
|
+
}) => {
|
|
37
|
+
return (
|
|
38
|
+
<RadioGroup.Item
|
|
39
|
+
value={value}
|
|
40
|
+
className={classNames(styles.radioItemContainer, className)}
|
|
41
|
+
style={style}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<RadioGroup.ItemControl className={styles.radioItem}>
|
|
45
|
+
<div className={styles.radioItemWrapper}>
|
|
46
|
+
<div className={styles.radioIndicator} data-part="indicator" />
|
|
47
|
+
</div>
|
|
48
|
+
</RadioGroup.ItemControl>
|
|
49
|
+
<RadioGroup.ItemHiddenInput />
|
|
50
|
+
{label ? (
|
|
51
|
+
<RadioGroup.ItemText className={styles.radioLabel}>
|
|
52
|
+
{label}
|
|
53
|
+
{labelInfo && <div className={styles.labelInfo}>{labelInfo}</div>}
|
|
54
|
+
</RadioGroup.ItemText>
|
|
55
|
+
) : (
|
|
56
|
+
children
|
|
57
|
+
)}
|
|
58
|
+
</RadioGroup.Item>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* DEPRECATED: Legacy DsRadioGroup component with options array
|
|
64
|
+
* Use compound component pattern instead: DsRadioGroup.Root + DsRadioGroup.Item
|
|
65
|
+
* @deprecated
|
|
66
|
+
*/
|
|
67
|
+
export const DsRadioGroupLegacy: React.FC<DsRadioGroupLegacyProps> = ({
|
|
68
|
+
options,
|
|
69
|
+
value,
|
|
70
|
+
defaultValue,
|
|
71
|
+
onValueChange,
|
|
72
|
+
className,
|
|
73
|
+
...props
|
|
74
|
+
}) => (
|
|
75
|
+
<RadioGroupPrimitive.Root
|
|
76
|
+
className={classNames(styles.radioGroupRoot, className)}
|
|
77
|
+
value={value}
|
|
78
|
+
defaultValue={defaultValue}
|
|
79
|
+
onValueChange={onValueChange}
|
|
80
|
+
{...props}
|
|
81
|
+
>
|
|
82
|
+
{options.map((option) => (
|
|
83
|
+
<div key={option.value} className={styles.radioItemContainer}>
|
|
84
|
+
<RadioGroupPrimitive.Item
|
|
85
|
+
className={styles.radioItem}
|
|
86
|
+
value={option.value}
|
|
87
|
+
disabled={option.disabled}
|
|
88
|
+
id={option.value}
|
|
89
|
+
>
|
|
90
|
+
<div className={styles.radioItemWrapper}>
|
|
91
|
+
<RadioGroupPrimitive.Indicator className={styles.radioIndicator} />
|
|
92
|
+
</div>
|
|
93
|
+
</RadioGroupPrimitive.Item>
|
|
94
|
+
<label className={styles.radioLabel} htmlFor={option.value}>
|
|
95
|
+
{option.label}
|
|
96
|
+
{option.labelInfo && <div className={styles.labelInfo}>{option.labelInfo}</div>}
|
|
97
|
+
</label>
|
|
98
|
+
</div>
|
|
99
|
+
))}
|
|
100
|
+
</RadioGroupPrimitive.Root>
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Design system RadioGroup component
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* <DsRadioGroup.Root value={value} onValueChange={setValue}>
|
|
108
|
+
* <DsRadioGroup.Item value="option1" label="Option 1" />
|
|
109
|
+
* <DsRadioGroup.Item value="option2" label="Option 2" />
|
|
110
|
+
* </DsRadioGroup.Root>
|
|
111
|
+
*/
|
|
112
|
+
export const DsRadioGroup = {
|
|
113
|
+
Root,
|
|
114
|
+
Item,
|
|
115
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
|
+
import { type RadioGroupItemProps, type RadioGroupRootProps } from '@ark-ui/react/radio-group';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props for the DsRadioGroup Root component
|
|
7
|
+
*/
|
|
8
|
+
export interface DsRadioGroupRootProps extends Pick<
|
|
9
|
+
RadioGroupRootProps,
|
|
10
|
+
'value' | 'defaultValue' | 'disabled' | 'name' | 'className' | 'style' | 'orientation' | 'children'
|
|
11
|
+
> {
|
|
12
|
+
/**
|
|
13
|
+
* Event handler called when the selected value changes
|
|
14
|
+
*/
|
|
15
|
+
onValueChange?: (value: string | null) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Props for the DsRadioGroup Item component
|
|
20
|
+
*/
|
|
21
|
+
export interface DsRadioGroupItemProps extends Pick<
|
|
22
|
+
RadioGroupItemProps,
|
|
23
|
+
'value' | 'disabled' | 'className' | 'style' | 'children'
|
|
24
|
+
> {
|
|
25
|
+
/**
|
|
26
|
+
* Optional label text for the radio item
|
|
27
|
+
*/
|
|
28
|
+
label?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional additional info text displayed below the label
|
|
31
|
+
*/
|
|
32
|
+
labelInfo?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* DEPRECATED: Legacy radio option configuration
|
|
37
|
+
* Use compound component pattern instead: <DsRadioGroup.Root><DsRadioGroup.Item /></DsRadioGroup.Root>
|
|
38
|
+
* @deprecated
|
|
39
|
+
*/
|
|
40
|
+
export interface DsRadioOptionLegacy<ValueType = string> {
|
|
41
|
+
/**
|
|
42
|
+
* Display label for the radio option
|
|
43
|
+
*/
|
|
44
|
+
label: string;
|
|
45
|
+
/**
|
|
46
|
+
* Value associated with this radio option
|
|
47
|
+
*/
|
|
48
|
+
value: ValueType;
|
|
49
|
+
/**
|
|
50
|
+
* Additional label info for the radio option
|
|
51
|
+
*/
|
|
52
|
+
labelInfo?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether this radio option is disabled
|
|
55
|
+
*/
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* DEPRECATED: Legacy props for DsRadioGroupLegacy component
|
|
61
|
+
* Use compound component pattern instead
|
|
62
|
+
* @deprecated
|
|
63
|
+
*/
|
|
64
|
+
export interface DsRadioGroupLegacyProps<
|
|
65
|
+
TOption extends DsRadioOptionLegacy = DsRadioOptionLegacy,
|
|
66
|
+
> extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {
|
|
67
|
+
/**
|
|
68
|
+
* The radio group options
|
|
69
|
+
*/
|
|
70
|
+
options: TOption[];
|
|
71
|
+
/**
|
|
72
|
+
* The selected value
|
|
73
|
+
*/
|
|
74
|
+
value?: TOption['value'];
|
|
75
|
+
/**
|
|
76
|
+
* The default selected value
|
|
77
|
+
*/
|
|
78
|
+
defaultValue?: TOption['value'];
|
|
79
|
+
/**
|
|
80
|
+
* Event handler called when the selected value changes
|
|
81
|
+
*
|
|
82
|
+
* @param value
|
|
83
|
+
*/
|
|
84
|
+
onValueChange?: (value: TOption['value']) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Additional CSS class names
|
|
87
|
+
*/
|
|
88
|
+
className?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Additional styles to apply to the component
|
|
91
|
+
*/
|
|
92
|
+
style?: React.CSSProperties;
|
|
93
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
@use '../../styles/typography';
|
|
2
|
+
@use '../../styles/shared/dropdown';
|
|
3
|
+
@use '../../styles/shared/input';
|
|
4
|
+
|
|
5
|
+
.control {
|
|
6
|
+
@include input.selectControl;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.trigger {
|
|
10
|
+
@include input.selectTrigger;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.content {
|
|
14
|
+
@include dropdown.dropdown-content;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.searchInput {
|
|
18
|
+
@include input.searchInput;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.viewport {
|
|
22
|
+
@include dropdown.dropdown-viewport;
|
|
23
|
+
max-height: 256px;
|
|
24
|
+
|
|
25
|
+
& > .content {
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
overflow-x: hidden;
|
|
28
|
+
scrollbar-width: thin;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.item {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
color: var(--color-font-secondary);
|
|
37
|
+
padding: var(--spacing-xs);
|
|
38
|
+
border-radius: 2px;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
outline: none;
|
|
41
|
+
|
|
42
|
+
&[data-highlighted],
|
|
43
|
+
&:hover {
|
|
44
|
+
background: var(--color-background-selected-weak);
|
|
45
|
+
|
|
46
|
+
.itemIcon {
|
|
47
|
+
color: var(--color-background-selected);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.valueText {
|
|
53
|
+
@include typography.ellipsis;
|
|
54
|
+
grid-column: 1;
|
|
55
|
+
grid-row: 1;
|
|
56
|
+
color: var(--color-font-secondary);
|
|
57
|
+
text-align: start;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.multiSelectItemsContainer {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
gap: var(--spacing-3xs);
|
|
64
|
+
padding: var(--spacing-3xs);
|
|
65
|
+
border-bottom: 1px solid var(--color-border-secondary);
|
|
66
|
+
}
|