@drivenets/design-system 0.0.1

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 (242) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +201 -0
  3. package/dist/index.cjs +5394 -0
  4. package/dist/index.css +1 -0
  5. package/dist/index.d.cts +9157 -0
  6. package/dist/index.d.cts.map +1 -0
  7. package/dist/index.d.ts +9157 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +5335 -0
  10. package/dist/index.js.map +1 -0
  11. package/package.json +104 -0
  12. package/src/components/ds-alert-banner/ds-alert-banner.module.scss +116 -0
  13. package/src/components/ds-alert-banner/ds-alert-banner.tsx +115 -0
  14. package/src/components/ds-alert-banner/ds-alert-banner.types.tsx +47 -0
  15. package/src/components/ds-alert-banner/index.tsx +2 -0
  16. package/src/components/ds-breadcrumb/ds-breadcrumb.module.scss +99 -0
  17. package/src/components/ds-breadcrumb/ds-breadcrumb.tsx +94 -0
  18. package/src/components/ds-breadcrumb/ds-breadcrumb.types.tsx +32 -0
  19. package/src/components/ds-breadcrumb/index.tsx +2 -0
  20. package/src/components/ds-button/ds-button.tsx +12 -0
  21. package/src/components/ds-button/ds-button.types.ts +6 -0
  22. package/src/components/ds-button/index.ts +2 -0
  23. package/src/components/ds-button/versions/ds-button-legacy/ds-button-legacy.module.scss +257 -0
  24. package/src/components/ds-button/versions/ds-button-legacy/ds-button-legacy.tsx +34 -0
  25. package/src/components/ds-button/versions/ds-button-legacy/ds-button-legacy.types.ts +41 -0
  26. package/src/components/ds-button/versions/ds-button-legacy/index.ts +2 -0
  27. package/src/components/ds-button/versions/ds-button-new/ds-button-new.module.scss +580 -0
  28. package/src/components/ds-button/versions/ds-button-new/ds-button-new.tsx +49 -0
  29. package/src/components/ds-button/versions/ds-button-new/ds-button-new.types.ts +41 -0
  30. package/src/components/ds-button/versions/ds-button-new/index.ts +2 -0
  31. package/src/components/ds-checkbox/ds-checkbox.module.scss +130 -0
  32. package/src/components/ds-checkbox/ds-checkbox.tsx +55 -0
  33. package/src/components/ds-checkbox/ds-checkbox.types.tsx +27 -0
  34. package/src/components/ds-checkbox/index.tsx +2 -0
  35. package/src/components/ds-chip/ds-chip.module.scss +71 -0
  36. package/src/components/ds-chip/ds-chip.tsx +73 -0
  37. package/src/components/ds-chip/ds-chip.types.tsx +46 -0
  38. package/src/components/ds-chip/index.tsx +2 -0
  39. package/src/components/ds-chip-group/ds-chip-group.module.scss +59 -0
  40. package/src/components/ds-chip-group/ds-chip-group.tsx +122 -0
  41. package/src/components/ds-chip-group/ds-chip-group.types.ts +52 -0
  42. package/src/components/ds-chip-group/hooks/use-chip-row-calculation.ts +76 -0
  43. package/src/components/ds-chip-group/index.ts +2 -0
  44. package/src/components/ds-confirmation/ds-confirmation.module.scss +58 -0
  45. package/src/components/ds-confirmation/ds-confirmation.tsx +121 -0
  46. package/src/components/ds-confirmation/ds-confirmation.types.tsx +28 -0
  47. package/src/components/ds-confirmation/index.ts +2 -0
  48. package/src/components/ds-dialog/ds-dialog.module.scss +50 -0
  49. package/src/components/ds-dialog/ds-dialog.tsx +70 -0
  50. package/src/components/ds-dialog/ds-dialog.types.tsx +48 -0
  51. package/src/components/ds-dialog/index.tsx +2 -0
  52. package/src/components/ds-drawer/ds-drawer.module.scss +212 -0
  53. package/src/components/ds-drawer/ds-drawer.tsx +160 -0
  54. package/src/components/ds-drawer/ds-drawer.types.tsx +54 -0
  55. package/src/components/ds-drawer/index.ts +2 -0
  56. package/src/components/ds-dropdown-menu/ds-dropdown-menu.module.scss +123 -0
  57. package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +396 -0
  58. package/src/components/ds-dropdown-menu/ds-dropdown-menu.types.tsx +262 -0
  59. package/src/components/ds-dropdown-menu/index.tsx +2 -0
  60. package/src/components/ds-expandable-text-input/ds-expandable-text-input.module.scss +70 -0
  61. package/src/components/ds-expandable-text-input/ds-expandable-text-input.tsx +106 -0
  62. package/src/components/ds-expandable-text-input/ds-expandable-text-input.types.tsx +19 -0
  63. package/src/components/ds-expandable-text-input/index.ts +2 -0
  64. package/src/components/ds-file-upload/components/file-upload/file-upload.module.scss +90 -0
  65. package/src/components/ds-file-upload/components/file-upload/file-upload.tsx +106 -0
  66. package/src/components/ds-file-upload/components/file-upload/file-upload.types.tsx +94 -0
  67. package/src/components/ds-file-upload/components/file-upload/index.ts +2 -0
  68. package/src/components/ds-file-upload/components/file-upload-item/file-upload-item.module.scss +125 -0
  69. package/src/components/ds-file-upload/components/file-upload-item/file-upload-item.tsx +143 -0
  70. package/src/components/ds-file-upload/components/file-upload-item/file-upload-item.types.tsx +26 -0
  71. package/src/components/ds-file-upload/components/file-upload-item/index.ts +2 -0
  72. package/src/components/ds-file-upload/ds-file-upload-api.types.ts +38 -0
  73. package/src/components/ds-file-upload/ds-file-upload.tsx +46 -0
  74. package/src/components/ds-file-upload/ds-file-upload.types.tsx +54 -0
  75. package/src/components/ds-file-upload/errors/file-upload-errors.ts +27 -0
  76. package/src/components/ds-file-upload/hooks/index.ts +2 -0
  77. package/src/components/ds-file-upload/hooks/use-file-upload.ts +350 -0
  78. package/src/components/ds-file-upload/index.ts +7 -0
  79. package/src/components/ds-file-upload/types/accept-types.ts +106 -0
  80. package/src/components/ds-file-upload/utils/accept-utils.ts +25 -0
  81. package/src/components/ds-file-upload/utils/constants.ts +21 -0
  82. package/src/components/ds-file-upload/utils/file-factory.ts +18 -0
  83. package/src/components/ds-file-upload/utils/format-file-size.ts +15 -0
  84. package/src/components/ds-file-upload/utils/generate-helper-text.ts +39 -0
  85. package/src/components/ds-file-upload/utils/get-error-message.ts +17 -0
  86. package/src/components/ds-file-upload/utils/is-file-equal.ts +8 -0
  87. package/src/components/ds-form-control/ds-form-control.module.scss +135 -0
  88. package/src/components/ds-form-control/ds-form-control.tsx +94 -0
  89. package/src/components/ds-form-control/ds-form-control.types.tsx +58 -0
  90. package/src/components/ds-form-control/index.tsx +2 -0
  91. package/src/components/ds-grid/ds-grid.module.scss +0 -0
  92. package/src/components/ds-grid/ds-grid.tsx +43 -0
  93. package/src/components/ds-grid/ds-grid.types.ts +55 -0
  94. package/src/components/ds-grid/index.ts +2 -0
  95. package/src/components/ds-icon/ds-icon.module.scss +25 -0
  96. package/src/components/ds-icon/ds-icon.tsx +33 -0
  97. package/src/components/ds-icon/ds-icon.types.ts +53 -0
  98. package/src/components/ds-icon/index.ts +2 -0
  99. package/src/components/ds-icon/material-icons.ts +6203 -0
  100. package/src/components/ds-modal/ds-modal.module.scss +100 -0
  101. package/src/components/ds-modal/ds-modal.tsx +136 -0
  102. package/src/components/ds-modal/ds-modal.types.tsx +44 -0
  103. package/src/components/ds-modal/index.tsx +2 -0
  104. package/src/components/ds-number-input/ds-number-input.module.scss +15 -0
  105. package/src/components/ds-number-input/ds-number-input.tsx +74 -0
  106. package/src/components/ds-number-input/ds-number-input.types.tsx +76 -0
  107. package/src/components/ds-number-input/index.tsx +2 -0
  108. package/src/components/ds-panel/ds-panel.module.scss +95 -0
  109. package/src/components/ds-panel/ds-panel.tsx +46 -0
  110. package/src/components/ds-panel/ds-panel.types.ts +17 -0
  111. package/src/components/ds-panel/index.tsx +2 -0
  112. package/src/components/ds-password-input/ds-password-input.module.scss +10 -0
  113. package/src/components/ds-password-input/ds-password-input.tsx +67 -0
  114. package/src/components/ds-password-input/ds-password-input.types.tsx +62 -0
  115. package/src/components/ds-password-input/index.tsx +2 -0
  116. package/src/components/ds-popover/ds-popover.module.scss +23 -0
  117. package/src/components/ds-popover/ds-popover.tsx +33 -0
  118. package/src/components/ds-popover/ds-popover.types.tsx +24 -0
  119. package/src/components/ds-popover/index.tsx +2 -0
  120. package/src/components/ds-radio-group/ds-radio-group.module.scss +138 -0
  121. package/src/components/ds-radio-group/ds-radio-group.tsx +115 -0
  122. package/src/components/ds-radio-group/ds-radio-group.types.tsx +93 -0
  123. package/src/components/ds-radio-group/index.tsx +2 -0
  124. package/src/components/ds-select/ds-select.module.scss +66 -0
  125. package/src/components/ds-select/ds-select.tsx +239 -0
  126. package/src/components/ds-select/ds-select.types.tsx +80 -0
  127. package/src/components/ds-select/index.tsx +2 -0
  128. package/src/components/ds-select/select-items-chips.tsx +56 -0
  129. package/src/components/ds-smart-tabs/ds-smart-tabs.module.scss +69 -0
  130. package/src/components/ds-smart-tabs/ds-smart-tabs.tsx +113 -0
  131. package/src/components/ds-smart-tabs/ds-smart-tabs.types.tsx +74 -0
  132. package/src/components/ds-smart-tabs/index.tsx +2 -0
  133. package/src/components/ds-spinner/ds-spinner.module.scss +39 -0
  134. package/src/components/ds-spinner/ds-spinner.tsx +51 -0
  135. package/src/components/ds-spinner/ds-spinner.types.tsx +20 -0
  136. package/src/components/ds-spinner/index.tsx +2 -0
  137. package/src/components/ds-status-badge/ds-status-badge.module.scss +79 -0
  138. package/src/components/ds-status-badge/ds-status-badge.tsx +42 -0
  139. package/src/components/ds-status-badge/ds-status-badge.types.tsx +46 -0
  140. package/src/components/ds-status-badge/index.tsx +2 -0
  141. package/src/components/ds-stepper/components/ds-step-content.tsx +32 -0
  142. package/src/components/ds-stepper/components/ds-step-description.tsx +6 -0
  143. package/src/components/ds-stepper/components/ds-step-label.tsx +6 -0
  144. package/src/components/ds-stepper/components/ds-step-next-button.tsx +13 -0
  145. package/src/components/ds-stepper/components/ds-step.tsx +59 -0
  146. package/src/components/ds-stepper/ds-stepper.module.scss +134 -0
  147. package/src/components/ds-stepper/ds-stepper.tsx +34 -0
  148. package/src/components/ds-stepper/ds-stepper.types.ts +12 -0
  149. package/src/components/ds-stepper/hooks/use-stepper.ts +20 -0
  150. package/src/components/ds-stepper/hooks/use-steps.ts +18 -0
  151. package/src/components/ds-stepper/index.tsx +6 -0
  152. package/src/components/ds-system-status/ds-system-status.module.scss +87 -0
  153. package/src/components/ds-system-status/ds-system-status.tsx +33 -0
  154. package/src/components/ds-system-status/ds-system-status.types.tsx +37 -0
  155. package/src/components/ds-system-status/index.tsx +10 -0
  156. package/src/components/ds-table/components/core-table/core-table.module.scss +32 -0
  157. package/src/components/ds-table/components/core-table/core-table.tsx +83 -0
  158. package/src/components/ds-table/components/core-table/index.ts +1 -0
  159. package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +115 -0
  160. package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.tsx +70 -0
  161. package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.types.ts +41 -0
  162. package/src/components/ds-table/components/ds-table-bulk-actions/index.ts +2 -0
  163. package/src/components/ds-table/components/ds-table-cell/ds-table-cell.module.scss +53 -0
  164. package/src/components/ds-table/components/ds-table-cell/ds-table-cell.tsx +95 -0
  165. package/src/components/ds-table/components/ds-table-cell/ds-table-cell.types.ts +67 -0
  166. package/src/components/ds-table/components/ds-table-cell/index.ts +2 -0
  167. package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +81 -0
  168. package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +99 -0
  169. package/src/components/ds-table/components/ds-table-header/ds-table-header.types.ts +11 -0
  170. package/src/components/ds-table/components/ds-table-header/index.ts +2 -0
  171. package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +137 -0
  172. package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +205 -0
  173. package/src/components/ds-table/components/ds-table-row/ds-table-row.types.ts +22 -0
  174. package/src/components/ds-table/components/ds-table-row/index.ts +2 -0
  175. package/src/components/ds-table/context/ds-table-context.tsx +39 -0
  176. package/src/components/ds-table/ds-table.module.scss +60 -0
  177. package/src/components/ds-table/ds-table.tsx +312 -0
  178. package/src/components/ds-table/ds-table.types.ts +377 -0
  179. package/src/components/ds-table/filters/adapters/create-checkbox-filter-adapter.tsx +116 -0
  180. package/src/components/ds-table/filters/adapters/create-dual-range-filter-adapter.tsx +171 -0
  181. package/src/components/ds-table/filters/adapters/create-filter-adapter.ts +131 -0
  182. package/src/components/ds-table/filters/adapters/index.ts +12 -0
  183. package/src/components/ds-table/filters/components/checkbox-filter/checkbox-filter.tsx +43 -0
  184. package/src/components/ds-table/filters/components/checkbox-filter/index.ts +2 -0
  185. package/src/components/ds-table/filters/components/range-filter/index.ts +2 -0
  186. package/src/components/ds-table/filters/components/range-filter/range-filter.module.scss +25 -0
  187. package/src/components/ds-table/filters/components/range-filter/range-filter.tsx +79 -0
  188. package/src/components/ds-table/filters/hooks/index.ts +1 -0
  189. package/src/components/ds-table/filters/hooks/use-table-filters.ts +234 -0
  190. package/src/components/ds-table/filters/index.ts +50 -0
  191. package/src/components/ds-table/filters/types/filter-adapter.types.ts +111 -0
  192. package/src/components/ds-table/hooks/use-drag-and-drop.tsx +107 -0
  193. package/src/components/ds-table/index.ts +4 -0
  194. package/src/components/ds-table/styles/_variables.scss +17 -0
  195. package/src/components/ds-table/styles/shared/ds-table-shared.module.scss +16 -0
  196. package/src/components/ds-table/utils/column-styling.ts +30 -0
  197. package/src/components/ds-table/utils/create-columns-grid-template.ts +23 -0
  198. package/src/components/ds-table/utils/merge-refs.ts +15 -0
  199. package/src/components/ds-table/utils/story-data-generator.ts +91 -0
  200. package/src/components/ds-text-input/ds-text-input.module.scss +27 -0
  201. package/src/components/ds-text-input/ds-text-input.tsx +75 -0
  202. package/src/components/ds-text-input/ds-text-input.types.tsx +110 -0
  203. package/src/components/ds-text-input/index.ts +2 -0
  204. package/src/components/ds-textarea/ds-textarea.module.scss +5 -0
  205. package/src/components/ds-textarea/ds-textarea.tsx +49 -0
  206. package/src/components/ds-textarea/ds-textarea.types.tsx +67 -0
  207. package/src/components/ds-textarea/index.tsx +2 -0
  208. package/src/components/ds-toast/ds-toast-context.tsx +79 -0
  209. package/src/components/ds-toast/ds-toast.module.scss +134 -0
  210. package/src/components/ds-toast/ds-toast.tsx +54 -0
  211. package/src/components/ds-toast/ds-toast.types.tsx +53 -0
  212. package/src/components/ds-toast/index.ts +3 -0
  213. package/src/components/ds-tooltip/ds-tooltip.module.scss +19 -0
  214. package/src/components/ds-tooltip/ds-tooltip.tsx +33 -0
  215. package/src/components/ds-tooltip/ds-tooltip.types.tsx +12 -0
  216. package/src/components/ds-tooltip/index.tsx +2 -0
  217. package/src/components/ds-typography/ds-typography.config.ts +32 -0
  218. package/src/components/ds-typography/ds-typography.module.scss +93 -0
  219. package/src/components/ds-typography/ds-typography.tsx +27 -0
  220. package/src/components/ds-typography/ds-typography.types.tsx +27 -0
  221. package/src/components/ds-typography/index.tsx +2 -0
  222. package/src/components/ds-vertical-tabs/ds-vertical-tabs.module.scss +60 -0
  223. package/src/components/ds-vertical-tabs/ds-vertical-tabs.tsx +80 -0
  224. package/src/components/ds-vertical-tabs/ds-vertical-tabs.types.ts +69 -0
  225. package/src/components/ds-vertical-tabs/index.ts +7 -0
  226. package/src/index.ts +34 -0
  227. package/src/styles/_colors.scss +65 -0
  228. package/src/styles/_grid.scss +111 -0
  229. package/src/styles/_mixin.scss +1 -0
  230. package/src/styles/_reset.scss +38 -0
  231. package/src/styles/_root.scss +390 -0
  232. package/src/styles/_scrollbars.scss +41 -0
  233. package/src/styles/_spacing.scss +47 -0
  234. package/src/styles/_typography.scss +301 -0
  235. package/src/styles/_utilities.scss +33 -0
  236. package/src/styles/_variables.scss +44 -0
  237. package/src/styles/mixins/_bounding-box.scss +53 -0
  238. package/src/styles/mixins/_list.scss +74 -0
  239. package/src/styles/shared/_dropdown.scss +89 -0
  240. package/src/styles/shared/_input.scss +365 -0
  241. package/src/styles/shared/_modal.scss +123 -0
  242. package/src/styles/styles.scss +12 -0
