baseui 14.0.0 → 15.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 (162) hide show
  1. package/accordion/accordion.js +4 -4
  2. package/accordion/panel.d.ts +1 -1
  3. package/accordion/stateless-accordion.js +8 -8
  4. package/accordion/styled-components.js +1 -1
  5. package/accordion/types.d.ts +1 -1
  6. package/app-nav-bar/mobile-menu.js +3 -1
  7. package/banner/banner.js +3 -1
  8. package/banner/types.d.ts +2 -1
  9. package/bottom-navigation/bottom-navigation.js +4 -6
  10. package/bottom-navigation/selector.js +1 -1
  11. package/bottom-navigation/styled-components.js +1 -1
  12. package/button/button.d.ts +1 -3
  13. package/button/button.js +6 -2
  14. package/button/styled-components.d.ts +1 -0
  15. package/button/styled-components.js +61 -4
  16. package/button/types.d.ts +15 -3
  17. package/button-timed/button-timed.js +4 -5
  18. package/button-timed/styled-components.js +5 -3
  19. package/button-timed/types.d.ts +1 -1
  20. package/data-table/column-categorical.js +2 -2
  21. package/data-table/column-numerical.js +3 -18
  22. package/data-table/locale.d.ts +2 -0
  23. package/data-table/locale.js +2 -1
  24. package/data-table/stateful-container.js +1 -1
  25. package/data-table/stateful-data-table.js +7 -3
  26. package/data-table/types.d.ts +2 -0
  27. package/datepicker/day.js +2 -4
  28. package/datepicker/utils/date-helpers.d.ts +1 -0
  29. package/datepicker/utils/date-helpers.js +3 -0
  30. package/dialog/dialog.d.ts +1 -1
  31. package/dialog/dialog.js +38 -56
  32. package/dialog/styled-components.d.ts +2 -2
  33. package/dialog/styled-components.js +56 -24
  34. package/dialog/types.d.ts +5 -2
  35. package/dnd-list/list.js +1 -1
  36. package/dnd-list/stateful-list-container.js +1 -1
  37. package/file-uploader/constants.d.ts +18 -0
  38. package/file-uploader/constants.js +32 -0
  39. package/file-uploader/file-uploader.d.ts +2 -2
  40. package/file-uploader/file-uploader.js +406 -117
  41. package/file-uploader/index.d.ts +1 -1
  42. package/file-uploader/index.js +67 -18
  43. package/file-uploader/locale.d.ts +10 -10
  44. package/file-uploader/locale.js +5 -5
  45. package/file-uploader/styled-components.d.ts +13 -6
  46. package/file-uploader/styled-components.js +261 -64
  47. package/file-uploader/types.d.ts +49 -32
  48. package/file-uploader/utils.d.ts +5 -0
  49. package/file-uploader/utils.js +45 -0
  50. package/file-uploader-basic/file-uploader-basic.d.ts +10 -0
  51. package/file-uploader-basic/file-uploader-basic.js +173 -0
  52. package/file-uploader-basic/index.d.ts +4 -0
  53. package/file-uploader-basic/index.js +71 -0
  54. package/file-uploader-basic/locale.d.ts +15 -0
  55. package/file-uploader-basic/locale.js +21 -0
  56. package/file-uploader-basic/styled-components.d.ts +7 -0
  57. package/file-uploader-basic/styled-components.js +83 -0
  58. package/file-uploader-basic/types.d.ts +41 -0
  59. package/form-control/form-control.js +38 -3
  60. package/form-control/styled-components.d.ts +2 -0
  61. package/form-control/styled-components.js +22 -2
  62. package/form-control/types.d.ts +4 -0
  63. package/helpers/react-helpers.js +1 -1
  64. package/icon/circle-check-filled.d.ts +9 -0
  65. package/icon/circle-check-filled.js +50 -0
  66. package/icon/circle-exclamation-point-filled.d.ts +9 -0
  67. package/icon/circle-exclamation-point-filled.js +50 -0
  68. package/icon/hide.js +1 -1
  69. package/icon/icon-exports.d.ts +4 -0
  70. package/icon/icon-exports.js +28 -0
  71. package/icon/paperclip-filled.d.ts +9 -0
  72. package/icon/paperclip-filled.js +50 -0
  73. package/icon/show.js +1 -1
  74. package/icon/trash-can-filled.d.ts +9 -0
  75. package/{button-docked/button-docked.js → icon/trash-can-filled.js} +35 -16
  76. package/list/list-item.js +0 -2
  77. package/locale/en_US.js +14 -12
  78. package/locale/es_AR.js +9 -1
  79. package/locale/index.d.ts +3 -0
  80. package/locale/index.js +1 -0
  81. package/locale/tr_TR.js +9 -1
  82. package/locale/types.d.ts +2 -0
  83. package/message-card/message-card.js +2 -2
  84. package/message-card/utils.js +8 -3
  85. package/mobile-header/mobile-header.js +0 -1
  86. package/modal/modal-button.d.ts +1 -3
  87. package/package.json +5 -2
  88. package/page-control/page-control.js +1 -3
  89. package/payment-card/custom-cards.config.d.ts +1 -11
  90. package/payment-card/payment-card.js +1 -3
  91. package/phone-input/base-country-picker.js +2 -2
  92. package/phone-input/country-picker.js +0 -10
  93. package/progress-bar/progressbar-rounded.js +1 -1
  94. package/progress-bar/styled-components.js +8 -6
  95. package/rating/styled-components.js +3 -2
  96. package/rating/svg-icons.d.ts +5 -5
  97. package/rating/svg-icons.js +20 -20
  98. package/segmented-control/segmented-control.js +1 -2
  99. package/segmented-control/stateful-segmented-control.js +1 -2
  100. package/select/multi-value.js +1 -1
  101. package/sheet/sheet.js +1 -3
  102. package/snackbar/index.d.ts +1 -0
  103. package/snackbar/snackbar-context.d.ts +1 -2
  104. package/snackbar/snackbar-context.js +27 -21
  105. package/spinner/index.d.ts +4 -2
  106. package/stepper/stepper.js +29 -30
  107. package/styles/__mocks__/styled.js +0 -2
  108. package/styles/as-primary-export-hoc.js +0 -2
  109. package/styles/styled.js +0 -2
  110. package/styles/types.d.ts +7 -3
  111. package/system-banner/system-banner.js +1 -3
  112. package/tabs-motion/tabs.js +2 -2
  113. package/tag/constants.d.ts +5 -4
  114. package/tag/constants.js +7 -6
  115. package/tag/index.d.ts +1 -1
  116. package/tag/index.js +7 -7
  117. package/tag/styled-components.d.ts +1 -1
  118. package/tag/styled-components.js +137 -124
  119. package/tag/tag.js +2 -2
  120. package/tag/types.d.ts +9 -8
  121. package/tag/types.js +2 -2
  122. package/themes/dark-theme/color-component-tokens.d.ts +2 -2
  123. package/themes/dark-theme/color-component-tokens.js +279 -275
  124. package/themes/dark-theme/color-foundation-tokens.d.ts +3 -0
  125. package/themes/dark-theme/{color-tokens.js → color-foundation-tokens.js} +11 -14
  126. package/themes/dark-theme/color-semantic-tokens.d.ts +2 -2
  127. package/themes/dark-theme/color-semantic-tokens.js +52 -58
  128. package/themes/dark-theme/create-dark-theme.d.ts +1 -1
  129. package/themes/dark-theme/create-dark-theme.js +12 -32
  130. package/themes/dark-theme/dark-theme.js +4 -4
  131. package/themes/dark-theme/primitives.js +2 -2
  132. package/themes/light-theme/color-component-tokens.d.ts +2 -2
  133. package/themes/light-theme/color-component-tokens.js +287 -282
  134. package/themes/light-theme/color-foundation-tokens.d.ts +3 -0
  135. package/themes/light-theme/{color-tokens.js → color-foundation-tokens.js} +10 -13
  136. package/themes/light-theme/color-semantic-tokens.d.ts +2 -2
  137. package/themes/light-theme/color-semantic-tokens.js +50 -53
  138. package/themes/light-theme/create-light-theme.d.ts +1 -1
  139. package/themes/light-theme/create-light-theme.js +12 -32
  140. package/themes/light-theme/light-theme.js +4 -4
  141. package/themes/light-theme/primitives.js +2 -2
  142. package/themes/types.d.ts +74 -13
  143. package/themes/utils.d.ts +1 -1
  144. package/themes/utils.js +4 -4
  145. package/tile/tile-group.js +2 -2
  146. package/timezonepicker/update-tzdata.js +0 -1
  147. package/tokens/color-primitive-tokens.d.ts +5 -0
  148. package/tokens/color-primitive-tokens.js +301 -0
  149. package/tokens/index.d.ts +5 -4
  150. package/tokens/index.js +25 -3
  151. package/tokens/types.d.ts +170 -1
  152. package/button-docked/button-docked.d.ts +0 -4
  153. package/button-docked/index.d.ts +0 -3
  154. package/button-docked/index.js +0 -40
  155. package/button-docked/styled-components.d.ts +0 -5
  156. package/button-docked/styled-components.js +0 -55
  157. package/button-docked/types.d.ts +0 -14
  158. package/themes/dark-theme/color-tokens.d.ts +0 -3
  159. package/themes/light-theme/color-tokens.d.ts +0 -3
  160. package/tokens/colors.d.ts +0 -3
  161. package/tokens/colors.js +0 -125
  162. /package/{button-docked → file-uploader-basic}/types.js +0 -0
