@drivenets/design-system 0.17.0 → 0.18.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.cjs +1727 -701
  3. package/dist/index.d.cts +115 -52
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.ts +115 -52
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1729 -705
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.min.css +1 -1
  10. package/package.json +2 -2
  11. package/src/components/ds-alert-banner/ds-alert-banner-global.figma.ts +49 -0
  12. package/src/components/ds-alert-banner/ds-alert-banner.figma.ts +51 -0
  13. package/src/components/ds-autocomplete/ds-autocomplete.module.scss +15 -4
  14. package/src/components/ds-autocomplete/ds-autocomplete.tsx +10 -3
  15. package/src/components/ds-autocomplete/ds-autocomplete.types.ts +8 -0
  16. package/src/components/ds-button-v3/ds-button-v3.figma.ts +5 -3
  17. package/src/components/ds-button-v3/ds-button-v3.module.scss +84 -17
  18. package/src/components/ds-button-v3/ds-button-v3.tsx +2 -0
  19. package/src/components/ds-button-v3/ds-button-v3.types.ts +11 -2
  20. package/src/components/ds-button-v3/ds-button-v4.figma.ts +121 -0
  21. package/src/components/ds-comment-bubble/ds-comment-bubble.figma.ts +52 -0
  22. package/src/components/ds-comment-card/ds-comment-card.figma.ts +36 -0
  23. package/src/components/ds-comment-indicator/ds-comment-indicator.figma.ts +32 -0
  24. package/src/components/ds-comments-drawer/ds-comments-drawer.figma.ts +19 -0
  25. package/src/components/ds-select/ds-select.figma.ts +2 -1
  26. package/src/components/ds-select/ds-select.tsx +6 -1
  27. package/src/components/ds-select/ds-select.types.ts +2 -1
  28. package/src/components/ds-slider/ds-slider.figma.ts +29 -0
  29. package/src/components/ds-slider/ds-slider.module.scss +104 -0
  30. package/src/components/ds-slider/ds-slider.tsx +118 -0
  31. package/src/components/ds-slider/ds-slider.types.ts +102 -0
  32. package/src/components/ds-slider/ds-slider.utils.ts +14 -0
  33. package/src/components/ds-slider/index.ts +11 -0
  34. package/src/components/ds-smart-tabs/figma/ds-smart-tabs-tab.figma.ts +83 -0
  35. package/src/components/ds-smart-tabs/figma/ds-smart-tabs.figma.ts +23 -0
  36. package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.module.scss +5 -1
  37. package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.tsx +15 -3
  38. package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +15 -1
  39. package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +29 -6
  40. package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.module.scss +23 -0
  41. package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.tsx +218 -0
  42. package/src/components/ds-table/components/ds-table-resize-handle/ds-table-resize-handle.types.ts +14 -0
  43. package/src/components/ds-table/components/ds-table-resize-handle/index.ts +1 -0
  44. package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.module.scss +18 -0
  45. package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.tsx +16 -0
  46. package/src/components/ds-table/components/ds-table-resize-overlay/ds-table-resize-overlay.types.ts +13 -0
  47. package/src/components/ds-table/components/ds-table-resize-overlay/index.ts +1 -0
  48. package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +1 -1
  49. package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +9 -2
  50. package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.module.scss +2 -1
  51. package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.tsx +9 -2
  52. package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-checkbox.tsx +2 -2
  53. package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-date.tsx +2 -1
  54. package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-number.tsx +2 -1
  55. package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-select.tsx +2 -1
  56. package/src/components/ds-table/components/edit/cell-editors/ds-table-edit-cell-text.tsx +2 -1
  57. package/src/components/ds-table/components/edit/ds-table-editing-cell/ds-table-editing-cell.tsx +12 -3
  58. package/src/components/ds-table/context/ds-table-context.tsx +208 -0
  59. package/src/components/ds-table/ds-table-defaults.ts +42 -0
  60. package/src/components/ds-table/ds-table.module.scss +4 -1
  61. package/src/components/ds-table/ds-table.tsx +139 -214
  62. package/src/components/ds-table/ds-table.types.ts +53 -47
  63. package/src/components/ds-table/grouping/utils/column-group.ts +7 -5
  64. package/src/components/ds-table/hooks/use-cell-editor.ts +5 -1
  65. package/src/components/ds-table/hooks/use-column-resize.ts +385 -0
  66. package/src/components/ds-table/hooks/use-editing-state.ts +190 -0
  67. package/src/components/ds-table/index.ts +1 -0
  68. package/src/components/ds-table/styles/_variables.scss +2 -1
  69. package/src/components/ds-table/utils/column-size-meta.augmentation.ts +16 -0
  70. package/src/components/ds-table/utils/column-size.ts +213 -10
  71. package/src/components/ds-table/utils/column-size.unit.test.ts +213 -0
  72. package/src/components/ds-table/utils/constants.ts +28 -0
  73. package/src/components/ds-table/utils/frozen-body.ts +33 -0
  74. package/src/components/ds-table/utils/frozen-body.unit.test.ts +44 -0
  75. package/src/components/ds-table/utils/table-api.ts +42 -0
  76. package/src/components/ds-table/utils/table-api.unit.test.ts +82 -0
  77. package/src/components/ds-table/utils/table-columns.tsx +119 -0
  78. package/src/components/ds-table/utils/table-columns.unit.test.ts +199 -0
  79. package/src/components/ds-tag/ds-tag.figma.ts +51 -0
  80. package/src/components/ds-tag-filter/ds-tag-filter.figma.ts +16 -0
  81. package/src/components/ds-text-input/ds-input-field-v02.figma.ts +29 -4
  82. package/src/components/ds-text-input/ds-text-input.figma.ts +3 -2
  83. package/src/components/ds-text-input/ds-text-input.tsx +1 -0
  84. package/src/components/ds-text-input/ds-text-input.types.ts +1 -1
  85. package/src/components/ds-tree/ds-tree.figma.ts +54 -0
  86. package/src/components/ds-workspace-layout/ds-workspace-layout.figma.ts +99 -0
  87. package/src/components/ds-workspace-layout/ds-workspace-layout.module.scss +1 -8
  88. package/src/index.ts +1 -0
  89. package/src/styles/_gradients.scss +19 -0
  90. package/src/styles/_root.scss +39 -15
  91. package/src/styles/_typography.scss +1 -0
  92. package/src/styles/shared/_input.scss +10 -0
  93. package/src/styles/styles.scss +1 -0
  94. package/src/components/ds-table/context/ds-table-context.ts +0 -112
@@ -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
+ }
@@ -18,18 +18,18 @@
18
18
  :root {
19
19
  /* Mode 1 */
20
20
  /* color */
21
- --color-dap-blue-050: #edf7ff;
22
- --color-dap-blue-075: #e1efff;
23
- --color-dap-blue-100: #d6eaff;
24
- --color-dap-blue-200: #b5ddff;
25
- --color-dap-blue-300: #83c8ff;
26
- --color-dap-blue-400: #48aaff;
27
- --color-dap-blue-500: #1e83ff;
28
- --color-dap-blue-600: #0661ff;
29
- --color-dap-blue-700: #004cff;
30
- --color-dap-blue-800: #083bc5;
31
- --color-dap-blue-900: #0d379b;
32
- --color-dap-blue-950: #0e235d;
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: Roboto;
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;
@@ -5,6 +5,7 @@
5
5
  @use './utilities';
6
6
  @use './scrollbars';
7
7
  @use './root';
8
+ @use './gradients';
8
9
 
9
10
  @use './shared/dropdown';
10
11
  @use './shared/input';
@@ -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
- };