@drivenets/design-system 0.9.0 → 0.10.0
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 +30 -0
- package/dist/index.cjs +1076 -600
- package/dist/index.d.cts +1988 -528
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1991 -531
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1083 -609
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +16 -17
- package/src/components/ds-breadcrumb/ds-breadcrumb.types.ts +40 -6
- package/src/components/ds-button/ds-button.types.ts +13 -2
- package/src/components/ds-button-v3/ds-button-v3.module.scss +108 -109
- package/src/components/ds-button-v3/ds-button-v3.tsx +2 -2
- package/src/components/ds-button-v3/ds-button-v3.types.ts +19 -3
- package/src/components/ds-button-v3/index.ts +5 -1
- package/src/components/ds-card/ds-card.types.ts +3 -1
- package/src/components/ds-checkbox/ds-checkbox.module.scss +106 -123
- package/src/components/ds-checkbox/ds-checkbox.tsx +24 -35
- package/src/components/ds-checkbox/ds-checkbox.types.ts +12 -11
- package/src/components/ds-checkbox-group/ds-checkbox-group.module.scss +13 -0
- package/src/components/ds-checkbox-group/ds-checkbox-group.tsx +20 -0
- package/src/components/ds-checkbox-group/ds-checkbox-group.types.ts +8 -0
- package/src/components/ds-checkbox-group/hooks/index.ts +6 -0
- package/src/components/ds-checkbox-group/hooks/use-checkbox-select-all.ts +65 -0
- package/src/components/ds-checkbox-group/index.ts +3 -0
- package/src/components/ds-comment-bubble/components/ds-comment-thread/ds-comment-thread.types.ts +26 -0
- package/src/components/ds-comment-bubble/components/ds-thread-item/ds-thread-item.types.ts +38 -0
- package/src/components/ds-comment-bubble/ds-comment-bubble.types.ts +78 -0
- package/src/components/ds-comment-card/ds-comment-card.module.scss +2 -2
- package/src/components/ds-comment-card/ds-comment-card.types.ts +114 -0
- package/src/components/ds-comment-indicator/ds-comment-indicator.types.ts +26 -0
- package/src/components/ds-comments-drawer/comments-filters.types.ts +33 -0
- package/src/components/ds-comments-drawer/components/comments-filter-modal/comments-filter-modal.types.ts +37 -1
- package/src/components/ds-comments-drawer/ds-comments-drawer.types.ts +64 -0
- package/src/components/ds-date-input/ds-date-input.types.ts +23 -0
- package/src/components/ds-date-picker/ds-date-picker.tsx +3 -0
- package/src/components/ds-date-picker/ds-date-picker.types.ts +20 -0
- package/src/components/ds-date-range-picker/ds-date-range-picker.types.ts +28 -0
- package/src/components/ds-dialog/ds-dialog.types.ts +10 -1
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.types.ts +24 -0
- package/src/components/ds-file-upload/components/file-upload/file-upload.types.ts +1 -0
- package/src/components/ds-file-upload/ds-file-upload-api.types.ts +55 -0
- package/src/components/ds-form-control/ds-form-control.types.ts +3 -0
- package/src/components/ds-grid/ds-grid.tsx +29 -12
- package/src/components/ds-grid/ds-grid.types.ts +16 -13
- package/src/components/ds-grid/index.ts +10 -2
- package/src/components/ds-icon/custom-icons/index.ts +2 -0
- package/src/components/ds-icon/custom-icons/special-leading-icon.tsx +11 -0
- package/src/components/ds-icon/ds-icon.tsx +10 -4
- package/src/components/ds-icon/ds-icon.types.ts +30 -0
- package/src/components/ds-key-value-pair/ds-key-value-pair.types.ts +12 -2
- package/src/components/ds-modal/ds-modal.types.ts +16 -0
- package/src/components/ds-panel/ds-panel.types.ts +39 -0
- package/src/components/ds-radio-group/ds-radio-group.module.scss +58 -56
- package/src/components/ds-radio-group/ds-radio-group.tsx +35 -28
- package/src/components/ds-radio-group/ds-radio-group.types.ts +38 -7
- package/src/components/ds-segment-group/ds-segment-group.types.ts +17 -0
- package/src/components/ds-select/ds-select.types.ts +32 -0
- package/src/components/ds-split-button/ds-split-button.module.scss +7 -7
- package/src/components/ds-split-button/ds-split-button.types.ts +28 -0
- package/src/components/ds-stack/ds-stack.types.ts +23 -0
- package/src/components/ds-stepper/ds-stepper.types.ts +34 -1
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.types.ts +27 -0
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.tsx +7 -4
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.types.ts +6 -0
- package/src/components/ds-table/components/ds-table-row-expandable-cell/ds-table-row-expandable-cell.types.ts +10 -0
- package/src/components/ds-table/components/ds-table-row-selectable-cell/ds-table-row-selectable-cell.types.ts +11 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.types.ts +27 -0
- package/src/components/ds-table/filters/types/filter-adapter.types.ts +6 -0
- package/src/components/ds-tag/ds-tag.types.ts +6 -0
- package/src/components/ds-tag-filter/ds-tag-filter.types.ts +16 -0
- package/src/components/ds-text-input/ds-text-input.types.ts +3 -0
- package/src/components/ds-time-picker/components/time-item/time-item.types.ts +19 -0
- package/src/components/ds-time-picker/components/time-scroller/time-scroller.types.ts +29 -0
- package/src/components/ds-time-picker/ds-time-picker.module.scss +7 -0
- package/src/components/ds-time-picker/ds-time-picker.tsx +8 -1
- package/src/components/ds-time-picker/ds-time-picker.types.ts +80 -0
- package/src/components/ds-tooltip/ds-tooltip.types.ts +6 -0
- package/src/components/ds-tree/ds-tree.types.ts +86 -4
- package/src/components/ds-typography/ds-typography.config.ts +46 -27
- package/src/components/ds-typography/ds-typography.tsx +22 -7
- package/src/components/ds-typography/ds-typography.types.ts +15 -4
- package/src/components/ds-workspace/ds-workspace.module.scss +55 -0
- package/src/components/ds-workspace/ds-workspace.tsx +37 -0
- package/src/components/ds-workspace/ds-workspace.types.ts +17 -0
- package/src/components/ds-workspace/index.ts +8 -0
- package/src/index.ts +2 -0
- package/src/styles/_grid.scss +7 -3
- package/src/styles/_mixin.scss +2 -2
- package/src/styles/_root_new.scss +449 -0
- package/src/styles/_scrollbars.scss +6 -1
- package/src/styles/shared/_input.scss +0 -2
- package/src/styles/styles.scss +1 -0
- package/src/styles/_root_updated.scss +0 -593
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
2
|
import { RadioGroup } from '@ark-ui/react/radio-group';
|
|
4
3
|
import classNames from 'classnames';
|
|
4
|
+
import { DsTypography } from '../ds-typography';
|
|
5
5
|
import styles from './ds-radio-group.module.scss';
|
|
6
6
|
import type {
|
|
7
7
|
DsRadioGroupItemProps,
|
|
@@ -47,13 +47,11 @@ const Item: React.FC<DsRadioGroupItemProps> = ({
|
|
|
47
47
|
</div>
|
|
48
48
|
</RadioGroup.ItemControl>
|
|
49
49
|
<RadioGroup.ItemHiddenInput />
|
|
50
|
-
{label ?
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{labelInfo
|
|
54
|
-
</
|
|
55
|
-
) : (
|
|
56
|
-
children
|
|
50
|
+
{label ? <RadioGroup.ItemText className={styles.radioLabel}>{label}</RadioGroup.ItemText> : children}
|
|
51
|
+
{!!labelInfo && (
|
|
52
|
+
<DsTypography variant="body-xs-reg" className={styles.labelInfo}>
|
|
53
|
+
{labelInfo}
|
|
54
|
+
</DsTypography>
|
|
57
55
|
)}
|
|
58
56
|
</RadioGroup.Item>
|
|
59
57
|
);
|
|
@@ -70,35 +68,44 @@ export const DsRadioGroupLegacy: React.FC<DsRadioGroupLegacyProps> = ({
|
|
|
70
68
|
value,
|
|
71
69
|
defaultValue,
|
|
72
70
|
onValueChange,
|
|
71
|
+
disabled,
|
|
73
72
|
className,
|
|
74
|
-
|
|
73
|
+
style,
|
|
75
74
|
}) => (
|
|
76
|
-
<
|
|
75
|
+
<RadioGroup.Root
|
|
77
76
|
className={classNames(styles.radioGroupRoot, className)}
|
|
78
|
-
|
|
77
|
+
style={style}
|
|
78
|
+
value={value ?? undefined}
|
|
79
79
|
defaultValue={defaultValue}
|
|
80
|
-
|
|
81
|
-
{
|
|
80
|
+
disabled={disabled}
|
|
81
|
+
onValueChange={(details) => {
|
|
82
|
+
if (details.value !== null) {
|
|
83
|
+
onValueChange?.(details.value);
|
|
84
|
+
}
|
|
85
|
+
}}
|
|
82
86
|
>
|
|
83
87
|
{options.map((option) => (
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
>
|
|
88
|
+
<RadioGroup.Item
|
|
89
|
+
key={option.value}
|
|
90
|
+
value={option.value}
|
|
91
|
+
disabled={option.disabled}
|
|
92
|
+
className={styles.radioItemContainer}
|
|
93
|
+
>
|
|
94
|
+
<RadioGroup.ItemControl className={styles.radioItem}>
|
|
91
95
|
<div className={styles.radioItemWrapper}>
|
|
92
|
-
<
|
|
96
|
+
<div className={styles.radioIndicator} data-part="indicator" />
|
|
93
97
|
</div>
|
|
94
|
-
</
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
</RadioGroup.ItemControl>
|
|
99
|
+
<RadioGroup.ItemHiddenInput />
|
|
100
|
+
<RadioGroup.ItemText className={styles.radioLabel}>{option.label}</RadioGroup.ItemText>
|
|
101
|
+
{!!option.labelInfo && (
|
|
102
|
+
<DsTypography variant="body-xs-reg" className={styles.labelInfo}>
|
|
103
|
+
{option.labelInfo}
|
|
104
|
+
</DsTypography>
|
|
105
|
+
)}
|
|
106
|
+
</RadioGroup.Item>
|
|
100
107
|
))}
|
|
101
|
-
</
|
|
108
|
+
</RadioGroup.Root>
|
|
102
109
|
);
|
|
103
110
|
/* c8 ignore stop */
|
|
104
111
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
2
|
import { type RadioGroupItemProps, type RadioGroupRootProps } from '@ark-ui/react/radio-group';
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -9,6 +8,28 @@ export interface DsRadioGroupRootProps extends Pick<
|
|
|
9
8
|
RadioGroupRootProps,
|
|
10
9
|
'id' | 'value' | 'defaultValue' | 'disabled' | 'name' | 'className' | 'style' | 'orientation' | 'children'
|
|
11
10
|
> {
|
|
11
|
+
/**
|
|
12
|
+
* Currently selected radio value (controlled). Pair with `onValueChange`.
|
|
13
|
+
*/
|
|
14
|
+
value?: RadioGroupRootProps['value'];
|
|
15
|
+
/**
|
|
16
|
+
* Initially selected radio value when uncontrolled.
|
|
17
|
+
*/
|
|
18
|
+
defaultValue?: RadioGroupRootProps['defaultValue'];
|
|
19
|
+
/**
|
|
20
|
+
* Whether the entire radio group is disabled.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
disabled?: RadioGroupRootProps['disabled'];
|
|
24
|
+
/**
|
|
25
|
+
* HTML name attribute applied to each radio input, used in form submissions.
|
|
26
|
+
*/
|
|
27
|
+
name?: RadioGroupRootProps['name'];
|
|
28
|
+
/**
|
|
29
|
+
* Layout orientation of the radio items.
|
|
30
|
+
* @default vertical
|
|
31
|
+
*/
|
|
32
|
+
orientation?: RadioGroupRootProps['orientation'];
|
|
12
33
|
/**
|
|
13
34
|
* Event handler called when the selected value changes
|
|
14
35
|
*/
|
|
@@ -22,6 +43,16 @@ export interface DsRadioGroupItemProps extends Pick<
|
|
|
22
43
|
RadioGroupItemProps,
|
|
23
44
|
'value' | 'disabled' | 'className' | 'style' | 'children'
|
|
24
45
|
> {
|
|
46
|
+
/**
|
|
47
|
+
* Underlying value submitted when this item is selected.
|
|
48
|
+
*/
|
|
49
|
+
value: RadioGroupItemProps['value'];
|
|
50
|
+
/**
|
|
51
|
+
* Whether this radio item is disabled. Takes precedence over the group-level
|
|
52
|
+
* `disabled` when the group is enabled.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
disabled?: RadioGroupItemProps['disabled'];
|
|
25
56
|
/**
|
|
26
57
|
* Optional label text for the radio item
|
|
27
58
|
*/
|
|
@@ -61,9 +92,7 @@ export interface DsRadioOptionLegacy<ValueType = string> {
|
|
|
61
92
|
* Use compound component pattern instead
|
|
62
93
|
* @deprecated
|
|
63
94
|
*/
|
|
64
|
-
export interface DsRadioGroupLegacyProps<
|
|
65
|
-
TOption extends DsRadioOptionLegacy = DsRadioOptionLegacy,
|
|
66
|
-
> extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {
|
|
95
|
+
export interface DsRadioGroupLegacyProps<TOption extends DsRadioOptionLegacy = DsRadioOptionLegacy> {
|
|
67
96
|
/**
|
|
68
97
|
* The radio group options
|
|
69
98
|
*/
|
|
@@ -78,16 +107,18 @@ export interface DsRadioGroupLegacyProps<
|
|
|
78
107
|
defaultValue?: TOption['value'];
|
|
79
108
|
/**
|
|
80
109
|
* Event handler called when the selected value changes
|
|
81
|
-
*
|
|
82
|
-
* @param value
|
|
83
110
|
*/
|
|
84
111
|
onValueChange?: (value: TOption['value']) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the entire radio group is disabled.
|
|
114
|
+
*/
|
|
115
|
+
disabled?: boolean;
|
|
85
116
|
/**
|
|
86
117
|
* Additional CSS class names
|
|
87
118
|
*/
|
|
88
119
|
className?: string;
|
|
89
120
|
/**
|
|
90
|
-
* Additional styles
|
|
121
|
+
* Additional inline styles
|
|
91
122
|
*/
|
|
92
123
|
style?: React.CSSProperties;
|
|
93
124
|
}
|
|
@@ -17,6 +17,23 @@ export interface DsSegmentGroupRootProps extends Pick<
|
|
|
17
17
|
SegmentGroupRootProps,
|
|
18
18
|
'value' | 'defaultValue' | 'disabled' | 'name' | 'className' | 'style' | 'children'
|
|
19
19
|
> {
|
|
20
|
+
/**
|
|
21
|
+
* Currently selected segment value (controlled). Pair with `onValueChange`.
|
|
22
|
+
*/
|
|
23
|
+
value?: SegmentGroupRootProps['value'];
|
|
24
|
+
/**
|
|
25
|
+
* Initially selected segment value when uncontrolled.
|
|
26
|
+
*/
|
|
27
|
+
defaultValue?: SegmentGroupRootProps['defaultValue'];
|
|
28
|
+
/**
|
|
29
|
+
* Whether the entire segment group is disabled.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
disabled?: SegmentGroupRootProps['disabled'];
|
|
33
|
+
/**
|
|
34
|
+
* HTML name attribute used when the group participates in a form submission.
|
|
35
|
+
*/
|
|
36
|
+
name?: SegmentGroupRootProps['name'];
|
|
20
37
|
/**
|
|
21
38
|
* Size variant of the segment group
|
|
22
39
|
* @default 'default'
|
|
@@ -65,18 +65,39 @@ export type DsSelectProps = {
|
|
|
65
65
|
renderOption?: (option: DsSelectOption) => ReactNode;
|
|
66
66
|
} & (
|
|
67
67
|
| {
|
|
68
|
+
/**
|
|
69
|
+
* When `false` or omitted, the select cannot be cleared. `onClear` is not
|
|
70
|
+
* accepted in this branch.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
68
73
|
clearable?: undefined | false;
|
|
69
74
|
onClear?: never;
|
|
70
75
|
}
|
|
71
76
|
| {
|
|
77
|
+
/**
|
|
78
|
+
* When `true`, renders a clear affordance on the trigger. Pair with `onClear`.
|
|
79
|
+
*/
|
|
72
80
|
clearable: true;
|
|
81
|
+
/**
|
|
82
|
+
* Called when the user clicks the clear affordance.
|
|
83
|
+
*/
|
|
73
84
|
onClear?: () => void;
|
|
74
85
|
}
|
|
75
86
|
) &
|
|
76
87
|
(
|
|
77
88
|
| {
|
|
89
|
+
/**
|
|
90
|
+
* Single-selection mode. When `false` or omitted, `value` is a single string.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
78
93
|
multiple?: undefined | false;
|
|
94
|
+
/**
|
|
95
|
+
* Currently selected option value (controlled).
|
|
96
|
+
*/
|
|
79
97
|
value: SelectOptionValue;
|
|
98
|
+
/**
|
|
99
|
+
* Called when the selection changes. Receives the newly selected option value.
|
|
100
|
+
*/
|
|
80
101
|
onValueChange?: (value: SelectOptionValue) => void;
|
|
81
102
|
/**
|
|
82
103
|
* Custom render function for the selected value in the trigger.
|
|
@@ -86,8 +107,19 @@ export type DsSelectProps = {
|
|
|
86
107
|
renderValue?: (selectedOption: DsSelectOption) => ReactNode;
|
|
87
108
|
}
|
|
88
109
|
| {
|
|
110
|
+
/**
|
|
111
|
+
* Multi-selection mode. When `true`, `value` is an array of selected option
|
|
112
|
+
* values and `onValueChange` receives the full updated array.
|
|
113
|
+
*/
|
|
89
114
|
multiple: true;
|
|
115
|
+
/**
|
|
116
|
+
* Currently selected option values (controlled).
|
|
117
|
+
*/
|
|
90
118
|
value: SelectOptionValue[];
|
|
119
|
+
/**
|
|
120
|
+
* Called when the selection changes. Receives the full updated array of
|
|
121
|
+
* selected values.
|
|
122
|
+
*/
|
|
91
123
|
onValueChange?: (value: SelectOptionValue[]) => void;
|
|
92
124
|
/**
|
|
93
125
|
* Custom render function for the selected value in the trigger.
|
|
@@ -49,11 +49,11 @@ $border-width: 1px;
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
&:not(:disabled):is(:hover, :active, [data-selected='true']) {
|
|
52
|
-
border-right-color: var(--border-
|
|
52
|
+
border-right-color: var(--border-secondary-hover);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
&:not(:disabled):focus-visible {
|
|
56
|
-
border-right-color: var(--border-
|
|
56
|
+
border-right-color: var(--border-inverse);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -74,8 +74,8 @@ $border-width: 1px;
|
|
|
74
74
|
left: -$divider-width;
|
|
75
75
|
z-index: $divider-z-index;
|
|
76
76
|
width: $divider-width;
|
|
77
|
-
padding: var(--
|
|
78
|
-
background-color: var(--background
|
|
77
|
+
padding: var(--3xs) 0;
|
|
78
|
+
background-color: var(--background);
|
|
79
79
|
|
|
80
80
|
@include when-button-highlighted {
|
|
81
81
|
display: none;
|
|
@@ -86,14 +86,14 @@ $border-width: 1px;
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
.divider {
|
|
89
|
-
background-color: var(--
|
|
89
|
+
background-color: var(--border-secondary);
|
|
90
90
|
width: $divider-width;
|
|
91
91
|
height: 100%;
|
|
92
92
|
|
|
93
93
|
@include when-button-disabled {
|
|
94
|
-
background-color: var(--border-
|
|
94
|
+
background-color: var(--border-disabled);
|
|
95
95
|
}
|
|
96
96
|
@include when-select-disabled {
|
|
97
|
-
background-color: var(--border-
|
|
97
|
+
background-color: var(--border-disabled);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -11,15 +11,43 @@ type ButtonSlotProps = Omit<DsButtonV3Props, 'variant' | 'color' | 'size'>;
|
|
|
11
11
|
type SelectSlotProps = DistributiveOmit<DsSelectProps, 'size'>;
|
|
12
12
|
|
|
13
13
|
export interface DsSplitButtonSlotProps {
|
|
14
|
+
/**
|
|
15
|
+
* Props forwarded to the primary action button (`DsButtonV3`). `variant`, `color`
|
|
16
|
+
* and `size` are controlled by the split button and cannot be overridden here.
|
|
17
|
+
*/
|
|
14
18
|
button: ButtonSlotProps;
|
|
19
|
+
/**
|
|
20
|
+
* Props forwarded to the dropdown select (`DsSelect`). `size` is controlled by
|
|
21
|
+
* the split button and cannot be overridden here.
|
|
22
|
+
*/
|
|
15
23
|
select: SelectSlotProps;
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
export interface DsSplitButtonProps {
|
|
27
|
+
/**
|
|
28
|
+
* Ref forwarded to the split-button wrapper element
|
|
29
|
+
*/
|
|
19
30
|
ref?: Ref<HTMLDivElement>;
|
|
31
|
+
/**
|
|
32
|
+
* Additional CSS class name applied to the wrapper element
|
|
33
|
+
*/
|
|
20
34
|
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Inline styles applied to the wrapper element
|
|
37
|
+
*/
|
|
21
38
|
style?: CSSProperties;
|
|
39
|
+
/**
|
|
40
|
+
* Visual size applied to both the button and select slots.
|
|
41
|
+
* @default medium
|
|
42
|
+
*/
|
|
22
43
|
size?: SplitButtonSize;
|
|
44
|
+
/**
|
|
45
|
+
* Whether both the button and the select are disabled.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
23
48
|
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Props forwarded to the internal button and select slots.
|
|
51
|
+
*/
|
|
24
52
|
slotProps: DsSplitButtonSlotProps;
|
|
25
53
|
}
|
|
@@ -4,12 +4,35 @@ type CSSProps = Properties<string | number>;
|
|
|
4
4
|
import type { CSSProperties, ReactNode, Ref } from 'react';
|
|
5
5
|
|
|
6
6
|
export interface DsStackProps {
|
|
7
|
+
/**
|
|
8
|
+
* Flex direction of the stack (maps to CSS `flex-direction`).
|
|
9
|
+
* @default row
|
|
10
|
+
*/
|
|
7
11
|
direction?: CSSProps['flexDirection'];
|
|
12
|
+
/**
|
|
13
|
+
* Space between children (maps to CSS `gap`). Accepts any valid CSS gap value,
|
|
14
|
+
* e.g. `8`, `'1rem'`, `'var(--ds-space-2)'`.
|
|
15
|
+
*/
|
|
8
16
|
gap?: CSSProps['gap'];
|
|
17
|
+
/**
|
|
18
|
+
* Cross-axis alignment of children (maps to CSS `align-items`).
|
|
19
|
+
*/
|
|
9
20
|
alignItems?: CSSProps['alignItems'];
|
|
21
|
+
/**
|
|
22
|
+
* Main-axis alignment of children (maps to CSS `justify-content`).
|
|
23
|
+
*/
|
|
10
24
|
justifyContent?: CSSProps['justifyContent'];
|
|
25
|
+
/**
|
|
26
|
+
* Flex shorthand applied to the stack itself (maps to CSS `flex`).
|
|
27
|
+
*/
|
|
11
28
|
flex?: CSSProps['flex'];
|
|
29
|
+
/**
|
|
30
|
+
* Whether and how children wrap onto multiple lines (maps to CSS `flex-wrap`).
|
|
31
|
+
*/
|
|
12
32
|
flexWrap?: CSSProps['flexWrap'];
|
|
33
|
+
/**
|
|
34
|
+
* Width of the stack container (maps to CSS `width`).
|
|
35
|
+
*/
|
|
13
36
|
width?: CSSProps['width'];
|
|
14
37
|
|
|
15
38
|
children?: ReactNode;
|
|
@@ -7,16 +7,49 @@ export type DsStepperOrientation = 'horizontal' | 'vertical';
|
|
|
7
7
|
|
|
8
8
|
export type DsStepperProps = PropsWithChildren<
|
|
9
9
|
{
|
|
10
|
+
/**
|
|
11
|
+
* Visual variant of the stepper. Currently only `single` is supported.
|
|
12
|
+
* @default single
|
|
13
|
+
*/
|
|
10
14
|
variant?: DsStepperVariant;
|
|
15
|
+
/**
|
|
16
|
+
* Layout orientation of the stepper.
|
|
17
|
+
* @default horizontal
|
|
18
|
+
*/
|
|
11
19
|
orientation?: DsStepperOrientation;
|
|
20
|
+
/**
|
|
21
|
+
* When `true`, renders the stepper as a floating overlay (typically pinned
|
|
22
|
+
* to the bottom of the viewport) instead of inline in the layout.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
12
25
|
floating?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Called when the final step completes (i.e., the user finishes the last step).
|
|
28
|
+
*/
|
|
13
29
|
onComplete?: steps.Props['onStepComplete'];
|
|
30
|
+
/**
|
|
31
|
+
* Zero-based index of the currently active step (controlled). Pair with
|
|
32
|
+
* `onStepChange`.
|
|
33
|
+
*/
|
|
14
34
|
activeStep?: steps.Props['step'];
|
|
35
|
+
/**
|
|
36
|
+
* Additional CSS class name applied to the stepper root.
|
|
37
|
+
*/
|
|
15
38
|
className?: string;
|
|
16
39
|
/**
|
|
17
40
|
* Optional actions rendered at the end of the stepper.
|
|
18
41
|
* Horizontal: displayed after the steps. Vertical: displayed at the bottom.
|
|
19
42
|
*/
|
|
20
43
|
actions?: ReactNode;
|
|
21
|
-
} & Pick<steps.Props, 'onStepChange' | 'count'>
|
|
44
|
+
} & Pick<steps.Props, 'onStepChange' | 'count'> & {
|
|
45
|
+
/**
|
|
46
|
+
* Called when the active step changes. Receives the zag-js step-change
|
|
47
|
+
* details including the new index.
|
|
48
|
+
*/
|
|
49
|
+
onStepChange?: steps.Props['onStepChange'];
|
|
50
|
+
/**
|
|
51
|
+
* Total number of steps in the stepper.
|
|
52
|
+
*/
|
|
53
|
+
count?: steps.Props['count'];
|
|
54
|
+
}
|
|
22
55
|
>;
|
|
@@ -2,12 +2,39 @@ import { type RefObject, type ReactNode } from 'react';
|
|
|
2
2
|
import { type RowSelectionState, type Table } from '@tanstack/react-table';
|
|
3
3
|
|
|
4
4
|
export interface DsTableBodyVirtualizedProps<TData> {
|
|
5
|
+
/**
|
|
6
|
+
* TanStack Table instance driving the body. Provides row models, visible rows,
|
|
7
|
+
* and column state.
|
|
8
|
+
*/
|
|
5
9
|
table: Table<TData>;
|
|
10
|
+
/**
|
|
11
|
+
* Ref to the scrollable container that hosts the virtualized rows. Required by
|
|
12
|
+
* the virtualizer to measure viewport size and listen for scroll events.
|
|
13
|
+
*/
|
|
6
14
|
tableContainerRef: RefObject<HTMLDivElement | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Optional content rendered in place of rows when the table has no data.
|
|
17
|
+
*/
|
|
7
18
|
emptyState?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Initial estimated row height in pixels. Used before actual rows are measured
|
|
21
|
+
* to compute the virtual scroll size.
|
|
22
|
+
*/
|
|
8
23
|
estimateSize: number;
|
|
24
|
+
/**
|
|
25
|
+
* Number of rows to render above and below the visible viewport to reduce
|
|
26
|
+
* flicker during fast scrolling.
|
|
27
|
+
* @default 5
|
|
28
|
+
*/
|
|
9
29
|
overscan?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Called on every scroll event with the current scroll metrics. Useful for
|
|
32
|
+
* infinite-scroll hooks and scroll-position indicators.
|
|
33
|
+
*/
|
|
10
34
|
onScroll?: (params: ScrollParams) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Current row selection state from TanStack Table. Used to style selected rows.
|
|
37
|
+
*/
|
|
11
38
|
rowSelection: RowSelectionState;
|
|
12
39
|
}
|
|
13
40
|
|
|
@@ -19,13 +19,16 @@ export const DsTableCell = <TData, TValue>({
|
|
|
19
19
|
primaryRowActions = [],
|
|
20
20
|
secondaryRowActions = [],
|
|
21
21
|
}: DsTableCellProps<TData, TValue>) => {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const visiblePrimary = primaryRowActions.filter((action) => !action.hidden?.(row.original));
|
|
23
|
+
const visibleSecondary = secondaryRowActions.filter((action) => !action.hidden?.(row.original));
|
|
24
|
+
|
|
25
|
+
if (visiblePrimary.length || visibleSecondary.length) {
|
|
26
|
+
const hasSecondaryRowActions = visibleSecondary.length > 0;
|
|
24
27
|
return (
|
|
25
28
|
<div className={styles.lastCell}>
|
|
26
29
|
<DsDefaultTableCell cell={cell} />
|
|
27
30
|
<div className={styles.cellActions}>
|
|
28
|
-
{
|
|
31
|
+
{visiblePrimary.map((action, i) => {
|
|
29
32
|
const isDisabled = action.disabled?.(row.original);
|
|
30
33
|
const label = typeof action.label === 'function' ? action.label(row.original) : action.label;
|
|
31
34
|
return (
|
|
@@ -67,7 +70,7 @@ export const DsTableCell = <TData, TValue>({
|
|
|
67
70
|
</button>
|
|
68
71
|
</DsDropdownMenu.Trigger>
|
|
69
72
|
<DsDropdownMenu.Content>
|
|
70
|
-
{
|
|
73
|
+
{visibleSecondary.map((action, i) => {
|
|
71
74
|
const label =
|
|
72
75
|
typeof action.label === 'function' ? action.label(row.original) : action.label;
|
|
73
76
|
const isDisabled = action.disabled?.(row.original);
|
|
@@ -20,6 +20,12 @@ export interface RowAction<TData> {
|
|
|
20
20
|
*/
|
|
21
21
|
tooltip?: string;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Optional function to determine if the action should be hidden for a specific row.
|
|
25
|
+
* When it returns `true`, the action is omitted from that row's menu. Takes precedence over `disabled`.
|
|
26
|
+
*/
|
|
27
|
+
hidden?: (row: TData) => boolean;
|
|
28
|
+
|
|
23
29
|
/**
|
|
24
30
|
* Optional function to determine if the action should be disabled for a specific row
|
|
25
31
|
*/
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import type { Row } from '@tanstack/react-table';
|
|
2
2
|
|
|
3
3
|
export interface DsTableRowExpandableCellProps<TData> {
|
|
4
|
+
/**
|
|
5
|
+
* TanStack Table row model for the parent row. Used to toggle the row's
|
|
6
|
+
* expanded state when the button is clicked.
|
|
7
|
+
*/
|
|
4
8
|
row: Row<TData>;
|
|
9
|
+
/**
|
|
10
|
+
* Additional CSS class name applied to the cell element.
|
|
11
|
+
*/
|
|
5
12
|
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Additional CSS class name applied to the expand/collapse button.
|
|
15
|
+
*/
|
|
6
16
|
buttonClassName?: string;
|
|
7
17
|
}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { Row } from '@tanstack/react-table';
|
|
2
2
|
|
|
3
3
|
export interface DsTableRowSelectableCellProps<TData> {
|
|
4
|
+
/**
|
|
5
|
+
* TanStack Table row model for the parent row. Used to toggle the row's
|
|
6
|
+
* selection state when the checkbox is clicked.
|
|
7
|
+
*/
|
|
4
8
|
row: Row<TData>;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the parent row is currently selected. Drives the checkbox's
|
|
11
|
+
* checked state.
|
|
12
|
+
*/
|
|
5
13
|
isSelected: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Additional CSS class name applied to the cell element.
|
|
16
|
+
*/
|
|
6
17
|
className?: string;
|
|
7
18
|
}
|
|
@@ -3,11 +3,38 @@ import { type Row } from '@tanstack/react-table';
|
|
|
3
3
|
import { type VirtualItem, type Virtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
|
|
5
5
|
export interface DsTableRowVirtualizedProps<TData> {
|
|
6
|
+
/**
|
|
7
|
+
* TanStack Table row model for this visual row.
|
|
8
|
+
*/
|
|
6
9
|
row: Row<TData>;
|
|
10
|
+
/**
|
|
11
|
+
* Whether this row is currently part of the selection.
|
|
12
|
+
*/
|
|
7
13
|
isSelected: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Shared ref that maps row ids to their rendered `<tr>` elements. The row
|
|
16
|
+
* registers itself here on mount so the virtualizer can measure heights and
|
|
17
|
+
* reference rows by id.
|
|
18
|
+
*/
|
|
8
19
|
rowsMapRef: RefObject<Map<string, HTMLTableRowElement>>;
|
|
20
|
+
/**
|
|
21
|
+
* Shared ref that caches the measured height of each row by id, so the
|
|
22
|
+
* virtualizer can preserve layout across remounts.
|
|
23
|
+
*/
|
|
9
24
|
rowHeightsMapRef: RefObject<Map<string, number>>;
|
|
25
|
+
/**
|
|
26
|
+
* TanStack virtualizer driving the scroll window for the table body.
|
|
27
|
+
*/
|
|
10
28
|
rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
|
|
29
|
+
/**
|
|
30
|
+
* Virtual item descriptor for this row (index, start, size) from the virtualizer.
|
|
31
|
+
*/
|
|
11
32
|
virtualRow: VirtualItem;
|
|
33
|
+
/**
|
|
34
|
+
* Whether this row renders expanded-row content (e.g., detail panel under the
|
|
35
|
+
* parent row) rather than a regular data row. Click handlers stop propagation
|
|
36
|
+
* when true to avoid triggering the parent's `onRowClick`.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
12
39
|
isExpandedRowContent?: boolean;
|
|
13
40
|
}
|
|
@@ -106,6 +106,12 @@ export interface FilterState<TValue> {
|
|
|
106
106
|
* Column filter for TanStack Table
|
|
107
107
|
*/
|
|
108
108
|
export interface ColumnFilterState<TValue> {
|
|
109
|
+
/**
|
|
110
|
+
* Column identifier this filter applies to (matches the column `accessorKey`).
|
|
111
|
+
*/
|
|
109
112
|
id: string;
|
|
113
|
+
/**
|
|
114
|
+
* Current filter value, passed to the column's filter function.
|
|
115
|
+
*/
|
|
110
116
|
value: TValue;
|
|
111
117
|
}
|
|
@@ -23,6 +23,9 @@ export interface DsTagProps {
|
|
|
23
23
|
* Locale object (you can pass custom strings for localization)
|
|
24
24
|
*/
|
|
25
25
|
locale?: {
|
|
26
|
+
/**
|
|
27
|
+
* aria-label for the delete button (shown when `onDelete` is provided).
|
|
28
|
+
*/
|
|
26
29
|
deleteAriaLabel?: string;
|
|
27
30
|
};
|
|
28
31
|
/**
|
|
@@ -58,6 +61,9 @@ export interface DsTagProps {
|
|
|
58
61
|
*/
|
|
59
62
|
disabled?: boolean;
|
|
60
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Optional render slots for customizing parts of the tag.
|
|
66
|
+
*/
|
|
61
67
|
slots?: {
|
|
62
68
|
/**
|
|
63
69
|
* Icon to display at the start of the input
|
|
@@ -22,6 +22,10 @@ export interface TagFilterItem {
|
|
|
22
22
|
* Additional props to pass to the components
|
|
23
23
|
*/
|
|
24
24
|
slotProps?: {
|
|
25
|
+
/**
|
|
26
|
+
* Props forwarded to the underlying `DsTag` rendered for this item. Useful
|
|
27
|
+
* for per-item overrides such as `variant` or `size`.
|
|
28
|
+
*/
|
|
25
29
|
tag?: Partial<DsTagProps>;
|
|
26
30
|
};
|
|
27
31
|
}
|
|
@@ -35,9 +39,21 @@ export interface DsTagFilterProps {
|
|
|
35
39
|
* Locale object (you can pass custom strings for localization)
|
|
36
40
|
*/
|
|
37
41
|
locale?: {
|
|
42
|
+
/**
|
|
43
|
+
* Heading label shown above the tag list (e.g., "Filters").
|
|
44
|
+
*/
|
|
38
45
|
label?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Label for the "Clear all" button.
|
|
48
|
+
*/
|
|
39
49
|
clearButton?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Label for the button that reveals hidden tags when the list overflows.
|
|
52
|
+
*/
|
|
40
53
|
showMore?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Label for the button that collapses the expanded list back to the preview.
|
|
56
|
+
*/
|
|
41
57
|
showLess?: string;
|
|
42
58
|
};
|
|
43
59
|
/**
|