@muraldevkit/ui-toolkit 4.76.1-dev-aD33.1 → 4.76.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/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
- package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
- package/dist/cjs/components/grid/MrlCol/MrlCol.js +55 -58
- package/dist/cjs/components/grid/MrlCol/MrlCol.js.map +1 -1
- package/dist/cjs/components/grid/MrlGrid/MrlGrid.js +6 -4
- package/dist/cjs/components/grid/MrlGrid/MrlGrid.js.map +1 -1
- package/dist/cjs/components/grid/MrlRow/MrlRow.js +8 -10
- package/dist/cjs/components/grid/MrlRow/MrlRow.js.map +1 -1
- package/dist/cjs/components/grid/constants.js +9 -47
- package/dist/cjs/components/grid/constants.js.map +1 -1
- package/dist/cjs/components/menu/MrlMenu/MrlMenu.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/components/grid/MrlCol/MrlCol.d.ts +6 -4
- package/dist/components/grid/MrlCol/index.d.ts +1 -1
- package/dist/components/grid/MrlGrid/MrlGrid.d.ts +5 -5
- package/dist/components/grid/MrlGrid/index.d.ts +1 -1
- package/dist/components/grid/MrlRow/MrlRow.d.ts +7 -7
- package/dist/components/grid/MrlRow/index.d.ts +1 -1
- package/dist/components/grid/constants.d.ts +12 -52
- package/dist/components/grid/index.d.ts +0 -1
- package/dist/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
- package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
- package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
- package/dist/esm/components/grid/MrlCol/MrlCol.js +56 -59
- package/dist/esm/components/grid/MrlCol/MrlCol.js.map +1 -1
- package/dist/esm/components/grid/MrlGrid/MrlGrid.js +6 -4
- package/dist/esm/components/grid/MrlGrid/MrlGrid.js.map +1 -1
- package/dist/esm/components/grid/MrlRow/MrlRow.js +8 -10
- package/dist/esm/components/grid/MrlRow/MrlRow.js.map +1 -1
- package/dist/esm/components/grid/constants.js +9 -46
- package/dist/esm/components/grid/constants.js.map +1 -1
- package/dist/esm/components/menu/MrlMenu/MrlMenu.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/styles/MrlSidebar/module.scss +2 -2
- package/dist/styles/grid/global.scss +2 -97
- package/dist/styles/grid/variables.scss +26 -0
- package/dist/styles.css +7 -1
- package/dist/types/components/grid/MrlCol/MrlCol.d.ts +6 -4
- package/dist/types/components/grid/MrlCol/index.d.ts +1 -1
- package/dist/types/components/grid/MrlGrid/MrlGrid.d.ts +5 -5
- package/dist/types/components/grid/MrlGrid/index.d.ts +1 -1
- package/dist/types/components/grid/MrlRow/MrlRow.d.ts +7 -7
- package/dist/types/components/grid/MrlRow/index.d.ts +1 -1
- package/dist/types/components/grid/constants.d.ts +12 -52
- package/dist/types/components/grid/index.d.ts +0 -1
- package/dist/types/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ var _excluded = ["accept", "className", "errorMessage", "eventId", "fileName", "
|
|
|
72
72
|
* @returns The MrlFileUpload component.
|
|
73
73
|
*/
|
|
74
74
|
function MrlFileUpload(props) {
|
|
75
|
-
var _ref
|
|
75
|
+
var _ref;
|
|
76
76
|
var _props$accept = props.accept,
|
|
77
77
|
accept = _props$accept === void 0 ? constants.fileUploadDefaults.accept : _props$accept,
|
|
78
78
|
className = props.className,
|
|
@@ -128,7 +128,10 @@ function MrlFileUpload(props) {
|
|
|
128
128
|
// A disabled zone outranks both — it cannot have accepted a file.
|
|
129
129
|
var effectiveState = isDisabled ? 'disabled' : validationError ? 'error' : state;
|
|
130
130
|
var displayName = (_ref = fileName !== null && fileName !== void 0 ? fileName : selectedName) !== null && _ref !== void 0 ? _ref : '';
|
|
131
|
-
|
|
131
|
+
// `||` rather than `??`: an empty message is as good as no message, and has
|
|
132
|
+
// to fall through — to the consumer's `errorMessage`, and then to the
|
|
133
|
+
// default below — or an errored zone renders with no text at all.
|
|
134
|
+
var displayError = validationError || errorMessage || null;
|
|
132
135
|
// An errored zone always carries text. The types forbid reporting 'error'
|
|
133
136
|
// without a message, but a JavaScript consumer can still reach it, and colour
|
|
134
137
|
// alone reaches neither assistive technology nor anyone who cannot see the hue.
|
|
@@ -1 +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;A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,CACpBC,4BAAM,CAAC,uBAAuB,CAAC,EAC/BA,4BAAM,CAAC,+BAA+B,CACvC;AAAE,GAAA,EACF,YACU,EAACzD,WAAW,EAAC,cACrB,CACC,CAAC,eACN5B,gBAAA,CAAA6F,aAAA,CAACG,mBAAS,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,gBAAA,CAAA6F,aAAA,CAACoB,iCAAgB,EAAA;AAACX,IAAAA,EAAE,EAAE/E,SAAU;AAAC0E,IAAAA,IAAI,EAAEX,UAAW;AAAC4B,IAAAA,OAAO,EAAE3B;AAAc,GAAE,CAC5E,eAQDvF,gBAAA,CAAA6F,aAAA,CAAA,OAAA,EAAA;IACC1H,MAAM,EAAEA,MAAM,IAAIwE,SAAU;AAC5B,IAAA,aAAA,EAAY,MAAM;AAClBtE,IAAAA,SAAS,EAAE+G,2BAAU,CAACC,4BAAM,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,gBAAA,CAAA6F,aAAA,CAAC0B,2BAAa,EAAA;AAACC,IAAAA,QAAQ,EAAC,QAAQ;IAACC,SAAS,EAAEjC,YAAY;AAAG,GAAE,CACzD,CAAC;AAER;;;;"}
|
|
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\t// `||` rather than `??`: an empty message is as good as no message, and has\n\t// to fall through — to the consumer's `errorMessage`, and then to the\n\t// default below — or an errored zone renders with no text at all.\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","_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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,KAAyB,EAAsB;AAAA,EAAA,IAAAC,IAAA;AAC5E,EAAA,IAAAC,aAAA,GAqBIF,KAAK,CApBRG,MAAM;AAANA,IAAAA,MAAM,GAAAD,aAAA,KAAA,MAAA,GAAGE,4BAAkB,CAACD,MAAM,GAAAD,aAAA;IAClCG,SAAS,GAmBNL,KAAK,CAnBRK,SAAS;IACTC,YAAY,GAkBTN,KAAK,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C,EAEL4B,aAAa,iBACbvF,gBAAA,CAAA6F,aAAA,CAACoB,iCAAgB,EAAA;AAACX,IAAAA,EAAE,EAAE/E,SAAU;AAAC0E,IAAAA,IAAI,EAAEX,UAAW;AAAC4B,IAAAA,OAAO,EAAE3B;AAAc,GAAE,CAC5E,eAQDvF,gBAAA,CAAA6F,aAAA,CAAA,OAAA,EAAA;IACC1H,MAAM,EAAEA,MAAM,IAAIwE,SAAU;AAC5B,IAAA,aAAA,EAAY,MAAM;AAClBtE,IAAAA,SAAS,EAAE+G,2BAAU,CAACC,4BAAM,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,gBAAA,CAAA6F,aAAA,CAAC0B,2BAAa,EAAA;AAACC,IAAAA,QAAQ,EAAC,QAAQ;IAACC,SAAS,EAAEjC,YAAY;AAAG,GAAE,CACzD,CAAC;AAER;;;;"}
|
|
@@ -28,55 +28,39 @@ function _interopNamespace(e) {
|
|
|
28
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
29
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
30
30
|
|
|
31
|
-
var _excluded = ["children", "className"
|
|
32
|
-
|
|
33
|
-
* Builds a single grid class. The base tier (`col`) and the deprecated `xs`
|
|
34
|
-
* alias are un-prefixed; every other breakpoint carries its infix.
|
|
35
|
-
* @param size - breakpoint key
|
|
36
|
-
* @param type - `col` or `offset`
|
|
37
|
-
* @param val - column count, or `auto`
|
|
38
|
-
* @returns the grid class name
|
|
39
|
-
*/
|
|
40
|
-
var getGridClass = (size, type, val) => size === 'col' || size === 'xs' ? "".concat(type, "-").concat(val) : "".concat(type, "-").concat(size, "-").concat(val);
|
|
41
|
-
|
|
42
|
-
/*
|
|
43
|
-
* There is no `col-0` class, so a zero span produces nothing. `ColSpan` already
|
|
44
|
-
* rules it out, but this is a published component and JavaScript consumers are
|
|
45
|
-
* not held to that — hence a runtime check rather than a type-level one.
|
|
46
|
-
*/
|
|
47
|
-
var isZeroSpan = val => val === 0;
|
|
31
|
+
var _excluded = ["children", "className"];
|
|
32
|
+
var getBootstrapClass = (size, type, val) => size === 'col' || size === 'xs' ? "".concat(type, "-").concat(val) : "".concat(type, "-").concat(size, "-").concat(val);
|
|
48
33
|
|
|
49
34
|
/**
|
|
50
35
|
* Creates the size classes for the grid.
|
|
51
|
-
*
|
|
52
|
-
* `offset: 0` is kept, because `offset-<size>-0` is how a breakpoint cancels an
|
|
53
|
-
* offset set on a smaller one. `col: 0` is dropped, because there is no
|
|
54
|
-
* `col-0` class — a column always spans at least one track.
|
|
55
36
|
* @param props - component props
|
|
56
|
-
* @returns an array of size classes
|
|
37
|
+
* @returns an array of size classes based on bootstrap grid API
|
|
57
38
|
*/
|
|
58
39
|
var createSizeClasses = props => {
|
|
59
40
|
var classes = [];
|
|
60
|
-
for (var size of constants.
|
|
41
|
+
for (var size of constants.GridSizes) {
|
|
61
42
|
// get the value based on the prop key from the component props
|
|
62
43
|
var value = props[size];
|
|
63
|
-
if (value === undefined) continue;
|
|
64
44
|
|
|
65
|
-
//
|
|
66
|
-
if (
|
|
67
|
-
if
|
|
68
|
-
|
|
69
|
-
|
|
45
|
+
// create the size class based on the value using the bootstrap grid API
|
|
46
|
+
if (value) {
|
|
47
|
+
// if the value is a number, then it is a column size
|
|
48
|
+
if (typeof value === 'number') {
|
|
49
|
+
classes.push(getBootstrapClass(size, 'col', value));
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
70
52
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
53
|
+
// if the value is an object, then we need to compose multiple classes
|
|
54
|
+
// based on the keyvalue pairings
|
|
55
|
+
if (value !== null && typeof value === 'object') {
|
|
56
|
+
for (var _ref3 of Object.entries(value)) {
|
|
57
|
+
var _ref2 = _rollupPluginBabelHelpers.slicedToArray(_ref3, 2);
|
|
58
|
+
var key = _ref2[0];
|
|
59
|
+
var val = _ref2[1];
|
|
60
|
+
if (val === 0 || val === undefined) continue;
|
|
61
|
+
classes.push(getBootstrapClass(size, key, val));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
80
64
|
}
|
|
81
65
|
}
|
|
82
66
|
if (classes.length === 0) classes.push('col');
|
|
@@ -84,31 +68,44 @@ var createSizeClasses = props => {
|
|
|
84
68
|
};
|
|
85
69
|
|
|
86
70
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @param props
|
|
89
|
-
* @returns
|
|
71
|
+
* Gets the grid size props from the component props.
|
|
72
|
+
* @param props - component props
|
|
73
|
+
* @returns object of grid size props
|
|
90
74
|
*/
|
|
91
|
-
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var columnClasses = createSizeClasses({
|
|
75
|
+
var getGridProps = props => {
|
|
76
|
+
var col = props.col,
|
|
77
|
+
xs = props.xs,
|
|
78
|
+
sm = props.sm,
|
|
79
|
+
md = props.md,
|
|
80
|
+
lg = props.lg,
|
|
81
|
+
xl = props.xl,
|
|
82
|
+
xxl = props.xxl;
|
|
83
|
+
|
|
84
|
+
// eslint-disable-next-line sort-keys
|
|
85
|
+
return {
|
|
103
86
|
col,
|
|
104
|
-
|
|
105
|
-
md,
|
|
87
|
+
xs,
|
|
106
88
|
sm,
|
|
89
|
+
md,
|
|
90
|
+
lg,
|
|
107
91
|
xl,
|
|
108
|
-
xs,
|
|
109
92
|
xxl
|
|
110
|
-
}
|
|
111
|
-
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* MrlCol React component.
|
|
98
|
+
* @param props - component props
|
|
99
|
+
* @returns a MrlCol React component.
|
|
100
|
+
*/
|
|
101
|
+
function MrlCol(props) {
|
|
102
|
+
var children = props.children,
|
|
103
|
+
_props$className = props.className,
|
|
104
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
105
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
106
|
+
var gridProps = getGridProps(props);
|
|
107
|
+
var columnClasses = React__namespace.useMemo(() => createSizeClasses(gridProps), [gridProps]);
|
|
108
|
+
var allClasses = classnames__default.default(className, columnClasses);
|
|
112
109
|
return /*#__PURE__*/React__namespace.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
113
110
|
className: allClasses
|
|
114
111
|
}), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {
|
|
1
|
+
{"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport { GridSizes, GridColumns } from '../constants';\n\ntype MrlCol = LayoutComponent & GridColumns;\n\nconst getBootstrapClass = (size: string, type: string, val: number | string): string =>\n\tsize === 'col' || size === 'xs' ? `${type}-${val}` : `${type}-${size}-${val}`;\n\n/**\n * Creates the size classes for the grid.\n * @param props - component props\n * @returns an array of size classes based on bootstrap grid API\n */\nconst createSizeClasses = (props: GridColumns): string[] => {\n\tconst classes: string[] = [];\n\n\tfor (const size of GridSizes) {\n\t\t// get the value based on the prop key from the component props\n\t\tconst value = props[size as keyof GridColumns];\n\n\t\t// create the size class based on the value using the bootstrap grid API\n\t\tif (value) {\n\t\t\t// if the value is a number, then it is a column size\n\t\t\tif (typeof value === 'number') {\n\t\t\t\tclasses.push(getBootstrapClass(size, 'col', value));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// if the value is an object, then we need to compose multiple classes\n\t\t\t// based on the keyvalue pairings\n\t\t\tif (value !== null && typeof value === 'object') {\n\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\tif (val === 0 || val === undefined) continue;\n\t\t\t\t\tclasses.push(getBootstrapClass(size, key, val as number));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (classes.length === 0) classes.push('col');\n\n\treturn classes;\n};\n\n/**\n * Gets the grid size props from the component props.\n * @param props - component props\n * @returns object of grid size props\n */\nconst getGridProps = (props: MrlCol): GridColumns => {\n\tconst { col, xs, sm, md, lg, xl, xxl } = props;\n\n\t// eslint-disable-next-line sort-keys\n\treturn { col, xs, sm, md, lg, xl, xxl };\n};\n\n/**\n * MrlCol React component.\n * @param props - component props\n * @returns a MrlCol React component.\n */\nexport function MrlCol(props: MrlCol): JSX.Element {\n\tconst { children, className = '', ...rest } = props;\n\tconst gridProps = getGridProps(props);\n\n\tconst columnClasses = React.useMemo(() => createSizeClasses(gridProps), [gridProps]);\n\tconst allClasses = classnames(className, columnClasses);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["getBootstrapClass","size","type","val","concat","createSizeClasses","props","classes","GridSizes","value","push","_ref3","Object","entries","_ref2","_slicedToArray","key","undefined","length","getGridProps","col","xs","sm","md","lg","xl","xxl","MrlCol","children","_props$className","className","rest","_objectWithoutProperties","_excluded","gridProps","columnClasses","React","useMemo","allClasses","classnames","createElement","_extends"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAMA,iBAAiB,GAAGA,CAACC,IAAY,EAAEC,IAAY,EAAEC,GAAoB,KAC1EF,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,IAAI,GAAA,EAAA,CAAAG,MAAA,CAAMF,IAAI,OAAAE,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AER;;;;"}
|
|
@@ -28,16 +28,18 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
28
28
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
29
29
|
|
|
30
30
|
var _excluded = ["children", "className"];
|
|
31
|
+
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* MrlCol React component.
|
|
33
34
|
* @param props - component props
|
|
34
|
-
* @returns a
|
|
35
|
+
* @returns a MrlCol React component.
|
|
35
36
|
*/
|
|
36
37
|
function MrlGrid(_ref) {
|
|
37
38
|
var children = _ref.children,
|
|
38
|
-
className = _ref.className,
|
|
39
|
+
_ref$className = _ref.className,
|
|
40
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
39
41
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
40
|
-
var allClasses = classnames__default.default('container',
|
|
42
|
+
var allClasses = classnames__default.default('container', className);
|
|
41
43
|
return /*#__PURE__*/React__namespace.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
42
44
|
className: allClasses
|
|
43
45
|
}), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {
|
|
1
|
+
{"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport '../grid.variables.scss';\nimport '../grid.global.scss';\n\n/**\n * MrlCol React component.\n * @param props - component props\n * @returns a MrlCol React component.\n */\nexport function MrlGrid({ children, className = '', ...rest }: LayoutComponent): JSX.Element {\n\tconst allClasses = classnames('container', className);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlGrid","_ref","children","_ref$className","className","rest","_objectWithoutProperties","_excluded","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAAC,IAAA,EAAsE;AAAA,EAAA,IAAnEC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,cAAA,GAAAF,IAAA,CAAEG,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;AAAKE,IAAAA,IAAI,GAAAC,iDAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA;AAC1D,EAAA,IAAMC,UAAU,GAAGC,2BAAU,CAAC,WAAW,EAAEL,SAAS,CAAC;AAErD,EAAA,oBACCM,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,iCAAA,KAASP,IAAI,EAAA;AAAED,IAAAA,SAAS,EAAEI;AAAW,GAAA,CAAA,EACnCN,QACG,CAAC;AAER;;;;"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var classnames = require('classnames');
|
|
6
|
-
var constants = require('../constants.js');
|
|
7
6
|
|
|
8
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
8
|
|
|
@@ -28,26 +27,25 @@ function _interopNamespace(e) {
|
|
|
28
27
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
28
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
30
29
|
|
|
31
|
-
var _excluded = ["align", "children", "className", "
|
|
30
|
+
var _excluded = ["align", "children", "className", "justify"];
|
|
32
31
|
/**
|
|
33
|
-
* MrlRow React component.
|
|
32
|
+
* MrlRow React component.
|
|
34
33
|
* @param props - component props
|
|
35
34
|
* @returns a MrlRow React component.
|
|
36
35
|
*/
|
|
37
36
|
function MrlRow(_ref) {
|
|
38
37
|
var align = _ref.align,
|
|
39
38
|
children = _ref.children,
|
|
40
|
-
className = _ref.className,
|
|
41
|
-
_ref$
|
|
42
|
-
gutter = _ref$gutter === void 0 ? 1 : _ref$gutter,
|
|
39
|
+
_ref$className = _ref.className,
|
|
40
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
43
41
|
justify = _ref.justify,
|
|
44
42
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
45
|
-
var alignClass = align
|
|
43
|
+
var alignClass = align ? "align-items-".concat(align) : '';
|
|
46
44
|
var justifyClass = justify && "justify-content-".concat(justify);
|
|
47
|
-
var allClasses = classnames__default.default('row',
|
|
48
|
-
return /*#__PURE__*/React__namespace.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
45
|
+
var allClasses = classnames__default.default('row', className, alignClass, justifyClass);
|
|
46
|
+
return /*#__PURE__*/React__namespace.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
49
47
|
className: allClasses
|
|
50
|
-
}), children);
|
|
48
|
+
}, rest), children);
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
exports.MrlRow = MrlRow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlRow.js","sources":["../../../../../src/components/grid/MrlRow/MrlRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {
|
|
1
|
+
{"version":3,"file":"MrlRow.js","sources":["../../../../../src/components/grid/MrlRow/MrlRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport { AlignOptions, GutterSizes, JustifyOptions } from '../constants';\n\ninterface MrlRow extends LayoutComponent {\n\t/**\n\t * Flex alignment of the children within the component.\n\t */\n\talign?: AlignOptions;\n\n\t/**\n\t * Gutter size for columns within the row\n\t */\n\tgutter?: GutterSizes;\n\n\t/**\n\t * Justify content of the children within the component.\n\t */\n\tjustify?: JustifyOptions;\n}\n\n/**\n * MrlRow React component.\n * @param props - component props\n * @returns a MrlRow React component.\n */\nexport function MrlRow({ align, children, className = '', justify, ...rest }: MrlRow): JSX.Element {\n\tconst alignClass = align ? `align-items-${align}` : '';\n\tconst justifyClass = justify && `justify-content-${justify}`;\n\n\tconst allClasses = classnames('row', className, alignClass, justifyClass);\n\n\treturn (\n\t\t<div className={allClasses} {...rest}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlRow","_ref","align","children","_ref$className","className","justify","rest","_objectWithoutProperties","_excluded","alignClass","concat","justifyClass","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAAAC,IAAA,EAA6E;AAAA,EAAA,IAA1EC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,cAAA,GAAAH,IAAA,CAAEI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IAAEE,OAAO,GAAAL,IAAA,CAAPK,OAAO;AAAKC,IAAAA,IAAI,GAAAC,iDAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA;EACzE,IAAMC,UAAU,GAAGR,KAAK,GAAA,cAAA,CAAAS,MAAA,CAAkBT,KAAK,IAAK,EAAE;AACtD,EAAA,IAAMU,YAAY,GAAGN,OAAO,uBAAAK,MAAA,CAAuBL,OAAO,CAAE;EAE5D,IAAMO,UAAU,GAAGC,2BAAU,CAAC,KAAK,EAAET,SAAS,EAAEK,UAAU,EAAEE,YAAY,CAAC;AAEzE,EAAA,oBACCG,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,iCAAA,CAAA;AAAKZ,IAAAA,SAAS,EAAEQ;GAAW,EAAKN,IAAI,CAAA,EAClCJ,QACG,CAAC;AAER;;;;"}
|
|
@@ -5,22 +5,23 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* always occupies at least one of the twelve tracks.
|
|
8
|
+
* Available grid sizes
|
|
10
9
|
*/
|
|
10
|
+
var GridSizes = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Number of columns
|
|
14
|
-
* larger breakpoint cancels an offset inherited from a smaller one.
|
|
13
|
+
* Number of columns that will be span on the grid.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* The type of classes that can be configured based on the bootstrap API.
|
|
18
|
+
* Current supported:
|
|
19
|
+
* - columns "col-<size>-<number>"
|
|
20
|
+
* - offsets "offset-<size>-<number>""
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
* Interface of available class selectors
|
|
24
|
+
* Interface of available class selectors based on GridClass
|
|
24
25
|
*
|
|
25
26
|
* Example interface:
|
|
26
27
|
* {
|
|
@@ -33,48 +34,9 @@
|
|
|
33
34
|
* Options to configure the number of columns to span on different screen sizes.
|
|
34
35
|
*/
|
|
35
36
|
|
|
36
|
-
/**
|
|
37
|
-
* Breakpoint keys in ascending order. Drives both class generation and the
|
|
38
|
-
* filtering that keeps grid props from reaching the DOM.
|
|
39
|
-
*/
|
|
40
|
-
var GRID_SIZE_KEYS = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
41
|
-
|
|
42
37
|
/**
|
|
43
38
|
* Available gutter sizes for customizing the grid
|
|
44
39
|
*/
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
* Gutter size to modifier class. `1` is the default declared on `.row`, so it
|
|
48
|
-
* needs no class.
|
|
49
|
-
*/
|
|
50
|
-
var GUTTER_CLASS = {
|
|
51
|
-
0: 'MrlRow-gutter--none',
|
|
52
|
-
1: undefined,
|
|
53
|
-
2: 'MrlRow-gutter--double'
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Roles a generic layout wrapper may safely carry.
|
|
58
|
-
*
|
|
59
|
-
* Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)
|
|
60
|
-
* are deliberately excluded: they promise an APG keyboard contract — roving
|
|
61
|
-
* tabindex or `aria-activedescendant`, arrow-key navigation, selection state —
|
|
62
|
-
* that these divs do not implement. The roles below are structural only and
|
|
63
|
-
* carry no interaction contract, so they are safe to forward.
|
|
64
|
-
*
|
|
65
|
-
* `list`/`listitem` in particular is how a row of columns is announced as
|
|
66
|
-
* "list, N items", and is the standard workaround for Safari/VoiceOver
|
|
67
|
-
* dropping implicit list semantics. `region` needs an accessible name to be
|
|
68
|
-
* exposed as a landmark; the type cannot enforce that.
|
|
69
|
-
*
|
|
70
|
-
* Page landmarks belong to the layout components (MrlMain, MrlPage).
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Shared props for the grid components: every `div` attribute, with `role`
|
|
75
|
-
* narrowed to {@link SafeLayoutRole}.
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
exports.GRID_SIZE_KEYS = GRID_SIZE_KEYS;
|
|
79
|
-
exports.GUTTER_CLASS = GUTTER_CLASS;
|
|
41
|
+
exports.GridSizes = GridSizes;
|
|
80
42
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["/**\n * Alignment & justification options for grid containers\n */\nexport type AlignOptions = 'start' | 'center' | 'end';\nexport type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';\n\n/**\n * Available grid sizes\n */\nexport const GridSizes = [\n\t'col',\n\t'xs',\n\t'sm',\n\t'md',\n\t'lg',\n\t'xl',\n\t'xxl'\n];\n\n/**\n * Number of columns that will be span on the grid.\n */\nexport type NumCols = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * The type of classes that can be configured based on the bootstrap API.\n * Current supported:\n * - columns \"col-<size>-<number>\"\n * - offsets \"offset-<size>-<number>\"\"\n */\ntype GridClass = 'col' | 'offset';\n\n/**\n * Interface of available class selectors based on GridClass\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\ntype GridClassConfig = {\n\t[key in GridClass]?: NumCols;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\ntype ColumnConfig = NumCols | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/*\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/*\n\t * @deprecated xs maps to col. Bootstrap grid removed xs in favor of col.\n\t */\n\txs?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on small devices.\n\t */\n\tsm?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on medium devices.\n\t */\n\tmd?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on large devices.\n\t */\n\tlg?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on extra large devices.\n\t */\n\txl?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on extra extra large devices.\n\t */\n\txxl?: ColumnConfig;\n}\n\n/**\n * Available gutter sizes for customizing the grid\n */\nexport type GutterSizes = 0 | 1 | 2;\n"],"names":["GridSizes"],"mappings":";;AAAA;AACA;AACA;;AAIA;AACA;AACA;IACaA,SAAS,GAAG,CACxB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK;;AAGN;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAwCA;AACA;AACA;;;;"}
|