baseui 15.0.0 → 15.0.2
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/stateless-accordion.js +8 -8
- package/bottom-navigation/bottom-navigation.js +1 -5
- package/checkbox/styled-components.js +2 -6
- package/data-table/column-numerical.js +3 -18
- package/dnd-list/list.js +1 -1
- package/dnd-list/stateful-list-container.js +1 -1
- package/file-uploader/constants.d.ts +2 -0
- package/file-uploader/constants.js +4 -2
- package/file-uploader/file-uploader.js +25 -6
- package/file-uploader/locale.js +1 -1
- package/file-uploader/types.d.ts +3 -1
- package/file-uploader-basic/file-uploader-basic.js +0 -2
- package/helpers/react-helpers.js +1 -1
- package/list/list-item.js +0 -2
- package/locale/index.js +0 -1
- package/mobile-header/mobile-header.js +0 -1
- package/package.json +4 -3
- package/page-control/page-control.js +1 -3
- package/segmented-control/segmented-control.js +1 -2
- package/segmented-control/stateful-segmented-control.js +1 -2
- package/sheet/sheet.js +1 -3
- package/stepper/stepper.js +1 -3
- package/system-banner/system-banner.js +1 -3
|
@@ -33,13 +33,13 @@ function StatelessAccordion({
|
|
|
33
33
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
34
34
|
"data-baseweb": "accordion"
|
|
35
35
|
}, rootProps), React.Children.map(children, (child, index) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const key =
|
|
41
|
-
return /*#__PURE__*/React.cloneElement(
|
|
42
|
-
disabled:
|
|
36
|
+
if (!(0, _reactIs.isElement)(child) && !(0, _reactIs.isPortal)(child)) {
|
|
37
|
+
return child;
|
|
38
|
+
}
|
|
39
|
+
const element = child;
|
|
40
|
+
const key = element.key || String(index);
|
|
41
|
+
return /*#__PURE__*/React.cloneElement(element, {
|
|
42
|
+
disabled: element.props.disabled || disabled,
|
|
43
43
|
expanded: expanded.includes(key),
|
|
44
44
|
key,
|
|
45
45
|
onChange:
|
|
@@ -66,7 +66,7 @@ function StatelessAccordion({
|
|
|
66
66
|
expanded: next
|
|
67
67
|
});
|
|
68
68
|
} : onChange,
|
|
69
|
-
overrides:
|
|
69
|
+
overrides: element.props.overrides || PanelOverrides,
|
|
70
70
|
renderAll
|
|
71
71
|
});
|
|
72
72
|
}));
|
|
@@ -34,7 +34,6 @@ const BottomNavigation = ({
|
|
|
34
34
|
const [displayOverflow, setDisplayOverflow] = React.useState(false);
|
|
35
35
|
const NavItemPanelRefs = React.useRef([]);
|
|
36
36
|
function scrollToTop(idx) {
|
|
37
|
-
// @ts-expect-error todo(ts-migration) TS2339 Property 'scrollTo' does not exist on type 'never'.
|
|
38
37
|
NavItemPanelRefs.current[idx].scrollTo({
|
|
39
38
|
top: 0,
|
|
40
39
|
left: 0,
|
|
@@ -45,7 +44,6 @@ const BottomNavigation = ({
|
|
|
45
44
|
if (displayOverflow) {
|
|
46
45
|
setDisplayOverflow(false);
|
|
47
46
|
}
|
|
48
|
-
// @ts-expect-error todo(ts-migration) TS2722 Cannot invoke an object which is possibly 'undefined'.
|
|
49
47
|
onChange({
|
|
50
48
|
activeKey
|
|
51
49
|
});
|
|
@@ -79,9 +77,7 @@ const BottomNavigation = ({
|
|
|
79
77
|
if (!navItem) return;
|
|
80
78
|
const isActive = activeKey === idx && !displayOverflow;
|
|
81
79
|
return /*#__PURE__*/React.createElement(_panel.Panel, {
|
|
82
|
-
isActive: isActive
|
|
83
|
-
// @ts-expect-error todo(ts-migration) TS2345 Argument of type 'unknown' is not assignable to parameter of type 'never'.
|
|
84
|
-
,
|
|
80
|
+
isActive: isActive,
|
|
85
81
|
ref: element => NavItemPanelRefs.current.push(element),
|
|
86
82
|
overrides: navItem.props.overrides,
|
|
87
83
|
key: idx,
|
|
@@ -285,13 +285,9 @@ const Toggle = exports.Toggle = (0, _styles.styled)('div', props => {
|
|
|
285
285
|
Toggle.displayName = "Toggle";
|
|
286
286
|
Toggle.displayName = 'Toggle';
|
|
287
287
|
const ToggleTrack = exports.ToggleTrack = (0, _styles.styled)('div', props => {
|
|
288
|
-
|
|
289
|
-
if (props.$disabled) {
|
|
290
|
-
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
291
|
-
} else if (props.$error && props.$checked) {
|
|
292
|
-
backgroundColor = props.$theme.colors.tickFillError;
|
|
293
|
-
}
|
|
288
|
+
const backgroundColor = props.$disabled ? props.$theme.colors.toggleTrackFillDisabled : props.$theme.colors.toggleTrackFill;
|
|
294
289
|
return {
|
|
290
|
+
flex: '0 0 auto',
|
|
295
291
|
alignItems: 'center',
|
|
296
292
|
backgroundColor,
|
|
297
293
|
borderTopLeftRadius: '7px',
|
|
@@ -66,7 +66,6 @@ function validateInput(input) {
|
|
|
66
66
|
|
|
67
67
|
// @ts-ignore
|
|
68
68
|
const bisect = (0, _d.bisector)(d => d.x0);
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
69
|
const Histogram = /*#__PURE__*/React.memo(function Histogram({
|
|
71
70
|
data,
|
|
72
71
|
lower,
|
|
@@ -83,9 +82,7 @@ const Histogram = /*#__PURE__*/React.memo(function Histogram({
|
|
|
83
82
|
yScale
|
|
84
83
|
} = React.useMemo(() => {
|
|
85
84
|
const bins = (0, _d.bin)().thresholds(Math.min(data.length, _constants.MAX_BIN_COUNT))(data);
|
|
86
|
-
const xScale = (0, _d.scaleLinear)()
|
|
87
|
-
// @ts-expect-error todo(ts-migration) TS2345 Argument of type '(number | undefined)[]' is not assignable to parameter of type 'Iterable<NumberValue>'.
|
|
88
|
-
.domain([bins[0].x0, bins[bins.length - 1].x1]).range([0, _constants.HISTOGRAM_SIZE.width]).clamp(true);
|
|
85
|
+
const xScale = (0, _d.scaleLinear)().domain([bins[0].x0, bins[bins.length - 1].x1]).range([0, _constants.HISTOGRAM_SIZE.width]).clamp(true);
|
|
89
86
|
const yScale = (0, _d.scaleLinear)()
|
|
90
87
|
// @ts-ignore
|
|
91
88
|
.domain([0, (0, _d.max)(bins, d => d.length)]).nice().range([_constants.HISTOGRAM_SIZE.height, 0]);
|
|
@@ -114,19 +111,15 @@ const Histogram = /*#__PURE__*/React.memo(function Histogram({
|
|
|
114
111
|
overflow: 'visible'
|
|
115
112
|
})
|
|
116
113
|
}, /*#__PURE__*/React.createElement("svg", _constants.HISTOGRAM_SIZE, bins.map((d, index) => {
|
|
117
|
-
// @ts-expect-error todo(ts-migration) TS2345 Argument of type 'number | undefined' is not assignable to parameter of type 'NumberValue'.
|
|
118
114
|
const x = xScale(d.x0) + 1;
|
|
119
115
|
const y = yScale(d.length);
|
|
120
|
-
// @ts-expect-error todo(ts-migration) TS2345 Argument of type 'number | undefined' is not assignable to parameter of type 'NumberValue'.
|
|
121
116
|
const width = Math.max(0, xScale(d.x1) - xScale(d.x0) - 1);
|
|
122
117
|
const height = yScale(0) - yScale(d.length);
|
|
123
118
|
let included;
|
|
124
119
|
if (singleIndexNearest != null) {
|
|
125
120
|
included = index === singleIndexNearest;
|
|
126
121
|
} else {
|
|
127
|
-
// @ts-expect-error todo(ts-migration) TS18048 'd.x1' is possibly 'undefined'.
|
|
128
122
|
const withinLower = d.x1 > lower;
|
|
129
|
-
// @ts-expect-error todo(ts-migration) TS18048 'd.x0' is possibly 'undefined'.
|
|
130
123
|
const withinUpper = d.x0 <= upper;
|
|
131
124
|
included = withinLower && withinUpper;
|
|
132
125
|
}
|
|
@@ -201,19 +194,14 @@ function NumericalFilter(props) {
|
|
|
201
194
|
// once the user is done inputting.
|
|
202
195
|
// we validate then format to the given precision
|
|
203
196
|
let l = isRange ? lv : sv;
|
|
204
|
-
// @ts-expect-error todo(ts-migration) TS2322 Type 'string | number | undefined' is not assignable to type 'number'.
|
|
205
197
|
l = validateInput(l) ? l : min;
|
|
206
198
|
let h = validateInput(uv) ? uv : max;
|
|
207
|
-
|
|
208
|
-
// @ts-expect-error todo(ts-migration) TS2345 Argument of type 'string | number | undefined' is not assignable to parameter of type 'number'.
|
|
209
199
|
return [roundToFixed(l, precision), roundToFixed(h, precision)];
|
|
210
200
|
}, [isRange, focused, sv, lv, uv, precision]);
|
|
211
201
|
|
|
212
202
|
// We have our slider values range from 1 to the bin size, so we have a scale which
|
|
213
203
|
// takes in the data driven range and maps it to values the scale can always handle
|
|
214
|
-
const sliderScale = React.useMemo(() => (0, _d.scaleLinear)()
|
|
215
|
-
// @ts-expect-error todo(ts-migration) TS2345 Argument of type '(string | undefined)[]' is not assignable to parameter of type 'Iterable<NumberValue>'.
|
|
216
|
-
.domain([min, max]).rangeRound([1, _constants.MAX_BIN_COUNT])
|
|
204
|
+
const sliderScale = React.useMemo(() => (0, _d.scaleLinear)().domain([min, max]).rangeRound([1, _constants.MAX_BIN_COUNT])
|
|
217
205
|
// We clamp the values within our min and max even if a user enters a huge number
|
|
218
206
|
.clamp(true), [min, max]);
|
|
219
207
|
let sliderValue = isRange ? [sliderScale(inputValueLower), sliderScale(inputValueUpper)] : [sliderScale(inputValueLower)];
|
|
@@ -395,10 +383,7 @@ function NumericalFilter(props) {
|
|
|
395
383
|
},
|
|
396
384
|
onFocus: () => setFocus(true),
|
|
397
385
|
onBlur: () => setFocus(false)
|
|
398
|
-
}), isRange &&
|
|
399
|
-
/*#__PURE__*/
|
|
400
|
-
// @ts-expect-error todo(ts-migration) TS2769 No overload matches this call.
|
|
401
|
-
React.createElement(_input.Input, {
|
|
386
|
+
}), isRange && /*#__PURE__*/React.createElement(_input.Input, {
|
|
402
387
|
min: min,
|
|
403
388
|
max: max,
|
|
404
389
|
size: _input.SIZE.mini,
|
package/dnd-list/list.js
CHANGED
|
@@ -23,7 +23,7 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
23
23
|
|
|
24
24
|
This source code is licensed under the MIT license found in the
|
|
25
25
|
LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/
|
|
26
|
+
*/ // @ts-ignore - react-movable is an ES module but we're in a CommonJS context
|
|
27
27
|
const ItemLayer = ({
|
|
28
28
|
children,
|
|
29
29
|
dragged
|
|
@@ -15,7 +15,7 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
15
15
|
|
|
16
16
|
This source code is licensed under the MIT license found in the
|
|
17
17
|
LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/
|
|
18
|
+
*/ // @ts-ignore - react-movable is an ES module but we're in a CommonJS context
|
|
19
19
|
const defaultStateReducer = (type, nextState) => nextState;
|
|
20
20
|
class StatefulListContainer extends React.Component {
|
|
21
21
|
constructor(...args) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.FILE_STATUS_TO_COLOR_MAP = exports.FILE_STATUS = exports.ARIA_LIVE_TIMEOUT_MS = exports.ARIA_LIVE_ELEMENT_ID = void 0;
|
|
6
|
+
exports.PROGRESS_AMOUNT_LOADING_COMPLETE = exports.PROGRESS_AMOUNT_LOADING = exports.FILE_STATUS_TO_COLOR_MAP = exports.FILE_STATUS = exports.ARIA_LIVE_TIMEOUT_MS = exports.ARIA_LIVE_ELEMENT_ID = void 0;
|
|
7
7
|
/*
|
|
8
8
|
Copyright (c) Uber Technologies, Inc.
|
|
9
9
|
|
|
@@ -27,4 +27,6 @@ let ARIA_LIVE_ELEMENT_ID = exports.ARIA_LIVE_ELEMENT_ID = /*#__PURE__*/function
|
|
|
27
27
|
ARIA_LIVE_ELEMENT_ID["REMOVAL"] = "file-uploader-removal";
|
|
28
28
|
return ARIA_LIVE_ELEMENT_ID;
|
|
29
29
|
}({});
|
|
30
|
-
const ARIA_LIVE_TIMEOUT_MS = exports.ARIA_LIVE_TIMEOUT_MS = 5000;
|
|
30
|
+
const ARIA_LIVE_TIMEOUT_MS = exports.ARIA_LIVE_TIMEOUT_MS = 5000;
|
|
31
|
+
const PROGRESS_AMOUNT_LOADING = exports.PROGRESS_AMOUNT_LOADING = 20;
|
|
32
|
+
const PROGRESS_AMOUNT_LOADING_COMPLETE = exports.PROGRESS_AMOUNT_LOADING_COMPLETE = 100;
|
|
@@ -39,6 +39,9 @@ function FileUploader(props) {
|
|
|
39
39
|
if (props['onDropRejected']) {
|
|
40
40
|
console.error('onDropRejected is not a prop for FileUploader.');
|
|
41
41
|
}
|
|
42
|
+
if (props['progressAmount']) {
|
|
43
|
+
console.error('progressAmount is not a prop for FileUploader.');
|
|
44
|
+
}
|
|
42
45
|
|
|
43
46
|
// Isolate props that are not meant to be passed to FileUploaderBasic
|
|
44
47
|
const {
|
|
@@ -49,6 +52,7 @@ function FileUploader(props) {
|
|
|
49
52
|
maxFiles,
|
|
50
53
|
overrides = {},
|
|
51
54
|
processFileOnDrop,
|
|
55
|
+
progressAmountStartValue,
|
|
52
56
|
setFileRows,
|
|
53
57
|
...fileUploaderBasicProps
|
|
54
58
|
} = props;
|
|
@@ -114,6 +118,7 @@ function FileUploader(props) {
|
|
|
114
118
|
file,
|
|
115
119
|
id: (0, _reactUid.uid)(file),
|
|
116
120
|
imagePreviewThumbnail: '',
|
|
121
|
+
progressAmount: progressAmountStartValue ?? _constants.PROGRESS_AMOUNT_LOADING,
|
|
117
122
|
status: _constants.FILE_STATUS.added
|
|
118
123
|
});
|
|
119
124
|
props.setFileRows([...newFileRows]);
|
|
@@ -124,6 +129,7 @@ function FileUploader(props) {
|
|
|
124
129
|
reader.onerror = () => {
|
|
125
130
|
newFileRows[index].errorMessage = 'cannot read file';
|
|
126
131
|
newFileRows[index].status = _constants.FILE_STATUS.error;
|
|
132
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
127
133
|
(0, _utils.handleAriaLiveUpdates)(_constants.ARIA_LIVE_ELEMENT_ID.ADDITION, `${newFileRows[index].file.name} added, upload failed: ${newFileRows[index].errorMessage}`);
|
|
128
134
|
props.setFileRows([...newFileRows]);
|
|
129
135
|
};
|
|
@@ -136,29 +142,33 @@ function FileUploader(props) {
|
|
|
136
142
|
// If too many files
|
|
137
143
|
newFileRows[index].errorMessage = `cannot process more than ${props.maxFiles} file(s)`;
|
|
138
144
|
newFileRows[index].status = _constants.FILE_STATUS.error;
|
|
145
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
139
146
|
(0, _utils.handleAriaLiveUpdates)(_constants.ARIA_LIVE_ELEMENT_ID.ADDITION, `${newFileRows[index].file.name} added, upload failed: ${newFileRows[index].errorMessage}`);
|
|
140
147
|
props.setFileRows([...newFileRows]);
|
|
141
148
|
} else if (props.minSize !== undefined && Number.isInteger(props.minSize) && props.minSize > fileRow.file.size) {
|
|
142
149
|
// If file size is too small
|
|
143
150
|
newFileRows[index].errorMessage = `file size must be greater than ${(0, _utils.formatBytes)(props.minSize)}`;
|
|
144
151
|
newFileRows[index].status = _constants.FILE_STATUS.error;
|
|
152
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
145
153
|
(0, _utils.handleAriaLiveUpdates)(_constants.ARIA_LIVE_ELEMENT_ID.ADDITION, `${newFileRows[index].file.name} added, upload failed: ${newFileRows[index].errorMessage}`);
|
|
146
154
|
props.setFileRows([...newFileRows]);
|
|
147
155
|
} else if (props.maxSize !== undefined && Number.isInteger(props.maxSize) && props.maxSize < fileRow.file.size) {
|
|
148
156
|
// If file size is too big
|
|
149
157
|
newFileRows[index].errorMessage = `file size must be less than ${(0, _utils.formatBytes)(props.maxSize)}`;
|
|
150
158
|
newFileRows[index].status = _constants.FILE_STATUS.error;
|
|
159
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
151
160
|
(0, _utils.handleAriaLiveUpdates)(_constants.ARIA_LIVE_ELEMENT_ID.ADDITION, `${newFileRows[index].file.name} added, upload failed: ${newFileRows[index].errorMessage}`);
|
|
152
161
|
props.setFileRows([...newFileRows]);
|
|
153
162
|
} else if (index >= newFileRows.length - rejectedFiles.length) {
|
|
154
163
|
// If file was rejected by dropzone (e.g. wrong file type)
|
|
155
164
|
newFileRows[index].errorMessage = fileRow.file.type ? `file type of ${fileRow.file.type} is not accepted` : 'file type is not accepted';
|
|
156
165
|
newFileRows[index].status = _constants.FILE_STATUS.error;
|
|
166
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
157
167
|
(0, _utils.handleAriaLiveUpdates)(_constants.ARIA_LIVE_ELEMENT_ID.ADDITION, `${newFileRows[index].file.name} added, upload failed: ${newFileRows[index].errorMessage}`);
|
|
158
168
|
props.setFileRows([...newFileRows]);
|
|
159
169
|
} else if (props.processFileOnDrop) {
|
|
160
170
|
// If caller passed in file process function
|
|
161
|
-
props.processFileOnDrop(fileRow.file).then(({
|
|
171
|
+
props.processFileOnDrop(fileRow.file, fileRow.id, newFileRows).then(({
|
|
162
172
|
errorMessage,
|
|
163
173
|
fileInfo
|
|
164
174
|
}) => {
|
|
@@ -168,13 +178,16 @@ function FileUploader(props) {
|
|
|
168
178
|
if (errorMessage) {
|
|
169
179
|
newFileRows[index].errorMessage = errorMessage;
|
|
170
180
|
newFileRows[index].status = _constants.FILE_STATUS.error;
|
|
181
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
171
182
|
} else {
|
|
172
183
|
newFileRows[index].status = _constants.FILE_STATUS.processed;
|
|
184
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
173
185
|
}
|
|
174
186
|
}).catch(error => {
|
|
175
187
|
console.error('error with processFileOnDrop', error);
|
|
176
188
|
newFileRows[index].errorMessage = 'unknown processing error';
|
|
177
189
|
newFileRows[index].status = _constants.FILE_STATUS.error;
|
|
190
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
178
191
|
(0, _utils.handleAriaLiveUpdates)(_constants.ARIA_LIVE_ELEMENT_ID.ADDITION, `${newFileRows[index].file.name} added, upload failed: ${newFileRows[index].errorMessage}`);
|
|
179
192
|
}).finally(() => {
|
|
180
193
|
props.setFileRows([...newFileRows]);
|
|
@@ -182,6 +195,7 @@ function FileUploader(props) {
|
|
|
182
195
|
} else {
|
|
183
196
|
// If no errors and no file process function
|
|
184
197
|
newFileRows[index].status = _constants.FILE_STATUS.processed;
|
|
198
|
+
newFileRows[index].progressAmount = _constants.PROGRESS_AMOUNT_LOADING_COMPLETE;
|
|
185
199
|
(0, _utils.handleAriaLiveUpdates)(_constants.ARIA_LIVE_ELEMENT_ID.ADDITION, `${newFileRows[index].file.name} added, upload successful`);
|
|
186
200
|
props.setFileRows([...newFileRows]);
|
|
187
201
|
}
|
|
@@ -233,13 +247,15 @@ function FileUploader(props) {
|
|
|
233
247
|
}, labelProps, {
|
|
234
248
|
$disabled: !!props.disabled
|
|
235
249
|
}), props.label), /*#__PURE__*/React.createElement(_fileUploaderBasic.FileUploaderBasic, _extends({
|
|
236
|
-
buttonIcon: () => /*#__PURE__*/React.createElement(_upload.default,
|
|
250
|
+
buttonIcon: () => /*#__PURE__*/React.createElement(_upload.default, {
|
|
251
|
+
"aria-hidden": 'true'
|
|
252
|
+
}),
|
|
237
253
|
buttonText: locale.fileuploader.buttonText,
|
|
238
254
|
contentMessage: locale.fileuploader.contentMessage,
|
|
239
255
|
overrides: {
|
|
240
256
|
ButtonComponent: {
|
|
241
257
|
props: {
|
|
242
|
-
'aria-
|
|
258
|
+
'aria-describedby': 'file-uploader-hint',
|
|
243
259
|
shape: _button.SHAPE.default,
|
|
244
260
|
size: _button.SIZE.default,
|
|
245
261
|
...props.overrides?.ButtonComponent?.props,
|
|
@@ -309,7 +325,8 @@ function FileUploader(props) {
|
|
|
309
325
|
,
|
|
310
326
|
onDrop: onDrop,
|
|
311
327
|
onDropAccepted: _ => {},
|
|
312
|
-
onDropRejected: _ => {}
|
|
328
|
+
onDropRejected: _ => {},
|
|
329
|
+
progressAmount: undefined
|
|
313
330
|
})), props.fileRows.length > 0 && /*#__PURE__*/React.createElement(FileRows, _extends({
|
|
314
331
|
"data-baseweb": "file-uploader-file-rows"
|
|
315
332
|
}, fileRowsProps), props.fileRows.map((fileRow, index) => /*#__PURE__*/React.createElement(FileRow, _extends({
|
|
@@ -344,7 +361,9 @@ function FileUploader(props) {
|
|
|
344
361
|
title: fileRow.status
|
|
345
362
|
}, circleExclamationPointFilledIconProps)), /*#__PURE__*/React.createElement(FileRowUploadText, _extends({
|
|
346
363
|
"aria-errormessage": fileRow.errorMessage,
|
|
347
|
-
"
|
|
364
|
+
"aria-invalid": true,
|
|
365
|
+
"data-baseweb": "file-uploader-file-row-upload-message-text",
|
|
366
|
+
id: `file-uploader-file-row-upload-message-text-${index}`
|
|
348
367
|
}, fileRowUploadTextProps), locale.fileuploader.error, fileRow.errorMessage)), fileRow.status === _constants.FILE_STATUS.processed && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CircleCheckFilledIcon, _extends({
|
|
349
368
|
"aria-hidden": 'true',
|
|
350
369
|
color: (0, _constants.FILE_STATUS_TO_COLOR_MAP)(theme)[fileRow.status],
|
|
@@ -405,7 +424,7 @@ function FileUploader(props) {
|
|
|
405
424
|
}
|
|
406
425
|
},
|
|
407
426
|
size: _progressBar.SIZE.small,
|
|
408
|
-
value: fileRow.
|
|
427
|
+
value: fileRow.progressAmount ?? _constants.PROGRESS_AMOUNT_LOADING_COMPLETE
|
|
409
428
|
}, progressBarProps)))))), props.hint && /*#__PURE__*/React.createElement(Hint, _extends({
|
|
410
429
|
"data-baseweb": "file-uploader-hint",
|
|
411
430
|
id: "file-uploader-hint",
|
package/file-uploader/locale.js
CHANGED
package/file-uploader/types.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export type FileRow = {
|
|
|
33
33
|
id: string;
|
|
34
34
|
fileInfo?: any;
|
|
35
35
|
imagePreviewThumbnail?: any;
|
|
36
|
+
progressAmount: number;
|
|
36
37
|
/** Defines the status of a file */
|
|
37
38
|
status: keyof typeof FILE_STATUS;
|
|
38
39
|
};
|
|
@@ -44,9 +45,10 @@ export type FileUploaderProps = Omit<FileUploaderBasicProps, 'onDrop' | 'onDropA
|
|
|
44
45
|
maxFiles?: number;
|
|
45
46
|
overrides?: FileUploaderBasicOverrides & FileUploaderOverrides;
|
|
46
47
|
/** Function to run on each file, returns "errorMessage: null" on success and "errorMessage: string" for failures */
|
|
47
|
-
processFileOnDrop?: (
|
|
48
|
+
processFileOnDrop?: (fileToProcess: File, fileToProcessId: string, fileRows: FileRow[]) => Promise<{
|
|
48
49
|
errorMessage: string | null;
|
|
49
50
|
fileInfo?: any;
|
|
50
51
|
}>;
|
|
52
|
+
progressAmountStartValue?: number;
|
|
51
53
|
setFileRows: (fileRows: FileRow[]) => void;
|
|
52
54
|
};
|
|
@@ -86,7 +86,6 @@ function FileUploaderBasic(props) {
|
|
|
86
86
|
shape: _button.SHAPE.pill,
|
|
87
87
|
size: _button.SIZE.compact,
|
|
88
88
|
onClick: open,
|
|
89
|
-
role: "button",
|
|
90
89
|
overrides: {
|
|
91
90
|
BaseButton: {
|
|
92
91
|
// @ts-ignore
|
|
@@ -106,7 +105,6 @@ function FileUploaderBasic(props) {
|
|
|
106
105
|
shape: _button.SHAPE.pill,
|
|
107
106
|
size: _button.SIZE.compact,
|
|
108
107
|
onClick: open,
|
|
109
|
-
role: "button",
|
|
110
108
|
overrides: {
|
|
111
109
|
BaseButton: {
|
|
112
110
|
// @ts-ignore
|
package/helpers/react-helpers.js
CHANGED
|
@@ -18,7 +18,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
18
18
|
const flattenFragments = (children, ChildWrapper, depth = 0) =>
|
|
19
19
|
// @ts-ignore
|
|
20
20
|
React.Children.toArray(children).reduce((acc, child, i) => {
|
|
21
|
-
if ((0, _reactIs.isFragment)(child)) {
|
|
21
|
+
if ((0, _reactIs.isFragment)(child) && /*#__PURE__*/React.isValidElement(child)) {
|
|
22
22
|
acc.push(...flattenFragments(child.props.children, ChildWrapper, depth + 1));
|
|
23
23
|
} else if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
24
24
|
if (ChildWrapper) {
|
package/list/list-item.js
CHANGED
|
@@ -53,8 +53,6 @@ const ListItem = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
53
53
|
const listItemName = _react.default.Children.count(props.children) === 0 ? ['List item'] : _react.default.Children.map(props.children, child => {
|
|
54
54
|
return getMainTextFromChild(child);
|
|
55
55
|
});
|
|
56
|
-
|
|
57
|
-
// @ts-expect-error todo(ts-migration) TS18049 'listItemName' is possibly 'null' or 'undefined'.
|
|
58
56
|
const ariaLabel = props.hasOwnProperty('aria-label') ? props['aria-label'] : listItemName[0];
|
|
59
57
|
return /*#__PURE__*/_react.default.createElement(Root
|
|
60
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
package/locale/index.js
CHANGED
|
@@ -30,7 +30,6 @@ const LocaleProvider = props => {
|
|
|
30
30
|
/*#__PURE__*/
|
|
31
31
|
// this is poorly documented but specifying true enforces that the object is deeply extended
|
|
32
32
|
// https://www.npmjs.com/package/just-extend
|
|
33
|
-
// @ts-expect-error todo(ts-migration) TS2740 Type '{}' is missing the following properties from type 'Locale': accordion, breadcrumbs, datepicker, datatable, and 8 more.
|
|
34
33
|
React.createElement(LocaleContext.Provider, {
|
|
35
34
|
value: (0, _justExtend.default)(true, {}, _en_US.default, parentLocale, locale)
|
|
36
35
|
}, children)
|
|
@@ -95,7 +95,6 @@ function MobileHeader({
|
|
|
95
95
|
$type: type,
|
|
96
96
|
$expanded: expanded
|
|
97
97
|
}, titleProps), title), actionButtons.length > 0 && /*#__PURE__*/React.createElement(ActionButtonsContainer, actionButtonsContainerProps, actionButtons.map((button, idx) => {
|
|
98
|
-
// @ts-expect-error todo(ts-migration) TS2339 Property 'renderIcon' does not exist on type 'IconButton | undefined'.
|
|
99
98
|
const {
|
|
100
99
|
renderIcon,
|
|
101
100
|
onClick,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseui",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.2",
|
|
4
4
|
"description": "A React Component library implementing the Base design language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"dev:docs": "next dev documentation-site",
|
|
17
17
|
"dev:ladle": "ladle serve",
|
|
18
18
|
"build:docs": "next build documentation-site",
|
|
19
|
+
"start:docs": "npx serve@latest documentation-site/out",
|
|
19
20
|
"build:ladle": "ladle build",
|
|
20
21
|
"build:lib": "NODE_ENV=production babel ./src --out-dir ./dist --config-file ./publish/.babelrc.js --extensions '.ts,.tsx,.js' --ignore **.test.*,**/__tests__/**,**/e2e.*,**/template-component/**,**/test/**",
|
|
21
22
|
"build:lib:dts": "tsc -p tsconfig.dist.json || true",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"@date-io/date-fns": "^2.13.1",
|
|
26
27
|
"@date-io/moment": "^2.13.1",
|
|
27
|
-
"
|
|
28
|
+
"axe-core": "^4.11.0",
|
|
28
29
|
"card-validator": "^6.2.0",
|
|
29
30
|
"csstype": "2.6.11",
|
|
30
31
|
"d3": "^6.7.0",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"react": ">=18",
|
|
59
60
|
"react-dom": ">=18",
|
|
60
|
-
"styletron-react": "
|
|
61
|
+
"styletron-react": ">=6"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
64
|
"@babel/cli": "^7.23.4",
|
|
@@ -91,9 +91,7 @@ const PageControl = ({
|
|
|
91
91
|
checked: isActive(page),
|
|
92
92
|
key: page,
|
|
93
93
|
"aria-label": `page ${page}`,
|
|
94
|
-
name: name
|
|
95
|
-
// @ts-expect-error todo(ts-migration) TS2722 Cannot invoke an object which is possibly 'undefined'.
|
|
96
|
-
,
|
|
94
|
+
name: name,
|
|
97
95
|
onChange: () => onPageChange({
|
|
98
96
|
nextPage: page
|
|
99
97
|
}),
|
|
@@ -19,10 +19,9 @@ const getInitialState = (children, initialState) => {
|
|
|
19
19
|
if (initialState && initialState.activeKey) {
|
|
20
20
|
return initialState;
|
|
21
21
|
} else {
|
|
22
|
-
// @ts-expect-error todo(ts-migration) TS2533 Object is possibly 'null' or 'undefined'.
|
|
23
22
|
const firstKey = React.Children.map(children,
|
|
24
23
|
// @ts-expect-error todo(flow->ts) child might be not a ReactElement, theoretically including null
|
|
25
|
-
(child, index) => child.key || String(index))[0];
|
|
24
|
+
(child, index) => child.key || String(index))?.[0];
|
|
26
25
|
return {
|
|
27
26
|
activeKey: firstKey
|
|
28
27
|
};
|
package/sheet/sheet.js
CHANGED
|
@@ -85,9 +85,7 @@ const Sheet = ({
|
|
|
85
85
|
onClick: trailingAction.onClick,
|
|
86
86
|
"aria-label": trailingAction.label,
|
|
87
87
|
size: buttonSize
|
|
88
|
-
}, actionButtonProps), renderActionButtonContent(trailingAction.renderIcon || trailingAction.label, buttonSize)), !trailingAction && leadingAction && /*#__PURE__*/React.createElement(EmptyDiv, emptyDivProps)), progressBar ? /*#__PURE__*/React.createElement(_progressBar.ProgressBar
|
|
89
|
-
// @ts-expect-error todo(ts-migration) TS2783 'size' is specified more than once, so this usage will be overwritten.
|
|
90
|
-
, _extends({
|
|
88
|
+
}, actionButtonProps), renderActionButtonContent(trailingAction.renderIcon || trailingAction.label, buttonSize)), !trailingAction && leadingAction && /*#__PURE__*/React.createElement(EmptyDiv, emptyDivProps)), progressBar ? /*#__PURE__*/React.createElement(_progressBar.ProgressBar, _extends({
|
|
91
89
|
size: _progressBar.SIZE.small,
|
|
92
90
|
overrides: {
|
|
93
91
|
BarContainer: {
|
package/stepper/stepper.js
CHANGED
|
@@ -84,9 +84,7 @@ function Stepper({
|
|
|
84
84
|
disabled: disabled,
|
|
85
85
|
"aria-label": "value"
|
|
86
86
|
}, inputProps)), /*#__PURE__*/React.createElement(IncrementButton, _extends({
|
|
87
|
-
onClick: () => setValue(value + 1)
|
|
88
|
-
// @ts-expect-error todo(ts-migration) TS18048 'maxValue' is possibly 'undefined'.
|
|
89
|
-
,
|
|
87
|
+
onClick: () => setValue(value + 1),
|
|
90
88
|
disabled: disabled || value >= maxValue,
|
|
91
89
|
"aria-label": "increment value"
|
|
92
90
|
}, incrementButtonProps), /*#__PURE__*/React.createElement(IncrementButtonIcon, incrementButtonIconProps)));
|
|
@@ -67,9 +67,7 @@ function SystemBanner(props) {
|
|
|
67
67
|
MessageContent: hasTwoActions ? (0, _overrides.mergeOverride)(systemBannerMessageContentOverrides, MessageContent || {}) : {},
|
|
68
68
|
...restOverrides
|
|
69
69
|
};
|
|
70
|
-
return /*#__PURE__*/React.createElement(_banner.Banner
|
|
71
|
-
// @ts-expect-error todo(ts-migration) TS2322 Type '{ icon?: ArtworkIcon | undefined; onClick: ((a: SyntheticEvent<HTMLButtonElement, Event>) => unknown) | null; label: string; } | { ...; } | null' is not assignable to type 'ActionContent | undef...
|
|
72
|
-
, _extends({
|
|
70
|
+
return /*#__PURE__*/React.createElement(_banner.Banner, _extends({
|
|
73
71
|
action: secondaryAction ? {
|
|
74
72
|
onClick: null,
|
|
75
73
|
...secondaryAction
|