@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,70 @@
1
+ .expandableInput {
2
+ width: max-content;
3
+ transition: 0.3s padding;
4
+
5
+ &:not(.expanded) {
6
+ gap: 0;
7
+ padding-inline: var(--spacing-xs);
8
+ }
9
+
10
+ .trigger:focus {
11
+ outline: none;
12
+ }
13
+
14
+ // Increase the clickable area of the start adornment.
15
+ .trigger::before {
16
+ content: '';
17
+ display: block;
18
+ position: absolute;
19
+ inset: 0;
20
+ cursor: pointer;
21
+ }
22
+
23
+ &:has(:disabled) .trigger::before {
24
+ cursor: not-allowed;
25
+ }
26
+
27
+ &.expanded .trigger {
28
+ pointer-events: none;
29
+
30
+ &::before {
31
+ display: none;
32
+ }
33
+ }
34
+
35
+ .clearTrigger {
36
+ transition: 0.3s opacity;
37
+ }
38
+
39
+ &:not(.expanded) .clearTrigger {
40
+ display: none;
41
+ }
42
+
43
+ &:not(.dirty) .clearTrigger {
44
+ opacity: 0;
45
+ pointer-events: none;
46
+ }
47
+
48
+ // See: https://css-tricks.com/css-grid-can-do-auto-height-transitions/
49
+ .inputExpander {
50
+ display: grid;
51
+ grid-template-columns: 0fr;
52
+ overflow: hidden;
53
+ transition: 0.3s grid-template-columns;
54
+
55
+ input {
56
+ min-width: 0;
57
+ opacity: 0;
58
+ transition: 0.15s opacity;
59
+ }
60
+ }
61
+
62
+ &.expanded .inputExpander {
63
+ grid-template-columns: 1fr;
64
+
65
+ input {
66
+ opacity: 1;
67
+ transition: 0.3s opacity 0.15s;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,106 @@
1
+ import { type ReactNode, useRef, useState } from 'react';
2
+ import { DsTextInput } from '../ds-text-input';
3
+ import { DsIcon } from '../ds-icon';
4
+ import classNames from 'classnames';
5
+ import styles from './ds-expandable-text-input.module.scss';
6
+ import { mergeRefs } from '../ds-table/utils/merge-refs';
7
+ import type { DsExpandableTextInputProps } from './ds-expandable-text-input.types';
8
+ import { DsButton } from '../ds-button';
9
+
10
+ export function DsExpandableTextInput({
11
+ onClear,
12
+ onExpandChange,
13
+ icon,
14
+ ...props
15
+ }: DsExpandableTextInputProps) {
16
+ const [expanded, _setExpanded] = useState(false);
17
+ const [dirty, setDirty] = useState(false);
18
+ const ref = useRef<HTMLInputElement>(null);
19
+
20
+ const setExpanded = (newExpanded: boolean) => {
21
+ _setExpanded(newExpanded);
22
+
23
+ onExpandChange?.(newExpanded);
24
+
25
+ if (!newExpanded) {
26
+ setDirty(false);
27
+ }
28
+ };
29
+
30
+ return (
31
+ <DsTextInput
32
+ {...props}
33
+ ref={mergeRefs(ref, props.ref)}
34
+ tabIndex={expanded ? 0 : -1}
35
+ className={classNames(
36
+ props.className,
37
+ styles.expandableInput,
38
+ expanded && styles.expanded,
39
+ dirty && styles.dirty,
40
+ )}
41
+ onChange={(e) => {
42
+ props.onChange?.(e);
43
+
44
+ setDirty(true);
45
+ }}
46
+ onBlur={(e) => {
47
+ props.onBlur?.(e);
48
+
49
+ if (!dirty && !ref.current?.value) {
50
+ setExpanded(false);
51
+ }
52
+ }}
53
+ slots={{
54
+ inputWrapper: InputExpander,
55
+ startAdornment: (
56
+ <button
57
+ type="button"
58
+ className={styles.trigger}
59
+ aria-label="Open text input"
60
+ aria-hidden={expanded}
61
+ tabIndex={expanded ? -1 : 0}
62
+ onClick={() => {
63
+ if (props.disabled) {
64
+ return;
65
+ }
66
+
67
+ setExpanded(true);
68
+
69
+ ref.current?.focus();
70
+ }}
71
+ >
72
+ <DsIcon icon={icon} size="small" />
73
+ </button>
74
+ ),
75
+
76
+ endAdornment: (
77
+ <DsButton
78
+ design="v1.2"
79
+ size="small"
80
+ buttonType="tertiary"
81
+ variant="filled"
82
+ className={styles.clearTrigger}
83
+ onClick={() => {
84
+ setExpanded(false);
85
+
86
+ if (ref.current) {
87
+ ref.current.blur();
88
+
89
+ // Manually clear the input in uncontrolled mode.
90
+ ref.current.value = '';
91
+ }
92
+
93
+ onClear?.();
94
+ }}
95
+ >
96
+ Clear
97
+ </DsButton>
98
+ ),
99
+ }}
100
+ />
101
+ );
102
+ }
103
+
104
+ function InputExpander({ children }: { children: ReactNode }) {
105
+ return <div className={styles.inputExpander}>{children}</div>;
106
+ }
@@ -0,0 +1,19 @@
1
+ import type { IconType } from '../ds-icon';
2
+ import type { DsTextInputProps } from '../ds-text-input';
3
+
4
+ export interface DsExpandableTextInputProps extends Omit<DsTextInputProps, 'tabIndex' | 'slots'> {
5
+ /**
6
+ * The icon to display inside the expandable input trigger button
7
+ */
8
+ icon: IconType;
9
+
10
+ /**
11
+ * Callback fired when the clear action is triggered
12
+ */
13
+ onClear?: () => void;
14
+
15
+ /**
16
+ * Callback fired when the expanded state changes
17
+ */
18
+ onExpandChange?: (expanded: boolean) => void;
19
+ }
@@ -0,0 +1,2 @@
1
+ export { DsExpandableTextInput } from './ds-expandable-text-input';
2
+ export type { DsExpandableTextInputProps } from './ds-expandable-text-input.types';
@@ -0,0 +1,90 @@
1
+ @use '../../../../styles/typography';
2
+
3
+ .fileUploadRoot {
4
+ display: flex;
5
+ flex-direction: column;
6
+ width: 100%;
7
+ }
8
+
9
+ .dropzone {
10
+ display: flex;
11
+ flex-direction: column;
12
+ align-items: center;
13
+ justify-content: center;
14
+ padding: var(--exo-spacing-small) var(--exo-spacing-standard);
15
+ border: var(--exo-spacing-4x-small) dashed var(--color-border);
16
+ border-radius: var(--exo-spacing-2x-small);
17
+ background-color: var(--color-background);
18
+ transition: all 0.2s ease;
19
+ cursor: pointer;
20
+
21
+ &.dropzoneCompact {
22
+ flex-direction: row;
23
+ justify-content: space-between;
24
+
25
+ .dropzoneIcon {
26
+ display: none;
27
+ }
28
+
29
+ .dropzoneText {
30
+ padding: 0;
31
+ }
32
+ }
33
+
34
+ .dropzoneIcon {
35
+ color: var(--color-icon-secondary);
36
+ }
37
+
38
+ .dropzoneText {
39
+ color: var(--color-background-deselected);
40
+ text-align: center;
41
+ padding: var(--spacing-3xs) 0 var(--spacing-sm) 0;
42
+ }
43
+
44
+ [data-part='trigger'] {
45
+ align-self: center;
46
+ }
47
+
48
+ &:hover:not([data-disabled]) {
49
+ border-color: var(--color-background-selected);
50
+ background-color: var(--color-background-selected-weak);
51
+ }
52
+
53
+ &[data-dragging] {
54
+ border-color: var(--color-background-selected);
55
+ background-color: var(--color-background-selected-weak);
56
+ border-style: solid;
57
+ }
58
+
59
+ &[data-disabled] {
60
+ cursor: not-allowed;
61
+
62
+ .dropzoneIcon,
63
+ .dropzoneText {
64
+ color: var(--color-background-disable);
65
+ }
66
+ }
67
+ }
68
+
69
+ .fileList {
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: var(--exo-spacing-x-small);
73
+ margin-top: var(--exo-spacing-x-small);
74
+ padding: var(--spacing-xs);
75
+ border-radius: var(--exo-spacing-2x-small);
76
+ background: var(--color-background-secondary);
77
+ }
78
+
79
+ .infoText {
80
+ color: var(--color-font-secondary);
81
+ margin-top: var(--spacing-2xs);
82
+ }
83
+
84
+ .errorText {
85
+ color: var(--color-background-danger-strong);
86
+ display: flex;
87
+ align-items: center;
88
+ gap: var(--spacing-3xs);
89
+ margin-top: var(--spacing-2xs);
90
+ }
@@ -0,0 +1,106 @@
1
+ import type React from 'react';
2
+ import classNames from 'classnames';
3
+ import { FileUpload as ArkUiFileUpload } from '@ark-ui/react';
4
+ import { DsIcon } from '../../../ds-icon';
5
+ import { DsTypography } from '../../../ds-typography';
6
+ import { DsButton } from '../../../ds-button';
7
+ import { FileUploadItem } from '../file-upload-item';
8
+ import type { FileUploadProps } from './file-upload.types';
9
+ import { DEFAULT_ALLOWED_FILE_TYPES, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_FILES } from '../../utils/constants';
10
+ import { generateHelperText } from '../../utils/generate-helper-text';
11
+ import { getMimeTypes } from '../../utils/accept-utils';
12
+ import styles from './file-upload.module.scss';
13
+
14
+ /**
15
+ * Design system base File Upload component
16
+ * Used in conjunction with the useFileUpload hook
17
+ */
18
+ export const FileUpload: React.FC<FileUploadProps> = ({
19
+ style = {},
20
+ className,
21
+ files,
22
+ acceptedFiles,
23
+ errorText,
24
+ dropzoneText = 'Drag and drop files here or ',
25
+ triggerText = 'Select file...',
26
+ hideProgress = false,
27
+ disableDrop = false,
28
+ onFileAccept,
29
+ onFileReject,
30
+ onFileRemove,
31
+ onFileDelete,
32
+ onFileCancel,
33
+ onFileRetry,
34
+ accept = DEFAULT_ALLOWED_FILE_TYPES,
35
+ maxFiles = DEFAULT_MAX_FILES,
36
+ maxFileSize = DEFAULT_MAX_FILE_SIZE,
37
+ compact = false,
38
+ disabled = false,
39
+ }) => {
40
+ const infoText = generateHelperText(accept, maxFileSize, maxFiles);
41
+
42
+ return (
43
+ <ArkUiFileUpload.Root
44
+ style={style}
45
+ className={classNames(styles.fileUploadRoot, className)}
46
+ maxFiles={maxFiles}
47
+ maxFileSize={maxFileSize}
48
+ accept={getMimeTypes(accept)}
49
+ disabled={disabled}
50
+ allowDrop={!disableDrop}
51
+ acceptedFiles={acceptedFiles}
52
+ onFileAccept={onFileAccept}
53
+ onFileReject={onFileReject}
54
+ >
55
+ <ArkUiFileUpload.Dropzone
56
+ className={classNames(styles.dropzone, {
57
+ [styles.dropzoneCompact]: compact,
58
+ })}
59
+ >
60
+ <DsIcon icon="upload" className={styles.dropzoneIcon} />
61
+ <DsTypography className={styles.dropzoneText} variant="body-xs-reg">
62
+ {dropzoneText}
63
+ </DsTypography>
64
+ <ArkUiFileUpload.Trigger asChild>
65
+ <DsButton design="v1.2" variant="ghost" size="small" disabled={disabled}>
66
+ {triggerText}
67
+ </DsButton>
68
+ </ArkUiFileUpload.Trigger>
69
+ </ArkUiFileUpload.Dropzone>
70
+
71
+ {infoText && !disabled && !errorText && (
72
+ <DsTypography className={styles.infoText} variant="body-xs-reg">
73
+ {infoText}
74
+ </DsTypography>
75
+ )}
76
+ {errorText && (
77
+ <DsTypography className={styles.errorText} variant="body-xs-reg">
78
+ <DsIcon icon="error" size="tiny" />
79
+ {errorText}
80
+ </DsTypography>
81
+ )}
82
+
83
+ {!!files?.length && (
84
+ <div className={styles.fileList}>
85
+ {files.map((uploadFile) => (
86
+ <FileUploadItem
87
+ key={uploadFile.id}
88
+ id={uploadFile.id}
89
+ name={uploadFile.name}
90
+ progress={uploadFile.progress}
91
+ hideProgress={hideProgress}
92
+ status={uploadFile.status}
93
+ errors={uploadFile.errors}
94
+ onRemove={onFileRemove}
95
+ onDelete={onFileDelete}
96
+ onCancel={onFileCancel}
97
+ onRetry={onFileRetry}
98
+ />
99
+ ))}
100
+ </div>
101
+ )}
102
+
103
+ <ArkUiFileUpload.HiddenInput />
104
+ </ArkUiFileUpload.Root>
105
+ );
106
+ };
@@ -0,0 +1,94 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { FileUploadFileAcceptDetails, FileUploadFileRejectDetails } from '@ark-ui/react';
3
+ import type { UploadedFile } from '../../ds-file-upload-api.types';
4
+ import type { AcceptedFileType } from '../../types/accept-types';
5
+
6
+ export interface FileUploadProps {
7
+ /**
8
+ * Error text displayed when validation fails
9
+ */
10
+ errorText?: string;
11
+ /**
12
+ * Text displayed in the dropzone area
13
+ */
14
+ dropzoneText?: string;
15
+ /**
16
+ * Text for the upload trigger button
17
+ */
18
+ triggerText?: string;
19
+ /**
20
+ * Whether to hide upload progress
21
+ * @default false
22
+ */
23
+ hideProgress?: boolean;
24
+ /**
25
+ * Whether to disable drag and drop functionality
26
+ * @default false
27
+ */
28
+ disableDrop?: boolean;
29
+ /**
30
+ * The maximum number of files that can be uploaded
31
+ */
32
+ maxFiles?: number;
33
+ /**
34
+ * Maximum file size in bytes
35
+ * @default 25MB
36
+ */
37
+ maxFileSize?: number;
38
+ /**
39
+ * Callback when files are accepted
40
+ */
41
+ onFileAccept?: (details: FileUploadFileAcceptDetails) => void;
42
+ /**
43
+ * Callback when files are rejected
44
+ */
45
+ onFileReject?: (details: FileUploadFileRejectDetails) => void;
46
+ /**
47
+ * Additional CSS class names
48
+ */
49
+ className?: string;
50
+ /**
51
+ * Additional styles
52
+ */
53
+ style?: CSSProperties;
54
+ /**
55
+ * The file types that are accepted
56
+ * Use shorthand for common MIME types (extensions provided automatically)
57
+ * or explicit form for custom types
58
+ * @example ['application/pdf', 'image/png']
59
+ * @example ['application/pdf', { mimeType: 'application/x-custom', extensions: ['.custom'] }]
60
+ */
61
+ accept?: AcceptedFileType[];
62
+ /**
63
+ * File states to display (managed externally)
64
+ */
65
+ files?: UploadedFile[];
66
+ /**
67
+ * Callback when files are removed
68
+ */
69
+ onFileRemove?: (fileId: string) => void;
70
+ /**
71
+ * Callback when files are deleted
72
+ */
73
+ onFileDelete?: (fileId: string) => void;
74
+ /**
75
+ * Callback when files upload is canceled
76
+ */
77
+ onFileCancel?: (fileId: string) => void;
78
+ /**
79
+ * Callback when files upload is retried
80
+ */
81
+ onFileRetry?: (fileId: string) => void;
82
+ /**
83
+ * Controlled accepted files
84
+ */
85
+ acceptedFiles?: File[];
86
+ /**
87
+ * Whether the file upload is disabled
88
+ */
89
+ disabled?: boolean;
90
+ /**
91
+ * Whether the file upload layout is compact (inline)
92
+ */
93
+ compact?: boolean;
94
+ }
@@ -0,0 +1,2 @@
1
+ export { FileUpload } from './file-upload';
2
+ export type { FileUploadProps } from './file-upload.types';
@@ -0,0 +1,125 @@
1
+ @use '../../../../styles/typography';
2
+
3
+ .fileItem {
4
+ display: flex;
5
+ flex-direction: column;
6
+
7
+ .fileItemContent {
8
+ display: flex;
9
+ align-items: center;
10
+ gap: var(--spacing-2xs);
11
+ width: 100%;
12
+ background-color: var(--color-background);
13
+ padding: var(--spacing-4xs) var(--exo-spacing-x-small);
14
+ border: 1px solid transparent;
15
+ border-radius: var(--exo-spacing-2x-small);
16
+ transition: all 0.2s ease;
17
+
18
+ &:hover {
19
+ border-color: var(--color-border-secondary);
20
+ }
21
+
22
+ &[data-disabled] {
23
+ opacity: 0.5;
24
+ }
25
+
26
+ &.fileItemError {
27
+ background-color: var(--color-background-danger-weak);
28
+
29
+ .progressRange {
30
+ background: var(--color-background-danger-strong);
31
+ }
32
+ }
33
+
34
+ &.fileItemCompleted {
35
+ .progressRange {
36
+ background: var(--color-background-success-strong);
37
+ }
38
+ }
39
+
40
+ &.fileItemUploading {
41
+ .progressRange {
42
+ background: var(--color-background-selected);
43
+ }
44
+ }
45
+
46
+ &.fileItemInterrupted {
47
+ .progressRange {
48
+ background: var(--color-background-warning-strong);
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ .filePreview {
55
+ color: var(--color-background-deselected);
56
+ }
57
+
58
+ .fileInfo {
59
+ display: flex;
60
+ align-items: center;
61
+ gap: var(--spacing-2xs);
62
+ flex: 1;
63
+ min-width: 0;
64
+ }
65
+
66
+ .fileName {
67
+ @include typography.body-sm-reg;
68
+ @include typography.ellipsis;
69
+ color: var(--color-font-main);
70
+ flex: 1 0 75%;
71
+ }
72
+
73
+ .progressContainer {
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: var(--spacing-xs);
77
+ width: 100%;
78
+ }
79
+
80
+ .progressBar {
81
+ width: 100%;
82
+ height: 2px;
83
+ }
84
+
85
+ .progressTrack {
86
+ width: 100%;
87
+ height: 100%;
88
+ background-color: var(--color-background-tertiary);
89
+ border-radius: var(--exo-spacing-2x-small);
90
+ overflow: hidden;
91
+ }
92
+
93
+ .progressRange {
94
+ height: 100%;
95
+ background-color: var(--color-background-selected);
96
+ border-radius: 2px;
97
+ transition: width 0.3s ease;
98
+ }
99
+
100
+ @mixin infoText {
101
+ @include typography.body-xs-reg;
102
+ display: flex;
103
+ gap: var(--spacing-3xs);
104
+ padding: var(--spacing-3xs) var(--spacing-sm);
105
+ }
106
+
107
+ .progressText {
108
+ @include infoText;
109
+ color: var(--color-font-secondary);
110
+ }
111
+
112
+ .completedText {
113
+ @include infoText;
114
+ color: var(--color-background-success-strong);
115
+ }
116
+
117
+ .interruptedText {
118
+ @include infoText;
119
+ color: var(--color-font-warning);
120
+ }
121
+
122
+ .errorMessage {
123
+ @include infoText;
124
+ color: var(--color-background-danger-strong);
125
+ }