@muraldevkit/ui-toolkit 4.74.1 → 4.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js +404 -0
  2. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -0
  3. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.module.scss.js +8 -0
  4. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.module.scss.js.map +1 -0
  5. package/dist/cjs/components/file-upload/constants.js +48 -0
  6. package/dist/cjs/components/file-upload/constants.js.map +1 -0
  7. package/dist/cjs/components/file-upload/helpers.js +67 -0
  8. package/dist/cjs/components/file-upload/helpers.js.map +1 -0
  9. package/dist/cjs/components/link/MrlLink/MrlLink.js.map +1 -1
  10. package/dist/cjs/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
  11. package/dist/cjs/components/table/MrlSmartTable/MrlSmartTable.js.map +1 -1
  12. package/dist/cjs/index.js +37 -31
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/cjs/version.js +1 -1
  15. package/dist/cjs/version.js.map +1 -1
  16. package/dist/components/file-upload/MrlFileUpload/MrlFileUpload.d.ts +154 -0
  17. package/dist/components/file-upload/MrlFileUpload/index.d.ts +1 -0
  18. package/dist/components/file-upload/constants.d.ts +35 -0
  19. package/dist/components/file-upload/helpers.d.ts +35 -0
  20. package/dist/components/file-upload/index.d.ts +2 -0
  21. package/dist/components/index.d.ts +1 -0
  22. package/dist/components/link/MrlLink/MrlLink.d.ts +7 -1
  23. package/dist/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +12 -1
  24. package/dist/components/table/MrlSmartTable/MrlSmartTable.d.ts +41 -0
  25. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js +379 -0
  26. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -0
  27. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.module.scss.js +4 -0
  28. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.module.scss.js.map +1 -0
  29. package/dist/esm/components/file-upload/constants.js +44 -0
  30. package/dist/esm/components/file-upload/constants.js.map +1 -0
  31. package/dist/esm/components/file-upload/helpers.js +62 -0
  32. package/dist/esm/components/file-upload/helpers.js.map +1 -0
  33. package/dist/esm/components/link/MrlLink/MrlLink.js.map +1 -1
  34. package/dist/esm/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
  35. package/dist/esm/components/table/MrlSmartTable/MrlSmartTable.js.map +1 -1
  36. package/dist/esm/index.js +2 -0
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/version.js +1 -1
  39. package/dist/esm/version.js.map +1 -1
  40. package/dist/styles/MrlFileUpload/module.scss +136 -0
  41. package/dist/styles/file-upload/variables.scss +13 -0
  42. package/dist/styles.css +1 -0
  43. package/dist/types/components/file-upload/MrlFileUpload/MrlFileUpload.d.ts +154 -0
  44. package/dist/types/components/file-upload/MrlFileUpload/index.d.ts +1 -0
  45. package/dist/types/components/file-upload/constants.d.ts +35 -0
  46. package/dist/types/components/file-upload/helpers.d.ts +35 -0
  47. package/dist/types/components/file-upload/index.d.ts +2 -0
  48. package/dist/types/components/index.d.ts +1 -0
  49. package/dist/types/components/link/MrlLink/MrlLink.d.ts +7 -1
  50. package/dist/types/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +12 -1
  51. package/dist/types/components/table/MrlSmartTable/MrlSmartTable.d.ts +41 -0
  52. package/package.json +1 -1
