@muraldevkit/ui-toolkit 4.77.0-dev-yOaq.1 → 4.77.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.
Files changed (131) hide show
  1. package/dist/cjs/components/button/MrlButton/MrlButton.js +16 -8
  2. package/dist/cjs/components/button/MrlButton/MrlButton.js.map +1 -1
  3. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
  4. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
  5. package/dist/cjs/components/filter/MrlFilterItem/MrlFilterItem.js +2 -1
  6. package/dist/cjs/components/filter/MrlFilterItem/MrlFilterItem.js.map +1 -1
  7. package/dist/cjs/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js.map +1 -1
  8. package/dist/cjs/components/form/label/MrlLabel/MrlLabel.js.map +1 -1
  9. package/dist/cjs/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.js.map +1 -1
  10. package/dist/cjs/components/form/text-input/MrlTextInput/MrlTextInput.js.map +1 -1
  11. package/dist/cjs/components/grid/MrlCol/MrlCol.js +49 -42
  12. package/dist/cjs/components/grid/MrlCol/MrlCol.js.map +1 -1
  13. package/dist/cjs/components/grid/MrlGrid/MrlGrid.js +6 -4
  14. package/dist/cjs/components/grid/MrlGrid/MrlGrid.js.map +1 -1
  15. package/dist/cjs/components/grid/MrlRow/MrlRow.js +8 -10
  16. package/dist/cjs/components/grid/MrlRow/MrlRow.js.map +1 -1
  17. package/dist/cjs/components/grid/constants.js +8 -27
  18. package/dist/cjs/components/grid/constants.js.map +1 -1
  19. package/dist/cjs/components/link/MrlLink/MrlLink.js.map +1 -1
  20. package/dist/cjs/components/menu/MrlMenu/MrlMenu.js.map +1 -1
  21. package/dist/cjs/components/menu/MrlMenuGroup/MrlMenuGroup.js +4 -1
  22. package/dist/cjs/components/menu/MrlMenuGroup/MrlMenuGroup.js.map +1 -1
  23. package/dist/cjs/components/menu/MrlMenuItem/MrlMenuItem.js +2 -1
  24. package/dist/cjs/components/menu/MrlMenuItem/MrlMenuItem.js.map +1 -1
  25. package/dist/cjs/components/menu/MrlMenuItemLink/MrlMenuItemLink.js +8 -4
  26. package/dist/cjs/components/menu/MrlMenuItemLink/MrlMenuItemLink.js.map +1 -1
  27. package/dist/cjs/components/modal/MrlModalContent/MrlModalContent.js +1 -1
  28. package/dist/cjs/components/modal/MrlModalContent/MrlModalContent.js.map +1 -1
  29. package/dist/cjs/components/modal/MrlModalFooter/MrlModalFooter.js +2 -1
  30. package/dist/cjs/components/modal/MrlModalFooter/MrlModalFooter.js.map +1 -1
  31. package/dist/cjs/components/modal/MrlModalHeader/MrlModalHeader.js +1 -1
  32. package/dist/cjs/components/modal/MrlModalHeader/MrlModalHeader.js.map +1 -1
  33. package/dist/cjs/components/panel/MrlPanel/MrlPanel.js.map +1 -1
  34. package/dist/cjs/components/panel/MrlPanelFooter/MrlPanelFooter.js +2 -1
  35. package/dist/cjs/components/panel/MrlPanelFooter/MrlPanelFooter.js.map +1 -1
  36. package/dist/cjs/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js +2 -1
  37. package/dist/cjs/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js.map +1 -1
  38. package/dist/cjs/version.js +1 -1
  39. package/dist/cjs/version.js.map +1 -1
  40. package/dist/components/button/MrlButton/MrlButton.d.ts +6 -0
  41. package/dist/components/filter/MrlFilterItem/MrlFilterItem.d.ts +6 -3
  42. package/dist/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.d.ts +10 -2
  43. package/dist/components/form/label/MrlLabel/MrlLabel.d.ts +5 -1
  44. package/dist/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.d.ts +2 -0
  45. package/dist/components/form/text-input/MrlTextInput/MrlTextInput.d.ts +5 -1
  46. package/dist/components/grid/MrlCol/MrlCol.d.ts +6 -4
  47. package/dist/components/grid/MrlCol/index.d.ts +1 -1
  48. package/dist/components/grid/MrlGrid/MrlGrid.d.ts +4 -5
  49. package/dist/components/grid/MrlGrid/index.d.ts +1 -1
  50. package/dist/components/grid/MrlRow/MrlRow.d.ts +7 -7
  51. package/dist/components/grid/MrlRow/index.d.ts +1 -1
  52. package/dist/components/grid/constants.d.ts +6 -20
  53. package/dist/components/link/MrlLink/MrlLink.d.ts +2 -0
  54. package/dist/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
  55. package/dist/components/menu/MrlMenuGroup/MrlMenuGroup.d.ts +15 -1
  56. package/dist/components/menu/MrlMenuItem/MrlMenuItem.d.ts +14 -6
  57. package/dist/components/menu/MrlMenuItemLink/MrlMenuItemLink.d.ts +16 -7
  58. package/dist/components/modal/MrlModalContent/MrlModalContent.d.ts +5 -2
  59. package/dist/components/modal/MrlModalFooter/MrlModalFooter.d.ts +4 -2
  60. package/dist/components/modal/MrlModalHeader/MrlModalHeader.d.ts +4 -3
  61. package/dist/components/panel/MrlPanel/MrlPanel.d.ts +2 -1
  62. package/dist/components/panel/MrlPanelFooter/MrlPanelFooter.d.ts +6 -3
  63. package/dist/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.d.ts +4 -2
  64. package/dist/esm/components/button/MrlButton/MrlButton.js +16 -8
  65. package/dist/esm/components/button/MrlButton/MrlButton.js.map +1 -1
  66. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
  67. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
  68. package/dist/esm/components/filter/MrlFilterItem/MrlFilterItem.js +2 -1
  69. package/dist/esm/components/filter/MrlFilterItem/MrlFilterItem.js.map +1 -1
  70. package/dist/esm/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js.map +1 -1
  71. package/dist/esm/components/form/label/MrlLabel/MrlLabel.js.map +1 -1
  72. package/dist/esm/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.js.map +1 -1
  73. package/dist/esm/components/form/text-input/MrlTextInput/MrlTextInput.js.map +1 -1
  74. package/dist/esm/components/grid/MrlCol/MrlCol.js +50 -43
  75. package/dist/esm/components/grid/MrlCol/MrlCol.js.map +1 -1
  76. package/dist/esm/components/grid/MrlGrid/MrlGrid.js +6 -4
  77. package/dist/esm/components/grid/MrlGrid/MrlGrid.js.map +1 -1
  78. package/dist/esm/components/grid/MrlRow/MrlRow.js +8 -10
  79. package/dist/esm/components/grid/MrlRow/MrlRow.js.map +1 -1
  80. package/dist/esm/components/grid/constants.js +8 -26
  81. package/dist/esm/components/grid/constants.js.map +1 -1
  82. package/dist/esm/components/link/MrlLink/MrlLink.js.map +1 -1
  83. package/dist/esm/components/menu/MrlMenu/MrlMenu.js.map +1 -1
  84. package/dist/esm/components/menu/MrlMenuGroup/MrlMenuGroup.js +4 -1
  85. package/dist/esm/components/menu/MrlMenuGroup/MrlMenuGroup.js.map +1 -1
  86. package/dist/esm/components/menu/MrlMenuItem/MrlMenuItem.js +2 -1
  87. package/dist/esm/components/menu/MrlMenuItem/MrlMenuItem.js.map +1 -1
  88. package/dist/esm/components/menu/MrlMenuItemLink/MrlMenuItemLink.js +8 -4
  89. package/dist/esm/components/menu/MrlMenuItemLink/MrlMenuItemLink.js.map +1 -1
  90. package/dist/esm/components/modal/MrlModalContent/MrlModalContent.js +1 -1
  91. package/dist/esm/components/modal/MrlModalContent/MrlModalContent.js.map +1 -1
  92. package/dist/esm/components/modal/MrlModalFooter/MrlModalFooter.js +2 -1
  93. package/dist/esm/components/modal/MrlModalFooter/MrlModalFooter.js.map +1 -1
  94. package/dist/esm/components/modal/MrlModalHeader/MrlModalHeader.js +1 -1
  95. package/dist/esm/components/modal/MrlModalHeader/MrlModalHeader.js.map +1 -1
  96. package/dist/esm/components/panel/MrlPanel/MrlPanel.js.map +1 -1
  97. package/dist/esm/components/panel/MrlPanelFooter/MrlPanelFooter.js +2 -1
  98. package/dist/esm/components/panel/MrlPanelFooter/MrlPanelFooter.js.map +1 -1
  99. package/dist/esm/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js +2 -1
  100. package/dist/esm/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js.map +1 -1
  101. package/dist/esm/version.js +1 -1
  102. package/dist/esm/version.js.map +1 -1
  103. package/dist/styles/MrlSidebar/module.scss +2 -2
  104. package/dist/styles/grid/global.scss +2 -98
  105. package/dist/styles/grid/variables.scss +18 -2
  106. package/dist/styles.css +6 -1
  107. package/dist/types/components/button/MrlButton/MrlButton.d.ts +6 -0
  108. package/dist/types/components/filter/MrlFilterItem/MrlFilterItem.d.ts +6 -3
  109. package/dist/types/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.d.ts +10 -2
  110. package/dist/types/components/form/label/MrlLabel/MrlLabel.d.ts +5 -1
  111. package/dist/types/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.d.ts +2 -0
  112. package/dist/types/components/form/text-input/MrlTextInput/MrlTextInput.d.ts +5 -1
  113. package/dist/types/components/grid/MrlCol/MrlCol.d.ts +6 -4
  114. package/dist/types/components/grid/MrlCol/index.d.ts +1 -1
  115. package/dist/types/components/grid/MrlGrid/MrlGrid.d.ts +4 -5
  116. package/dist/types/components/grid/MrlGrid/index.d.ts +1 -1
  117. package/dist/types/components/grid/MrlRow/MrlRow.d.ts +7 -7
  118. package/dist/types/components/grid/MrlRow/index.d.ts +1 -1
  119. package/dist/types/components/grid/constants.d.ts +6 -20
  120. package/dist/types/components/link/MrlLink/MrlLink.d.ts +2 -0
  121. package/dist/types/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
  122. package/dist/types/components/menu/MrlMenuGroup/MrlMenuGroup.d.ts +15 -1
  123. package/dist/types/components/menu/MrlMenuItem/MrlMenuItem.d.ts +14 -6
  124. package/dist/types/components/menu/MrlMenuItemLink/MrlMenuItemLink.d.ts +16 -7
  125. package/dist/types/components/modal/MrlModalContent/MrlModalContent.d.ts +5 -2
  126. package/dist/types/components/modal/MrlModalFooter/MrlModalFooter.d.ts +4 -2
  127. package/dist/types/components/modal/MrlModalHeader/MrlModalHeader.d.ts +4 -3
  128. package/dist/types/components/panel/MrlPanel/MrlPanel.d.ts +2 -1
  129. package/dist/types/components/panel/MrlPanelFooter/MrlPanelFooter.d.ts +6 -3
  130. package/dist/types/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.d.ts +4 -2
  131. package/package.json +1 -1
