carbon-react 124.2.2 → 124.3.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/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +1 -1
- package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +6 -4
- package/esm/__spec_helper__/index.js +3 -1
- package/esm/__spec_helper__/mock-element-scrollto.d.ts +2 -0
- package/esm/__spec_helper__/mock-element-scrollto.js +6 -0
- package/esm/__spec_helper__/select-test-utils.d.ts +3 -0
- package/esm/__spec_helper__/select-test-utils.js +39 -0
- package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.component.d.ts +35 -0
- package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.component.js +73 -0
- package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.style.d.ts +12 -0
- package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.style.js +97 -0
- package/esm/components/file-input/__internal__/file-upload-status/index.d.ts +2 -0
- package/esm/components/file-input/__internal__/file-upload-status/index.js +1 -0
- package/esm/components/file-input/file-input.component.d.ts +36 -0
- package/esm/components/file-input/file-input.component.js +353 -0
- package/esm/components/file-input/file-input.style.d.ts +14 -0
- package/esm/components/file-input/file-input.style.js +58 -0
- package/esm/components/file-input/index.d.ts +3 -0
- package/esm/components/file-input/index.js +1 -0
- package/esm/components/select/select-list/select-list.component.js +41 -7
- package/esm/locales/en-gb.js +10 -0
- package/esm/locales/locale.d.ts +10 -0
- package/esm/locales/pl-pl.js +10 -0
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +1 -1
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +6 -4
- package/lib/__spec_helper__/index.js +3 -1
- package/lib/__spec_helper__/mock-element-scrollto.d.ts +2 -0
- package/lib/__spec_helper__/mock-element-scrollto.js +12 -0
- package/lib/__spec_helper__/select-test-utils.d.ts +3 -0
- package/lib/__spec_helper__/select-test-utils.js +47 -0
- package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.component.d.ts +35 -0
- package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.component.js +81 -0
- package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.style.d.ts +12 -0
- package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.style.js +106 -0
- package/lib/components/file-input/__internal__/file-upload-status/index.d.ts +2 -0
- package/lib/components/file-input/__internal__/file-upload-status/index.js +13 -0
- package/lib/components/file-input/__internal__/file-upload-status/package.json +6 -0
- package/lib/components/file-input/file-input.component.d.ts +36 -0
- package/lib/components/file-input/file-input.component.js +361 -0
- package/lib/components/file-input/file-input.style.d.ts +14 -0
- package/lib/components/file-input/file-input.style.js +67 -0
- package/lib/components/file-input/index.d.ts +3 -0
- package/lib/components/file-input/index.js +13 -0
- package/lib/components/file-input/package.json +6 -0
- package/lib/components/select/select-list/select-list.component.js +40 -6
- package/lib/locales/en-gb.js +10 -0
- package/lib/locales/locale.d.ts +10 -0
- package/lib/locales/pl-pl.js +10 -0
- package/package.json +3 -2
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.FileInput = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _utils = require("../../style/utils");
|
|
10
|
+
var _inputBehaviour = require("../../__internal__/input-behaviour");
|
|
11
|
+
var _formField = _interopRequireDefault(require("../../__internal__/form-field"));
|
|
12
|
+
var _useUniqueId = _interopRequireDefault(require("../../hooks/__internal__/useUniqueId"));
|
|
13
|
+
var _useInputAccessibility = _interopRequireDefault(require("../../hooks/__internal__/useInputAccessibility/useInputAccessibility"));
|
|
14
|
+
var _validationMessage = _interopRequireDefault(require("../../__internal__/validation-message"));
|
|
15
|
+
var _fileInput = require("./file-input.style");
|
|
16
|
+
var _textbox = require("../textbox/textbox.style");
|
|
17
|
+
var _buttonMinor = _interopRequireDefault(require("../button-minor"));
|
|
18
|
+
var _typography = _interopRequireDefault(require("../typography"));
|
|
19
|
+
var _fileUploadStatus = _interopRequireDefault(require("./__internal__/file-upload-status"));
|
|
20
|
+
var _box = _interopRequireDefault(require("../box"));
|
|
21
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
26
|
+
const FileInput = exports.FileInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
27
|
+
accept,
|
|
28
|
+
buttonText,
|
|
29
|
+
"data-element": dataElement,
|
|
30
|
+
"data-role": dataRole,
|
|
31
|
+
dragAndDropText,
|
|
32
|
+
error,
|
|
33
|
+
label,
|
|
34
|
+
id,
|
|
35
|
+
inputHint,
|
|
36
|
+
isVertical,
|
|
37
|
+
maxHeight,
|
|
38
|
+
maxWidth,
|
|
39
|
+
minHeight = "40px",
|
|
40
|
+
minWidth = "256px",
|
|
41
|
+
name,
|
|
42
|
+
onChange,
|
|
43
|
+
required,
|
|
44
|
+
uploadStatus = [],
|
|
45
|
+
...rest
|
|
46
|
+
}, ref) => {
|
|
47
|
+
const locale = (0, _useLocale.default)();
|
|
48
|
+
const textOnButton = buttonText || locale.fileInput.selectFile();
|
|
49
|
+
const mainText = dragAndDropText || locale.fileInput.dragAndDrop();
|
|
50
|
+
const sizeProps = {
|
|
51
|
+
maxHeight: maxHeight || (isVertical ? undefined : minHeight),
|
|
52
|
+
maxWidth: maxWidth || minWidth,
|
|
53
|
+
minHeight,
|
|
54
|
+
minWidth
|
|
55
|
+
};
|
|
56
|
+
const [uniqueId, uniqueName] = (0, _useUniqueId.default)(id, name);
|
|
57
|
+
const [isDraggedOver, setIsDraggedOver] = (0, _react.useState)(false);
|
|
58
|
+
const [isDraggingFile, setIsDraggingFile] = (0, _react.useState)(false);
|
|
59
|
+
const internalInputRef = (0, _react.useRef)(null);
|
|
60
|
+
const internalCallbackRef = fileInput => {
|
|
61
|
+
internalInputRef.current = fileInput;
|
|
62
|
+
if (typeof ref === "function") {
|
|
63
|
+
ref(fileInput);
|
|
64
|
+
} else if (ref) {
|
|
65
|
+
ref.current = fileInput;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const startDrag = e => {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
if (e.dataTransfer?.types.includes("Files")) {
|
|
71
|
+
setIsDraggingFile(true);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const stopDrag = e => {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
setIsDraggingFile(false);
|
|
77
|
+
};
|
|
78
|
+
(0, _react.useEffect)(() => {
|
|
79
|
+
document.addEventListener("dragover", startDrag);
|
|
80
|
+
document.addEventListener("drop", stopDrag);
|
|
81
|
+
document.addEventListener("dragleave", stopDrag);
|
|
82
|
+
return () => {
|
|
83
|
+
document.removeEventListener("dragover", startDrag);
|
|
84
|
+
document.removeEventListener("drop", stopDrag);
|
|
85
|
+
document.removeEventListener("dragleave", stopDrag);
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
88
|
+
const onSelectFileClick = () => {
|
|
89
|
+
internalInputRef.current?.click();
|
|
90
|
+
};
|
|
91
|
+
const onFileAdded = files => {
|
|
92
|
+
onChange?.(files);
|
|
93
|
+
};
|
|
94
|
+
const onDragOver = e => {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
if (e.dataTransfer?.types.includes("Files")) {
|
|
97
|
+
setIsDraggedOver(true);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const onDragLeave = e => {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
e.stopPropagation(); // stop event triggering the document listener that resets the styles
|
|
103
|
+
setIsDraggedOver(false);
|
|
104
|
+
};
|
|
105
|
+
const onDrop = e => {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
setIsDraggedOver(false);
|
|
108
|
+
onFileAdded(e.dataTransfer.files);
|
|
109
|
+
};
|
|
110
|
+
const onInputChange = e => {
|
|
111
|
+
onFileAdded(e.target.files);
|
|
112
|
+
};
|
|
113
|
+
const {
|
|
114
|
+
labelId,
|
|
115
|
+
validationId
|
|
116
|
+
} = (0, _useInputAccessibility.default)({
|
|
117
|
+
id: uniqueId,
|
|
118
|
+
validationRedesignOptIn: true,
|
|
119
|
+
error,
|
|
120
|
+
label
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// allow for single input that a single set of status props is provided
|
|
124
|
+
const filesUploaded = Array.isArray(uploadStatus) ? uploadStatus : [uploadStatus];
|
|
125
|
+
const input = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, inputHint && /*#__PURE__*/_react.default.createElement(_textbox.StyledHintText, null, inputHint), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
126
|
+
position: "relative"
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
|
|
128
|
+
error: error,
|
|
129
|
+
validationId: validationId
|
|
130
|
+
}), error && /*#__PURE__*/_react.default.createElement(_textbox.ErrorBorder, {
|
|
131
|
+
warning: false
|
|
132
|
+
}), /*#__PURE__*/_react.default.createElement(_fileInput.StyledHiddenFileInput, _extends({}, required && {
|
|
133
|
+
required
|
|
134
|
+
}, {
|
|
135
|
+
accept: accept,
|
|
136
|
+
"aria-invalid": !!error,
|
|
137
|
+
id: uniqueId,
|
|
138
|
+
ref: internalCallbackRef,
|
|
139
|
+
name: uniqueName,
|
|
140
|
+
onChange: onInputChange,
|
|
141
|
+
type: "file"
|
|
142
|
+
}, rest)), /*#__PURE__*/_react.default.createElement(_fileInput.StyledFileInputPresentation, _extends({
|
|
143
|
+
isDraggedOver: isDraggedOver,
|
|
144
|
+
isDraggingFile: isDraggingFile,
|
|
145
|
+
error: error,
|
|
146
|
+
onDragLeave: onDragLeave,
|
|
147
|
+
onDragOver: onDragOver,
|
|
148
|
+
onDrop: onDrop
|
|
149
|
+
}, sizeProps), /*#__PURE__*/_react.default.createElement(_buttonMinor.default, {
|
|
150
|
+
buttonType: "primary",
|
|
151
|
+
onClick: onSelectFileClick
|
|
152
|
+
}, textOnButton), /*#__PURE__*/_react.default.createElement(_typography.default, {
|
|
153
|
+
m: 0
|
|
154
|
+
}, mainText))));
|
|
155
|
+
return /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputBehaviour, null, /*#__PURE__*/_react.default.createElement(_formField.default, _extends({
|
|
156
|
+
error: error,
|
|
157
|
+
label: label,
|
|
158
|
+
labelId: labelId,
|
|
159
|
+
id: uniqueId,
|
|
160
|
+
isRequired: required,
|
|
161
|
+
"data-component": "file-input",
|
|
162
|
+
"data-role": dataRole,
|
|
163
|
+
"data-element": dataElement,
|
|
164
|
+
validationRedesignOptIn: true // do not support old-style validation for File Input component
|
|
165
|
+
}, (0, _utils.filterStyledSystemMarginProps)(rest)), filesUploaded.length === 0 ? input : filesUploaded.map(props => /*#__PURE__*/_react.default.createElement(_fileInput.StyledFileInputPresentation, _extends({
|
|
166
|
+
hasUploadStatus: true
|
|
167
|
+
}, sizeProps, {
|
|
168
|
+
key: props.filename
|
|
169
|
+
}), /*#__PURE__*/_react.default.createElement(_fileUploadStatus.default, props)))));
|
|
170
|
+
});
|
|
171
|
+
FileInput.propTypes = {
|
|
172
|
+
"accept": _propTypes.default.string,
|
|
173
|
+
"buttonText": _propTypes.default.string,
|
|
174
|
+
"data-component": _propTypes.default.string,
|
|
175
|
+
"data-element": _propTypes.default.string,
|
|
176
|
+
"data-role": _propTypes.default.string,
|
|
177
|
+
"dragAndDropText": _propTypes.default.string,
|
|
178
|
+
"error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
179
|
+
"id": _propTypes.default.string,
|
|
180
|
+
"inputHint": _propTypes.default.node,
|
|
181
|
+
"isVertical": _propTypes.default.bool,
|
|
182
|
+
"label": _propTypes.default.string,
|
|
183
|
+
"m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
184
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
185
|
+
"description": _propTypes.default.string,
|
|
186
|
+
"toString": _propTypes.default.func.isRequired,
|
|
187
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
188
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
189
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
190
|
+
"description": _propTypes.default.string,
|
|
191
|
+
"toString": _propTypes.default.func.isRequired,
|
|
192
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
193
|
+
}), _propTypes.default.string]),
|
|
194
|
+
"margin": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
195
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
196
|
+
"description": _propTypes.default.string,
|
|
197
|
+
"toString": _propTypes.default.func.isRequired,
|
|
198
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
199
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
200
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
201
|
+
"description": _propTypes.default.string,
|
|
202
|
+
"toString": _propTypes.default.func.isRequired,
|
|
203
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
204
|
+
}), _propTypes.default.string]),
|
|
205
|
+
"marginBottom": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
206
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
207
|
+
"description": _propTypes.default.string,
|
|
208
|
+
"toString": _propTypes.default.func.isRequired,
|
|
209
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
210
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
211
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
212
|
+
"description": _propTypes.default.string,
|
|
213
|
+
"toString": _propTypes.default.func.isRequired,
|
|
214
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
215
|
+
}), _propTypes.default.string]),
|
|
216
|
+
"marginLeft": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
217
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
218
|
+
"description": _propTypes.default.string,
|
|
219
|
+
"toString": _propTypes.default.func.isRequired,
|
|
220
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
221
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
222
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
223
|
+
"description": _propTypes.default.string,
|
|
224
|
+
"toString": _propTypes.default.func.isRequired,
|
|
225
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
226
|
+
}), _propTypes.default.string]),
|
|
227
|
+
"marginRight": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
228
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
229
|
+
"description": _propTypes.default.string,
|
|
230
|
+
"toString": _propTypes.default.func.isRequired,
|
|
231
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
232
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
233
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
234
|
+
"description": _propTypes.default.string,
|
|
235
|
+
"toString": _propTypes.default.func.isRequired,
|
|
236
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
237
|
+
}), _propTypes.default.string]),
|
|
238
|
+
"marginTop": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
239
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
240
|
+
"description": _propTypes.default.string,
|
|
241
|
+
"toString": _propTypes.default.func.isRequired,
|
|
242
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
243
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
244
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
245
|
+
"description": _propTypes.default.string,
|
|
246
|
+
"toString": _propTypes.default.func.isRequired,
|
|
247
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
248
|
+
}), _propTypes.default.string]),
|
|
249
|
+
"marginX": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
250
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
251
|
+
"description": _propTypes.default.string,
|
|
252
|
+
"toString": _propTypes.default.func.isRequired,
|
|
253
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
254
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
255
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
256
|
+
"description": _propTypes.default.string,
|
|
257
|
+
"toString": _propTypes.default.func.isRequired,
|
|
258
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
259
|
+
}), _propTypes.default.string]),
|
|
260
|
+
"marginY": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
261
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
262
|
+
"description": _propTypes.default.string,
|
|
263
|
+
"toString": _propTypes.default.func.isRequired,
|
|
264
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
265
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
266
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
267
|
+
"description": _propTypes.default.string,
|
|
268
|
+
"toString": _propTypes.default.func.isRequired,
|
|
269
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
270
|
+
}), _propTypes.default.string]),
|
|
271
|
+
"maxHeight": _propTypes.default.string,
|
|
272
|
+
"maxWidth": _propTypes.default.string,
|
|
273
|
+
"mb": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
274
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
275
|
+
"description": _propTypes.default.string,
|
|
276
|
+
"toString": _propTypes.default.func.isRequired,
|
|
277
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
278
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
279
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
280
|
+
"description": _propTypes.default.string,
|
|
281
|
+
"toString": _propTypes.default.func.isRequired,
|
|
282
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
283
|
+
}), _propTypes.default.string]),
|
|
284
|
+
"minHeight": _propTypes.default.string,
|
|
285
|
+
"minWidth": _propTypes.default.string,
|
|
286
|
+
"ml": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
287
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
288
|
+
"description": _propTypes.default.string,
|
|
289
|
+
"toString": _propTypes.default.func.isRequired,
|
|
290
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
291
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
292
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
293
|
+
"description": _propTypes.default.string,
|
|
294
|
+
"toString": _propTypes.default.func.isRequired,
|
|
295
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
296
|
+
}), _propTypes.default.string]),
|
|
297
|
+
"mr": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
298
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
299
|
+
"description": _propTypes.default.string,
|
|
300
|
+
"toString": _propTypes.default.func.isRequired,
|
|
301
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
302
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
303
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
304
|
+
"description": _propTypes.default.string,
|
|
305
|
+
"toString": _propTypes.default.func.isRequired,
|
|
306
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
307
|
+
}), _propTypes.default.string]),
|
|
308
|
+
"mt": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
309
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
310
|
+
"description": _propTypes.default.string,
|
|
311
|
+
"toString": _propTypes.default.func.isRequired,
|
|
312
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
313
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
314
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
315
|
+
"description": _propTypes.default.string,
|
|
316
|
+
"toString": _propTypes.default.func.isRequired,
|
|
317
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
318
|
+
}), _propTypes.default.string]),
|
|
319
|
+
"mx": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
320
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
321
|
+
"description": _propTypes.default.string,
|
|
322
|
+
"toString": _propTypes.default.func.isRequired,
|
|
323
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
324
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
325
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
326
|
+
"description": _propTypes.default.string,
|
|
327
|
+
"toString": _propTypes.default.func.isRequired,
|
|
328
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
329
|
+
}), _propTypes.default.string]),
|
|
330
|
+
"my": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
331
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
332
|
+
"description": _propTypes.default.string,
|
|
333
|
+
"toString": _propTypes.default.func.isRequired,
|
|
334
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
335
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
336
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
337
|
+
"description": _propTypes.default.string,
|
|
338
|
+
"toString": _propTypes.default.func.isRequired,
|
|
339
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
340
|
+
}), _propTypes.default.string]),
|
|
341
|
+
"name": _propTypes.default.string,
|
|
342
|
+
"onChange": _propTypes.default.func.isRequired,
|
|
343
|
+
"required": _propTypes.default.bool,
|
|
344
|
+
"uploadStatus": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.shape({
|
|
345
|
+
"filename": _propTypes.default.string.isRequired,
|
|
346
|
+
"iconType": _propTypes.default.oneOf(["accessibility_web", "add", "admin", "alert_on", "alert", "analysis", "app_facebook", "app_instagram", "app_tiktok", "app_twitter", "app_youtube", "apps", "arrow_bottom_right_circle", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_top_left_circle", "arrow_up", "arrow", "arrows_left_right", "attach", "bank_with_card", "bank", "basket_with_squares", "basket", "bed", "bill_paid", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "box_arrow_right", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_pay_date", "calendar_today", "calendar", "call", "camera", "car_lock", "car_money", "car_repair", "card_view", "card_wallet", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "cash", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "check_all", "check_none", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "cloud_co2", "coins", "collaborate", "computer_clock", "connect_off", "connect", "construction", "contact_card", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "dashboard", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "drill", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "form_refresh", "gift", "go", "graduation_hat", "graph", "grid", "hand_cash_coins", "hand_cash_note", "heart_pulse", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "intranet", "italic", "job_seeked", "key", "laptop", "leaf", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "like_no", "like", "link_cloud", "link_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "microphone", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "palm_tree", "pause_circle", "pause", "pdf", "people_switch", "people", "percentage_boxed", "person_info", "person_tick", "person", "petrol_pump", "phone", "piggy_bank", "plane", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "protect", "question_hollow", "question_mark", "question", "recruiting", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "send", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "support_online", "sync", "tag", "talk", "target_man", "target", "theatre_masks", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "volunteering", "warning", "website", "welfare"]),
|
|
347
|
+
"message": _propTypes.default.string,
|
|
348
|
+
"onAction": _propTypes.default.func.isRequired,
|
|
349
|
+
"progress": _propTypes.default.number,
|
|
350
|
+
"status": _propTypes.default.oneOf(["uploading"]).isRequired
|
|
351
|
+
})])), _propTypes.default.object, _propTypes.default.shape({
|
|
352
|
+
"filename": _propTypes.default.string.isRequired,
|
|
353
|
+
"iconType": _propTypes.default.oneOf(["accessibility_web", "add", "admin", "alert_on", "alert", "analysis", "app_facebook", "app_instagram", "app_tiktok", "app_twitter", "app_youtube", "apps", "arrow_bottom_right_circle", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_top_left_circle", "arrow_up", "arrow", "arrows_left_right", "attach", "bank_with_card", "bank", "basket_with_squares", "basket", "bed", "bill_paid", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "box_arrow_right", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_pay_date", "calendar_today", "calendar", "call", "camera", "car_lock", "car_money", "car_repair", "card_view", "card_wallet", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "cash", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "check_all", "check_none", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "cloud_co2", "coins", "collaborate", "computer_clock", "connect_off", "connect", "construction", "contact_card", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "dashboard", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "drill", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "form_refresh", "gift", "go", "graduation_hat", "graph", "grid", "hand_cash_coins", "hand_cash_note", "heart_pulse", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "intranet", "italic", "job_seeked", "key", "laptop", "leaf", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "like_no", "like", "link_cloud", "link_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "microphone", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "palm_tree", "pause_circle", "pause", "pdf", "people_switch", "people", "percentage_boxed", "person_info", "person_tick", "person", "petrol_pump", "phone", "piggy_bank", "plane", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "protect", "question_hollow", "question_mark", "question", "recruiting", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "send", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "support_online", "sync", "tag", "talk", "target_man", "target", "theatre_masks", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "volunteering", "warning", "website", "welfare"]),
|
|
354
|
+
"message": _propTypes.default.string,
|
|
355
|
+
"onAction": _propTypes.default.func.isRequired,
|
|
356
|
+
"progress": _propTypes.default.number,
|
|
357
|
+
"status": _propTypes.default.oneOf(["uploading"]).isRequired
|
|
358
|
+
})])
|
|
359
|
+
};
|
|
360
|
+
FileInput.displayName = "FileInput";
|
|
361
|
+
var _default = exports.default = FileInput;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InputProps } from "../../__internal__/input";
|
|
2
|
+
import type { ValidationProps } from "../../__internal__/validations";
|
|
3
|
+
export declare const StyledHiddenFileInput: import("styled-components").StyledComponent<"input", any, InputProps, never>;
|
|
4
|
+
interface StyledFileInputPresentationProps extends Pick<ValidationProps, "error"> {
|
|
5
|
+
isDraggedOver?: boolean;
|
|
6
|
+
isDraggingFile?: boolean;
|
|
7
|
+
hasUploadStatus?: boolean;
|
|
8
|
+
maxHeight?: string;
|
|
9
|
+
maxWidth?: string;
|
|
10
|
+
minHeight?: string;
|
|
11
|
+
minWidth?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const StyledFileInputPresentation: import("styled-components").StyledComponent<"div", any, StyledFileInputPresentationProps, never>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledHiddenFileInput = exports.StyledFileInputPresentation = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _typography = _interopRequireDefault(require("../typography/typography.style"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
const StyledHiddenFileInput = exports.StyledHiddenFileInput = _styledComponents.default.input`
|
|
13
|
+
display: none;
|
|
14
|
+
`;
|
|
15
|
+
const StyledFileInputPresentation = exports.StyledFileInputPresentation = _styledComponents.default.div`
|
|
16
|
+
${({
|
|
17
|
+
hasUploadStatus,
|
|
18
|
+
minWidth,
|
|
19
|
+
minHeight,
|
|
20
|
+
maxWidth,
|
|
21
|
+
maxHeight
|
|
22
|
+
}) => (0, _styledComponents.css)`
|
|
23
|
+
min-width: ${minWidth};
|
|
24
|
+
min-height: ${minHeight};
|
|
25
|
+
max-width: ${maxWidth};
|
|
26
|
+
${!hasUploadStatus && (0, _styledComponents.css)`
|
|
27
|
+
padding: var(--spacing150);
|
|
28
|
+
max-height: ${maxHeight};
|
|
29
|
+
`}
|
|
30
|
+
`}
|
|
31
|
+
|
|
32
|
+
${({
|
|
33
|
+
hasUploadStatus,
|
|
34
|
+
isDraggedOver,
|
|
35
|
+
isDraggingFile,
|
|
36
|
+
error
|
|
37
|
+
}) => {
|
|
38
|
+
const borderWidthToken = error || isDraggingFile ? "borderWidth200" : "borderWidth100";
|
|
39
|
+
let borderColorToken = "colorsUtilityMajor300";
|
|
40
|
+
let backgroundColorToken = "colorsUtilityYang100";
|
|
41
|
+
if (isDraggedOver) {
|
|
42
|
+
borderColorToken = "colorsUtilityMajor400";
|
|
43
|
+
backgroundColorToken = "colorsUtilityMajor100";
|
|
44
|
+
} else if (isDraggingFile) {
|
|
45
|
+
borderColorToken = "colorsUtilityMajor400";
|
|
46
|
+
}
|
|
47
|
+
if (error) {
|
|
48
|
+
borderColorToken = `colorsSemanticNegative${isDraggingFile ? 600 : 500}`;
|
|
49
|
+
}
|
|
50
|
+
return !hasUploadStatus && (0, _styledComponents.css)`
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
align-content: center;
|
|
56
|
+
align-items: center;
|
|
57
|
+
text-align: center;
|
|
58
|
+
gap: var(--spacing150);
|
|
59
|
+
border-radius: var(--borderRadius050);
|
|
60
|
+
border: var(--${borderWidthToken}) dashed var(--${borderColorToken});
|
|
61
|
+
background: var(--${backgroundColorToken});
|
|
62
|
+
${_typography.default} {
|
|
63
|
+
color: var(--colorsUtilityYin055);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
}}
|
|
67
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _fileInput.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _fileInput = _interopRequireDefault(require("./file-input.component"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _dom = require("@floating-ui/dom");
|
|
10
10
|
var _reactVirtual = require("@tanstack/react-virtual");
|
|
11
11
|
var _findLastIndex = _interopRequireDefault(require("lodash/findLastIndex"));
|
|
12
|
+
var _usePrevious = _interopRequireDefault(require("../../../hooks/__internal__/usePrevious"));
|
|
12
13
|
var _useScrollBlock = _interopRequireDefault(require("../../../hooks/__internal__/useScrollBlock"));
|
|
13
14
|
var _useModalManager = _interopRequireDefault(require("../../../hooks/__internal__/useModalManager"));
|
|
14
15
|
var _selectList = require("./select-list.style");
|
|
@@ -69,7 +70,26 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
69
70
|
allowScroll
|
|
70
71
|
} = (0, _useScrollBlock.default)();
|
|
71
72
|
const actionButtonHeight = (0, _react.useRef)(0);
|
|
73
|
+
const wasOpen = (0, _usePrevious.default)(isOpen);
|
|
74
|
+
|
|
75
|
+
// ensure scroll-position goes back to the top whenever the list is (re)-opened. (On Safari, without this it remains at the bottom if it had been scrolled
|
|
76
|
+
// to the bottom before closing.)
|
|
77
|
+
(0, _react.useEffect)(() => {
|
|
78
|
+
if (isOpen && !wasOpen) {
|
|
79
|
+
listContainerRef.current?.scrollTo(0, 0);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
72
82
|
const overscan = enableVirtualScroll ? virtualScrollOverscan : _react.default.Children.count(children);
|
|
83
|
+
|
|
84
|
+
// need to use a custom rangeExtractor that ensure the currently-selected option, if any, always appears as an option returned from the virtualiser.
|
|
85
|
+
// This ensures that the aria-activedescendant value is always valid even when the currently-selected item is out of the visible range.
|
|
86
|
+
const rangeExtractor = range => {
|
|
87
|
+
const toRender = (0, _reactVirtual.defaultRangeExtractor)(range);
|
|
88
|
+
if (currentOptionsListIndex !== -1 && !toRender.includes(currentOptionsListIndex)) {
|
|
89
|
+
toRender.push(currentOptionsListIndex);
|
|
90
|
+
}
|
|
91
|
+
return toRender;
|
|
92
|
+
};
|
|
73
93
|
const virtualizer = (0, _reactVirtual.useVirtualizer)({
|
|
74
94
|
count: _react.default.Children.count(children),
|
|
75
95
|
getScrollElement: () => listContainerRef.current,
|
|
@@ -77,9 +97,21 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
77
97
|
// value doesn't really seem to matter since we're dynamically measuring, but 40px is the height of a single-line option
|
|
78
98
|
overscan,
|
|
79
99
|
paddingStart: multiColumn ? TABLE_HEADER_HEIGHT : 0,
|
|
80
|
-
scrollPaddingEnd: actionButtonHeight.current
|
|
100
|
+
scrollPaddingEnd: actionButtonHeight.current,
|
|
101
|
+
rangeExtractor
|
|
81
102
|
});
|
|
82
103
|
const items = virtualizer.getVirtualItems();
|
|
104
|
+
|
|
105
|
+
// getVirtualItems returns an empty array of items if the select list is currently closed - which is correct visually but
|
|
106
|
+
// we need to ensure that any currently-selected option is still in the DOM to avoid any accessibility issues.
|
|
107
|
+
// The isOpen prop will ensure that no options are visible regardless of what is in the items array.
|
|
108
|
+
if (items.length === 0 && currentOptionsListIndex !== -1) {
|
|
109
|
+
// only index property is required with the item not visible so the following type assertion, even though incorrect,
|
|
110
|
+
// should be OK
|
|
111
|
+
items.push({
|
|
112
|
+
index: currentOptionsListIndex
|
|
113
|
+
});
|
|
114
|
+
}
|
|
83
115
|
const listHeight = virtualizer.getTotalSize();
|
|
84
116
|
(0, _react.useEffect)(() => {
|
|
85
117
|
if (isOpen) {
|
|
@@ -128,11 +160,13 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
128
160
|
measureElement(element);
|
|
129
161
|
}
|
|
130
162
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
163
|
+
|
|
164
|
+
// the rangeExtractor above can cause an undefined value to be appended to the return items.
|
|
165
|
+
// Easiest way to stop that crashing is just to filter it out.
|
|
166
|
+
const renderedChildren = items.filter(item => item !== undefined).map(({
|
|
167
|
+
index,
|
|
168
|
+
start
|
|
169
|
+
}) => {
|
|
136
170
|
const child = childrenList[index];
|
|
137
171
|
if (! /*#__PURE__*/_react.default.isValidElement(child)) {
|
|
138
172
|
return child;
|
package/lib/locales/en-gb.js
CHANGED
|
@@ -73,6 +73,16 @@ const enGB = {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
|
+
fileInput: {
|
|
77
|
+
dragAndDrop: () => "or drag and drop your file",
|
|
78
|
+
selectFile: () => "Select file",
|
|
79
|
+
fileUploadStatus: () => "File upload status",
|
|
80
|
+
actions: {
|
|
81
|
+
cancel: () => "Cancel upload",
|
|
82
|
+
clear: () => "Clear",
|
|
83
|
+
delete: () => "Delete file"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
76
86
|
heading: {
|
|
77
87
|
backLinkAriaLabel: () => "Back"
|
|
78
88
|
},
|
package/lib/locales/locale.d.ts
CHANGED
|
@@ -50,6 +50,16 @@ interface Locale {
|
|
|
50
50
|
formSummary: (errors: number, warnings: number, type: string) => [string, string] | null;
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
+
fileInput: {
|
|
54
|
+
dragAndDrop: () => string;
|
|
55
|
+
selectFile: () => string;
|
|
56
|
+
fileUploadStatus: () => string;
|
|
57
|
+
actions: {
|
|
58
|
+
cancel: () => string;
|
|
59
|
+
clear: () => string;
|
|
60
|
+
delete: () => string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
53
63
|
heading: {
|
|
54
64
|
backLinkAriaLabel: () => string;
|
|
55
65
|
};
|
package/lib/locales/pl-pl.js
CHANGED
|
@@ -109,6 +109,16 @@ const plPL = {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
+
fileInput: {
|
|
113
|
+
dragAndDrop: () => "lub przeciągnij i upuść plik",
|
|
114
|
+
selectFile: () => "Wybierz pliki",
|
|
115
|
+
fileUploadStatus: () => "Status przesyłania plików",
|
|
116
|
+
actions: {
|
|
117
|
+
cancel: () => "Anuluj przesyłanie",
|
|
118
|
+
clear: () => "Wyczyść",
|
|
119
|
+
delete: () => "Usuń plik"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
112
122
|
heading: {
|
|
113
123
|
backLinkAriaLabel: () => "Wstecz"
|
|
114
124
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "124.
|
|
3
|
+
"version": "124.3.1",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -156,6 +156,7 @@
|
|
|
156
156
|
"jest-environment-jsdom": "^27.5.1",
|
|
157
157
|
"jest-fetch-mock": "^3.0.3",
|
|
158
158
|
"jest-styled-components": "^6.3.4",
|
|
159
|
+
"jsdom-testing-mocks": "^1.11.0",
|
|
159
160
|
"lint-staged": "^11.2.6",
|
|
160
161
|
"mockdate": "^2.0.5",
|
|
161
162
|
"nock": "^13.3.8",
|
|
@@ -182,7 +183,7 @@
|
|
|
182
183
|
"@floating-ui/react-dom": "~1.3.0",
|
|
183
184
|
"@octokit/rest": "^18.12.0",
|
|
184
185
|
"@styled-system/prop-types": "^5.1.5",
|
|
185
|
-
"@tanstack/react-virtual": "3.0.0-beta.
|
|
186
|
+
"@tanstack/react-virtual": "^3.0.0-beta.68",
|
|
186
187
|
"@types/styled-system": "^5.1.22",
|
|
187
188
|
"chalk": "^4.1.2",
|
|
188
189
|
"ci-info": "^3.8.0",
|