@drivenets/design-system 0.17.0 → 0.18.1
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 +24 -0
- package/dist/index.cjs +1797 -805
- package/dist/index.d.cts +117 -53
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +117 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1799 -809
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +3 -3
- package/src/components/ds-alert-banner/ds-alert-banner-global.figma.ts +49 -0
- package/src/components/ds-alert-banner/ds-alert-banner.figma.ts +51 -0
- package/src/components/ds-autocomplete/ds-autocomplete.module.scss +15 -4
- package/src/components/ds-autocomplete/ds-autocomplete.tsx +10 -3
- package/src/components/ds-autocomplete/ds-autocomplete.types.ts +8 -0
- package/src/components/ds-button-v3/ds-button-v3.figma.ts +5 -3
- package/src/components/ds-button-v3/ds-button-v3.module.scss +84 -17
- package/src/components/ds-button-v3/ds-button-v3.tsx +2 -0
- package/src/components/ds-button-v3/ds-button-v3.types.ts +11 -2
- package/src/components/ds-button-v3/ds-button-v4.figma.ts +121 -0
- package/src/components/ds-comment-bubble/ds-comment-bubble.figma.ts +52 -0
- package/src/components/ds-comment-card/ds-comment-card.figma.ts +36 -0
- package/src/components/ds-comment-indicator/ds-comment-indicator.figma.ts +32 -0
- package/src/components/ds-comments-drawer/ds-comments-drawer.figma.ts +19 -0
- package/src/components/ds-select/ds-select.figma.ts +2 -1
- package/src/components/ds-select/ds-select.tsx +6 -1
- package/src/components/ds-select/ds-select.types.ts +2 -1
- package/src/components/ds-slider/ds-slider.figma.ts +29 -0
- package/src/components/ds-slider/ds-slider.module.scss +104 -0
- package/src/components/ds-slider/ds-slider.tsx +118 -0
- package/src/components/ds-slider/ds-slider.types.ts +102 -0
- package/src/components/ds-slider/ds-slider.utils.ts +14 -0
- package/src/components/ds-slider/index.ts +11 -0
- package/src/components/ds-smart-tabs/figma/ds-smart-tabs-tab.figma.ts +83 -0
- package/src/components/ds-smart-tabs/figma/ds-smart-tabs.figma.ts +23 -0
- package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.module.scss +5 -1
- package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.tsx +15 -3
- package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +15 -1
- package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +29 -6
- package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.module.scss +23 -0
- package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.tsx +218 -0
- package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.types.ts +14 -0
- package/src/components/ds-table/components/ds-table-resize-handle/index.ts +1 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.module.scss +18 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.tsx +16 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.types.ts +13 -0
- package/src/components/ds-table/components/ds-table-resize-overlay/index.ts +1 -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 +9 -2
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.module.scss +2 -1
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.tsx +9 -2
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-checkbox.tsx +2 -2
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-date.tsx +2 -1
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-number.tsx +2 -1
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-select.tsx +2 -1
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-text.tsx +2 -1
- package/src/components/ds-table/components/edit/ds-table-editing-cell/ds-table-editing-cell.tsx +12 -3
- package/src/components/ds-table/context/ds-table-context.tsx +208 -0
- package/src/components/ds-table/ds-table-defaults.ts +42 -0
- package/src/components/ds-table/ds-table.module.scss +4 -1
- package/src/components/ds-table/ds-table.tsx +139 -214
- package/src/components/ds-table/ds-table.types.ts +53 -47
- package/src/components/ds-table/grouping/utils/column-group.ts +7 -5
- package/src/components/ds-table/hooks/use-cell-editor.ts +5 -1
- package/src/components/ds-table/hooks/use-column-resize.ts +385 -0
- package/src/components/ds-table/hooks/use-editing-state.ts +190 -0
- package/src/components/ds-table/index.ts +1 -0
- package/src/components/ds-table/styles/_variables.scss +2 -1
- package/src/components/ds-table/utils/column-size-meta.augmentation.ts +16 -0
- package/src/components/ds-table/utils/column-size.ts +213 -10
- package/src/components/ds-table/utils/column-size.unit.test.ts +213 -0
- package/src/components/ds-table/utils/constants.ts +28 -0
- package/src/components/ds-table/utils/frozen-body.ts +33 -0
- package/src/components/ds-table/utils/frozen-body.unit.test.ts +44 -0
- package/src/components/ds-table/utils/table-api.ts +42 -0
- package/src/components/ds-table/utils/table-api.unit.test.ts +82 -0
- package/src/components/ds-table/utils/table-columns.tsx +119 -0
- package/src/components/ds-table/utils/table-columns.unit.test.ts +199 -0
- package/src/components/ds-tag/ds-tag.figma.ts +51 -0
- package/src/components/ds-tag-filter/ds-tag-filter.figma.ts +16 -0
- package/src/components/ds-tag-filter/ds-tag-filter.module.scss +7 -35
- package/src/components/ds-tag-filter/ds-tag-filter.tsx +34 -57
- package/src/components/ds-tag-filter/ds-tag-filter.types.ts +2 -1
- package/src/components/ds-tag-filter/hooks/use-tag-overflow-calculation.ts +13 -18
- package/src/components/ds-text-input/ds-input-field-v02.figma.ts +29 -4
- package/src/components/ds-text-input/ds-text-input.figma.ts +3 -2
- package/src/components/ds-text-input/ds-text-input.tsx +1 -0
- package/src/components/ds-text-input/ds-text-input.types.ts +1 -1
- package/src/components/ds-tree/ds-tree.figma.ts +54 -0
- package/src/components/ds-workspace-layout/ds-workspace-layout.figma.ts +99 -0
- package/src/components/ds-workspace-layout/ds-workspace-layout.module.scss +1 -8
- package/src/index.ts +1 -0
- package/src/styles/_gradients.scss +19 -0
- package/src/styles/_root.scss +39 -15
- package/src/styles/_typography.scss +1 -0
- package/src/styles/shared/_input.scss +10 -0
- package/src/styles/styles.scss +1 -0
- package/src/components/ds-table/context/ds-table-context.ts +0 -112
|
@@ -7,27 +7,49 @@ interface FieldInfo {
|
|
|
7
7
|
component: string;
|
|
8
8
|
fcMember?: string;
|
|
9
9
|
size?: boolean;
|
|
10
|
+
large?: boolean;
|
|
10
11
|
readOnly?: boolean;
|
|
11
12
|
invalid?: boolean;
|
|
12
13
|
data?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const textInfo: FieldInfo = {
|
|
16
|
+
const textInfo: FieldInfo = {
|
|
17
|
+
component: 'DsTextInput',
|
|
18
|
+
fcMember: 'TextInput',
|
|
19
|
+
size: true,
|
|
20
|
+
large: true,
|
|
21
|
+
readOnly: true,
|
|
22
|
+
};
|
|
16
23
|
|
|
17
24
|
const registry: Record<string, FieldInfo> = {
|
|
18
25
|
text: textInfo,
|
|
19
26
|
textArea: { component: 'DsTextarea', fcMember: 'Textarea' },
|
|
20
27
|
number: { component: 'DsNumberInput', fcMember: 'NumberInput', size: true, readOnly: true },
|
|
21
28
|
password: { component: 'DsPasswordInput', fcMember: 'PasswordInput', size: true, readOnly: true },
|
|
22
|
-
select: {
|
|
29
|
+
select: {
|
|
30
|
+
component: 'DsSelect',
|
|
31
|
+
fcMember: 'Select',
|
|
32
|
+
size: true,
|
|
33
|
+
large: true,
|
|
34
|
+
invalid: true,
|
|
35
|
+
data: 'options={[]} value=""',
|
|
36
|
+
},
|
|
23
37
|
date: { component: 'DsDateInput', fcMember: 'DateInput' },
|
|
24
38
|
time: { component: 'DsTimePicker', fcMember: 'TimePicker' },
|
|
25
39
|
autocompleteSearch: {
|
|
26
40
|
component: 'DsAutocomplete',
|
|
41
|
+
size: true,
|
|
42
|
+
large: true,
|
|
27
43
|
invalid: true,
|
|
28
44
|
data: 'options={[]} showTrigger={false}',
|
|
29
45
|
},
|
|
30
|
-
autocompleteCombobox: {
|
|
46
|
+
autocompleteCombobox: {
|
|
47
|
+
component: 'DsAutocomplete',
|
|
48
|
+
size: true,
|
|
49
|
+
large: true,
|
|
50
|
+
invalid: true,
|
|
51
|
+
data: 'options={[]}',
|
|
52
|
+
},
|
|
31
53
|
};
|
|
32
54
|
|
|
33
55
|
const instance = figma.selectedInstance;
|
|
@@ -69,8 +91,11 @@ const disabled = state === 'disabled';
|
|
|
69
91
|
const readOnly = state === 'readOnly';
|
|
70
92
|
const error = state === 'error';
|
|
71
93
|
|
|
94
|
+
const sizeAttr =
|
|
95
|
+
info.size && size === 'small' ? 'size="small"' : info.large && size === 'large' ? 'size="large"' : '';
|
|
96
|
+
|
|
72
97
|
const attrs = [
|
|
73
|
-
|
|
98
|
+
sizeAttr,
|
|
74
99
|
info.data ?? '',
|
|
75
100
|
disabled ? 'disabled' : '',
|
|
76
101
|
info.readOnly && readOnly ? 'readOnly' : '',
|
|
@@ -22,7 +22,7 @@ const type = instance.getEnum('Type', {
|
|
|
22
22
|
const size = instance.getEnum('Size', {
|
|
23
23
|
Small: 'small',
|
|
24
24
|
Default: 'default',
|
|
25
|
-
Large: '
|
|
25
|
+
Large: 'large',
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const state = instance.getEnum('State', {
|
|
@@ -36,7 +36,8 @@ const state = instance.getEnum('State', {
|
|
|
36
36
|
const disabled = state === 'disabled';
|
|
37
37
|
const readOnly = type === 'readOnly' || state === 'readOnly';
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const isTextType = type !== 'number' && type !== 'password';
|
|
40
|
+
const sizeAttr = size === 'small' ? 'size="small"' : size === 'large' && isTextType ? 'size="large"' : '';
|
|
40
41
|
|
|
41
42
|
const componentName =
|
|
42
43
|
type === 'number' ? 'DsNumberInput' : type === 'password' ? 'DsPasswordInput' : 'DsTextInput';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
|
|
4
|
-
export const textInputSizes = ['small', 'default'] as const;
|
|
4
|
+
export const textInputSizes = ['small', 'default', 'large'] as const;
|
|
5
5
|
export type TextInputSize = (typeof textInputSizes)[number];
|
|
6
6
|
|
|
7
7
|
export interface DsTextInputProps {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=34873-157787
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-tree
|
|
3
|
+
// component=DsTree
|
|
4
|
+
//
|
|
5
|
+
// `DsTreeV2` is the collection-driven tree. Figma models the branch/item sub-parts
|
|
6
|
+
// (branch-control, branch-text, item-text, indicators, indent guide) as separate
|
|
7
|
+
// components and exposes `side nav` / `map` / `workflows` preview presets via
|
|
8
|
+
// `Property 1`, but code never hand-assembles those parts: it composes `DsTree.Root`
|
|
9
|
+
// with a `createDsTreeCollection` data source and one recursive `DsTree.NodeProvider`
|
|
10
|
+
// renderer. The snippet is the canonical usage referenced by the Storybook docs.
|
|
11
|
+
import figma from 'figma';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
example: figma.code`const collection = createDsTreeCollection([
|
|
15
|
+
{
|
|
16
|
+
id: 'network',
|
|
17
|
+
name: 'Network',
|
|
18
|
+
children: [
|
|
19
|
+
{ id: 'routers', name: 'Routers', children: [{ id: 'router-1', name: 'Router Alpha' }] },
|
|
20
|
+
{ id: 'firewall-1', name: 'Firewall Primary' },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{ id: 'monitoring', name: 'Monitoring', children: [{ id: 'alerts', name: 'Alerts' }] },
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
<DsTree.Root collection={collection} defaultExpandedValue={['network']}>
|
|
27
|
+
<DsTree.Tree>
|
|
28
|
+
{collection.rootNode.children?.map((node, index) => (
|
|
29
|
+
<DsTree.NodeProvider key={node.id} node={node} indexPath={[index]}>
|
|
30
|
+
{node.children ? (
|
|
31
|
+
<DsTree.Branch>
|
|
32
|
+
<DsTree.BranchControl>
|
|
33
|
+
<DsTree.BranchIndicator />
|
|
34
|
+
<DsTree.BranchText>{node.name}</DsTree.BranchText>
|
|
35
|
+
</DsTree.BranchControl>
|
|
36
|
+
<DsTree.BranchContent>
|
|
37
|
+
<DsTree.BranchIndentGuide />
|
|
38
|
+
{/* recurse over node.children with another DsTree.NodeProvider */}
|
|
39
|
+
</DsTree.BranchContent>
|
|
40
|
+
</DsTree.Branch>
|
|
41
|
+
) : (
|
|
42
|
+
<DsTree.Item>
|
|
43
|
+
<DsTree.ItemIndicator />
|
|
44
|
+
<DsTree.ItemText>{node.name}</DsTree.ItemText>
|
|
45
|
+
</DsTree.Item>
|
|
46
|
+
)}
|
|
47
|
+
</DsTree.NodeProvider>
|
|
48
|
+
))}
|
|
49
|
+
</DsTree.Tree>
|
|
50
|
+
</DsTree.Root>`,
|
|
51
|
+
imports: ["import { DsTree, createDsTreeCollection } from '@drivenets/design-system';"],
|
|
52
|
+
id: 'ds-tree',
|
|
53
|
+
metadata: { nestable: false },
|
|
54
|
+
} satisfies figma.Template;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=32960-46399
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-workspace-layout
|
|
3
|
+
// component=DsWorkspaceLayout.Header
|
|
4
|
+
//
|
|
5
|
+
// Maps Part_workspace-header_v02 / DAP_workspace-header_v02. Figma `Type` selects the
|
|
6
|
+
// example Header composition; Figma `Status` is ignored (badge always shown).
|
|
7
|
+
// Layout divs are structural only — consumers supply their own header chrome CSS.
|
|
8
|
+
import figma from 'figma';
|
|
9
|
+
|
|
10
|
+
const instance = figma.selectedInstance;
|
|
11
|
+
|
|
12
|
+
const type =
|
|
13
|
+
instance.getEnum('Type', {
|
|
14
|
+
draft: 'draft',
|
|
15
|
+
pending: 'pending',
|
|
16
|
+
running: 'running',
|
|
17
|
+
}) ?? 'draft';
|
|
18
|
+
|
|
19
|
+
const draftHeader = figma.code`<DsWorkspaceLayout.Header>
|
|
20
|
+
{/* left / center / right — style with consumer CSS (flex row) */}
|
|
21
|
+
<div>
|
|
22
|
+
<DsButtonV3 variant="secondary" color="light" size="small" icon="close">
|
|
23
|
+
Close
|
|
24
|
+
</DsButtonV3>
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<DsTypography variant="body-sm-reg">Untitled Project -23-May-2024 04:47 PM</DsTypography>
|
|
28
|
+
<DsIcon icon="info" size="tiny" />
|
|
29
|
+
<DsStatusBadgeV2 phase="temporary" label="Draft" size="small" />
|
|
30
|
+
</div>
|
|
31
|
+
<div>
|
|
32
|
+
<DsButtonV3 variant="secondary" color="light" size="small">
|
|
33
|
+
Discard
|
|
34
|
+
</DsButtonV3>
|
|
35
|
+
<DsButtonV3 variant="primary" color="light" size="small">
|
|
36
|
+
Save project
|
|
37
|
+
</DsButtonV3>
|
|
38
|
+
<DsButtonV3 variant="tertiary" color="light" size="small" icon="more_vert" aria-label="More actions" />
|
|
39
|
+
</div>
|
|
40
|
+
</DsWorkspaceLayout.Header>`;
|
|
41
|
+
|
|
42
|
+
const pendingHeader = figma.code`<DsWorkspaceLayout.Header>
|
|
43
|
+
{/* left / center / right — style with consumer CSS (flex row) */}
|
|
44
|
+
<div>
|
|
45
|
+
<DsButtonV3 variant="secondary" color="light" size="small" icon="close">
|
|
46
|
+
Close
|
|
47
|
+
</DsButtonV3>
|
|
48
|
+
</div>
|
|
49
|
+
<div>
|
|
50
|
+
<DsTypography variant="body-sm-reg">Untitled Project -23-May-2024 04:47 PM</DsTypography>
|
|
51
|
+
<DsIcon icon="info" size="tiny" />
|
|
52
|
+
<DsStatusBadgeV2 phase="pending" label="Pending" size="small" />
|
|
53
|
+
</div>
|
|
54
|
+
<div>
|
|
55
|
+
<DsButtonV3 variant="secondary" color="light" size="small">
|
|
56
|
+
Discard
|
|
57
|
+
</DsButtonV3>
|
|
58
|
+
<DsButtonV3 variant="primary" color="light" size="small">
|
|
59
|
+
Save project
|
|
60
|
+
</DsButtonV3>
|
|
61
|
+
<DsButtonV3 variant="tertiary" color="light" size="small" icon="more_vert" aria-label="More actions" />
|
|
62
|
+
</div>
|
|
63
|
+
</DsWorkspaceLayout.Header>`;
|
|
64
|
+
|
|
65
|
+
const runningHeader = figma.code`<DsWorkspaceLayout.Header>
|
|
66
|
+
{/* left / center / right — style with consumer CSS (flex row) */}
|
|
67
|
+
<div>
|
|
68
|
+
<DsButtonV3 variant="secondary" color="light" size="small" icon="close">
|
|
69
|
+
Close
|
|
70
|
+
</DsButtonV3>
|
|
71
|
+
<DsButtonV3 variant="secondary" color="light" size="small" icon="keyboard_double_arrow_left">
|
|
72
|
+
Previous
|
|
73
|
+
</DsButtonV3>
|
|
74
|
+
<DsButtonV3 variant="secondary" color="light" size="small">
|
|
75
|
+
Next
|
|
76
|
+
</DsButtonV3>
|
|
77
|
+
</div>
|
|
78
|
+
<div>
|
|
79
|
+
<DsTypography variant="body-sm-reg">Untitled Project -23-May-2024 04:47 PM</DsTypography>
|
|
80
|
+
<DsIcon icon="info" size="tiny" />
|
|
81
|
+
<DsStatusBadgeV2 phase="execution" label="Running" size="small" />
|
|
82
|
+
</div>
|
|
83
|
+
<div>
|
|
84
|
+
<DsIcon icon="history_2" size="small" />
|
|
85
|
+
<DsTypography variant="body-sm-reg">Last update: 2d ago</DsTypography>
|
|
86
|
+
<DsButtonV3 variant="tertiary" color="light" size="small" icon="more_vert" aria-label="More actions" />
|
|
87
|
+
</div>
|
|
88
|
+
</DsWorkspaceLayout.Header>`;
|
|
89
|
+
|
|
90
|
+
const example = type === 'pending' ? pendingHeader : type === 'running' ? runningHeader : draftHeader;
|
|
91
|
+
|
|
92
|
+
export default {
|
|
93
|
+
example,
|
|
94
|
+
imports: [
|
|
95
|
+
"import { DsWorkspaceLayout, DsButtonV3, DsTypography, DsIcon, DsStatusBadgeV2 } from '@drivenets/design-system';",
|
|
96
|
+
],
|
|
97
|
+
id: 'ds-workspace-layout-header',
|
|
98
|
+
metadata: { nestable: true },
|
|
99
|
+
} satisfies figma.Template;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
.root {
|
|
2
2
|
--ds-workspace-layout-header-height: 54px;
|
|
3
|
-
--ds-workspace-layout-header-gradient: radial-gradient(
|
|
4
|
-
ellipse at left bottom,
|
|
5
|
-
rgba(1, 75, 253, 1) 0%,
|
|
6
|
-
rgba(10, 60, 194, 1) 78%,
|
|
7
|
-
rgba(16, 51, 160, 1) 89%,
|
|
8
|
-
rgba(21, 42, 126, 1) 100%
|
|
9
|
-
);
|
|
10
3
|
--ds-workspace-layout-side-menu-collapsed-width: 60px;
|
|
11
4
|
--ds-workspace-layout-side-menu-expanded-width: 256px;
|
|
12
5
|
--ds-workspace-layout-side-menu-padding-top: 28px;
|
|
@@ -33,7 +26,7 @@
|
|
|
33
26
|
flex-shrink: 0;
|
|
34
27
|
height: var(--ds-workspace-layout-header-height);
|
|
35
28
|
padding: 0 var(--sm) 0 var(--lg);
|
|
36
|
-
background: var(--
|
|
29
|
+
background: var(--blue-grad-workspace-header);
|
|
37
30
|
color: var(--font-on-action);
|
|
38
31
|
overflow: clip;
|
|
39
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from './components/ds-segment-group';
|
|
|
45
45
|
export * from './components/ds-select';
|
|
46
46
|
export * from './components/ds-site-node';
|
|
47
47
|
export * from './components/ds-skeleton';
|
|
48
|
+
export * from './components/ds-slider';
|
|
48
49
|
export * from './components/ds-smart-tabs';
|
|
49
50
|
export * from './components/ds-spinner';
|
|
50
51
|
export * from './components/ds-split-button';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Hand-authored shared Brand Refresh gradient styles. Source in Figma.
|
|
3
|
+
* App-/product-specific gradients stay in the consuming application — see Guidelines/Colors.
|
|
4
|
+
*/
|
|
5
|
+
:root {
|
|
6
|
+
// https://www.figma.com/design/DDe8yyHzVoBDePbLfmJYce/DAP-Brand-Refresh-1.0?node-id=181-13762
|
|
7
|
+
--blue-radial-grad: radial-gradient(
|
|
8
|
+
58.25% 72.07% at 94.38% 95.2%,
|
|
9
|
+
var(--blue-grad-2) 0%,
|
|
10
|
+
var(--blue-grad-1) 100%
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
// https://www.figma.com/design/DDe8yyHzVoBDePbLfmJYce/DAP-Brand-Refresh-1.0?node-id=4-10764
|
|
14
|
+
--blue-grad-workspace-header: radial-gradient(
|
|
15
|
+
24.05% 380.93% at 24.05% 0%,
|
|
16
|
+
rgb(0 160 250 / 80%) 0%,
|
|
17
|
+
var(--blue-grad-1) 100%
|
|
18
|
+
);
|
|
19
|
+
}
|
package/src/styles/_root.scss
CHANGED
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
:root {
|
|
19
19
|
/* Mode 1 */
|
|
20
20
|
/* color */
|
|
21
|
-
--color-dap-blue-050: #
|
|
22
|
-
--color-dap-blue-075: #
|
|
23
|
-
--color-dap-blue-100: #
|
|
24
|
-
--color-dap-blue-200: #
|
|
25
|
-
--color-dap-blue-300: #
|
|
26
|
-
--color-dap-blue-400: #
|
|
27
|
-
--color-dap-blue-500: #
|
|
28
|
-
--color-dap-blue-600: #
|
|
29
|
-
--color-dap-blue-700: #
|
|
30
|
-
--color-dap-blue-800: #
|
|
31
|
-
--color-dap-blue-900: #
|
|
32
|
-
--color-dap-blue-950: #
|
|
21
|
+
--color-dap-blue-050: #e3f2ff;
|
|
22
|
+
--color-dap-blue-075: #d4ecff;
|
|
23
|
+
--color-dap-blue-100: #c4e4ff;
|
|
24
|
+
--color-dap-blue-200: #a7d3ff;
|
|
25
|
+
--color-dap-blue-300: #85c2ff;
|
|
26
|
+
--color-dap-blue-400: #5eacff;
|
|
27
|
+
--color-dap-blue-500: #3593ff;
|
|
28
|
+
--color-dap-blue-600: #1c79ff;
|
|
29
|
+
--color-dap-blue-700: #0066fa;
|
|
30
|
+
--color-dap-blue-800: #0057d4;
|
|
31
|
+
--color-dap-blue-900: #0047ad;
|
|
32
|
+
--color-dap-blue-950: #00337e;
|
|
33
33
|
--color-dap-brand-050: #e5e8ed;
|
|
34
34
|
--color-dap-brand-100: #bfc6d1;
|
|
35
35
|
--color-dap-brand-200: #99a3b6;
|
|
@@ -259,14 +259,14 @@
|
|
|
259
259
|
--background-info: var(--color-dap-blue-050);
|
|
260
260
|
--background-info-strong: var(--color-dap-blue-800);
|
|
261
261
|
--background-light: var(--color-dap-dark-blue-500);
|
|
262
|
+
--background-light-active: var(--color-dap-blue-400);
|
|
262
263
|
--background-light-disabled: #415b9a;
|
|
264
|
+
--background-light-hover: var(--color-dap-blue-500);
|
|
263
265
|
--background-light-primary: var(--color-dap-dark-blue-300);
|
|
264
266
|
--background-light-primary-hover: var(--color-dap-dark-blue-200);
|
|
265
267
|
--background-light-primary-selected: var(--color-dap-dark-blue-150);
|
|
266
268
|
--background-light-secondary-selected: var(--color-dap-dark-blue-400);
|
|
267
269
|
--background-light-subtle: var(--color-dap-blue-600);
|
|
268
|
-
--background-light-subtle-active: var(--color-dap-blue-400);
|
|
269
|
-
--background-light-subtle-hover: var(--color-dap-blue-500);
|
|
270
270
|
--background-neutral: var(--color-dap-gray-600);
|
|
271
271
|
--background-overlay: #001a4733;
|
|
272
272
|
--background-page: var(--color-dap-gray-100);
|
|
@@ -293,6 +293,8 @@
|
|
|
293
293
|
--background-transparent-hover: #ffffff26;
|
|
294
294
|
--background-warning: var(--color-dap-orange-100);
|
|
295
295
|
--background-warning-strong: var(--color-dap-orange-600);
|
|
296
|
+
--blue-grad-1: var(--color-dap-blue-700);
|
|
297
|
+
--blue-grad-2: #2ab2ff;
|
|
296
298
|
--border: var(--color-dap-gray-300);
|
|
297
299
|
--border-action-primary: var(--color-dap-blue-700);
|
|
298
300
|
--border-action-primary-hover: var(--color-dap-blue-800);
|
|
@@ -316,6 +318,14 @@
|
|
|
316
318
|
--border-success: var(--color-dap-green-600);
|
|
317
319
|
--border-tertiary: var(--color-dap-gray-100);
|
|
318
320
|
--border-warning-strong: var(--color-dap-orange-600);
|
|
321
|
+
--device-green: #39cea0;
|
|
322
|
+
--device-green-20: #39cea033;
|
|
323
|
+
--device-light-blue: #74b8f4;
|
|
324
|
+
--device-light-blue-20: #74b8f433;
|
|
325
|
+
--device-orange: #ea8078;
|
|
326
|
+
--device-orange-20: #ea807833;
|
|
327
|
+
--device-purple: #9747ff;
|
|
328
|
+
--device-purple-20: #9747ff33;
|
|
319
329
|
--error: var(--color-dap-red-050);
|
|
320
330
|
--font-action: var(--color-dap-blue-700);
|
|
321
331
|
--font-action-hover: var(--color-dap-blue-800);
|
|
@@ -420,6 +430,20 @@
|
|
|
420
430
|
--status-bg-success: var(--color-dap-green-075);
|
|
421
431
|
--status-bg-warning: var(--color-dap-orange-200);
|
|
422
432
|
--text-on-button: #000000;
|
|
433
|
+
--dap-icons-0: var(--color-dap-gray-050);
|
|
434
|
+
--dap-icons-100: var(--color-dap-blue-100);
|
|
435
|
+
--dap-icons-200: var(--color-dap-blue-200);
|
|
436
|
+
--dap-icons-300: var(--color-dap-blue-300);
|
|
437
|
+
--dap-icons-400: var(--color-dap-blue-400);
|
|
438
|
+
--dap-icons-50: var(--color-dap-blue-050);
|
|
439
|
+
--dap-icons-500: var(--color-dap-blue-500);
|
|
440
|
+
--dap-icons-600: var(--color-dap-blue-600);
|
|
441
|
+
--dap-icons-700: var(--color-dap-blue-700);
|
|
442
|
+
--dap-icons-75: var(--color-dap-blue-075);
|
|
443
|
+
--dap-icons-800: var(--color-dap-blue-800);
|
|
444
|
+
--dap-icons-900: var(--color-dap-blue-900);
|
|
445
|
+
--dap-icons-950: var(--color-dap-blue-950);
|
|
446
|
+
--dap-icons-grey: var(--color-dap-gray-600);
|
|
423
447
|
}
|
|
424
448
|
/* Spacing */
|
|
425
449
|
:root {
|
|
@@ -473,5 +497,5 @@
|
|
|
473
497
|
/* string */
|
|
474
498
|
--font-family-base: Roboto;
|
|
475
499
|
--font-family-code: Fira Mono;
|
|
476
|
-
--font-family-heading:
|
|
500
|
+
--font-family-heading: Poppins;
|
|
477
501
|
}
|
|
@@ -164,6 +164,7 @@
|
|
|
164
164
|
|
|
165
165
|
@mixin heading($font-weight: var(--heading-font-size-3xl), $line-height: var(--heading-line-height-3xl)) {
|
|
166
166
|
@include font-base;
|
|
167
|
+
font-family: var(--font-family-heading);
|
|
167
168
|
font-size: $font-weight;
|
|
168
169
|
font-weight: var(--font-weight-semi-bold);
|
|
169
170
|
line-height: $line-height;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Variables
|
|
4
4
|
$input-text-height-small: 28px;
|
|
5
5
|
$input-text-height-default: 36px;
|
|
6
|
+
$input-text-height-large: 40px;
|
|
6
7
|
$textarea-height-default: 120px;
|
|
7
8
|
|
|
8
9
|
// Mixins
|
|
@@ -171,6 +172,11 @@ $textarea-height-default: 120px;
|
|
|
171
172
|
height: $input-text-height-default;
|
|
172
173
|
}
|
|
173
174
|
|
|
175
|
+
&.large {
|
|
176
|
+
height: $input-text-height-large;
|
|
177
|
+
max-height: $input-text-height-large;
|
|
178
|
+
}
|
|
179
|
+
|
|
174
180
|
&:has(input[type='number']) {
|
|
175
181
|
.input {
|
|
176
182
|
text-align: center;
|
|
@@ -240,6 +246,10 @@ $textarea-height-default: 120px;
|
|
|
240
246
|
height: $input-text-height-small;
|
|
241
247
|
}
|
|
242
248
|
|
|
249
|
+
&.large {
|
|
250
|
+
height: $input-text-height-large;
|
|
251
|
+
}
|
|
252
|
+
|
|
243
253
|
.clearIcon {
|
|
244
254
|
grid-column: 2;
|
|
245
255
|
grid-row: 1;
|
package/src/styles/styles.scss
CHANGED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { createContext, useCallback, useContext, useRef, useState } from 'react';
|
|
2
|
-
import type { Cell } from '@tanstack/react-table';
|
|
3
|
-
import type { DsDataTableProps, DsTableRowSize } from '../ds-table.types';
|
|
4
|
-
|
|
5
|
-
export interface EditingState<TData, TValue> {
|
|
6
|
-
cell: Cell<TData, TValue>;
|
|
7
|
-
draftValue: TValue;
|
|
8
|
-
error: string | null;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface DsTableContextType<TData, TValue> extends Partial<DsDataTableProps<TData, TValue>> {
|
|
12
|
-
/**
|
|
13
|
-
* Whether the table is virtualized
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
virtualized?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Row size variant
|
|
19
|
-
* @default 'medium'
|
|
20
|
-
*/
|
|
21
|
-
rowSize: DsTableRowSize;
|
|
22
|
-
/**
|
|
23
|
-
* ID of the currently active row
|
|
24
|
-
*/
|
|
25
|
-
activeRowId?: string | null;
|
|
26
|
-
/**
|
|
27
|
-
* Toggles the collapsed state of a column group by its id.
|
|
28
|
-
*/
|
|
29
|
-
onToggleColumnGroup?: (groupId: string) => void;
|
|
30
|
-
/** The cell currently in edit mode, if any. */
|
|
31
|
-
editing: EditingState<TData, TValue> | null;
|
|
32
|
-
beginEdit: (cell: Cell<TData, TValue>) => void;
|
|
33
|
-
setDraft: (value: TValue) => void;
|
|
34
|
-
commit: (overrideValue?: TValue) => void;
|
|
35
|
-
cancel: () => void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
export const DsTableContext = createContext<DsTableContextType<any, any> | null>(null);
|
|
40
|
-
|
|
41
|
-
export const useDsTableContext = <TData, TValue>(): DsTableContextType<TData, TValue> => {
|
|
42
|
-
const context = useContext(DsTableContext);
|
|
43
|
-
if (!context) {
|
|
44
|
-
throw new Error('useDsTableContext must be used within DsTable');
|
|
45
|
-
}
|
|
46
|
-
return context as DsTableContextType<TData, TValue>;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Hoisted editing state for single-cell-at-a-time inline editing.
|
|
51
|
-
* Lives on {@link DsTableContext} so cell renderers and editors share one provider.
|
|
52
|
-
*/
|
|
53
|
-
export const useEditingState = <TData, TValue>(
|
|
54
|
-
onCellEdit?: (row: TData, columnId: string, value: TValue) => void,
|
|
55
|
-
onCellValidate?: (row: TData, columnId: string, value: TValue) => string | null,
|
|
56
|
-
) => {
|
|
57
|
-
const [editing, setEditing] = useState<EditingState<TData, TValue> | null>(null);
|
|
58
|
-
|
|
59
|
-
const onCellEditRef = useRef(onCellEdit);
|
|
60
|
-
onCellEditRef.current = onCellEdit;
|
|
61
|
-
|
|
62
|
-
const onCellValidateRef = useRef(onCellValidate);
|
|
63
|
-
onCellValidateRef.current = onCellValidate;
|
|
64
|
-
|
|
65
|
-
const editingRef = useRef(editing);
|
|
66
|
-
editingRef.current = editing;
|
|
67
|
-
|
|
68
|
-
const beginEdit = useCallback((cell: Cell<TData, TValue>) => {
|
|
69
|
-
const current = editingRef.current;
|
|
70
|
-
if (current) {
|
|
71
|
-
const isSameCell = current.cell.row.id === cell.row.id && current.cell.column.id === cell.column.id;
|
|
72
|
-
if (isSameCell) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
setEditing({
|
|
77
|
-
cell,
|
|
78
|
-
draftValue: cell.getValue(),
|
|
79
|
-
error: null,
|
|
80
|
-
});
|
|
81
|
-
}, []);
|
|
82
|
-
|
|
83
|
-
const setDraft = useCallback((value: TValue) => {
|
|
84
|
-
const current = editingRef.current;
|
|
85
|
-
if (!current) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
setEditing({ ...current, draftValue: value, error: null });
|
|
89
|
-
}, []);
|
|
90
|
-
|
|
91
|
-
const commit = useCallback((overrideValue?: TValue) => {
|
|
92
|
-
const current = editingRef.current;
|
|
93
|
-
if (!current) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const valueToCommit = overrideValue !== undefined ? overrideValue : current.draftValue;
|
|
97
|
-
const error =
|
|
98
|
-
onCellValidateRef.current?.(current.cell.row.original, current.cell.column.id, valueToCommit) ?? null;
|
|
99
|
-
if (error !== null) {
|
|
100
|
-
setEditing({ ...current, draftValue: valueToCommit, error });
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
onCellEditRef.current?.(current.cell.row.original, current.cell.column.id, valueToCommit);
|
|
104
|
-
setEditing(null);
|
|
105
|
-
}, []);
|
|
106
|
-
|
|
107
|
-
const cancel = useCallback(() => {
|
|
108
|
-
setEditing(null);
|
|
109
|
-
}, []);
|
|
110
|
-
|
|
111
|
-
return { editing, beginEdit, setDraft, commit, cancel };
|
|
112
|
-
};
|