@drivenets/design-system 0.18.1 → 0.20.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 (216) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/index.cjs +17038 -10114
  3. package/dist/index.d.cts +1355 -444
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.ts +1354 -443
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +17073 -10172
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.min.css +1 -1
  10. package/package.json +41 -41
  11. package/src/components/ds-bot-button/ds-bot-button.figma.ts +38 -0
  12. package/src/components/ds-bot-button/ds-bot-button.module.scss +41 -0
  13. package/src/components/ds-bot-button/ds-bot-button.tsx +48 -0
  14. package/src/components/ds-bot-button/ds-bot-button.types.ts +33 -0
  15. package/src/components/ds-bot-button/index.ts +2 -0
  16. package/src/components/ds-bot-button/net-gen-logo.tsx +46 -0
  17. package/src/components/ds-bulk-actions/components/action-button.tsx +42 -0
  18. package/src/components/ds-bulk-actions/components/menu-entries.tsx +76 -0
  19. package/src/components/ds-bulk-actions/components/overflow.tsx +75 -0
  20. package/src/components/ds-bulk-actions/ds-bulk-actions.figma.ts +28 -0
  21. package/src/components/ds-bulk-actions/ds-bulk-actions.module.scss +199 -0
  22. package/src/components/ds-bulk-actions/ds-bulk-actions.tsx +220 -0
  23. package/src/components/ds-bulk-actions/ds-bulk-actions.types.ts +170 -0
  24. package/src/components/ds-bulk-actions/ds-bulk-actions.unit.test.ts +195 -0
  25. package/src/components/ds-bulk-actions/ds-bulk-actions.utils.ts +91 -0
  26. package/src/components/ds-bulk-actions/ds-bulk-actions.utils.unit.test.ts +134 -0
  27. package/src/components/ds-bulk-actions/hooks/compute-bulk-actions-overflow.ts +85 -0
  28. package/src/components/ds-bulk-actions/hooks/use-bulk-actions-overflow.ts +153 -0
  29. package/src/components/ds-bulk-actions/index.ts +18 -0
  30. package/src/components/ds-button-v3/ds-button-v3.module.scss +2 -2
  31. package/src/components/ds-catalog-layout/ds-catalog-layout.figma.ts +1 -1
  32. package/src/components/ds-checkbox/ds-checkbox.figma.ts +3 -0
  33. package/src/components/ds-checkbox/ds-checkbox.module.scss +102 -20
  34. package/src/components/ds-checkbox/ds-checkbox.tsx +30 -2
  35. package/src/components/ds-checkbox/ds-checkbox.types.ts +10 -0
  36. package/src/components/ds-code-input/collapsed-code-field/collapsed-code-field.module.scss +169 -0
  37. package/src/components/ds-code-input/collapsed-code-field/collapsed-code-field.tsx +92 -0
  38. package/src/components/ds-code-input/collapsed-code-field/index.ts +1 -0
  39. package/src/components/ds-code-input/ds-code-input-panel/ds-code-input-panel.module.scss +110 -0
  40. package/src/components/ds-code-input/ds-code-input-panel/ds-code-input-panel.tsx +61 -0
  41. package/src/components/ds-code-input/ds-code-input-panel/index.ts +1 -0
  42. package/src/components/ds-code-input/ds-code-input.module.scss +25 -0
  43. package/src/components/ds-code-input/ds-code-input.tsx +401 -0
  44. package/src/components/ds-code-input/ds-code-input.types.ts +166 -0
  45. package/src/components/ds-code-input/ds-code-input.utils.ts +94 -0
  46. package/src/components/ds-code-input/ds-code-input.utils.unit.test.ts +166 -0
  47. package/src/components/ds-code-input/index.ts +2 -0
  48. package/src/components/ds-code-input/use-collapsed-viewport.ts +289 -0
  49. package/src/components/ds-code-input/use-editor-host.ts +87 -0
  50. package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +2 -0
  51. package/src/components/ds-empty-state/ds-empty-state.module.scss +16 -0
  52. package/src/components/ds-empty-state/ds-empty-state.tsx +45 -0
  53. package/src/components/ds-empty-state/ds-empty-state.types.ts +38 -0
  54. package/src/components/ds-empty-state/index.ts +3 -0
  55. package/src/components/ds-file-upload/ds-file-upload.tsx +4 -1
  56. package/src/components/ds-filters-bar/components/ds-filters-bar-builder/ds-filters-bar-builder.ts +11 -0
  57. package/src/components/ds-filters-bar/components/ds-filters-bar-builder/ds-filters-bar-builder.types.ts +41 -0
  58. package/src/components/ds-filters-bar/components/ds-filters-bar-builder/index.ts +1 -0
  59. package/src/components/ds-filters-bar/components/ds-filters-bar-clear-all.ts +11 -0
  60. package/src/components/ds-filters-bar/components/ds-filters-bar-conditions/ds-filters-bar-conditions.ts +11 -0
  61. package/src/components/ds-filters-bar/components/ds-filters-bar-conditions/ds-filters-bar-conditions.types.ts +30 -0
  62. package/src/components/ds-filters-bar/components/ds-filters-bar-conditions/index.ts +1 -0
  63. package/src/components/ds-filters-bar/components/ds-filters-bar-pinned.ts +31 -0
  64. package/src/components/ds-filters-bar/components/ds-filters-bar-query/ds-filters-bar-query.ts +11 -0
  65. package/src/components/ds-filters-bar/components/ds-filters-bar-query/ds-filters-bar-query.types.ts +22 -0
  66. package/src/components/ds-filters-bar/components/ds-filters-bar-query/index.ts +1 -0
  67. package/src/components/ds-filters-bar/components/ds-filters-bar-saved-filters.ts +19 -0
  68. package/src/components/ds-filters-bar/components/ds-filters-bar-search.ts +11 -0
  69. package/src/components/ds-filters-bar/components/ds-filters-bar-summary.ts +11 -0
  70. package/src/components/ds-filters-bar/components/ds-filters-bar-toolbar.ts +11 -0
  71. package/src/components/ds-filters-bar/components/ds-filters-bar-view-switch.ts +11 -0
  72. package/src/components/ds-filters-bar/components/ds-filters-bar-view.ts +11 -0
  73. package/src/components/ds-filters-bar/components/index.ts +11 -0
  74. package/src/components/ds-filters-bar/ds-filters-bar.context.ts +69 -0
  75. package/src/components/ds-filters-bar/ds-filters-bar.tsx +120 -0
  76. package/src/components/ds-filters-bar/ds-filters-bar.types.ts +440 -0
  77. package/src/components/ds-filters-bar/ds-filters-bar.unit.test.ts +216 -0
  78. package/src/components/ds-filters-bar/ds-filters-bar.utils.ts +141 -0
  79. package/src/components/ds-filters-bar/index.ts +1 -0
  80. package/src/components/ds-form-control/ds-form-control.module.scss +18 -0
  81. package/src/components/ds-form-control/ds-form-control.tsx +61 -19
  82. package/src/components/ds-form-control/ds-form-control.types.ts +2 -1
  83. package/src/components/ds-icon/custom-icons/index.ts +2 -0
  84. package/src/components/ds-icon/custom-icons/special-adv-filters.tsx +28 -0
  85. package/src/components/ds-illustration/ds-illustration.figma.ts +34 -0
  86. package/src/components/ds-illustration/ds-illustration.module.scss +6 -0
  87. package/src/components/ds-illustration/ds-illustration.tsx +29 -0
  88. package/src/components/ds-illustration/ds-illustration.types.ts +45 -0
  89. package/src/components/ds-illustration/illustrations/configuration.tsx +51 -0
  90. package/src/components/ds-illustration/illustrations/device.tsx +133 -0
  91. package/src/components/ds-illustration/illustrations/done.tsx +107 -0
  92. package/src/components/{ds-catalog-layout/catalog-layout-empty-illustration.tsx → ds-illustration/illustrations/empty-inbox.tsx} +10 -14
  93. package/src/components/ds-illustration/illustrations/error.tsx +86 -0
  94. package/src/components/ds-illustration/illustrations/go-filter.tsx +51 -0
  95. package/src/components/ds-illustration/illustrations/illustration-clouds.tsx +10 -0
  96. package/src/components/ds-illustration/illustrations/index.ts +39 -0
  97. package/src/components/ds-illustration/illustrations/no-connection.tsx +54 -0
  98. package/src/components/ds-illustration/illustrations/no-credit-card.tsx +48 -0
  99. package/src/components/ds-illustration/illustrations/no-device.tsx +61 -0
  100. package/src/components/ds-illustration/illustrations/no-documents.tsx +52 -0
  101. package/src/components/ds-illustration/illustrations/no-gps.tsx +57 -0
  102. package/src/components/ds-illustration/illustrations/no-images.tsx +82 -0
  103. package/src/components/ds-illustration/illustrations/no-items-cart.tsx +86 -0
  104. package/src/components/ds-illustration/illustrations/no-messages.tsx +51 -0
  105. package/src/components/ds-illustration/illustrations/no-search-result.tsx +76 -0
  106. package/src/components/ds-illustration/illustrations/no-tasks.tsx +61 -0
  107. package/src/components/ds-illustration/illustrations/site.tsx +80 -0
  108. package/src/components/ds-illustration/index.ts +3 -0
  109. package/src/components/ds-main-menu/components/expanded-item/expanded-item.tsx +108 -0
  110. package/src/components/ds-main-menu/components/expanded-item/expanded-item.types.ts +8 -0
  111. package/src/components/ds-main-menu/components/expanded-item/index.ts +1 -0
  112. package/src/components/ds-main-menu/components/menu-graphic/index.ts +1 -0
  113. package/src/components/ds-main-menu/components/menu-graphic/menu-graphic.tsx +16 -0
  114. package/src/components/ds-main-menu/components/menu-graphic/menu-graphic.types.ts +7 -0
  115. package/src/components/ds-main-menu/components/tile-link/index.ts +1 -0
  116. package/src/components/ds-main-menu/components/tile-link/tile-link.tsx +85 -0
  117. package/src/components/ds-main-menu/components/tile-link/tile-link.types.ts +8 -0
  118. package/src/components/ds-main-menu/components/utility-link/index.ts +1 -0
  119. package/src/components/ds-main-menu/components/utility-link/utility-link.tsx +37 -0
  120. package/src/components/ds-main-menu/components/utility-link/utility-link.types.ts +7 -0
  121. package/src/components/ds-main-menu/ds-main-menu.figma.ts +17 -0
  122. package/src/components/ds-main-menu/ds-main-menu.module.scss +349 -0
  123. package/src/components/ds-main-menu/ds-main-menu.tsx +102 -0
  124. package/src/components/ds-main-menu/ds-main-menu.types.ts +86 -0
  125. package/src/components/ds-main-menu/ds-main-menu.utils.ts +40 -0
  126. package/src/components/ds-main-menu/index.ts +9 -0
  127. package/src/components/ds-modal/figma/ds-modal-footer.figma.ts +1 -1
  128. package/src/components/ds-pin-toggle/ds-pin-toggle.figma.ts +27 -0
  129. package/src/components/ds-pin-toggle/ds-pin-toggle.module.scss +41 -0
  130. package/src/components/ds-pin-toggle/ds-pin-toggle.tsx +43 -0
  131. package/src/components/ds-pin-toggle/ds-pin-toggle.types.ts +29 -0
  132. package/src/components/ds-pin-toggle/index.ts +2 -0
  133. package/src/components/ds-popover/components/popover-trigger/index.ts +1 -0
  134. package/src/components/ds-popover/components/popover-trigger/popover-trigger.tsx +15 -0
  135. package/src/components/ds-popover/ds-popover.context.ts +18 -0
  136. package/src/components/ds-popover/ds-popover.hover-intent.ts +65 -0
  137. package/src/components/ds-popover/ds-popover.tsx +164 -41
  138. package/src/components/ds-popover/ds-popover.types.ts +65 -0
  139. package/src/components/ds-popover/ds-popover.utils.ts +60 -0
  140. package/src/components/ds-popover/ds-popover.utils.unit.test.ts +25 -0
  141. package/src/components/ds-saved-filters/components/ds-saved-filters-delete-confirm.tsx +53 -0
  142. package/src/components/ds-saved-filters/components/ds-saved-filters-name-entry.tsx +64 -0
  143. package/src/components/ds-saved-filters/components/ds-saved-filters-name-modal.tsx +50 -0
  144. package/src/components/ds-saved-filters/components/ds-saved-filters-row/ds-saved-filters-row.module.scss +68 -0
  145. package/src/components/ds-saved-filters/components/ds-saved-filters-row/ds-saved-filters-row.tsx +83 -0
  146. package/src/components/ds-saved-filters/components/ds-saved-filters-row/index.ts +1 -0
  147. package/src/components/ds-saved-filters/components/ds-saved-filters-save.tsx +164 -0
  148. package/src/components/ds-saved-filters/components/ds-saved-filters-trigger/ds-saved-filters-trigger.module.scss +21 -0
  149. package/src/components/ds-saved-filters/components/ds-saved-filters-trigger/ds-saved-filters-trigger.tsx +237 -0
  150. package/src/components/ds-saved-filters/components/ds-saved-filters-trigger/index.ts +1 -0
  151. package/src/components/ds-saved-filters/components/index.ts +2 -0
  152. package/src/components/ds-saved-filters/ds-saved-filters.ts +6 -0
  153. package/src/components/ds-saved-filters/ds-saved-filters.types.ts +106 -0
  154. package/src/components/ds-saved-filters/ds-saved-filters.utils.ts +35 -0
  155. package/src/components/ds-saved-filters/hooks/index.ts +1 -0
  156. package/src/components/ds-saved-filters/hooks/use-picker-outside-dismiss.ts +42 -0
  157. package/src/components/ds-saved-filters/index.ts +2 -0
  158. package/src/components/ds-segment-group/ds-segment-group.module.scss +65 -37
  159. package/src/components/ds-segment-group/ds-segment-group.tsx +17 -5
  160. package/src/components/ds-segment-group/ds-segment-group.types.ts +20 -5
  161. package/src/components/ds-segment-group/figma/ds-segment-group-v2-item.figma.ts +109 -0
  162. package/src/components/ds-segment-group/figma/ds-segment-group-v2.figma.ts +31 -0
  163. package/src/components/ds-site-node/ds-site-node.tsx +2 -2
  164. package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.module.scss +12 -2
  165. package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.tsx +2 -3
  166. package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.module.scss +1 -6
  167. package/src/components/ds-table/components/ds-table-group-header-cell/ds-table-group-header-cell.tsx +6 -3
  168. package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +18 -7
  169. package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +27 -21
  170. package/src/components/ds-table/components/ds-table-header-label.module.scss +12 -0
  171. package/src/components/ds-table/components/ds-table-header-label.tsx +28 -0
  172. package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +0 -1
  173. package/src/components/ds-table/context/ds-table-context.tsx +8 -0
  174. package/src/components/ds-table/ds-table.module.scss +26 -16
  175. package/src/components/ds-table/ds-table.tsx +46 -14
  176. package/src/components/ds-table/ds-table.types.ts +33 -3
  177. package/src/components/ds-table/hooks/use-column-resize.ts +114 -11
  178. package/src/components/ds-table/hooks/use-scrollbar-spacer.ts +108 -0
  179. package/src/components/ds-table/hooks/use-scrollbar-spacer.unit.test.ts +26 -0
  180. package/src/components/ds-table/styles/_variables.scss +0 -2
  181. package/src/components/ds-table/utils/column-size.ts +274 -1
  182. package/src/components/ds-table/utils/column-size.unit.test.ts +157 -0
  183. package/src/components/ds-table/utils/constants.ts +13 -5
  184. package/src/components/ds-table/utils/table-columns.tsx +27 -13
  185. package/src/components/ds-table/utils/table-columns.unit.test.ts +44 -0
  186. package/src/components/ds-tag/ds-tag.figma.ts +23 -3
  187. package/src/components/ds-tag/ds-tag.module.scss +71 -7
  188. package/src/components/ds-tag/ds-tag.tsx +115 -14
  189. package/src/components/ds-tag/ds-tag.types.ts +70 -3
  190. package/src/components/ds-tag/ds-tag.unit.test.ts +23 -4
  191. package/src/components/ds-tag/index.ts +2 -2
  192. package/src/components/ds-text-input/ds-input-field-v02.figma.ts +2 -0
  193. package/src/components/ds-toggle/ds-toggle.module.scss +18 -0
  194. package/src/components/ds-toggle/ds-toggle.tsx +15 -9
  195. package/src/components/ds-toggle/ds-toggle.types.ts +6 -0
  196. package/src/components/ds-toggle-filter-data/ds-toggle-filter-data.module.scss +69 -0
  197. package/src/components/ds-toggle-filter-data/ds-toggle-filter-data.tsx +55 -0
  198. package/src/components/ds-toggle-filter-data/ds-toggle-filter-data.types.ts +43 -0
  199. package/src/components/ds-toggle-filter-data/index.ts +1 -0
  200. package/src/components/ds-tooltip/ds-tooltip.module.scss +8 -0
  201. package/src/components/ds-tooltip/ds-tooltip.tsx +7 -3
  202. package/src/components/ds-tooltip/ds-tooltip.types.ts +17 -0
  203. package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.figma.ts +35 -0
  204. package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.module.scss +150 -0
  205. package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.tsx +161 -0
  206. package/src/components/ds-top-bar-navigation/ds-top-bar-navigation.types.ts +117 -0
  207. package/src/components/ds-top-bar-navigation/index.ts +2 -0
  208. package/src/components/ds-tree/ds-tree.tsx +10 -10
  209. package/src/components/ds-tree/ds-tree.types.ts +40 -7
  210. package/src/index.ts +8 -0
  211. package/src/utils/use-is-horizontally-overflowing.ts +35 -0
  212. package/src/components/ds-site-node/hooks/use-is-overflowing.ts +0 -31
  213. package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +0 -112
  214. package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.tsx +0 -67
  215. package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.types.ts +0 -41
  216. package/src/components/ds-table/components/ds-table-bulk-actions/index.ts +0 -2
