@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,117 @@
1
+ import type { ComponentPropsWithRef, MouseEvent, ReactNode } from 'react';
2
+ import type { DsDropdownMenuPositioning } from '../ds-dropdown-menu';
3
+
4
+ /** Count above which the notification badge collapses to `<cap>+`. */
5
+ export const notificationCountCap = 99;
6
+
7
+ export type DsTopBarNavigationProps = ComponentPropsWithRef<'div'>;
8
+
9
+ export interface DsTopBarNavigationLogoProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
10
+ /**
11
+ * Brand glyph rendered at 32px before the wordmark. Kept as a slot, so the bar stays
12
+ * tenant-neutral — no brand asset ships with the design system.
13
+ */
14
+ logo?: ReactNode;
15
+ /**
16
+ * Brand wordmark rendered beside the glyph. Styled with the heading font; pass a node
17
+ * when the mark needs custom kerning.
18
+ */
19
+ wordmark?: ReactNode;
20
+ /**
21
+ * Turns the glyph and wordmark into a link to the platform home.
22
+ */
23
+ href?: string;
24
+ locale?: {
25
+ /**
26
+ * Accessible name for the logo link. Only applied when `href` is set; useful when the
27
+ * wordmark is an image rather than text.
28
+ */
29
+ homeLinkLabel?: string;
30
+ /**
31
+ * @default 'Apps'
32
+ */
33
+ appsButtonLabel?: string;
34
+ };
35
+ /**
36
+ * Fires on the logo link itself, not the surrounding zone. Call `preventDefault` here to
37
+ * hand navigation to a client-side router instead of letting the browser reload the document.
38
+ */
39
+ onLogoClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
40
+ /**
41
+ * Renders the app-switcher button. Omit to hide the button entirely. Ignored when
42
+ * `appsMenu` is set.
43
+ */
44
+ onAppsClick?: () => void;
45
+ /**
46
+ * Takes over the app-switcher slot with your own control — pass a `DsMainMenu` to open the
47
+ * app grid from the brand zone. The node is rendered as-is, so it owns its own trigger,
48
+ * open state, and positioning.
49
+ */
50
+ appsMenu?: ReactNode;
51
+ }
52
+
53
+ export type DsTopBarNavigationBreadcrumbProps = ComponentPropsWithRef<'div'>;
54
+
55
+ export type DsTopBarNavigationCenterProps = ComponentPropsWithRef<'div'>;
56
+
57
+ export type DsTopBarNavigationActionsProps = ComponentPropsWithRef<'div'>;
58
+
59
+ export interface DsTopBarNavigationNotificationsProps extends Omit<
60
+ ComponentPropsWithRef<'button'>,
61
+ 'children' | 'aria-label' | 'color'
62
+ > {
63
+ /**
64
+ * Unread count. `0` or omitted renders the bell with no badge; anything above
65
+ * `notificationCountCap` collapses to a capped label.
66
+ */
67
+ count?: number;
68
+ locale?: {
69
+ /**
70
+ * Accessible name when there are no unread notifications.
71
+ * @default 'Notifications'
72
+ */
73
+ notificationsButtonLabel?: string;
74
+ /**
75
+ * Accessible name when unread notifications exist. Receives the uncapped count.
76
+ * @default (count) => `Notifications, ${count} unread`
77
+ */
78
+ notificationsButtonLabelWithCount?: (count: number) => string;
79
+ };
80
+ }
81
+
82
+ export interface DsTopBarNavigationUserMenuProps extends Omit<
83
+ ComponentPropsWithRef<'button'>,
84
+ 'children' | 'aria-label' | 'onSelect'
85
+ > {
86
+ /**
87
+ * Drives the avatar initials and its accessible name.
88
+ */
89
+ name: string;
90
+ /**
91
+ * Avatar photo URL. Omit, or let it fail to load, to fall back to initials.
92
+ */
93
+ src?: string;
94
+ /**
95
+ * Menu entries — `DsDropdownMenu.Item`, `.Separator`, `.ItemGroup` and friends.
96
+ */
97
+ children?: ReactNode;
98
+ /**
99
+ * Open state for controlled usage.
100
+ */
101
+ open?: boolean;
102
+ /**
103
+ * Placement and offset of the menu. Defaults to `bottom-end` so the menu stays inside the
104
+ * viewport when the trigger sits against the right edge of the bar.
105
+ */
106
+ positioning?: DsDropdownMenuPositioning;
107
+ locale?: {
108
+ /**
109
+ * Accessible name for the trigger. Receives `name`; the default distinguishes the
110
+ * control from the avatar's own name tooltip.
111
+ * @default (name) => `Account menu for ${name}`
112
+ */
113
+ userMenuButtonLabel?: (name: string) => string;
114
+ };
115
+ onOpenChange?: (open: boolean) => void;
116
+ onSelect?: (value: string) => void;
117
+ }
@@ -0,0 +1,2 @@
1
+ export { default as DsTopBarNavigation } from './ds-top-bar-navigation';
2
+ export * from './ds-top-bar-navigation.types';
@@ -79,14 +79,14 @@ const DsTreeTree = ({ className, style, children }: DsTreeTreeProps) => (
79
79
  </TreeView.Tree>
80
80
  );
