@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
|
@@ -18,9 +18,24 @@ $bulk-actions-reserved-space: 80px;
|
|
|
18
18
|
border-style: solid;
|
|
19
19
|
border-color: var(--color-dap-gray-400);
|
|
20
20
|
background: var(--background);
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
max-height: 100%;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.controls {
|
|
28
|
+
background: var(--background);
|
|
29
|
+
border-bottom: 1px solid var(--border);
|
|
30
|
+
padding: var(--xs) var(--standard);
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
flex-shrink: 0;
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
.dataTableContainer {
|
|
37
|
+
flex: 1;
|
|
38
|
+
min-height: 0;
|
|
24
39
|
max-height: 100%;
|
|
25
40
|
overflow-x: auto;
|
|
26
41
|
overflow-y: hidden;
|
|
@@ -52,6 +52,7 @@ const DsTable = <TData extends { id: string }, TValue>({
|
|
|
52
52
|
ref,
|
|
53
53
|
columns: columnsProp,
|
|
54
54
|
data: tableData,
|
|
55
|
+
controls,
|
|
55
56
|
virtualized = false,
|
|
56
57
|
virtualizedOptions,
|
|
57
58
|
className,
|
|
@@ -336,41 +337,43 @@ const DsTable = <TData extends { id: string }, TValue>({
|
|
|
336
337
|
return (
|
|
337
338
|
<DsTableContext.Provider value={contextValue}>
|
|
338
339
|
<div
|
|
339
|
-
|
|
340
|
-
className={classnames(
|
|
341
|
-
styles.container,
|
|
342
|
-
!virtualized && styles.dataTableContainer,
|
|
343
|
-
virtualized && styles.virtualizedContainer,
|
|
344
|
-
isBulkActionsVisible && styles.bulkActionsVisible,
|
|
345
|
-
className,
|
|
346
|
-
)}
|
|
340
|
+
className={classnames(styles.container, isBulkActionsVisible && styles.bulkActionsVisible, className)}
|
|
347
341
|
>
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
342
|
+
{controls && <div className={styles.controls}>{controls}</div>}
|
|
343
|
+
<div
|
|
344
|
+
ref={tableContainerRef}
|
|
345
|
+
className={classnames(
|
|
346
|
+
!virtualized && styles.dataTableContainer,
|
|
347
|
+
virtualized && styles.virtualizedContainer,
|
|
348
|
+
)}
|
|
349
|
+
>
|
|
350
|
+
<DragWrapper>
|
|
351
|
+
<Table className={classnames(fullWidth && styles.fullWidth, !bordered && styles.tableNoBorder)}>
|
|
352
|
+
<DsTableHeader table={table} />
|
|
353
|
+
{virtualized ? (
|
|
354
|
+
<DsTableBodyVirtualized
|
|
355
|
+
table={table}
|
|
356
|
+
emptyState={emptyState}
|
|
357
|
+
estimateSize={virtualizedOptions?.estimateSize || ROW_SIZE_HEIGHT_MAP[rowSize]}
|
|
358
|
+
overscan={virtualizedOptions?.overscan}
|
|
359
|
+
onScroll={onScroll}
|
|
360
|
+
rowSelection={rowSelection}
|
|
361
|
+
infiniteScroll={infiniteScroll}
|
|
362
|
+
/>
|
|
363
|
+
) : (
|
|
364
|
+
<TableBody>
|
|
365
|
+
<SortableWrapper>
|
|
366
|
+
{rows.length
|
|
367
|
+
? rows.map((row) => (
|
|
368
|
+
<DsTableRow key={row.id} row={row} isSelected={!!rowSelection[row.id]} />
|
|
369
|
+
))
|
|
370
|
+
: renderEmptyState()}
|
|
371
|
+
</SortableWrapper>
|
|
372
|
+
</TableBody>
|
|
373
|
+
)}
|
|
374
|
+
</Table>
|
|
375
|
+
</DragWrapper>
|
|
376
|
+
</div>
|
|
374
377
|
{selectable && actions.length > 0 && (
|
|
375
378
|
<DsTableBulkActions
|
|
376
379
|
numSelectedRows={selectedRows.length}
|
|
@@ -386,4 +389,6 @@ const DsTable = <TData extends { id: string }, TValue>({
|
|
|
386
389
|
);
|
|
387
390
|
};
|
|
388
391
|
|
|
392
|
+
DsTable.displayName = 'DsTable';
|
|
393
|
+
|
|
389
394
|
export default DsTable;
|
|
@@ -228,6 +228,12 @@ export interface DsDataTableProps<TData, TValue> {
|
|
|
228
228
|
*/
|
|
229
229
|
data: TData[];
|
|
230
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Optional content rendered in a pinned controls bar above the table header
|
|
233
|
+
* (e.g. filters, action buttons). Layout is owned by the consumer.
|
|
234
|
+
*/
|
|
235
|
+
controls?: React.ReactNode;
|
|
236
|
+
|
|
231
237
|
/**
|
|
232
238
|
* Whether the table is virtualized
|
|
233
239
|
* @default false
|
|
@@ -11,7 +11,7 @@ import figma from 'figma';
|
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
13
|
example: figma.code`<DsTable columns={columns} data={data} expandable renderExpandedRow={(row) => null} />`,
|
|
14
|
-
imports: ["import { DsTable } from '@drivenets/design-system'"],
|
|
14
|
+
imports: ["import { DsTable } from '@drivenets/design-system';"],
|
|
15
15
|
id: 'ds-table-expandable',
|
|
16
16
|
metadata: { nestable: false },
|
|
17
|
-
};
|
|
17
|
+
} satisfies figma.Template;
|
|
@@ -10,7 +10,7 @@ import figma from 'figma';
|
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
example: figma.code`<DsTable columns={columns} data={data} />`,
|
|
13
|
-
imports: ["import { DsTable } from '@drivenets/design-system'"],
|
|
13
|
+
imports: ["import { DsTable } from '@drivenets/design-system';"],
|
|
14
14
|
id: 'ds-table',
|
|
15
15
|
metadata: { nestable: false },
|
|
16
|
-
};
|
|
16
|
+
} satisfies figma.Template;
|
|
@@ -10,6 +10,9 @@ export type { DsTableEditDisabledResult } from './ds-table-column.types';
|
|
|
10
10
|
export { default as DsTable } from './ds-table';
|
|
11
11
|
export * from './ds-table.types';
|
|
12
12
|
|
|
13
|
+
export { createColumnHelper } from '@tanstack/react-table';
|
|
14
|
+
export type { ColumnDef } from '@tanstack/react-table';
|
|
15
|
+
|
|
13
16
|
export { useCellEditor } from './hooks/use-cell-editor';
|
|
14
17
|
export type {
|
|
15
18
|
UseCellEditorOptions,
|
|
@@ -72,7 +72,7 @@ const attrs = [`value="${value}"`, `label="${label}"`, icon ? `icon="${icon}"` :
|
|
|
72
72
|
|
|
73
73
|
export default {
|
|
74
74
|
example: figma.code`<DsTabs.Tab ${attrs} />`,
|
|
75
|
-
imports: ["import { DsTabs } from '@drivenets/design-system'"],
|
|
75
|
+
imports: ["import { DsTabs } from '@drivenets/design-system';"],
|
|
76
76
|
id: 'ds-tabs-tab-vertical',
|
|
77
77
|
metadata: { nestable: true },
|
|
78
|
-
};
|
|
78
|
+
} satisfies figma.Template;
|
|
@@ -83,7 +83,7 @@ const attrs = [
|
|
|
83
83
|
|
|
84
84
|
export default {
|
|
85
85
|
example: figma.code`<DsTabs.Tab ${attrs} />`,
|
|
86
|
-
imports: ["import { DsTabs } from '@drivenets/design-system'"],
|
|
86
|
+
imports: ["import { DsTabs } from '@drivenets/design-system';"],
|
|
87
87
|
id: 'ds-tabs-tab',
|
|
88
88
|
metadata: { nestable: true },
|
|
89
|
-
};
|
|
89
|
+
} satisfies figma.Template;
|
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
<DsTabs.List>${tabs}</DsTabs.List>
|
|
26
26
|
{/* Add a <DsTabs.Content value="..."> panel for each tab */}
|
|
27
27
|
</DsTabs.Root>`,
|
|
28
|
-
imports: ["import { DsTabs } from '@drivenets/design-system'"],
|
|
28
|
+
imports: ["import { DsTabs } from '@drivenets/design-system';"],
|
|
29
29
|
id: 'ds-tabs-vertical',
|
|
30
30
|
metadata: { nestable: false },
|
|
31
|
-
};
|
|
31
|
+
} satisfies figma.Template;
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
<DsTabs.List>${tabs}</DsTabs.List>
|
|
24
24
|
{/* Add a <DsTabs.Content value="..."> panel for each tab */}
|
|
25
25
|
</DsTabs.Root>`,
|
|
26
|
-
imports: ["import { DsTabs } from '@drivenets/design-system'"],
|
|
26
|
+
imports: ["import { DsTabs } from '@drivenets/design-system';"],
|
|
27
27
|
id: 'ds-tabs',
|
|
28
28
|
metadata: { nestable: false },
|
|
29
|
-
};
|
|
29
|
+
} satisfies figma.Template;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=39475-58722
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-text-input
|
|
3
|
+
// component=DsTextInput
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
interface FieldInfo {
|
|
7
|
+
component: string;
|
|
8
|
+
fcMember?: string;
|
|
9
|
+
size?: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
data?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const textInfo: FieldInfo = { component: 'DsTextInput', fcMember: 'TextInput', size: true, readOnly: true };
|
|
16
|
+
|
|
17
|
+
const registry: Record<string, FieldInfo> = {
|
|
18
|
+
text: textInfo,
|
|
19
|
+
textArea: { component: 'DsTextarea', fcMember: 'Textarea' },
|
|
20
|
+
number: { component: 'DsNumberInput', fcMember: 'NumberInput', size: true, readOnly: true },
|
|
21
|
+
password: { component: 'DsPasswordInput', fcMember: 'PasswordInput', size: true, readOnly: true },
|
|
22
|
+
select: { component: 'DsSelect', fcMember: 'Select', invalid: true, data: 'options={[]} value=""' },
|
|
23
|
+
date: { component: 'DsDateInput', fcMember: 'DateInput' },
|
|
24
|
+
time: { component: 'DsTimePicker', fcMember: 'TimePicker' },
|
|
25
|
+
autocompleteSearch: {
|
|
26
|
+
component: 'DsAutocomplete',
|
|
27
|
+
invalid: true,
|
|
28
|
+
data: 'options={[]} showTrigger={false}',
|
|
29
|
+
},
|
|
30
|
+
autocompleteCombobox: { component: 'DsAutocomplete', invalid: true, data: 'options={[]}' },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const instance = figma.selectedInstance;
|
|
34
|
+
|
|
35
|
+
const size = instance.getEnum('size', {
|
|
36
|
+
small: 'small',
|
|
37
|
+
medium: 'medium',
|
|
38
|
+
large: 'large',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const state = instance.getEnum('state', {
|
|
42
|
+
default: 'default',
|
|
43
|
+
hover: 'hover',
|
|
44
|
+
focus: 'focus',
|
|
45
|
+
disabled: 'disabled',
|
|
46
|
+
'read-only': 'readOnly',
|
|
47
|
+
error: 'error',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const part = instance.findInstance('DAP-part_InputType_v01', { traverseInstances: true });
|
|
51
|
+
const inputType =
|
|
52
|
+
(part.type === 'INSTANCE'
|
|
53
|
+
? part.getEnum('inputType', {
|
|
54
|
+
text: 'text',
|
|
55
|
+
'text-area': 'textArea',
|
|
56
|
+
select: 'select',
|
|
57
|
+
password: 'password',
|
|
58
|
+
number: 'number',
|
|
59
|
+
date: 'date',
|
|
60
|
+
time: 'time',
|
|
61
|
+
'autocomplete-search': 'autocompleteSearch',
|
|
62
|
+
'autocomplete-combobox': 'autocompleteCombobox',
|
|
63
|
+
})
|
|
64
|
+
: 'text') ?? 'text';
|
|
65
|
+
|
|
66
|
+
const info = registry[inputType] ?? textInfo;
|
|
67
|
+
|
|
68
|
+
const disabled = state === 'disabled';
|
|
69
|
+
const readOnly = state === 'readOnly';
|
|
70
|
+
const error = state === 'error';
|
|
71
|
+
|
|
72
|
+
const attrs = [
|
|
73
|
+
info.size && size === 'small' ? 'size="small"' : '',
|
|
74
|
+
info.data ?? '',
|
|
75
|
+
disabled ? 'disabled' : '',
|
|
76
|
+
info.readOnly && readOnly ? 'readOnly' : '',
|
|
77
|
+
info.invalid && error ? 'invalid' : '',
|
|
78
|
+
]
|
|
79
|
+
.filter(Boolean)
|
|
80
|
+
.join(' ');
|
|
81
|
+
|
|
82
|
+
export default {
|
|
83
|
+
example: figma.code`<${info.component} ${attrs} />`,
|
|
84
|
+
imports: [`import { ${info.component} } from '@drivenets/design-system';`],
|
|
85
|
+
id: 'ds-input-field-v02',
|
|
86
|
+
metadata: { nestable: true, props: { fcMember: info.fcMember, fcProps: attrs } },
|
|
87
|
+
} satisfies figma.Template;
|
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
: type === 'password'
|
|
55
55
|
? figma.code`<DsPasswordInput ${sizeAttr} ${disabled ? 'disabled' : ''} />`
|
|
56
56
|
: figma.code`<DsTextInput ${sizeAttr} ${disabled ? 'disabled' : ''} ${readOnly ? 'readOnly' : ''} />`,
|
|
57
|
-
imports: [`import { ${componentName} } from '@drivenets/design-system'
|
|
57
|
+
imports: [`import { ${componentName} } from '@drivenets/design-system';`],
|
|
58
58
|
id: 'ds-text-input',
|
|
59
59
|
metadata: { nestable: true, props: { fcMember, fcProps } },
|
|
60
|
-
};
|
|
60
|
+
} satisfies figma.Template;
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
example: figma.code`const [value, setValue] = useState<Date | null>(null);
|
|
13
13
|
|
|
14
14
|
<DsTimePicker value={value} onChange={setValue} placeholder="hh:mm AM/PM" />`,
|
|
15
|
-
imports: ["import {
|
|
15
|
+
imports: ["import { DsTimePicker } from '@drivenets/design-system';", "import { useState } from 'react';"],
|
|
16
16
|
id: 'ds-time-picker',
|
|
17
17
|
metadata: { nestable: true, props: { fcMember: 'TimePicker', fcProps: '' } },
|
|
18
|
-
};
|
|
18
|
+
} satisfies figma.Template;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15100-3016
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-toast
|
|
3
|
+
// component=DsToast
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const variant = instance.getEnum('Type', {
|
|
9
|
+
info: 'info',
|
|
10
|
+
success: 'success',
|
|
11
|
+
warning: 'warning',
|
|
12
|
+
error: 'error',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const extended = instance.getEnum('Extended', { True: true, False: false });
|
|
16
|
+
const cta = instance.getEnum('CTA', { True: true, False: false });
|
|
17
|
+
|
|
18
|
+
const titleLine = extended ? `\n\ttitle: 'Title',` : '';
|
|
19
|
+
const actionsLine = cta ? `\n\tactions: <DsButtonV3 variant="secondary">Action</DsButtonV3>,` : '';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
example: figma.code`const { createToast } = useToaster();
|
|
23
|
+
|
|
24
|
+
createToast({
|
|
25
|
+
variant: '${variant}',${titleLine}
|
|
26
|
+
description: 'Description',${actionsLine}
|
|
27
|
+
});`,
|
|
28
|
+
imports: [
|
|
29
|
+
"import { useToaster } from '@drivenets/design-system';",
|
|
30
|
+
"import { DsButtonV3 } from '@drivenets/design-system';",
|
|
31
|
+
],
|
|
32
|
+
id: 'ds-toast',
|
|
33
|
+
metadata: { nestable: false },
|
|
34
|
+
} satisfies figma.Template;
|
|
@@ -51,4 +51,7 @@ const DsToastGroup: React.FC<{ toaster: CreateToasterReturn }> = ({ toaster }) =
|
|
|
51
51
|
return <Toaster toaster={toaster}>{(toast: DsToastProps) => <DsToast {...toast} />}</Toaster>;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
DsToast.displayName = 'DsToast';
|
|
55
|
+
DsToastGroup.displayName = 'DsToastGroup';
|
|
56
|
+
|
|
54
57
|
export { DsToast, DsToastGroup };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=15035-29699
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-toggle
|
|
3
|
+
// component=DsToggle
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const on = instance.getEnum('On', {
|
|
9
|
+
Yes: 'yes',
|
|
10
|
+
No: 'no',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const size = instance.getEnum('Size', {
|
|
14
|
+
Default: 'default',
|
|
15
|
+
Small: 'small',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const state = instance.getEnum('State', {
|
|
19
|
+
Default: 'default',
|
|
20
|
+
Hover: 'hover',
|
|
21
|
+
Focus: 'focus',
|
|
22
|
+
Disabled: 'disabled',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const attrs = [
|
|
26
|
+
'label="Label"',
|
|
27
|
+
size === 'small' ? 'size="small"' : '',
|
|
28
|
+
on === 'yes' ? 'checked' : '',
|
|
29
|
+
state === 'disabled' ? 'disabled' : '',
|
|
30
|
+
]
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.join(' ');
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
example: figma.code`<DsToggle ${attrs} />`,
|
|
36
|
+
imports: ["import { DsToggle } from '@drivenets/design-system';"],
|
|
37
|
+
id: 'ds-toggle',
|
|
38
|
+
metadata: { nestable: true },
|
|
39
|
+
} satisfies figma.Template;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=14845-9203
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-tooltip
|
|
3
|
+
// component=DsTooltip
|
|
4
|
+
import figma from 'figma';
|
|
5
|
+
|
|
6
|
+
const instance = figma.selectedInstance;
|
|
7
|
+
|
|
8
|
+
const labelNode = instance.findText('Tooltip', { traverseInstances: true });
|
|
9
|
+
const content = labelNode.type === 'TEXT' ? labelNode.textContent : 'Tooltip text';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
example: figma.code`<DsTooltip content="${content}">{/* trigger element */}</DsTooltip>`,
|
|
13
|
+
imports: ["import { DsTooltip } from '@drivenets/design-system';"],
|
|
14
|
+
id: 'ds-tooltip',
|
|
15
|
+
metadata: { nestable: false },
|
|
16
|
+
} satisfies figma.Template;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
@use '../../styles/typography';
|
|
2
|
+
|
|
1
3
|
.tooltip {
|
|
4
|
+
--arrow-size: 7px;
|
|
2
5
|
color: var(--font-on-action);
|
|
3
6
|
background-color: var(--background-brand);
|
|
4
7
|
padding: var(--xs) var(--sm);
|
|
@@ -8,6 +11,10 @@
|
|
|
8
11
|
z-index: 9999;
|
|
9
12
|
}
|
|
10
13
|
|
|
14
|
+
.text {
|
|
15
|
+
@include typography.body-xs-reg;
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
.arrow {
|
|
12
|
-
|
|
19
|
+
--arrow-background: var(--color-dap-gray-700);
|
|
13
20
|
}
|
|
@@ -1,33 +1,53 @@
|
|
|
1
1
|
import { type FC, isValidElement } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { Tooltip } from '@ark-ui/react/tooltip';
|
|
3
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import styles from './ds-tooltip.module.scss';
|
|
5
6
|
import type { DsTooltipProps } from './ds-tooltip.types';
|
|
6
|
-
import { DsTypography } from '../ds-typography';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const OPEN_DELAY_MS = 200;
|
|
9
|
+
const CLOSE_DELAY_MS = 0;
|
|
10
|
+
const TOOLTIP_GUTTER_PX = 0;
|
|
11
|
+
|
|
12
|
+
const DsTooltip: FC<DsTooltipProps> = ({
|
|
13
|
+
content,
|
|
14
|
+
children,
|
|
15
|
+
placement = 'top',
|
|
16
|
+
disabled = false,
|
|
17
|
+
getAnchorRect,
|
|
18
|
+
slotProps,
|
|
19
|
+
}) => {
|
|
9
20
|
if (content === undefined) {
|
|
10
21
|
return children;
|
|
11
22
|
}
|
|
23
|
+
|
|
12
24
|
return (
|
|
13
|
-
<Tooltip.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
<Tooltip.Root
|
|
26
|
+
openDelay={OPEN_DELAY_MS}
|
|
27
|
+
closeDelay={CLOSE_DELAY_MS}
|
|
28
|
+
disabled={disabled}
|
|
29
|
+
positioning={{ placement, gutter: TOOLTIP_GUTTER_PX, getAnchorRect: getAnchorRect ?? undefined }}
|
|
30
|
+
lazyMount
|
|
31
|
+
unmountOnExit
|
|
32
|
+
>
|
|
33
|
+
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
|
34
|
+
<Portal>
|
|
35
|
+
<Tooltip.Positioner>
|
|
17
36
|
<Tooltip.Content
|
|
18
37
|
className={classNames(styles.tooltip, slotProps?.content?.className)}
|
|
19
38
|
style={slotProps?.content?.style}
|
|
20
|
-
side="top"
|
|
21
|
-
align="center"
|
|
22
|
-
sideOffset={4}
|
|
23
39
|
>
|
|
24
|
-
{isValidElement(content) ? content : <
|
|
25
|
-
<Tooltip.Arrow className={styles.arrow}
|
|
40
|
+
{isValidElement(content) ? content : <span className={styles.text}>{content}</span>}
|
|
41
|
+
<Tooltip.Arrow className={styles.arrow}>
|
|
42
|
+
<Tooltip.ArrowTip />
|
|
43
|
+
</Tooltip.Arrow>
|
|
26
44
|
</Tooltip.Content>
|
|
27
|
-
</Tooltip.
|
|
28
|
-
</
|
|
29
|
-
</Tooltip.
|
|
45
|
+
</Tooltip.Positioner>
|
|
46
|
+
</Portal>
|
|
47
|
+
</Tooltip.Root>
|
|
30
48
|
);
|
|
31
49
|
};
|
|
32
50
|
|
|
51
|
+
DsTooltip.displayName = 'DsTooltip';
|
|
52
|
+
|
|
33
53
|
export default DsTooltip;
|