@@ -0,0 +1,69 @@
1
+ .pill {
2
+ box-sizing: border-box;
3
+ display: inline-flex;
4
+ align-items: center;
5
+ gap: var(--4xs);
6
+ height: var(--lg);
7
+ padding: var(--4xs) var(--xs);
8
+ border: 1px solid var(--border);
9
+ border-radius: 9999px;
10
+ background: var(--background);
11
+ color: var(--font-main);
12
+ cursor: pointer;
13
+ transition-property: background, border-color, box-shadow, color;
14
+ transition-timing-function: ease-out;
15
+ transition-duration: 0.2s;
16
+
17
+ &:hover {
18
+ background: var(--background-action-hover-weak);
19
+ border-color: var(--border-field-hover);
20
+ }
21
+
22
+ &:focus-visible {
23
+ outline: none;
24
+ border-color: var(--border-field-hover);
25
+ background: var(--background-action-hover-weak);
26
+ box-shadow: inset 0 0 0 1px var(--border-field-hover);
27
+ }
28
+
29
+ &.active {
30
+ border-color: var(--border-action-primary);
31
+ background: var(--background-secondary-hover);
32
+
33
+ &:hover,
34
+ &:focus-visible {
35
+ border-color: var(--border-action-primary-hover);
36
+ background: var(--background-action-secondary-hover);
37
+ }
38
+
39
+ &:focus-visible {
40
+ box-shadow: inset 0 0 0 1px var(--border-action-primary-hover);
41
+ }
42
+
43
+ &:disabled {
44
+ border-color: var(--border-disabled);
45
+ background: var(--background-secondary);
46
+ }
47
+ }
48
+
49
+ &:disabled {
50
+ border-color: var(--border-disabled);
51
+ background: var(--background-action-hover-weak);
52
+ color: var(--font-disabled);
53
+ box-shadow: none;
54
+ cursor: not-allowed;
55
+
56
+ .value {
57
+ color: var(--font-disabled);
58
+ }
59
+ }
60
+ }
61
+
62
+ .label,
63
+ .value {
64
+ flex-shrink: 0;
65
+ }
66
+
67
+ .value {
68
+ color: var(--font-secondary);
69
+ }
@@ -0,0 +1,55 @@
1
+ import type { MouseEvent } from 'react';
2
+ import classNames from 'classnames';
3
+ import styles from './ds-toggle-filter-data.module.scss';
4
+ import type { DsToggleFilterDataProps } from './ds-toggle-filter-data.types';
5
+ import { DsTypography } from '../ds-typography';
6
+
7
+ /**
8
+ * @summary Data pill that toggles on and off, pairing a label with its value, for filter rows
9
+ * above a table or list.
10
+ *
11
+ * Internal to the filters component and not exported from the package.
12
+ *
13
+ * A real `<button type="button">`, so `aria-pressed`, Enter/Space activation, the disabled state
14
+ * and the focus ring are all native. Selection is controlled: the pill reports the next `active`
15
+ * value through `onActiveChange` and never toggles itself.
16
+ */
17
+ const DsToggleFilterData = ({
18
+ ref,
19
+ label,
20
+ value,
21
+ active,
22
+ disabled = false,
23
+ className,
24
+ style,
25
+ onActiveChange,
26
+ onClick,
27
+ }: DsToggleFilterDataProps) => {
28
+ const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
29
+ onClick?.(event);
30
+ onActiveChange?.(!active);
31
+ };
32
+
33
+ return (
34
+ <button
35
+ ref={ref}
36
+ type="button"
37
+ className={classNames(styles.pill, { [styles.active]: active }, className)}
38
+ style={style}
39
+ disabled={disabled}
40
+ aria-pressed={active}
41
+ onClick={handleClick}
42
+ >
43
+ <DsTypography variant="body-xs-md" className={styles.label}>
44
+ {label}
45
+ </DsTypography>
46
+ <DsTypography variant="body-xs-reg" className={styles.value}>
47
+ {value}
48
+ </DsTypography>
49
+ </button>
50
+ );
51
+ };
52
+
53
+ DsToggleFilterData.displayName = 'DsToggleFilterData';
54
+
55
+ export default DsToggleFilterData;
@@ -0,0 +1,43 @@
1
+ import type { CSSProperties, MouseEvent, ReactNode, Ref } from 'react';
2
+
3
+ export interface DsToggleFilterDataProps {
4
+ /**
5
+ * Ref to the pill element
6
+ */
7
+ ref?: Ref<HTMLButtonElement>;
8
+ /**
9
+ * Emphasized leading segment naming the data the pill filters on
10
+ */
11
+ label: ReactNode;
12
+ /**
13
+ * Secondary-colored trailing segment, typically the count the `label` refers to
14
+ */
15
+ value: ReactNode;
16
+ /**
17
+ * Whether the pill is toggled on. Controlled — pair it with `onActiveChange` and re-render with
18
+ * the next value. Surfaced as `aria-pressed`, which stays exposed while `disabled`.
19
+ */
20
+ active: boolean;
21
+ /**
22
+ * Whether the pill is disabled. Neither callback fires while set.
23
+ * @default false
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * Additional CSS class names
28
+ */
29
+ className?: string;
30
+ /**
31
+ * Additional styles to apply
32
+ */
33
+ style?: CSSProperties;
34
+ /**
35
+ * Called on click and on keyboard activation with the next `active` value
36
+ */
37
+ onActiveChange?: (active: boolean) => void;
38
+ /**
39
+ * Called with the raw click event, before `onActiveChange`. Observational only — it cannot veto
40
+ * the toggle.
41
+ */
42
+ onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
43
+ }
@@ -0,0 +1 @@
1
+ export { default as DsToggleFilterData } from './ds-toggle-filter-data';
@@ -1,5 +1,13 @@
1
1
  @use '../../styles/typography';