81
81
 
82
- const DsTreeBranch = ({ className, style, children }: DsTreeBranchProps) => (
83
- <TreeView.Branch className={classNames(styles.branch, className)} style={style}>
82
+ const DsTreeBranch = ({ className, style, children, ...rest }: DsTreeBranchProps) => (
83
+ <TreeView.Branch {...rest} className={classNames(styles.branch, className)} style={style}>
84
84
  {children}
85
85
  </TreeView.Branch>
86
86
  );
87
87
 
88
- const DsTreeBranchControl = ({ className, style, children }: DsTreeBranchControlProps) => (
89
- <TreeView.BranchControl className={classNames(styles.branchControl, className)} style={style}>
88
+ const DsTreeBranchControl = ({ className, style, children, ...rest }: DsTreeBranchControlProps) => (
89
+ <TreeView.BranchControl {...rest} className={classNames(styles.branchControl, className)} style={style}>
90
90
  {children}
91
91
  </TreeView.BranchControl>
92
92
  );
@@ -97,8 +97,8 @@ const DsTreeBranchIndicator = ({ className, style, children }: DsTreeBranchIndic
97
97
  </TreeView.BranchIndicator>
98
98
  );
99
99
 
100
- const DsTreeBranchText = ({ className, style, children }: DsTreeBranchTextProps) => (
101
- <TreeView.BranchText className={classNames(styles.branchText, className)} style={style}>
100
+ const DsTreeBranchText = ({ className, style, children, ...rest }: DsTreeBranchTextProps) => (
101
+ <TreeView.BranchText {...rest} className={classNames(styles.branchText, className)} style={style}>
102
102
  {children}
103
103
  </TreeView.BranchText>
104
104
  );
@@ -113,14 +113,14 @@ const DsTreeBranchIndentGuide = ({ className, style }: DsTreeBranchIndentGuidePr
113
113
  <TreeView.BranchIndentGuide className={classNames(styles.branchIndentGuide, className)} style={style} />
114
114
  );
115
115
 
116
- const DsTreeItem = ({ className, style, children, onClick }: DsTreeItemProps) => (
117
- <TreeView.Item className={classNames(styles.item, className)} style={style} onClick={onClick}>
116
+ const DsTreeItem = ({ className, style, children, onClick, ...rest }: DsTreeItemProps) => (
117
+ <TreeView.Item {...rest} className={classNames(styles.item, className)} style={style} onClick={onClick}>
118
118
  {children}
119
119
  </TreeView.Item>
120
120
  );
121
121
 
122
- const DsTreeItemText = ({ className, style, children }: DsTreeItemTextProps) => (
123
- <TreeView.ItemText className={classNames(styles.itemText, className)} style={style}>
122
+ const DsTreeItemText = ({ className, style, children, ...rest }: DsTreeItemTextProps) => (
123
+ <TreeView.ItemText {...rest} className={classNames(styles.itemText, className)} style={style}>
124
124
  {children}
125
125
  </TreeView.ItemText>
126
126
  );
@@ -1,4 +1,14 @@
1
- import type { CSSProperties, MouseEvent, ReactNode, Ref } from 'react';
1
+ import type {
2
+ AriaAttributes,
3
+ CSSProperties,
4
+ FocusEventHandler,
5
+ KeyboardEventHandler,
6
+ MouseEvent,
7
+ MouseEventHandler,
8
+ PointerEventHandler,
9
+ ReactNode,
10
+ Ref,
11
+ } from 'react';
2
12
  import type { TreeView as ArkTreeView } from '@ark-ui/react/tree-view';
3
13
  import type { IconType } from '../ds-icon';
4
14
  import type { FilterStatus } from '../ds-filter-status-icon';
@@ -96,7 +106,7 @@ export interface DsTreeRootProps<T extends DsTreeNode = DsTreeNode> extends DsTr
96
106
  /**
97
107
  * Whether clicking anywhere on a branch row toggles its expansion in addition
98
108
  * to clicking the branch indicator.
99
- * @default false
109
+ * @default true
100
110
  */
101
111
  expandOnClick?: boolean;
102
112
 
@@ -148,26 +158,49 @@ export interface DsTreeRootProps<T extends DsTreeNode = DsTreeNode> extends DsTr
148
158
 
149
159
  export type DsTreeTreeProps = DsTreeBasePropsWithChildren;
150
160
 
151
- export type DsTreeBranchProps = DsTreeBasePropsWithChildren;
161
+ /**
162
+ * Props a wrapping `asChild` trigger (`DsPopover.Trigger`, `DsTooltip`) injects onto
163
+ * the element it wraps. Row parts forward these so wrapping a row actually wires up
164
+ * instead of silently doing nothing.
165
+ */
166
+ export interface DsTreeRowTriggerProps<T extends HTMLElement = HTMLElement> {
167
+ id?: string;
168
+ ref?: Ref<T>;
169
+ tabIndex?: number;
170
+ 'aria-haspopup'?: AriaAttributes['aria-haspopup'];
171
+ 'aria-expanded'?: AriaAttributes['aria-expanded'];
172
+ 'aria-controls'?: string;
173
+ 'data-state'?: string;
174
+ onClick?: MouseEventHandler<T>;
175
+ onPointerDown?: PointerEventHandler<T>;
176
+ onPointerEnter?: PointerEventHandler<T>;
177
+ onPointerLeave?: PointerEventHandler<T>;
178
+ onFocus?: FocusEventHandler<T>;
179
+ onBlur?: FocusEventHandler<T>;
180
+ onKeyDown?: KeyboardEventHandler<T>;
181
+ }
182
+
183
+ export type DsTreeBranchProps = DsTreeBasePropsWithChildren & DsTreeRowTriggerProps<HTMLDivElement>;
152
184
 
153
- export type DsTreeBranchControlProps = DsTreeBasePropsWithChildren;
185
+ export type DsTreeBranchControlProps = DsTreeBasePropsWithChildren & DsTreeRowTriggerProps<HTMLDivElement>;
154
186
 
155
187
  export type DsTreeBranchIndicatorProps = DsTreeBasePropsWithChildren;
156
188
 
157
- export type DsTreeBranchTextProps = DsTreeBasePropsWithChildren;
189
+ export type DsTreeBranchTextProps = DsTreeBasePropsWithChildren & DsTreeRowTriggerProps<HTMLSpanElement>;
158
190
 
159
191
  export type DsTreeBranchContentProps = DsTreeBasePropsWithChildren;
160
192
 
161
193
  export type DsTreeBranchIndentGuideProps = DsTreeBaseProps;
162
194
 
163
- export interface DsTreeItemProps extends DsTreeBasePropsWithChildren {
195
+ export interface DsTreeItemProps
196
+ extends DsTreeBasePropsWithChildren, Omit<DsTreeRowTriggerProps<HTMLDivElement>, 'onClick'> {
164
197
  /**
165
198
  * Called when the leaf item is clicked. Receives the native mouse event.
166
199
  */
167
200
  onClick?: (event: MouseEvent<HTMLDivElement>) => void;
168
201
  }
169
202
 
170
- export type DsTreeItemTextProps = DsTreeBasePropsWithChildren;
203
+ export type DsTreeItemTextProps = DsTreeBasePropsWithChildren & DsTreeRowTriggerProps<HTMLSpanElement>;
171
204
 
172
205
  export type DsTreeItemIndicatorProps = DsTreeBaseProps;
173
206
 
package/src/index.ts CHANGED
@@ -2,7 +2,9 @@ export * from './components/ds-alert-banner';
2
2
  export * from './components/ds-autocomplete';
3
3
  export * from './components/ds-avatar';
4
4
  export * from './components/ds-avatar-group';
5
+ export * from './components/ds-bot-button';
5
6
  export * from './components/ds-breadcrumb';
7
+ export * from './components/ds-bulk-actions';
6
8
  export * from './components/ds-button';
7
9
  export * from './components/ds-button-v3';
8
10
  export * from './components/ds-card';
@@ -11,6 +13,7 @@ export * from './components/ds-checkbox';
11
13
  export * from './components/ds-checkbox-group';
12
14
  export * from './components/ds-chip';
13
15
  export * from './components/ds-chip-group';
16
+ export * from './components/ds-code-input';
14
17
  export * from './components/ds-comment-bubble';
15
18
  export * from './components/ds-comment-card';
16
19
  export * from './components/ds-comment-indicator';
@@ -23,18 +26,22 @@ export * from './components/ds-dialog';
23
26
  export * from './components/ds-divider';
24
27
  export * from './components/ds-drawer';
25
28
  export * from './components/ds-dropdown-menu';
29
+ export * from './components/ds-empty-state';
26
30
  export * from './components/ds-expandable-text-input';
27
31
  export * from './components/ds-file-upload';
28
32
  export * from './components/ds-filter-status-icon';
29
33
  export * from './components/ds-form-control';
30
34
  export * from './components/ds-grid';
31
35
  export * from './components/ds-icon';
36
+ export * from './components/ds-illustration';
32
37
  export * from './components/ds-key-value-pair';
33
38
  export * from './components/ds-loader';
39
+ export * from './components/ds-main-menu';
34
40
  export * from './components/ds-modal';
35
41
  export * from './components/ds-number-input';
36
42
  export * from './components/ds-panel';
37
43
  export * from './components/ds-password-input';
44
+ export * from './components/ds-pin-toggle';
38
45
  export * from './components/ds-popover';
39
46
  export * from './components/ds-progress-arc';
40
47
  export * from './components/ds-progress-donut';
@@ -64,6 +71,7 @@ export * from './components/ds-time-picker';
64
71
  export * from './components/ds-toast';
65
72
  export * from './components/ds-toggle';
66
73
  export * from './components/ds-tooltip';
74
+ export * from './components/ds-top-bar-navigation';
67
75
  export * from './components/ds-tree';
68
76
  export * from './components/ds-typography';
69
77
  export * from './components/ds-user-card';
@@ -0,0 +1,35 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ export const useIsHorizontallyOverflowing = <T extends HTMLElement = HTMLElement>(content?: string) => {
4
+ const [element, setElement] = useState<T | null>(null);
5
+ const [measuredOverflow, setMeasuredOverflow] = useState(false);
6
+
7
+ useEffect(() => {
8
+ if (!element || !content) {
9
+ return;
10
+ }
11
+
12
+ const measure = () => {
13
+ setMeasuredOverflow(element.scrollWidth > element.clientWidth);
14
+ };
15
+
16
+ measure();
17
+
18
+ const resizeObserver = new ResizeObserver(measure);
19
+ resizeObserver.observe(element);
20
+
21
+ // document.fonts is missing in jsdom; `'fonts' in document` (not optional chaining) satisfies TS.
22
+ const fonts = 'fonts' in document ? document.fonts : undefined;
23
+ fonts?.addEventListener('loadingdone', measure);
24
+
25
+ return () => {
26
+ resizeObserver.disconnect();
27
+ fonts?.removeEventListener('loadingdone', measure);
28
+ };
29
+ }, [content, element]);
30
+
31
+ return {
32
+ ref: setElement,
33
+ isOverflowing: Boolean(content) && measuredOverflow,
34
+ };
35
+ };
@@ -1,31 +0,0 @@
1
- import { useLayoutEffect, useRef, useState } from 'react';
2
-
3
- export const useIsOverflowing = <T extends HTMLElement = HTMLElement>(text: string | undefined) => {
4
- const ref = useRef<T>(null);
5
- const [isOverflowing, setIsOverflowing] = useState(false);
6
-
7
- useLayoutEffect(() => {
8
- const element = ref.current;
9
- if (!element) {
10
- return;
11
- }
12
-
13
- const measure = () => setIsOverflowing(element.scrollWidth > element.clientWidth);
14
- measure();
15
-
16
- const observer = new ResizeObserver(measure);
17
- observer.observe(element);
18
-
19
- const frame = requestAnimationFrame(measure);
20
- document.fonts.ready.then(measure).catch(() => undefined);
21
- document.fonts.addEventListener('loadingdone', measure);
22
-
23
- return () => {
24
- cancelAnimationFrame(frame);
25
- observer.disconnect();
26
- document.fonts.removeEventListener('loadingdone', measure);
27
- };
28
- }, [text]);
29
-
30
- return { ref, isOverflowing };
31
- };
@@ -1,112 +0,0 @@
1
- @use '../../../../styles/typography';
2
-
3
- .bulkActionsContainer {
4
- position: absolute;
5
- bottom: 20px;
6
- left: 50%;
7
- transform: translateX(-50%);
8
- background-color: var(--color-dap-gray-050);
9
- border-radius: 8px;
10
- box-shadow: 0 4px 12px #0445cc66;
11
- z-index: 1;
12
- display: flex;
13
- align-items: center;
14
- border-radius: 8px;
15
- overflow: hidden;
16
- animation-duration: 0.3s;
17
- animation-timing-function: ease-out;
18
- animation-fill-mode: forwards;
19
-
20
- &.entering {
21
- animation-name: slideUpFadeIn;
22
- }
23
-
24
- &.exiting {
25
- animation-name: slideDownFadeOut;
26
- }
27
- }
28
-
29
- .bulkActionsContent {
30
- display: flex;
31
- align-items: center;
32
- padding-right: 6px;
33
- padding-left: 6px;
34
- }
35
-
36
- .selectedCountContainer {
37
- background-color: var(--color-dap-blue-600);
38
- display: flex;
39
- align-items: center;
40
- padding: 6px 22px;
41
- }
42
-
43
- .selectedCountBadge {
44
- color: var(--color-dap-gray-050);
45
- margin: 0;
46
- }
47
-
48
- .bulkActionsInfo {
49
- color: var(--color-dap-gray-600);
50
- text-wrap: nowrap;
51
- padding-left: 8px;
52
- padding-right: 56px;
53
- }
54
-
55
- .bulkActionsActions {
56
- display: flex;
57
- align-items: center;
58
- gap: 8px;
59
-
60
- > .actionButton {
61
- display: flex;
62
- flex-direction: column;
63
- align-items: center;
64
- justify-content: center;
65
- gap: var(--3xs);
66
- border-right: 1px solid var(--color-dap-gray-400);
67
- width: 68px;
68
- height: 48px;
69
- border-radius: 0;
70
- }
71
-
72
- > .actionButton:first-child {
73
- border-left: 1px solid var(--color-dap-gray-400);
74
- }
75
- }
76
-
77
- .escapeButtonContent {
78
- display: flex;
79
- flex-direction: column;
80
- justify-content: center;
81
- align-items: center;
82
- color: var(--color-dap-gray-600);
83
- gap: 2px !important;
84
- width: 36px;
85
- padding-left: 4px;
86
-
87
- &:hover {
88
- color: var(--color-dap-gray-500);
89
- }
90
- }
91
-
92
- @keyframes slideUpFadeIn {
93
- 0% {
94
- opacity: 0;
95
- transform: translate(-50%, 100%);
96
- }
97
- 100% {
98
- opacity: 1;
99
- transform: translate(-50%, 0);
100
- }
101
- }
102
-
103
- @keyframes slideDownFadeOut {
104
- 0% {
105
- opacity: 1;
106
- transform: translate(-50%, 0);
107
- }
108
- 100% {
109
- opacity: 0;
110
- transform: translate(-50%, 100%);
111
- }
112
- }
@@ -1,67 +0,0 @@
1
- import type React from 'react';
2
- import { useEffect, useState } from 'react';
3
- import classnames from 'classnames';
4
- import { DsButton } from '../../../ds-button';
5
- import { DsIcon } from '../../../ds-icon';
6
- import styles from './ds-table-bulk-actions.module.scss';
7
- import type { BulkActionsProps } from './ds-table-bulk-actions.types';
8
- import { DsTypography } from '../../../ds-typography';
9
-
10
- const DsTableBulkActions: React.FC<BulkActionsProps> = ({ numSelectedRows, actions, onClearSelection }) => {
11
- const [isRendered, setIsRendered] = useState(false);
12
- const [animationClass, setAnimationClass] = useState('');
13
-
14
- useEffect(() => {
15
- if (numSelectedRows > 0) {
16
- setIsRendered(true);
17
- setAnimationClass(styles.entering);
18
- } else if (isRendered) {
19
- setAnimationClass(styles.exiting);
20
- const timer = setTimeout(() => {
21
- setIsRendered(false);
22
- setAnimationClass('');
23
- }, 300);
24
- return () => clearTimeout(timer);
25
- }
26
- }, [numSelectedRows, isRendered]);
27
-
28
- if (!isRendered) {
29
- return null;
30
- }
31
-
32
- return (
33
- <div className={classnames(styles.bulkActionsContainer, animationClass)}>
34
- <div className={styles.selectedCountContainer}>
35
- <DsTypography variant="heading1" className={styles.selectedCountBadge}>
36
- {numSelectedRows}
37
- </DsTypography>
38
- </div>
39
- <div className={styles.bulkActionsContent}>
40
- <DsTypography variant="body-md-semi-bold" className={styles.bulkActionsInfo}>
41
- Items selected
42
- </DsTypography>
43
-
44
- <div className={styles.bulkActionsActions}>
45
- {actions.map((action, index) => (
46
- <button key={index} type="button" className={styles.actionButton} onClick={action.onClick}>
47
- <DsIcon icon={action.icon} />
48
- <DsTypography variant="body-xs-md">{action.label}</DsTypography>
49
- </button>
50
- ))}
51
- </div>
52
-
53
- <DsButton
54
- variant="borderless"
55
- size="small"
56
- color="neutral-2"
57
- contentClassName={styles.escapeButtonContent}
58
- onClick={onClearSelection}
59
- >
60
- <DsIcon icon="close" />
61
- </DsButton>
62
- </div>
63
- </div>
64
- );
65
- };
66
-
67
- export default DsTableBulkActions;
@@ -1,41 +0,0 @@
1
- import type { IconType } from '../../../ds-icon';
2
-
3
- /**
4
- * Represents a bulk action that can be performed on selected table rows
5
- */
6
- export interface Action {
7
- /**
8
- * Icon to be displayed for the action
9
- */
10
- icon: IconType;
11
-
12
- /**
13
- * Label text for the action
14
- */
15
- label: string;
16
-
17
- /**
18
- * Function to be called when the action is clicked
19
- */
20
- onClick: () => void;
21
- }
22
-
23
- /**
24
- * Props for the bulk actions component
25
- */
26
- export interface BulkActionsProps {
27
- /**
28
- * Number of rows currently selected in the table
29
- */
30
- numSelectedRows: number;
31
-
32
- /**
33
- * Array of actions to be displayed in the bulk actions bar
34
- */
35
- actions: Action[];
36
-
37
- /**
38
- * Function to be called when the selection should be cleared
39
- */
40
- onClearSelection: () => void;
41
- }
@@ -1,2 +0,0 @@
1
- export { default as DsTableBulkActions } from './ds-table-bulk-actions';
2
- export * from './ds-table-bulk-actions.types';