@drivenets/design-system 0.15.0 → 0.17.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/dist/index.cjs +1092 -381
- package/dist/index.d.cts +886 -1204
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +886 -1204
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1076 -377
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +36 -34
- package/src/components/ds-alert-banner/ds-alert-banner.tsx +16 -6
- 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 +3 -3
- 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-card/figma/ds-card-content.figma.ts +2 -2
- package/src/components/ds-card/figma/ds-card-footer.figma.ts +2 -2
- package/src/components/ds-card/figma/ds-card-header.figma.ts +2 -2
- package/src/components/ds-card/figma/ds-card.figma.ts +2 -2
- package/src/components/ds-catalog-layout/ds-catalog-layout.figma.ts +51 -0
- package/src/components/ds-catalog-layout/ds-catalog-layout.tsx +15 -6
- 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/components/comments-filter-modal/index.ts +0 -1
- package/src/components/ds-comments-drawer/ds-comments-drawer.tsx +1 -0
- package/src/components/ds-confirmation/ds-confirmation.tsx +13 -10
- package/src/components/ds-date-input/ds-date-input.tsx +2 -0
- package/src/components/ds-date-picker/ds-date-picker.figma.ts +2 -2
- 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 +19 -8
- 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/components/file-upload-item/index.ts +0 -1
- 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.figma.ts +2 -2
- package/src/components/ds-form-control/ds-form-control.tsx +16 -11
- package/src/components/ds-grid/index.ts +3 -0
- package/src/components/ds-icon/ds-icon.tsx +2 -0
- package/src/components/ds-icon/figma/ds-icon-material.figma.batch.ts +1 -1
- package/src/components/ds-icon/figma/ds-icon-special.figma.batch.ts +1 -1
- 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 +17 -7
- package/src/components/ds-modal/figma/ds-modal-content.figma.ts +2 -2
- package/src/components/ds-modal/figma/ds-modal-footer.figma.ts +2 -2
- package/src/components/ds-modal/figma/ds-modal-header.figma.ts +2 -2
- package/src/components/ds-modal/figma/ds-modal.figma.ts +2 -2
- package/src/components/ds-number-input/ds-number-input.tsx +3 -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 +2 -2
- 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.figma.ts +2 -2
- 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 +7 -2
- 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.figma.ts +2 -2
- 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/ds-status-badge-v2.figma.ts +2 -2
- 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-group-header-cell/index.ts +0 -1
- package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +2 -2
- package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +2 -4
- 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.module.scss +15 -0
- package/src/components/ds-table/ds-table.tsx +39 -34
- package/src/components/ds-table/ds-table.types.ts +6 -0
- package/src/components/ds-table/figma/ds-table-expandable.figma.ts +2 -2
- package/src/components/ds-table/figma/ds-table.figma.ts +2 -2
- 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-tabs/figma/ds-tabs-tab-vertical.figma.ts +2 -2
- package/src/components/ds-tabs/figma/ds-tabs-tab.figma.ts +2 -2
- package/src/components/ds-tabs/figma/ds-tabs-vertical.figma.ts +2 -2
- package/src/components/ds-tabs/figma/ds-tabs.figma.ts +2 -2
- 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.figma.ts +2 -2
- 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.figma.ts +2 -2
- 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.module.scss +2 -2
- package/src/components/ds-tree/ds-tree.tsx +22 -0
- package/src/components/ds-tree/ds-tree.types.ts +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 +17 -4
- package/src/components/ds-workspace-layout/ds-workspace-layout.tsx +19 -8
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drivenets/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.cts",
|
|
@@ -41,15 +41,14 @@
|
|
|
41
41
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
42
42
|
"@dnd-kit/sortable": "^10.0.0",
|
|
43
43
|
"@dnd-kit/utilities": "^3.2.2",
|
|
44
|
-
"@radix-ui/react-collapsible": "^1.1.
|
|
45
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
46
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
47
|
-
"@radix-ui/react-
|
|
48
|
-
"@radix-ui/react-visually-hidden": "^1.2.5",
|
|
44
|
+
"@radix-ui/react-collapsible": "^1.1.17",
|
|
45
|
+
"@radix-ui/react-dialog": "^1.1.20",
|
|
46
|
+
"@radix-ui/react-dropdown-menu": "^2.1.21",
|
|
47
|
+
"@radix-ui/react-visually-hidden": "^1.2.8",
|
|
49
48
|
"@tanstack/react-table": "^8.21.3",
|
|
50
|
-
"@tanstack/react-virtual": "^3.14.
|
|
51
|
-
"@zag-js/react": "^1.
|
|
52
|
-
"@zag-js/steps": "^1.
|
|
49
|
+
"@tanstack/react-virtual": "^3.14.6",
|
|
50
|
+
"@zag-js/react": "^1.42.0",
|
|
51
|
+
"@zag-js/steps": "^1.42.0",
|
|
53
52
|
"classnames": "^2.5.1",
|
|
54
53
|
"csstype": "^3.2.3"
|
|
55
54
|
},
|
|
@@ -62,51 +61,53 @@
|
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
64
63
|
"@eslint/compat": "^2.1.0",
|
|
65
|
-
"@faker-js/faker": "^10.
|
|
66
|
-
"@figma/code-connect": "^1.4.
|
|
64
|
+
"@faker-js/faker": "^10.5.0",
|
|
65
|
+
"@figma/code-connect": "^1.4.9",
|
|
67
66
|
"@github-ui/storybook-addon-performance-panel": "^1.1.4",
|
|
68
|
-
"@hookform/resolvers": "^5.4.
|
|
67
|
+
"@hookform/resolvers": "^5.4.2",
|
|
69
68
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
70
69
|
"@storybook/addon-a11y": "^10.4.1",
|
|
71
70
|
"@storybook/addon-docs": "^10.4.1",
|
|
72
71
|
"@storybook/addon-mcp": "^0.6.0",
|
|
73
72
|
"@storybook/addon-vitest": "^10.4.1",
|
|
74
73
|
"@storybook/react-vite": "^10.4.1",
|
|
75
|
-
"@tanstack/react-query": "^5.
|
|
76
|
-
"@tanstack/react-router": "^1.170.
|
|
77
|
-
"@tsdown/css": "^0.22.
|
|
74
|
+
"@tanstack/react-query": "^5.101.4",
|
|
75
|
+
"@tanstack/react-router": "^1.170.18",
|
|
76
|
+
"@tsdown/css": "^0.22.14",
|
|
78
77
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
79
|
-
"@types/react": "^19.2.
|
|
78
|
+
"@types/react": "^19.2.17",
|
|
80
79
|
"@types/react-dom": "^19.2.3",
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@
|
|
84
|
-
"@vitest/
|
|
80
|
+
"@types/serve-handler": "^6.1.4",
|
|
81
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
82
|
+
"@vitejs/plugin-react": "^6.0.4",
|
|
83
|
+
"@vitest/browser-playwright": "^4.1.10",
|
|
84
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
85
85
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
86
86
|
"eslint": "^10.0.1",
|
|
87
87
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
88
88
|
"eslint-plugin-react": "^7.37.5",
|
|
89
89
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
90
|
-
"eslint-plugin-storybook": "^10.
|
|
90
|
+
"eslint-plugin-storybook": "^10.5.0",
|
|
91
91
|
"mockdate": "^3.0.5",
|
|
92
|
-
"playwright": "^1.
|
|
93
|
-
"publint": "^0.3.
|
|
94
|
-
"react": "^19.2.
|
|
95
|
-
"react-dom": "^19.2.
|
|
96
|
-
"react-hook-form": "^7.
|
|
92
|
+
"playwright": "^1.62.0",
|
|
93
|
+
"publint": "^0.3.22",
|
|
94
|
+
"react": "^19.2.8",
|
|
95
|
+
"react-dom": "^19.2.8",
|
|
96
|
+
"react-hook-form": "^7.83.0",
|
|
97
97
|
"remark-gfm": "^4.0.1",
|
|
98
98
|
"sass-embedded": "^1.100.0",
|
|
99
|
+
"serve-handler": "^6.1.7",
|
|
99
100
|
"storybook": "^10.4.1",
|
|
100
|
-
"tsdown": "^0.22.
|
|
101
|
+
"tsdown": "^0.22.14",
|
|
101
102
|
"typed-scss-modules": "^8.1.1",
|
|
102
|
-
"typescript": "
|
|
103
|
+
"typescript": "npm:@typescript/typescript6",
|
|
103
104
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
104
|
-
"vite": "8.
|
|
105
|
-
"vitest": "^4.1.
|
|
105
|
+
"vite": "8.1.5",
|
|
106
|
+
"vitest": "^4.1.10",
|
|
106
107
|
"vitest-browser-react": "^2.1.0",
|
|
107
108
|
"zod": "^4.4.3",
|
|
108
|
-
"@drivenets/
|
|
109
|
-
"@drivenets/
|
|
109
|
+
"@drivenets/eslint-plugin-internal": "0.0.0",
|
|
110
|
+
"@drivenets/vite-plugin-design-system": "0.0.10"
|
|
110
111
|
},
|
|
111
112
|
"scripts": {
|
|
112
113
|
"start": "storybook dev -p 6006",
|
|
@@ -115,15 +116,16 @@
|
|
|
115
116
|
"//": "ESLINT_ARGS is used to pass arguments to eslint. We're using it so we don't need to duplicate the lint script.",
|
|
116
117
|
"lint:fix": "ESLINT_ARGS=--fix pnpm lint",
|
|
117
118
|
"lint:build": "publint && attw --pack",
|
|
118
|
-
"typecheck": "pnpm generate-scss-dts &&
|
|
119
|
+
"typecheck": "pnpm generate-scss-dts && tsc; EXIT_CODE=$?; rm -rf .scss-dts; exit $EXIT_CODE",
|
|
119
120
|
"generate-scss-dts": "typed-scss-modules ./src -o ./.scss-dts --nameFormat all --exportType default > /dev/null 2>&1",
|
|
120
121
|
"figma:lint": "figma connect parse --exit-on-unreadable-files",
|
|
121
122
|
"figma:publish": "figma connect publish --exit-on-unreadable-files",
|
|
122
|
-
"test": "vitest --project
|
|
123
|
+
"test": "vitest --project=unit --project=browser --project=storybook",
|
|
123
124
|
"test:coverage": "pnpm test --coverage",
|
|
124
125
|
"test:unit": "vitest --project=unit",
|
|
125
126
|
"test:browser": "vitest --project=browser",
|
|
126
127
|
"test:requires-build": "vitest --project=requires-build",
|
|
128
|
+
"test:storybook-docs": "vitest --project=storybook-docs",
|
|
127
129
|
"build": "tsdown",
|
|
128
130
|
"build:watch": "pnpm build --watch",
|
|
129
131
|
"build:storybook": "storybook build"
|
|
@@ -6,10 +6,13 @@ import { DsIcon } from '../ds-icon';
|
|
|
6
6
|
import { DsTypography } from '../ds-typography';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* @summary Controlled banner for surfacing contextual status messages.
|
|
10
|
+
*
|
|
11
|
+
* Renders as an inline bordered card or a full-width global bar, with five
|
|
12
|
+
* severity variants, an optional icon, and an optional close button. Compose the
|
|
13
|
+
* content with `DsAlertBanner.Title`, `DsAlertBanner.Body`, and `DsAlertBanner.Actions`.
|
|
11
14
|
*/
|
|
12
|
-
const
|
|
15
|
+
const DsAlertBannerRoot = ({
|
|
13
16
|
open,
|
|
14
17
|
onOpenChange,
|
|
15
18
|
inline = false,
|
|
@@ -108,8 +111,15 @@ const Actions = ({
|
|
|
108
111
|
</div>
|
|
109
112
|
);
|
|
110
113
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
Title.displayName = 'DsAlertBanner.Title';
|
|
115
|
+
Body.displayName = 'DsAlertBanner.Body';
|
|
116
|
+
Actions.displayName = 'DsAlertBanner.Actions';
|
|
117
|
+
|
|
118
|
+
const DsAlertBanner = Object.assign(DsAlertBannerRoot, {
|
|
119
|
+
displayName: 'DsAlertBanner',
|
|
120
|
+
Title,
|
|
121
|
+
Body,
|
|
122
|
+
Actions,
|
|
123
|
+
});
|
|
114
124
|
|
|
115
125
|
export default DsAlertBanner;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=14824-7324
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-autocomplete
|
|
3
|
+
// component=DsAutocomplete
|
|
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
|
+
Disable: 'disable',
|
|
13
|
+
Error: 'error',
|
|
14
|
+
'read only': 'readOnly',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const comboBox = instance.getEnum('Combo box', {
|
|
18
|
+
ON: 'on',
|
|
19
|
+
OFF: 'off',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const attrs = [
|
|
23
|
+
'options={[]}',
|
|
24
|
+
comboBox === 'off' ? 'showTrigger={false}' : '',
|
|
25
|
+
state === 'disable' ? 'disabled' : '',
|
|
26
|
+
state === 'error' ? 'invalid' : '',
|
|
27
|
+
]
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.join(' ');
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
example: figma.code`<DsAutocomplete ${attrs} />`,
|
|
33
|
+
imports: ["import { DsAutocomplete } from '@drivenets/design-system';"],
|
|
34
|
+
id: 'ds-autocomplete',
|
|
35
|
+
metadata: { nestable: true },
|
|
36
|
+
} satisfies figma.Template;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=14860-11893
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-avatar
|
|
3
|
+
// component=DsAvatar
|
|
4
|
+
//
|
|
5
|
+
// `Size` and `Type` map to the code props. Figma's boolean `Placeholder` variant has no
|
|
6
|
+
// code equivalent — initials-vs-photo is automatic (required `name` drives initials, an
|
|
7
|
+
// optional `src` drives the photo) — so it is ignored. `name` is content, not derivable
|
|
8
|
+
// from Figma, so it is emitted as a placeholder (see `ds-user-card.figma.ts`).
|
|
9
|
+
import figma from 'figma';
|
|
10
|
+
|
|
11
|
+
const instance = figma.selectedInstance;
|
|
12
|
+
|
|
13
|
+
const size =
|
|
14
|
+
instance.getEnum('Size', {
|
|
15
|
+
'XSM - 18': 'xsm',
|
|
16
|
+
'SM - 24': 'sm',
|
|
17
|
+
'Regular - 32': 'regular',
|
|
18
|
+
'MD - 48': 'md',
|
|
19
|
+
'LG - 80': 'lg',
|
|
20
|
+
'XL - 144': 'xl',
|
|
21
|
+
}) ?? 'regular';
|
|
22
|
+
|
|
23
|
+
const type = instance.getEnum('Type', { Circle: 'circle', Rounded: 'rounded' }) ?? 'circle';
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
example: figma.code`<DsAvatar name="Full Name" size="${size}" type="${type}" />`,
|
|
27
|
+
imports: ["import { DsAvatar } from '@drivenets/design-system';"],
|
|
28
|
+
id: 'ds-avatar',
|
|
29
|
+
metadata: { nestable: true },
|
|
30
|
+
} satisfies figma.Template;
|
|
@@ -6,7 +6,11 @@ import type { DsAvatarProps } from './ds-avatar.types';
|
|
|
6
6
|
import { DsTooltip } from '../ds-tooltip';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* @summary Displays a user's profile picture, falling back to initials.
|
|
10
|
+
*
|
|
11
|
+
* Renders a circular or rounded avatar from an image `src`. When the image is
|
|
12
|
+
* missing or fails to load, the trimmed initials derived from `name` are shown
|
|
13
|
+
* instead, and `name` is surfaced in a tooltip on hover.
|
|
10
14
|
*/
|
|
11
15
|
export const DsAvatar: FC<DsAvatarProps> = ({
|
|
12
16
|
src,
|
|
@@ -40,3 +44,4 @@ export const DsAvatar: FC<DsAvatarProps> = ({
|
|
|
40
44
|
</DsTooltip>
|
|
41
45
|
);
|
|
42
46
|
};
|
|
47
|
+
DsAvatar.displayName = 'DsAvatar';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export const dsAvatarSizes = ['xsm', 'sm', 'regular', 'md', 'lg', 'xl'] as const;
|
|
4
|
+
export const dsAvatarTypes = ['circle', 'rounded'] as const;
|
|
5
|
+
|
|
6
|
+
export type DsAvatarSize = (typeof dsAvatarSizes)[number];
|
|
7
|
+
export type DsAvatarType = (typeof dsAvatarTypes)[number];
|
|
5
8
|
|
|
6
9
|
export interface DsAvatarProps {
|
|
7
10
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=14870-20161
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-avatar-group
|
|
3
|
+
// component=DsAvatarGroup
|
|
4
|
+
//
|
|
5
|
+
// `Size` maps to the code prop (note the key is `XS - 18`, unlike `ds-avatar`'s `XSM - 18`).
|
|
6
|
+
// `avatars` is a required data array, not derivable from Figma, so it is emitted as an empty
|
|
7
|
+
// placeholder for the developer to fill in (see `ds-select.figma.ts`). The Figma set only
|
|
8
|
+
// models `type=circle` (code also supports `rounded`) and does not expose `max`, so neither
|
|
9
|
+
// is mapped.
|
|
10
|
+
import figma from 'figma';
|
|
11
|
+
|
|
12
|
+
const instance = figma.selectedInstance;
|
|
13
|
+
|
|
14
|
+
const size =
|
|
15
|
+
instance.getEnum('Size', {
|
|
16
|
+
'XS - 18': 'xsm',
|
|
17
|
+
'SM - 24': 'sm',
|
|
18
|
+
'Regular - 32': 'regular',
|
|
19
|
+
'MD - 48': 'md',
|
|
20
|
+
}) ?? 'regular';
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
example: figma.code`<DsAvatarGroup avatars={[]} size="${size}" />`,
|
|
24
|
+
imports: ["import { DsAvatarGroup } from '@drivenets/design-system';"],
|
|
25
|
+
id: 'ds-avatar-group',
|
|
26
|
+
metadata: { nestable: true },
|
|
27
|
+
} satisfies figma.Template;
|
|
@@ -7,7 +7,11 @@ import { DsTooltip } from '../ds-tooltip';
|
|
|
7
7
|
import { DsTypography } from '../ds-typography';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* @summary Overlapping avatars with overflow collapse and tooltip.
|
|
11
|
+
*
|
|
12
|
+
* Renders a row of {@link DsAvatar} members that share `size` and `type`. When
|
|
13
|
+
* `avatars.length` exceeds `max`, the remainder collapse behind a `+N`
|
|
14
|
+
* indicator; hovering it lists the hidden names in a tooltip.
|
|
11
15
|
*/
|
|
12
16
|
export const DsAvatarGroup: FC<DsAvatarGroupProps> = ({
|
|
13
17
|
avatars,
|
|
@@ -49,3 +53,4 @@ export const DsAvatarGroup: FC<DsAvatarGroupProps> = ({
|
|
|
49
53
|
</div>
|
|
50
54
|
);
|
|
51
55
|
};
|
|
56
|
+
DsAvatarGroup.displayName = 'DsAvatarGroup';
|
|
@@ -2,7 +2,9 @@ import type { DsAvatarProps, DsAvatarSize, DsAvatarType } from '../ds-avatar';
|
|
|
2
2
|
|
|
3
3
|
export interface DsAvatarGroupProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Avatar items to display. Each item accepts `DsAvatar` props except `size`
|
|
6
|
+
* and `type`, which are set on the group. `name` is required; `src` and `alt`
|
|
7
|
+
* are optional — without `src`, initials are shown per `DsAvatar`.
|
|
6
8
|
*/
|
|
7
9
|
avatars: Omit<DsAvatarProps, 'size' | 'type'>[];
|
|
8
10
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15015-2480
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-breadcrumb
|
|
3
|
+
// component=DsBreadcrumb
|
|
4
|
+
//
|
|
5
|
+
// `DAP_Breadcrumbs-nav_v01` maps to `DsBreadcrumb`. Its `steps`/`icons`/`back` variants do
|
|
6
|
+
// not map to props: the trail is built from a single `items` array (Figma's fixed
|
|
7
|
+
// `steps=1..7` variants only exist because a component can't repeat an array), the per-item
|
|
8
|
+
// icon lives in each `items` entry, and there is no back-navigation feature in code. `items`
|
|
9
|
+
// is required data, so it is emitted as an empty placeholder (see `ds-select.figma.ts`). The
|
|
10
|
+
// single-crumb atom `DAP_Breadcrumbs-item_v01` has no public export and is intentionally not
|
|
11
|
+
// connected.
|
|
12
|
+
import figma from 'figma';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
example: figma.code`<DsBreadcrumb items={[]} />`,
|
|
16
|
+
imports: ["import { DsBreadcrumb } from '@drivenets/design-system';"],
|
|
17
|
+
id: 'ds-breadcrumb',
|
|
18
|
+
metadata: { nestable: true },
|
|
19
|
+
} satisfies figma.Template;
|
|
@@ -5,7 +5,7 @@ import figma from 'figma';
|
|
|
5
5
|
|
|
6
6
|
const instance = figma.selectedInstance;
|
|
7
7
|
|
|
8
|
-
const variant = instance.getEnum('
|
|
8
|
+
const variant = instance.getEnum('buttonType', {
|
|
9
9
|
primary: 'primary',
|
|
10
10
|
secondary: 'secondary',
|
|
11
11
|
tertiary: 'tertiary',
|
|
@@ -93,7 +93,7 @@ export default {
|
|
|
93
93
|
: showIcon && icon
|
|
94
94
|
? figma.code`<DsButtonV3 variant="${variant}" color="${color}" size="${size}" ${disabled ? 'disabled' : ''} icon="${icon}">${label}</DsButtonV3>`
|
|
95
95
|
: figma.code`<DsButtonV3 variant="${variant}" color="${color}" size="${size}" ${disabled ? 'disabled' : ''}>${label}</DsButtonV3>`,
|
|
96
|
-
imports: ["import { DsButtonV3 } from '@drivenets/design-system'"],
|
|
96
|
+
imports: ["import { DsButtonV3 } from '@drivenets/design-system';"],
|
|
97
97
|
id: 'ds-button-v3',
|
|
98
98
|
metadata: { nestable: true },
|
|
99
|
-
};
|
|
99
|
+
} satisfies figma.Template;
|
|
@@ -11,6 +11,12 @@ const iconSizeMap: Record<ButtonV3Size, IconSize> = Object.freeze({
|
|
|
11
11
|
tiny: 'tiny',
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Button for user-triggered actions that do not navigate to another route.
|
|
16
|
+
* Supports color palettes, emphasis variants, sizes, icon-only layout, loading and selected states.
|
|
17
|
+
*
|
|
18
|
+
* @summary action button with color/variant/size, icon-only, loading and selected states
|
|
19
|
+
*/
|
|
14
20
|
const DsButtonV3 = ({
|
|
15
21
|
ref,
|
|
16
22
|
className,
|
|
@@ -51,9 +51,8 @@ const Root = ({
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* Card header
|
|
55
|
-
*
|
|
56
|
-
* or provide custom children for full flexibility.
|
|
54
|
+
* Card header — title row and optional trailing content.
|
|
55
|
+
* Provide custom children for full layout flexibility.
|
|
57
56
|
*/
|
|
58
57
|
const Header = ({ className, children, ref, ...rest }: DsCardHeaderProps) => (
|
|
59
58
|
<div ref={ref} className={classNames(styles.header, className)} {...rest}>
|
|
@@ -79,6 +78,11 @@ const Footer = ({ className, children, ref, ...rest }: DsCardFooterProps) => (
|
|
|
79
78
|
</div>
|
|
80
79
|
);
|
|
81
80
|
|
|
81
|
+
Root.displayName = 'DsCard.Root';
|
|
82
|
+
Header.displayName = 'DsCard.Header';
|
|
83
|
+
Body.displayName = 'DsCard.Body';
|
|
84
|
+
Footer.displayName = 'DsCard.Footer';
|
|
85
|
+
|
|
82
86
|
export const DsCard = {
|
|
83
87
|
Root,
|
|
84
88
|
Header,
|
|
@@ -9,7 +9,7 @@ import figma from 'figma';
|
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
example: figma.code`<DsCard.Body>Card content</DsCard.Body>`,
|
|
12
|
-
imports: ["import { DsCard } from '@drivenets/design-system'"],
|
|
12
|
+
imports: ["import { DsCard } from '@drivenets/design-system';"],
|
|
13
13
|
id: 'ds-card-content',
|
|
14
14
|
metadata: { nestable: true },
|
|
15
|
-
};
|
|
15
|
+
} satisfies figma.Template;
|
|
@@ -9,7 +9,7 @@ import figma from 'figma';
|
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
example: figma.code`<DsCard.Footer>Card footer</DsCard.Footer>`,
|
|
12
|
-
imports: ["import { DsCard } from '@drivenets/design-system'"],
|
|
12
|
+
imports: ["import { DsCard } from '@drivenets/design-system';"],
|
|
13
13
|
id: 'ds-card-footer',
|
|
14
14
|
metadata: { nestable: true },
|
|
15
|
-
};
|
|
15
|
+
} satisfies figma.Template;
|
|
@@ -9,7 +9,7 @@ import figma from 'figma';
|
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
example: figma.code`<DsCard.Header>Card title</DsCard.Header>`,
|
|
12
|
-
imports: ["import { DsCard } from '@drivenets/design-system'"],
|
|
12
|
+
imports: ["import { DsCard } from '@drivenets/design-system';"],
|
|
13
13
|
id: 'ds-card-header',
|
|
14
14
|
metadata: { nestable: true },
|
|
15
|
-
};
|
|
15
|
+
} satisfies figma.Template;
|
|
@@ -66,7 +66,7 @@ if (footer.type === 'INSTANCE') {
|
|
|
66
66
|
|
|
67
67
|
export default {
|
|
68
68
|
example: figma.code`<DsCard.Root size="${size}"${flagsAttr}>${headerCode}${contentCode}${footerCode}</DsCard.Root>`,
|
|
69
|
-
imports: ["import { DsCard } from '@drivenets/design-system'"],
|
|
69
|
+
imports: ["import { DsCard } from '@drivenets/design-system';"],
|
|
70
70
|
id: 'ds-card',
|
|
71
71
|
metadata: { nestable: false },
|
|
72
|
-
};
|
|
72
|
+
} satisfies figma.Template;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=38148-43478
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-catalog-layout
|
|
3
|
+
// component=DsCatalogLayout
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const type =
|
|
9
|
+
instance.getEnum('Type', {
|
|
10
|
+
empty: 'empty',
|
|
11
|
+
'collapsed side menu': 'collapsed',
|
|
12
|
+
'hover to expand side menu': 'hover',
|
|
13
|
+
'pin expanded side menu': 'pinned',
|
|
14
|
+
}) ?? 'empty';
|
|
15
|
+
|
|
16
|
+
const hasSideMenu = type !== 'empty';
|
|
17
|
+
const pinnedAttr = type === 'pinned' ? 'pinned' : 'pinned={false}';
|
|
18
|
+
|
|
19
|
+
const sideMenu = hasSideMenu
|
|
20
|
+
? figma.code`
|
|
21
|
+
<DsCatalogLayout.SideMenu ${pinnedAttr} onPinnedChange={() => {}}>
|
|
22
|
+
{/* DsTree / DsSideMenu navigation items */}
|
|
23
|
+
</DsCatalogLayout.SideMenu>`
|
|
24
|
+
: '';
|
|
25
|
+
|
|
26
|
+
const contentHeader =
|
|
27
|
+
type === 'empty'
|
|
28
|
+
? figma.code`<DsCatalogLayout.ContentHeader title={<DsTypography variant="heading3">Title</DsTypography>} />`
|
|
29
|
+
: figma.code`<DsCatalogLayout.ContentHeader title={<DsTypography variant="heading3">Title</DsTypography>}>
|
|
30
|
+
{/* DsSmartTabs */}
|
|
31
|
+
</DsCatalogLayout.ContentHeader>`;
|
|
32
|
+
|
|
33
|
+
const contentBody =
|
|
34
|
+
type === 'empty'
|
|
35
|
+
? '{/* EmptyStateCard + DsButtonV3 (no data / clear filters) */}'
|
|
36
|
+
: '{/* DsTable with data rows */}';
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
example: figma.code`<DsCatalogLayout>
|
|
40
|
+
<DsCatalogLayout.Header>{/* DsTopBarNavigation */}</DsCatalogLayout.Header>
|
|
41
|
+
<DsCatalogLayout.Body>${sideMenu}
|
|
42
|
+
<DsCatalogLayout.Content>
|
|
43
|
+
${contentHeader}
|
|
44
|
+
${contentBody}
|
|
45
|
+
</DsCatalogLayout.Content>
|
|
46
|
+
</DsCatalogLayout.Body>
|
|
47
|
+
</DsCatalogLayout>`,
|
|
48
|
+
imports: ["import { DsCatalogLayout, DsTypography } from '@drivenets/design-system';"],
|
|
49
|
+
id: 'ds-catalog-layout',
|
|
50
|
+
metadata: { nestable: false },
|
|
51
|
+
} satisfies figma.Template;
|
|
@@ -17,7 +17,7 @@ const DEFAULT_LOCALE = Object.freeze({
|
|
|
17
17
|
unpinButtonLabel: 'Unpin side menu',
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const DsCatalogLayoutRoot = ({ className, fillParent = false, ...rest }: DsCatalogLayoutProps) => {
|
|
21
21
|
const [hasSideMenu, setHasSideMenu] = useState(false);
|
|
22
22
|
|
|
23
23
|
const registerSideMenu = useCallback(() => setHasSideMenu(true), []);
|
|
@@ -121,10 +121,19 @@ const ContentHeader = ({
|
|
|
121
121
|
</div>
|
|
122
122
|
);
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
Header.displayName = 'DsCatalogLayout.Header';
|
|
125
|
+
Body.displayName = 'DsCatalogLayout.Body';
|
|
126
|
+
SideMenu.displayName = 'DsCatalogLayout.SideMenu';
|
|
127
|
+
Content.displayName = 'DsCatalogLayout.Content';
|
|
128
|
+
ContentHeader.displayName = 'DsCatalogLayout.ContentHeader';
|
|
129
|
+
|
|
130
|
+
const DsCatalogLayout = Object.assign(DsCatalogLayoutRoot, {
|
|
131
|
+
displayName: 'DsCatalogLayout',
|
|
132
|
+
Header,
|
|
133
|
+
Body,
|
|
134
|
+
SideMenu,
|
|
135
|
+
Content,
|
|
136
|
+
ContentHeader,
|
|
137
|
+
});
|
|
129
138
|
|
|
130
139
|
export default DsCatalogLayout;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=34856-101385
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-checkbox
|
|
3
|
+
// component=DsCheckbox
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const inner = instance.findInstance('DAP_checkbox_v03', { traverseInstances: true });
|
|
9
|
+
|
|
10
|
+
const color =
|
|
11
|
+
inner.type === 'INSTANCE' ? inner.getEnum('color', { Default: 'default', warning: 'warning' }) : 'default';
|
|
12
|
+
|
|
13
|
+
const checked =
|
|
14
|
+
inner.type === 'INSTANCE'
|
|
15
|
+
? inner.getEnum('checked', { unchecked: 'unchecked', checked: 'checked', partial: 'partial' })
|
|
16
|
+
: 'unchecked';
|
|
17
|
+
|
|
18
|
+
const state =
|
|
19
|
+
inner.type === 'INSTANCE'
|
|
20
|
+
? inner.getEnum('state', { default: 'default', hover: 'hover', focus: 'focus', disabled: 'disabled' })
|
|
21
|
+
: 'default';
|
|
22
|
+
|
|
23
|
+
const checkedAttr =
|
|
24
|
+
checked === 'partial' ? 'defaultChecked="indeterminate"' : checked === 'checked' ? 'defaultChecked' : '';
|
|
25
|
+
|
|
26
|
+
const attrs = [
|
|
27
|
+
'label="Label"',
|
|
28
|
+
color === 'warning' ? 'variant="warning"' : '',
|
|
29
|
+
checkedAttr,
|
|
30
|
+
state === 'disabled' ? 'disabled' : '',
|
|
31
|
+
]
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.join(' ');
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
example: figma.code`<DsCheckbox ${attrs} />`,
|
|
37
|
+
imports: ["import { DsCheckbox } from '@drivenets/design-system';"],
|
|
38
|
+
id: 'ds-checkbox-level-2',
|
|
39
|
+
metadata: { nestable: true },
|
|
40
|
+
} satisfies figma.Template;
|