@@ -34,7 +34,7 @@ function _interopNamespace(e) {
34
34
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
35
35
  var classnames__default = /*#__PURE__*/_interopDefault(classnames);
36
36
 
37
- var _excluded = ["attrs", "badge", "className", "disabled", "disableEvents", "icon", "iconPos", "kind", "loading", "loadingText", "onClick", "toggleAria", "toggleStyle", "text", "eventId", "size", "state", "tooltip"];
37
+ var _excluded = ["attrs", "badge", "className", "disabled", "disableEvents", "icon", "iconPos", "kind", "loading", "loadingText", "onClick", "toggleAria", "toggleStyle", "text", "eventId", "size", "state", "tooltip", "controlledState"];
38
38
  var MrlButton = /*#__PURE__*/React__namespace.forwardRef(function MrlButton(_ref, ref) {
39
39
  var attrs = _ref.attrs,
40
40
  badge = _ref.badge,
@@ -63,8 +63,16 @@ var MrlButton = /*#__PURE__*/React__namespace.forwardRef(function MrlButton(_ref
63
63
  _ref$state = _ref.state,
64
64
  state = _ref$state === void 0 ? constants$1.buttonDefaults.state : _ref$state,
65
65
  tooltip = _ref.tooltip,
66
+ controlledState = _ref.controlledState,
66
67
  remainingProps = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
67
- var _React$useState = React__namespace.useState(() => helpers._isSelected(state)),
68
+ /**
69
+ * Determine the effective button state.
70
+ * Uses controlledState if provided (controlled mode),
71
+ * otherwise falls back to the state prop (uncontrolled mode).
72
+ * This allows the component to work in both controlled and uncontrolled scenarios.
73
+ */
74
+ var effectiveButtonState = controlledState !== null && controlledState !== void 0 ? controlledState : state;
75
+ var _React$useState = React__namespace.useState(() => helpers._isSelected(effectiveButtonState)),
68
76
  _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
69
77
  isSelected = _React$useState2[0],
70
78
  setIsSelected = _React$useState2[1];
@@ -82,8 +90,8 @@ var MrlButton = /*#__PURE__*/React__namespace.forwardRef(function MrlButton(_ref
82
90
  */
83
91
  React__namespace.useEffect(() => {
84
92
  // allows consumers to set the 'selected' or 'selected-disabled' state from a parent component.
85
- setIsSelected(helpers._isSelected(state));
86
- }, [state]);
93
+ setIsSelected(helpers._isSelected(effectiveButtonState));
94
+ }, [effectiveButtonState]);
87
95
 
88
96
  /**
89
97
  * Handle onClick events
@@ -92,21 +100,21 @@ var MrlButton = /*#__PURE__*/React__namespace.forwardRef(function MrlButton(_ref
92
100
  */
93
101
  function handleOnClick(e) {
94
102
  e.stopPropagation();
95
- if (helpers._isDisabled(state, loading) || disabled || disableEvents) {
103
+ if (helpers._isDisabled(effectiveButtonState, loading) || disabled || disableEvents) {
96
104
  return;
97
105
  }
98
106
  trackInteraction({
99
107
  action: 'click',
100
108
  variant: kind
101
109
  });
102
- if (isToggleButton) {
110
+ if (isToggleButton && !controlledState) {
103
111
  setIsSelected(prevIsSelected => !prevIsSelected);
104
112
  }
105
113
  if (onClick && typeof onClick === 'function') {
106
114
  onClick(e);
107
115
  }
108
116
  }
109
- var classNames = classnames__default.default('mrlButton', "mrlButton--".concat(size), "mrlButton--".concat(kind), state === 'skeleton' && "mrlButton--skeleton", !icon && loading && "mrlButton--loading", isToggleButton && "toggleStyle--".concat(toggleStyle), icon && "mrlButton--icon-".concat(iconPos), className, (attrs === null || attrs === void 0 ? void 0 : attrs.class) || (attrs === null || attrs === void 0 ? void 0 : attrs.className));
117
+ var classNames = classnames__default.default('mrlButton', "mrlButton--".concat(size), "mrlButton--".concat(kind), effectiveButtonState === 'skeleton' && "mrlButton--skeleton", !icon && loading && "mrlButton--loading", isToggleButton && "toggleStyle--".concat(toggleStyle), icon && "mrlButton--icon-".concat(iconPos), className, (attrs === null || attrs === void 0 ? void 0 : attrs.class) || (attrs === null || attrs === void 0 ? void 0 : attrs.className));
110
118
  if (attrs && attrs.class) delete attrs.class;
111
119
  if (attrs && attrs.className) delete attrs.className;
112
120
  var spinnerProps = helpers._spinnerProps(kind, size);
@@ -117,7 +125,7 @@ var MrlButton = /*#__PURE__*/React__namespace.forwardRef(function MrlButton(_ref
117
125
  text: loadingText
118
126
  });
119
127
  var attributes = setAttributes.setAttributes(attrs || {}, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
120
- 'aria-disabled': helpers._isDisabled(state, loading) || disabled
128
+ 'aria-disabled': helpers._isDisabled(effectiveButtonState, loading) || disabled
121
129
  }, isToggleButton && {
122
130
  ["aria-".concat(toggleAria)]: isSelected || false
123
131
  }), {}, {
@@ -1 +1 @@
1
- {"version":3,"file":"MrlButton.js","sources":["../../../../../src/components/button/MrlButton/MrlButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tallowedButtonValues,\n\tbuttonDefaults,\n\tMrlButtonKind,\n\tMrlButtonSize,\n\tToggleAria,\n\tIconPosition\n} from '../constants';\nimport { _isDisabled, _isSelected, _spinnerProps } from '../helpers';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltipAnchor, MrlTooltipPosition } from '../../tooltip/constants';\nimport { MrlTooltip } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { AttrsObject, MrlComponentProps, setAttributes } from '../../../utils';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport './MrlButton.global.scss';\n\nexport type MrlButtonState = (typeof allowedButtonValues.states)[number];\nexport type ToggleStyle = (typeof allowedButtonValues.toggleStyles)[number];\n\nexport interface TooltipConfig {\n\t/**\n\t * The text to display in the tooltip\n\t */\n\ttext: string;\n\t/**\n\t * The position of the tooltip relative to the button\n\t */\n\tposition?: MrlTooltipPosition;\n\n\t/**\n\t * The anchor of the tooltip relative to the button\n\t */\n\tanchor?: MrlTooltipAnchor;\n\n\t/**\n\t * The data-qa attribute for the tooltip\n\t */\n\tdataQa?: string;\n}\n\nexport interface MrlButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'button'> {\n\t/**\n\t * Applies additional HTML attributes to the button element.\n\t *\n\t * @deprecated\n\t */\n\tattrs?: AttrsObject;\n\t/**\n\t * Allow developers to add badge to buttons.\n\t */\n\tbadge?: React.ReactElement;\n\n\t/**\n\t * @deprecated - Use state=\"disabled\" or \"selected-disabled\" or \"skeleton\" instead.\n\t * Allow developers to change the disabled state based on user interactions.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Allows developers the ability to disable built in event listeners so they can manage user\n\t * interactions from the application.\n\t */\n\tdisableEvents?: boolean;\n\t/**\n\t * Allow developers to add icon to buttons.\n\t */\n\ticon?: React.ReactElement;\n\t/**\n\t * Allows developers to right-align an icon within a button.\n\t */\n\ticonPos?: IconPosition;\n\t/**\n\t * Changes the visual emphasis of the button.\n\t */\n\tkind?: MrlButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n\t/**\n\t * Changes the size of the button so it can scale with its surrounding context.\n\t */\n\tsize?: MrlButtonSize;\n\t/**\n\t * Changes the state of the button based on user permissions or actions.\n\t */\n\tstate?: MrlButtonState;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'board-share-cta'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\t/**\n\t * Determines which aria setup to use for various toggle/selected styles.\n\t * pressed - use for an traditional “toggle button”\n\t * selected - use for tabs and custom select options\n\t * expanded - use for menus, panels, and popovers\n\t * checked - use for custom [radiobutton](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/#wai-aria-roles-states-and-properties-16)\n\t * \t\tor [checkbox](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/#wai-aria-roles-states-and-properties-5) inputs\n\t */\n\ttoggleAria?: ToggleAria;\n\n\t/**\n\t * Tooltip configuration for the button\n\t */\n\ttooltip?: TooltipConfig;\n\n\t/**\n\t * Selected state variant when the button is a Toggle Button. The visual styles\n\t * are also impacted by the \"kind\" prop. Toggle buttons are only supported\n\t * when \"kind\" is set to either \"ghost\" or \"ghost-inverse\". Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\ttoggleStyle?: ToggleStyle;\n}\n\nexport const MrlButton = React.forwardRef<HTMLButtonElement, MrlButtonProps>(function MrlButton(\n\t{\n\t\tattrs,\n\t\tbadge,\n\t\tclassName,\n\t\tdisabled = buttonDefaults.disabled,\n\t\tdisableEvents = false,\n\t\ticon,\n\t\ticonPos = buttonDefaults.iconPos,\n\t\tkind = buttonDefaults.kind,\n\t\tloading = false,\n\t\tloadingText = spinnerDefaults.text,\n\t\tonClick,\n\t\ttoggleAria = buttonDefaults.toggleAria,\n\t\ttoggleStyle,\n\t\ttext,\n\t\teventId,\n\t\tsize = buttonDefaults.size,\n\t\tstate = buttonDefaults.state,\n\t\ttooltip,\n\t\t...remainingProps\n\t}: MrlButtonProps,\n\tref\n) {\n\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(state));\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlButton', eventId);\n\n\t/**\n\t * MrlButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'\n\t */\n\tconst isToggleButton = toggleStyle && allowedButtonValues.toggleStyles.includes(toggleStyle);\n\n\t/**\n\t * We need to watch the value of state to keep in sync\n\t * the value of state passed as props and the internal\n\t * isSelected piece of state.\n\t */\n\tReact.useEffect(() => {\n\t\t// allows consumers to set the 'selected' or 'selected-disabled' state from a parent component.\n\t\tsetIsSelected(_isSelected(state));\n\t}, [state]);\n\n\t/**\n\t * Handle onClick events\n\t *\n\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t */\n\tfunction handleOnClick(e: React.MouseEvent<HTMLButtonElement>) {\n\t\te.stopPropagation();\n\n\t\tif (_isDisabled(state, loading) || disabled || disableEvents) {\n\t\t\treturn;\n\t\t}\n\n\t\ttrackInteraction({ action: 'click', variant: kind });\n\n\t\tif (isToggleButton) {\n\t\t\tsetIsSelected((prevIsSelected) => !prevIsSelected);\n\t\t}\n\n\t\tif (onClick && typeof onClick === 'function') {\n\t\t\tonClick(e);\n\t\t}\n\t}\n\n\tconst classNames = classnames(\n\t\t'mrlButton',\n\t\t`mrlButton--${size}`,\n\t\t`mrlButton--${kind}`,\n\t\tstate === 'skeleton' && `mrlButton--skeleton`,\n\t\t!icon && loading && `mrlButton--loading`,\n\t\tisToggleButton && `toggleStyle--${toggleStyle}`,\n\t\ticon && `mrlButton--icon-${iconPos}`,\n\t\tclassName,\n\t\tattrs?.class || attrs?.className\n\t);\n\n\tif (attrs && attrs.class) delete attrs.class;\n\tif (attrs && attrs.className) delete attrs.className;\n\n\tconst spinnerProps = _spinnerProps(kind, size);\n\tconst spinner = (\n\t\t<MrlSpinner kind={spinnerProps.kind} role=\"none\" size={spinnerProps.size} text={loadingText} />\n\t);\n\n\tconst attributes = setAttributes(attrs || {}, {\n\t\t'aria-disabled': _isDisabled(state, loading) || disabled,\n\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\trole: 'button',\n\t\ttype: 'button'\n\t});\n\n\tconst renderButton = () => (\n\t\t<button\n\t\t\t{...attributes}\n\t\t\t{...remainingProps}\n\t\t\tclassName={classNames}\n\t\t\tref={ref}\n\t\t\tonClick={handleOnClick}\n\t\t>\n\t\t\t{loading ? spinner : icon}\n\t\t\t<span className=\"mrlButton-text\">{text}</span>\n\t\t\t{badge}\n\t\t</button>\n\t);\n\n\treturn !tooltip ? (\n\t\trenderButton()\n\t) : (\n\t\t<MrlTooltip\n\t\t\tposition={tooltip.position || 'bottom'}\n\t\t\tanchor={tooltip.anchor || 'center'}\n\t\t\ttext={tooltip.text}\n\t\t\tdataQa={tooltip.dataQa}\n\t\t>\n\t\t\t{renderButton()}\n\t\t</MrlTooltip>\n\t);\n});\n"],"names":["MrlButton","React","forwardRef","_ref","ref","attrs","badge","className","_ref$disabled","disabled","buttonDefaults","_ref$disableEvents","disableEvents","icon","_ref$iconPos","iconPos","_ref$kind","kind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","_ref$toggleAria","toggleAria","toggleStyle","eventId","_ref$size","size","_ref$state","state","tooltip","remainingProps","_objectWithoutProperties","_excluded","_React$useState","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","trackInteraction","useMrlTrackInteraction","isToggleButton","allowedButtonValues","toggleStyles","includes","useEffect","handleOnClick","e","stopPropagation","_isDisabled","action","variant","prevIsSelected","classNames","classnames","concat","class","spinnerProps","_spinnerProps","spinner","createElement","MrlSpinner","role","attributes","setAttributes","_objectSpread","type","renderButton","_extends","MrlTooltip","position","anchor","dataQa"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIO,IAAMA,SAAS,gBAAGC,gBAAK,CAACC,UAAU,CAAoC,SAASF,SAASA,CAAAG,IAAA,EAsB9FC,GAAG,EACF;AAAA,EAAA,IArBAC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,aAAA,GAAAL,IAAA,CACTM,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAA,MAAA,GAAGE,0BAAc,CAACD,QAAQ,GAAAD,aAAA;IAAAG,kBAAA,GAAAR,IAAA,CAClCS,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GA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AU,IAAI;GAAO,CAAA,EAAA,EAAA,EAAA;AACrEyB,IAAAA,IAAI,EAAE,QAAQ;AACdI,IAAAA,IAAI,EAAE;AAAQ,GAAA,CACd,CAAC;AAEF,EAAA,IAAMC,YAAY,GAAGA,mBACpBvE,gBAAA,CAAAgE,aAAA,CAAA,QAAA,EAAAQ,iCAAA,CAAA,EAAA,EACKL,UAAU,EACVlC,cAAc,EAAA;AAClB3B,IAAAA,SAAS,EAAEmD,UAAW;AACtBtD,IAAAA,GAAG,EAAEA,GAAI;AACToB,IAAAA,OAAO,EAAE2B;GAAc,CAAA,EAEtBhC,OAAO,GAAG6C,OAAO,GAAGnD,IAAI,eACzBZ,gBAAA,CAAAgE,aAAA,CAAA,MAAA,EAAA;AAAM1D,IAAAA,SAAS,EAAC;AAAgB,GAAA,EAAEgB,IAAW,CAAC,EAC7CjB,KACM,CACR;EAED,OAAO,CAAC2B,OAAO,GACduC,YAAY,EAAE,gBAEdvE,gBAAA,CAAAgE,aAAA,CAACS,qBAAU,EAAA;AACVC,IAAAA,QAAQ,EAAE1C,OAAO,CAAC0C,QAAQ,IAAI,QAAS;AACvCC,IAAAA,MAAM,EAAE3C,OAAO,CAAC2C,MAAM,IAAI,QAAS;IACnCrD,IAAI,EAAEU,OAAO,CAACV,IAAK;IACnBsD,MAAM,EAAE5C,OAAO,CAAC4C;GAAO,EAEtBL,YAAY,EACF,CACZ;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"MrlButton.js","sources":["../../../../../src/components/button/MrlButton/MrlButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tallowedButtonValues,\n\tbuttonDefaults,\n\tMrlButtonKind,\n\tMrlButtonSize,\n\tToggleAria,\n\tIconPosition\n} from '../constants';\nimport { _isDisabled, _isSelected, _spinnerProps } from '../helpers';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltipAnchor, MrlTooltipPosition } from '../../tooltip/constants';\nimport { MrlTooltip } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { AttrsObject, MrlComponentProps, setAttributes } from '../../../utils';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport './MrlButton.global.scss';\n\nexport type MrlButtonState = (typeof allowedButtonValues.states)[number];\nexport type ToggleStyle = (typeof allowedButtonValues.toggleStyles)[number];\n\nexport interface TooltipConfig {\n\t/**\n\t * The text to display in the tooltip\n\t */\n\ttext: string;\n\t/**\n\t * The position of the tooltip relative to the button\n\t */\n\tposition?: MrlTooltipPosition;\n\n\t/**\n\t * The anchor of the tooltip relative to the button\n\t */\n\tanchor?: MrlTooltipAnchor;\n\n\t/**\n\t * The data-qa attribute for the tooltip\n\t */\n\tdataQa?: string;\n}\n\nexport interface MrlButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'button'> {\n\t/**\n\t * Applies additional HTML attributes to the button element.\n\t *\n\t * @deprecated\n\t */\n\tattrs?: AttrsObject;\n\t/**\n\t * Allow developers to add badge to buttons.\n\t */\n\tbadge?: React.ReactElement;\n\n\t/**\n\t * @deprecated - Use state=\"disabled\" or \"selected-disabled\" or \"skeleton\" instead.\n\t * Allow developers to change the disabled state based on user interactions.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Allows developers the ability to disable built in event listeners so they can manage user\n\t * interactions from the application.\n\t */\n\tdisableEvents?: boolean;\n\t/**\n\t * Allow developers to add icon to buttons.\n\t */\n\ticon?: React.ReactElement;\n\t/**\n\t * Allows developers to right-align an icon within a button.\n\t */\n\ticonPos?: IconPosition;\n\t/**\n\t * Changes the visual emphasis of the button.\n\t */\n\tkind?: MrlButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n\t/**\n\t * Changes the size of the button so it can scale with its surrounding context.\n\t */\n\tsize?: MrlButtonSize;\n\t/**\n\t * Changes the state of the button based on user permissions or actions.\n\t */\n\tstate?: MrlButtonState;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'board-share-cta'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\t/**\n\t * Determines which aria setup to use for various toggle/selected styles.\n\t * pressed - use for an traditional “toggle button”\n\t * selected - use for tabs and custom select options\n\t * expanded - use for menus, panels, and popovers\n\t * checked - use for custom [radiobutton](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/#wai-aria-roles-states-and-properties-16)\n\t * \t\tor [checkbox](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/#wai-aria-roles-states-and-properties-5) inputs\n\t */\n\ttoggleAria?: ToggleAria;\n\n\t/**\n\t * Tooltip configuration for the button\n\t */\n\ttooltip?: TooltipConfig;\n\n\t/**\n\t * Selected state variant when the button is a Toggle Button. The visual styles\n\t * are also impacted by the \"kind\" prop. Toggle buttons are only supported\n\t * when \"kind\" is set to either \"ghost\" or \"ghost-inverse\". Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\ttoggleStyle?: ToggleStyle;\n\n\t/**\n\t * Controlled state that overrides the internal state management.\n\t * When provided, this takes precedence over the `state` prop and allows\n\t * the parent component to fully control the button's state.\n\t */\n\tcontrolledState?: MrlButtonState;\n}\n\nexport const MrlButton = React.forwardRef<HTMLButtonElement, MrlButtonProps>(function MrlButton(\n\t{\n\t\tattrs,\n\t\tbadge,\n\t\tclassName,\n\t\tdisabled = buttonDefaults.disabled,\n\t\tdisableEvents = false,\n\t\ticon,\n\t\ticonPos = buttonDefaults.iconPos,\n\t\tkind = buttonDefaults.kind,\n\t\tloading = false,\n\t\tloadingText = spinnerDefaults.text,\n\t\tonClick,\n\t\ttoggleAria = buttonDefaults.toggleAria,\n\t\ttoggleStyle,\n\t\ttext,\n\t\teventId,\n\t\tsize = buttonDefaults.size,\n\t\tstate = buttonDefaults.state,\n\t\ttooltip,\n\t\tcontrolledState,\n\t\t...remainingProps\n\t}: MrlButtonProps,\n\tref\n) {\n\t/**\n\t * Determine the effective button state.\n\t * Uses controlledState if provided (controlled mode),\n\t * otherwise falls back to the state prop (uncontrolled mode).\n\t * This allows the component to work in both controlled and uncontrolled scenarios.\n\t */\n\tconst effectiveButtonState = controlledState ?? state;\n\n\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(effectiveButtonState));\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlButton', eventId);\n\n\t/**\n\t * MrlButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'\n\t */\n\tconst isToggleButton = toggleStyle && allowedButtonValues.toggleStyles.includes(toggleStyle);\n\n\t/**\n\t * We need to watch the value of state to keep in sync\n\t * the value of state passed as props and the internal\n\t * isSelected piece of state.\n\t */\n\tReact.useEffect(() => {\n\t\t// allows consumers to set the 'selected' or 'selected-disabled' state from a parent component.\n\t\tsetIsSelected(_isSelected(effectiveButtonState));\n\t}, [effectiveButtonState]);\n\n\t/**\n\t * Handle onClick events\n\t *\n\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t */\n\tfunction handleOnClick(e: React.MouseEvent<HTMLButtonElement>) {\n\t\te.stopPropagation();\n\n\t\tif (_isDisabled(effectiveButtonState, loading) || disabled || disableEvents) {\n\t\t\treturn;\n\t\t}\n\n\t\ttrackInteraction({ action: 'click', variant: kind });\n\n\t\tif (isToggleButton && !controlledState) {\n\t\t\tsetIsSelected((prevIsSelected) => !prevIsSelected);\n\t\t}\n\n\t\tif (onClick && typeof onClick === 'function') {\n\t\t\tonClick(e);\n\t\t}\n\t}\n\n\tconst classNames = classnames(\n\t\t'mrlButton',\n\t\t`mrlButton--${size}`,\n\t\t`mrlButton--${kind}`,\n\t\teffectiveButtonState === 'skeleton' && `mrlButton--skeleton`,\n\t\t!icon && loading && `mrlButton--loading`,\n\t\tisToggleButton && `toggleStyle--${toggleStyle}`,\n\t\ticon && `mrlButton--icon-${iconPos}`,\n\t\tclassName,\n\t\tattrs?.class || attrs?.className\n\t);\n\n\tif (attrs && attrs.class) delete attrs.class;\n\tif (attrs && attrs.className) delete attrs.className;\n\n\tconst spinnerProps = _spinnerProps(kind, size);\n\tconst spinner = (\n\t\t<MrlSpinner kind={spinnerProps.kind} role=\"none\" size={spinnerProps.size} text={loadingText} />\n\t);\n\n\tconst attributes = setAttributes(attrs || {}, {\n\t\t'aria-disabled': _isDisabled(effectiveButtonState, loading) || disabled,\n\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\trole: 'button',\n\t\ttype: 'button'\n\t});\n\n\tconst renderButton = () => (\n\t\t<button\n\t\t\t{...attributes}\n\t\t\t{...remainingProps}\n\t\t\tclassName={classNames}\n\t\t\tref={ref}\n\t\t\tonClick={handleOnClick}\n\t\t>\n\t\t\t{loading ? spinner : icon}\n\t\t\t<span className=\"mrlButton-text\">{text}</span>\n\t\t\t{badge}\n\t\t</button>\n\t);\n\n\treturn !tooltip ? (\n\t\trenderButton()\n\t) : (\n\t\t<MrlTooltip\n\t\t\tposition={tooltip.position || 'bottom'}\n\t\t\tanchor={tooltip.anchor || 'center'}\n\t\t\ttext={tooltip.text}\n\t\t\tdataQa={tooltip.dataQa}\n\t\t>\n\t\t\t{renderButton()}\n\t\t</MrlTooltip>\n\t);\n});\n"],"names":["MrlButton","React","forwardRef","_ref","ref","attrs","badge","className","_ref$disabled","disabled","buttonDefaults","_ref$disableEvents","disableEvents","icon","_ref$iconPos","iconPos","_ref$kind","kind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","_ref$toggleAria","toggleAria","toggleStyle","eventId","_ref$size","size","_ref$state","state","tooltip","controlledState","remainingProps","_objectWithoutProperties","_excluded","effectiveButtonState","_React$useState","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","trackInteraction","useMrlTrackInteraction","isToggleButton","allowedButtonValues","toggleStyles","includes","useEffect","handleOnClick","e","stopPropagation","_isDisabled","action","variant","prevIsSelected","classNames","classnames","concat","class","spinnerProps","_spinnerProps","spinner","createElement","MrlSpinner","role","attributes","setAttributes","_objectSpread","type","renderButton","_extends","MrlTooltip","position","anchor","dataQa"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6IO,IAAMA,SAAS,gBAAGC,gBAAK,CAACC,UAAU,CAAoC,SAASF,SAASA,CAAAG,IAAA,EAuB9FC,GAAG,EACF;AAAA,EAAA,IAtBAC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,aAAA,GAAAL,IAAA,CACTM,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAA,MAAA,GAAGE,0BAAc,CAACD,QAAQ,GAAAD,aAAA;IAAAG,kBAAA,GAAAR,IAAA,CAClCS,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,kBAAA;IACrBE,IAAI,GAAAV,IAAA,CAAJU,IAAI;IAAAC,YAAA,GAAAX,IAAA,CACJY,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAGJ,0BAAc,CAACK,OAAO,GAAAD,YAAA;IAAAE,SAAA,GAAAb,IAAA,CAChCc,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGN,0BAAc,CAACO,IAAI,GAAAD,SAAA;IAAAE,YAAA,GAAAf,IAAA,CAC1BgB,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,YAAA;IAAAE,gBAAA,GAAAjB,IAAA,C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AAA;AAClB5B,IAAAA,SAAS,EAAEqD,UAAW;AACtBxD,IAAAA,GAAG,EAAEA,GAAI;AACToB,IAAAA,OAAO,EAAE6B;GAAc,CAAA,EAEtBlC,OAAO,GAAG+C,OAAO,GAAGrD,IAAI,eACzBZ,gBAAA,CAAAkE,aAAA,CAAA,MAAA,EAAA;AAAM5D,IAAAA,SAAS,EAAC;AAAgB,GAAA,EAAEgB,IAAW,CAAC,EAC7CjB,KACM,CACR;EAED,OAAO,CAAC2B,OAAO,GACdyC,YAAY,EAAE,gBAEdzE,gBAAA,CAAAkE,aAAA,CAACS,qBAAU,EAAA;AACVC,IAAAA,QAAQ,EAAE5C,OAAO,CAAC4C,QAAQ,IAAI,QAAS;AACvCC,IAAAA,MAAM,EAAE7C,OAAO,CAAC6C,MAAM,IAAI,QAAS;IACnCvD,IAAI,EAAEU,OAAO,CAACV,IAAK;IACnBwD,MAAM,EAAE9C,OAAO,CAAC8C;GAAO,EAEtBL,YAAY,EACF,CACZ;AACF,CAAC;;;;"}
@@ -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, _ref2;
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
- var displayError = (_ref2 = validationError !== null && validationError !== void 0 ? validationError : errorMessage) !== null && _ref2 !== void 0 ? _ref2 : null;
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,KAAyB,EAAsB;EAAA,IAAAC,IAAA,EAAAC,KAAA;AAC5E,EAAA,IAAAC,aAAA,GAqB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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,CAlBRM,YAAY;IACZC,OAAO,GAiBJP,KAAK,CAjBRO,OAAO;IACPC,QAAQ,GAgBLR,KAAK,CAhBRQ,QAAQ;IAAAC,cAAA,GAgBLT,KAAK,CAfRU,OAAO;AAAPA,IAA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,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;;;;"}
@@ -34,7 +34,8 @@ var classnames__default = /*#__PURE__*/_interopDefault(classnames);
34
34
 
35
35
  var _excluded = ["data-qa", "id", "children", "className", "value", "count", "eventId"];
36
36
  /**
37
- * MrlFilterItem component.
37
+ * MrlFilterItem component. One option of an `MrlFilter`, rendered as a `radio` of the filter's
38
+ * radio group; must be rendered inside `MrlFilter`.
38
39
  *
39
40
  * @param props - The component props.
40
41
  * @returns The MrlFilterItem component.
@@ -1 +1 @@
1
- {"version":3,"file":"MrlFilterItem.js","sources":["../../../../../src/components/filter/MrlFilterItem/MrlFilterItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport styles from './MrlFilterItem.module.scss';\nimport { DataQa } from '../../../utils/dataQa';\nimport { getUniqueId } from '../../../utils';\nimport { useMrlFilterContext } from '../MrlFilterContext';\nimport { MrlBadge } from '../../badge';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nexport type MrlFilterItemProps = {\n\t/**\n\t * The filter item's value.\n\t */\n\tvalue: string;\n\t/**\n\t * The content to be displayed within the filter item.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * The count of items for this filter option.\n\t */\n\tcount?: number;\n\t/**\n\t * Enables interaction tracking for this filter option. Provide a stable, non-PII id\n\t * (e.g. 'templates-category-filter'). When omitted, the option emits no analytics.\n\t *\n\t * Note: the option's value and content are never emitted.\n\t */\n\teventId?: string;\n} & React.ComponentPropsWithoutRef<'span'> &\n\tDataQa;\n\n/**\n * MrlFilterItem component.\n *\n * @param props - The component props.\n * @returns The MrlFilterItem component.\n */\nexport function MrlFilterItem(props: MrlFilterItemProps): React.ReactElement {\n\tconst { ['data-qa']: dataQa, id, children, className, value, count, eventId, ...rest } = props;\n\n\tconst { state, dispatch } = useMrlFilterContext();\n\tconst trackInteraction = useMrlTrackInteraction('MrlFilterItem', eventId);\n\n\tfunction handleFilterChange() {\n\t\t// click also focuses the item, so only an actual change in selection is emitted.\n\t\t// the option's value is consumer data and is never emitted.\n\t\tif (state.checked !== value) {\n\t\t\ttrackInteraction({ action: 'select' });\n\t\t}\n\n\t\tdispatch({\n\t\t\tpayload: value,\n\t\t\ttype: 'SET_CHECKED'\n\t\t});\n\t}\n\n\tconst filterItemIdRef = React.useRef<string>(id || getUniqueId('mrl-filter-item'));\n\tconst isChecked = state.checked === value;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/interactive-supports-focus, jsx-a11y/click-events-have-key-events\n\t\t<span\n\t\t\t{...rest}\n\t\t\tdata-qa={dataQa}\n\t\t\tdata-roving=\"true\"\n\t\t\tonClick={handleFilterChange}\n\t\t\tonFocus={handleFilterChange}\n\t\t\taria-checked={isChecked}\n\t\t\trole=\"radio\"\n\t\t\tid={filterItemIdRef.current}\n\t\t\tclassName={classnames(\n\t\t\t\tstyles['MrlFilterItem'],\n\t\t\t\t'MrlFilterItem',\n\t\t\t\t{\n\t\t\t\t\t[styles['MrlFilterItem-has-count']]: typeof count !== 'undefined'\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{children}\n\t\t\t{typeof count !== 'undefined' && (\n\t\t\t\t<MrlBadge text={String(count)} aria-label={`, ${count} items`} />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n"],"names":["MrlFilterItem","props","dataQa","id","children","className","value","count","eventId","rest","_objectWithoutProperties","_excluded","_useMrlFilterContext","useMrlFilterContext","state","dispatch","trackInteraction","useMrlTrackInteraction","handleFilterChange","checked","action","payload","type","filterItemIdRef","React","useRef","getUniqueId","isChecked","createElement","_extends","onClick","onFocus","role","current","classnames","styles","MrlBadge","text","String","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,KAAyB,EAAsB;AAC5E,EAAA,IAAqBC,MAAM,GAA8DD,KAAK,CAArF,SAAS,CAAA;IAAWE,EAAE,GAA0DF,KAAK,CAAjEE,EAAE;IAAEC,QAAQ,GAAgDH,KAAK,CAA7DG,QAAQ;IAAEC,SAAS,GAAqCJ,KAAK,CAAnDI,SAAS;IAAEC,KAAK,GAA8BL,KAAK,CAAxCK,KAAK;IAAEC,KAAK,GAAuBN,KAAK,CAAjCM,KAAK;IAAEC,OAAO,GAAcP,KAAK,CAA1BO,OAAO;AAAKC,IAAAA,IAAI,GAAAC,iDAAA,CAAKT,KAAK,EAAAU,SAAA,CAAA;AAE9F,EAAA,IAAAC,oBAAA,GAA4BC,oCAAmB,EAAE;IAAzCC,KAAK,GAAAF,oBAAA,CAALE,KAAK;IAAEC,QAAQ,GAAAH,oBAAA,CAARG,QAAQ;AACvB,EAAA,IAAMC,gBAAgB,GAAGC,sCAAsB,CAAC,eAAe,EAAET,OAAO,CAAC;EAEzE,SAASU,kBAAkBA,GAAG;AAC7B;AACA;AACA,IAAA,IAAIJ,KAAK,CAACK,OAAO,KAAKb,KAAK,EAAE;AAC5BU,MAAAA,gBAAgB,CAAC;AAAEI,QAAAA,MAAM,EAAE;AAAS,OAAC,CAAC;AACvC,IAAA;AAEAL,IAAAA,QAAQ,CAAC;AACRM,MAAAA,OAAO,EAAEf,KAAK;AACdgB,MAAAA,IAAI,EAAE;AACP,KAAC,CAAC;AACH,EAAA;AAEA,EAAA,IAAMC,eAAe,GAAGC,gBAAK,CAACC,MAAM,CAAStB,EAAE,IAAIuB,yBAAW,CAAC,iBAAiB,CAAC,CAAC;AAClF,EAAA,IAAMC,SAAS,GAAGb,KAAK,CAACK,OAAO,KAAKb,KAAK;AAEzC,EAAA;AAAA;AACC;AACAkB,IAAAA,gBAAA,CAAAI,aAAA,CAAA,MAAA,EAAAC,iCAAA,KACKpB,IAAI,EAAA;AACR,MAAA,SAAA,EAASP,MAAO;AAChB,MAAA,aAAA,EAAY,MAAM;AAClB4B,MAAAA,OAAO,EAAEZ,kBAAmB;AAC5Ba,MAAAA,OAAO,EAAEb,kBAAmB;AAC5B,MAAA,cAAA,EAAcS,SAAU;AACxBK,MAAAA,IAAI,EAAC,OAAO;MACZ7B,EAAE,EAAEoB,eAAe,CAACU,OAAQ;MAC5B5B,SAAS,EAAE6B,2BAAU,CACpBC,4BAAM,CAAC,eAAe,CAAC,EACvB,eAAe,EACf;AACC,QAAA,CAACA,4BAAM,CAAC,yBAAyB,CAAC,GAAG,OAAO5B,KAAK,KAAK;AACvD,OAAC,EACDF,SACD;KAAE,CAAA,EAEDD,QAAQ,EACR,OAAOG,KAAK,KAAK,WAAW,iBAC5BiB,gBAAA,CAAAI,aAAA,CAACQ,iBAAQ,EAAA;AAACC,MAAAA,IAAI,EAAEC,MAAM,CAAC/B,KAAK,CAAE;MAAC,YAAA,EAAA,IAAA,CAAAgC,MAAA,CAAiBhC,KAAK,EAAA,QAAA;AAAS,KAAE,CAE5D;AAAC;AAET;;;;"}
1
+ {"version":3,"file":"MrlFilterItem.js","sources":["../../../../../src/components/filter/MrlFilterItem/MrlFilterItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport styles from './MrlFilterItem.module.scss';\nimport { DataQa } from '../../../utils/dataQa';\nimport { getUniqueId } from '../../../utils';\nimport { useMrlFilterContext } from '../MrlFilterContext';\nimport { MrlBadge } from '../../badge';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nexport type MrlFilterItemProps = {\n\t/**\n\t * The filter item's value, reported to `MrlFilter` when the item is selected by click or by\n\t * arrow-key focus. The item is checked while it equals the filter's selected value.\n\t */\n\tvalue: string;\n\t/**\n\t * The content to be displayed within the filter item.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * The count of items for this filter option, shown as a badge and announced as \", N items\"\n\t * after the label.\n\t */\n\tcount?: number;\n\t/**\n\t * Enables interaction tracking for this filter option. Provide a stable, non-PII id\n\t * (e.g. 'templates-category-filter'). When omitted, the option emits no analytics.\n\t *\n\t * Note: the option's value and content are never emitted.\n\t */\n\teventId?: string;\n} & React.ComponentPropsWithoutRef<'span'> &\n\tDataQa;\n\n/**\n * MrlFilterItem component. One option of an `MrlFilter`, rendered as a `radio` of the filter's\n * radio group; must be rendered inside `MrlFilter`.\n *\n * @param props - The component props.\n * @returns The MrlFilterItem component.\n */\nexport function MrlFilterItem(props: MrlFilterItemProps): React.ReactElement {\n\tconst { ['data-qa']: dataQa, id, children, className, value, count, eventId, ...rest } = props;\n\n\tconst { state, dispatch } = useMrlFilterContext();\n\tconst trackInteraction = useMrlTrackInteraction('MrlFilterItem', eventId);\n\n\tfunction handleFilterChange() {\n\t\t// click also focuses the item, so only an actual change in selection is emitted.\n\t\t// the option's value is consumer data and is never emitted.\n\t\tif (state.checked !== value) {\n\t\t\ttrackInteraction({ action: 'select' });\n\t\t}\n\n\t\tdispatch({\n\t\t\tpayload: value,\n\t\t\ttype: 'SET_CHECKED'\n\t\t});\n\t}\n\n\tconst filterItemIdRef = React.useRef<string>(id || getUniqueId('mrl-filter-item'));\n\tconst isChecked = state.checked === value;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/interactive-supports-focus, jsx-a11y/click-events-have-key-events\n\t\t<span\n\t\t\t{...rest}\n\t\t\tdata-qa={dataQa}\n\t\t\tdata-roving=\"true\"\n\t\t\tonClick={handleFilterChange}\n\t\t\tonFocus={handleFilterChange}\n\t\t\taria-checked={isChecked}\n\t\t\trole=\"radio\"\n\t\t\tid={filterItemIdRef.current}\n\t\t\tclassName={classnames(\n\t\t\t\tstyles['MrlFilterItem'],\n\t\t\t\t'MrlFilterItem',\n\t\t\t\t{\n\t\t\t\t\t[styles['MrlFilterItem-has-count']]: typeof count !== 'undefined'\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{children}\n\t\t\t{typeof count !== 'undefined' && (\n\t\t\t\t<MrlBadge text={String(count)} aria-label={`, ${count} items`} />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n"],"names":["MrlFilterItem","props","dataQa","id","children","className","value","count","eventId","rest","_objectWithoutProperties","_excluded","_useMrlFilterContext","useMrlFilterContext","state","dispatch","trackInteraction","useMrlTrackInteraction","handleFilterChange","checked","action","payload","type","filterItemIdRef","React","useRef","getUniqueId","isChecked","createElement","_extends","onClick","onFocus","role","current","classnames","styles","MrlBadge","text","String","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,KAAyB,EAAsB;AAC5E,EAAA,IAAqBC,MAAM,GAA8DD,KAAK,CAArF,SAAS,CAAA;IAAWE,EAAE,GAA0DF,KAAK,CAAjEE,EAAE;IAAEC,QAAQ,GAAgDH,KAAK,CAA7DG,QAAQ;IAAEC,SAAS,GAAqCJ,KAAK,CAAnDI,SAAS;IAAEC,KAAK,GAA8BL,KAAK,CAAxCK,KAAK;IAAEC,KAAK,GAAuBN,KAAK,CAAjCM,KAAK;IAAEC,OAAO,GAAcP,KAAK,CAA1BO,OAAO;AAAKC,IAAAA,IAAI,GAAAC,iDAAA,CAAKT,KAAK,EAAAU,SAAA,CAAA;AAE9F,EAAA,IAA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WAAW,iBAC5BiB,gBAAA,CAAAI,aAAA,CAACQ,iBAAQ,EAAA;AAACC,MAAAA,IAAI,EAAEC,MAAM,CAAC/B,KAAK,CAAE;MAAC,YAAA,EAAA,IAAA,CAAAgC,MAAA,CAAiBhC,KAAK,EAAA,QAAA;AAAS,KAAE,CAE5D;AAAC;AAET;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MrlCheckboxStandalone.js","sources":["../../../../../../src/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, getUniqueId, setAttributes } from '../../../../utils';\nimport { check, minus } from '@muraldevkit/ds-icons';\nimport { checkboxDefaults, CheckboxSelected, CheckboxStates } from '../../constants';\nimport { MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlCheckboxStandalone.module.scss';\nimport './MrlCheckboxStandalone.global.scss';\n\ninterface MrlCheckboxStandaloneProps {\n\t/** Applies additional HTML attributes to the checkbox element */\n\tattrs?: AttrsObject;\n\t/** The current state of the checkbox input based on user interactions or permissions */\n\tstate?: CheckboxStates;\n\t/** Sets what selection state the checkbox is in. */\n\tselected?: CheckboxSelected;\n\t/**\n\t * Enables interaction tracking for this checkbox. Provide a stable, non-PII id\n\t * (e.g. 'export-include-comments'). When omitted, the checkbox emits no analytics.\n\t */\n\teventId?: string;\n}\n\n/**\n * Input that allows the user to select one or more options from a provided list.\n * Note, this component does not provide out of the box accessibility for ensuring\n * an associated label and must be manually setup during adoption.\n * @param {MrlCheckboxStandaloneProps} props - the component props\n * @returns a checkbox element\n */\nexport function MrlCheckboxStandalone({\n\tattrs = {},\n\tstate = checkboxDefaults.state,\n\tselected = checkboxDefaults.selected,\n\teventId,\n\t...rest\n}: MrlCheckboxStandaloneProps): JSX.Element {\n\tconst trackInteraction = useMrlTrackInteraction('MrlCheckboxStandalone', eventId);\n\t// Use attrs.id if the developer passes in a custom id\n\t// but we need to ensure one exists for accessibility\n\tconst checkboxIdRef = React.useRef<string>(attrs.id || getUniqueId('mrl-checkbox'));\n\tconst inputRef = React.useRef<HTMLInputElement>(null);\n\n\tif (!(attrs.id || attrs['aria-labelledby'])) {\n\t\tconsole.warn(\n\t\t\t'Warning: Mural Standalone Checkboxes must have either an id or' +\n\t\t\t\t' aria-labelledby attribute for proper accessibility.'\n\t\t);\n\t}\n\n\t// We need to use the ref to set indetermiant attr\n\t// due to not being an intrinsic HTML attr\n\tReact.useEffect(() => {\n\t\tconst indeterminate = selected === 'indeterminate';\n\n\t\tif (inputRef.current) {\n\t\t\tinputRef.current.indeterminate = indeterminate;\n\t\t}\n\t}, [selected]);\n\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs);\n\n\t// the consumer's handler arrives through `attrs`, so wrap it here rather than\n\t// relying on a top-level onChange prop.\n\tconst consumerOnChange = attributes.onChange as\n\t\t| ((e: React.ChangeEvent<HTMLInputElement>) => void)\n\t\t| undefined;\n\n\t/**\n\t * Handle change events\n\t *\n\t * @param {React.ChangeEvent<HTMLInputElement>} e - change event\n\t */\n\tconst handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\ttrackInteraction({ action: 'change', metadata: { selected: e.target.checked } });\n\n\t\tconsumerOnChange?.(e);\n\t};\n\n\treturn (\n\t\t<div className={classnames(styles['MrlCheckboxStandalone'], 'MrlCheckboxStandalone')}>\n\t\t\t<span className=\"mrl-u-focus-wrapper\">\n\t\t\t\t<input\n\t\t\t\t\t{...rest}\n\t\t\t\t\t{...attributes}\n\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\tchecked={selected === 'checked'}\n\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\tid={checkboxIdRef.current}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\tstyles['MrlCheckboxStandalone-input'],\n\t\t\t\t\t\t'MrlCheckboxStandalone-input'\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<span className=\"mrl-u-focus-indicator\"></span>\n\t\t\t\t<span\n\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\tstyles['MrlCheckboxStandalone-inputDisplay'],\n\t\t\t\t\t\t'MrlCheckboxStandalone-inputDisplay'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\tsvg={selected !== 'indeterminate' ? check : minus}\n\t\t\t\t\t\tsize=\"auto\"\n\t\t\t\t\t\tclassName={styles['MrlCheckboxStandalone-inputDisplay-icon']}\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</div>\n\t);\n}\n"],"names":["MrlCheckboxStandalone","_ref","_ref$attrs","attrs","_ref$state","state","checkboxDefaults","_ref$selected","selected","eventId","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","checkboxIdRef","React","useRef","id","getUniqueId","inputRef","console","warn","useEffect","indeterminate","current","class","className","attributes","setAttributes","consumerOnChange","onChange","handleChange","e","action","metadata","target","checked","createElement","classnames","styles","_extends","disabled","ref","type","MrlSvg","svg","check","minus","size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqBA,CAAAC,IAAA,EAMO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAL3CE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IAAAE,UAAA,GAAAH,IAAA,CACVI,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAGE,0BAAgB,CAACD,KAAK,GAAAD,UAAA;IAAAG,aAAA,GAAAN,IAAA,CAC9BO,QAAQ;AA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AM;AAClDC,IAAAA,IAAI,EAAC,MAAM;IACXtB,SAAS,EAAEa,oCAAM,CAAC,yCAAyC;GAC3D,CACI,CACD,CACF,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlCheckboxStandalone.js","sources":["../../../../../../src/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, getUniqueId, setAttributes } from '../../../../utils';\nimport { check, minus } from '@muraldevkit/ds-icons';\nimport { checkboxDefaults, CheckboxSelected, CheckboxStates } from '../../constants';\nimport { MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlCheckboxStandalone.module.scss';\nimport './MrlCheckboxStandalone.global.scss';\n\ninterface MrlCheckboxStandaloneProps {\n\t/**\n\t * Applies additional HTML attributes to the checkbox element. The component renders no label,\n\t * so label it here: an `id` referenced by a `<label htmlFor>`, or `aria-labelledby` pointing\n\t * to visible text (a console warning is logged when both are missing). Pass the `onChange`\n\t * handler here as well.\n\t */\n\tattrs?: AttrsObject;\n\t/** The current state of the checkbox input based on user interactions or permissions */\n\tstate?: CheckboxStates;\n\t/**\n\t * Sets what selection state the checkbox is in. The component is controlled: update it from\n\t * the `onChange` handler passed in `attrs`.\n\t */\n\tselected?: CheckboxSelected;\n\t/**\n\t * Enables interaction tracking for this checkbox. Provide a stable, non-PII id\n\t * (e.g. 'export-include-comments'). When omitted, the checkbox emits no analytics.\n\t */\n\teventId?: string;\n}\n\n/**\n * Input that allows the user to select one or more options from a provided list.\n * Note, this component does not provide out of the box accessibility for ensuring\n * an associated label and must be manually setup during adoption.\n * @param {MrlCheckboxStandaloneProps} props - the component props\n * @returns a checkbox element\n */\nexport function MrlCheckboxStandalone({\n\tattrs = {},\n\tstate = checkboxDefaults.state,\n\tselected = checkboxDefaults.selected,\n\teventId,\n\t...rest\n}: MrlCheckboxStandaloneProps): JSX.Element {\n\tconst trackInteraction = useMrlTrackInteraction('MrlCheckboxStandalone', eventId);\n\t// Use attrs.id if the developer passes in a custom id\n\t// but we need to ensure one exists for accessibility\n\tconst checkboxIdRef = React.useRef<string>(attrs.id || getUniqueId('mrl-checkbox'));\n\tconst inputRef = React.useRef<HTMLInputElement>(null);\n\n\tif (!(attrs.id || attrs['aria-labelledby'])) {\n\t\tconsole.warn(\n\t\t\t'Warning: Mural Standalone Checkboxes must have either an id or' +\n\t\t\t\t' aria-labelledby attribute for proper accessibility.'\n\t\t);\n\t}\n\n\t// We need to use the ref to set indetermiant attr\n\t// due to not being an intrinsic HTML attr\n\tReact.useEffect(() => {\n\t\tconst indeterminate = selected === 'indeterminate';\n\n\t\tif (inputRef.current) {\n\t\t\tinputRef.current.indeterminate = indeterminate;\n\t\t}\n\t}, [selected]);\n\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs);\n\n\t// the consumer's handler arrives through `attrs`, so wrap it here rather than\n\t// relying on a top-level onChange prop.\n\tconst consumerOnChange = attributes.onChange as\n\t\t| ((e: React.ChangeEvent<HTMLInputElement>) => void)\n\t\t| undefined;\n\n\t/**\n\t * Handle change events\n\t *\n\t * @param {React.ChangeEvent<HTMLInputElement>} e - change event\n\t */\n\tconst handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\ttrackInteraction({ action: 'change', metadata: { selected: e.target.checked } });\n\n\t\tconsumerOnChange?.(e);\n\t};\n\n\treturn (\n\t\t<div className={classnames(styles['MrlCheckboxStandalone'], 'MrlCheckboxStandalone')}>\n\t\t\t<span className=\"mrl-u-focus-wrapper\">\n\t\t\t\t<input\n\t\t\t\t\t{...rest}\n\t\t\t\t\t{...attributes}\n\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\tchecked={selected === 'checked'}\n\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\tid={checkboxIdRef.current}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\tstyles['MrlCheckboxStandalone-input'],\n\t\t\t\t\t\t'MrlCheckboxStandalone-input'\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<span className=\"mrl-u-focus-indicator\"></span>\n\t\t\t\t<span\n\t\t\t\t\tclassName={classnames(\n\t\t\t\t\t\tstyles['MrlCheckboxStandalone-inputDisplay'],\n\t\t\t\t\t\t'MrlCheckboxStandalone-inputDisplay'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\tsvg={selected !== 'indeterminate' ? check : minus}\n\t\t\t\t\t\tsize=\"auto\"\n\t\t\t\t\t\tclassName={styles['MrlCheckboxStandalone-inputDisplay-icon']}\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</div>\n\t);\n}\n"],"names":["MrlCheckboxStandalone","_ref","_ref$attrs","attrs","_ref$state","state","checkboxDefaults","_ref$selected","selected","eventId","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","checkboxIdRef","React","useRef","id","getUniqueId","inputRef","console","warn","useEffect","indeterminate","current","class","className","attributes","setAttributes","consumerOnChange","onChange","handleChange","e","action","metadata","target","checked","createElement","classnames","styles","_extends","disabled","ref","type","MrlSvg","svg","check","minus","size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqBA,CAAAC,IAAA,EAMO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAL3CE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IAAAE,UAAA,GAAAH,IAAA,CACVI,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAGE,0BAAgB,CAACD,K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AAA,GAAG,EAAEtC,QAAQ,KAAK,eAAe,GAAGuC,aAAK,GAAGC,aAAM;AAClDC,IAAAA,IAAI,EAAC,MAAM;IACXtB,SAAS,EAAEa,oCAAM,CAAC,yCAAyC;GAC3D,CACI,CACD,CACF,CAAC;AAER;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MrlLabel.js","sources":["../../../../../../src/components/form/label/MrlLabel/MrlLabel.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, setAttributes } from '../../../../utils';\nimport { labelDefaults, LabelKind, LabelStates, StaticIconConfig } from '../../constants';\n\nimport { MrlSvg } from '../../../svg';\n\nimport styles from './MrlLabel.module.scss';\n\ninterface MrlLabelProps extends React.HTMLAttributes<HTMLLabelElement> {\n\t/** Applies additional HTML attributes to the label element */\n\tattrs?: AttrsObject;\n\t/** Informs the user of the form element's purpose */\n\ttext: string;\n\t/** ID of the form elements so all users can understand the relationship between the two elements */\n\thtmlFor?: string;\n\t/** Label style based on the type of associated form element */\n\tkind?: LabelKind;\n\t/**\n\t * Configures a leading icon within the label. This is only supported with an inline label\n\t */\n\ticon?: StaticIconConfig;\n\t/**\n\t * Changes the state of the label based on state of the associated input. Note, do not\n\t * use this prop only for styling, it must match the state of the input for accessibility compliance.\n\t */\n\tstate?: LabelStates;\n\t/** Additional class to add to the label */\n\tclassName?: string;\n}\n\n/**\n * Provides a label for a form element\n *\n * @param {MrlLabelProps} props - the component props\n * @returns a label element\n */\nexport function MrlLabel({\n\tattrs = {},\n\tclassName,\n\ttext,\n\thtmlFor,\n\tkind = labelDefaults.kind,\n\ticon,\n\tstate = labelDefaults.state,\n\t...rest\n}: MrlLabelProps): JSX.Element {\n\tconst allClasses = classnames(\n\t\t'mrl-label',\n\t\t'MrlLabel',\n\t\tstyles['MrlLabel'],\n\t\tattrs.class || attrs.className,\n\t\tclassName,\n\t\t{\n\t\t\t[styles['mrl-is--disabled']]: state === 'disabled',\n\t\t\t[styles['MrlLabel--inline']]: kind !== labelDefaults.kind\n\t\t}\n\t);\n\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs);\n\n\treturn (\n\t\t<label {...rest} {...attributes} htmlFor={htmlFor}\n\t\t\tclassName={allClasses}>\n\t\t\t{icon && (\n\t\t\t\t<MrlSvg\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tsvg={icon.icon}\n\t\t\t\t\tclassName={classnames(styles['MrlLabel-icon'], 'MrlLabel-icon')}\n\t\t\t\t\tsize=\"auto\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<span className=\"MrlLabel-text\">{text}</span>\n\t\t</label>\n\t);\n}\n"],"names":["MrlLabel","_ref","_ref$attrs","attrs","className","text","htmlFor","_ref$kind","kind","labelDefaults","icon","_ref$state","state","rest","_objectWithoutProperties","_excluded","allClasses","classnames","styles","class","attributes","setAttributes","React","createElement","_extends","MrlSvg","svg","size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,QAAQA,CAAAC,IAAA,EASO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAR9BE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IACVE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IAAAC,SAAA,GAAAN,IAAA,CACPO,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGE,uBAAa,CAACD,IAAI,GAAAD,SAAA;IACzBG,IAAI,GAAAT,IAAA,CAAJS,IAAI;IAAAC,UAAA,GAAAV,IAAA,CACJW,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAGF,uBAAa,CAACG,KAAK,GAAAD,UAAA;AACxBE,IAAAA,IAAI,GAAAC,iDAAA,CAAAb,IAAA,EAAAc,SAAA,CAAA;EAEP,IAAMC,UAAU,GAAGC,2BAAU,CAC5B,WAAW,EACX,UAAU,EACVC,uBAAM,CAAC,UAAU,CAAC,EAClBf,KAAK,CAACgB,KAAK,IAAIhB,KAAK,CAACC,SAAS,EAC9BA,SAAS,EACT;AACC,IAAA,CAACc,uBAAM,CAAC,kBAAkB,CAAC,GAAGN,KAAK,KAAK,UAAU;IAClD,CAACM,uBAAM,CAAC,kBAAkB,CAAC,GAAGV,IAAI,KAAKC,uBAAa,CAACD;AACtD,GACD,CAAC;EAED,OAAOL,KAAK,CAACgB,KAAK;EAClB,OAAOhB,KAAK,CAACC,SAAS;AAEtB,EAAA,IAAMgB,UAAU,GAAGC,2BAAa,CAAClB,KAAK,CAAC;EAEvC,oBACCmB,gBAAA,CAAAC,aAAA,CAAA,OAAA,EAAAC,iCAAA,CAAA,EAAA,EAAWX,IAAI,EAAMO,UAAU,EAAA;AAAEd,IAAAA,OAAO,EAAEA,OAAQ;AACjDF,IAAAA,SAAS,EAAEY;AAAW,GAAA,CAAA,EACrBN,IAAI,iBACJY,gBAAA,CAAAC,aAAA,CAACE,aAAM,EAAA;AACN,IAAA,aAAA,EAAY,MAAM;IAClBC,GAAG,EAAEhB,IAAI,CAACA,IAAK;IACfN,SAAS,EAAEa,2BAAU,CAACC,uBAAM,CAAC,eAAe,CAAC,EAAE,eAAe,CAAE;AAChES,IAAAA,IAAI,EAAC;AAAM,GACX,CACD,eACDL,gBAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMnB,IAAAA,SAAS,EAAC;GAAe,EAAEC,IAAW,CACtC,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"MrlLabel.js","sources":["../../../../../../src/components/form/label/MrlLabel/MrlLabel.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, setAttributes } from '../../../../utils';\nimport { labelDefaults, LabelKind, LabelStates, StaticIconConfig } from '../../constants';\n\nimport { MrlSvg } from '../../../svg';\n\nimport styles from './MrlLabel.module.scss';\n\ninterface MrlLabelProps extends React.HTMLAttributes<HTMLLabelElement> {\n\t/**\n\t * Applies additional HTML attributes to the label element\n\t *\n\t * @deprecated - use the regular HTML attributes instead.\n\t */\n\tattrs?: AttrsObject;\n\t/** Informs the user of the form element's purpose */\n\ttext: string;\n\t/** ID of the form elements so all users can understand the relationship between the two elements */\n\thtmlFor?: string;\n\t/** Label style based on the type of associated form element */\n\tkind?: LabelKind;\n\t/**\n\t * Configures a leading icon within the label. This is only supported with an inline label\n\t */\n\ticon?: StaticIconConfig;\n\t/**\n\t * Changes the state of the label based on state of the associated input. Note, do not\n\t * use this prop only for styling, it must match the state of the input for accessibility compliance.\n\t */\n\tstate?: LabelStates;\n\t/** Additional class to add to the label */\n\tclassName?: string;\n}\n\n/**\n * Provides a label for a form element\n *\n * @param {MrlLabelProps} props - the component props\n * @returns a label element\n */\nexport function MrlLabel({\n\tattrs = {},\n\tclassName,\n\ttext,\n\thtmlFor,\n\tkind = labelDefaults.kind,\n\ticon,\n\tstate = labelDefaults.state,\n\t...rest\n}: MrlLabelProps): JSX.Element {\n\tconst allClasses = classnames(\n\t\t'mrl-label',\n\t\t'MrlLabel',\n\t\tstyles['MrlLabel'],\n\t\tattrs.class || attrs.className,\n\t\tclassName,\n\t\t{\n\t\t\t[styles['mrl-is--disabled']]: state === 'disabled',\n\t\t\t[styles['MrlLabel--inline']]: kind !== labelDefaults.kind\n\t\t}\n\t);\n\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs);\n\n\treturn (\n\t\t<label {...rest} {...attributes} htmlFor={htmlFor} className={allClasses}>\n\t\t\t{icon && (\n\t\t\t\t<MrlSvg\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tsvg={icon.icon}\n\t\t\t\t\tclassName={classnames(styles['MrlLabel-icon'], 'MrlLabel-icon')}\n\t\t\t\t\tsize=\"auto\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<span className=\"MrlLabel-text\">{text}</span>\n\t\t</label>\n\t);\n}\n"],"names":["MrlLabel","_ref","_ref$attrs","attrs","className","text","htmlFor","_ref$kind","kind","labelDefaults","icon","_ref$state","state","rest","_objectWithoutProperties","_excluded","allClasses","classnames","styles","class","attributes","setAttributes","React","createElement","_extends","MrlSvg","svg","size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,QAAQA,CAAAC,IAAA,EASO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAR9BE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IACVE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IAAAC,SAAA,GAAAN,IAAA,CACPO,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGE,uBAAa,CAACD,IAAI,GAAAD,SAAA;IACzBG,IAAI,GAAAT,IAAA,CAAJS,IAAI;IAAAC,UAAA,GAAAV,IAAA,CACJW,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAGF,uBAAa,CAACG,KAAK,GAAAD,UAAA;AACxBE,IAAAA,IAAI,GAAAC,iDAAA,CAAAb,IAAA,EAAAc,SAAA,CAAA;EAEP,IAAMC,UAAU,GAAGC,2BAAU,CAC5B,WAAW,EACX,UAAU,EACVC,uBAAM,CAAC,UAAU,CAAC,EAClBf,KAAK,CAACgB,KAAK,IAAIhB,KAAK,CAACC,SAAS,EAC9BA,SAAS,EACT;AACC,IAAA,CAACc,uBAAM,CAAC,kBAAkB,CAAC,GAAGN,KAAK,KAAK,UAAU;IAClD,CAACM,uBAAM,CAAC,kBAAkB,CAAC,GAAGV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