@drivenets/design-system 0.18.0 → 0.19.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 +26 -0
- package/dist/index.cjs +15850 -10821
- package/dist/index.d.cts +785 -239
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +785 -239
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15835 -10822
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +13 -13
- package/src/components/ds-bot-button/ds-bot-button.figma.ts +38 -0
- package/src/components/ds-bot-button/ds-bot-button.module.scss +41 -0
- package/src/components/ds-bot-button/ds-bot-button.tsx +48 -0
- package/src/components/ds-bot-button/ds-bot-button.types.ts +33 -0
- package/src/components/ds-bot-button/index.ts +2 -0
- package/src/components/ds-bot-button/net-gen-logo.tsx +46 -0
- package/src/components/ds-bulk-actions/components/action-button.tsx +42 -0
- package/src/components/ds-bulk-actions/components/menu-entries.tsx +76 -0
- package/src/components/ds-bulk-actions/components/overflow.tsx +75 -0
- package/src/components/ds-bulk-actions/ds-bulk-actions.figma.ts +28 -0
- package/src/components/ds-bulk-actions/ds-bulk-actions.module.scss +199 -0
- package/src/components/ds-bulk-actions/ds-bulk-actions.tsx +220 -0
- package/src/components/ds-bulk-actions/ds-bulk-actions.types.ts +170 -0
- package/src/components/ds-bulk-actions/ds-bulk-actions.unit.test.ts +195 -0
- package/src/components/ds-bulk-actions/ds-bulk-actions.utils.ts +91 -0
- package/src/components/ds-bulk-actions/ds-bulk-actions.utils.unit.test.ts +134 -0
- package/src/components/ds-bulk-actions/hooks/compute-bulk-actions-overflow.ts +85 -0
- package/src/components/ds-bulk-actions/hooks/use-bulk-actions-overflow.ts +153 -0
- package/src/components/ds-bulk-actions/index.ts +18 -0
- package/src/components/ds-button-v3/ds-button-v3.module.scss +2 -2
- package/src/components/ds-catalog-layout/ds-catalog-layout.figma.ts +1 -1
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +2 -0
- package/src/components/ds-empty-state/ds-empty-state.module.scss +16 -0
- package/src/components/ds-empty-state/ds-empty-state.tsx +45 -0
- package/src/components/ds-empty-state/ds-empty-state.types.ts +38 -0
- package/src/components/ds-empty-state/index.ts +3 -0
- package/src/components/ds-file-upload/ds-file-upload.tsx +4 -1
- package/src/components/ds-form-control/ds-form-control.tsx +18 -10
- package/src/components/ds-illustration/ds-illustration.figma.ts +34 -0
- package/src/components/ds-illustration/ds-illustration.module.scss +6 -0
- package/src/components/ds-illustration/ds-illustration.tsx +29 -0
- package/src/components/ds-illustration/ds-illustration.types.ts +45 -0
- package/src/components/ds-illustration/illustrations/configuration.tsx +51 -0
- package/src/components/ds-illustration/illustrations/device.tsx +133 -0
- package/src/components/ds-illustration/illustrations/done.tsx +107 -0
- package/src/components/{ds-catalog-layout/catalog-layout-empty-illustration.tsx → ds-illustration/illustrations/empty-inbox.tsx} +10 -14
- package/src/components/ds-illustration/illustrations/error.tsx +86 -0
- package/src/components/ds-illustration/illustrations/go-filter.tsx +51 -0
- package/src/components/ds-illustration/illustrations/illustration-clouds.tsx +10 -0
- package/src/components/ds-illustration/illustrations/index.ts +39 -0
- package/src/components/ds-illustration/illustrations/no-connection.tsx +54 -0
- package/src/components/ds-illustration/illustrations/no-credit-card.tsx +48 -0
- package/src/components/ds-illustration/illustrations/no-device.tsx +61 -0
- package/src/components/ds-illustration/illustrations/no-documents.tsx +52 -0
- package/src/components/ds-illustration/illustrations/no-gps.tsx +57 -0
- package/src/components/ds-illustration/illustrations/no-images.tsx +82 -0
- package/src/components/ds-illustration/illustrations/no-items-cart.tsx +86 -0
- package/src/components/ds-illustration/illustrations/no-messages.tsx +51 -0
- package/src/components/ds-illustration/illustrations/no-search-result.tsx +76 -0
- package/src/components/ds-illustration/illustrations/no-tasks.tsx +61 -0
- package/src/components/ds-illustration/illustrations/site.tsx +80 -0
- package/src/components/ds-illustration/index.ts +3 -0
- package/src/components/ds-main-menu/components/expanded-item/expanded-item.tsx +108 -0
- package/src/components/ds-main-menu/components/expanded-item/expanded-item.types.ts +8 -0
- package/src/components/ds-main-menu/components/expanded-item/index.ts +1 -0
- package/src/components/ds-main-menu/components/menu-graphic/index.ts +1 -0
- package/src/components/ds-main-menu/components/menu-graphic/menu-graphic.tsx +16 -0
- package/src/components/ds-main-menu/components/menu-graphic/menu-graphic.types.ts +7 -0
- package/src/components/ds-main-menu/components/tile-link/index.ts +1 -0
- package/src/components/ds-main-menu/components/tile-link/tile-link.tsx +85 -0
- package/src/components/ds-main-menu/components/tile-link/tile-link.types.ts +8 -0
- package/src/components/ds-main-menu/components/utility-link/index.ts +1 -0
- package/src/components/ds-main-menu/components/utility-link/utility-link.tsx +37 -0
- package/src/components/ds-main-menu/components/utility-link/utility-link.types.ts +7 -0
- package/src/components/ds-main-menu/ds-main-menu.figma.ts +17 -0
- package/src/components/ds-main-menu/ds-main-menu.module.scss +349 -0
- package/src/components/ds-main-menu/ds-main-menu.tsx +102 -0
- package/src/components/ds-main-menu/ds-main-menu.types.ts +86 -0
- package/src/components/ds-main-menu/ds-main-menu.utils.ts +40 -0
- package/src/components/ds-main-menu/index.ts +9 -0
- package/src/components/ds-modal/figma/ds-modal-footer.figma.ts +1 -1
- package/src/components/ds-popover/ds-popover.tsx +2 -1
- package/src/components/ds-popover/ds-popover.types.ts +7 -0
- package/src/components/ds-site-node/ds-site-node.tsx +2 -2
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.module.scss +12 -2
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.tsx +2 -3
- package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.module.scss +1 -6
- package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.tsx +6 -3
- package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +18 -7
- package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +27 -21
- package/src/components/ds-table/components/ds-table-header-label.module.scss +12 -0
- package/src/components/ds-table/components/ds-table-header-label.tsx +28 -0
- package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +0 -1
- package/src/components/ds-table/context/ds-table-context.tsx +8 -0
- package/src/components/ds-table/ds-table.module.scss +26 -16
- package/src/components/ds-table/ds-table.tsx +46 -14
- package/src/components/ds-table/ds-table.types.ts +33 -3
- package/src/components/ds-table/hooks/use-column-resize.ts +114 -11
- package/src/components/ds-table/hooks/use-scrollbar-spacer.ts +108 -0
- package/src/components/ds-table/hooks/use-scrollbar-spacer.unit.test.ts +26 -0
- package/src/components/ds-table/styles/_variables.scss +0 -2
- package/src/components/ds-table/utils/column-size.ts +274 -1
- package/src/components/ds-table/utils/column-size.unit.test.ts +157 -0
- package/src/components/ds-table/utils/constants.ts +13 -5
- package/src/components/ds-table/utils/table-columns.tsx +27 -13
- package/src/components/ds-table/utils/table-columns.unit.test.ts +44 -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-toggle/ds-toggle.module.scss +18 -0
- package/src/components/ds-toggle/ds-toggle.tsx +15 -13
- package/src/components/ds-tooltip/ds-tooltip.tsx +6 -2
- package/src/components/ds-tooltip/ds-tooltip.types.ts +17 -0
- package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.figma.ts +35 -0
- package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.module.scss +150 -0
- package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.tsx +161 -0
- package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.types.ts +117 -0
- package/src/components/ds-top-bar-navigation/index.ts +2 -0
- package/src/index.ts +6 -0
- package/src/utils/use-is-horizontally-overflowing.ts +35 -0
- package/src/components/ds-site-node/hooks/use-is-overflowing.ts +0 -31
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +0 -112
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.tsx +0 -67
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.types.ts +0 -41
- package/src/components/ds-table/components/ds-table-bulk-actions/index.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drivenets/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.cts",
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"directory": "/packages/design-system"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ark-ui/react": "^5.
|
|
39
|
+
"@ark-ui/react": "^5.38.2",
|
|
40
40
|
"@dnd-kit/core": "^6.3.1",
|
|
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-visually-hidden": "^1.2.
|
|
44
|
+
"@radix-ui/react-collapsible": "^1.1.20",
|
|
45
|
+
"@radix-ui/react-dialog": "^1.1.23",
|
|
46
|
+
"@radix-ui/react-dropdown-menu": "^2.1.24",
|
|
47
|
+
"@radix-ui/react-visually-hidden": "^1.2.11",
|
|
48
48
|
"@tanstack/react-table": "^8.21.3",
|
|
49
|
-
"@tanstack/react-virtual": "^3.14.
|
|
50
|
-
"@zag-js/react": "^1.
|
|
51
|
-
"@zag-js/steps": "^1.
|
|
49
|
+
"@tanstack/react-virtual": "^3.14.10",
|
|
50
|
+
"@zag-js/react": "^1.43.3",
|
|
51
|
+
"@zag-js/steps": "^1.43.3",
|
|
52
52
|
"classnames": "^2.5.1",
|
|
53
53
|
"csstype": "^3.2.3"
|
|
54
54
|
},
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"react-dom": "^19"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
63
|
-
"@eslint/compat": "^2.1.
|
|
62
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
63
|
+
"@eslint/compat": "^2.1.1",
|
|
64
64
|
"@faker-js/faker": "^10.5.0",
|
|
65
65
|
"@figma/code-connect": "^1.4.9",
|
|
66
66
|
"@github-ui/storybook-addon-performance-panel": "^1.1.4",
|
|
@@ -87,10 +87,10 @@
|
|
|
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.6.0",
|
|
91
91
|
"mockdate": "^3.0.5",
|
|
92
92
|
"playwright": "^1.62.0",
|
|
93
|
-
"publint": "^0.3.
|
|
93
|
+
"publint": "^0.3.24",
|
|
94
94
|
"react": "^19.2.8",
|
|
95
95
|
"react-dom": "^19.2.8",
|
|
96
96
|
"react-hook-form": "^7.83.0",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=40935-37071
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-bot-button
|
|
3
|
+
// component=DsBotButton
|
|
4
|
+
//
|
|
5
|
+
// Figma models the six looks as one `state` enum; the code API is the three booleans it implies,
|
|
6
|
+
// since hover and focus belong to the browser. The label is read off the instance and emitted
|
|
7
|
+
// through `locale` only when it has drifted from the fixed bot name.
|
|
8
|
+
//
|
|
9
|
+
// The nested `Part_ButtonStructureV2` props Dev Mode lists are deliberately not mapped: `size`,
|
|
10
|
+
// `icon-only` and `high-emphasis` are constants handed to `DsButtonV3`, and the icon/dropdown
|
|
11
|
+
// slots are internals of a part whose own description calls it "not for standalone use".
|
|
12
|
+
import figma from 'figma';
|
|
13
|
+
|
|
14
|
+
const instance = figma.selectedInstance;
|
|
15
|
+
|
|
16
|
+
const state = instance.getEnum('state', {
|
|
17
|
+
default: 'default',
|
|
18
|
+
hover: 'default',
|
|
19
|
+
focus: 'default',
|
|
20
|
+
selected: 'selected',
|
|
21
|
+
disabled: 'disabled',
|
|
22
|
+
isLoading: 'isLoading',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const selectedProp = state === 'selected' ? ' selected' : '';
|
|
26
|
+
const disabledProp = state === 'disabled' ? ' disabled' : '';
|
|
27
|
+
const loadingProp = state === 'isLoading' ? ' loading' : '';
|
|
28
|
+
|
|
29
|
+
const labelNode = instance.findText('NetGen', { traverseInstances: true });
|
|
30
|
+
const label = labelNode.type === 'TEXT' ? labelNode.textContent : 'NetGen';
|
|
31
|
+
const localeProp = label === 'NetGen' ? '' : ` locale={{ label: '${label}' }}`;
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
example: figma.code`<DsBotButton${selectedProp}${disabledProp}${loadingProp}${localeProp} />`,
|
|
35
|
+
imports: ["import { DsBotButton } from '@drivenets/design-system';"],
|
|
36
|
+
id: 'ds-bot-button',
|
|
37
|
+
metadata: { nestable: true },
|
|
38
|
+
} satisfies figma.Template;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Overrides have to match `DsButtonV3`'s own `[data-color][data-variant]` selectors to outweigh them.
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
--ds-bot-button-mark-size: 16px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Figma binds the border to the `--blue-grad-2` gradient stop; no semantic border token carries
|
|
8
|
+
// that hue. Focus-visible and disabled keep `DsButtonV3`'s borders.
|
|
9
|
+
.root[data-variant='primary-subtle']:not(:focus-visible):not(:disabled),
|
|
10
|
+
.root[data-variant='primary-subtle']:not(:focus-visible)[data-loading] {
|
|
11
|
+
border-color: var(--blue-grad-2);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// `DsSpinner` sizes itself to `1em`, so the root font size is what keeps the loading spinner the
|
|
15
|
+
// same size as the mark it replaces.
|
|
16
|
+
.root[data-variant='primary-subtle'][data-size='small'] {
|
|
17
|
+
font-size: var(--ds-bot-button-mark-size);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.mark {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
width: var(--ds-bot-button-mark-size);
|
|
24
|
+
height: var(--ds-bot-button-mark-size);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.label {
|
|
28
|
+
font-family: var(--font-family-heading);
|
|
29
|
+
font-size: var(--body-font-size-xs);
|
|
30
|
+
font-weight: var(--font-weight-medium);
|
|
31
|
+
line-height: var(--body-line-height-xs);
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
|
|
34
|
+
// `DsButtonV3` tints `primary-subtle` text with `--font-action`; the bot's name is body text.
|
|
35
|
+
color: var(--font-main);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Mirrors `DsButtonV3`'s own `:disabled:not([data-loading])` condition.
|
|
39
|
+
.root:disabled:not([data-loading]) .label {
|
|
40
|
+
color: var(--font-disabled);
|
|
41
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import styles from './ds-bot-button.module.scss';
|
|
3
|
+
import type { DsBotButtonProps } from './ds-bot-button.types';
|
|
4
|
+
import { NetGenLogo } from './net-gen-logo';
|
|
5
|
+
import { DsButtonV3 } from '../ds-button-v3';
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LOCALE = Object.freeze({ label: 'NetGen' });
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Launcher for the NetGen AI companion
|
|
11
|
+
*/
|
|
12
|
+
const DsBotButton = ({
|
|
13
|
+
ref,
|
|
14
|
+
className,
|
|
15
|
+
selected = false,
|
|
16
|
+
loading = false,
|
|
17
|
+
disabled = false,
|
|
18
|
+
locale,
|
|
19
|
+
...rest
|
|
20
|
+
}: DsBotButtonProps) => {
|
|
21
|
+
const label = locale?.label ?? DEFAULT_LOCALE.label;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<DsButtonV3
|
|
25
|
+
ref={ref}
|
|
26
|
+
variant="primary-subtle"
|
|
27
|
+
size="small"
|
|
28
|
+
highEmphasis
|
|
29
|
+
selected={selected}
|
|
30
|
+
loading={loading}
|
|
31
|
+
disabled={disabled}
|
|
32
|
+
className={classNames(styles.root, className)}
|
|
33
|
+
{...rest}
|
|
34
|
+
>
|
|
35
|
+
{/* `DsButtonV3` renders its own spinner in the leading slot while loading. */}
|
|
36
|
+
{!loading && (
|
|
37
|
+
<span className={styles.mark}>
|
|
38
|
+
<NetGenLogo tone={disabled ? 'greyscale' : 'color'} />
|
|
39
|
+
</span>
|
|
40
|
+
)}
|
|
41
|
+
<span className={styles.label}>{label}</span>
|
|
42
|
+
</DsButtonV3>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
DsBotButton.displayName = 'DsBotButton';
|
|
47
|
+
|
|
48
|
+
export default DsBotButton;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
/** `color` is dropped with `children`: content is fixed branding and the palette is the preset's. */
|
|
4
|
+
export interface DsBotButtonProps extends Omit<
|
|
5
|
+
ButtonHTMLAttributes<HTMLButtonElement>,
|
|
6
|
+
'children' | 'color'
|
|
7
|
+
> {
|
|
8
|
+
ref?: Ref<HTMLButtonElement>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Pressed look for while the bot panel is open. Report the panel's open state here so the
|
|
12
|
+
* button and the panel cannot disagree.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Swaps the logo for a spinner and blocks interaction while the bot starts up or answers.
|
|
19
|
+
* Composes with `selected`: a panel that is open while the bot answers keeps the pressed look
|
|
20
|
+
* under the spinner. `disabled` overrides both.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
loading?: boolean;
|
|
24
|
+
|
|
25
|
+
locale?: {
|
|
26
|
+
/**
|
|
27
|
+
* Visible label and the button's accessible name. The bot's name is fixed branding —
|
|
28
|
+
* override it only to translate it, never to repurpose the button.
|
|
29
|
+
* @default 'NetGen'
|
|
30
|
+
*/
|
|
31
|
+
label?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FC, SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
type NetGenLogoTone = 'color' | 'greyscale';
|
|
4
|
+
|
|
5
|
+
interface NetGenLogoProps extends Omit<SVGProps<SVGSVGElement>, 'fill'> {
|
|
6
|
+
tone?: NetGenLogoTone;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* NetGen brand mark from Figma `DapNetGenLogoV1`. Both stops are fixed brand tokens — the mark is
|
|
11
|
+
* never recolored, so it takes a `tone` rather than `currentColor`.
|
|
12
|
+
*
|
|
13
|
+
* Private to `DsBotButton`; promote it to its own `ds-*` component once another NetGen surface
|
|
14
|
+
* (panel header, onboarding, empty state) needs it.
|
|
15
|
+
*
|
|
16
|
+
* @figma https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp?node-id=31155-54754
|
|
17
|
+
*/
|
|
18
|
+
export const NetGenLogo: FC<NetGenLogoProps> = ({ tone = 'color', ...props }) => {
|
|
19
|
+
const light = tone === 'color' ? 'var(--net-gen-logo-dodger-blue)' : 'var(--net-gen-logo-light-grey)';
|
|
20
|
+
const dark = tone === 'color' ? 'var(--net-gen-logo-ultramarine-blue)' : 'var(--net-gen-logo-dark-grey)';
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<svg
|
|
24
|
+
viewBox="0 0 48 48"
|
|
25
|
+
fill="none"
|
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
27
|
+
aria-hidden
|
|
28
|
+
focusable="false"
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{/* Figma centers the 38x42 mark in a 48x48 box; the translate keeps that padding. */}
|
|
32
|
+
<g transform="translate(5 3)">
|
|
33
|
+
<path
|
|
34
|
+
d="M25.9488 0C32.6087 0.000155233 38 5.42946 38 12.1166C37.9999 14.9274 37.0454 17.5138 35.4473 19.5689C32.6256 17.7276 29.2073 18.1106 20.6082 20.8684L29.9215 4.38066H28.9932C27.8806 5.59416 7.31397 28.1298 0.695319 18.4532C0.248329 17.3609 3.11481e-05 16.1654 0 14.9119C0.000131791 9.76874 4.14676 5.5914 9.27141 5.59122L9.50735 5.59489C11.4997 5.64494 13.3363 6.32745 14.8251 7.44859C16.6422 3.07692 20.9356 0.000118632 25.9488 0Z"
|
|
35
|
+
fill={light}
|
|
36
|
+
/>
|
|
37
|
+
<path
|
|
38
|
+
d="M7.85784 37.3463C11.933 32.4313 32.3987 15.5201 36.9093 22.5582C37.6042 23.8656 38 25.3583 38 26.9432C37.9998 32.0863 33.8527 36.2629 28.728 36.263L28.4928 36.26C26.5005 36.21 24.6639 35.5275 23.1751 34.4064C21.3581 38.778 17.0642 41.8548 12.051 41.8548C5.39126 41.8546 2.87107e-06 36.4254 0 29.7384C2.89199e-05 26.649 1.15215 23.8298 3.04582 21.6902C7.17136 24.1138 11.4572 23.3273 16.494 21.6483L6.92586 37.3463H7.85784Z"
|
|
39
|
+
fill={dark}
|
|
40
|
+
/>
|
|
41
|
+
</g>
|
|
42
|
+
</svg>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
NetGenLogo.displayName = 'NetGenLogo';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, Ref } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import styles from '../ds-bulk-actions.module.scss';
|
|
4
|
+
import type { ItemWidthLayout } from '../ds-bulk-actions.utils';
|
|
5
|
+
import { DsIcon, type IconType } from '../../ds-icon';
|
|
6
|
+
import { DsTypography } from '../../ds-typography';
|
|
7
|
+
|
|
8
|
+
export interface ActionButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
9
|
+
icon: IconType;
|
|
10
|
+
label: string;
|
|
11
|
+
itemWidth?: ItemWidthLayout['mode'];
|
|
12
|
+
ref?: Ref<HTMLButtonElement>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const ActionButton = ({
|
|
16
|
+
icon,
|
|
17
|
+
label,
|
|
18
|
+
onClick,
|
|
19
|
+
disabled,
|
|
20
|
+
className,
|
|
21
|
+
style,
|
|
22
|
+
itemWidth = 'fixed',
|
|
23
|
+
ref,
|
|
24
|
+
...rest
|
|
25
|
+
}: ActionButtonProps) => (
|
|
26
|
+
<button
|
|
27
|
+
className={classnames(styles.actionButton, className)}
|
|
28
|
+
style={style}
|
|
29
|
+
onClick={onClick}
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
aria-label={label}
|
|
32
|
+
data-item-width={itemWidth}
|
|
33
|
+
{...rest}
|
|
34
|
+
type="button"
|
|
35
|
+
ref={ref}
|
|
36
|
+
>
|
|
37
|
+
<DsIcon icon={icon} size="small" />
|
|
38
|
+
<DsTypography variant="body-xs-md" className={styles.actionLabel}>
|
|
39
|
+
{label}
|
|
40
|
+
</DsTypography>
|
|
41
|
+
</button>
|
|
42
|
+
);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import styles from '../ds-bulk-actions.module.scss';
|
|
3
|
+
import type { DsBulkActionsMenuEntry } from '../ds-bulk-actions.types';
|
|
4
|
+
import { isSubmenuEntry, type ItemWidthLayout } from '../ds-bulk-actions.utils';
|
|
5
|
+
import { ActionButton } from './action-button';
|
|
6
|
+
import { DsDropdownMenu } from '../../ds-dropdown-menu';
|
|
7
|
+
import { DsIcon, type IconType } from '../../ds-icon';
|
|
8
|
+
import { DsTooltip } from '../../ds-tooltip';
|
|
9
|
+
|
|
10
|
+
const SUBMENU_PLACEMENT = 'right-start' as const;
|
|
11
|
+
|
|
12
|
+
const MenuEntryLabel = ({ icon, label }: { icon?: IconType; label: string }) => (
|
|
13
|
+
<>
|
|
14
|
+
{icon ? <DsIcon icon={icon} /> : null}
|
|
15
|
+
<span>{label}</span>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const MenuEntries = ({ entries }: { entries: DsBulkActionsMenuEntry[] }) => (
|
|
20
|
+
<>
|
|
21
|
+
{entries.map((entry) => {
|
|
22
|
+
if (isSubmenuEntry(entry) && entry.menu.length > 0 && !entry.disabled) {
|
|
23
|
+
return (
|
|
24
|
+
<DsDropdownMenu.Root key={entry.value} positioning={{ placement: SUBMENU_PLACEMENT }}>
|
|
25
|
+
<DsDropdownMenu.TriggerItem>
|
|
26
|
+
<MenuEntryLabel icon={entry.icon} label={entry.label} />
|
|
27
|
+
</DsDropdownMenu.TriggerItem>
|
|
28
|
+
<DsDropdownMenu.Content>
|
|
29
|
+
<MenuEntries entries={entry.menu} />
|
|
30
|
+
</DsDropdownMenu.Content>
|
|
31
|
+
</DsDropdownMenu.Root>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<DsDropdownMenu.Item
|
|
37
|
+
key={entry.value}
|
|
38
|
+
value={entry.value}
|
|
39
|
+
disabled={entry.disabled}
|
|
40
|
+
variant={entry.variant}
|
|
41
|
+
onSelect={'onSelect' in entry ? entry.onSelect : undefined}
|
|
42
|
+
>
|
|
43
|
+
<MenuEntryLabel icon={entry.icon} label={entry.label} />
|
|
44
|
+
</DsDropdownMenu.Item>
|
|
45
|
+
);
|
|
46
|
+
})}
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const TooltipMenuTrigger = ({
|
|
51
|
+
icon,
|
|
52
|
+
label,
|
|
53
|
+
disabled,
|
|
54
|
+
itemWidth,
|
|
55
|
+
buttonStyle,
|
|
56
|
+
}: {
|
|
57
|
+
icon: IconType;
|
|
58
|
+
label: string;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
itemWidth: ItemWidthLayout['mode'];
|
|
61
|
+
buttonStyle?: CSSProperties;
|
|
62
|
+
}) => (
|
|
63
|
+
<DsTooltip content={label}>
|
|
64
|
+
<span className={styles.menuTriggerAnchor}>
|
|
65
|
+
<DsDropdownMenu.Trigger asChild>
|
|
66
|
+
<ActionButton
|
|
67
|
+
icon={icon}
|
|
68
|
+
label={label}
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
itemWidth={itemWidth}
|
|
71
|
+
style={buttonStyle}
|
|
72
|
+
/>
|
|
73
|
+
</DsDropdownMenu.Trigger>
|
|
74
|
+
</span>
|
|
75
|
+
</DsTooltip>
|
|
76
|
+
);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ReactElement, RefObject } from 'react';
|
|
2
|
+
import styles from '../ds-bulk-actions.module.scss';
|
|
3
|
+
import type {
|
|
4
|
+
BulkActionsMenuPlacement,
|
|
5
|
+
DsBulkActionsItemProps,
|
|
6
|
+
DsBulkActionsMenuEntry,
|
|
7
|
+
} from '../ds-bulk-actions.types';
|
|
8
|
+
import { resolveItemWidth } from '../ds-bulk-actions.utils';
|
|
9
|
+
import { ActionButton } from './action-button';
|
|
10
|
+
import { MenuEntries, TooltipMenuTrigger } from './menu-entries';
|
|
11
|
+
import { DsDropdownMenu } from '../../ds-dropdown-menu';
|
|
12
|
+
import { DsTypography } from '../../ds-typography';
|
|
13
|
+
|
|
14
|
+
export const OverflowMore = ({
|
|
15
|
+
label,
|
|
16
|
+
menuPlacement,
|
|
17
|
+
entries,
|
|
18
|
+
}: {
|
|
19
|
+
label: string;
|
|
20
|
+
menuPlacement: BulkActionsMenuPlacement;
|
|
21
|
+
entries: DsBulkActionsMenuEntry[];
|
|
22
|
+
}) => (
|
|
23
|
+
<div className={styles.actionItem}>
|
|
24
|
+
<DsDropdownMenu.Root positioning={{ placement: menuPlacement }}>
|
|
25
|
+
<TooltipMenuTrigger icon="more_horiz" label={label} itemWidth="fixed" />
|
|
26
|
+
<DsDropdownMenu.Content>
|
|
27
|
+
<MenuEntries entries={entries} />
|
|
28
|
+
</DsDropdownMenu.Content>
|
|
29
|
+
</DsDropdownMenu.Root>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const OverflowMeasure = ({
|
|
34
|
+
items,
|
|
35
|
+
moreActionsLabel,
|
|
36
|
+
itemsSelectedLabel,
|
|
37
|
+
measureRef,
|
|
38
|
+
}: {
|
|
39
|
+
items: ReactElement<DsBulkActionsItemProps>[];
|
|
40
|
+
moreActionsLabel: string;
|
|
41
|
+
itemsSelectedLabel: string;
|
|
42
|
+
measureRef: RefObject<HTMLDivElement | null>;
|
|
43
|
+
}) => (
|
|
44
|
+
<div ref={measureRef} className={styles.measurementContainer} aria-hidden="true">
|
|
45
|
+
{items.map((item, index) => {
|
|
46
|
+
const { mode, buttonStyle } = resolveItemWidth(item.props.width);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
key={item.key ?? `measure-${String(index)}`}
|
|
51
|
+
data-overflow-measure="item"
|
|
52
|
+
data-item-width={mode}
|
|
53
|
+
className={styles.actionItem}
|
|
54
|
+
style={item.props.style}
|
|
55
|
+
>
|
|
56
|
+
<ActionButton
|
|
57
|
+
icon={item.props.icon}
|
|
58
|
+
label={item.props.label}
|
|
59
|
+
tabIndex={-1}
|
|
60
|
+
itemWidth={mode}
|
|
61
|
+
style={buttonStyle}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
})}
|
|
66
|
+
<div data-overflow-measure="more" className={styles.actionItem}>
|
|
67
|
+
<ActionButton icon="more_horiz" label={moreActionsLabel} tabIndex={-1} />
|
|
68
|
+
</div>
|
|
69
|
+
<div data-overflow-measure="label">
|
|
70
|
+
<DsTypography variant="body-md-semi-bold" className={styles.bulkActionsInfo}>
|
|
71
|
+
{itemsSelectedLabel}
|
|
72
|
+
</DsTypography>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=34851-93874
|
|
2
|
+
// source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-bulk-actions
|
|
3
|
+
// component=DsBulkActions
|
|
4
|
+
//
|
|
5
|
+
// `DsBulkActionsV2` is the floating toolbar shown when one or more table/tree rows are
|
|
6
|
+
// multi-selected. The Figma component exposes no properties, and each action in the
|
|
7
|
+
// "Action buttons slot" is a placeholder `Part_ActionBtnItemV2` with no click/menu
|
|
8
|
+
// semantics — so this is a representative usage of the compound `Item` API rather than
|
|
9
|
+
// a slot mapping.
|
|
10
|
+
import figma from 'figma';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
example: figma.code`<DsBulkActions
|
|
14
|
+
selectedCount={3}
|
|
15
|
+
onClearSelection={() => {}}
|
|
16
|
+
>
|
|
17
|
+
<DsBulkActions.Item icon="alarm" label="Notify" onClick={() => {}} />
|
|
18
|
+
<DsBulkActions.Item
|
|
19
|
+
icon="share"
|
|
20
|
+
label="Share"
|
|
21
|
+
menu={[{ value: 'email', label: 'Email', onSelect: () => {} }]}
|
|
22
|
+
/>
|
|
23
|
+
<DsBulkActions.Item icon="delete_outline" label="Delete" onClick={() => {}} />
|
|
24
|
+
</DsBulkActions>`,
|
|
25
|
+
imports: ["import { DsBulkActions } from '@drivenets/design-system';"],
|
|
26
|
+
id: 'ds-bulk-actions',
|
|
27
|
+
metadata: { nestable: false },
|
|
28
|
+
} satisfies figma.Template;
|