2
2
 
3
+ .positioner {
4
+ // Zag marks the *content* pointer-transparent when the tooltip is not
5
+ // interactive, but leaves this wrapper clickable — so an open tooltip swallows
6
+ // clicks meant for whatever it overlaps. Interactive content re-enables itself
7
+ // with `pointer-events: auto`, which still applies under a `none` parent.
8
+ pointer-events: none;
9
+ }
10
+
3
11
  .tooltip {
4
12
  --arrow-size: 7px;
5
13
  color: var(--font-on-action);
@@ -14,6 +14,9 @@ const DsTooltip: FC<DsTooltipProps> = ({
14
14
  children,
15
15
  placement = 'top',
16
16
  disabled = false,
17
+ interactive = false,
18
+ openDelay = OPEN_DELAY_MS,
19
+ closeDelay = CLOSE_DELAY_MS,
17
20
  getAnchorRect,
18
21
  slotProps,
19
22
  }) => {
@@ -23,8 +26,9 @@ const DsTooltip: FC<DsTooltipProps> = ({
23
26
 
24
27
  return (
25
28
  <Tooltip.Root
26
- openDelay={OPEN_DELAY_MS}
27
- closeDelay={CLOSE_DELAY_MS}
29
+ interactive={interactive}
30
+ openDelay={openDelay}
31
+ closeDelay={closeDelay}
28
32
  disabled={disabled}
29
33
  positioning={{ placement, gutter: TOOLTIP_GUTTER_PX, getAnchorRect: getAnchorRect ?? undefined }}
30
34
  lazyMount
@@ -32,7 +36,7 @@ const DsTooltip: FC<DsTooltipProps> = ({
32
36
  >
33
37
  <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
34
38
  <Portal>
35
- <Tooltip.Positioner>
39
+ <Tooltip.Positioner className={styles.positioner}>
36
40
  <Tooltip.Content
37
41
  className={classNames(styles.tooltip, slotProps?.content?.className)}
38
42
  style={slotProps?.content?.style}
@@ -44,6 +44,23 @@ export interface DsTooltipProps {
44
44
  * When true the trigger renders but the tooltip never opens.
45
45
  */
46
46
  disabled?: boolean;
47
+ /**
48
+ * When true, content is pointer-reachable and the tooltip stays open while the
49
+ * pointer is over it. Pair with a non-zero `closeDelay` (e.g. 150) so the pointer
50
+ * can travel from the trigger onto the content; `0` can lose that handoff.
51
+ * @default false
52
+ */
53
+ interactive?: boolean;
54
+ /**
55
+ * Milliseconds after pointer enter or focus before the tooltip opens.
56
+ * @default 200
57
+ */
58
+ openDelay?: number;
59
+ /**
60
+ * Milliseconds after pointer leave before the tooltip closes.
61
+ * @default 0
62
+ */
63
+ closeDelay?: number;
47
64
  /**
48
65
  * Anchors the tooltip to a virtual rect instead of the trigger, re-evaluated on
49
66
  * each reposition. Return `null` to fall back to the trigger.
@@ -0,0 +1,35 @@
1
+ // url=https://www.figma.com/design/nha3m67y7S57cHCSuQO2gp/DAP-Design-System-1.2?node-id=9543-40942
2
+ // source=https://github.com/drivenets/design-system/tree/main/packages/design-system/src/components/ds-top-bar-navigation
3
+ // component=DsTopBarNavigation
4
+ //
5
+ // `DsTopBarNavigationV1` maps to the `DsTopBarNavigation` compound component. Figma models the
6
+ // bar as a fixed 920px left frame with an absolutely-positioned breadcrumb; in code the zones
7
+ // are flex (`.Logo` fixed-basis, `.Breadcrumb` shrinkable, `.Center` reserved, `.Actions`
8
+ // pinned right), so none of that geometry maps to props.
9
+ //
10
+ // The brand glyph and wordmark are consumer slots — no brand asset ships with the design
11
+ // system — so they are emitted as placeholders. Figma's `DsBotButtonV1` maps to `DsBotButton`,
12
+ // which is connected separately in `ds-bot-button/ds-bot-button.figma.ts`.
13
+ import figma from 'figma';
14
+
15
+ export default {
16
+ example: figma.code`<DsTopBarNavigation>
17
+ <DsTopBarNavigation.Logo logo={<img src="/brand-mark.svg" alt="" />} wordmark="DAP" href="/" onAppsClick={() => {}} />
18
+ <DsTopBarNavigation.Breadcrumb>
19
+ <DsBreadcrumb items={[]} />
20
+ </DsTopBarNavigation.Breadcrumb>
21
+ <DsTopBarNavigation.Center />
22
+ <DsTopBarNavigation.Actions>
23
+ <DsTopBarNavigation.Notifications count={13} onClick={() => {}} />
24
+ <DsBotButton />
25
+ <DsTopBarNavigation.UserMenu name="Full Name">
26
+ <DsDropdownMenu.Item value="profile">Profile</DsDropdownMenu.Item>
27
+ </DsTopBarNavigation.UserMenu>
28
+ </DsTopBarNavigation.Actions>
29
+ </DsTopBarNavigation>`,
30
+ imports: [
31
+ "import { DsTopBarNavigation, DsBotButton, DsBreadcrumb, DsDropdownMenu } from '@drivenets/design-system';",
32
+ ],
33
+ id: 'ds-top-bar-navigation',
34
+ metadata: { nestable: false },
35
+ } satisfies figma.Template;
@@ -0,0 +1,150 @@
1
+ $focus-outline-width: 2px;
2
+ $disabled-avatar-opacity: 0.55;
3
+
4
+ .root {
5
+ --ds-top-bar-navigation-height: 54px;
6
+ --ds-top-bar-navigation-logo-min-width: 174px;
7
+ --ds-top-bar-navigation-logo-glyph-size: 32px;
8
+ --ds-top-bar-navigation-wordmark-font-size: 24px;
9
+ --ds-top-bar-navigation-breadcrumb-offset: var(--lg);
10
+ --ds-top-bar-navigation-zone-gap: var(--lg);
11
+ --ds-top-bar-navigation-badge-size: 16px;
12
+ --ds-top-bar-navigation-caret-size: 20px;
13
+
14
+ box-sizing: border-box;
15
+ display: flex;
16
+ align-items: center;
17
+ flex-shrink: 0;
18
+ height: var(--ds-top-bar-navigation-height);
19
+ padding-right: var(--md);
20
+ border-bottom: 1px solid var(--border);
21
+ background: var(--background);
22
+ }
23
+
24
+ .logo {
25
+ box-sizing: border-box;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ flex-shrink: 0;
30
+ gap: var(--sm);
31
+ align-self: stretch;
32
+ min-width: var(--ds-top-bar-navigation-logo-min-width);
33
+ padding: 0 var(--lg);
34
+ background: var(--background-primary);
35
+ color: var(--font-on-action);
36
+ }
37
+
38
+ .logoLockup {
39
+ display: flex;
40
+ align-items: center;
41
+ gap: var(--xs);
42
+ color: inherit;
43
+ text-decoration: none;
44
+ }
45
+
46
+ .logoGlyph {
47
+ display: flex;
48
+ flex-shrink: 0;
49
+ width: var(--ds-top-bar-navigation-logo-glyph-size);
50
+ height: var(--ds-top-bar-navigation-logo-glyph-size);
51
+ }
52
+
53
+ .logoWordmark {
54
+ font-family: var(--font-family-heading);
55
+ font-size: var(--ds-top-bar-navigation-wordmark-font-size);
56
+ font-weight: var(--font-weight-bold);
57
+ white-space: nowrap;
58
+ }
59
+
60
+ .breadcrumb {
61
+ display: flex;
62
+ align-items: center;
63
+ min-width: 0;
64
+ margin-left: var(--ds-top-bar-navigation-breadcrumb-offset);
65
+ overflow: hidden;
66
+ white-space: nowrap;
67
+ }
68
+
69
+ .center {
70
+ display: flex;
71
+ align-items: center;
72
+ flex: 1;
73
+ min-width: 0;
74
+ }
75
+
76
+ .actions {
77
+ display: flex;
78
+ align-items: center;
79
+ flex-shrink: 0;
80
+ gap: var(--standard);
81
+ margin-inline-start: auto;
82
+ padding-inline-start: var(--ds-top-bar-navigation-zone-gap);
83
+ }
84
+
85
+ .notificationsBadge {
86
+ box-sizing: border-box;
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ min-width: var(--ds-top-bar-navigation-badge-size);
91
+ height: var(--ds-top-bar-navigation-badge-size);
92
+ padding: 0 var(--3xs);
93
+ border-radius: 9999px;
94
+ background: var(--background-error);
95
+ color: var(--font-on-action);
96
+ font-size: var(--body-font-size-xs);
97
+ font-weight: var(--font-weight-medium);
98
+ line-height: var(--body-line-height-xs);
99
+
100
+ &[data-empty] {
101
+ display: none;
102
+ }
103
+ }
104
+
105
+ .userMenuTrigger {
106
+ display: flex;
107
+ align-items: center;
108
+ gap: var(--3xs);
109
+ padding: 0;
110
+ border: none;
111
+ border-radius: var(--3xs);
112
+ background: transparent;
113
+ color: var(--font-main);
114
+ cursor: pointer;
115
+
116
+ // Nested for the extra class of specificity: `DsAvatar` paints its own `background-color`
117
+ // and `color` from a single-class rule, so a standalone `.userMenuAvatar` ties with it and
118
+ // bundle order picks the winner.
119
+ .userMenuAvatar {
120
+ background-color: var(--light-buttons-tertiary);
121
+ color: var(--font-main);
122
+ }
123
+
124
+ &:focus {
125
+ outline: none;
126
+ }
127
+
128
+ &:focus-visible {
129
+ outline: $focus-outline-width solid var(--border-action-primary);
130
+ outline-offset: $focus-outline-width;
131
+ }
132
+
133
+ &:disabled {
134
+ color: var(--font-disabled);
135
+ cursor: not-allowed;
136
+
137
+ // The caret follows `color`; the avatar sets its own fill and text color above, so
138
+ // neither inherits the disabled tone — dim the whole lockup instead.
139
+ .userMenuAvatar {
140
+ opacity: $disabled-avatar-opacity;
141
+ }
142
+ }
143
+ }
144
+
145
+ .userMenuCaret {
146
+ display: flex;
147
+ flex-shrink: 0;
148
+ width: var(--ds-top-bar-navigation-caret-size);
149
+ height: var(--ds-top-bar-navigation-caret-size);
150
+ }
@@ -0,0 +1,161 @@
1
+ import classNames from 'classnames';
2
+ import styles from './ds-top-bar-navigation.module.scss';
3
+ import { DsAvatar } from '../ds-avatar';
4
+ import { DsButtonV3 } from '../ds-button-v3';
5
+ import { DsDropdownMenu } from '../ds-dropdown-menu';
6
+ import { DsIcon } from '../ds-icon';
7
+ import {
8
+ notificationCountCap,
9
+ type DsTopBarNavigationActionsProps,
10
+ type DsTopBarNavigationBreadcrumbProps,
11
+ type DsTopBarNavigationCenterProps,
12
+ type DsTopBarNavigationLogoProps,
13
+ type DsTopBarNavigationNotificationsProps,
14
+ type DsTopBarNavigationProps,
15
+ type DsTopBarNavigationUserMenuProps,
16
+ } from './ds-top-bar-navigation.types';
17
+
18
+ const DEFAULT_LOCALE = Object.freeze({
19
+ appsButtonLabel: 'Apps',
20
+ notificationsButtonLabel: 'Notifications',
21
+ notificationsButtonLabelWithCount: (count: number) => `Notifications, ${String(count)} unread`,
22
+ userMenuButtonLabel: (name: string) => `Account menu for ${name}`,
23
+ });
24
+
25
+ const DEFAULT_USER_MENU_POSITIONING = Object.freeze({ placement: 'bottom-end' } as const);
26
+
27
+ const DsTopBarNavigationRoot = ({ className, ...rest }: DsTopBarNavigationProps) => (
28
+ <div {...rest} className={classNames(styles.root, className)} />
29
+ );
30
+
31
+ const Logo = ({
32
+ className,
33
+ logo,
34
+ wordmark,
35
+ href,
36
+ locale,
37
+ onLogoClick,
38
+ onAppsClick,
39
+ appsMenu,
40
+ ...rest
41
+ }: DsTopBarNavigationLogoProps) => {
42
+ const lockup = (
43
+ <>
44
+ {logo ? <span className={styles.logoGlyph}>{logo}</span> : null}
45
+ {wordmark ? <span className={styles.logoWordmark}>{wordmark}</span> : null}
46
+ </>
47
+ );
48
+
49
+ return (
50
+ <div {...rest} className={classNames(styles.logo, className)}>
51
+ {href ? (
52
+ <a className={styles.logoLockup} href={href} aria-label={locale?.homeLinkLabel} onClick={onLogoClick}>
53
+ {lockup}
54
+ </a>
55
+ ) : (
56
+ <span className={styles.logoLockup}>{lockup}</span>
57
+ )}
58
+
59
+ {appsMenu}
60
+
61
+ {!appsMenu && onAppsClick ? (
62
+ <DsButtonV3
63
+ variant="tertiary"
64
+ color="light"
65
+ size="small"
66
+ icon="apps"
67
+ aria-label={locale?.appsButtonLabel ?? DEFAULT_LOCALE.appsButtonLabel}
68
+ onClick={onAppsClick}
69
+ />
70
+ ) : null}
71
+ </div>
72
+ );
73
+ };
74
+
75
+ const Breadcrumb = ({ className, ...rest }: DsTopBarNavigationBreadcrumbProps) => (
76
+ <div {...rest} className={classNames(styles.breadcrumb, className)} />
77
+ );
78
+
79
+ /** Reserved zone between the breadcrumb trail and the actions. Empty by design today. */
80
+ const Center = ({ className, ...rest }: DsTopBarNavigationCenterProps) => (
81
+ <div {...rest} className={classNames(styles.center, className)} />
82
+ );
83
+
84
+ const Actions = ({ className, ...rest }: DsTopBarNavigationActionsProps) => (
85
+ <div {...rest} className={classNames(styles.actions, className)} />
86
+ );
87
+
88
+ const Notifications = ({ count = 0, locale, ...rest }: DsTopBarNavigationNotificationsProps) => {
89
+ const hasCount = count > 0;
90
+ const label = hasCount
91
+ ? (locale?.notificationsButtonLabelWithCount ?? DEFAULT_LOCALE.notificationsButtonLabelWithCount)(count)
92
+ : (locale?.notificationsButtonLabel ?? DEFAULT_LOCALE.notificationsButtonLabel);
93
+
94
+ return (
95
+ <DsButtonV3 {...rest} variant="tertiary" size="small" icon="notifications_active" aria-label={label}>
96
+ {/*
97
+ Always rendered so DsButtonV3 never switches to its icon-only geometry,
98
+ which would re-pad the bell when the count clears.
99
+ */}
100
+ <span className={styles.notificationsBadge} aria-hidden data-empty={hasCount ? undefined : ''}>
101
+ {count > notificationCountCap ? `${String(notificationCountCap)}+` : count}
102
+ </span>
103
+ </DsButtonV3>
104
+ );
105
+ };
106
+
107
+ const UserMenu = ({
108
+ className,
109
+ name,
110
+ src,
111
+ children,
112
+ open,
113
+ positioning,
114
+ locale,
115
+ onOpenChange,
116
+ onSelect,
117
+ ...rest
118
+ }: DsTopBarNavigationUserMenuProps) => (
119
+ <DsDropdownMenu.Root
120
+ open={open}
121
+ // Merged, not replaced: a caller who only overrides `gutter` keeps `bottom-end`, which is
122
+ // what stops the menu from spilling past the right edge of the bar.
123
+ positioning={{ ...DEFAULT_USER_MENU_POSITIONING, ...positioning }}
124
+ onOpenChange={onOpenChange}
125
+ onSelect={onSelect}
126
+ >
127
+ <DsDropdownMenu.Trigger asChild>
128
+ <button
129
+ {...rest}
130
+ type="button"
131
+ className={classNames(styles.userMenuTrigger, className)}
132
+ aria-label={(locale?.userMenuButtonLabel ?? DEFAULT_LOCALE.userMenuButtonLabel)(name)}
133
+ >
134
+ <DsAvatar className={styles.userMenuAvatar} name={name} src={src} size="regular" type="circle" />
135
+ <span className={styles.userMenuCaret}>
136
+ <DsIcon icon="arrow_drop_down" size="small" aria-hidden />
137
+ </span>
138
+ </button>
139
+ </DsDropdownMenu.Trigger>
140
+ <DsDropdownMenu.Content>{children}</DsDropdownMenu.Content>
141
+ </DsDropdownMenu.Root>
142
+ );
143
+
144
+ DsTopBarNavigationRoot.displayName = 'DsTopBarNavigation';
145
+ Logo.displayName = 'DsTopBarNavigation.Logo';
146
+ Breadcrumb.displayName = 'DsTopBarNavigation.Breadcrumb';
147
+ Center.displayName = 'DsTopBarNavigation.Center';
148
+ Actions.displayName = 'DsTopBarNavigation.Actions';
149
+ Notifications.displayName = 'DsTopBarNavigation.Notifications';
150
+ UserMenu.displayName = 'DsTopBarNavigation.UserMenu';
151
+
152
+ const DsTopBarNavigation = Object.assign(DsTopBarNavigationRoot, {
153
+ Logo,
154
+ Breadcrumb,
155
+ Center,
156
+ Actions,
157
+ Notifications,
158
+ UserMenu,
159
+ });
160
+
161
+ export default DsTopBarNavigation;