@@ -0,0 +1,33 @@
1
+ import type React from 'react';
2
+ import classNames from 'classnames';
3
+ import styles from './ds-system-status.module.scss';
4
+ import type { DsSystemStatusProps } from './ds-system-status.types';
5
+
6
+ /**
7
+ * @deprecated This component is deprecated. Use `DsStatusBadge` instead.
8
+ * @see {@link ../ds-status-badge/ds-status-badge} for the replacement component.
9
+ */
10
+ const defaultLabels: Record<DsSystemStatusProps['status'], string> = {
11
+ healthy: 'HEALTHY',
12
+ neutral: 'NEUTRAL',
13
+ error: 'ERROR',
14
+ 'in-progress': 'IN PROGRESS',
15
+ pending: 'PENDING',
16
+ alert: 'ALERT',
17
+ disabled: 'DISABLED',
18
+ };
19
+
20
+ /**
21
+ * @deprecated This component is deprecated. Use `DsStatusBadge` instead.
22
+ * @see {@link ../ds-status-badge/ds-status-badge} for the replacement component.
23
+ */
24
+ const DsSystemStatus: React.FC<DsSystemStatusProps> = ({ status, label, className }) => {
25
+ return (
26
+ <div className={classNames(styles.container, styles[status], className)}>
27
+ <span className={styles.dot} />
28
+ <span className={styles.label}>{label || defaultLabels[status]}</span>
29
+ </div>
30
+ );
31
+ };
32
+
33
+ export default DsSystemStatus;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @deprecated This type is deprecated. Use `DsStatusBadge` and its related types instead.
3
+ * @see {@link ../ds-status-badge/ds-status-badge} for the replacement component.
4
+ */
5
+ export const systemStatuses = [
6
+ 'healthy',
7
+ 'neutral',
8
+ 'error',
9
+ 'in-progress',
10
+ 'pending',
11
+ 'alert',
12
+ 'disabled',
13
+ ] as const;
14
+
15
+ /**
16
+ * @deprecated This type is deprecated. Use `DsStatus` from `ds-status-badge` instead.
17
+ */
18
+ export type SystemStatus = (typeof systemStatuses)[number];
19
+
20
+ /**
21
+ * @deprecated This interface is deprecated. Use `DsStatusBadgeProps` from `ds-status-badge` instead.
22
+ * @see {@link ../ds-status-badge/ds-status-badge.types} for the replacement interface.
23
+ */
24
+ export interface DsSystemStatusProps {
25
+ /**
26
+ * The status of the system
27
+ */
28
+ status: SystemStatus;
29
+ /**
30
+ * The label to be displayed
31
+ */
32
+ label?: string;
33
+ /**
34
+ * Additional CSS class names
35
+ */
36
+ className?: string;
37
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @deprecated DsSystemStatus is deprecated. Use DsStatusBadge instead.
3
+ * @see {@link ../ds-status-badge} for the replacement component.
4
+ */
5
+ export { default as DsSystemStatus } from './ds-system-status';
6
+ /**
7
+ * @deprecated These types are deprecated. Use DsStatusBadge types instead.
8
+ * @see {@link ../ds-status-badge} for the replacement types.
9
+ */
10
+ export * from './ds-system-status.types';
@@ -0,0 +1,32 @@
1
+ .table {
2
+ width: 100%;
3
+ caption-side: bottom;
4
+ font-size: 0.875rem;
5
+ line-height: 1.25rem;
6
+ border-collapse: separate;
7
+ border-spacing: 0;
8
+ }
9
+
10
+ .tableFooter {
11
+ background-color: rgba(241, 245, 249, 0.5);
12
+ font-weight: 500;
13
+ }
14
+
15
+ .tableHead {
16
+ &:has([role='checkbox']) {
17
+ padding-right: 0;
18
+ }
19
+ }
20
+
21
+ .tableCell {
22
+ &:has([role='checkbox']) {
23
+ padding-right: 0;
24
+ }
25
+ }
26
+
27
+ .tableCaption {
28
+ margin-top: 1rem;
29
+ font-size: 0.875rem;
30
+ line-height: 1.25rem;
31
+ color: rgb(100, 116, 139);
32
+ }
@@ -0,0 +1,83 @@
1
+ import type { HTMLAttributes, Ref, TdHTMLAttributes, ThHTMLAttributes } from 'react';
2
+ import classnames from 'classnames';
3
+ import styles from './core-table.module.scss';
4
+
5
+ type TableProps = HTMLAttributes<HTMLTableElement> & { ref?: Ref<HTMLTableElement> };
6
+
7
+ function Table({ className, ref, ...props }: TableProps) {
8
+ return <table ref={ref} className={classnames(styles.table, className)} {...props} />;
9
+ }
10
+
11
+ Table.displayName = 'Table';
12
+
13
+ type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement> & {
14
+ ref?: Ref<HTMLTableSectionElement>;
15
+ };
16
+
17
+ function TableHeader({ className, ref, ...props }: TableHeaderProps) {
18
+ return <thead ref={ref} className={classnames(styles.tableHeader, className)} {...props} />;
19
+ }
20
+
21
+ TableHeader.displayName = 'TableHeader';
22
+
23
+ type TableBodyProps = HTMLAttributes<HTMLTableSectionElement> & {
24
+ ref?: Ref<HTMLTableSectionElement>;
25
+ };
26
+
27
+ function TableBody({ className, ref, ...props }: TableBodyProps) {
28
+ return <tbody ref={ref} className={classnames(styles.tableBody, className)} {...props} />;
29
+ }
30
+
31
+ TableBody.displayName = 'TableBody';
32
+
33
+ type TableFooterProps = HTMLAttributes<HTMLTableSectionElement> & {
34
+ ref?: Ref<HTMLTableSectionElement>;
35
+ };
36
+
37
+ function TableFooter({ className, ref, ...props }: TableFooterProps) {
38
+ return <tfoot ref={ref} className={classnames(styles.tableFooter, className)} {...props} />;
39
+ }
40
+
41
+ TableFooter.displayName = 'TableFooter';
42
+
43
+ type TableRowProps = HTMLAttributes<HTMLTableRowElement> & {
44
+ ref?: Ref<HTMLTableRowElement>;
45
+ };
46
+
47
+ function TableRow({ className, ref, ...props }: TableRowProps) {
48
+ return <tr ref={ref} className={classnames(styles.tableRow, className)} {...props} />;
49
+ }
50
+
51
+ TableRow.displayName = 'TableRow';
52
+
53
+ type TableHeadProps = ThHTMLAttributes<HTMLTableCellElement> & {
54
+ ref?: Ref<HTMLTableCellElement>;
55
+ };
56
+
57
+ function TableHead({ className, ref, ...props }: TableHeadProps) {
58
+ return <th ref={ref} className={classnames(styles.tableHead, className)} {...props} />;
59
+ }
60
+
61
+ TableHead.displayName = 'TableHead';
62
+
63
+ type TableCellProps = TdHTMLAttributes<HTMLTableCellElement> & {
64
+ ref?: Ref<HTMLTableCellElement>;
65
+ };
66
+
67
+ function TableCell({ className, ref, ...props }: TableCellProps) {
68
+ return <td ref={ref} className={classnames(styles.tableCell, className)} {...props} />;
69
+ }
70
+
71
+ TableCell.displayName = 'TableCell';
72
+
73
+ type TableCaptionProps = HTMLAttributes<HTMLTableCaptionElement> & {
74
+ ref?: Ref<HTMLTableCaptionElement>;
75
+ };
76
+
77
+ function TableCaption({ className, ref, ...props }: TableCaptionProps) {
78
+ return <caption ref={ref} className={classnames(styles.tableCaption, className)} {...props} />;
79
+ }
80
+
81
+ TableCaption.displayName = 'TableCaption';
82
+
83
+ export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };
@@ -0,0 +1 @@
1
+ export * from './core-table';
@@ -0,0 +1,115 @@
1
+ @use '../../../../styles/typography';
2
+
3
+ .bulkActionsContainer {
4
+ position: fixed;
5
+ bottom: 20px;
6
+ left: 50%;
7
+ transform: translateX(-50%);
8
+ background-color: var(--white);
9
+ border-radius: 8px;
10
+ box-shadow: 0 4px 12px #0445cc66;
11
+ z-index: 1000;
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(--action-cta1);
38
+ display: flex;
39
+ align-items: center;
40
+ padding: 6px 22px;
41
+ }
42
+
43
+ .selectedCountBadge {
44
+ color: var(--white);
45
+ margin: 0;
46
+ }
47
+
48
+ .bulkActionsInfo {
49
+ color: var(--neutral-2);
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
+ border-right: 1px solid var(--neutral-6);
62
+ width: 68px;
63
+ height: 48px;
64
+ border-radius: 0;
65
+
66
+ > .actionButtonContent {
67
+ display: flex;
68
+ flex-direction: column;
69
+ align-items: center;
70
+ justify-content: center;
71
+ gap: 4px;
72
+ }
73
+ }
74
+
75
+ > .actionButton:first-child {
76
+ border-left: 1px solid var(--neutral-6);
77
+ }
78
+ }
79
+
80
+ .escapeButtonContent {
81
+ display: flex;
82
+ flex-direction: column;
83
+ justify-content: center;
84
+ align-items: center;
85
+ color: var(--neutral-2);
86
+ gap: 2px !important;
87
+ width: 36px;
88
+ padding-left: 4px;
89
+
90
+ &:hover {
91
+ color: var(--neutral-4);
92
+ }
93
+ }
94
+
95
+ @keyframes slideUpFadeIn {
96
+ 0% {
97
+ opacity: 0;
98
+ transform: translate(-50%, 100%);
99
+ }
100
+ 100% {
101
+ opacity: 1;
102
+ transform: translate(-50%, 0);
103
+ }
104
+ }
105
+
106
+ @keyframes slideDownFadeOut {
107
+ 0% {
108
+ opacity: 1;
109
+ transform: translate(-50%, 0);
110
+ }
111
+ 100% {
112
+ opacity: 0;
113
+ transform: translate(-50%, 100%);
114
+ }
115
+ }
@@ -0,0 +1,70 @@
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
+
9
+ const DsTableBulkActions: React.FC<BulkActionsProps> = ({ numSelectedRows, actions, onClearSelection }) => {
10
+ const [isRendered, setIsRendered] = useState(false);
11
+ const [animationClass, setAnimationClass] = useState('');
12
+
13
+ useEffect(() => {
14
+ if (numSelectedRows > 0) {
15
+ setIsRendered(true);
16
+ setAnimationClass(styles.entering);
17
+ } else if (isRendered) {
18
+ setAnimationClass(styles.exiting);
19
+ const timer = setTimeout(() => {
20
+ setIsRendered(false);
21
+ setAnimationClass('');
22
+ }, 300);
23
+ return () => clearTimeout(timer);
24
+ }
25
+ }, [numSelectedRows, isRendered]);
26
+
27
+ if (!isRendered) {
28
+ return null;
29
+ }
30
+
31
+ return (
32
+ <div className={classnames(styles.bulkActionsContainer, animationClass)}>
33
+ <div className={styles.selectedCountContainer}>
34
+ <h3 className={classnames(styles.selectedCountBadge, styles.bold)}>{numSelectedRows}</h3>
35
+ </div>
36
+ <div className={styles.bulkActionsContent}>
37
+ <span className={styles.bulkActionsInfo}>items selected</span>
38
+
39
+ <div className={styles.bulkActionsActions}>
40
+ {actions.map((action, index) => (
41
+ <DsButton
42
+ key={index}
43
+ variant="borderless"
44
+ size="small"
45
+ className={styles.actionButton}
46
+ contentClassName={styles.actionButtonContent}
47
+ onClick={action.onClick}
48
+ >
49
+ <DsIcon icon={action.icon} />
50
+ <span className={(styles['p-s'], styles.medium)}>{action.label}</span>
51
+ </DsButton>
52
+ ))}
53
+ </div>
54
+
55
+ <DsButton
56
+ variant="borderless"
57
+ size="small"
58
+ color="neutral-2"
59
+ contentClassName={styles.escapeButtonContent}
60
+ onClick={onClearSelection}
61
+ >
62
+ <DsIcon icon="close" />
63
+ <span className={(styles['p-s'], styles.medium)}>Esc</span>
64
+ </DsButton>
65
+ </div>
66
+ </div>
67
+ );
68
+ };
69
+
70
+ export default DsTableBulkActions;
@@ -0,0 +1,41 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ export { default as DsTableBulkActions } from './ds-table-bulk-actions';
2
+ export * from './ds-table-bulk-actions.types';
@@ -0,0 +1,53 @@
1
+ @use '../../../../styles/typography';
2
+
3
+ .tableCellEllipsis {
4
+ display: -webkit-box;
5
+ -webkit-line-clamp: 2;
6
+ -webkit-box-orient: vertical;
7
+ overflow: hidden;
8
+ text-overflow: ellipsis;
9
+ word-break: break-word;
10
+ }
11
+
12
+ .lastCell {
13
+ display: flex;
14
+ justify-content: space-between;
15
+ align-items: center;
16
+ height: 100%;
17
+ flex: 1;
18
+
19
+ .cellActions {
20
+ display: flex;
21
+ align-items: center;
22
+ gap: 8px;
23
+ }
24
+ }
25
+
26
+ .rowActionIcon {
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ width: 36px;
31
+ height: 36px;
32
+ border-radius: 50%;
33
+ background: none;
34
+ cursor: pointer;
35
+ transition: background 0.15s;
36
+ color: var(--color-icon-secondary);
37
+
38
+ &.disabled {
39
+ opacity: 0.5;
40
+ cursor: not-allowed;
41
+ pointer-events: none;
42
+ }
43
+
44
+ &:hover,
45
+ &:focus-within {
46
+ background: var(--color-background-action-hover-weak);
47
+ color: var(--color-font-action);
48
+ }
49
+ }
50
+
51
+ .secondaryActionsTrigger {
52
+ margin-inline-start: var(--spacing-sm);
53
+ }
@@ -0,0 +1,95 @@
1
+ import { type Cell, flexRender } from '@tanstack/react-table';
2
+ import classnames from 'classnames';
3
+ import { DsIcon } from '../../../ds-icon';
4
+ import { DsDropdownMenu } from '../../../ds-dropdown-menu';
5
+ import styles from './ds-table-cell.module.scss';
6
+ import type { DsTableCellProps } from './ds-table-cell.types';
7
+
8
+ const DsDefaultTableCell = <TData, TValue>({ cell }: { cell: Cell<TData, TValue> }) => {
9
+ return (
10
+ <div className={styles.tableCellEllipsis}>
11
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
12
+ </div>
13
+ );
14
+ };
15
+
16
+ export const DsTableCell = <TData, TValue>({
17
+ row,
18
+ cell,
19
+ primaryRowActions = [],
20
+ secondaryRowActions = [],
21
+ }: DsTableCellProps<TData, TValue>) => {
22
+ if (primaryRowActions.length || secondaryRowActions.length) {
23
+ const hasSecondaryRowActions = secondaryRowActions.some((action) => !action.disabled?.(row.original));
24
+ return (
25
+ <div className={styles.lastCell}>
26
+ <DsDefaultTableCell cell={cell} />
27
+ <div className={styles.cellActions}>
28
+ {primaryRowActions.map((action, i) => {
29
+ const isDisabled = action.disabled?.(row.original);
30
+ const label = typeof action.label === 'function' ? action.label(row.original) : action.label;
31
+ return (
32
+ <button
33
+ key={i}
34
+ type="button"
35
+ className={classnames(styles.rowActionIcon, { [styles.disabled]: isDisabled })}
36
+ title={action.tooltip || label}
37
+ onClick={(e) => {
38
+ e.stopPropagation();
39
+
40
+ if (isDisabled) {
41
+ return;
42
+ }
43
+ action.onClick(row.original);
44
+ }}
45
+ tabIndex={isDisabled ? -1 : 0}
46
+ aria-label={label}
47
+ aria-disabled={isDisabled}
48
+ >
49
+ <DsIcon icon={action.icon} size="tiny" />
50
+ </button>
51
+ );
52
+ })}
53
+ {hasSecondaryRowActions && (
54
+ <DsDropdownMenu.Root>
55
+ <DsDropdownMenu.Trigger
56
+ className={classnames(styles.rowActionIcon, styles.secondaryActionsTrigger)}
57
+ aria-label="More actions"
58
+ asChild
59
+ >
60
+ <button
61
+ type="button"
62
+ title="More actions"
63
+ aria-label="More actions"
64
+ onClick={(e) => e.stopPropagation()}
65
+ >
66
+ <DsIcon icon="more_vert" size="tiny" />
67
+ </button>
68
+ </DsDropdownMenu.Trigger>
69
+ <DsDropdownMenu.Content>
70
+ {secondaryRowActions.map((action, i) => {
71
+ const label =
72
+ typeof action.label === 'function' ? action.label(row.original) : action.label;
73
+ const isDisabled = action.disabled?.(row.original);
74
+ return (
75
+ <DsDropdownMenu.Item
76
+ key={i}
77
+ value={label}
78
+ disabled={isDisabled}
79
+ onClick={(e) => e.stopPropagation()}
80
+ onSelect={() => action.onClick(row.original)}
81
+ >
82
+ {action.icon && <DsIcon icon={action.icon} />}
83
+ <span>{label}</span>
84
+ </DsDropdownMenu.Item>
85
+ );
86
+ })}
87
+ </DsDropdownMenu.Content>
88
+ </DsDropdownMenu.Root>
89
+ )}
90
+ </div>
91
+ </div>
92
+ );
93
+ }
94
+ return <DsDefaultTableCell cell={cell} />;
95
+ };
@@ -0,0 +1,67 @@
1
+ import type { Cell, Row } from '@tanstack/react-table';
2
+ import type { IconType } from '../../../ds-icon';
3
+
4
+ /**
5
+ * Represents an action that can be performed on a single row
6
+ */
7
+ export interface RowAction<TData> {
8
+ /**
9
+ * Icon to be displayed for the action
10
+ */
11
+ icon: IconType;
12
+
13
+ /**
14
+ * Label text for the action
15
+ */
16
+ label: string | ((row: TData) => string);
17
+
18
+ /**
19
+ * Optional tooltip text to show on hover
20
+ */
21
+ tooltip?: string;
22
+
23
+ /**
24
+ * Optional function to determine if the action should be disabled for a specific row
25
+ */
26
+ disabled?: (row: TData) => boolean;
27
+
28
+ /**
29
+ * Function to be called when the action is clicked, receives the row data as parameter
30
+ */
31
+ onClick: (row: TData) => void;
32
+ }
33
+
34
+ /**
35
+ * Represents a secondary action that can be performed on a single row
36
+ */
37
+ export type SecondaryRowAction<TData> = Omit<RowAction<TData>, 'icon'> & {
38
+ /**
39
+ * Optional icon to be displayed for the action
40
+ */
41
+ icon?: IconType;
42
+ };
43
+
44
+ /**
45
+ * Props for the table cell component
46
+ */
47
+ export interface DsTableCellProps<TData, TValue> {
48
+ /**
49
+ * The row data from the table
50
+ */
51
+ row: Row<TData>;
52
+
53
+ /**
54
+ * The cell data from the table
55
+ */
56
+ cell: Cell<TData, TValue>;
57
+
58
+ /**
59
+ * Primary actions to be shown on each row (on hover)
60
+ */
61
+ primaryRowActions?: RowAction<TData>[];
62
+
63
+ /**
64
+ * Secondary actions to be shown in a dropdown on each row (on hover)
65
+ */
66
+ secondaryRowActions?: SecondaryRowAction<TData>[];
67
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ds-table-cell';
2
+ export * from './ds-table-cell.types';