@@ -0,0 +1,379 @@
1
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import * as React from 'react';
3
+ import classnames from 'classnames';
4
+ import { importIcon, check } from '@muraldevkit/ds-icons';
5
+ import { MrlButton } from '../../button/MrlButton/MrlButton.js';
6
+ import { MrlInlineMessage } from '../../notification/MrlInlineMessage/MrlInlineMessage.js';
7
+ import { MrlLiveRegion } from '../../live-region/MrlLiveRegion/MrlLiveRegion.js';
8
+ import { MrlProgressBar } from '../../loader/MrlProgressBar/MrlProgressBar.js';
9
+ import { MrlSvg } from '../../svg/MrlSvg/MrlSvg.js';
10
+ import { MrlText } from '../../text/MrlText/MrlText.js';
11
+ import { fileUploadDefaults, DEFAULT_ERROR_MESSAGE } from '../constants.js';
12
+ import { describeConstraints, isAccepted, formatAcceptList, formatBytes } from '../helpers.js';
13
+ import styles from './MrlFileUpload.module.scss.js';
14
+ import { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics/useMrlAnalytics.js';
15
+
16
+ var _excluded = ["accept", "className", "errorMessage", "eventId", "fileName", "heading", "helperText", "label", "maxSizeBytes", "onCancel", "onError", "onFilesSelected", "onRemove", "percent", "showHelperText", "showInlineAlert", "state", "validate", "data-qa"];
17
+
18
+ /**
19
+ * The resting half of the state contract: anything but a reported failure.
20
+ */
21
+
22
+ /**
23
+ * The failure half: reporting an error means saying what went wrong.
24
+ */
25
+
26
+ /**
27
+ * The zone's state and, when it reports a failure, the message that explains it.
28
+ *
29
+ * The two are a union rather than two independent props so that `state="error"`
30
+ * without an `errorMessage` does not compile. An errored zone with no text is
31
+ * signalled by border colour alone, which reaches neither assistive technology
32
+ * nor anyone who cannot distinguish the error hue. A consumer holding the state
33
+ * in a variable typed as the whole union has to narrow it before rendering —
34
+ * that is the point, not an accident.
35
+ */
36
+
37
+ /**
38
+ * A drag-and-drop file upload zone with a keyboard-accessible browse button.
39
+ *
40
+ * The component owns presentation, drag tracking and local validation
41
+ * (`accept`, `maxSizeBytes`); the consumer owns the upload itself and drives
42
+ * `state` and `percent`. Drag and drop is pointer-only by nature, so the
43
+ * button inside the zone is the equivalent path for everyone else and is the
44
+ * affordance exposed to the accessibility tree.
45
+ *
46
+ * @param props - The component props.
47
+ * @returns The MrlFileUpload component.
48
+ */
49
+ function MrlFileUpload(props) {
50
+ var _ref, _ref2;
51
+ var _props$accept = props.accept,
52
+ accept = _props$accept === void 0 ? fileUploadDefaults.accept : _props$accept,
53
+ className = props.className,
54
+ errorMessage = props.errorMessage,
55
+ eventId = props.eventId,
56
+ fileName = props.fileName,
57
+ _props$heading = props.heading,
58
+ heading = _props$heading === void 0 ? fileUploadDefaults.heading : _props$heading,
59
+ helperText = props.helperText,
60
+ label = props.label,
61
+ maxSizeBytes = props.maxSizeBytes,
62
+ onCancel = props.onCancel,
63
+ onError = props.onError,
64
+ onFilesSelected = props.onFilesSelected,
65
+ onRemove = props.onRemove,
66
+ _props$percent = props.percent,
67
+ percent = _props$percent === void 0 ? 0 : _props$percent,
68
+ _props$showHelperText = props.showHelperText,
69
+ showHelperText = _props$showHelperText === void 0 ? fileUploadDefaults.showHelperText : _props$showHelperText,
70
+ _props$showInlineAler = props.showInlineAlert,
71
+ showInlineAlert = _props$showInlineAler === void 0 ? fileUploadDefaults.showInlineAlert : _props$showInlineAler,
72
+ _props$state = props.state,
73
+ state = _props$state === void 0 ? fileUploadDefaults.state : _props$state,
74
+ validate = props.validate,
75
+ dataQa = props['data-qa'],
76
+ rest = _objectWithoutProperties(props, _excluded);
77
+ var _React$useState = React.useState(false),
78
+ _React$useState2 = _slicedToArray(_React$useState, 2),
79
+ isDragging = _React$useState2[0],
80
+ setIsDragging = _React$useState2[1];
81
+ var _React$useState3 = React.useState(null),
82
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
83
+ validationError = _React$useState4[0],
84
+ setValidationError = _React$useState4[1];
85
+ var _React$useState5 = React.useState(null),
86
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
87
+ selectedName = _React$useState6[0],
88
+ setSelectedName = _React$useState6[1];
89
+ var inputRef = React.useRef(null);
90
+ // The action button of whichever view is showing — Browse, Cancel or Remove.
91
+ var actionRef = React.useRef(null);
92
+ // Armed when an interaction puts focus on that button, so the next view swap
93
+ // can hand it back rather than dropping it.
94
+ var shouldRestoreFocus = React.useRef(false);
95
+ // dragenter/dragleave fire for descendants too; counting keeps the state stable.
96
+ var dragDepth = React.useRef(0);
97
+ var reactId = React.useId();
98
+ var labelId = "".concat(reactId, "-label");
99
+ var messageId = "".concat(reactId, "-message");
100
+ var trackInteraction = useMrlTrackInteraction('MrlFileUpload', eventId);
101
+ var isDisabled = state === 'disabled';
102
+ // A failed local validation outranks the consumer's state: no upload started.
103
+ // A disabled zone outranks both — it cannot have accepted a file.
104
+ var effectiveState = isDisabled ? 'disabled' : validationError ? 'error' : state;
105
+ var displayName = (_ref = fileName !== null && fileName !== void 0 ? fileName : selectedName) !== null && _ref !== void 0 ? _ref : '';
106
+ var displayError = (_ref2 = validationError !== null && validationError !== void 0 ? validationError : errorMessage) !== null && _ref2 !== void 0 ? _ref2 : null;
107
+ // An errored zone always carries text. The types forbid reporting 'error'
108
+ // without a message, but a JavaScript consumer can still reach it, and colour
109
+ // alone reaches neither assistive technology nor anyone who cannot see the hue.
110
+ var resolvedError = effectiveState === 'error' ? displayError !== null && displayError !== void 0 ? displayError : DEFAULT_ERROR_MESSAGE : displayError;
111
+ // Derived rather than defaulted, so the copy cannot contradict what validation
112
+ // enforces — and so the size limit is stated before it rejects anyone.
113
+ var resolvedHelperText = helperText !== null && helperText !== void 0 ? helperText : describeConstraints(accept, maxSizeBytes);
114
+ var isBusy = effectiveState === 'uploading';
115
+
116
+ /**
117
+ * Validates a file — against `accept` and `maxSizeBytes`, then against the
118
+ * consumer's own `validate` — and hands it over, or reports why it was
119
+ * rejected. Emits exactly one analytics event per selection.
120
+ *
121
+ * @param file - the file the user chose or dropped
122
+ * @param source - how the file arrived, for analytics only
123
+ */
124
+ var acceptFile = React.useCallback((file, source) => {
125
+ if (!file) return;
126
+ var rejection = null;
127
+ if (!isAccepted(file, accept)) {
128
+ // The rule that rejected the file is the only reliable source for what
129
+ // would be accepted; a hand-written list drifts away from `accept`.
130
+ var types = formatAcceptList(accept);
131
+ rejection = types ? "File type is not valid. Accepted types: ".concat(types) : 'File type is not valid';
132
+ } else if (maxSizeBytes !== undefined && file.size > maxSizeBytes) {
133
+ rejection = "File is larger than ".concat(formatBytes(maxSizeBytes));
134
+ } else {
135
+ var _validate;
136
+ // The consumer's rules run last, so a file that fails the component's
137
+ // own checks never reaches them.
138
+ rejection = (_validate = validate === null || validate === void 0 ? void 0 : validate(file)) !== null && _validate !== void 0 ? _validate : null;
139
+ }
140
+
141
+ // The file's name, size and type are consumer data and are never emitted.
142
+ trackInteraction({
143
+ action: 'select',
144
+ metadata: {
145
+ outcome: rejection ? 'rejected' : 'accepted',
146
+ source
147
+ }
148
+ });
149
+ if (rejection) {
150
+ setSelectedName(file.name);
151
+ setValidationError(rejection);
152
+ onError === null || onError === void 0 ? void 0 : onError(rejection, file);
153
+ return;
154
+ }
155
+ setSelectedName(file.name);
156
+ setValidationError(null);
157
+ // A browse selection leaves focus on the Browse button, which the consumer
158
+ // is about to unmount by moving to 'uploading'. A drop does not: it is
159
+ // pointer-only, and focus was never in the zone to begin with.
160
+ if (source === 'browse') shouldRestoreFocus.current = true;
161
+ onFilesSelected === null || onFilesSelected === void 0 ? void 0 : onFilesSelected(file);
162
+ }, [accept, maxSizeBytes, onError, onFilesSelected, trackInteraction, validate]);
163
+
164
+ /**
165
+ * Returns the zone to its resting state and clears the native input so the
166
+ * same file can be chosen again.
167
+ */
168
+ var reset = React.useCallback(() => {
169
+ dragDepth.current = 0;
170
+ setIsDragging(false);
171
+ setSelectedName(null);
172
+ setValidationError(null);
173
+ if (inputRef.current) inputRef.current.value = '';
174
+ }, []);
175
+ var handleBrowse = React.useCallback(() => {
176
+ var _inputRef$current;
177
+ if (isDisabled) return;
178
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.click();
179
+ }, [isDisabled]);
180
+ var handleCancel = React.useCallback(() => {
181
+ if (isDisabled) return;
182
+ shouldRestoreFocus.current = true;
183
+ trackInteraction({
184
+ action: 'click',
185
+ metadata: {
186
+ control: 'cancel'
187
+ }
188
+ });
189
+ reset();
190
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
191
+ }, [isDisabled, onCancel, reset, trackInteraction]);
192
+ var handleRemove = React.useCallback(() => {
193
+ if (isDisabled) return;
194
+ shouldRestoreFocus.current = true;
195
+ trackInteraction({
196
+ action: 'clear',
197
+ metadata: {
198
+ control: 'remove'
199
+ }
200
+ });
201
+ reset();
202
+ onRemove === null || onRemove === void 0 ? void 0 : onRemove();
203
+ }, [isDisabled, onRemove, reset, trackInteraction]);
204
+ var handleDragEnter = React.useCallback(event => {
205
+ if (isDisabled || isBusy) return;
206
+ event.preventDefault();
207
+ dragDepth.current += 1;
208
+ setIsDragging(true);
209
+ }, [isDisabled, isBusy]);
210
+ var handleDragOver = React.useCallback(event => {
211
+ if (isDisabled || isBusy) return;
212
+ // Required, or the browser treats the drop as navigation and opens the file.
213
+ event.preventDefault();
214
+ event.dataTransfer.dropEffect = 'copy';
215
+ }, [isDisabled, isBusy]);
216
+ var handleDragLeave = React.useCallback(event => {
217
+ if (isDisabled || isBusy) return;
218
+ event.preventDefault();
219
+ dragDepth.current = Math.max(0, dragDepth.current - 1);
220
+ // Leaving without dropping restores the previous view rather than resetting,
221
+ // so a completed or errored zone is not cleared by a passing cursor.
222
+ if (dragDepth.current === 0) setIsDragging(false);
223
+ }, [isDisabled, isBusy]);
224
+ var handleDrop = React.useCallback(event => {
225
+ var _event$dataTransfer$f;
226
+ if (isDisabled || isBusy) return;
227
+ event.preventDefault();
228
+ dragDepth.current = 0;
229
+ setIsDragging(false);
230
+ acceptFile((_event$dataTransfer$f = event.dataTransfer.files) === null || _event$dataTransfer$f === void 0 ? void 0 : _event$dataTransfer$f[0], 'drop');
231
+ }, [acceptFile, isDisabled, isBusy]);
232
+ var handleInputChange = React.useCallback(event => {
233
+ var _event$target$files;
234
+ var file = (_event$target$files = event.target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0];
235
+ // Cleared before validating: the native control fires `change` only when
236
+ // the selection changes, so re-picking a corrected file would be silent.
237
+ event.target.value = '';
238
+ acceptFile(file, 'browse');
239
+ }, [acceptFile]);
240
+ var view = isDragging ? 'dragging' : effectiveState;
241
+
242
+ /*
243
+ * Each view renders its action button at a different position inside the zone,
244
+ * so React unmounts one and mounts another rather than reusing it, and the
245
+ * browser drops focus to the body — sending a keyboard user back to the top of
246
+ * the page mid-task. Hand focus to the button that replaced it, but only when
247
+ * it was genuinely lost: never take it from someone who has tabbed away.
248
+ */
249
+ React.useLayoutEffect(() => {
250
+ if (!shouldRestoreFocus.current) return;
251
+ var focusWasLost = !document.activeElement || document.activeElement === document.body;
252
+ shouldRestoreFocus.current = false;
253
+ if (focusWasLost) {
254
+ var _actionRef$current;
255
+ (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : _actionRef$current.focus();
256
+ // Focus is inside the zone again, so keep the chain armed for the next
257
+ // swap — an upload the consumer completes on its own included.
258
+ shouldRestoreFocus.current = true;
259
+ }
260
+ }, [view]);
261
+
262
+ /* eslint-disable sort-keys */
263
+ var zoneClasses = classnames({
264
+ [styles['MrlFileUpload-zone']]: true,
265
+ 'MrlFileUpload-zone': true,
266
+ [styles["MrlFileUpload-zone--".concat(view)]]: view !== 'idle'
267
+ });
268
+ /* eslint-enable sort-keys */
269
+
270
+ var inlineKind = resolvedError ? 'error' : 'helper';
271
+ var inlineMessage = resolvedError !== null && resolvedError !== void 0 ? resolvedError : showInlineAlert ? resolvedHelperText : null;
272
+ var announcement = () => {
273
+ if (effectiveState === 'uploading') {
274
+ // Quantised to 10% steps. A live region queues announcements rather than
275
+ // replacing them, so narrating every tick buries 'upload successful'
276
+ // behind a backlog that is usually discarded before it is spoken.
277
+ var step = Math.floor(Math.round(percent) / 10) * 10;
278
+ return "Uploading ".concat(displayName, ", ").concat(step, "%");
279
+ }
280
+ if (effectiveState === 'complete') return "Upload of ".concat(displayName, " successful");
281
+ if (effectiveState === 'error' && resolvedError) {
282
+ // Prefixed with the file name so two failures for the same reason are two
283
+ // different strings: a live region re-set to the same text stays silent.
284
+ return displayName ? "".concat(displayName, ": ").concat(resolvedError) : resolvedError;
285
+ }
286
+ return '';
287
+ };
288
+ var restingContent = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
289
+ className: classnames(styles['MrlFileUpload-content'], 'MrlFileUpload-content')
290
+ }, /*#__PURE__*/React.createElement("p", {
291
+ className: classnames(styles['MrlFileUpload-heading'], 'MrlFileUpload-heading')
292
+ }, heading), showHelperText && resolvedHelperText && /*#__PURE__*/React.createElement(MrlText, {
293
+ size: "small"
294
+ }, resolvedHelperText)), /*#__PURE__*/React.createElement(MrlButton, {
295
+ "aria-describedby": inlineMessage ? messageId : undefined,
296
+ kind: "secondary",
297
+ ref: actionRef,
298
+ size: "small",
299
+ state: isDisabled ? 'disabled' : 'default',
300
+ text: "Browse files",
301
+ onClick: handleBrowse
302
+ }));
303
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
304
+ "data-qa": dataQa,
305
+ className: classnames(styles['MrlFileUpload'], 'MrlFileUpload', className)
306
+ }), label && /*#__PURE__*/React.createElement("span", {
307
+ className: classnames(styles['MrlFileUpload-label'], 'MrlFileUpload-label'),
308
+ id: labelId
309
+ }, label), /*#__PURE__*/React.createElement("div", {
310
+ "aria-describedby": inlineMessage ? messageId : undefined,
311
+ "aria-disabled": isDisabled || undefined,
312
+ "aria-label": label ? undefined : heading,
313
+ "aria-labelledby": label ? labelId : undefined,
314
+ className: zoneClasses,
315
+ role: "group",
316
+ onDragEnter: handleDragEnter,
317
+ onDragLeave: handleDragLeave,
318
+ onDragOver: handleDragOver,
319
+ onDrop: handleDrop
320
+ }, (view === 'idle' || view === 'error' || view === 'disabled') && restingContent, view === 'dragging' && /*#__PURE__*/React.createElement("div", {
321
+ className: classnames(styles['MrlFileUpload-preloader'])
322
+ }, /*#__PURE__*/React.createElement(MrlSvg, {
323
+ className: classnames(styles['MrlFileUpload-icon'], styles['MrlFileUpload-icon--accent']),
324
+ size: "auto",
325
+ svg: importIcon
326
+ }), /*#__PURE__*/React.createElement("p", {
327
+ className: classnames(styles['MrlFileUpload-heading'], styles['MrlFileUpload-heading--accent'])
328
+ }, "Drop your files")), view === 'uploading' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
329
+ className: classnames(styles['MrlFileUpload-preloader'])
330
+ }, /*#__PURE__*/React.createElement("div", {
331
+ className: classnames(styles['MrlFileUpload-progress'])
332
+ }, /*#__PURE__*/React.createElement(MrlProgressBar, {
333
+ name: "Uploading ".concat(displayName || 'file'),
334
+ percent: Math.round(percent)
335
+ })), /*#__PURE__*/React.createElement("p", {
336
+ className: classnames(styles['MrlFileUpload-heading'], styles['MrlFileUpload-heading--strong'])
337
+ }, "Uploading ", displayName)), /*#__PURE__*/React.createElement(MrlButton, {
338
+ "aria-describedby": inlineMessage ? messageId : undefined,
339
+ kind: "secondary",
340
+ ref: actionRef,
341
+ size: "small",
342
+ text: "Cancel",
343
+ onClick: handleCancel
344
+ })), view === 'complete' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
345
+ className: classnames(styles['MrlFileUpload-preloader'])
346
+ }, /*#__PURE__*/React.createElement(MrlSvg, {
347
+ className: classnames(styles['MrlFileUpload-icon'], styles['MrlFileUpload-icon--success']),
348
+ size: "auto",
349
+ svg: check
350
+ }), /*#__PURE__*/React.createElement("p", {
351
+ className: classnames(styles['MrlFileUpload-heading'], styles['MrlFileUpload-heading--strong'])
352
+ }, "Upload of ", displayName, " successful!")), /*#__PURE__*/React.createElement(MrlButton, {
353
+ "aria-describedby": inlineMessage ? messageId : undefined,
354
+ kind: "secondary",
355
+ ref: actionRef,
356
+ size: "small",
357
+ text: "Remove",
358
+ onClick: handleRemove
359
+ }))), inlineMessage && /*#__PURE__*/React.createElement(MrlInlineMessage, {
360
+ id: messageId,
361
+ kind: inlineKind,
362
+ message: inlineMessage
363
+ }), /*#__PURE__*/React.createElement("input", {
364
+ accept: accept || undefined,
365
+ "aria-hidden": "true",
366
+ className: classnames(styles['MrlFileUpload-input']),
367
+ disabled: isDisabled,
368
+ ref: inputRef,
369
+ tabIndex: -1,
370
+ type: "file",
371
+ onChange: handleInputChange
372
+ }), /*#__PURE__*/React.createElement(MrlLiveRegion, {
373
+ ariaLive: "polite",
374
+ srContent: announcement()
375
+ }));
376
+ }
377
+
378
+ export { MrlFileUpload };
379
+ //# sourceMappingURL=MrlFileUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MrlFileUpload.js","sources":["../../../../../src/components/file-upload/MrlFileUpload/MrlFileUpload.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { check, importIcon } from '@muraldevkit/ds-icons';\nimport { MrlButton } from '../../button/MrlButton/MrlButton';\nimport { MrlInlineMessage } from '../../notification/MrlInlineMessage/MrlInlineMessage';\nimport { MrlLiveRegion } from '../../live-region/MrlLiveRegion/MrlLiveRegion';\nimport { MrlProgressBar } from '../../loader/MrlProgressBar/MrlProgressBar';\nimport { MrlSvg } from '../../svg/MrlSvg/MrlSvg';\nimport { MrlText } from '../../text/MrlText/MrlText';\nimport { ProgressRange } from '../../loader/constants';\nimport { DataQa } from '../../../utils/dataQa';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\nimport { DEFAULT_ERROR_MESSAGE, fileUploadDefaults, MrlFileUploadState } from '../constants';\nimport { describeConstraints, formatAcceptList, formatBytes, isAccepted } from '../helpers';\nimport styles from './MrlFileUpload.module.scss';\n\n/**\n * The resting half of the state contract: anything but a reported failure.\n */\ntype MrlFileUploadRestingProps = {\n\t/**\n\t * Message for a failure the consumer is not currently reporting — kept across\n\t * a retry, for instance. Rendered only in the error state.\n\t */\n\terrorMessage?: string;\n\t/**\n\t * The visual state of the zone, owned by the consumer. The component tracks\n\t * drag state and local validation itself, but never starts, advances or\n\t * completes an upload — pass 'uploading' with a `percent`, then 'complete'.\n\t * Reporting 'error' requires an `errorMessage`, so it lives in the other half\n\t * of this union.\n\t *\n\t * 'disabled' blocks all interaction: drag, drop and click handlers return\n\t * early rather than relying on `pointer-events` alone. Because it is a value\n\t * of this union rather than a separate flag, it replaces the lifecycle state\n\t * rather than composing with it — a zone cannot be disabled *and* report\n\t * progress at the same time.\n\t */\n\tstate?: Exclude<MrlFileUploadState, 'error'>;\n};\n\n/**\n * The failure half: reporting an error means saying what went wrong.\n */\ntype MrlFileUploadErrorProps = {\n\t/**\n\t * Why the upload failed. Required alongside `state=\"error\"`: the failure has\n\t * to reach people who cannot see the border colour.\n\t *\n\t * A retry that fails with the identical message is announced only once — a\n\t * live region re-set to the text it already holds says nothing, and the\n\t * component cannot tell a retry from a re-render. Pass through a non-error\n\t * state between attempts (back to 'idle', or 'uploading' while the retry is\n\t * in flight) so the second failure is a genuine change.\n\t */\n\terrorMessage: string;\n\t/**\n\t * Reports a failed upload. A local validation failure supplies its own\n\t * message and takes precedence over `errorMessage`.\n\t */\n\tstate: 'error';\n};\n\n/**\n * The zone's state and, when it reports a failure, the message that explains it.\n *\n * The two are a union rather than two independent props so that `state=\"error\"`\n * without an `errorMessage` does not compile. An errored zone with no text is\n * signalled by border colour alone, which reaches neither assistive technology\n * nor anyone who cannot distinguish the error hue. A consumer holding the state\n * in a variable typed as the whole union has to narrow it before rendering —\n * that is the point, not an accident.\n */\nexport type MrlFileUploadStateProps = MrlFileUploadRestingProps | MrlFileUploadErrorProps;\n\nexport type MrlFileUploadProps = {\n\t/**\n\t * Accepted file types, in the same format as the native `accept` attribute\n\t * (e.g. '.gif,.jpg,.jpeg,.png' or 'image/*'). Also enforced on drop, which\n\t * the native attribute does not cover.\n\t */\n\taccept?: string;\n\t/**\n\t * Name of the file being uploaded, shown in the progress and completed copy\n\t * and announced to assistive technology. Falls back to the name of the file\n\t * the user last selected.\n\t */\n\tfileName?: string;\n\t/**\n\t * Headline inside the drop zone.\n\t */\n\theading?: string;\n\t/**\n\t * Supporting line describing what is accepted.\n\t */\n\thelperText?: string;\n\t/**\n\t * Field label rendered above the drop zone, and the zone's accessible name.\n\t */\n\tlabel?: string;\n\t/**\n\t * Maximum accepted file size in bytes. Omit for no limit.\n\t */\n\tmaxSizeBytes?: number;\n\t/**\n\t * Fired when the user cancels an upload in progress. The consumer owns the\n\t * abort — the component only returns itself to its resting state.\n\t */\n\tonCancel?: () => void;\n\t/**\n\t * Fired when a file fails local validation, with the message shown to the\n\t * user. Transport failures are reported by the consumer through\n\t * `state=\"error\"` instead.\n\t */\n\tonError?: (message: string, file: File) => void;\n\t/**\n\t * Fired when a file passes validation and is ready to upload. The consumer\n\t * performs the upload and drives `state` and `percent` from its result.\n\t */\n\tonFilesSelected?: (file: File) => void;\n\t/**\n\t * Fired when the user removes a completed upload.\n\t */\n\tonRemove?: () => void;\n\t/**\n\t * Upload progress, 0–100. Only read while `state` is 'uploading'.\n\t */\n\tpercent?: ProgressRange;\n\t/**\n\t * Shows `helperText` inside the drop zone.\n\t */\n\tshowHelperText?: boolean;\n\t/**\n\t * Repeats `helperText` as an inline message below the drop zone. Off by\n\t * default — with `showHelperText` on, enabling both prints the same sentence\n\t * twice. A validation or upload error always renders below the zone\n\t * regardless of this flag.\n\t */\n\tshowInlineAlert?: boolean;\n\t/**\n\t * Additional validation, run after the built-in `accept` and `maxSizeBytes`\n\t * checks and only if those pass. Return a message to reject the file — it is\n\t * shown and reported exactly like a built-in failure — or `null` to accept it.\n\t */\n\tvalidate?: (file: File) => string | null;\n\t/**\n\t * Enables interaction tracking for this upload control. Provide a stable,\n\t * non-PII id (e.g. 'workspace-logo-upload'). When omitted, the component\n\t * emits no analytics.\n\t *\n\t * Note: file names, sizes and types are never emitted — only the fact of a\n\t * selection and whether it was accepted.\n\t */\n\teventId?: string;\n} & MrlFileUploadStateProps &\n\tOmit<React.ComponentPropsWithoutRef<'div'>, 'onError'> &\n\tDataQa;\n\n/**\n * A drag-and-drop file upload zone with a keyboard-accessible browse button.\n *\n * The component owns presentation, drag tracking and local validation\n * (`accept`, `maxSizeBytes`); the consumer owns the upload itself and drives\n * `state` and `percent`. Drag and drop is pointer-only by nature, so the\n * button inside the zone is the equivalent path for everyone else and is the\n * affordance exposed to the accessibility tree.\n *\n * @param props - The component props.\n * @returns The MrlFileUpload component.\n */\nexport function MrlFileUpload(props: MrlFileUploadProps): React.ReactElement {\n\tconst {\n\t\taccept = fileUploadDefaults.accept,\n\t\tclassName,\n\t\terrorMessage,\n\t\teventId,\n\t\tfileName,\n\t\theading = fileUploadDefaults.heading,\n\t\thelperText,\n\t\tlabel,\n\t\tmaxSizeBytes,\n\t\tonCancel,\n\t\tonError,\n\t\tonFilesSelected,\n\t\tonRemove,\n\t\tpercent = 0,\n\t\tshowHelperText = fileUploadDefaults.showHelperText,\n\t\tshowInlineAlert = fileUploadDefaults.showInlineAlert,\n\t\tstate = fileUploadDefaults.state,\n\t\tvalidate,\n\t\t['data-qa']: dataQa,\n\t\t...rest\n\t} = props;\n\n\tconst [isDragging, setIsDragging] = React.useState(false);\n\tconst [validationError, setValidationError] = React.useState<string | null>(null);\n\tconst [selectedName, setSelectedName] = React.useState<string | null>(null);\n\n\tconst inputRef = React.useRef<HTMLInputElement>(null);\n\t// The action button of whichever view is showing — Browse, Cancel or Remove.\n\tconst actionRef = React.useRef<HTMLButtonElement>(null);\n\t// Armed when an interaction puts focus on that button, so the next view swap\n\t// can hand it back rather than dropping it.\n\tconst shouldRestoreFocus = React.useRef(false);\n\t// dragenter/dragleave fire for descendants too; counting keeps the state stable.\n\tconst dragDepth = React.useRef(0);\n\n\tconst reactId = React.useId();\n\tconst labelId = `${reactId}-label`;\n\tconst messageId = `${reactId}-message`;\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlFileUpload', eventId);\n\n\tconst isDisabled = state === 'disabled';\n\t// A failed local validation outranks the consumer's state: no upload started.\n\t// A disabled zone outranks both — it cannot have accepted a file.\n\tconst effectiveState: MrlFileUploadState = isDisabled\n\t\t? 'disabled'\n\t\t: validationError\n\t\t\t? 'error'\n\t\t\t: state;\n\tconst displayName = fileName ?? selectedName ?? '';\n\tconst displayError = validationError ?? errorMessage ?? null;\n\t// An errored zone always carries text. The types forbid reporting 'error'\n\t// without a message, but a JavaScript consumer can still reach it, and colour\n\t// alone reaches neither assistive technology nor anyone who cannot see the hue.\n\tconst resolvedError =\n\t\teffectiveState === 'error' ? (displayError ?? DEFAULT_ERROR_MESSAGE) : displayError;\n\t// Derived rather than defaulted, so the copy cannot contradict what validation\n\t// enforces — and so the size limit is stated before it rejects anyone.\n\tconst resolvedHelperText = helperText ?? describeConstraints(accept, maxSizeBytes);\n\tconst isBusy = effectiveState === 'uploading';\n\n\t/**\n\t * Validates a file — against `accept` and `maxSizeBytes`, then against the\n\t * consumer's own `validate` — and hands it over, or reports why it was\n\t * rejected. Emits exactly one analytics event per selection.\n\t *\n\t * @param file - the file the user chose or dropped\n\t * @param source - how the file arrived, for analytics only\n\t */\n\tconst acceptFile = React.useCallback(\n\t\t(file: File | undefined, source: 'browse' | 'drop') => {\n\t\t\tif (!file) return;\n\n\t\t\tlet rejection: string | null = null;\n\n\t\t\tif (!isAccepted(file, accept)) {\n\t\t\t\t// The rule that rejected the file is the only reliable source for what\n\t\t\t\t// would be accepted; a hand-written list drifts away from `accept`.\n\t\t\t\tconst types = formatAcceptList(accept);\n\t\t\t\trejection = types\n\t\t\t\t\t? `File type is not valid. Accepted types: ${types}`\n\t\t\t\t\t: 'File type is not valid';\n\t\t\t} else if (maxSizeBytes !== undefined && file.size > maxSizeBytes) {\n\t\t\t\trejection = `File is larger than ${formatBytes(maxSizeBytes)}`;\n\t\t\t} else {\n\t\t\t\t// The consumer's rules run last, so a file that fails the component's\n\t\t\t\t// own checks never reaches them.\n\t\t\t\trejection = validate?.(file) ?? null;\n\t\t\t}\n\n\t\t\t// The file's name, size and type are consumer data and are never emitted.\n\t\t\ttrackInteraction({\n\t\t\t\taction: 'select',\n\t\t\t\tmetadata: { outcome: rejection ? 'rejected' : 'accepted', source }\n\t\t\t});\n\n\t\t\tif (rejection) {\n\t\t\t\tsetSelectedName(file.name);\n\t\t\t\tsetValidationError(rejection);\n\t\t\t\tonError?.(rejection, file);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetSelectedName(file.name);\n\t\t\tsetValidationError(null);\n\t\t\t// A browse selection leaves focus on the Browse button, which the consumer\n\t\t\t// is about to unmount by moving to 'uploading'. A drop does not: it is\n\t\t\t// pointer-only, and focus was never in the zone to begin with.\n\t\t\tif (source === 'browse') shouldRestoreFocus.current = true;\n\t\t\tonFilesSelected?.(file);\n\t\t},\n\t\t[accept, maxSizeBytes, onError, onFilesSelected, trackInteraction, validate]\n\t);\n\n\t/**\n\t * Returns the zone to its resting state and clears the native input so the\n\t * same file can be chosen again.\n\t */\n\tconst reset = React.useCallback(() => {\n\t\tdragDepth.current = 0;\n\t\tsetIsDragging(false);\n\t\tsetSelectedName(null);\n\t\tsetValidationError(null);\n\t\tif (inputRef.current) inputRef.current.value = '';\n\t}, []);\n\n\tconst handleBrowse = React.useCallback(() => {\n\t\tif (isDisabled) return;\n\t\tinputRef.current?.click();\n\t}, [isDisabled]);\n\n\tconst handleCancel = React.useCallback(() => {\n\t\tif (isDisabled) return;\n\t\tshouldRestoreFocus.current = true;\n\t\ttrackInteraction({ action: 'click', metadata: { control: 'cancel' } });\n\t\treset();\n\t\tonCancel?.();\n\t}, [isDisabled, onCancel, reset, trackInteraction]);\n\n\tconst handleRemove = React.useCallback(() => {\n\t\tif (isDisabled) return;\n\t\tshouldRestoreFocus.current = true;\n\t\ttrackInteraction({ action: 'clear', metadata: { control: 'remove' } });\n\t\treset();\n\t\tonRemove?.();\n\t}, [isDisabled, onRemove, reset, trackInteraction]);\n\n\tconst handleDragEnter = React.useCallback(\n\t\t(event: React.DragEvent<HTMLDivElement>) => {\n\t\t\tif (isDisabled || isBusy) return;\n\t\t\tevent.preventDefault();\n\t\t\tdragDepth.current += 1;\n\t\t\tsetIsDragging(true);\n\t\t},\n\t\t[isDisabled, isBusy]\n\t);\n\n\tconst handleDragOver = React.useCallback(\n\t\t(event: React.DragEvent<HTMLDivElement>) => {\n\t\t\tif (isDisabled || isBusy) return;\n\t\t\t// Required, or the browser treats the drop as navigation and opens the file.\n\t\t\tevent.preventDefault();\n\t\t\tevent.dataTransfer.dropEffect = 'copy';\n\t\t},\n\t\t[isDisabled, isBusy]\n\t);\n\n\tconst handleDragLeave = React.useCallback(\n\t\t(event: React.DragEvent<HTMLDivElement>) => {\n\t\t\tif (isDisabled || isBusy) return;\n\t\t\tevent.preventDefault();\n\t\t\tdragDepth.current = Math.max(0, dragDepth.current - 1);\n\t\t\t// Leaving without dropping restores the previous view rather than resetting,\n\t\t\t// so a completed or errored zone is not cleared by a passing cursor.\n\t\t\tif (dragDepth.current === 0) setIsDragging(false);\n\t\t},\n\t\t[isDisabled, isBusy]\n\t);\n\n\tconst handleDrop = React.useCallback(\n\t\t(event: React.DragEvent<HTMLDivElement>) => {\n\t\t\tif (isDisabled || isBusy) return;\n\t\t\tevent.preventDefault();\n\t\t\tdragDepth.current = 0;\n\t\t\tsetIsDragging(false);\n\t\t\tacceptFile(event.dataTransfer.files?.[0], 'drop');\n\t\t},\n\t\t[acceptFile, isDisabled, isBusy]\n\t);\n\n\tconst handleInputChange = React.useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tconst file = event.target.files?.[0];\n\t\t\t// Cleared before validating: the native control fires `change` only when\n\t\t\t// the selection changes, so re-picking a corrected file would be silent.\n\t\t\tevent.target.value = '';\n\t\t\tacceptFile(file, 'browse');\n\t\t},\n\t\t[acceptFile]\n\t);\n\n\tconst view = isDragging ? 'dragging' : effectiveState;\n\n\t/*\n\t * Each view renders its action button at a different position inside the zone,\n\t * so React unmounts one and mounts another rather than reusing it, and the\n\t * browser drops focus to the body — sending a keyboard user back to the top of\n\t * the page mid-task. Hand focus to the button that replaced it, but only when\n\t * it was genuinely lost: never take it from someone who has tabbed away.\n\t */\n\tReact.useLayoutEffect(() => {\n\t\tif (!shouldRestoreFocus.current) return;\n\n\t\tconst focusWasLost = !document.activeElement || document.activeElement === document.body;\n\t\tshouldRestoreFocus.current = false;\n\n\t\tif (focusWasLost) {\n\t\t\tactionRef.current?.focus();\n\t\t\t// Focus is inside the zone again, so keep the chain armed for the next\n\t\t\t// swap — an upload the consumer completes on its own included.\n\t\t\tshouldRestoreFocus.current = true;\n\t\t}\n\t}, [view]);\n\n\t/* eslint-disable sort-keys */\n\tconst zoneClasses = classnames({\n\t\t[styles['MrlFileUpload-zone']]: true,\n\t\t'MrlFileUpload-zone': true,\n\t\t[styles[`MrlFileUpload-zone--${view}`]]: view !== 'idle'\n\t});\n\t/* eslint-enable sort-keys */\n\n\tconst inlineKind = resolvedError ? 'error' : 'helper';\n\tconst inlineMessage = resolvedError ?? (showInlineAlert ? resolvedHelperText : null);\n\n\tconst announcement = () => {\n\t\tif (effectiveState === 'uploading') {\n\t\t\t// Quantised to 10% steps. A live region queues announcements rather than\n\t\t\t// replacing them, so narrating every tick buries 'upload successful'\n\t\t\t// behind a backlog that is usually discarded before it is spoken.\n\t\t\tconst step = Math.floor(Math.round(percent) / 10) * 10;\n\t\t\treturn `Uploading ${displayName}, ${step}%`;\n\t\t}\n\t\tif (effectiveState === 'complete') return `Upload of ${displayName} successful`;\n\t\tif (effectiveState === 'error' && resolvedError) {\n\t\t\t// Prefixed with the file name so two failures for the same reason are two\n\t\t\t// different strings: a live region re-set to the same text stays silent.\n\t\t\treturn displayName ? `${displayName}: ${resolvedError}` : resolvedError;\n\t\t}\n\t\treturn '';\n\t};\n\n\tconst restingContent = (\n\t\t<>\n\t\t\t<div className={classnames(styles['MrlFileUpload-content'], 'MrlFileUpload-content')}>\n\t\t\t\t<p className={classnames(styles['MrlFileUpload-heading'], 'MrlFileUpload-heading')}>\n\t\t\t\t\t{heading}\n\t\t\t\t</p>\n\t\t\t\t{showHelperText && resolvedHelperText && (\n\t\t\t\t\t<MrlText size=\"small\">{resolvedHelperText}</MrlText>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t<MrlButton\n\t\t\t\taria-describedby={inlineMessage ? messageId : undefined}\n\t\t\t\tkind=\"secondary\"\n\t\t\t\tref={actionRef}\n\t\t\t\tsize=\"small\"\n\t\t\t\tstate={isDisabled ? 'disabled' : 'default'}\n\t\t\t\ttext=\"Browse files\"\n\t\t\t\tonClick={handleBrowse}\n\t\t\t/>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-qa={dataQa}\n\t\t\tclassName={classnames(styles['MrlFileUpload'], 'MrlFileUpload', className)}\n\t\t>\n\t\t\t{label && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={classnames(styles['MrlFileUpload-label'], 'MrlFileUpload-label')}\n\t\t\t\t\tid={labelId}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</span>\n\t\t\t)}\n\n\t\t\t<div\n\t\t\t\taria-describedby={inlineMessage ? messageId : undefined}\n\t\t\t\taria-disabled={isDisabled || undefined}\n\t\t\t\taria-label={label ? undefined : heading}\n\t\t\t\taria-labelledby={label ? labelId : undefined}\n\t\t\t\tclassName={zoneClasses}\n\t\t\t\trole=\"group\"\n\t\t\t\tonDragEnter={handleDragEnter}\n\t\t\t\tonDragLeave={handleDragLeave}\n\t\t\t\tonDragOver={handleDragOver}\n\t\t\t\tonDrop={handleDrop}\n\t\t\t>\n\t\t\t\t{(view === 'idle' || view === 'error' || view === 'disabled') && restingContent}\n\n\t\t\t\t{view === 'dragging' && (\n\t\t\t\t\t<div className={classnames(styles['MrlFileUpload-preloader'])}>\n\t\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\t\t\tstyles['MrlFileUpload-icon'],\n\t\t\t\t\t\t\t\tstyles['MrlFileUpload-icon--accent']\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tsize=\"auto\"\n\t\t\t\t\t\t\tsvg={importIcon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\t\t\tstyles['MrlFileUpload-heading'],\n\t\t\t\t\t\t\t\tstyles['MrlFileUpload-heading--accent']\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tDrop your files\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t{view === 'uploading' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className={classnames(styles['MrlFileUpload-preloader'])}>\n\t\t\t\t\t\t\t<div className={classnames(styles['MrlFileUpload-progress'])}>\n\t\t\t\t\t\t\t\t<MrlProgressBar\n\t\t\t\t\t\t\t\t\tname={`Uploading ${displayName || 'file'}`}\n\t\t\t\t\t\t\t\t\tpercent={Math.round(percent) as ProgressRange}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\t\t\t\tstyles['MrlFileUpload-heading'],\n\t\t\t\t\t\t\t\t\tstyles['MrlFileUpload-heading--strong']\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tUploading {displayName}\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<MrlButton\n\t\t\t\t\t\t\taria-describedby={inlineMessage ? messageId : undefined}\n\t\t\t\t\t\t\tkind=\"secondary\"\n\t\t\t\t\t\t\tref={actionRef}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ttext=\"Cancel\"\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t{view === 'complete' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className={classnames(styles['MrlFileUpload-preloader'])}>\n\t\t\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\t\t\t\tstyles['MrlFileUpload-icon'],\n\t\t\t\t\t\t\t\t\tstyles['MrlFileUpload-icon--success']\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tsize=\"auto\"\n\t\t\t\t\t\t\t\tsvg={check}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\t\t\t\tstyles['MrlFileUpload-heading'],\n\t\t\t\t\t\t\t\t\tstyles['MrlFileUpload-heading--strong']\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tUpload of {displayName} successful!\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<MrlButton\n\t\t\t\t\t\t\taria-describedby={inlineMessage ? messageId : undefined}\n\t\t\t\t\t\t\tkind=\"secondary\"\n\t\t\t\t\t\t\tref={actionRef}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ttext=\"Remove\"\n\t\t\t\t\t\t\tonClick={handleRemove}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{inlineMessage && (\n\t\t\t\t<MrlInlineMessage id={messageId} kind={inlineKind} message={inlineMessage} />\n\t\t\t)}\n\n\t\t\t{/*\n\t\t\t * The real control, opened by the \"Browse files\" button. It is removed from\n\t\t\t * the tab order and the accessibility tree deliberately: the button is the\n\t\t\t * accessible affordance, and a focusable invisible input would be a keyboard\n\t\t\t * trap with no visible focus ring. Do not make it focusable.\n\t\t\t */}\n\t\t\t<input\n\t\t\t\taccept={accept || undefined}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName={classnames(styles['MrlFileUpload-input'])}\n\t\t\t\tdisabled={isDisabled}\n\t\t\t\tref={inputRef}\n\t\t\t\ttabIndex={-1}\n\t\t\t\ttype=\"file\"\n\t\t\t\tonChange={handleInputChange}\n\t\t\t/>\n\n\t\t\t<MrlLiveRegion ariaLive=\"polite\" srContent={announcement()} />\n\t\t</div>\n\t);\n}\n"],"names":["MrlFileUpload","props","_ref","_ref2","_props$accept","accept","fileUploadDefaults","className","errorMessage","eventId","fileName","_props$heading","heading","helperText","label","maxSizeBytes","onCancel","onError","onFilesSelected","onRemove","_props$percent","percent","_props$showHelperText","showHelperText","_props$showInlineAler","showInlineAlert","_props$state","state","validate","dataQa","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isDragging","setIsDragging","_React$useState3","_React$useState4","validationError","setValidationError","_React$useState5","_React$useState6","selectedName","setSelectedName","inputRef","useRef","actionRef","shouldRestoreFocus","dragDepth","reactId","useId","labelId","concat","messageId","trackInteraction","useMrlTrackInteraction","isDisabled","effectiveState","displayName","displayError","resolvedError","DEFAULT_ERROR_MESSAGE","resolvedHelperText","describeConstraints","isBusy","acceptFile","useCallback","file","source","rejection","isAccepted","types","formatAcceptList","undefined","size","formatBytes","_validate","action","metadata","outcome","name","current","reset","value","handleBrowse","_inputRef$current","click","handleCancel","control","handleRemove","handleDragEnter","event","preventDefault","handleDragOver","dataTransfer","dropEffect","handleDragLeave","Math","max","handleDrop","_event$dataTransfer$f","files","handleInputChange","_event$target$files","target","view","useLayoutEffect","focusWasLost","document","activeElement","body","_actionRef$current","focus","zoneClasses","classnames","styles","inlineKind","inlineMessage","announcement","step","floor","round","restingContent","createElement","Fragment","MrlText","MrlButton","kind","ref","text","onClick","_extends","id","role","onDragEnter","onDragLeave","onDragOver","onDrop","MrlSvg","svg","importIcon","MrlProgressBar","check","MrlInlineMessage","message","disabled","tabIndex","type","onChange","MrlLiveRegion","ariaLive","srContent"],"mappings":";;;;;;;;;;;;;;;;;AAgBA;AACA;AACA;;AAuBA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsFA;AACA;AACA;AACA;AACA;AAC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ACrB,CACC,CAAC,eACN5B,KAAA,CAAA6F,aAAA,CAACG,SAAS,EAAA;AACT,IAAA,kBAAA,EAAkBT,aAAa,GAAGhE,SAAS,GAAGoB,SAAU;AACxDsD,IAAAA,IAAI,EAAC,WAAW;AAChBC,IAAAA,GAAG,EAAElF,SAAU;AACf4B,IAAAA,IAAI,EAAC,OAAO;AACZuD,IAAAA,IAAI,EAAC,QAAQ;AACbC,IAAAA,OAAO,EAAEzC;GACT,CACA,CAEC,CAAC,EAEL4B,aAAa,iBACbvF,KAAA,CAAA6F,aAAA,CAACoB,gBAAgB,EAAA;AAACX,IAAAA,EAAE,EAAE/E,SAAU;AAAC0E,IAAAA,IAAI,EAAEX,UAAW;AAAC4B,IAAAA,OAAO,EAAE3B;AAAc,GAAE,CAC5E,eAQDvF,KAAA,CAAA6F,aAAA,CAAA,OAAA,EAAA;IACC1H,MAAM,EAAEA,MAAM,IAAIwE,SAAU;AAC5B,IAAA,aAAA,EAAY,MAAM;AAClBtE,IAAAA,SAAS,EAAE+G,UAAU,CAACC,MAAM,CAAC,qBAAqB,CAAC,CAAE;AACrD8B,IAAAA,QAAQ,EAAEzF,UAAW;AACrBwE,IAAAA,GAAG,EAAEpF,QAAS;IACdsG,QAAQ,EAAE,EAAG;AACbC,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,QAAQ,EAAE9C;AAAkB,GAC5B,CAAC,eAEFxE,KAAA,CAAA6F,aAAA,CAAC0B,aAAa,EAAA;AAACC,IAAAA,QAAQ,EAAC,QAAQ;IAACC,SAAS,EAAEjC,YAAY;AAAG,GAAE,CACzD,CAAC;AAER;;;;"}
@@ -0,0 +1,4 @@
1
+ var styles = {"MrlFileUpload":"MrlFileUpload--q42Jc","MrlFileUpload-label":"MrlFileUpload-label--fuqMG","MrlFileUpload-zone":"MrlFileUpload-zone--pB0EK","MrlFileUpload-zone--dragging":"MrlFileUpload-zone--dragging--aZBH2","MrlFileUpload-zone--uploading":"MrlFileUpload-zone--uploading--f0aUR","MrlFileUpload-zone--complete":"MrlFileUpload-zone--complete--HeuVL","MrlFileUpload-zone--error":"MrlFileUpload-zone--error--f5DIT","MrlFileUpload-zone--disabled":"MrlFileUpload-zone--disabled--UgSP5","MrlFileUpload-content":"MrlFileUpload-content--vybKc","MrlFileUpload-preloader":"MrlFileUpload-preloader--Aib44","MrlFileUpload-heading":"MrlFileUpload-heading--J4xnq","MrlFileUpload-heading--accent":"MrlFileUpload-heading--accent--UCQja","MrlFileUpload-heading--strong":"MrlFileUpload-heading--strong--FRgxv","MrlFileUpload-icon":"MrlFileUpload-icon--ZLxPa","MrlFileUpload-icon--accent":"MrlFileUpload-icon--accent--bav01","MrlFileUpload-icon--success":"MrlFileUpload-icon--success--G_dKs","MrlFileUpload-progress":"MrlFileUpload-progress--a6AlX","MrlFileUpload-input":"MrlFileUpload-input--GCD8R"};
2
+
3
+ export { styles as default };
4
+ //# sourceMappingURL=MrlFileUpload.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MrlFileUpload.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,44 @@
1
+ /*
2
+ * File upload component constants
3
+ * ------------------------------------------------------------------
4
+ */
5
+
6
+ var allowedFileUploadValues = {
7
+ states: ['idle', 'uploading', 'complete', 'error', 'disabled']
8
+ };
9
+
10
+ /**
11
+ * The visual state of the drop zone, owned by the consumer.
12
+ *
13
+ * `dragging` is deliberately absent — a drag is transient pointer state the
14
+ * component tracks internally, not a state a consumer can meaningfully set.
15
+ */
16
+
17
+ /**
18
+ * Default values for props on the MrlFileUpload component;
19
+ * shared between the component and Storybook.
20
+ *
21
+ * `helperText` is absent on purpose: with no value from the consumer it is
22
+ * derived from the constraints actually enforced, so the copy cannot drift from
23
+ * what `accept` and `maxSizeBytes` reject.
24
+ */
25
+ var fileUploadDefaults = {
26
+ accept: '.gif,.jpg,.jpeg,.png',
27
+ heading: 'Drop files here to upload',
28
+ showHelperText: true,
29
+ showInlineAlert: false,
30
+ state: 'idle'
31
+ };
32
+
33
+ /**
34
+ * Shown when a consumer reports `state="error"` without an `errorMessage`.
35
+ *
36
+ * The types make that combination impossible, but a JavaScript consumer can
37
+ * still reach it — and an errored zone with no text is signalled by border
38
+ * colour alone, which reaches neither assistive technology nor anyone who
39
+ * cannot distinguish the error hue.
40
+ */
41
+ var DEFAULT_ERROR_MESSAGE = 'Upload failed';
42
+
43
+ export { DEFAULT_ERROR_MESSAGE, allowedFileUploadValues, fileUploadDefaults };
44
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/file-upload/constants.ts"],"sourcesContent":["/*\n * File upload component constants\n * ------------------------------------------------------------------\n */\n\nexport const allowedFileUploadValues = {\n\tstates: ['idle', 'uploading', 'complete', 'error', 'disabled'] as const\n};\n\n/**\n * The visual state of the drop zone, owned by the consumer.\n *\n * `dragging` is deliberately absent — a drag is transient pointer state the\n * component tracks internally, not a state a consumer can meaningfully set.\n */\nexport type MrlFileUploadState = (typeof allowedFileUploadValues.states)[number];\n\nexport interface FileUploadDefaults {\n\taccept: string;\n\theading: string;\n\tshowHelperText: boolean;\n\tshowInlineAlert: boolean;\n\tstate: MrlFileUploadState;\n}\n\n/**\n * Default values for props on the MrlFileUpload component;\n * shared between the component and Storybook.\n *\n * `helperText` is absent on purpose: with no value from the consumer it is\n * derived from the constraints actually enforced, so the copy cannot drift from\n * what `accept` and `maxSizeBytes` reject.\n */\nexport const fileUploadDefaults: FileUploadDefaults = {\n\taccept: '.gif,.jpg,.jpeg,.png',\n\theading: 'Drop files here to upload',\n\tshowHelperText: true,\n\tshowInlineAlert: false,\n\tstate: 'idle'\n};\n\n/**\n * Shown when a consumer reports `state=\"error\"` without an `errorMessage`.\n *\n * The types make that combination impossible, but a JavaScript consumer can\n * still reach it — and an errored zone with no text is signalled by border\n * colour alone, which reaches neither assistive technology nor anyone who\n * cannot distinguish the error hue.\n */\nexport const DEFAULT_ERROR_MESSAGE = 'Upload failed';\n"],"names":["allowedFileUploadValues","states","fileUploadDefaults","accept","heading","showHelperText","showInlineAlert","state","DEFAULT_ERROR_MESSAGE"],"mappings":"AAAA;AACA;AACA;AACA;;AAEO,IAAMA,uBAAuB,GAAG;EACtCC,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,kBAAsC,GAAG;AACrDC,EAAAA,MAAM,EAAE,sBAAsB;AAC9BC,EAAAA,OAAO,EAAE,2BAA2B;AACpCC,EAAAA,cAAc,EAAE,IAAI;AACpBC,EAAAA,eAAe,EAAE,KAAK;AACtBC,EAAAA,KAAK,EAAE;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,qBAAqB,GAAG;;;;"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Matches a file against an `accept` string (extensions and/or MIME types).
3
+ *
4
+ * The native `accept` attribute only filters the file picker; a dropped file
5
+ * bypasses it entirely, so the same rules have to be applied in code.
6
+ *
7
+ * @param file - the file to test
8
+ * @param accept - native `accept` syntax, e.g. '.png,image/*'
9
+ * @returns whether the file matches the accept rules
10
+ */
11
+ function isAccepted(file, accept) {
12
+ var rules = accept.split(',').map(rule => rule.trim().toLowerCase()).filter(Boolean);
13
+ if (rules.length === 0) return true;
14
+ var name = file.name.toLowerCase();
15
+ var type = file.type.toLowerCase();
16
+ return rules.some(rule => {
17
+ if (rule.startsWith('.')) return name.endsWith(rule);
18
+ if (rule.endsWith('/*')) return type.startsWith(rule.slice(0, -1));
19
+ return type === rule;
20
+ });
21
+ }
22
+
23
+ /**
24
+ * Formats a byte count for display in a validation message.
25
+ *
26
+ * @param bytes - the size in bytes
27
+ * @returns a short human-readable size, e.g. '2.5 MB'
28
+ */
29
+ function formatBytes(bytes) {
30
+ if (bytes < 1024) return "".concat(bytes, " B");
31
+ if (bytes < 1024 * 1024) return "".concat(Math.round(bytes / 1024), " KB");
32
+ return "".concat(Math.round(bytes / (1024 * 1024) * 10) / 10, " MB");
33
+ }
34
+
35
+ /**
36
+ * Lists the file types an `accept` string permits, for display.
37
+ *
38
+ * @param accept - native `accept` syntax, e.g. '.png,image/*'
39
+ * @returns a comma-separated list, or an empty string if nothing is restricted
40
+ */
41
+ function formatAcceptList(accept) {
42
+ return accept.split(',').map(rule => rule.trim()).filter(Boolean).join(', ');
43
+ }
44
+
45
+ /**
46
+ * Describes the constraints the component actually enforces, for use as helper
47
+ * text. Deriving the sentence from `accept` and `maxSizeBytes` is what keeps it
48
+ * from contradicting what validation rejects.
49
+ *
50
+ * @param accept - native `accept` syntax, e.g. '.png,image/*'
51
+ * @param maxSizeBytes - the size limit in bytes, if there is one
52
+ * @returns a sentence describing what may be uploaded, or an empty string
53
+ */
54
+ function describeConstraints(accept, maxSizeBytes) {
55
+ var types = formatAcceptList(accept);
56
+ var limit = maxSizeBytes !== undefined ? "up to ".concat(formatBytes(maxSizeBytes)) : '';
57
+ if (!types) return limit ? "Accepts any file ".concat(limit) : '';
58
+ return limit ? "Accepts ".concat(types, " ").concat(limit) : "Accepts ".concat(types);
59
+ }
60
+
61
+ export { describeConstraints, formatAcceptList, formatBytes, isAccepted };
62
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sources":["../../../../src/components/file-upload/helpers.ts"],"sourcesContent":["/**\n * Matches a file against an `accept` string (extensions and/or MIME types).\n *\n * The native `accept` attribute only filters the file picker; a dropped file\n * bypasses it entirely, so the same rules have to be applied in code.\n *\n * @param file - the file to test\n * @param accept - native `accept` syntax, e.g. '.png,image/*'\n * @returns whether the file matches the accept rules\n */\nexport function isAccepted(file: File, accept: string): boolean {\n\tconst rules = accept\n\t\t.split(',')\n\t\t.map((rule) => rule.trim().toLowerCase())\n\t\t.filter(Boolean);\n\n\tif (rules.length === 0) return true;\n\n\tconst name = file.name.toLowerCase();\n\tconst type = file.type.toLowerCase();\n\n\treturn rules.some((rule) => {\n\t\tif (rule.startsWith('.')) return name.endsWith(rule);\n\t\tif (rule.endsWith('/*')) return type.startsWith(rule.slice(0, -1));\n\t\treturn type === rule;\n\t});\n}\n\n/**\n * Formats a byte count for display in a validation message.\n *\n * @param bytes - the size in bytes\n * @returns a short human-readable size, e.g. '2.5 MB'\n */\nexport function formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes} B`;\n\tif (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;\n\treturn `${Math.round((bytes / (1024 * 1024)) * 10) / 10} MB`;\n}\n\n/**\n * Lists the file types an `accept` string permits, for display.\n *\n * @param accept - native `accept` syntax, e.g. '.png,image/*'\n * @returns a comma-separated list, or an empty string if nothing is restricted\n */\nexport function formatAcceptList(accept: string): string {\n\treturn accept\n\t\t.split(',')\n\t\t.map((rule) => rule.trim())\n\t\t.filter(Boolean)\n\t\t.join(', ');\n}\n\n/**\n * Describes the constraints the component actually enforces, for use as helper\n * text. Deriving the sentence from `accept` and `maxSizeBytes` is what keeps it\n * from contradicting what validation rejects.\n *\n * @param accept - native `accept` syntax, e.g. '.png,image/*'\n * @param maxSizeBytes - the size limit in bytes, if there is one\n * @returns a sentence describing what may be uploaded, or an empty string\n */\nexport function describeConstraints(accept: string, maxSizeBytes?: number): string {\n\tconst types = formatAcceptList(accept);\n\tconst limit = maxSizeBytes !== undefined ? `up to ${formatBytes(maxSizeBytes)}` : '';\n\n\tif (!types) return limit ? `Accepts any file ${limit}` : '';\n\n\treturn limit ? `Accepts ${types} ${limit}` : `Accepts ${types}`;\n}\n"],"names":["isAccepted","file","accept","rules","split","map","rule","trim","toLowerCase","filter","Boolean","length","name","type","some","startsWith","endsWith","slice","formatBytes","bytes","concat","Math","round","formatAcceptList","join","describeConstraints","maxSizeBytes","types","limit","undefined"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAC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