@drivenets/design-system 0.15.0 → 0.16.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 +19 -0
- package/dist/index.cjs +868 -200
- package/dist/index.d.cts +810 -1181
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +810 -1181
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +852 -196
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +15 -13
- package/src/components/ds-alert-banner/ds-alert-banner.tsx +11 -2
- package/src/components/ds-autocomplete/ds-autocomplete.figma.ts +36 -0
- package/src/components/ds-autocomplete/ds-autocomplete.tsx +2 -0
- package/src/components/ds-avatar/ds-avatar.figma.ts +30 -0
- package/src/components/ds-avatar/ds-avatar.tsx +6 -1
- package/src/components/ds-avatar/ds-avatar.types.ts +5 -2
- package/src/components/ds-avatar-group/ds-avatar-group.figma.ts +27 -0
- package/src/components/ds-avatar-group/ds-avatar-group.tsx +6 -1
- package/src/components/ds-avatar-group/ds-avatar-group.types.ts +3 -1
- package/src/components/ds-breadcrumb/ds-breadcrumb.figma.ts +19 -0
- package/src/components/ds-breadcrumb/ds-breadcrumb.tsx +2 -0
- package/src/components/ds-button/ds-button.tsx +2 -0
- package/src/components/ds-button-v3/ds-button-v3.figma.ts +1 -1
- package/src/components/ds-button-v3/ds-button-v3.tsx +6 -0
- package/src/components/ds-button-v3/index.ts +2 -0
- package/src/components/ds-card/ds-card.tsx +7 -3
- package/src/components/ds-catalog-layout/ds-catalog-layout.tsx +8 -0
- package/src/components/ds-checkbox/ds-checkbox-level-2.figma.ts +40 -0
- package/src/components/ds-checkbox/ds-checkbox.figma.ts +45 -0
- package/src/components/ds-checkbox/ds-checkbox.module.scss +1 -1
- package/src/components/ds-checkbox/ds-checkbox.tsx +9 -1
- package/src/components/ds-checkbox-group/ds-checkbox-group.figma.ts +15 -0
- package/src/components/ds-checkbox-group/ds-checkbox-group.tsx +2 -0
- package/src/components/ds-chip/ds-chip.tsx +2 -0
- package/src/components/ds-chip-group/ds-chip-group.tsx +2 -0
- package/src/components/ds-comment-bubble/components/ds-comment-thread/ds-comment-thread.tsx +1 -0
- package/src/components/ds-comment-bubble/components/ds-thread-item/ds-thread-item.tsx +1 -0
- package/src/components/ds-comment-bubble/ds-comment-bubble.tsx +1 -0
- package/src/components/ds-comment-card/ds-comment-card.tsx +1 -0
- package/src/components/ds-comment-indicator/ds-comment-indicator.tsx +1 -0
- package/src/components/ds-comments-drawer/ds-comments-drawer.tsx +1 -0
- package/src/components/ds-confirmation/ds-confirmation.tsx +1 -0
- package/src/components/ds-date-input/ds-date-input.tsx +2 -0
- package/src/components/ds-date-picker/ds-date-picker.tsx +9 -0
- package/src/components/ds-date-picker/ds-date-picker.types.ts +1 -1
- package/src/components/ds-date-range-picker/ds-date-range-picker.tsx +2 -0
- package/src/components/ds-dialog/ds-dialog.tsx +9 -0
- package/src/components/ds-dialog/ds-dialog.types.ts +1 -1
- package/src/components/ds-divider/ds-divider.figma.ts +19 -0
- package/src/components/ds-divider/ds-divider.tsx +2 -0
- package/src/components/ds-drawer/ds-drawer.tsx +10 -0
- package/src/components/ds-drawer/figma/ds-drawer-content.figma.ts +15 -0
- package/src/components/ds-drawer/figma/ds-drawer-footer.figma.ts +19 -0
- package/src/components/ds-drawer/figma/ds-drawer-header.figma.ts +16 -0
- package/src/components/ds-drawer/figma/ds-drawer.figma.ts +36 -0
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.module.scss +12 -3
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +24 -6
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.types.ts +10 -1
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-footer.figma.ts +11 -0
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-group.figma.ts +23 -0
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-item.figma.ts +29 -0
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu-separator.figma.ts +11 -0
- package/src/components/ds-dropdown-menu/figma/ds-dropdown-menu.figma.ts +24 -0
- package/src/components/ds-expandable-text-input/ds-expandable-text-input.figma.ts +24 -0
- package/src/components/ds-expandable-text-input/ds-expandable-text-input.tsx +1 -0
- package/src/components/ds-file-upload/ds-file-upload.figma.ts +29 -0
- package/src/components/ds-file-upload/ds-file-upload.tsx +2 -0
- package/src/components/ds-filter-status-icon/ds-filter-status-icon.figma.ts +22 -0
- package/src/components/ds-filter-status-icon/ds-filter-status-icon.tsx +1 -0
- package/src/components/ds-form-control/ds-form-control.tsx +3 -0
- package/src/components/ds-grid/index.ts +3 -0
- package/src/components/ds-icon/ds-icon.tsx +2 -0
- package/src/components/ds-key-value-pair/ds-key-value-pair.figma.ts +24 -0
- package/src/components/ds-key-value-pair/ds-key-value-pair.tsx +2 -0
- package/src/components/ds-loader/ds-loader.figma.ts +11 -0
- package/src/components/ds-loader/ds-loader.tsx +2 -0
- package/src/components/ds-modal/ds-modal.tsx +9 -0
- package/src/components/ds-number-input/ds-number-input.tsx +2 -0
- package/src/components/ds-panel/ds-panel.figma.ts +16 -0
- package/src/components/ds-panel/index.ts +2 -0
- package/src/components/ds-password-input/ds-password-input.tsx +2 -0
- package/src/components/ds-popover/ds-popover.tsx +9 -0
- package/src/components/ds-popover/figma/ds-popover-content-item.figma.ts +18 -0
- package/src/components/ds-popover/figma/ds-popover-content.figma.ts +15 -0
- package/src/components/ds-popover/figma/ds-popover-footer.figma.ts +19 -0
- package/src/components/ds-popover/figma/ds-popover-header.figma.ts +16 -0
- package/src/components/ds-popover/figma/ds-popover.figma.ts +34 -0
- package/src/components/ds-progress-arc/ds-progress-arc.figma.ts +23 -0
- package/src/components/ds-progress-arc/ds-progress-arc.tsx +2 -0
- package/src/components/ds-progress-donut/ds-progress-donut.figma.ts +45 -0
- package/src/components/ds-progress-donut/ds-progress-donut.tsx +2 -0
- package/src/components/ds-progress-linear/ds-progress-linear.figma.ts +26 -0
- package/src/components/ds-progress-linear/ds-progress-linear.tsx +2 -0
- package/src/components/ds-progress-task-bar/ds-progress-task-bar.tsx +2 -0
- package/src/components/ds-radio-group/ds-radio-group.tsx +3 -0
- package/src/components/ds-radio-group/figma/ds-radio-group-item.figma.ts +24 -0
- package/src/components/ds-radio-group/figma/ds-radio-group.figma.ts +14 -0
- package/src/components/ds-segment-group/ds-segment-group.tsx +3 -0
- package/src/components/ds-segment-group/figma/ds-segment-group-item.figma.ts +25 -0
- package/src/components/ds-segment-group/figma/ds-segment-group.figma.ts +23 -0
- package/src/components/ds-select/ds-select.tsx +2 -0
- package/src/components/ds-site-node/ds-site-node.figma.ts +27 -0
- package/src/components/ds-site-node/ds-site-node.module.scss +59 -0
- package/src/components/ds-site-node/ds-site-node.tsx +73 -0
- package/src/components/ds-site-node/ds-site-node.types.ts +36 -0
- package/src/components/ds-site-node/hooks/use-is-overflowing.ts +31 -0
- package/src/components/ds-site-node/index.ts +3 -0
- package/src/components/ds-skeleton/ds-skeleton-circle.tsx +2 -0
- package/src/components/ds-skeleton/ds-skeleton-rect.tsx +2 -0
- package/src/components/ds-skeleton/ds-skeleton-text.tsx +2 -0
- package/src/components/ds-skeleton/ds-skeleton.ts +7 -1
- package/src/components/ds-smart-tabs/ds-smart-tabs.tsx +4 -0
- package/src/components/ds-spinner/ds-spinner.figma.ts +19 -0
- package/src/components/ds-spinner/ds-spinner.tsx +2 -0
- package/src/components/ds-split-button/ds-split-button.tsx +6 -0
- package/src/components/ds-status-badge/ds-status-badge.tsx +2 -0
- package/src/components/ds-status-badge-v2/index.ts +2 -0
- package/src/components/ds-stepper/components/ds-step-content.tsx +2 -0
- package/src/components/ds-stepper/components/ds-step-next-button.tsx +2 -0
- package/src/components/ds-stepper/components/ds-step.tsx +2 -0
- package/src/components/ds-stepper/ds-stepper.figma.ts +38 -0
- package/src/components/ds-stepper/ds-stepper.tsx +1 -0
- package/src/components/ds-system-status/ds-system-status.tsx +2 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-checkbox.tsx +1 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-date.tsx +1 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-number.tsx +1 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-select.tsx +1 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-text.tsx +1 -0
- package/src/components/ds-table/components/edit/ds-table-editable-cell/ds-table-editable-cell.tsx +1 -0
- package/src/components/ds-table/components/edit/ds-table-editing-cell/ds-table-editing-cell.tsx +1 -0
- package/src/components/ds-table/ds-table.tsx +2 -0
- package/src/components/ds-table/index.ts +3 -0
- package/src/components/ds-tabs/components/ds-tabs-content/ds-tabs-content.tsx +2 -0
- package/src/components/ds-tabs/components/ds-tabs-list/ds-tabs-list.tsx +2 -0
- package/src/components/ds-tabs/components/ds-tabs-tab/ds-tabs-tab.tsx +2 -0
- package/src/components/ds-tabs/ds-tabs.tsx +2 -0
- package/src/components/ds-tag/ds-tag.tsx +2 -0
- package/src/components/ds-tag-filter/ds-tag-filter.tsx +2 -0
- package/src/components/ds-text-input/ds-input-field-v02.figma.ts +87 -0
- package/src/components/ds-text-input/ds-text-input.tsx +2 -0
- package/src/components/ds-textarea/ds-textarea.tsx +2 -0
- package/src/components/ds-time-picker/ds-time-picker.tsx +2 -0
- package/src/components/ds-toast/ds-toast-context.tsx +1 -0
- package/src/components/ds-toast/ds-toast.figma.ts +34 -0
- package/src/components/ds-toast/ds-toast.tsx +3 -0
- package/src/components/ds-toggle/ds-toggle.figma.ts +39 -0
- package/src/components/ds-toggle/ds-toggle.tsx +2 -0
- package/src/components/ds-tooltip/ds-tooltip.figma.ts +16 -0
- package/src/components/ds-tooltip/ds-tooltip.module.scss +8 -1
- package/src/components/ds-tooltip/ds-tooltip.tsx +35 -15
- package/src/components/ds-tooltip/ds-tooltip.types.ts +40 -0
- package/src/components/ds-tree/ds-tree.tsx +16 -0
- package/src/components/ds-typography/ds-typography.config.ts +1 -1
- package/src/components/ds-typography/ds-typography.figma.ts +63 -0
- package/src/components/ds-typography/ds-typography.module.scss +16 -0
- package/src/components/ds-typography/ds-typography.tsx +64 -7
- package/src/components/ds-typography/ds-typography.types.ts +13 -0
- package/src/components/ds-typography/hooks/use-truncation.ts +151 -0
- package/src/components/ds-user-card/ds-user-card.figma.ts +16 -0
- package/src/components/ds-user-card/ds-user-card.module.scss +25 -0
- package/src/components/ds-user-card/ds-user-card.tsx +31 -0
- package/src/components/ds-user-card/ds-user-card.types.ts +26 -0
- package/src/components/ds-user-card/index.ts +2 -0
- package/src/components/ds-vertical-tabs/ds-vertical-tabs.tsx +6 -0
- package/src/components/ds-workspace-layout/ds-workspace-layout.tsx +10 -0
- package/src/index.ts +2 -0
- package/src/styles/_root.scss +468 -363
- package/src/styles/shared/_dropdown.scss +2 -2
- package/src/styles/styles.scss +0 -3
- package/src/styles/_colors.scss +0 -65
- package/src/styles/_root_new.scss +0 -451
- package/src/styles/_spacing.scss +0 -47
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15119-13518
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-spinner
|
|
3
|
+
// component=DsSpinner
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const size = instance.getEnum('Size', {
|
|
9
|
+
SM: 'small',
|
|
10
|
+
Default: 'medium',
|
|
11
|
+
LG: 'large',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
example: figma.code`<DsSpinner size="${size}" />`,
|
|
16
|
+
imports: ["import { DsSpinner } from '@drivenets/design-system'"],
|
|
17
|
+
id: 'ds-spinner',
|
|
18
|
+
metadata: { nestable: true },
|
|
19
|
+
};
|
|
@@ -4,6 +4,12 @@ import styles from './ds-split-button.module.scss';
|
|
|
4
4
|
import type { DsSplitButtonProps, SplitButtonSize } from './ds-split-button.types';
|
|
5
5
|
import { DsButtonV3 } from '../ds-button-v3';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Secondary action button paired with a dropdown select for choosing a related option.
|
|
9
|
+
* Both slots share a size and disabled state controlled by the split button.
|
|
10
|
+
*
|
|
11
|
+
* @summary split action button with a primary action and an option select
|
|
12
|
+
*/
|
|
7
13
|
const DsSplitButton = ({
|
|
8
14
|
ref,
|
|
9
15
|
className,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=29164-187694
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-stepper
|
|
3
|
+
// component=DsStepper
|
|
4
|
+
//
|
|
5
|
+
// `direction` maps to `orientation`. Figma's `type` (detailed|compact) is not a code prop:
|
|
6
|
+
// detailed steps carry a `description` on each `DsStepContent`, compact steps omit it. The
|
|
7
|
+
// steps are composed in code (`DsStep` > `DsStepContent` > `DsNextStepButton`), not derivable
|
|
8
|
+
// from Figma's step atoms, and `count` is data — so a representative two-step composition is
|
|
9
|
+
// emitted for the developer to extend (one `DsStep` per step). The panel-docked wrappers
|
|
10
|
+
// (`DAP_stepper-panel-*_v01`) are a `DsPanel` composition and are intentionally not connected;
|
|
11
|
+
// the stepper still resolves when nested inside them.
|
|
12
|
+
import figma from 'figma';
|
|
13
|
+
|
|
14
|
+
const instance = figma.selectedInstance;
|
|
15
|
+
|
|
16
|
+
const orientation =
|
|
17
|
+
instance.getEnum('direction', {
|
|
18
|
+
vertical: 'vertical',
|
|
19
|
+
horizontal: 'horizontal',
|
|
20
|
+
}) ?? 'vertical';
|
|
21
|
+
|
|
22
|
+
const detailed = instance.getEnum('type', { detailed: true, compact: false }) ?? true;
|
|
23
|
+
const description = detailed ? ' description="Step description"' : '';
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
example: figma.code`<DsStepper count={2} orientation="${orientation}">
|
|
27
|
+
<DsStep index={0}>
|
|
28
|
+
<DsStepContent index={0} label="Step title"${description} actions={<DsNextStepButton>Next</DsNextStepButton>} />
|
|
29
|
+
</DsStep>
|
|
30
|
+
<DsStep index={1}>
|
|
31
|
+
<DsStepContent index={1} label="Step title"${description} actions={<DsNextStepButton>Finish</DsNextStepButton>} />
|
|
32
|
+
</DsStep>
|
|
33
|
+
{/* Add a <DsStep> per step */}
|
|
34
|
+
</DsStepper>`,
|
|
35
|
+
imports: ["import { DsStepper, DsStep, DsStepContent, DsNextStepButton } from '@drivenets/design-system'"],
|
|
36
|
+
id: 'ds-stepper',
|
|
37
|
+
metadata: { nestable: true },
|
|
38
|
+
};
|
|
@@ -10,6 +10,9 @@ export type { DsTableEditDisabledResult } from './ds-table-column.types';
|
|
|
10
10
|
export { default as DsTable } from './ds-table';
|
|
11
11
|
export * from './ds-table.types';
|
|
12
12
|
|
|
13
|
+
export { createColumnHelper } from '@tanstack/react-table';
|
|
14
|
+
export type { ColumnDef } from '@tanstack/react-table';
|
|
15
|
+
|
|
13
16
|
export { useCellEditor } from './hooks/use-cell-editor';
|
|
14
17
|
export type {
|
|
15
18
|
UseCellEditorOptions,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=39475-58722
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-text-input
|
|
3
|
+
// component=DsTextInput
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
interface FieldInfo {
|
|
7
|
+
component: string;
|
|
8
|
+
fcMember?: string;
|
|
9
|
+
size?: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
data?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const textInfo: FieldInfo = { component: 'DsTextInput', fcMember: 'TextInput', size: true, readOnly: true };
|
|
16
|
+
|
|
17
|
+
const registry: Record<string, FieldInfo> = {
|
|
18
|
+
text: textInfo,
|
|
19
|
+
textArea: { component: 'DsTextarea', fcMember: 'Textarea' },
|
|
20
|
+
number: { component: 'DsNumberInput', fcMember: 'NumberInput', size: true, readOnly: true },
|
|
21
|
+
password: { component: 'DsPasswordInput', fcMember: 'PasswordInput', size: true, readOnly: true },
|
|
22
|
+
select: { component: 'DsSelect', fcMember: 'Select', invalid: true, data: 'options={[]} value=""' },
|
|
23
|
+
date: { component: 'DsDateInput', fcMember: 'DateInput' },
|
|
24
|
+
time: { component: 'DsTimePicker', fcMember: 'TimePicker' },
|
|
25
|
+
autocompleteSearch: {
|
|
26
|
+
component: 'DsAutocomplete',
|
|
27
|
+
invalid: true,
|
|
28
|
+
data: 'options={[]} showTrigger={false}',
|
|
29
|
+
},
|
|
30
|
+
autocompleteCombobox: { component: 'DsAutocomplete', invalid: true, data: 'options={[]}' },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const instance = figma.selectedInstance;
|
|
34
|
+
|
|
35
|
+
const size = instance.getEnum('size', {
|
|
36
|
+
small: 'small',
|
|
37
|
+
medium: 'medium',
|
|
38
|
+
large: 'large',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const state = instance.getEnum('state', {
|
|
42
|
+
default: 'default',
|
|
43
|
+
hover: 'hover',
|
|
44
|
+
focus: 'focus',
|
|
45
|
+
disabled: 'disabled',
|
|
46
|
+
'read-only': 'readOnly',
|
|
47
|
+
error: 'error',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const part = instance.findInstance('DAP-part_InputType_v01', { traverseInstances: true });
|
|
51
|
+
const inputType =
|
|
52
|
+
(part.type === 'INSTANCE'
|
|
53
|
+
? part.getEnum('inputType', {
|
|
54
|
+
text: 'text',
|
|
55
|
+
'text-area': 'textArea',
|
|
56
|
+
select: 'select',
|
|
57
|
+
password: 'password',
|
|
58
|
+
number: 'number',
|
|
59
|
+
date: 'date',
|
|
60
|
+
time: 'time',
|
|
61
|
+
'autocomplete-search': 'autocompleteSearch',
|
|
62
|
+
'autocomplete-combobox': 'autocompleteCombobox',
|
|
63
|
+
})
|
|
64
|
+
: 'text') ?? 'text';
|
|
65
|
+
|
|
66
|
+
const info = registry[inputType] ?? textInfo;
|
|
67
|
+
|
|
68
|
+
const disabled = state === 'disabled';
|
|
69
|
+
const readOnly = state === 'readOnly';
|
|
70
|
+
const error = state === 'error';
|
|
71
|
+
|
|
72
|
+
const attrs = [
|
|
73
|
+
info.size && size === 'small' ? 'size="small"' : '',
|
|
74
|
+
info.data ?? '',
|
|
75
|
+
disabled ? 'disabled' : '',
|
|
76
|
+
info.readOnly && readOnly ? 'readOnly' : '',
|
|
77
|
+
info.invalid && error ? 'invalid' : '',
|
|
78
|
+
]
|
|
79
|
+
.filter(Boolean)
|
|
80
|
+
.join(' ');
|
|
81
|
+
|
|
82
|
+
export default {
|
|
83
|
+
example: figma.code`<${info.component} ${attrs} />`,
|
|
84
|
+
imports: [`import { ${info.component} } from '@drivenets/design-system'`],
|
|
85
|
+
id: 'ds-input-field-v02',
|
|
86
|
+
metadata: { nestable: true, props: { fcMember: info.fcMember, fcProps: attrs } },
|
|
87
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15100-3016
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-toast
|
|
3
|
+
// component=DsToast
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const variant = instance.getEnum('Type', {
|
|
9
|
+
info: 'info',
|
|
10
|
+
success: 'success',
|
|
11
|
+
warning: 'warning',
|
|
12
|
+
error: 'error',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const extended = instance.getEnum('Extended', { True: true, False: false });
|
|
16
|
+
const cta = instance.getEnum('CTA', { True: true, False: false });
|
|
17
|
+
|
|
18
|
+
const titleLine = extended ? `\n\ttitle: 'Title',` : '';
|
|
19
|
+
const actionsLine = cta ? `\n\tactions: <DsButtonV3 variant="secondary">Action</DsButtonV3>,` : '';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
example: figma.code`const { createToast } = useToaster();
|
|
23
|
+
|
|
24
|
+
createToast({
|
|
25
|
+
variant: '${variant}',${titleLine}
|
|
26
|
+
description: 'Description',${actionsLine}
|
|
27
|
+
});`,
|
|
28
|
+
imports: [
|
|
29
|
+
"import { useToaster } from '@drivenets/design-system'",
|
|
30
|
+
"import { DsButtonV3 } from '@drivenets/design-system'",
|
|
31
|
+
],
|
|
32
|
+
id: 'ds-toast',
|
|
33
|
+
metadata: { nestable: false },
|
|
34
|
+
};
|
|
@@ -51,4 +51,7 @@ const DsToastGroup: React.FC<{ toaster: CreateToasterReturn }> = ({ toaster }) =
|
|
|
51
51
|
return <Toaster toaster={toaster}>{(toast: DsToastProps) => <DsToast {...toast} />}</Toaster>;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
DsToast.displayName = 'DsToast';
|
|
55
|
+
DsToastGroup.displayName = 'DsToastGroup';
|
|
56
|
+
|
|
54
57
|
export { DsToast, DsToastGroup };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15035-29699
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-toggle
|
|
3
|
+
// component=DsToggle
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const on = instance.getEnum('On', {
|
|
9
|
+
Yes: 'yes',
|
|
10
|
+
No: 'no',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const size = instance.getEnum('Size', {
|
|
14
|
+
Default: 'default',
|
|
15
|
+
Small: 'small',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const state = instance.getEnum('State', {
|
|
19
|
+
Default: 'default',
|
|
20
|
+
Hover: 'hover',
|
|
21
|
+
Focus: 'focus',
|
|
22
|
+
Disabled: 'disabled',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const attrs = [
|
|
26
|
+
'label="Label"',
|
|
27
|
+
size === 'small' ? 'size="small"' : '',
|
|
28
|
+
on === 'yes' ? 'checked' : '',
|
|
29
|
+
state === 'disabled' ? 'disabled' : '',
|
|
30
|
+
]
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.join(' ');
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
example: figma.code`<DsToggle ${attrs} />`,
|
|
36
|
+
imports: ["import { DsToggle } from '@drivenets/design-system'"],
|
|
37
|
+
id: 'ds-toggle',
|
|
38
|
+
metadata: { nestable: true },
|
|
39
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=14845-9203
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-tooltip
|
|
3
|
+
// component=DsTooltip
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const labelNode = instance.findText('Tooltip', { traverseInstances: true });
|
|
9
|
+
const content = labelNode.type === 'TEXT' ? labelNode.textContent : 'Tooltip text';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
example: figma.code`<DsTooltip content="${content}">{/* trigger element */}</DsTooltip>`,
|
|
13
|
+
imports: ["import { DsTooltip } from '@drivenets/design-system'"],
|
|
14
|
+
id: 'ds-tooltip',
|
|
15
|
+
metadata: { nestable: false },
|
|
16
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
@use '../../styles/typography';
|
|
2
|
+
|
|
1
3
|
.tooltip {
|
|
4
|
+
--arrow-size: 7px;
|
|
2
5
|
color: var(--font-on-action);
|
|
3
6
|
background-color: var(--background-brand);
|
|
4
7
|
padding: var(--xs) var(--sm);
|
|
@@ -8,6 +11,10 @@
|
|
|
8
11
|
z-index: 9999;
|
|
9
12
|
}
|
|
10
13
|
|
|
14
|
+
.text {
|
|
15
|
+
@include typography.body-xs-reg;
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
.arrow {
|
|
12
|
-
|
|
19
|
+
--arrow-background: var(--color-dap-gray-700);
|
|
13
20
|
}
|
|
@@ -1,33 +1,53 @@
|
|
|
1
1
|
import { type FC, isValidElement } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { Tooltip } from '@ark-ui/react/tooltip';
|
|
3
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import styles from './ds-tooltip.module.scss';
|
|
5
6
|
import type { DsTooltipProps } from './ds-tooltip.types';
|
|
6
|
-
import { DsTypography } from '../ds-typography';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const OPEN_DELAY_MS = 200;
|
|
9
|
+
const CLOSE_DELAY_MS = 0;
|
|
10
|
+
const TOOLTIP_GUTTER_PX = 0;
|
|
11
|
+
|
|
12
|
+
const DsTooltip: FC<DsTooltipProps> = ({
|
|
13
|
+
content,
|
|
14
|
+
children,
|
|
15
|
+
placement = 'top',
|
|
16
|
+
disabled = false,
|
|
17
|
+
getAnchorRect,
|
|
18
|
+
slotProps,
|
|
19
|
+
}) => {
|
|
9
20
|
if (content === undefined) {
|
|
10
21
|
return children;
|
|
11
22
|
}
|
|
23
|
+
|
|
12
24
|
return (
|
|
13
|
-
<Tooltip.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
<Tooltip.Root
|
|
26
|
+
openDelay={OPEN_DELAY_MS}
|
|
27
|
+
closeDelay={CLOSE_DELAY_MS}
|
|
28
|
+
disabled={disabled}
|
|
29
|
+
positioning={{ placement, gutter: TOOLTIP_GUTTER_PX, getAnchorRect: getAnchorRect ?? undefined }}
|
|
30
|
+
lazyMount
|
|
31
|
+
unmountOnExit
|
|
32
|
+
>
|
|
33
|
+
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
|
34
|
+
<Portal>
|
|
35
|
+
<Tooltip.Positioner>
|
|
17
36
|
<Tooltip.Content
|
|
18
37
|
className={classNames(styles.tooltip, slotProps?.content?.className)}
|
|
19
38
|
style={slotProps?.content?.style}
|
|
20
|
-
side="top"
|
|
21
|
-
align="center"
|
|
22
|
-
sideOffset={4}
|
|
23
39
|
>
|
|
24
|
-
{isValidElement(content) ? content : <
|
|
25
|
-
<Tooltip.Arrow className={styles.arrow}
|
|
40
|
+
{isValidElement(content) ? content : <span className={styles.text}>{content}</span>}
|
|
41
|
+
<Tooltip.Arrow className={styles.arrow}>
|
|
42
|
+
<Tooltip.ArrowTip />
|
|
43
|
+
</Tooltip.Arrow>
|
|
26
44
|
</Tooltip.Content>
|
|
27
|
-
</Tooltip.
|
|
28
|
-
</
|
|
29
|
-
</Tooltip.
|
|
45
|
+
</Tooltip.Positioner>
|
|
46
|
+
</Portal>
|
|
47
|
+
</Tooltip.Root>
|
|
30
48
|
);
|
|
31
49
|
};
|
|
32
50
|
|
|
51
|
+
DsTooltip.displayName = 'DsTooltip';
|
|
52
|
+
|
|
33
53
|
export default DsTooltip;
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
+
export const tooltipPlacements = [
|
|
4
|
+
'top',
|
|
5
|
+
'top-start',
|
|
6
|
+
'top-end',
|
|
7
|
+
'bottom',
|
|
8
|
+
'bottom-start',
|
|
9
|
+
'bottom-end',
|
|
10
|
+
'left',
|
|
11
|
+
'left-start',
|
|
12
|
+
'left-end',
|
|
13
|
+
'right',
|
|
14
|
+
'right-start',
|
|
15
|
+
'right-end',
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
export type TooltipPlacement = (typeof tooltipPlacements)[number];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Viewport-relative rect (CSS pixels) the tooltip anchors to, instead of the trigger.
|
|
22
|
+
*/
|
|
23
|
+
export interface TooltipAnchorRect {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
3
30
|
export interface DsTooltipProps {
|
|
4
31
|
/**
|
|
5
32
|
* Tooltip content
|
|
@@ -9,6 +36,19 @@ export interface DsTooltipProps {
|
|
|
9
36
|
* The content to be rendered inside the tooltip
|
|
10
37
|
*/
|
|
11
38
|
children: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Placement relative to the trigger; `-start` / `-end` align to that edge.
|
|
41
|
+
*/
|
|
42
|
+
placement?: TooltipPlacement;
|
|
43
|
+
/**
|
|
44
|
+
* When true the trigger renders but the tooltip never opens.
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Anchors the tooltip to a virtual rect instead of the trigger, re-evaluated on
|
|
49
|
+
* each reposition. Return `null` to fall back to the trigger.
|
|
50
|
+
*/
|
|
51
|
+
getAnchorRect?: () => TooltipAnchorRect | null;
|
|
12
52
|
/**
|
|
13
53
|
* Props forwarded to nested sub-components.
|
|
14
54
|
*/
|
|
@@ -153,6 +153,22 @@ const DsTreeItemAction = ({ className, style, children, onClick }: DsTreeItemAct
|
|
|
153
153
|
</button>
|
|
154
154
|
);
|
|
155
155
|
|
|
156
|
+
DsTreeRoot.displayName = 'DsTree.Root';
|
|
157
|
+
DsTreeTree.displayName = 'DsTree.Tree';
|
|
158
|
+
Object.defineProperty(TreeView.NodeProvider, 'displayName', { value: 'DsTree.NodeProvider' });
|
|
159
|
+
Object.defineProperty(TreeView.NodeContext, 'displayName', { value: 'DsTree.NodeContext' });
|
|
160
|
+
DsTreeBranch.displayName = 'DsTree.Branch';
|
|
161
|
+
DsTreeBranchControl.displayName = 'DsTree.BranchControl';
|
|
162
|
+
DsTreeBranchIndicator.displayName = 'DsTree.BranchIndicator';
|
|
163
|
+
DsTreeBranchText.displayName = 'DsTree.BranchText';
|
|
164
|
+
DsTreeBranchContent.displayName = 'DsTree.BranchContent';
|
|
165
|
+
DsTreeBranchIndentGuide.displayName = 'DsTree.BranchIndentGuide';
|
|
166
|
+
DsTreeItem.displayName = 'DsTree.Item';
|
|
167
|
+
DsTreeItemText.displayName = 'DsTree.ItemText';
|
|
168
|
+
DsTreeItemIndicator.displayName = 'DsTree.ItemIndicator';
|
|
169
|
+
DsTreeItemAction.displayName = 'DsTree.ItemAction';
|
|
170
|
+
DsTreeNodeCheckbox.displayName = 'DsTree.NodeCheckbox';
|
|
171
|
+
|
|
156
172
|
export const DsTree = {
|
|
157
173
|
Root: DsTreeRoot,
|
|
158
174
|
Tree: DsTreeTree,
|
|
@@ -30,7 +30,7 @@ export const typographyVariantConfig = {
|
|
|
30
30
|
heading4: { element: 'h4', component: ark.h4 },
|
|
31
31
|
} as const;
|
|
32
32
|
|
|
33
|
-
/** Semantic text colors backed by `--font-*` tokens in `
|
|
33
|
+
/** Semantic text colors backed by `--font-*` tokens in `_root.scss`. */
|
|
34
34
|
export const typographyColors = [
|
|
35
35
|
'main',
|
|
36
36
|
'secondary',
|