@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
|
@@ -146,6 +146,15 @@ const DsPopoverLegacy = ({
|
|
|
146
146
|
</DsPopoverRoot>
|
|
147
147
|
);
|
|
148
148
|
|
|
149
|
+
DsPopoverLegacy.displayName = 'DsPopover';
|
|
150
|
+
DsPopoverRoot.displayName = 'DsPopover.Root';
|
|
151
|
+
DsPopoverTrigger.displayName = 'DsPopover.Trigger';
|
|
152
|
+
DsPopoverPanel.displayName = 'DsPopover.Panel';
|
|
153
|
+
DsPopoverHeader.displayName = 'DsPopover.Header';
|
|
154
|
+
DsPopoverContent.displayName = 'DsPopover.Content';
|
|
155
|
+
DsPopoverContentItem.displayName = 'DsPopover.ContentItem';
|
|
156
|
+
DsPopoverFooter.displayName = 'DsPopover.Footer';
|
|
157
|
+
|
|
149
158
|
export const DsPopover = Object.assign(DsPopoverLegacy, {
|
|
150
159
|
Root: DsPopoverRoot,
|
|
151
160
|
Trigger: DsPopoverTrigger,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=37891-84870
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-popover
|
|
3
|
+
// component=DsPopover.ContentItem
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const headlineNode = instance.findText('Content-item-headline', { traverseInstances: true });
|
|
9
|
+
const headlineAttr = headlineNode.type === 'TEXT' ? ` headline="${headlineNode.textContent}"` : '';
|
|
10
|
+
|
|
11
|
+
const body = instance.getSlot('Slot');
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
example: figma.code`<DsPopover.ContentItem${headlineAttr}>${body}</DsPopover.ContentItem>`,
|
|
15
|
+
imports: ["import { DsPopover } from '@drivenets/design-system'"],
|
|
16
|
+
id: 'ds-popover-content-item',
|
|
17
|
+
metadata: { nestable: true },
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=37891-84883
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-popover
|
|
3
|
+
// component=DsPopover.Content
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const items = instance.getSlot('Slot');
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
example: figma.code`<DsPopover.Content>${items}</DsPopover.Content>`,
|
|
12
|
+
imports: ["import { DsPopover } from '@drivenets/design-system'"],
|
|
13
|
+
id: 'ds-popover-content',
|
|
14
|
+
metadata: { nestable: true },
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=37891-84845
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-popover
|
|
3
|
+
// component=DsPopover.Footer
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const button = instance.findInstance('DAP_Button_v03', { traverseInstances: true });
|
|
9
|
+
let buttonCode: figma.ResultSection[] | undefined;
|
|
10
|
+
if (button.type === 'INSTANCE') {
|
|
11
|
+
buttonCode = button.executeTemplate().example;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
example: figma.code`<DsPopover.Footer>${buttonCode}</DsPopover.Footer>`,
|
|
16
|
+
imports: ["import { DsPopover } from '@drivenets/design-system'"],
|
|
17
|
+
id: 'ds-popover-footer',
|
|
18
|
+
metadata: { nestable: true },
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=37891-11066
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-popover
|
|
3
|
+
// component=DsPopover.Header
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const titleNode = instance.findText('Title', { traverseInstances: true });
|
|
9
|
+
const title = titleNode.type === 'TEXT' ? titleNode.textContent : 'Popover title';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
example: figma.code`<DsPopover.Header>${title}</DsPopover.Header>`,
|
|
13
|
+
imports: ["import { DsPopover } from '@drivenets/design-system'"],
|
|
14
|
+
id: 'ds-popover-header',
|
|
15
|
+
metadata: { nestable: true },
|
|
16
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=37891-84942
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-popover
|
|
3
|
+
// component=DsPopover
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const header = instance.findInstance('DAP_popover-header_v01', { traverseInstances: true });
|
|
9
|
+
let headerCode: figma.ResultSection[] | undefined;
|
|
10
|
+
if (header.type === 'INSTANCE') {
|
|
11
|
+
headerCode = header.executeTemplate().example;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const content = instance.findInstance('DAP_popover-content_v01', { traverseInstances: true });
|
|
15
|
+
let contentCode: figma.ResultSection[] | undefined;
|
|
16
|
+
if (content.type === 'INSTANCE') {
|
|
17
|
+
contentCode = content.executeTemplate().example;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const footer = instance.findInstance('DAP_popover-footer_v01', { traverseInstances: true });
|
|
21
|
+
let footerCode: figma.ResultSection[] | undefined;
|
|
22
|
+
if (footer.type === 'INSTANCE') {
|
|
23
|
+
footerCode = footer.executeTemplate().example;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
example: figma.code`<DsPopover.Root>
|
|
28
|
+
<DsPopover.Trigger>{/* trigger element */}</DsPopover.Trigger>
|
|
29
|
+
<DsPopover.Panel>${headerCode}${contentCode}${footerCode}</DsPopover.Panel>
|
|
30
|
+
</DsPopover.Root>`,
|
|
31
|
+
imports: ["import { DsPopover } from '@drivenets/design-system'"],
|
|
32
|
+
id: 'ds-popover',
|
|
33
|
+
metadata: { nestable: false },
|
|
34
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15179-8747
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-progress-arc
|
|
3
|
+
// component=DsProgressArc
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const size = instance.getEnum('Size', {
|
|
9
|
+
small: 'small',
|
|
10
|
+
medium: 'medium',
|
|
11
|
+
});
|
|
12
|
+
const variant = instance.getEnum('State', {
|
|
13
|
+
fill: 'default',
|
|
14
|
+
success: 'success',
|
|
15
|
+
error: 'error',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
example: figma.code`<DsProgressArc variant="${variant}" size="${size}" value={0} />`,
|
|
20
|
+
imports: ["import { DsProgressArc } from '@drivenets/design-system'"],
|
|
21
|
+
id: 'ds-progress-arc',
|
|
22
|
+
metadata: { nestable: false },
|
|
23
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15179-8570
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-progress-donut
|
|
3
|
+
// component=DsProgressDonut
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const size = instance.getEnum('Size', {
|
|
9
|
+
small: 'small',
|
|
10
|
+
medium: 'medium',
|
|
11
|
+
});
|
|
12
|
+
const variant = instance.getEnum('Status', {
|
|
13
|
+
'fill 10%': 'default',
|
|
14
|
+
'fill 20%': 'default',
|
|
15
|
+
'fill 30%': 'default',
|
|
16
|
+
'fill 40%': 'default',
|
|
17
|
+
'fill 50%': 'default',
|
|
18
|
+
'fill 60%': 'default',
|
|
19
|
+
'fill 70%': 'default',
|
|
20
|
+
'fill 80%': 'default',
|
|
21
|
+
'fill 90%': 'default',
|
|
22
|
+
Success: 'success',
|
|
23
|
+
success: 'success',
|
|
24
|
+
error: 'error',
|
|
25
|
+
failed: 'error',
|
|
26
|
+
});
|
|
27
|
+
const value = instance.getEnum('Status', {
|
|
28
|
+
'fill 10%': 10,
|
|
29
|
+
'fill 20%': 20,
|
|
30
|
+
'fill 30%': 30,
|
|
31
|
+
'fill 40%': 40,
|
|
32
|
+
'fill 50%': 50,
|
|
33
|
+
'fill 60%': 60,
|
|
34
|
+
'fill 70%': 70,
|
|
35
|
+
'fill 80%': 80,
|
|
36
|
+
'fill 90%': 90,
|
|
37
|
+
});
|
|
38
|
+
const valueProp = typeof value === 'number' ? ` value={${String(value)}}` : '';
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
example: figma.code`<DsProgressDonut variant="${variant}" size="${size}"${valueProp} />`,
|
|
42
|
+
imports: ["import { DsProgressDonut } from '@drivenets/design-system'"],
|
|
43
|
+
id: 'ds-progress-donut',
|
|
44
|
+
metadata: { nestable: false },
|
|
45
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15179-12155
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-progress-linear
|
|
3
|
+
// component=DsProgressLinear
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const size = instance.getEnum('Size', {
|
|
9
|
+
Small: 'small',
|
|
10
|
+
Medium: 'medium',
|
|
11
|
+
Large: 'large',
|
|
12
|
+
});
|
|
13
|
+
const variant = instance.getEnum('Type', {
|
|
14
|
+
initial: 'initial',
|
|
15
|
+
progress: 'progress',
|
|
16
|
+
interrupted: 'interrupted',
|
|
17
|
+
success: 'success',
|
|
18
|
+
error: 'error',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
example: figma.code`<DsProgressLinear variant="${variant}" size="${size}" value={0} />`,
|
|
23
|
+
imports: ["import { DsProgressLinear } from '@drivenets/design-system'"],
|
|
24
|
+
id: 'ds-progress-linear',
|
|
25
|
+
metadata: { nestable: false },
|
|
26
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=32934-446
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-radio-group
|
|
3
|
+
// component=DsRadioGroup.Item
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const state = instance.getEnum('state', {
|
|
9
|
+
default: 'default',
|
|
10
|
+
hover: 'hover',
|
|
11
|
+
focus: 'focus',
|
|
12
|
+
disabled: 'disabled',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const attrs = ['value="option"', 'label="Option"', state === 'disabled' ? 'disabled' : '']
|
|
16
|
+
.filter(Boolean)
|
|
17
|
+
.join(' ');
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
example: figma.code`<DsRadioGroup.Item ${attrs} />`,
|
|
21
|
+
imports: ["import { DsRadioGroup } from '@drivenets/design-system'"],
|
|
22
|
+
id: 'ds-radio-group-item',
|
|
23
|
+
metadata: { nestable: true },
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=34864-124515
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-radio-group
|
|
3
|
+
// component=DsRadioGroup.Root
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
example: figma.code`<DsRadioGroup.Root>
|
|
8
|
+
<DsRadioGroup.Item value="option-1" label="Option 1" />
|
|
9
|
+
<DsRadioGroup.Item value="option-2" label="Option 2" />
|
|
10
|
+
</DsRadioGroup.Root>`,
|
|
11
|
+
imports: ["import { DsRadioGroup } from '@drivenets/design-system'"],
|
|
12
|
+
id: 'ds-radio-group',
|
|
13
|
+
metadata: { nestable: false },
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15094-6249
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-segment-group
|
|
3
|
+
// component=DsSegmentGroup.Item
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const state = instance.getEnum('State', {
|
|
9
|
+
Default: 'default',
|
|
10
|
+
Hover: 'hover',
|
|
11
|
+
Pressed: 'pressed',
|
|
12
|
+
Focus: 'focus',
|
|
13
|
+
Disabled: 'disabled',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const attrs = ['value="option"', 'label="Option"', state === 'disabled' ? 'disabled' : '']
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(' ');
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
example: figma.code`<DsSegmentGroup.Item ${attrs} />`,
|
|
22
|
+
imports: ["import { DsSegmentGroup } from '@drivenets/design-system'"],
|
|
23
|
+
id: 'ds-segment-group-item',
|
|
24
|
+
metadata: { nestable: true },
|
|
25
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15094-8569
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-segment-group
|
|
3
|
+
// component=DsSegmentGroup.Root
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const size = instance.getEnum('Size', {
|
|
9
|
+
medium: 'medium',
|
|
10
|
+
small: 'small',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const sizeAttr = size === 'small' ? ' size="small"' : '';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
example: figma.code`<DsSegmentGroup.Root${sizeAttr}>
|
|
17
|
+
<DsSegmentGroup.Item value="option-1" label="Option 1" />
|
|
18
|
+
<DsSegmentGroup.Item value="option-2" label="Option 2" />
|
|
19
|
+
</DsSegmentGroup.Root>`,
|
|
20
|
+
imports: ["import { DsSegmentGroup } from '@drivenets/design-system'"],
|
|
21
|
+
id: 'ds-segment-group',
|
|
22
|
+
metadata: { nestable: false },
|
|
23
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=39525-181
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-site-node
|
|
3
|
+
// component=DsSiteNode
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const state = instance.getEnum('State', {
|
|
9
|
+
Default: 'default',
|
|
10
|
+
Selected: 'selected',
|
|
11
|
+
Muted: 'muted',
|
|
12
|
+
Overflow: 'overflow',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const tier = instance.getString('Tier');
|
|
16
|
+
const siteCode = instance.getString('Site code');
|
|
17
|
+
const overflowLabel = instance.getString('Overflow label');
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
example:
|
|
21
|
+
state === 'overflow'
|
|
22
|
+
? figma.code`<DsSiteNode state="${state}" overflowLabel="${overflowLabel}" />`
|
|
23
|
+
: figma.code`<DsSiteNode state="${state}" tier="${tier}" siteCode="${siteCode}" />`,
|
|
24
|
+
imports: ["import { DsSiteNode } from '@drivenets/design-system'"],
|
|
25
|
+
id: 'ds-site-node',
|
|
26
|
+
metadata: { nestable: true },
|
|
27
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
$node-width: 140px;
|
|
2
|
+
$node-radius: 8px;
|
|
3
|
+
$overflow-height: 70px;
|
|
4
|
+
|
|
5
|
+
.node {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
width: $node-width;
|
|
12
|
+
padding: var(--sm);
|
|
13
|
+
gap: var(--2xs);
|
|
14
|
+
overflow: clip;
|
|
15
|
+
border: 1px solid var(--border-secondary);
|
|
16
|
+
border-radius: $node-radius;
|
|
17
|
+
background: var(--background);
|
|
18
|
+
font-family: var(--font-family-base);
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
appearance: none;
|
|
21
|
+
|
|
22
|
+
&:focus-visible {
|
|
23
|
+
outline: 2px solid var(--outline-moderate);
|
|
24
|
+
outline-offset: 2px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.selected {
|
|
29
|
+
border-color: var(--outline-moderate);
|
|
30
|
+
background: var(--background-info);
|
|
31
|
+
box-shadow: inset 0 0 0 1px var(--outline-moderate);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.overflow {
|
|
35
|
+
min-height: $overflow-height;
|
|
36
|
+
gap: 0;
|
|
37
|
+
border: 1px dashed var(--border-disabled);
|
|
38
|
+
background: var(--background-secondary-selected-weak);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.pill {
|
|
42
|
+
padding: var(--4xs) var(--xs);
|
|
43
|
+
overflow: clip;
|
|
44
|
+
border-radius: 9999px;
|
|
45
|
+
background: var(--background-primary);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.pillMuted {
|
|
49
|
+
background: var(--background-tertiary-selected-weak);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.siteCode {
|
|
53
|
+
display: block;
|
|
54
|
+
align-self: stretch;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-align: center;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import type { DsSiteNodeProps } from './ds-site-node.types';
|
|
3
|
+
import { useIsOverflowing } from './hooks/use-is-overflowing';
|
|
4
|
+
import { DsStack } from '../ds-stack';
|
|
5
|
+
import { DsTooltip } from '../ds-tooltip';
|
|
6
|
+
import { DsTypography } from '../ds-typography';
|
|
7
|
+
import styles from './ds-site-node.module.scss';
|
|
8
|
+
|
|
9
|
+
const DsSiteNode = ({
|
|
10
|
+
ref,
|
|
11
|
+
state = 'default',
|
|
12
|
+
tier,
|
|
13
|
+
siteCode,
|
|
14
|
+
overflowLabel,
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
'aria-label': ariaLabel,
|
|
18
|
+
onClick,
|
|
19
|
+
}: DsSiteNodeProps) => {
|
|
20
|
+
const isOverflow = state === 'overflow';
|
|
21
|
+
const isSelected = state === 'selected';
|
|
22
|
+
const isMuted = state === 'muted';
|
|
23
|
+
|
|
24
|
+
const { ref: siteCodeRef, isOverflowing } = useIsOverflowing<HTMLSpanElement>(siteCode);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
ref={ref}
|
|
29
|
+
type="button"
|
|
30
|
+
className={classNames(
|
|
31
|
+
styles.node,
|
|
32
|
+
{
|
|
33
|
+
[styles.selected]: isSelected,
|
|
34
|
+
[styles.overflow]: isOverflow,
|
|
35
|
+
},
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
style={style}
|
|
39
|
+
aria-label={ariaLabel}
|
|
40
|
+
aria-current={isSelected ? true : undefined}
|
|
41
|
+
onClick={onClick}
|
|
42
|
+
>
|
|
43
|
+
{isOverflow ? (
|
|
44
|
+
<DsTypography variant="body-sm-reg" color="secondary">
|
|
45
|
+
{overflowLabel}
|
|
46
|
+
</DsTypography>
|
|
47
|
+
) : (
|
|
48
|
+
<>
|
|
49
|
+
<DsStack
|
|
50
|
+
direction="row"
|
|
51
|
+
alignItems="center"
|
|
52
|
+
justifyContent="center"
|
|
53
|
+
className={classNames(styles.pill, { [styles.pillMuted]: isMuted })}
|
|
54
|
+
>
|
|
55
|
+
<DsTypography variant="body-xs-md" color={isMuted ? 'on-disabled' : 'on-action'}>
|
|
56
|
+
{tier}
|
|
57
|
+
</DsTypography>
|
|
58
|
+
</DsStack>
|
|
59
|
+
|
|
60
|
+
<span ref={siteCodeRef} className={styles.siteCode}>
|
|
61
|
+
<DsTooltip content={isOverflowing ? siteCode : undefined}>
|
|
62
|
+
<DsTypography variant="body-sm-bold" color={isSelected ? 'main' : 'secondary'}>
|
|
63
|
+
{siteCode}
|
|
64
|
+
</DsTypography>
|
|
65
|
+
</DsTooltip>
|
|
66
|
+
</span>
|
|
67
|
+
</>
|
|
68
|
+
)}
|
|
69
|
+
</button>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default DsSiteNode;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CSSProperties, MouseEvent, Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
export const siteNodeStates = ['default', 'selected', 'muted', 'overflow'] as const;
|
|
4
|
+
export type SiteNodeState = (typeof siteNodeStates)[number];
|
|
5
|
+
|
|
6
|
+
export interface DsSiteNodeProps {
|
|
7
|
+
ref?: Ref<HTMLButtonElement>;
|
|
8
|
+
/**
|
|
9
|
+
* Scope/selection state within the site hierarchy path.
|
|
10
|
+
* `overflow` renders a collapsed summary node (no tier/site code).
|
|
11
|
+
*/
|
|
12
|
+
state?: SiteNodeState;
|
|
13
|
+
/**
|
|
14
|
+
* Short tier label shown in the pill, e.g. `"T1"`. Ignored when `state="overflow"`.
|
|
15
|
+
*/
|
|
16
|
+
tier?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Site identifier. Truncates with an ellipsis and reveals the full value in a
|
|
19
|
+
* tooltip when it overflows. Ignored when `state="overflow"`.
|
|
20
|
+
*/
|
|
21
|
+
siteCode?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Summary label for the collapsed branch, e.g. `"+2 more"`. Only used when
|
|
24
|
+
* `state="overflow"`.
|
|
25
|
+
*/
|
|
26
|
+
overflowLabel?: string;
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
/**
|
|
30
|
+
* Overrides the accessible name. By default the node is named by its visible
|
|
31
|
+
* content (tier + site code, or the overflow label); set this to give the
|
|
32
|
+
* overflow node a more descriptive name, e.g. `"Show 2 more sites"`.
|
|
33
|
+
*/
|
|
34
|
+
'aria-label'?: string;
|
|
35
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export const useIsOverflowing = <T extends HTMLElement = HTMLElement>(text: string | undefined) => {
|
|
4
|
+
const ref = useRef<T>(null);
|
|
5
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
6
|
+
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
const element = ref.current;
|
|
9
|
+
if (!element) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const measure = () => setIsOverflowing(element.scrollWidth > element.clientWidth);
|
|
14
|
+
measure();
|
|
15
|
+
|
|
16
|
+
const observer = new ResizeObserver(measure);
|
|
17
|
+
observer.observe(element);
|
|
18
|
+
|
|
19
|
+
const frame = requestAnimationFrame(measure);
|
|
20
|
+
document.fonts.ready.then(measure).catch(() => undefined);
|
|
21
|
+
document.fonts.addEventListener('loadingdone', measure);
|
|
22
|
+
|
|
23
|
+
return () => {
|
|
24
|
+
cancelAnimationFrame(frame);
|
|
25
|
+
observer.disconnect();
|
|
26
|
+
document.fonts.removeEventListener('loadingdone', measure);
|
|
27
|
+
};
|
|
28
|
+
}, [text]);
|
|
29
|
+
|
|
30
|
+
return { ref, isOverflowing };
|
|
31
|
+
};
|
|
@@ -2,8 +2,14 @@ import DsSkeletonText from './ds-skeleton-text';
|
|
|
2
2
|
import DsSkeletonCircle from './ds-skeleton-circle';
|
|
3
3
|
import DsSkeletonRect from './ds-skeleton-rect';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const DsSkeleton = {
|
|
6
6
|
Text: DsSkeletonText,
|
|
7
7
|
Circle: DsSkeletonCircle,
|
|
8
8
|
Rect: DsSkeletonRect,
|
|
9
9
|
};
|
|
10
|
+
|
|
11
|
+
DsSkeleton.Text.displayName = 'DsSkeleton.Text';
|
|
12
|
+
DsSkeleton.Circle.displayName = 'DsSkeleton.Circle';
|
|
13
|
+
DsSkeleton.Rect.displayName = 'DsSkeleton.Rect';
|
|
14
|
+
|
|
15
|
+
export default DsSkeleton;
|