@drivenets/design-system 0.12.1 → 0.13.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 +15 -0
- package/dist/index.cjs +1097 -308
- package/dist/index.d.cts +1118 -982
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1118 -982
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1089 -309
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +31 -31
- package/src/components/ds-date-input/ds-date-input.utils.ts +2 -2
- package/src/components/ds-drawer/ds-drawer.tsx +2 -0
- package/src/components/ds-form-control/ds-form-control.tsx +14 -11
- package/src/components/ds-form-control/ds-form-control.types.ts +4 -0
- package/src/components/ds-grid/ds-grid.tsx +1 -2
- package/src/components/ds-modal/ds-modal.tsx +3 -0
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.module.scss +21 -2
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.tsx +14 -11
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.types.ts +1 -6
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +2 -2
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.module.scss +2 -0
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.tsx +42 -11
- package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +24 -4
- package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +22 -1
- package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +22 -0
- package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +1 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.module.scss +19 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.tsx +2 -1
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.types.ts +1 -1
- package/src/components/ds-table/components/edit/cell-editors/cell-editors.module.scss +3 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-checkbox.tsx +27 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-date.tsx +50 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-number.tsx +51 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-select.tsx +36 -0
- package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-text.tsx +50 -0
- package/src/components/ds-table/components/edit/cell-editors/index.ts +14 -0
- package/src/components/ds-table/components/edit/cell-editors/table-edit-form-control.tsx +31 -0
- package/src/components/ds-table/components/edit/ds-table-editable-cell/ds-table-editable-cell.module.scss +28 -0
- package/src/components/ds-table/components/edit/ds-table-editable-cell/ds-table-editable-cell.tsx +39 -0
- package/src/components/ds-table/components/edit/ds-table-editable-cell/ds-table-editable-cell.types.ts +7 -0
- package/src/components/ds-table/components/edit/ds-table-editable-cell/index.ts +2 -0
- package/src/components/ds-table/components/edit/ds-table-editing-cell/ds-table-editing-cell.module.scss +48 -0
- package/src/components/ds-table/components/edit/ds-table-editing-cell/ds-table-editing-cell.tsx +76 -0
- package/src/components/ds-table/components/edit/ds-table-editing-cell/ds-table-editing-cell.types.ts +5 -0
- package/src/components/ds-table/components/edit/ds-table-editing-cell/index.ts +2 -0
- package/src/components/ds-table/context/ds-table-context.ts +79 -1
- package/src/components/ds-table/ds-table-column.types.ts +12 -0
- package/src/components/ds-table/ds-table.module.scss +100 -10
- package/src/components/ds-table/ds-table.tsx +18 -19
- package/src/components/ds-table/ds-table.types.ts +52 -0
- package/src/components/ds-table/filters/adapters/create-checkbox-filter-adapter.tsx +24 -40
- package/src/components/ds-table/filters/adapters/create-dual-range-filter-adapter.tsx +10 -31
- package/src/components/ds-table/filters/adapters/create-filter-adapter.ts +6 -98
- package/src/components/ds-table/filters/components/checkbox-filter/checkbox-filter.module.scss +36 -0
- package/src/components/ds-table/filters/components/checkbox-filter/checkbox-filter.tsx +92 -13
- package/src/components/ds-table/filters/components/checkbox-filter/index.ts +1 -1
- package/src/components/ds-table/filters/components/column-filter-popover/column-filter-popover.module.scss +42 -0
- package/src/components/ds-table/filters/components/column-filter-popover/column-filter-popover.tsx +89 -0
- package/src/components/ds-table/filters/components/column-filter-popover/column-filter-popover.types.ts +25 -0
- package/src/components/ds-table/filters/components/column-filter-popover/index.ts +5 -0
- package/src/components/ds-table/filters/hooks/use-table-filters.ts +113 -78
- package/src/components/ds-table/filters/index.ts +2 -44
- package/src/components/ds-table/filters/types/column-meta.augmentation.ts +19 -0
- package/src/components/ds-table/filters/types/filter-adapter.types.ts +48 -81
- package/src/components/ds-table/hooks/use-cell-editor.ts +81 -0
- package/src/components/ds-table/index.ts +29 -0
- package/src/components/ds-table/utils/column-size.ts +9 -8
- package/src/components/ds-tag/ds-tag.tsx +2 -2
- package/src/components/ds-workspace-layout/ds-workspace-layout.context.ts +19 -0
- package/src/components/ds-workspace-layout/ds-workspace-layout.module.scss +166 -0
- package/src/components/ds-workspace-layout/ds-workspace-layout.tsx +135 -0
- package/src/components/ds-workspace-layout/ds-workspace-layout.types.ts +52 -0
- package/src/components/ds-workspace-layout/index.ts +11 -0
- package/src/index.ts +1 -1
- package/src/styles/_scrollbars.scss +37 -0
- package/src/utils/restore-document-body-modal-styles.ts +44 -0
- package/src/utils/use-ark-dialog-body-lock-cleanup.ts +36 -0
- package/src/components/ds-workspace/ds-workspace.module.scss +0 -55
- package/src/components/ds-workspace/ds-workspace.tsx +0 -37
- package/src/components/ds-workspace/ds-workspace.types.ts +0 -17
- package/src/components/ds-workspace/index.ts +0 -8
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface DsWorkspaceLayoutProps extends ComponentPropsWithRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the workspace should fill its parent height (`100%`) instead of the viewport (`100vh`).
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
fillParent?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type DsWorkspaceLayoutHeaderProps = ComponentPropsWithRef<'header'>;
|
|
12
|
+
|
|
13
|
+
export type DsWorkspaceLayoutSubHeaderProps = ComponentPropsWithRef<'div'>;
|
|
14
|
+
|
|
15
|
+
export type DsWorkspaceLayoutContentProps = ComponentPropsWithRef<'div'>;
|
|
16
|
+
|
|
17
|
+
export type DsWorkspaceLayoutFooterProps = ComponentPropsWithRef<'footer'>;
|
|
18
|
+
|
|
19
|
+
export type DsWorkspaceLayoutBodyProps = ComponentPropsWithRef<'div'>;
|
|
20
|
+
|
|
21
|
+
export type DsWorkspaceLayoutLeftPanelProps = ComponentPropsWithRef<'aside'>;
|
|
22
|
+
|
|
23
|
+
export interface DsWorkspaceLayoutSideMenuProps extends ComponentPropsWithRef<'aside'> {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the side menu is pinned open. When `true`, the expanded panel pushes the content area
|
|
26
|
+
* to the right; when `false`, the collapsed rail is shown and hovering it overlays the expanded
|
|
27
|
+
* panel without shifting the content.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
pinned?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Called when the built-in pin/unpin button is clicked. Pass this prop to render the pin
|
|
33
|
+
* affordance in the top-right corner of the expanded panel; omit it to hide the button (e.g.
|
|
34
|
+
* when the side menu should always remain in its default collapsed state).
|
|
35
|
+
*/
|
|
36
|
+
onPinnedChange?: (pinned: boolean) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Locale object (you can pass custom strings for localization).
|
|
39
|
+
*/
|
|
40
|
+
locale?: {
|
|
41
|
+
/**
|
|
42
|
+
* aria-label for the pin button when the side menu is collapsed/unpinned.
|
|
43
|
+
* @default 'Pin side menu'
|
|
44
|
+
*/
|
|
45
|
+
pinButtonLabel?: string;
|
|
46
|
+
/**
|
|
47
|
+
* aria-label for the pin button when the side menu is pinned.
|
|
48
|
+
* @default 'Unpin side menu'
|
|
49
|
+
*/
|
|
50
|
+
unpinButtonLabel?: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as DsWorkspaceLayout } from './ds-workspace-layout';
|
|
2
|
+
export type {
|
|
3
|
+
DsWorkspaceLayoutProps,
|
|
4
|
+
DsWorkspaceLayoutHeaderProps,
|
|
5
|
+
DsWorkspaceLayoutSubHeaderProps,
|
|
6
|
+
DsWorkspaceLayoutContentProps,
|
|
7
|
+
DsWorkspaceLayoutFooterProps,
|
|
8
|
+
DsWorkspaceLayoutBodyProps,
|
|
9
|
+
DsWorkspaceLayoutSideMenuProps,
|
|
10
|
+
DsWorkspaceLayoutLeftPanelProps,
|
|
11
|
+
} from './ds-workspace-layout.types';
|
package/src/index.ts
CHANGED
|
@@ -64,5 +64,5 @@ export * from './components/ds-tooltip';
|
|
|
64
64
|
export * from './components/ds-tree';
|
|
65
65
|
export * from './components/ds-typography';
|
|
66
66
|
export * from './components/ds-vertical-tabs';
|
|
67
|
-
export * from './components/ds-workspace';
|
|
67
|
+
export * from './components/ds-workspace-layout';
|
|
68
68
|
export * from './utils/responsive';
|
|
@@ -35,6 +35,43 @@ $scrollbar-thin-size: 4px;
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
@mixin scrollbar-on-hover {
|
|
39
|
+
&::-webkit-scrollbar {
|
|
40
|
+
width: $scrollbar-thin-size;
|
|
41
|
+
height: $scrollbar-thin-size;
|
|
42
|
+
background: transparent;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&::-webkit-scrollbar-track {
|
|
46
|
+
background: transparent;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&::-webkit-scrollbar-corner {
|
|
50
|
+
background: transparent;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&::-webkit-scrollbar-thumb {
|
|
54
|
+
background-color: transparent;
|
|
55
|
+
border-radius: $scrollbar-border-radius;
|
|
56
|
+
transition: background-color 0.2s;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:hover::-webkit-scrollbar-thumb {
|
|
60
|
+
background-color: var(--background-tertiary);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
64
|
+
background-color: var(--background-deselected-hover);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
scrollbar-width: thin;
|
|
68
|
+
scrollbar-color: transparent transparent;
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
scrollbar-color: var(--background-tertiary) transparent;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
38
75
|
* {
|
|
39
76
|
@include scrollbar-base($scrollbar-default-size);
|
|
40
77
|
@include firefox-scrollbar($scrollbar-default-size);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const SCROLL_LOCK_ATTRIBUTE = 'data-scroll-lock';
|
|
2
|
+
const INERT_ATTRIBUTE = 'data-inert';
|
|
3
|
+
const ARIA_HIDDEN_MARKER = 'data-aria-hidden';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Clears document body styles and attributes left by Zag dialog modal effects when a
|
|
7
|
+
* dialog instance tears down without a normal close transition.
|
|
8
|
+
*
|
|
9
|
+
* No-op unless a leak sentinel is present: in the common case Zag restores the body on
|
|
10
|
+
* unmount itself, and we must not clobber styles the host app owns.
|
|
11
|
+
*/
|
|
12
|
+
export const restoreDocumentBodyModalStyles = (doc: Document = document) => {
|
|
13
|
+
const { body, documentElement } = doc;
|
|
14
|
+
|
|
15
|
+
const hasLeakedLock =
|
|
16
|
+
body.hasAttribute(SCROLL_LOCK_ATTRIBUTE) ||
|
|
17
|
+
body.hasAttribute(INERT_ATTRIBUTE) ||
|
|
18
|
+
body.style.pointerEvents === 'none';
|
|
19
|
+
|
|
20
|
+
if (!hasLeakedLock) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
body.removeAttribute(SCROLL_LOCK_ATTRIBUTE);
|
|
25
|
+
body.removeAttribute(INERT_ATTRIBUTE);
|
|
26
|
+
body.removeAttribute(ARIA_HIDDEN_MARKER);
|
|
27
|
+
|
|
28
|
+
if (body.getAttribute('aria-hidden') === 'true') {
|
|
29
|
+
body.removeAttribute('aria-hidden');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
body.style.removeProperty('overflow');
|
|
33
|
+
body.style.removeProperty('pointer-events');
|
|
34
|
+
body.style.removeProperty('position');
|
|
35
|
+
body.style.removeProperty('top');
|
|
36
|
+
body.style.removeProperty('left');
|
|
37
|
+
body.style.removeProperty('right');
|
|
38
|
+
|
|
39
|
+
if (body.style.length === 0) {
|
|
40
|
+
body.removeAttribute('style');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
documentElement.style.removeProperty('--scrollbar-width');
|
|
44
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
2
|
+
import { restoreDocumentBodyModalStyles } from './restore-document-body-modal-styles';
|
|
3
|
+
|
|
4
|
+
const activeBodyLockInstances = new Set<symbol>();
|
|
5
|
+
|
|
6
|
+
const scheduleBodyLockRestoreIfIdle = () => {
|
|
7
|
+
queueMicrotask(() => {
|
|
8
|
+
if (activeBodyLockInstances.size > 0) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
restoreDocumentBodyModalStyles();
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Ensures Zag dialog body scroll-lock and modal pointer blocking are released when
|
|
18
|
+
* an Ark dialog unmounts while still open (e.g. close + conditional unmount + navigate).
|
|
19
|
+
*/
|
|
20
|
+
export const useArkDialogBodyLockCleanup = (open: boolean, enabled: boolean) => {
|
|
21
|
+
const instanceIdRef = useRef(Symbol('ark-dialog-body-lock'));
|
|
22
|
+
|
|
23
|
+
useLayoutEffect(() => {
|
|
24
|
+
if (!open || !enabled) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const instanceId = instanceIdRef.current;
|
|
29
|
+
activeBodyLockInstances.add(instanceId);
|
|
30
|
+
|
|
31
|
+
return () => {
|
|
32
|
+
activeBodyLockInstances.delete(instanceId);
|
|
33
|
+
scheduleBodyLockRestoreIfIdle();
|
|
34
|
+
};
|
|
35
|
+
}, [open, enabled]);
|
|
36
|
+
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
--ds-workspace-header-height: 54px;
|
|
3
|
-
--ds-workspace-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
|
-
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
height: 100vh;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
background: var(--background);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.fillParent {
|
|
19
|
-
height: 100%;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.header {
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
flex-shrink: 0;
|
|
26
|
-
height: var(--ds-workspace-header-height);
|
|
27
|
-
padding: 0 var(--sm) 0 var(--lg);
|
|
28
|
-
background: var(--ds-workspace-header-gradient);
|
|
29
|
-
color: var(--font-on-action);
|
|
30
|
-
overflow: clip;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.subHeader {
|
|
34
|
-
display: flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
flex-shrink: 0;
|
|
37
|
-
padding: var(--xs) var(--standard);
|
|
38
|
-
border-bottom: 1px solid var(--border);
|
|
39
|
-
background: var(--background);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.content {
|
|
43
|
-
position: relative;
|
|
44
|
-
flex: 1;
|
|
45
|
-
overflow: auto;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.footer {
|
|
49
|
-
display: flex;
|
|
50
|
-
align-items: center;
|
|
51
|
-
flex-shrink: 0;
|
|
52
|
-
padding: var(--xs) var(--standard);
|
|
53
|
-
border-top: 1px solid var(--border);
|
|
54
|
-
background: var(--background);
|
|
55
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import styles from './ds-workspace.module.scss';
|
|
3
|
-
import type {
|
|
4
|
-
DsWorkspaceProps,
|
|
5
|
-
DsWorkspaceHeaderProps,
|
|
6
|
-
DsWorkspaceSubHeaderProps,
|
|
7
|
-
DsWorkspaceContentProps,
|
|
8
|
-
DsWorkspaceFooterProps,
|
|
9
|
-
} from './ds-workspace.types';
|
|
10
|
-
|
|
11
|
-
const DsWorkspace = ({ className, fillParent = false, ...rest }: DsWorkspaceProps) => (
|
|
12
|
-
<div {...rest} className={classNames(styles.root, { [styles.fillParent]: fillParent }, className)} />
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const Header = ({ className, ...rest }: DsWorkspaceHeaderProps) => (
|
|
16
|
-
<header {...rest} className={classNames(styles.header, className)} />
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const SubHeader = ({ className, ...rest }: DsWorkspaceSubHeaderProps) => (
|
|
20
|
-
<div {...rest} className={classNames(styles.subHeader, className)} />
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
/** Stacking context for non-portal drawer containment. */
|
|
24
|
-
const Content = ({ className, ...rest }: DsWorkspaceContentProps) => (
|
|
25
|
-
<div {...rest} className={classNames(styles.content, className)} />
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const Footer = ({ className, ...rest }: DsWorkspaceFooterProps) => (
|
|
29
|
-
<footer {...rest} className={classNames(styles.footer, className)} />
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
DsWorkspace.Header = Header;
|
|
33
|
-
DsWorkspace.SubHeader = SubHeader;
|
|
34
|
-
DsWorkspace.Content = Content;
|
|
35
|
-
DsWorkspace.Footer = Footer;
|
|
36
|
-
|
|
37
|
-
export default DsWorkspace;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface DsWorkspaceProps extends ComponentPropsWithRef<'div'> {
|
|
4
|
-
/**
|
|
5
|
-
* Whether the workspace should fill its parent height (`100%`) instead of the viewport (`100vh`).
|
|
6
|
-
* @default false
|
|
7
|
-
*/
|
|
8
|
-
fillParent?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type DsWorkspaceHeaderProps = ComponentPropsWithRef<'header'>;
|
|
12
|
-
|
|
13
|
-
export type DsWorkspaceSubHeaderProps = ComponentPropsWithRef<'div'>;
|
|
14
|
-
|
|
15
|
-
export type DsWorkspaceContentProps = ComponentPropsWithRef<'div'>;
|
|
16
|
-
|
|
17
|
-
export type DsWorkspaceFooterProps = ComponentPropsWithRef<'footer'>;
|