baseui 0.0.0-next-bdd41d47f → 0.0.0-next-18f01efe0
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/file-uploader/types.d.ts +0 -3
- package/file-uploader-beta/file-uploader-beta.js +14 -5
- package/file-uploader-beta/styled-components.js +46 -0
- package/file-uploader-beta/types.d.ts +3 -8
- package/file-uploader-beta/utils.d.ts +2 -0
- package/file-uploader-beta/utils.js +12 -1
- package/package.json +1 -1
package/file-uploader/types.d.ts
CHANGED
|
@@ -3,14 +3,11 @@ import type { DragEvent } from 'react';
|
|
|
3
3
|
import type { Override } from '../helpers/overrides';
|
|
4
4
|
export type StyleProps = {
|
|
5
5
|
$afterFileDrop: boolean;
|
|
6
|
-
$alt: string;
|
|
7
|
-
$color: string;
|
|
8
6
|
$disabled: boolean;
|
|
9
7
|
$isDragActive: boolean;
|
|
10
8
|
$isDragAccept: boolean;
|
|
11
9
|
$isDragReject: boolean;
|
|
12
10
|
$isFocused: boolean;
|
|
13
|
-
$src: string;
|
|
14
11
|
};
|
|
15
12
|
export type FileUploaderOverrides = {
|
|
16
13
|
Root?: Override;
|
|
@@ -199,7 +199,7 @@ function FileUploaderBeta(props) {
|
|
|
199
199
|
style: {
|
|
200
200
|
marginTop: 0,
|
|
201
201
|
// @ts-expect-error
|
|
202
|
-
...props.overrides?.ButtonComponent?.props?.style
|
|
202
|
+
...(0, _utils.destructureStyleOverride)(props.overrides?.ButtonComponent?.props?.style, theme)
|
|
203
203
|
},
|
|
204
204
|
overrides: {
|
|
205
205
|
// @ts-expect-error
|
|
@@ -209,8 +209,9 @@ function FileUploaderBeta(props) {
|
|
|
209
209
|
...props.overrides?.ButtonComponent?.props?.overrides?.BaseButton,
|
|
210
210
|
style: {
|
|
211
211
|
backgroundColor: theme.colors.backgroundPrimary,
|
|
212
|
+
...(0, _utils.destructureStyleOverride)(
|
|
212
213
|
// @ts-expect-error
|
|
213
|
-
|
|
214
|
+
props.overrides?.ButtonComponent?.props?.overrides?.BaseButton?.style, theme)
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
}
|
|
@@ -220,7 +221,7 @@ function FileUploaderBeta(props) {
|
|
|
220
221
|
style: {
|
|
221
222
|
...theme.typography.ParagraphMedium,
|
|
222
223
|
color: theme.colors.contentTertiary,
|
|
223
|
-
...props.overrides?.ContentMessage?.style
|
|
224
|
+
...(0, _utils.destructureStyleOverride)(props.overrides?.ContentMessage?.style, theme)
|
|
224
225
|
}
|
|
225
226
|
},
|
|
226
227
|
FileDragAndDrop: {
|
|
@@ -233,7 +234,14 @@ function FileUploaderBeta(props) {
|
|
|
233
234
|
paddingLeft: theme.sizing.scale600,
|
|
234
235
|
paddingRight: theme.sizing.scale600,
|
|
235
236
|
paddingTop: theme.sizing.scale600,
|
|
236
|
-
...props.overrides?.FileDragAndDrop?.style
|
|
237
|
+
...(0, _utils.destructureStyleOverride)(props.overrides?.FileDragAndDrop?.style, theme)
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
Root: {
|
|
241
|
+
style: {
|
|
242
|
+
zIndex: 1,
|
|
243
|
+
...(0, _utils.destructureStyleOverride)(props.overrides?.Root?.style, theme),
|
|
244
|
+
...props.overrides?.Root?.style
|
|
237
245
|
}
|
|
238
246
|
}
|
|
239
247
|
}
|
|
@@ -329,7 +337,8 @@ function FileUploaderBeta(props) {
|
|
|
329
337
|
},
|
|
330
338
|
value: fileRow.status === _constants.FILE_STATUS.processed ? 100 : 20
|
|
331
339
|
}, progressBarProps))))))), props.hint && /*#__PURE__*/React.createElement(Hint, _extends({
|
|
332
|
-
"data-baseweb": "file-uploader-beta-hint"
|
|
340
|
+
"data-baseweb": "file-uploader-beta-hint",
|
|
341
|
+
$fileCount: props.fileRows.length
|
|
333
342
|
}, hintProps), props.hint));
|
|
334
343
|
}
|
|
335
344
|
FileUploaderBeta.defaultProps = {
|
|
@@ -15,10 +15,28 @@ LICENSE file in the root directory of this source tree.
|
|
|
15
15
|
const StyledFileRow = exports.StyledFileRow = (0, _styles.styled)('li', props => {
|
|
16
16
|
const {
|
|
17
17
|
$theme: {
|
|
18
|
+
animation,
|
|
18
19
|
sizing
|
|
19
20
|
}
|
|
20
21
|
} = props;
|
|
21
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
|
+
},
|
|
22
40
|
paddingTop: sizing.scale500,
|
|
23
41
|
paddingRight: sizing.scale500,
|
|
24
42
|
paddingBottom: sizing.scale500,
|
|
@@ -137,11 +155,23 @@ StyledFileRowUploadText.displayName = 'StyledFileRowUploadText';
|
|
|
137
155
|
const StyledFileRows = exports.StyledFileRows = (0, _styles.styled)('ul', props => {
|
|
138
156
|
const {
|
|
139
157
|
$theme: {
|
|
158
|
+
animation,
|
|
140
159
|
borders,
|
|
141
160
|
sizing
|
|
142
161
|
}
|
|
143
162
|
} = props;
|
|
144
163
|
return {
|
|
164
|
+
animationDuration: animation.timing500,
|
|
165
|
+
animationIterationCount: 1,
|
|
166
|
+
animationTimingFunction: animation.easeInOutQuinticCurve,
|
|
167
|
+
animationName: {
|
|
168
|
+
'0%': {
|
|
169
|
+
transform: 'translateY(-32px)'
|
|
170
|
+
},
|
|
171
|
+
'100%': {
|
|
172
|
+
transform: 'translateX(-0px)'
|
|
173
|
+
}
|
|
174
|
+
},
|
|
145
175
|
...borders.border200,
|
|
146
176
|
borderRadius: borders.radius400,
|
|
147
177
|
borderWidth: sizing.scale0,
|
|
@@ -155,13 +185,29 @@ StyledFileRows.displayName = "StyledFileRows";
|
|
|
155
185
|
StyledFileRows.displayName = 'StyledFileRows';
|
|
156
186
|
const StyledHint = exports.StyledHint = (0, _styles.styled)('div', props => {
|
|
157
187
|
const {
|
|
188
|
+
$fileCount,
|
|
158
189
|
$theme: {
|
|
190
|
+
animation,
|
|
159
191
|
colors,
|
|
160
192
|
typography
|
|
161
193
|
}
|
|
162
194
|
} = props;
|
|
163
195
|
let fontColor = colors.contentTertiary;
|
|
196
|
+
const animations = $fileCount > 0 ? {
|
|
197
|
+
animationDuration: animation.timing500,
|
|
198
|
+
animationIterationCount: 1,
|
|
199
|
+
animationTimingFunction: animation.easeInOutQuinticCurve,
|
|
200
|
+
animationName: {
|
|
201
|
+
'0%': {
|
|
202
|
+
transform: 'translateY(-32px)'
|
|
203
|
+
},
|
|
204
|
+
'100%': {
|
|
205
|
+
transform: 'translateX(-0px)'
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} : {};
|
|
164
209
|
return {
|
|
210
|
+
...animations,
|
|
165
211
|
...typography.font100,
|
|
166
212
|
color: fontColor
|
|
167
213
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import type { Override } from '../helpers/overrides';
|
|
2
2
|
import type { FILE_STATUS } from './constants';
|
|
3
|
-
import type { FileUploaderOverrides, FileUploaderProps } from '../file-uploader/types';
|
|
4
|
-
export type StyleProps = {
|
|
5
|
-
$afterFileDrop: boolean;
|
|
3
|
+
import type { FileUploaderOverrides, FileUploaderProps, StyleProps as FileUploaderBasicStyleProps } from '../file-uploader/types';
|
|
4
|
+
export type StyleProps = FileUploaderBasicStyleProps & {
|
|
6
5
|
$alt: string;
|
|
7
6
|
$color: string;
|
|
8
|
-
$
|
|
9
|
-
$isDragActive: boolean;
|
|
10
|
-
$isDragAccept: boolean;
|
|
11
|
-
$isDragReject: boolean;
|
|
12
|
-
$isFocused: boolean;
|
|
7
|
+
$fileCount: number;
|
|
13
8
|
$src: string;
|
|
14
9
|
};
|
|
15
10
|
export type FileUploaderBetaOverrides = {
|
|
@@ -3,13 +3,24 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.formatBytes = void 0;
|
|
6
|
+
exports.formatBytes = exports.destructureStyleOverride = void 0;
|
|
7
7
|
/*
|
|
8
8
|
Copyright (c) Uber Technologies, Inc.
|
|
9
9
|
|
|
10
10
|
This source code is licensed under the MIT license found in the
|
|
11
11
|
LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
+
|
|
14
|
+
const destructureStyleOverride = (styleOverride, theme) => {
|
|
15
|
+
if (typeof styleOverride === 'function') {
|
|
16
|
+
return styleOverride({
|
|
17
|
+
$theme: theme
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
return styleOverride;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.destructureStyleOverride = destructureStyleOverride;
|
|
13
24
|
const formatBytes = bytes => {
|
|
14
25
|
if (bytes === 0) return '0 bytes';
|
|
15
26
|
const k = 1000;
|