@@ -5,12 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  FileUploader: true,
8
- StyledRoot: true,
9
- StyledFileDragAndDrop: true,
10
- StyledContentMessage: true,
11
- StyledContentSeparator: true,
12
- StyledErrorMessage: true,
13
- StyledHiddenInput: true
8
+ StyledFileRow: true,
9
+ StyledFileRowColumn: true,
10
+ StyledFileRowContent: true,
11
+ StyledFileRowFileName: true,
12
+ StyledFileRowText: true,
13
+ StyledFileRowUploadMessage: true,
14
+ StyledFileRowUploadText: true,
15
+ StyledFileRows: true,
16
+ StyledHint: true,
17
+ StyledImagePreviewThumbnail: true,
18
+ StyledItemPreviewContainer: true,
19
+ StyledLabel: true,
20
+ StyledParentRoot: true
14
21
  };
15
22
  Object.defineProperty(exports, "FileUploader", {
16
23
  enumerable: true,
@@ -18,40 +25,82 @@ Object.defineProperty(exports, "FileUploader", {
18
25
  return _fileUploader.default;
19
26
  }
20
27
  });
21
- Object.defineProperty(exports, "StyledContentMessage", {
28
+ Object.defineProperty(exports, "StyledFileRow", {
22
29
  enumerable: true,
23
30
  get: function () {
24
- return _styledComponents.StyledContentMessage;
31
+ return _styledComponents.StyledFileRow;
25
32
  }
26
33
  });
27
- Object.defineProperty(exports, "StyledContentSeparator", {
34
+ Object.defineProperty(exports, "StyledFileRowColumn", {
28
35
  enumerable: true,
29
36
  get: function () {
30
- return _styledComponents.StyledContentSeparator;
37
+ return _styledComponents.StyledFileRowColumn;
31
38
  }
32
39
  });
33
- Object.defineProperty(exports, "StyledErrorMessage", {
40
+ Object.defineProperty(exports, "StyledFileRowContent", {
34
41
  enumerable: true,
35
42
  get: function () {
36
- return _styledComponents.StyledErrorMessage;
43
+ return _styledComponents.StyledFileRowContent;
37
44
  }
38
45
  });
39
- Object.defineProperty(exports, "StyledFileDragAndDrop", {
46
+ Object.defineProperty(exports, "StyledFileRowFileName", {
40
47
  enumerable: true,
41
48
  get: function () {
42
- return _styledComponents.StyledFileDragAndDrop;
49
+ return _styledComponents.StyledFileRowFileName;
43
50
  }
44
51
  });
45
- Object.defineProperty(exports, "StyledHiddenInput", {
52
+ Object.defineProperty(exports, "StyledFileRowText", {
46
53
  enumerable: true,
47
54
  get: function () {
48
- return _styledComponents.StyledHiddenInput;
55
+ return _styledComponents.StyledFileRowText;
49
56
  }
50
57
  });
51
- Object.defineProperty(exports, "StyledRoot", {
58
+ Object.defineProperty(exports, "StyledFileRowUploadMessage", {
52
59
  enumerable: true,
53
60
  get: function () {
54
- return _styledComponents.StyledRoot;
61
+ return _styledComponents.StyledFileRowUploadMessage;
62
+ }
63
+ });
64
+ Object.defineProperty(exports, "StyledFileRowUploadText", {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _styledComponents.StyledFileRowUploadText;
68
+ }
69
+ });
70
+ Object.defineProperty(exports, "StyledFileRows", {
71
+ enumerable: true,
72
+ get: function () {
73
+ return _styledComponents.StyledFileRows;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, "StyledHint", {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _styledComponents.StyledHint;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "StyledImagePreviewThumbnail", {
83
+ enumerable: true,
84
+ get: function () {
85
+ return _styledComponents.StyledImagePreviewThumbnail;
86
+ }
87
+ });
88
+ Object.defineProperty(exports, "StyledItemPreviewContainer", {
89
+ enumerable: true,
90
+ get: function () {
91
+ return _styledComponents.StyledItemPreviewContainer;
92
+ }
93
+ });
94
+ Object.defineProperty(exports, "StyledLabel", {
95
+ enumerable: true,
96
+ get: function () {
97
+ return _styledComponents.StyledLabel;
98
+ }
99
+ });
100
+ Object.defineProperty(exports, "StyledParentRoot", {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _styledComponents.StyledParentRoot;
55
104
  }
56
105
  });
57
106
  var _fileUploader = _interopRequireDefault(require("./file-uploader"));
@@ -1,15 +1,15 @@
1
1
  export type FileUploaderLocale = {
2
- dropFilesToUpload: string;
3
- or: string;
4
- browseFiles: string;
5
- retry: string;
6
- cancel: string;
2
+ added: string;
3
+ buttonText: string;
4
+ contentMessage: string;
5
+ error: string;
6
+ processed: string;
7
7
  };
8
8
  declare const locale: {
9
- dropFilesToUpload: string;
10
- or: string;
11
- browseFiles: string;
12
- retry: string;
13
- cancel: string;
9
+ added: string;
10
+ buttonText: string;
11
+ contentMessage: string;
12
+ error: string;
13
+ processed: string;
14
14
  };
15
15
  export default locale;
@@ -12,10 +12,10 @@ LICENSE file in the root directory of this source tree.
12
12
  */
13
13
 
14
14
  const locale = {
15
- dropFilesToUpload: 'Drop files here to upload...',
16
- or: '',
17
- browseFiles: 'Browse files',
18
- retry: 'Retry Upload',
19
- cancel: 'Cancel'
15
+ added: 'Uploading',
16
+ buttonText: 'Browse files',
17
+ contentMessage: 'or drop to upload',
18
+ error: 'Upload failed: ',
19
+ processed: 'Upload successful'
20
20
  };
21
21
  var _default = exports.default = locale;
@@ -1,7 +1,14 @@
1
1
  import type { StyleProps } from './types';
2
- export declare const StyledFileDragAndDrop: import("styletron-react").StyletronComponent<"div", StyleProps>;
3
- export declare const StyledContentMessage: import("styletron-react").StyletronComponent<"div", StyleProps>;
4
- export declare const StyledContentSeparator: import("styletron-react").StyletronComponent<"div", StyleProps>;
5
- export declare const StyledErrorMessage: import("styletron-react").StyletronComponent<"div", StyleProps>;
6
- export declare const StyledRoot: import("styletron-react").StyletronComponent<"div", StyleProps>;
7
- export declare const StyledHiddenInput: import("styletron-react").StyletronComponent<"input", {}>;
2
+ export declare const StyledFileRow: import("styletron-react").StyletronComponent<"li", StyleProps>;
3
+ export declare const StyledFileRowColumn: import("styletron-react").StyletronComponent<"div", StyleProps>;
4
+ export declare const StyledFileRowContent: import("styletron-react").StyletronComponent<"div", StyleProps>;
5
+ export declare const StyledFileRowFileName: import("styletron-react").StyletronComponent<"div", StyleProps>;
6
+ export declare const StyledFileRowText: import("styletron-react").StyletronComponent<"div", StyleProps>;
7
+ export declare const StyledFileRowUploadMessage: import("styletron-react").StyletronComponent<"div", StyleProps>;
8
+ export declare const StyledFileRowUploadText: import("styletron-react").StyletronComponent<"div", StyleProps>;
9
+ export declare const StyledFileRows: import("styletron-react").StyletronComponent<"ul", StyleProps>;
10
+ export declare const StyledHint: import("styletron-react").StyletronComponent<"div", StyleProps>;
11
+ export declare const StyledImagePreviewThumbnail: import("styletron-react").StyletronComponent<"img", StyleProps>;
12
+ export declare const StyledItemPreviewContainer: import("styletron-react").StyletronComponent<"div", StyleProps>;
13
+ export declare const StyledLabel: import("styletron-react").StyletronComponent<"label", StyleProps>;
14
+ export declare const StyledParentRoot: import("styletron-react").StyletronComponent<"div", StyleProps>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledRoot = exports.StyledHiddenInput = exports.StyledFileDragAndDrop = exports.StyledErrorMessage = exports.StyledContentSeparator = exports.StyledContentMessage = void 0;
6
+ exports.StyledParentRoot = exports.StyledLabel = exports.StyledItemPreviewContainer = exports.StyledImagePreviewThumbnail = exports.StyledHint = exports.StyledFileRows = exports.StyledFileRowUploadText = exports.StyledFileRowUploadMessage = exports.StyledFileRowText = exports.StyledFileRowFileName = exports.StyledFileRowContent = exports.StyledFileRowColumn = exports.StyledFileRow = void 0;
7
7
  var _styles = require("../styles");
8
8
  /*
9
9
  Copyright (c) Uber Technologies, Inc.
@@ -12,72 +12,269 @@ This source code is licensed under the MIT license found in the
12
12
  LICENSE file in the root directory of this source tree.
13
13
  */
14
14
 
15
- const StyledFileDragAndDrop = exports.StyledFileDragAndDrop = (0, _styles.styled)('div', props => {
16
- const borderColor = props.$isDragActive ? props.$theme.colors.borderAccent : props.$theme.colors.fileUploaderBorderColorDefault;
17
- const borderStyle = props.$afterFileDrop ? 'none' : 'dashed';
15
+ const StyledFileRow = exports.StyledFileRow = (0, _styles.styled)('li', props => {
16
+ const {
17
+ $theme: {
18
+ animation,
19
+ sizing
20
+ }
21
+ } = props;
22
+ return {
23
+ animationDuration: animation.timing400,
24
+ animationFillMode: 'forwards',
25
+ animationIterationCount: 1,
26
+ animationTimingFunction: animation.easeOutQuinticCurve,
27
+ animationName: {
28
+ '0%': {
29
+ transform: 'translateY(-32px)',
30
+ opacity: 0
31
+ },
32
+ '50%': {
33
+ opacity: 1
34
+ },
35
+ '100%': {
36
+ transform: 'translateY(0px)',
37
+ opacity: 1
38
+ }
39
+ },
40
+ paddingTop: sizing.scale500,
41
+ paddingRight: sizing.scale500,
42
+ paddingBottom: sizing.scale500,
43
+ paddingLeft: sizing.scale500,
44
+ gap: sizing.scale500,
45
+ height: 'fit-content',
46
+ display: 'flex',
47
+ alignItems: 'center'
48
+ };
49
+ });
50
+ StyledFileRow.displayName = "StyledFileRow";
51
+ StyledFileRow.displayName = 'StyledFileRow';
52
+ const StyledFileRowColumn = exports.StyledFileRowColumn = (0, _styles.styled)('div', () => {
18
53
  return {
19
54
  alignItems: 'center',
20
- backgroundColor: props.$isDragActive ? props.$theme.colors.backgroundAccentLight : props.$theme.colors.fileUploaderBackgroundColor,
21
- borderLeftColor: borderColor,
22
- borderRightColor: borderColor,
23
- borderTopColor: borderColor,
24
- borderBottomColor: borderColor,
25
- borderLeftStyle: borderStyle,
26
- borderRightStyle: borderStyle,
27
- borderTopStyle: borderStyle,
28
- borderBottomStyle: borderStyle,
29
- borderLeftWidth: props.$theme.sizing.scale0,
30
- borderRightWidth: props.$theme.sizing.scale0,
31
- borderTopWidth: props.$theme.sizing.scale0,
32
- borderBottomWidth: props.$theme.sizing.scale0,
33
- borderTopLeftRadius: props.$theme.borders.radius400,
34
- borderTopRightRadius: props.$theme.borders.radius400,
35
- borderBottomLeftRadius: props.$theme.borders.radius400,
36
- borderBottomRightRadius: props.$theme.borders.radius400,
37
- boxSizing: 'border-box',
38
55
  display: 'flex',
39
56
  flexDirection: 'column',
40
- outline: 'none',
41
- paddingTop: props.$theme.sizing.scale900,
42
- paddingRight: props.$theme.sizing.scale800,
43
- paddingBottom: props.$afterFileDrop ? props.$theme.sizing.scale300 : props.$theme.sizing.scale900,
44
- paddingLeft: props.$theme.sizing.scale800,
45
- width: '100%'
57
+ width: '100%',
58
+ height: '100%',
59
+ justifyContent: 'space-between',
60
+ flexGrow: 1,
61
+ overflow: 'auto'
46
62
  };
47
63
  });
48
- StyledFileDragAndDrop.displayName = "StyledFileDragAndDrop";
49
- StyledFileDragAndDrop.displayName = 'StyledFileDragAndDrop';
50
- const StyledContentMessage = exports.StyledContentMessage = (0, _styles.styled)('div',
51
- // @ts-ignore
52
- ({
53
- $theme,
54
- $afterFileDrop,
55
- $isDragActive
56
- }) => ({
57
- ...($afterFileDrop ? $theme.typography.LabelMedium : $theme.typography.LabelSmall),
58
- color: $afterFileDrop ? $theme.colors.contentPrimary : $isDragActive ? $theme.colors.contentAccent : null,
59
- marginTop: $afterFileDrop ? $theme.sizing.scale100 : null,
60
- marginBottom: $afterFileDrop ? $theme.sizing.scale100 : null
61
- }));
62
- StyledContentMessage.displayName = "StyledContentMessage";
63
- StyledContentMessage.displayName = 'StyledContentMessage';
64
- const StyledContentSeparator = exports.StyledContentSeparator = StyledContentMessage;
65
-
66
- // @ts-ignore
67
- const StyledErrorMessage = exports.StyledErrorMessage = (0, _styles.styled)('div', props => ({
68
- ...props.$theme.typography.LabelMedium,
69
- color: props.$theme.colors.contentNegative,
70
- marginTop: props.$afterFileDrop ? props.$theme.sizing.scale100 : null,
71
- marginBottom: props.$afterFileDrop ? props.$theme.sizing.scale100 : null
72
- }));
73
- StyledErrorMessage.displayName = "StyledErrorMessage";
74
- StyledErrorMessage.displayName = 'StyledErrorMessage';
75
- const StyledRoot = exports.StyledRoot = (0, _styles.styled)('div', props => ({
76
- ...props.$theme.typography.font300,
77
- color: props.$theme.colors.fileUploaderMessageColor
78
- }));
79
- StyledRoot.displayName = "StyledRoot";
80
- StyledRoot.displayName = 'StyledRoot';
81
- const StyledHiddenInput = exports.StyledHiddenInput = (0, _styles.styled)('input', {});
82
- StyledHiddenInput.displayName = "StyledHiddenInput";
83
- StyledHiddenInput.displayName = 'StyledHiddenInput';
64
+ StyledFileRowColumn.displayName = "StyledFileRowColumn";
65
+ StyledFileRowColumn.displayName = 'StyledFileRowColumn';
66
+ const StyledFileRowContent = exports.StyledFileRowContent = (0, _styles.styled)('div', props => {
67
+ const {
68
+ $theme: {
69
+ sizing
70
+ }
71
+ } = props;
72
+ return {
73
+ alignItems: 'center',
74
+ display: 'flex',
75
+ flexDirection: 'row',
76
+ gap: sizing.scale500,
77
+ justifyContent: 'space-between',
78
+ width: '100%',
79
+ height: sizing.scale1000
80
+ };
81
+ });
82
+ StyledFileRowContent.displayName = "StyledFileRowContent";
83
+ StyledFileRowContent.displayName = 'StyledFileRowContent';
84
+ const StyledFileRowFileName = exports.StyledFileRowFileName = (0, _styles.styled)('div', props => {
85
+ const {
86
+ $theme: {
87
+ colors,
88
+ typography
89
+ }
90
+ } = props;
91
+ return {
92
+ ...typography.LabelSmall,
93
+ color: colors.contentPrimary,
94
+ width: '100%',
95
+ textOverflow: 'ellipsis',
96
+ overflow: 'hidden',
97
+ whiteSpace: 'nowrap'
98
+ };
99
+ });
100
+ StyledFileRowFileName.displayName = "StyledFileRowFileName";
101
+ StyledFileRowColumn.displayName = 'StyledFileRowColumn';
102
+ const StyledFileRowText = exports.StyledFileRowText = (0, _styles.styled)('div', props => {
103
+ const {
104
+ $theme: {
105
+ sizing
106
+ }
107
+ } = props;
108
+ return {
109
+ display: 'flex',
110
+ flexDirection: 'column',
111
+ height: '100%',
112
+ width: '100%',
113
+ gap: sizing.scale0,
114
+ flexGrow: 1,
115
+ overflow: 'auto'
116
+ };
117
+ });
118
+ StyledFileRowText.displayName = "StyledFileRowText";
119
+ StyledFileRowColumn.displayName = 'StyledFileRowColumn';
120
+ const StyledFileRowUploadMessage = exports.StyledFileRowUploadMessage = (0, _styles.styled)('div', props => {
121
+ const {
122
+ $color,
123
+ $theme: {
124
+ sizing,
125
+ typography
126
+ }
127
+ } = props;
128
+ return {
129
+ ...typography.ParagraphXSmall,
130
+ color: $color,
131
+ alignItems: 'center',
132
+ gap: sizing.scale100,
133
+ display: 'flex',
134
+ flexDirection: 'row'
135
+ };
136
+ });
137
+ StyledFileRowUploadMessage.displayName = "StyledFileRowUploadMessage";
138
+ StyledFileRowUploadMessage.displayName = 'StyledFileRowUploadMessage';
139
+ const StyledFileRowUploadText = exports.StyledFileRowUploadText = (0, _styles.styled)('div', props => {
140
+ const {
141
+ $color
142
+ } = props;
143
+ return {
144
+ color: $color ? $color : 'inherit',
145
+ width: '100%',
146
+ textOverflow: 'ellipsis',
147
+ overflow: 'hidden',
148
+ whiteSpace: 'nowrap'
149
+ };
150
+ });
151
+ StyledFileRowUploadText.displayName = "StyledFileRowUploadText";
152
+ StyledFileRowUploadText.displayName = 'StyledFileRowUploadText';
153
+ const StyledFileRows = exports.StyledFileRows = (0, _styles.styled)('ul', props => {
154
+ const {
155
+ $theme: {
156
+ animation,
157
+ borders,
158
+ sizing
159
+ }
160
+ } = props;
161
+ return {
162
+ animationDuration: animation.timing500,
163
+ animationIterationCount: 1,
164
+ animationTimingFunction: animation.easeInOutQuinticCurve,
165
+ animationName: {
166
+ '0%': {
167
+ transform: 'translateY(-32px)'
168
+ },
169
+ '100%': {
170
+ transform: 'translateX(-0px)'
171
+ }
172
+ },
173
+ ...borders.border200,
174
+ borderRadius: borders.radius400,
175
+ borderWidth: sizing.scale0,
176
+ listStyle: 'none',
177
+ padding: 0,
178
+ marginTop: 0,
179
+ marginBottom: sizing.scale300
180
+ };
181
+ });
182
+ StyledFileRows.displayName = "StyledFileRows";
183
+ StyledFileRows.displayName = 'StyledFileRows';
184
+ const StyledHint = exports.StyledHint = (0, _styles.styled)('div', props => {
185
+ const {
186
+ $fileCount,
187
+ $theme: {
188
+ animation,
189
+ colors,
190
+ typography
191
+ }
192
+ } = props;
193
+ let fontColor = colors.contentTertiary;
194
+ const animations = $fileCount > 0 ? {
195
+ animationDuration: animation.timing500,
196
+ animationIterationCount: 1,
197
+ animationTimingFunction: animation.easeInOutQuinticCurve,
198
+ animationName: {
199
+ '0%': {
200
+ transform: 'translateY(-32px)'
201
+ },
202
+ '100%': {
203
+ transform: 'translateX(-0px)'
204
+ }
205
+ }
206
+ } : {};
207
+ return {
208
+ ...animations,
209
+ ...typography.ParagraphSmall,
210
+ color: fontColor
211
+ };
212
+ });
213
+ StyledHint.displayName = "StyledHint";
214
+ StyledHint.displayName = 'StyledHint';
215
+ const StyledImagePreviewThumbnail = exports.StyledImagePreviewThumbnail = (0, _styles.styled)('img', props => {
216
+ const {
217
+ $alt,
218
+ $src,
219
+ $theme: {
220
+ borders,
221
+ colors
222
+ }
223
+ } = props;
224
+ return {
225
+ alt: $alt,
226
+ borderRadius: borders.radius300,
227
+ outline: `1px ${colors.borderTransparent}`,
228
+ className: 'thumb',
229
+ src: $src,
230
+ width: '100%',
231
+ height: '100%',
232
+ objectFit: 'cover'
233
+ };
234
+ });
235
+ StyledImagePreviewThumbnail.displayName = "StyledImagePreviewThumbnail";
236
+ StyledImagePreviewThumbnail.displayName = 'StyledImagePreviewThumbnail';
237
+ const StyledItemPreviewContainer = exports.StyledItemPreviewContainer = (0, _styles.styled)('div', props => {
238
+ const {
239
+ $theme: {
240
+ sizing
241
+ }
242
+ } = props;
243
+ return {
244
+ display: 'flex',
245
+ alignItems: 'center',
246
+ justifyContent: 'center',
247
+ flexShrink: 0,
248
+ width: sizing.scale1200,
249
+ height: sizing.scale1200
250
+ };
251
+ });
252
+ StyledItemPreviewContainer.displayName = "StyledItemPreviewContainer";
253
+ StyledItemPreviewContainer.displayName = 'StyledItemPreviewContainer';
254
+ const StyledLabel = exports.StyledLabel = (0, _styles.styled)('label', props => {
255
+ const {
256
+ $disabled,
257
+ $theme: {
258
+ colors,
259
+ sizing,
260
+ typography
261
+ }
262
+ } = props;
263
+ return {
264
+ ...typography.LabelSmall,
265
+ width: '100%',
266
+ color: $disabled ? colors.contentStateDisabled : colors.contentPrimary,
267
+ display: 'block',
268
+ marginBottom: sizing.scale300
269
+ };
270
+ });
271
+ StyledLabel.displayName = "StyledLabel";
272
+ StyledLabel.displayName = 'StyledLabel';
273
+ const StyledParentRoot = exports.StyledParentRoot = (0, _styles.styled)('div', () => {
274
+ return {
275
+ display: 'flex',
276
+ flexDirection: 'column'
277
+ };
278
+ });
279
+ StyledParentRoot.displayName = "StyledParentRoot";
280
+ StyledParentRoot.displayName = 'StyledParentRoot';
@@ -1,37 +1,54 @@
1
- import type { DropzoneProps } from 'react-dropzone';
2
- import type { DragEvent } from 'react';
3
1
  import type { Override } from '../helpers/overrides';
4
- export type StyleProps = {
5
- $afterFileDrop: boolean;
6
- $isDisabled: boolean;
7
- $isDragActive: boolean;
8
- $isDragAccept: boolean;
9
- $isDragReject: boolean;
10
- $isFocused: boolean;
2
+ import type { FILE_STATUS } from './constants';
3
+ import type { FileUploaderBasicOverrides, FileUploaderBasicProps, StyleProps as FileUploaderBasicStyleProps } from '../file-uploader-basic/types';
4
+ export type StyleProps = FileUploaderBasicStyleProps & {
5
+ $alt: string;
6
+ $color: string;
7
+ $fileCount: number;
8
+ $src: string;
11
9
  };
12
10
  export type FileUploaderOverrides = {
13
- Root?: Override;
14
- FileDragAndDrop?: Override;
15
- ContentMessage?: Override;
16
- ContentSeparator?: Override;
17
- HiddenInput?: Override;
18
- ProgressMessage?: Override;
19
- ErrorMessage?: Override;
20
- ButtonComponent?: Override;
21
- CancelButtonComponent?: Override;
22
- RetryButtonComponent?: Override;
23
- Spinner?: Override;
24
- ProgressBar?: Override;
11
+ CircleCheckFilledIcon?: Override;
12
+ CircleExclamationPointFilledIcon?: Override;
13
+ DeleteButtonComponent?: Override;
14
+ FileRow?: Override;
15
+ FileRowColumn?: Override;
16
+ FileRowContent?: Override;
17
+ FileRowFileName?: Override;
18
+ FileRowText?: Override;
19
+ FileRowUploadMessage?: Override;
20
+ FileRowUploadText?: Override;
21
+ FileRows?: Override;
22
+ Hint?: Override;
23
+ ImagePreviewThumbnail?: Override;
24
+ ItemPreviewContainer?: Override;
25
+ Label?: Override;
26
+ PaperclipFilledIcon?: Override;
27
+ ParentRoot?: Override;
28
+ TrashCanFilledIcon?: Override;
25
29
  };
26
- export type FileUploaderProps = Omit<DropzoneProps, 'accept'> & {
27
- accept?: string[] | string;
28
- disableClick?: boolean;
29
- 'aria-describedby'?: string;
30
- errorMessage?: string;
31
- onCancel?: () => unknown;
32
- onRetry?: () => unknown;
33
- overrides?: FileUploaderOverrides;
34
- progressAmount?: number;
35
- progressMessage?: string;
30
+ export type FileRow = {
31
+ errorMessage: string | null;
32
+ file: File;
33
+ id: string;
34
+ fileInfo?: any;
35
+ imagePreviewThumbnail?: any;
36
+ progressAmount: number;
37
+ /** Defines the status of a file */
38
+ status: keyof typeof FILE_STATUS;
39
+ };
40
+ export type FileUploaderProps = Omit<FileUploaderBasicProps, 'onDrop' | 'onDropAccepted' | 'onDropRejected' | 'overrides'> & {
41
+ fileRows: FileRow[];
42
+ hint?: string;
43
+ itemPreview?: boolean;
44
+ label?: string;
45
+ maxFiles?: number;
46
+ overrides?: FileUploaderBasicOverrides & FileUploaderOverrides;
47
+ /** Function to run on each file, returns "errorMessage: null" on success and "errorMessage: string" for failures */
48
+ processFileOnDrop?: (fileToProcess: File, fileToProcessId: string, fileRows: FileRow[]) => Promise<{
49
+ errorMessage: string | null;
50
+ fileInfo?: any;
51
+ }>;
52
+ progressAmountStartValue?: number;
53
+ setFileRows: (fileRows: FileRow[]) => void;
36
54
  };
37
- export type DropFilesEventHandler = (accepted: File[], rejected: File[], event: DragEvent<HTMLElement>) => unknown;
@@ -0,0 +1,5 @@
1
+ import type { Theme } from '../styles';
2
+ import { type ARIA_LIVE_ELEMENT_ID } from './constants';
3
+ export declare const destructureStyleOverride: (styleOverride: any, theme: Theme) => any;
4
+ export declare const formatBytes: (bytes: number) => string;
5
+ export declare const handleAriaLiveUpdates: (elementId: ARIA_LIVE_ELEMENT_ID, updateMessage: string) => void;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleAriaLiveUpdates = exports.formatBytes = exports.destructureStyleOverride = void 0;
7
+ var _constants = require("./constants");
8
+ /*
9
+ Copyright (c) Uber Technologies, Inc.
10
+
11
+ This source code is licensed under the MIT license found in the
12
+ LICENSE file in the root directory of this source tree.
13
+ */
14
+
15
+ const destructureStyleOverride = (styleOverride, theme) => {
16
+ if (typeof styleOverride === 'function') {
17
+ return styleOverride({
18
+ $theme: theme
19
+ });
20
+ } else {
21
+ return styleOverride;
22
+ }
23
+ };
24
+ exports.destructureStyleOverride = destructureStyleOverride;
25
+ const formatBytes = bytes => {
26
+ if (bytes === 0) return '0 bytes';
27
+ const k = 1000;
28
+ const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
29
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
30
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
31
+ };
32
+ exports.formatBytes = formatBytes;
33
+ const handleAriaLiveUpdates = (elementId, updateMessage) => {
34
+ const liveRegion = document.getElementById(elementId);
35
+ if (liveRegion) {
36
+ liveRegion.textContent = updateMessage;
37
+ }
38
+ setTimeout(() => {
39
+ const liveRegion = document.getElementById(elementId);
40
+ if (liveRegion) {
41
+ liveRegion.textContent = null;
42
+ }
43
+ }, _constants.ARIA_LIVE_TIMEOUT_MS);
44
+ };
45
+ exports.handleAriaLiveUpdates = handleAriaLiveUpdates;