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.
- package/accordion/accordion.js +4 -4
- package/accordion/panel.d.ts +1 -1
- package/accordion/stateless-accordion.js +8 -8
- package/accordion/styled-components.js +1 -1
- package/accordion/types.d.ts +1 -1
- package/app-nav-bar/mobile-menu.js +3 -1
- package/banner/banner.js +3 -1
- package/banner/types.d.ts +2 -1
- package/bottom-navigation/bottom-navigation.js +4 -6
- package/bottom-navigation/selector.js +1 -1
- package/bottom-navigation/styled-components.js +1 -1
- package/button/button.d.ts +1 -3
- package/button/button.js +6 -2
- package/button/styled-components.d.ts +1 -0
- package/button/styled-components.js +61 -4
- package/button/types.d.ts +15 -3
- package/button-timed/button-timed.js +4 -5
- package/button-timed/styled-components.js +5 -3
- package/button-timed/types.d.ts +1 -1
- package/data-table/column-categorical.js +2 -2
- package/data-table/column-numerical.js +3 -18
- package/data-table/locale.d.ts +2 -0
- package/data-table/locale.js +2 -1
- package/data-table/stateful-container.js +1 -1
- package/data-table/stateful-data-table.js +7 -3
- package/data-table/types.d.ts +2 -0
- package/datepicker/day.js +2 -4
- package/datepicker/utils/date-helpers.d.ts +1 -0
- package/datepicker/utils/date-helpers.js +3 -0
- package/dialog/dialog.d.ts +1 -1
- package/dialog/dialog.js +38 -56
- package/dialog/styled-components.d.ts +2 -2
- package/dialog/styled-components.js +56 -24
- package/dialog/types.d.ts +5 -2
- package/dnd-list/list.js +1 -1
- package/dnd-list/stateful-list-container.js +1 -1
- package/file-uploader/constants.d.ts +18 -0
- package/file-uploader/constants.js +32 -0
- package/file-uploader/file-uploader.d.ts +2 -2
- package/file-uploader/file-uploader.js +406 -117
- package/file-uploader/index.d.ts +1 -1
- package/file-uploader/index.js +67 -18
- package/file-uploader/locale.d.ts +10 -10
- package/file-uploader/locale.js +5 -5
- package/file-uploader/styled-components.d.ts +13 -6
- package/file-uploader/styled-components.js +261 -64
- package/file-uploader/types.d.ts +49 -32
- package/file-uploader/utils.d.ts +5 -0
- package/file-uploader/utils.js +45 -0
- package/file-uploader-basic/file-uploader-basic.d.ts +10 -0
- package/file-uploader-basic/file-uploader-basic.js +173 -0
- package/file-uploader-basic/index.d.ts +4 -0
- package/file-uploader-basic/index.js +71 -0
- package/file-uploader-basic/locale.d.ts +15 -0
- package/file-uploader-basic/locale.js +21 -0
- package/file-uploader-basic/styled-components.d.ts +7 -0
- package/file-uploader-basic/styled-components.js +83 -0
- package/file-uploader-basic/types.d.ts +41 -0
- package/form-control/form-control.js +38 -3
- package/form-control/styled-components.d.ts +2 -0
- package/form-control/styled-components.js +22 -2
- package/form-control/types.d.ts +4 -0
- package/helpers/react-helpers.js +1 -1
- package/icon/circle-check-filled.d.ts +9 -0
- package/icon/circle-check-filled.js +50 -0
- package/icon/circle-exclamation-point-filled.d.ts +9 -0
- package/icon/circle-exclamation-point-filled.js +50 -0
- package/icon/hide.js +1 -1
- package/icon/icon-exports.d.ts +4 -0
- package/icon/icon-exports.js +28 -0
- package/icon/paperclip-filled.d.ts +9 -0
- package/icon/paperclip-filled.js +50 -0
- package/icon/show.js +1 -1
- package/icon/trash-can-filled.d.ts +9 -0
- package/{button-docked/button-docked.js → icon/trash-can-filled.js} +35 -16
- package/list/list-item.js +0 -2
- package/locale/en_US.js +14 -12
- package/locale/es_AR.js +9 -1
- package/locale/index.d.ts +3 -0
- package/locale/index.js +1 -0
- package/locale/tr_TR.js +9 -1
- package/locale/types.d.ts +2 -0
- package/message-card/message-card.js +2 -2
- package/message-card/utils.js +8 -3
- package/mobile-header/mobile-header.js +0 -1
- package/modal/modal-button.d.ts +1 -3
- package/package.json +5 -2
- package/page-control/page-control.js +1 -3
- package/payment-card/custom-cards.config.d.ts +1 -11
- package/payment-card/payment-card.js +1 -3
- package/phone-input/base-country-picker.js +2 -2
- package/phone-input/country-picker.js +0 -10
- package/progress-bar/progressbar-rounded.js +1 -1
- package/progress-bar/styled-components.js +8 -6
- package/rating/styled-components.js +3 -2
- package/rating/svg-icons.d.ts +5 -5
- package/rating/svg-icons.js +20 -20
- package/segmented-control/segmented-control.js +1 -2
- package/segmented-control/stateful-segmented-control.js +1 -2
- package/select/multi-value.js +1 -1
- package/sheet/sheet.js +1 -3
- package/snackbar/index.d.ts +1 -0
- package/snackbar/snackbar-context.d.ts +1 -2
- package/snackbar/snackbar-context.js +27 -21
- package/spinner/index.d.ts +4 -2
- package/stepper/stepper.js +29 -30
- package/styles/__mocks__/styled.js +0 -2
- package/styles/as-primary-export-hoc.js +0 -2
- package/styles/styled.js +0 -2
- package/styles/types.d.ts +7 -3
- package/system-banner/system-banner.js +1 -3
- package/tabs-motion/tabs.js +2 -2
- package/tag/constants.d.ts +5 -4
- package/tag/constants.js +7 -6
- package/tag/index.d.ts +1 -1
- package/tag/index.js +7 -7
- package/tag/styled-components.d.ts +1 -1
- package/tag/styled-components.js +137 -124
- package/tag/tag.js +2 -2
- package/tag/types.d.ts +9 -8
- package/tag/types.js +2 -2
- package/themes/dark-theme/color-component-tokens.d.ts +2 -2
- package/themes/dark-theme/color-component-tokens.js +279 -275
- package/themes/dark-theme/color-foundation-tokens.d.ts +3 -0
- package/themes/dark-theme/{color-tokens.js → color-foundation-tokens.js} +11 -14
- package/themes/dark-theme/color-semantic-tokens.d.ts +2 -2
- package/themes/dark-theme/color-semantic-tokens.js +52 -58
- package/themes/dark-theme/create-dark-theme.d.ts +1 -1
- package/themes/dark-theme/create-dark-theme.js +12 -32
- package/themes/dark-theme/dark-theme.js +4 -4
- package/themes/dark-theme/primitives.js +2 -2
- package/themes/light-theme/color-component-tokens.d.ts +2 -2
- package/themes/light-theme/color-component-tokens.js +287 -282
- package/themes/light-theme/color-foundation-tokens.d.ts +3 -0
- package/themes/light-theme/{color-tokens.js → color-foundation-tokens.js} +10 -13
- package/themes/light-theme/color-semantic-tokens.d.ts +2 -2
- package/themes/light-theme/color-semantic-tokens.js +50 -53
- package/themes/light-theme/create-light-theme.d.ts +1 -1
- package/themes/light-theme/create-light-theme.js +12 -32
- package/themes/light-theme/light-theme.js +4 -4
- package/themes/light-theme/primitives.js +2 -2
- package/themes/types.d.ts +74 -13
- package/themes/utils.d.ts +1 -1
- package/themes/utils.js +4 -4
- package/tile/tile-group.js +2 -2
- package/timezonepicker/update-tzdata.js +0 -1
- package/tokens/color-primitive-tokens.d.ts +5 -0
- package/tokens/color-primitive-tokens.js +301 -0
- package/tokens/index.d.ts +5 -4
- package/tokens/index.js +25 -3
- package/tokens/types.d.ts +170 -1
- package/button-docked/button-docked.d.ts +0 -4
- package/button-docked/index.d.ts +0 -3
- package/button-docked/index.js +0 -40
- package/button-docked/styled-components.d.ts +0 -5
- package/button-docked/styled-components.js +0 -55
- package/button-docked/types.d.ts +0 -14
- package/themes/dark-theme/color-tokens.d.ts +0 -3
- package/themes/light-theme/color-tokens.d.ts +0 -3
- package/tokens/colors.d.ts +0 -3
- package/tokens/colors.js +0 -125
- /package/{button-docked → file-uploader-basic}/types.js +0 -0
package/file-uploader/index.js
CHANGED
|
@@ -5,12 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
FileUploader: true,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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, "
|
|
28
|
+
Object.defineProperty(exports, "StyledFileRow", {
|
|
22
29
|
enumerable: true,
|
|
23
30
|
get: function () {
|
|
24
|
-
return _styledComponents.
|
|
31
|
+
return _styledComponents.StyledFileRow;
|
|
25
32
|
}
|
|
26
33
|
});
|
|
27
|
-
Object.defineProperty(exports, "
|
|
34
|
+
Object.defineProperty(exports, "StyledFileRowColumn", {
|
|
28
35
|
enumerable: true,
|
|
29
36
|
get: function () {
|
|
30
|
-
return _styledComponents.
|
|
37
|
+
return _styledComponents.StyledFileRowColumn;
|
|
31
38
|
}
|
|
32
39
|
});
|
|
33
|
-
Object.defineProperty(exports, "
|
|
40
|
+
Object.defineProperty(exports, "StyledFileRowContent", {
|
|
34
41
|
enumerable: true,
|
|
35
42
|
get: function () {
|
|
36
|
-
return _styledComponents.
|
|
43
|
+
return _styledComponents.StyledFileRowContent;
|
|
37
44
|
}
|
|
38
45
|
});
|
|
39
|
-
Object.defineProperty(exports, "
|
|
46
|
+
Object.defineProperty(exports, "StyledFileRowFileName", {
|
|
40
47
|
enumerable: true,
|
|
41
48
|
get: function () {
|
|
42
|
-
return _styledComponents.
|
|
49
|
+
return _styledComponents.StyledFileRowFileName;
|
|
43
50
|
}
|
|
44
51
|
});
|
|
45
|
-
Object.defineProperty(exports, "
|
|
52
|
+
Object.defineProperty(exports, "StyledFileRowText", {
|
|
46
53
|
enumerable: true,
|
|
47
54
|
get: function () {
|
|
48
|
-
return _styledComponents.
|
|
55
|
+
return _styledComponents.StyledFileRowText;
|
|
49
56
|
}
|
|
50
57
|
});
|
|
51
|
-
Object.defineProperty(exports, "
|
|
58
|
+
Object.defineProperty(exports, "StyledFileRowUploadMessage", {
|
|
52
59
|
enumerable: true,
|
|
53
60
|
get: function () {
|
|
54
|
-
return _styledComponents.
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
added: string;
|
|
3
|
+
buttonText: string;
|
|
4
|
+
contentMessage: string;
|
|
5
|
+
error: string;
|
|
6
|
+
processed: string;
|
|
7
7
|
};
|
|
8
8
|
declare const locale: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
added: string;
|
|
10
|
+
buttonText: string;
|
|
11
|
+
contentMessage: string;
|
|
12
|
+
error: string;
|
|
13
|
+
processed: string;
|
|
14
14
|
};
|
|
15
15
|
export default locale;
|
package/file-uploader/locale.js
CHANGED
|
@@ -12,10 +12,10 @@ LICENSE file in the root directory of this source tree.
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const locale = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
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.
|
|
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
|
|
16
|
-
const
|
|
17
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
width: '100%'
|
|
57
|
+
width: '100%',
|
|
58
|
+
height: '100%',
|
|
59
|
+
justifyContent: 'space-between',
|
|
60
|
+
flexGrow: 1,
|
|
61
|
+
overflow: 'auto'
|
|
46
62
|
};
|
|
47
63
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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';
|
package/file-uploader/types.d.ts
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$
|
|
8
|
-
$
|
|
9
|
-
$
|
|
10
|
-
$
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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;
|