@drivenets/design-system 0.14.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 +32 -0
- package/README.md +1 -1
- package/dist/index.cjs +1239 -262
- package/dist/index.d.cts +904 -1169
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +904 -1169
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1221 -258
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +15 -12
- 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.module.scss +14 -0
- package/src/components/ds-drawer/ds-drawer.tsx +30 -1
- package/src/components/ds-drawer/ds-drawer.types.ts +7 -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-file-upload/hooks/use-file-upload.ts +7 -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.figma.ts +29 -0
- package/src/components/ds-progress-task-bar/ds-progress-task-bar.module.scss +39 -0
- package/src/components/ds-progress-task-bar/ds-progress-task-bar.tsx +124 -0
- package/src/components/ds-progress-task-bar/ds-progress-task-bar.types.ts +65 -0
- package/src/components/ds-progress-task-bar/index.ts +2 -0
- package/src/components/ds-progress-task-bar/utils.ts +51 -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/ds-table-row/ds-table-row.module.scss +1 -1
- package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +2 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.module.scss +1 -1
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.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.module.scss +14 -2
- package/src/components/ds-table/components/edit/ds-table-editable-cell/ds-table-editable-cell.tsx +20 -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-column.types.ts +24 -0
- package/src/components/ds-table/ds-table.tsx +30 -4
- package/src/components/ds-table/ds-table.types.ts +7 -0
- package/src/components/ds-table/index.ts +4 -0
- package/src/components/ds-table/utils/constants.ts +5 -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-tabs/figma/ds-tabs-tab-vertical.figma.ts +78 -0
- package/src/components/ds-tabs/figma/ds-tabs-tab.figma.ts +89 -0
- package/src/components/ds-tabs/figma/ds-tabs-vertical.figma.ts +31 -0
- package/src/components/ds-tabs/figma/ds-tabs.figma.ts +29 -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 +3 -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,11 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=14836-15179
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-loader
|
|
3
|
+
// component=DsLoader
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
example: figma.code`<DsLoader />`,
|
|
8
|
+
imports: ["import { DsLoader } from '@drivenets/design-system'"],
|
|
9
|
+
id: 'ds-loader',
|
|
10
|
+
metadata: { nestable: true },
|
|
11
|
+
};
|
|
@@ -138,6 +138,13 @@ const Actions = ({
|
|
|
138
138
|
</div>
|
|
139
139
|
);
|
|
140
140
|
|
|
141
|
+
Header.displayName = 'DsModal.Header';
|
|
142
|
+
Title.displayName = 'DsModal.Title';
|
|
143
|
+
CloseTrigger.displayName = 'DsModal.CloseTrigger';
|
|
144
|
+
Body.displayName = 'DsModal.Body';
|
|
145
|
+
Footer.displayName = 'DsModal.Footer';
|
|
146
|
+
Actions.displayName = 'DsModal.Actions';
|
|
147
|
+
|
|
141
148
|
DsModal.Header = Header;
|
|
142
149
|
DsModal.Title = Title;
|
|
143
150
|
DsModal.CloseTrigger = CloseTrigger;
|
|
@@ -145,4 +152,6 @@ DsModal.Body = Body;
|
|
|
145
152
|
DsModal.Footer = Footer;
|
|
146
153
|
DsModal.Actions = Actions;
|
|
147
154
|
|
|
155
|
+
DsModal.displayName = 'DsModal';
|
|
156
|
+
|
|
148
157
|
export default DsModal;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15978-26200
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-panel
|
|
3
|
+
// component=DsPanel
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const open = instance.getEnum('type', { expanded: true, collapsed: false });
|
|
9
|
+
const openAttr = open ? 'open' : 'open={false}';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
example: figma.code`<DsPanel ${openAttr}>{/* panel content */}</DsPanel>`,
|
|
13
|
+
imports: ["import { DsPanel } from '@drivenets/design-system'"],
|
|
14
|
+
id: 'ds-panel',
|
|
15
|
+
metadata: { nestable: false },
|
|
16
|
+
};
|
|
@@ -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,29 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=36987-43620
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-progress-task-bar
|
|
3
|
+
// component=DsProgressTaskBar
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
// Boolean property names are case-sensitive: `Running` / `Failed` are capitalized.
|
|
9
|
+
const zero = instance.getBoolean('zero');
|
|
10
|
+
const completed = instance.getBoolean('completed');
|
|
11
|
+
const running = instance.getBoolean('Running');
|
|
12
|
+
const failed = instance.getBoolean('Failed');
|
|
13
|
+
|
|
14
|
+
// Booleans only toggle a status on/off, so emit a representative count per status.
|
|
15
|
+
const attrs = [
|
|
16
|
+
completed ? 'completed={300}' : '',
|
|
17
|
+
running ? 'running={100}' : '',
|
|
18
|
+
failed ? 'failed={100}' : '',
|
|
19
|
+
'total={1000}',
|
|
20
|
+
]
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join(' ');
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
example: zero ? figma.code`<DsProgressTaskBar total={999} />` : figma.code`<DsProgressTaskBar ${attrs} />`,
|
|
26
|
+
imports: ["import { DsProgressTaskBar } from '@drivenets/design-system'"],
|
|
27
|
+
id: 'ds-progress-task-bar',
|
|
28
|
+
metadata: { nestable: false },
|
|
29
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
$bar-height: 8px;
|
|
2
|
+
$segment-min-width: 4px;
|
|
3
|
+
|
|
4
|
+
.statusIcon {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.total {
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.bar {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: $bar-height;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
background-color: var(--background-action-secondary-hover);
|
|
19
|
+
border-radius: var(--3xs);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.segment {
|
|
23
|
+
flex: none;
|
|
24
|
+
min-width: $segment-min-width;
|
|
25
|
+
height: 100%;
|
|
26
|
+
transition: width 0.2s ease;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.segmentCompleted {
|
|
30
|
+
background-color: var(--background-success-medium);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.segmentRunning {
|
|
34
|
+
background-color: var(--background-light-primary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.segmentFailed {
|
|
38
|
+
background-color: var(--background-error);
|
|
39
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { DsIcon, type IconColor, type IconName } from '../ds-icon';
|
|
4
|
+
import { DsStack } from '../ds-stack';
|
|
5
|
+
import { DsTooltip } from '../ds-tooltip';
|
|
6
|
+
import { DsTypography, type TypographyColor } from '../ds-typography';
|
|
7
|
+
|
|
8
|
+
import styles from './ds-progress-task-bar.module.scss';
|
|
9
|
+
import {
|
|
10
|
+
type DsProgressTaskBarLocale,
|
|
11
|
+
type DsProgressTaskBarProps,
|
|
12
|
+
type TaskBarStatus,
|
|
13
|
+
taskBarStatuses,
|
|
14
|
+
} from './ds-progress-task-bar.types';
|
|
15
|
+
import { formatCount } from './utils';
|
|
16
|
+
|
|
17
|
+
const statusIcon: Record<TaskBarStatus, IconName> = Object.freeze({
|
|
18
|
+
completed: 'check_circle',
|
|
19
|
+
running: 'play_circle',
|
|
20
|
+
failed: 'cancel',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const statusIconColor: Record<TaskBarStatus, IconColor> = Object.freeze({
|
|
24
|
+
completed: 'success',
|
|
25
|
+
running: 'action',
|
|
26
|
+
failed: 'error',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const statusTextColor: Record<TaskBarStatus, TypographyColor> = Object.freeze({
|
|
30
|
+
completed: 'success',
|
|
31
|
+
running: 'action',
|
|
32
|
+
failed: 'error',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const statusSegmentClass: Record<TaskBarStatus, string> = Object.freeze({
|
|
36
|
+
completed: styles.segmentCompleted,
|
|
37
|
+
running: styles.segmentRunning,
|
|
38
|
+
failed: styles.segmentFailed,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const defaultLocale: Required<DsProgressTaskBarLocale> = Object.freeze({
|
|
42
|
+
completed: 'Completed',
|
|
43
|
+
running: 'Running',
|
|
44
|
+
failed: 'Failed',
|
|
45
|
+
total: (total: string) => `of ${total}`,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const DsProgressTaskBar = ({
|
|
49
|
+
completed = 0,
|
|
50
|
+
running = 0,
|
|
51
|
+
failed = 0,
|
|
52
|
+
total,
|
|
53
|
+
locale,
|
|
54
|
+
className,
|
|
55
|
+
style,
|
|
56
|
+
ref,
|
|
57
|
+
}: DsProgressTaskBarProps) => {
|
|
58
|
+
const counts: Record<TaskBarStatus, number> = {
|
|
59
|
+
completed: Math.max(0, completed),
|
|
60
|
+
running: Math.max(0, running),
|
|
61
|
+
failed: Math.max(0, failed),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const sum = counts.completed + counts.running + counts.failed;
|
|
65
|
+
const denominator = Math.max(total ?? sum, sum);
|
|
66
|
+
|
|
67
|
+
const mergedLocale = { ...defaultLocale, ...locale };
|
|
68
|
+
const activeStatuses = taskBarStatuses.filter((status) => counts[status] > 0);
|
|
69
|
+
|
|
70
|
+
const segmentWidth = (status: TaskBarStatus) =>
|
|
71
|
+
denominator > 0 ? `${String((counts[status] / denominator) * 100)}%` : '0%';
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<DsStack ref={ref} direction="column" gap="var(--xs)" width="100%" className={className} style={style}>
|
|
75
|
+
<DsStack direction="row" alignItems="center" justifyContent="space-between">
|
|
76
|
+
<DsStack direction="row" alignItems="center" gap="var(--3xs)">
|
|
77
|
+
{activeStatuses.length === 0 ? (
|
|
78
|
+
<DsTypography variant="body-xs-reg" color="secondary">
|
|
79
|
+
0
|
|
80
|
+
</DsTypography>
|
|
81
|
+
) : (
|
|
82
|
+
activeStatuses.map((status) => (
|
|
83
|
+
<DsStack key={status} direction="row" alignItems="center" gap="var(--4xs)">
|
|
84
|
+
<DsTooltip content={mergedLocale[status]}>
|
|
85
|
+
<span className={styles.statusIcon}>
|
|
86
|
+
<DsIcon icon={statusIcon[status]} size="tiny" color={statusIconColor[status]} filled />
|
|
87
|
+
</span>
|
|
88
|
+
</DsTooltip>
|
|
89
|
+
<DsTypography variant="body-xs-reg" color={statusTextColor[status]}>
|
|
90
|
+
{formatCount(counts[status])}
|
|
91
|
+
</DsTypography>
|
|
92
|
+
</DsStack>
|
|
93
|
+
))
|
|
94
|
+
)}
|
|
95
|
+
</DsStack>
|
|
96
|
+
|
|
97
|
+
<DsTypography variant="body-xs-reg" color="secondary" className={styles.total}>
|
|
98
|
+
{mergedLocale.total(formatCount(denominator))}
|
|
99
|
+
</DsTypography>
|
|
100
|
+
</DsStack>
|
|
101
|
+
|
|
102
|
+
<div
|
|
103
|
+
className={styles.bar}
|
|
104
|
+
role="progressbar"
|
|
105
|
+
aria-valuemin={0}
|
|
106
|
+
aria-valuemax={denominator}
|
|
107
|
+
aria-valuenow={sum}
|
|
108
|
+
>
|
|
109
|
+
{activeStatuses.map((status) => (
|
|
110
|
+
<DsTooltip key={status} content={mergedLocale[status]}>
|
|
111
|
+
<span
|
|
112
|
+
className={classNames(styles.segment, statusSegmentClass[status])}
|
|
113
|
+
style={{ width: segmentWidth(status) }}
|
|
114
|
+
/>
|
|
115
|
+
</DsTooltip>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
</DsStack>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
DsProgressTaskBar.displayName = 'DsProgressTaskBar';
|
|
123
|
+
|
|
124
|
+
export default DsProgressTaskBar;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { CSSProperties, Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
export const taskBarStatuses = ['completed', 'running', 'failed'] as const;
|
|
4
|
+
export type TaskBarStatus = (typeof taskBarStatuses)[number];
|
|
5
|
+
|
|
6
|
+
export interface DsProgressTaskBarLocale {
|
|
7
|
+
/** @default 'Completed' */
|
|
8
|
+
completed?: string;
|
|
9
|
+
/** @default 'Running' */
|
|
10
|
+
running?: string;
|
|
11
|
+
/** @default 'Failed' */
|
|
12
|
+
failed?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Builds the trailing total label from the already-formatted total value.
|
|
15
|
+
* @default (total) => `of ${total}`
|
|
16
|
+
*/
|
|
17
|
+
total?: (total: string) => string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface DsProgressTaskBarProps {
|
|
21
|
+
/**
|
|
22
|
+
* Number of completed tasks.
|
|
23
|
+
* @default 0
|
|
24
|
+
*/
|
|
25
|
+
completed?: number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Number of running tasks.
|
|
29
|
+
* @default 0
|
|
30
|
+
*/
|
|
31
|
+
running?: number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Number of failed tasks.
|
|
35
|
+
* @default 0
|
|
36
|
+
*/
|
|
37
|
+
failed?: number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Total task count used as the denominator for segment widths and shown as
|
|
41
|
+
* the trailing "of {total}" label. Defaults to the sum of the status counts
|
|
42
|
+
* (fully filled bar).
|
|
43
|
+
*/
|
|
44
|
+
total?: number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Localized strings (status tooltips and total label).
|
|
48
|
+
*/
|
|
49
|
+
locale?: DsProgressTaskBarLocale;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Additional CSS class names
|
|
53
|
+
*/
|
|
54
|
+
className?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Additional styles to apply to the component
|
|
58
|
+
*/
|
|
59
|
+
style?: CSSProperties;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Ref to the root element
|
|
63
|
+
*/
|
|
64
|
+
ref?: Ref<HTMLDivElement>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
interface CountUnit {
|
|
2
|
+
value: number;
|
|
3
|
+
suffix: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const COUNT_UNITS: readonly CountUnit[] = [
|
|
7
|
+
{ value: 1_000_000_000, suffix: 'B' },
|
|
8
|
+
{ value: 1_000_000, suffix: 'M' },
|
|
9
|
+
{ value: 1_000, suffix: 'K' },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
// Counts below this are shown verbatim; at or above it they are abbreviated.
|
|
13
|
+
const ABBREVIATION_FLOOR = 1_000;
|
|
14
|
+
|
|
15
|
+
// Below this multiple of a unit, show one decimal place (e.g. 1.1K); at or
|
|
16
|
+
// above it, show a whole number (e.g. 87K).
|
|
17
|
+
const DECIMAL_THRESHOLD = 10;
|
|
18
|
+
|
|
19
|
+
const stripTrailingZero = (value: number): string => (value % 1 === 0 ? String(value) : value.toFixed(1));
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Format a task count for the legend, following the design's abbreviation rules:
|
|
23
|
+
* - `< 1000` → exact number (e.g. `999`)
|
|
24
|
+
* - single-digit unit → one decimal (e.g. `1.1K`, `1.2M`)
|
|
25
|
+
* - multi-digit unit → whole number, truncated so `999,999 → 999K`
|
|
26
|
+
*/
|
|
27
|
+
export const formatCount = (count: number): string => {
|
|
28
|
+
if (!Number.isFinite(count)) {
|
|
29
|
+
return '0';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const rounded = Math.max(0, Math.round(count));
|
|
33
|
+
|
|
34
|
+
if (rounded < ABBREVIATION_FLOOR) {
|
|
35
|
+
return String(rounded);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const unit = COUNT_UNITS.find(({ value }) => rounded >= value);
|
|
39
|
+
|
|
40
|
+
if (unit === undefined) {
|
|
41
|
+
return String(rounded);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const scaled = rounded / unit.value;
|
|
45
|
+
|
|
46
|
+
if (scaled < DECIMAL_THRESHOLD) {
|
|
47
|
+
return `${stripTrailingZero(Math.round(scaled * 10) / 10)}${unit.suffix}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return `${String(Math.floor(scaled))}${unit.suffix}`;
|
|
51
|
+
};
|