@muraldevkit/ui-toolkit 4.84.0 → 4.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/components/avatar/MrlAvatar/MrlAvatar.js.map +1 -1
  2. package/dist/cjs/components/callout/MrlCallout/MrlCallout.js.map +1 -1
  3. package/dist/cjs/components/form/checkbox/MrlCheckbox/MrlCheckbox.js +13 -8
  4. package/dist/cjs/components/form/checkbox/MrlCheckbox/MrlCheckbox.js.map +1 -1
  5. package/dist/cjs/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js +16 -11
  6. package/dist/cjs/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js.map +1 -1
  7. package/dist/cjs/components/form/constants.js +6 -0
  8. package/dist/cjs/components/form/constants.js.map +1 -1
  9. package/dist/cjs/components/form/textarea/MrlTextarea/MrlTextarea.js.map +1 -1
  10. package/dist/cjs/components/grid/constants.js.map +1 -1
  11. package/dist/cjs/components/live-region/MrlLiveRegion/MrlLiveRegion.js.map +1 -1
  12. package/dist/cjs/components/popover/MrlPopover/MrlPopover.js.map +1 -1
  13. package/dist/cjs/components/portal/MrlPortal.js.map +1 -1
  14. package/dist/cjs/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.js.map +1 -1
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/cjs/version.js.map +1 -1
  17. package/dist/esm/components/avatar/MrlAvatar/MrlAvatar.js.map +1 -1
  18. package/dist/esm/components/callout/MrlCallout/MrlCallout.js.map +1 -1
  19. package/dist/esm/components/form/checkbox/MrlCheckbox/MrlCheckbox.js +13 -8
  20. package/dist/esm/components/form/checkbox/MrlCheckbox/MrlCheckbox.js.map +1 -1
  21. package/dist/esm/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js +16 -11
  22. package/dist/esm/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js.map +1 -1
  23. package/dist/esm/components/form/constants.js +6 -0
  24. package/dist/esm/components/form/constants.js.map +1 -1
  25. package/dist/esm/components/form/textarea/MrlTextarea/MrlTextarea.js.map +1 -1
  26. package/dist/esm/components/grid/constants.js.map +1 -1
  27. package/dist/esm/components/live-region/MrlLiveRegion/MrlLiveRegion.js.map +1 -1
  28. package/dist/esm/components/popover/MrlPopover/MrlPopover.js.map +1 -1
  29. package/dist/esm/components/portal/MrlPortal.js.map +1 -1
  30. package/dist/esm/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.js.map +1 -1
  31. package/dist/esm/version.js +1 -1
  32. package/dist/esm/version.js.map +1 -1
  33. package/dist/types/components/avatar/MrlAvatar/MrlAvatar.d.ts +2 -2
  34. package/dist/types/components/callout/MrlCallout/MrlCallout.d.ts +1 -2
  35. package/dist/types/components/form/checkbox/MrlCheckbox/MrlCheckbox.d.ts +11 -6
  36. package/dist/types/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.d.ts +11 -9
  37. package/dist/types/components/form/constants.d.ts +6 -0
  38. package/dist/types/components/form/textarea/MrlTextarea/MrlTextarea.d.ts +1 -1
  39. package/dist/types/components/grid/constants.d.ts +2 -3
  40. package/dist/types/components/grid/index.d.ts +1 -1
  41. package/dist/types/components/live-region/MrlLiveRegion/MrlLiveRegion.d.ts +1 -2
  42. package/dist/types/components/live-region/MrlLiveRegion/index.d.ts +1 -1
  43. package/dist/types/components/popover/MrlPopover/MrlPopover.d.ts +1 -2
  44. package/dist/types/components/portal/MrlPortal.d.ts +1 -2
  45. package/dist/types/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.d.ts +1 -1
  46. package/package.json +1 -1
@@ -10,7 +10,7 @@ import { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics/useMrl
10
10
  import { getUniqueId, setAttributes } from '../../../../utils/setAttributes/setAttributes.js';
11
11
  import { MrlLabelWithDescription } from '../../label/MrlLabelWithDescription/MrlLabelWithDescription.js';
12
12
 
13
- var _excluded = ["attrs", "className", "description", "hasMultilineLabel", "state", "selected", "icon", "label", "eventId"];
13
+ var _excluded = ["attrs", "className", "description", "hasMultilineLabel", "state", "selected", "icon", "label", "eventId", "onChange"];
14
14
  /**
15
15
  * Form element with an associated text label that allows the user to select one or more options
16
16
  * from a provided list
@@ -31,6 +31,8 @@ function MrlCheckbox(_ref) {
31
31
  icon = _ref.icon,
32
32
  label = _ref.label,
33
33
  eventId = _ref.eventId,
34
+ _ref$onChange = _ref.onChange,
35
+ onChange = _ref$onChange === void 0 ? attrs.onChange : _ref$onChange,
34
36
  rest = _objectWithoutProperties(_ref, _excluded);
35
37
  var trackInteraction = useMrlTrackInteraction('MrlCheckbox', eventId);
36
38
  var checkboxIdRef = React.useRef(getUniqueId('mrl-checkbox'));
@@ -51,24 +53,27 @@ function MrlCheckbox(_ref) {
51
53
  // setAttributes always sets className="" which always triggers the warning message in the MrlCheckboxStandalone component
52
54
  delete attributes.className;
53
55
 
54
- // the consumer's handler arrives through `attrs`, so wrap it before handing the
55
- // attributes down to the standalone input.
56
- var consumerOnChange = attributes.onChange;
57
- attributes.onChange = e => {
56
+ /**
57
+ * Handle change events
58
+ *
59
+ * @param {React.ChangeEvent<HTMLInputElement>} e - change event
60
+ */
61
+ var handleChange = e => {
58
62
  trackInteraction({
59
63
  action: 'checked',
60
64
  metadata: {
61
65
  selected: e.target.checked
62
66
  }
63
67
  });
64
- consumerOnChange === null || consumerOnChange === void 0 ? void 0 : consumerOnChange(e);
68
+ onChange === null || onChange === void 0 ? void 0 : onChange(e);
65
69
  };
66
70
  return /*#__PURE__*/React.createElement("div", {
67
71
  className: allClasses
68
72
  }, /*#__PURE__*/React.createElement(MrlCheckboxStandalone, _extends({}, rest, {
73
+ attrs: attributes,
74
+ onChange: handleChange,
69
75
  selected: selected,
70
- state: state,
71
- attrs: attributes
76
+ state: state
72
77
  })), /*#__PURE__*/React.createElement(MrlLabelWithDescription, {
73
78
  isDisabled: state === 'disabled',
74
79
  isSelected: selected === 'checked',
@@ -1 +1 @@
1
- {"version":3,"file":"MrlCheckbox.js","sources":["../../../../../../src/components/form/checkbox/MrlCheckbox/MrlCheckbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, getUniqueId, setAttributes } from '../../../../utils';\nimport {\n\tcheckboxDefaults,\n\tCheckboxSelected,\n\tCheckboxStates,\n\tStaticIconConfig\n} from '../../constants';\nimport { MrlCheckboxStandalone } from '../MrlCheckboxStandalone/MrlCheckboxStandalone';\nimport { checkInvalidAttributes } from '../../../../utils/checkInvalidAttributes';\n\nimport './MrlCheckbox.global.scss';\nimport styles from './MrlCheckbox.module.scss';\nimport { MrlLabelWithDescription } from '../../label/MrlLabelWithDescription';\nimport { getDescribedby } from '../../utils';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\ninterface MrlCheckboxProps {\n\t/** Applies additional HTML attributes to the checkbox element */\n\tattrs?: AttrsObject;\n\t/** Additional class to add to the container of the checkbox and label */\n\tclassName?: string;\n\t/** Adjusts the styles of the label, icon and description when the label is multiline */\n\thasMultilineLabel?: boolean;\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/** The text to display as the checkbox's label */\n\tlabel: string;\n\t/** Leading label icon */\n\ticon?: StaticIconConfig;\n\t/**\n\t * Description, additional context text for the user.\n\t * It can be a string or a React component for custom render.\n\t * When using a React component it's necessary to add an id to the custom element and\n\t * pass it to the MrlCheckbox through 'attrs[\"aria-describedby\"]' to make it accessible\n\t * to screen readers.\n\t * Custom description should also implement the disabled state styles\n\t * for text when the input is disabled or set color: inherit.\n\t * @example\n\t * <MrlCheckbox attrs={{ 'aria-describedby': customId }} description={\n\t * <p id={customId}>description</p>\n\t * }>\n\t */\n\tdescription?: string | React.ReactNode;\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 * Form element with an associated text label that allows the user to select one or more options\n * from a provided list\n * @param {MrlCheckboxProps} props - the component props\n * @returns a checkbox element with an associated label\n */\nexport function MrlCheckbox({\n\tattrs = {},\n\tclassName,\n\tdescription,\n\thasMultilineLabel = false,\n\tstate = checkboxDefaults.state,\n\tselected = checkboxDefaults.selected,\n\ticon,\n\tlabel,\n\teventId,\n\t...rest\n}: MrlCheckboxProps): JSX.Element {\n\tconst trackInteraction = useMrlTrackInteraction('MrlCheckbox', eventId);\n\tconst checkboxIdRef = React.useRef<string>(getUniqueId('mrl-checkbox'));\n\tconst descriptionId = `${checkboxIdRef.current}-description`;\n\n\tconst allClasses = classnames(\n\t\tattrs.class || attrs.className,\n\t\tclassName,\n\t\t'MrlCheckbox',\n\t\tstyles['MrlCheckbox'],\n\t\t{\n\t\t\t[styles['mrl-is--disabled']]: state === 'disabled',\n\t\t\t[styles['mrl-is--invalid']]: state === 'error',\n\t\t\t[styles['mrl-is--selected']]: selected === 'checked',\n\t\t\t[styles['mrl-is--indeterminate']]: selected === 'indeterminate'\n\t\t}\n\t);\n\n\tcheckInvalidAttributes(attrs);\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs, {\n\t\t...getDescribedby(\n\t\t\tattrs['aria-describedby'],\n\t\t\ttypeof description === 'string' ? descriptionId : undefined\n\t\t),\n\t\tid: checkboxIdRef.current\n\t});\n\n\t// setAttributes always sets className=\"\" which always triggers the warning message in the MrlCheckboxStandalone component\n\tdelete attributes.className;\n\n\t// the consumer's handler arrives through `attrs`, so wrap it before handing the\n\t// attributes down to the standalone input.\n\tconst consumerOnChange = attributes.onChange as\n\t\t| ((e: React.ChangeEvent<HTMLInputElement>) => void)\n\t\t| undefined;\n\n\tattributes.onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\ttrackInteraction({ action: 'checked', metadata: { selected: e.target.checked } });\n\n\t\tconsumerOnChange?.(e);\n\t};\n\n\treturn (\n\t\t<div className={allClasses}>\n\t\t\t<MrlCheckboxStandalone {...rest} selected={selected} state={state} attrs={attributes} />\n\t\t\t<MrlLabelWithDescription\n\t\t\t\tisDisabled={state === 'disabled'}\n\t\t\t\tisSelected={selected === 'checked'}\n\t\t\t\tisIndeterminate={selected === 'indeterminate'}\n\t\t\t\thasMultilineLabel={hasMultilineLabel}\n\t\t\t\thtmlFor={checkboxIdRef.current}\n\t\t\t\ticon={icon}\n\t\t\t\tlabel={label}\n\t\t\t\tdescription={description}\n\t\t\t\tdescriptionId={descriptionId}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"names":["MrlCheckbox","_ref","_ref$attrs","attrs","className","description","_ref$hasMultilineLabe","hasMultilineLabel","_ref$state","state","checkboxDefaults","_ref$selected","selected","icon","label","eventId","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","checkboxIdRef","React","useRef","getUniqueId","descriptionId","concat","current","allClasses","classnames","class","styles","checkInvalidAttributes","attributes","setAttributes","_objectSpread","getDescribedby","undefined","id","consumerOnChange","onChange","e","action","metadata","target","checked","createElement","MrlCheckboxStandalone","_extends","MrlLabelWithDescription","isDisabled","isSelected","isIndeterminate","htmlFor"],"mappings":";;;;;;;;;;;;;AAsDA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAAC,IAAA,EAWO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAVjCE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IACVE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IAAAC,qBAAA,GAAAL,IAAA,CACXM,iBAAiB;AAAjBA,IAAAA,iBAAiB,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;IAAAE,UAAA,GAAAP,IAAA,CACzBQ,KAAK;A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M,OAAQ;AAC/Bd,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,KAAK,EAAEA,KAAM;AACbT,IAAAA,WAAW,EAAEA,WAAY;AACzBoB,IAAAA,aAAa,EAAEA;AAAc,GAC7B,CACG,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlCheckbox.js","sources":["../../../../../../src/components/form/checkbox/MrlCheckbox/MrlCheckbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, getUniqueId, setAttributes } from '../../../../utils';\nimport {\n\tcheckboxDefaults,\n\tCheckboxInputProps,\n\tCheckboxSelected,\n\tCheckboxStates,\n\tStaticIconConfig\n} from '../../constants';\nimport { MrlCheckboxStandalone } from '../MrlCheckboxStandalone/MrlCheckboxStandalone';\nimport { checkInvalidAttributes } from '../../../../utils/checkInvalidAttributes';\n\nimport './MrlCheckbox.global.scss';\nimport styles from './MrlCheckbox.module.scss';\nimport { MrlLabelWithDescription } from '../../label/MrlLabelWithDescription';\nimport { getDescribedby } from '../../utils';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\ninterface MrlCheckboxProps extends CheckboxInputProps {\n\t/**\n\t * Applies additional HTML attributes to the checkbox element\n\t *\n\t * @deprecated - use the regular HTML attributes instead. When an attribute is passed both\n\t * ways, the regular HTML attribute wins.\n\t */\n\tattrs?: AttrsObject;\n\t/** Additional class to add to the container of the checkbox and label */\n\tclassName?: string;\n\t/** Adjusts the styles of the label, icon and description when the label is multiline */\n\thasMultilineLabel?: boolean;\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/** The text to display as the checkbox's label */\n\tlabel: string;\n\t/** Leading label icon */\n\ticon?: StaticIconConfig;\n\t/**\n\t * Description, additional context text for the user.\n\t * It can be a string or a React component for custom render.\n\t * When using a React component it's necessary to add an id to the custom element and\n\t * pass it to the MrlCheckbox through \"aria-describedby\" to make it accessible\n\t * to screen readers.\n\t * Custom description should also implement the disabled state styles\n\t * for text when the input is disabled or set color: inherit.\n\t * @example\n\t * <MrlCheckbox aria-describedby={customId} description={\n\t * <p id={customId}>description</p>\n\t * }>\n\t */\n\tdescription?: string | React.ReactNode;\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 * Form element with an associated text label that allows the user to select one or more options\n * from a provided list\n * @param {MrlCheckboxProps} props - the component props\n * @returns a checkbox element with an associated label\n */\nexport function MrlCheckbox({\n\tattrs = {},\n\tclassName,\n\tdescription,\n\thasMultilineLabel = false,\n\tstate = checkboxDefaults.state,\n\tselected = checkboxDefaults.selected,\n\ticon,\n\tlabel,\n\teventId,\n\t// the regular HTML attribute wins over the deprecated `attrs` object\n\tonChange = attrs.onChange,\n\t...rest\n}: MrlCheckboxProps): JSX.Element {\n\tconst trackInteraction = useMrlTrackInteraction('MrlCheckbox', eventId);\n\tconst checkboxIdRef = React.useRef<string>(getUniqueId('mrl-checkbox'));\n\tconst descriptionId = `${checkboxIdRef.current}-description`;\n\n\tconst allClasses = classnames(\n\t\tattrs.class || attrs.className,\n\t\tclassName,\n\t\t'MrlCheckbox',\n\t\tstyles['MrlCheckbox'],\n\t\t{\n\t\t\t[styles['mrl-is--disabled']]: state === 'disabled',\n\t\t\t[styles['mrl-is--invalid']]: state === 'error',\n\t\t\t[styles['mrl-is--selected']]: selected === 'checked',\n\t\t\t[styles['mrl-is--indeterminate']]: selected === 'indeterminate'\n\t\t}\n\t);\n\n\tcheckInvalidAttributes(attrs);\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs, {\n\t\t...getDescribedby(\n\t\t\tattrs['aria-describedby'],\n\t\t\ttypeof description === 'string' ? descriptionId : undefined\n\t\t),\n\t\tid: checkboxIdRef.current\n\t});\n\n\t// setAttributes always sets className=\"\" which always triggers the warning message in the MrlCheckboxStandalone component\n\tdelete attributes.className;\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: 'checked', metadata: { selected: e.target.checked } });\n\n\t\tonChange?.(e);\n\t};\n\n\treturn (\n\t\t<div className={allClasses}>\n\t\t\t<MrlCheckboxStandalone\n\t\t\t\t{...rest}\n\t\t\t\tattrs={attributes}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tselected={selected}\n\t\t\t\tstate={state}\n\t\t\t/>\n\t\t\t<MrlLabelWithDescription\n\t\t\t\tisDisabled={state === 'disabled'}\n\t\t\t\tisSelected={selected === 'checked'}\n\t\t\t\tisIndeterminate={selected === 'indeterminate'}\n\t\t\t\thasMultilineLabel={hasMultilineLabel}\n\t\t\t\thtmlFor={checkboxIdRef.current}\n\t\t\t\ticon={icon}\n\t\t\t\tlabel={label}\n\t\t\t\tdescription={description}\n\t\t\t\tdescriptionId={descriptionId}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"names":["MrlCheckbox","_ref","_ref$attrs","attrs","className","description","_ref$hasMultilineLabe","hasMultilineLabel","_ref$state","state","checkboxDefaults","_ref$selected","selected","icon","label","eventId","_ref$onChange","onChange","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","checkboxIdRef","React","useRef","getUniqueId","descriptionId","concat","current","allClasses","classnames","class","styles","checkInvalidAttributes","attributes","setAttributes","_objectSpread","getDescribedby","undefined","id","handleChange","e","action","metadata","target","checked","createElement","MrlCheckboxStandalone","_extends","MrlLabelWithDescription","isDisabled","isSelected","isIndeterminate","htmlFor"],"mappings":";;;;;;;;;;;;;AA4DA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAAC,IAAA,EAaO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAZjCE,KAAK;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AI,EAAA;AACRf,IAAAA,KAAK,EAAEgC,UAAW;AAClBlB,IAAAA,QAAQ,EAAEwB,YAAa;AACvB7B,IAAAA,QAAQ,EAAEA,QAAS;AACnBH,IAAAA,KAAK,EAAEA;AAAM,GAAA,CACb,CAAC,eACFe,KAAA,CAAAuB,aAAA,CAACG,uBAAuB,EAAA;IACvBC,UAAU,EAAE1C,KAAK,KAAK,UAAW;IACjC2C,UAAU,EAAExC,QAAQ,KAAK,SAAU;IACnCyC,eAAe,EAAEzC,QAAQ,KAAK,eAAgB;AAC9CL,IAAAA,iBAAiB,EAAEA,iBAAkB;IACrC+C,OAAO,EAAE/B,aAAa,CAACM,OAAQ;AAC/BhB,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,KAAK,EAAEA,KAAM;AACbT,IAAAA,WAAW,EAAEA,WAAY;AACzBsB,IAAAA,aAAa,EAAEA;AAAc,GAC7B,CACG,CAAC;AAER;;;;"}
@@ -8,11 +8,13 @@ import styles from './MrlCheckboxStandalone.module.scss.js';
8
8
  import { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics/useMrlAnalytics.js';
9
9
  import { getUniqueId, setAttributes } from '../../../../utils/setAttributes/setAttributes.js';
10
10
 
11
- var _excluded = ["attrs", "state", "selected", "eventId"];
11
+ var _excluded = ["attrs", "state", "selected", "eventId", "id", "onChange", "aria-labelledby"];
12
12
  /**
13
13
  * Input that allows the user to select one or more options from a provided list.
14
14
  * Note, this component does not provide out of the box accessibility for ensuring
15
- * an associated label and must be manually setup during adoption.
15
+ * an associated label and must be manually setup during adoption: pass an `id` referenced
16
+ * by a `<label htmlFor>`, or `aria-labelledby` pointing to visible text (a console warning
17
+ * is logged when both are missing).
16
18
  * @param {MrlCheckboxStandaloneProps} props - the component props
17
19
  * @returns a checkbox element
18
20
  */
@@ -24,13 +26,19 @@ function MrlCheckboxStandalone(_ref) {
24
26
  _ref$selected = _ref.selected,
25
27
  selected = _ref$selected === void 0 ? checkboxDefaults.selected : _ref$selected,
26
28
  eventId = _ref.eventId,
29
+ _ref$id = _ref.id,
30
+ id = _ref$id === void 0 ? attrs.id : _ref$id,
31
+ _ref$onChange = _ref.onChange,
32
+ onChange = _ref$onChange === void 0 ? attrs.onChange : _ref$onChange,
33
+ _ref$ariaLabelledby = _ref['aria-labelledby'],
34
+ ariaLabelledby = _ref$ariaLabelledby === void 0 ? attrs['aria-labelledby'] : _ref$ariaLabelledby,
27
35
  rest = _objectWithoutProperties(_ref, _excluded);
28
36
  var trackInteraction = useMrlTrackInteraction('MrlCheckboxStandalone', eventId);
29
- // Use attrs.id if the developer passes in a custom id
37
+ // Use the id if the developer passes in a custom one
30
38
  // but we need to ensure one exists for accessibility
31
- var checkboxIdRef = React.useRef(attrs.id || getUniqueId('mrl-checkbox'));
39
+ var checkboxIdRef = React.useRef(id || getUniqueId('mrl-checkbox'));
32
40
  var inputRef = React.useRef(null);
33
- if (!(attrs.id || attrs['aria-labelledby'])) {
41
+ if (!(id || ariaLabelledby)) {
34
42
  console.warn('Warning: Mural Standalone Checkboxes must have either an id or' + ' aria-labelledby attribute for proper accessibility.');
35
43
  }
36
44
 
@@ -46,10 +54,6 @@ function MrlCheckboxStandalone(_ref) {
46
54
  delete attrs.className;
47
55
  var attributes = setAttributes(attrs);
48
56
 
49
- // the consumer's handler arrives through `attrs`, so wrap it here rather than
50
- // relying on a top-level onChange prop.
51
- var consumerOnChange = attributes.onChange;
52
-
53
57
  /**
54
58
  * Handle change events
55
59
  *
@@ -62,14 +66,15 @@ function MrlCheckboxStandalone(_ref) {
62
66
  selected: e.target.checked
63
67
  }
64
68
  });
65
- consumerOnChange === null || consumerOnChange === void 0 ? void 0 : consumerOnChange(e);
69
+ onChange === null || onChange === void 0 ? void 0 : onChange(e);
66
70
  };
67
71
  return /*#__PURE__*/React.createElement("div", {
68
72
  className: classnames(styles['MrlCheckboxStandalone'], 'MrlCheckboxStandalone')
69
73
  }, /*#__PURE__*/React.createElement("span", {
70
74
  className: "mrl-u-focus-wrapper"
71
- }, /*#__PURE__*/React.createElement("input", _extends({}, rest, attributes, {
75
+ }, /*#__PURE__*/React.createElement("input", _extends({}, attributes, rest, {
72
76
  "aria-invalid": state === 'error',
77
+ "aria-labelledby": ariaLabelledby,
73
78
  checked: selected === 'checked',
74
79
  disabled: state === 'disabled',
75
80
  id: checkboxIdRef.current,
@@ -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/**\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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AA,eAEFxB,KAAA,CAAAsB,aAAA,CAACO,MAAM,EAAA;AACNC,IAAAA,GAAG,EAAEtC,QAAQ,KAAK,eAAe,GAAGuC,KAAK,GAAGC,KAAM;AAClDC,IAAAA,IAAI,EAAC,MAAM;IACXtB,SAAS,EAAEa,MAAM,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 {\n\tcheckboxDefaults,\n\tCheckboxInputProps,\n\tCheckboxSelected,\n\tCheckboxStates\n} 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 extends CheckboxInputProps {\n\t/**\n\t * Applies additional HTML attributes to the checkbox element\n\t *\n\t * @deprecated - use the regular HTML attributes instead. When an attribute is passed both\n\t * ways, the regular HTML attribute wins.\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.\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: pass an `id` referenced\n * by a `<label htmlFor>`, or `aria-labelledby` pointing to visible text (a console warning\n * is logged when both are missing).\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// the regular HTML attributes win over the deprecated `attrs` object\n\tid = attrs.id,\n\tonChange = attrs.onChange,\n\t'aria-labelledby': ariaLabelledby = attrs['aria-labelledby'],\n\t...rest\n}: MrlCheckboxStandaloneProps): JSX.Element {\n\tconst trackInteraction = useMrlTrackInteraction('MrlCheckboxStandalone', eventId);\n\t// Use the id if the developer passes in a custom one\n\t// but we need to ensure one exists for accessibility\n\tconst checkboxIdRef = React.useRef<string>(id || getUniqueId('mrl-checkbox'));\n\tconst inputRef = React.useRef<HTMLInputElement>(null);\n\n\tif (!(id || ariaLabelledby)) {\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/**\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\tonChange?.(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{...attributes}\n\t\t\t\t\t{...rest}\n\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\taria-labelledby={ariaLabelledby}\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","_ref$id","id","_ref$onChange","onChange","_ref$ariaLabelledby","ariaLabelledby","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","checkboxIdRef","React","useRef","getUniqueId","inputRef","console","warn","useEffect","indeterminate","current","class","className","attributes","setAttributes","handleChange","e","action","metadata","target","checked","createElement","classnames","styles","_extends","disabled","ref","type","MrlSvg","svg","check","minus","size"],"mappings":";;;;;;;;;;;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqBA,CAAAC,IAAA,EAUO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAT3CE,KAAK;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AAAA,QAAQ,EAAEsB,YAAa;AACvBW,IAAAA,GAAG,EAAErB,QAAS;AACdsB,IAAAA,IAAI,EAAC,UAAU;IACff,SAAS,EAAEU,UAAU,CACpBC,MAAM,CAAC,6BAA6B,CAAC,EACrC,6BACD;AAAE,GAAA,CACF,CAAC,eACFrB,KAAA,CAAAmB,aAAA,CAAA,MAAA,EAAA;AAAMT,IAAAA,SAAS,EAAC;AAAuB,GAAO,CAAC,eAC/CV,KAAA,CAAAmB,aAAA,CAAA,MAAA,EAAA;IACCT,SAAS,EAAEU,UAAU,CACpBC,MAAM,CAAC,oCAAoC,CAAC,EAC5C,oCACD;AAAE,GAAA,eAEFrB,KAAA,CAAAmB,aAAA,CAACO,MAAM,EAAA;AACNC,IAAAA,GAAG,EAAEzC,QAAQ,KAAK,eAAe,GAAG0C,KAAK,GAAGC,KAAM;AAClDC,IAAAA,IAAI,EAAC,MAAM;IACXpB,SAAS,EAAEW,MAAM,CAAC,yCAAyC;GAC3D,CACI,CACD,CACF,CAAC;AAER;;;;"}
@@ -19,6 +19,12 @@ var allowedCheckboxValues = {
19
19
  selected: ['default', 'checked', 'indeterminate'],
20
20
  states: ['default', 'disabled', 'error', 'read-only']
21
21
  };
22
+
23
+ /**
24
+ * Native attributes accepted by the checkbox `input`. The omitted ones are driven by the
25
+ * component's own props (`selected`, `state`) or do not apply to the element.
26
+ */
27
+
22
28
  var checkboxDefaults = {
23
29
  selected: 'default',
24
30
  state: 'default'
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/components/form/constants.ts"],"sourcesContent":["import * as React from 'react';\nimport { DSIconType } from '../svg';\n\n/*\n * Shared error object for inputs\n * ------------------------------------------------------------------\n */\n/**\n * This should be used to communciate error information for a specific input\n */\nexport interface MrlFormInputError {\n\tmessage: string;\n}\n\n/*\n * Shared input values\n * ------------------------------------------------------------------\n */\nexport type InputStates = 'disabled' | 'error' | 'read-only';\nexport type InputKinds = 'default' | 'inline' | 'inline-label';\nexport type InputSizes = 'default' | 'large';\n\n/*\n * Checkbox component\n * ------------------------------------------------------------------\n */\nexport const allowedCheckboxValues = {\n\tselected: ['default', 'checked', 'indeterminate'] as const,\n\tstates: [\n\t\t'default',\n\t\t'disabled',\n\t\t'error',\n\t\t'read-only'\n\t] as const\n};\n\nexport type CheckboxStates = (typeof allowedCheckboxValues.states)[number];\nexport type CheckboxSelected = (typeof allowedCheckboxValues.selected)[number];\n\ninterface CheckboxDefaults {\n\tselected: CheckboxSelected;\n\tstate: CheckboxStates;\n}\n\nexport const checkboxDefaults: CheckboxDefaults = {\n\tselected: 'default',\n\tstate: 'default'\n};\n\n/*\n * Select component\n * ------------------------------------------------------------------\n */\n\nexport const allowedSelectItemValues = {\n\tstates: ['default', 'disabled', 'selected'] as const\n};\n\nexport type SelectItemStates = (typeof allowedSelectItemValues.states)[number];\n\ninterface SelectItemDefaults {\n\tstate: SelectItemStates;\n}\n\nexport const selectItemDefaults: SelectItemDefaults = {\n\tstate: 'default'\n};\n\nexport const allowedSelectMenuValues = {\n\tpositions: ['bottom', 'top'] as const\n};\n\nexport type SelectMenuPositions = (typeof allowedSelectMenuValues.positions)[number];\n\ninterface SelectMenuDefaults {\n\tposition: SelectMenuPositions;\n}\n\nexport const selectMenuDefaults: SelectMenuDefaults = {\n\tposition: 'bottom'\n};\n\n// Selects are an extension of the shared \"allowedValues\" object but\n// TypeScript won't let me combine the two objects.\nexport const allowedSelectValues = {\n\tstates: [\n\t\t'default',\n\t\t'disabled',\n\t\t'open',\n\t\t'read-only'\n\t] as const\n};\n\nexport type SelectStates = (typeof allowedSelectValues.states)[number];\n\ninterface SelectDefaults {\n\tsize: InputSizes;\n\tkind: InputKinds;\n\tstate: SelectStates;\n}\n\nexport const selectDefaults: SelectDefaults = {\n\tkind: 'default',\n\tsize: 'default',\n\tstate: 'default'\n};\n\n/*\n * Text Input component\n * ------------------------------------------------------------------\n */\nexport interface StaticIconConfig {\n\ticon: DSIconType;\n\ttheme?: string;\n}\n\nexport interface RightActionConfig extends StaticIconConfig {\n\taction: (event: React.MouseEvent | React.KeyboardEvent) => void;\n\tlabel: string;\n}\n\n/*\n * Label component\n * ------------------------------------------------------------------\n */\nexport const allowedLabelValues = {\n\tkinds: ['block', 'inline'] as const,\n\tstates: ['default', 'disabled'] as const\n};\n\nexport type LabelStates = (typeof allowedLabelValues.states)[number];\nexport type LabelKind = (typeof allowedLabelValues.kinds)[number];\n\ninterface LabelDefaults {\n\tkind: LabelKind;\n\tstate: LabelStates;\n}\n\nexport const labelDefaults: LabelDefaults = {\n\tkind: 'block',\n\tstate: 'default'\n};\n\nexport interface FormControlDefaults {\n\tdisabled: boolean;\n\tlabel: string;\n}\n\nexport interface FieldsetDefault {\n\tlabel: string;\n}\n\n/**\n * Default values for props on the Fieldset component;\n * Shared between the component and Storybook\n */\nexport const fieldsetDefault: FieldsetDefault = {\n\tlabel: \"fieldset's legend label\"\n};\n\n/**\n * Default values for props on the Fieldset component which is used to group Textarea components;\n * Shared between the component and Storybook\n */\nexport const textareaDefaults: FormControlDefaults = {\n\tdisabled: false,\n\tlabel: 'Legend'\n};\n"],"names":["allowedCheckboxValues","selected","states","checkboxDefaults","state","allowedSelectItemValues","selectItemDefaults","allowedSelectMenuValues","positions","selectMenuDefaults","position","allowedSelectValues","selectDefaults","kind","size","allowedLabelValues","kinds","labelDefaults","fieldsetDefault","label","textareaDefaults","disabled"],"mappings":"AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACO,IAAMA,qBAAqB,GAAG;AACpCC,EAAAA,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAU;EAC1DC,MAAM,EAAE,CACP,SAAS,EACT,UAAU,EACV,OAAO,EACP,WAAW;AAEb;AAUO,IAAMC,gBAAkC,GAAG;AACjDF,EAAAA,QAAQ,EAAE,SAAS;AACnBG,EAAAA,KAAK,EAAE;AACR;;AAEA;AACA;AACA;AACA;;AAEO,IAAMC,uBAAuB,GAAG;AACtCH,EAAAA,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU;AAC3C;AAQO,IAAMI,kBAAsC,GAAG;AACrDF,EAAAA,KAAK,EAAE;AACR;AAEO,IAAMG,uBAAuB,GAAG;AACtCC,EAAAA,SAAS,EAAE,CAAC,QAAQ,EAAE,KAAK;AAC5B;AAQO,IAAMC,kBAAsC,GAAG;AACrDC,EAAAA,QAAQ,EAAE;AACX;;AAEA;AACA;AACO,IAAMC,mBAAmB,GAAG;EAClCT,MAAM,EAAE,CACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,WAAW;AAEb;AAUO,IAAMU,cAA8B,GAAG;AAC7CC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,IAAI,EAAE,SAAS;AACfV,EAAAA,KAAK,EAAE;AACR;;AAEA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACO,IAAMW,kBAAkB,GAAG;AACjCC,EAAAA,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAU;AACnCd,EAAAA,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU;AAC/B;AAUO,IAAMe,aAA4B,GAAG;AAC3CJ,EAAAA,IAAI,EAAE,OAAO;AACbT,EAAAA,KAAK,EAAE;AACR;AAWA;AACA;AACA;AACA;AACO,IAAMc,eAAgC,GAAG;AAC/CC,EAAAA,KAAK,EAAE;AACR;;AAEA;AACA;AACA;AACA;AACO,IAAMC,gBAAqC,GAAG;AACpDC,EAAAA,QAAQ,EAAE,KAAK;AACfF,EAAAA,KAAK,EAAE;AACR;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/form/constants.ts"],"sourcesContent":["import * as React from 'react';\nimport { DSIconType } from '../svg';\nimport { DataQa } from '../../utils/dataQa';\n\n/*\n * Shared error object for inputs\n * ------------------------------------------------------------------\n */\n/**\n * This should be used to communciate error information for a specific input\n */\nexport interface MrlFormInputError {\n\tmessage: string;\n}\n\n/*\n * Shared input values\n * ------------------------------------------------------------------\n */\nexport type InputStates = 'disabled' | 'error' | 'read-only';\nexport type InputKinds = 'default' | 'inline' | 'inline-label';\nexport type InputSizes = 'default' | 'large';\n\n/*\n * Checkbox component\n * ------------------------------------------------------------------\n */\nexport const allowedCheckboxValues = {\n\tselected: ['default', 'checked', 'indeterminate'] as const,\n\tstates: ['default', 'disabled', 'error', 'read-only'] as const\n};\n\nexport type CheckboxStates = (typeof allowedCheckboxValues.states)[number];\nexport type CheckboxSelected = (typeof allowedCheckboxValues.selected)[number];\n\n/**\n * Native attributes accepted by the checkbox `input`. The omitted ones are driven by the\n * component's own props (`selected`, `state`) or do not apply to the element.\n */\nexport type CheckboxInputProps = Omit<\n\tReact.ComponentPropsWithoutRef<'input'>,\n\t'type' | 'checked' | 'defaultChecked' | 'disabled' | 'children' | 'className' | 'style'\n> &\n\tDataQa;\n\ninterface CheckboxDefaults {\n\tselected: CheckboxSelected;\n\tstate: CheckboxStates;\n}\n\nexport const checkboxDefaults: CheckboxDefaults = {\n\tselected: 'default',\n\tstate: 'default'\n};\n\n/*\n * Select component\n * ------------------------------------------------------------------\n */\n\nexport const allowedSelectItemValues = {\n\tstates: ['default', 'disabled', 'selected'] as const\n};\n\nexport type SelectItemStates = (typeof allowedSelectItemValues.states)[number];\n\ninterface SelectItemDefaults {\n\tstate: SelectItemStates;\n}\n\nexport const selectItemDefaults: SelectItemDefaults = {\n\tstate: 'default'\n};\n\nexport const allowedSelectMenuValues = {\n\tpositions: ['bottom', 'top'] as const\n};\n\nexport type SelectMenuPositions = (typeof allowedSelectMenuValues.positions)[number];\n\ninterface SelectMenuDefaults {\n\tposition: SelectMenuPositions;\n}\n\nexport const selectMenuDefaults: SelectMenuDefaults = {\n\tposition: 'bottom'\n};\n\n// Selects are an extension of the shared \"allowedValues\" object but\n// TypeScript won't let me combine the two objects.\nexport const allowedSelectValues = {\n\tstates: ['default', 'disabled', 'open', 'read-only'] as const\n};\n\nexport type SelectStates = (typeof allowedSelectValues.states)[number];\n\ninterface SelectDefaults {\n\tsize: InputSizes;\n\tkind: InputKinds;\n\tstate: SelectStates;\n}\n\nexport const selectDefaults: SelectDefaults = {\n\tkind: 'default',\n\tsize: 'default',\n\tstate: 'default'\n};\n\n/*\n * Text Input component\n * ------------------------------------------------------------------\n */\nexport interface StaticIconConfig {\n\ticon: DSIconType;\n\ttheme?: string;\n}\n\nexport interface RightActionConfig extends StaticIconConfig {\n\taction: (event: React.MouseEvent | React.KeyboardEvent) => void;\n\tlabel: string;\n}\n\n/*\n * Label component\n * ------------------------------------------------------------------\n */\nexport const allowedLabelValues = {\n\tkinds: ['block', 'inline'] as const,\n\tstates: ['default', 'disabled'] as const\n};\n\nexport type LabelStates = (typeof allowedLabelValues.states)[number];\nexport type LabelKind = (typeof allowedLabelValues.kinds)[number];\n\ninterface LabelDefaults {\n\tkind: LabelKind;\n\tstate: LabelStates;\n}\n\nexport const labelDefaults: LabelDefaults = {\n\tkind: 'block',\n\tstate: 'default'\n};\n\nexport interface FormControlDefaults {\n\tdisabled: boolean;\n\tlabel: string;\n}\n\nexport interface FieldsetDefault {\n\tlabel: string;\n}\n\n/**\n * Default values for props on the Fieldset component;\n * Shared between the component and Storybook\n */\nexport const fieldsetDefault: FieldsetDefault = {\n\tlabel: \"fieldset's legend label\"\n};\n\n/**\n * Default values for props on the Fieldset component which is used to group Textarea components;\n * Shared between the component and Storybook\n */\nexport const textareaDefaults: FormControlDefaults = {\n\tdisabled: false,\n\tlabel: 'Legend'\n};\n"],"names":["allowedCheckboxValues","selected","states","checkboxDefaults","state","allowedSelectItemValues","selectItemDefaults","allowedSelectMenuValues","positions","selectMenuDefaults","position","allowedSelectValues","selectDefaults","kind","size","allowedLabelValues","kinds","labelDefaults","fieldsetDefault","label","textareaDefaults","disabled"],"mappings":"AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACO,IAAMA,qBAAqB,GAAG;AACpCC,E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Q,EAAE,KAAK;AACfF,EAAAA,KAAK,EAAE;AACR;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MrlTextarea.js","sources":["../../../../../../src/components/form/textarea/MrlTextarea/MrlTextarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, setAttributes } from '../../../../utils';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlTextarea.module.scss';\nimport './MrlTextarea.global.scss';\n\ntype MrlTextareaState = 'default' | 'disabled' | 'error' | 'read-only';\n\ninterface MrlTextareaProps {\n\t/** Applies additional HTML attributes to the textarea element */\n\tattrs?: AttrsObject;\n\t/** The value of the textarea used to make it a controlled input */\n\tvalue?: string;\n\t/**\n\t * The maximum number of characters that the user can enter.\n\t * If undefined or set to \"0\", removes the character counter from the textarea\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Id of the text input.\n\t */\n\tinputId: string;\n\t/**\n\t * Text placeholder for the text input.\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Changes the state of the input based on user permissions or actions.\n\t */\n\tstate?: MrlTextareaState;\n\n\t/** Additional class to add to the textarea */\n\tclassName?: string;\n\n\t/** Autoexpand will automatically adjust the height of the textarea based on the amount of text within it */\n\tautoExpand?: boolean;\n\n\t/**\n\t * Enables interaction tracking for this textarea. Provide a stable, non-PII id\n\t * (e.g. 'template-description'). When omitted, the textarea emits no analytics.\n\t *\n\t * Note: the textarea's value is never emitted, and `change` is emitted once per\n\t * editing session (on blur, when the value actually changed) rather than per keystroke.\n\t */\n\teventId?: string;\n}\n\n/**\n * Allows the user to input plain text in a multi-line format\n * @param {MrlTextareaProps} props - the component props\n * @returns a textarea element\n */\nexport function MrlTextarea({\n\tattrs = {},\n\tclassName,\n\tinputId,\n\tstate = 'default',\n\tmaxLength,\n\tplaceholder,\n\teventId,\n\tvalue,\n\tautoExpand = false,\n\t...rest\n}: MrlTextareaProps): JSX.Element {\n\tconst textareaRef = React.useRef<HTMLTextAreaElement>(null);\n\t// the value when the field gained focus, so `change` can be emitted once per\n\t// editing session instead of once per keystroke.\n\tconst valueOnFocusRef = React.useRef<string>('');\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlTextarea', eventId);\n\n\tReact.useEffect(() => {\n\t\tif (textareaRef.current && attrs.autofocus) {\n\t\t\ttextareaRef.current.focus();\n\t\t}\n\t}, [attrs, textareaRef]);\n\n\tconst dataMaxLength = attrs['data-maxlength'];\n\n\t// Special use-case for AI Chat Input (AI-658)\n\tReact.useEffect(() => {\n\t\tif (autoExpand && textareaRef.current) {\n\t\t\ttextareaRef.current.style.height = '0px';\n\t\t\tconst scrollHeight = textareaRef.current.scrollHeight + 4;\n\t\t\ttextareaRef.current.style.height = scrollHeight + 'px';\n\t\t}\n\t}, [value, autoExpand]);\n\n\tconst hasMaxLength = typeof maxLength !== 'undefined' && Number(maxLength) > 0;\n\tconst hasDataMaxLength = typeof dataMaxLength !== 'undefined' && Number(dataMaxLength) > 0;\n\n\tconst displayCounter = hasMaxLength || hasDataMaxLength;\n\n\tif (hasMaxLength && isNaN(Number(maxLength))) {\n\t\tthrow new Error('maxLength should have type number');\n\t}\n\n\tif (hasDataMaxLength && isNaN(Number(hasDataMaxLength))) {\n\t\tthrow new Error('data-maxlength should have type number');\n\t}\n\n\tif (hasMaxLength && hasDataMaxLength) {\n\t\tthrow new Error('maxLength and data-maxlength should not be used at the same time');\n\t}\n\n\tconst inputClasses = classnames(\n\t\tattrs.class || attrs.className,\n\t\tclassName,\n\t\tstyles['MrlTextarea'],\n\t\t'MrlTextarea',\n\t\t'mrl-textarea',\n\t\t{\n\t\t\t[styles['MrlTextarea--auto-expand']]: autoExpand,\n\t\t\t[styles['MrlTextarea--read-only']]: state === 'read-only'\n\t\t}\n\t);\n\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs);\n\n\t/**\n\t * Handle focus events\n\t *\n\t * @param {React.FocusEvent<HTMLTextAreaElement>} e - focus event\n\t */\n\tconst handleOnFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\tvalueOnFocusRef.current = e.target.value;\n\n\t\tif (typeof attributes.onFocus === 'function') {\n\t\t\tattributes.onFocus(e);\n\t\t}\n\t};\n\n\t/**\n\t * Handle blur events\n\t *\n\t * @param {React.FocusEvent<HTMLTextAreaElement>} e - blur event\n\t */\n\tconst handleOnBlur = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\t// the value itself is never emitted — only the fact that it changed.\n\t\tif (e.target.value !== valueOnFocusRef.current) {\n\t\t\ttrackInteraction({ action: 'change' });\n\t\t}\n\n\t\tif (typeof attributes.onBlur === 'function') {\n\t\t\tattributes.onBlur(e);\n\t\t}\n\t};\n\n\tconst renderCounter = () => {\n\t\tconst displayedValue = dataMaxLength ? dataMaxLength : maxLength;\n\t\tconst valueExceedsDataMaxLength = dataMaxLength && value ? value.length > dataMaxLength : false;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName={classnames('MrlCounter', {\n\t\t\t\t\t\t'MrlCounter-overMaxLength': valueExceedsDataMaxLength\n\t\t\t\t\t})}\n\t\t\t\t\tid={`${inputId}-visible-counter`}\n\t\t\t\t>\n\t\t\t\t\t{value?.length || 0}/{displayedValue}\n\t\t\t\t</span>\n\t\t\t\t<p style={{ display: 'none' }} id={`${inputId}-counter`}>\n\t\t\t\t\t{`${displayedValue - (value?.length || 0)} of ${displayedValue} characters remaining`}\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"MrlTextarea--wrapper\">\n\t\t\t\t<textarea\n\t\t\t\t\t{...rest}\n\t\t\t\t\t{...attributes}\n\t\t\t\t\tid={inputId}\n\t\t\t\t\tonBlur={handleOnBlur}\n\t\t\t\t\tonFocus={handleOnFocus}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tclassName={inputClasses}\n\t\t\t\t\t// Force value if defined (controlled component) or pass\n\t\t\t\t\t// undefined and fallback to the default (uncontrolled)\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\taria-describedby={`${inputId}-counter`}\n\t\t\t\t\tmaxLength={hasMaxLength ? maxLength : undefined}\n\t\t\t\t\tref={textareaRef}\n\t\t\t\t\treadOnly={state === 'read-only'}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{displayCounter && state !== 'read-only' && (\n\t\t\t\t<span className={classnames(styles['MrlForm-counter'], 'MrlForm-counter')}>\n\t\t\t\t\t{renderCounter()}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</>\n\t);\n}\n"],"names":["MrlTextarea","_ref","_ref$attrs","attrs","className","inputId","_ref$state","state","maxLength","placeholder","eventId","value","_ref$autoExpand","autoExpand","rest","_objectWithoutProperties","_excluded","textareaRef","React","useRef","valueOnFocusRef","trackInteraction","useMrlTrackInteraction","useEffect","current","autofocus","focus","dataMaxLength","style","height","scrollHeight","hasMaxLength","Number","hasDataMaxLength","displayCounter","isNaN","Error","inputClasses","classnames","class","styles","attributes","setAttributes","handleOnFocus","e","target","onFocus","handleOnBlur","action","onBlur","renderCounter","displayedValue","valueExceedsDataMaxLength","length","createElement","Fragment","id","concat","display","_extends","disabled","undefined","ref","readOnly"],"mappings":";;;;;;;;AAiDA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAAC,IAAA,EAWO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAVjCE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IACVE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IAAAC,UAAA,GAAAL,IAAA,CACPM,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,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AAA,CAAA,MAAA,EAAA;IAAMlD,SAAS,EAAEkC,UAAU,CAACE,MAAM,CAAC,iBAAiB,CAAC,EAAE,iBAAiB;AAAE,GAAA,EACxEU,aAAa,EACT,CAEN,CAAC;AAEL;;;;"}
1
+ {"version":3,"file":"MrlTextarea.js","sources":["../../../../../../src/components/form/textarea/MrlTextarea/MrlTextarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, setAttributes } from '../../../../utils';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlTextarea.module.scss';\nimport './MrlTextarea.global.scss';\n\nexport type MrlTextareaState = 'default' | 'disabled' | 'error' | 'read-only';\n\ninterface MrlTextareaProps {\n\t/** Applies additional HTML attributes to the textarea element */\n\tattrs?: AttrsObject;\n\t/** The value of the textarea used to make it a controlled input */\n\tvalue?: string;\n\t/**\n\t * The maximum number of characters that the user can enter.\n\t * If undefined or set to \"0\", removes the character counter from the textarea\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Id of the text input.\n\t */\n\tinputId: string;\n\t/**\n\t * Text placeholder for the text input.\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Changes the state of the input based on user permissions or actions.\n\t */\n\tstate?: MrlTextareaState;\n\n\t/** Additional class to add to the textarea */\n\tclassName?: string;\n\n\t/** Autoexpand will automatically adjust the height of the textarea based on the amount of text within it */\n\tautoExpand?: boolean;\n\n\t/**\n\t * Enables interaction tracking for this textarea. Provide a stable, non-PII id\n\t * (e.g. 'template-description'). When omitted, the textarea emits no analytics.\n\t *\n\t * Note: the textarea's value is never emitted, and `change` is emitted once per\n\t * editing session (on blur, when the value actually changed) rather than per keystroke.\n\t */\n\teventId?: string;\n}\n\n/**\n * Allows the user to input plain text in a multi-line format\n * @param {MrlTextareaProps} props - the component props\n * @returns a textarea element\n */\nexport function MrlTextarea({\n\tattrs = {},\n\tclassName,\n\tinputId,\n\tstate = 'default',\n\tmaxLength,\n\tplaceholder,\n\teventId,\n\tvalue,\n\tautoExpand = false,\n\t...rest\n}: MrlTextareaProps): JSX.Element {\n\tconst textareaRef = React.useRef<HTMLTextAreaElement>(null);\n\t// the value when the field gained focus, so `change` can be emitted once per\n\t// editing session instead of once per keystroke.\n\tconst valueOnFocusRef = React.useRef<string>('');\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlTextarea', eventId);\n\n\tReact.useEffect(() => {\n\t\tif (textareaRef.current && attrs.autofocus) {\n\t\t\ttextareaRef.current.focus();\n\t\t}\n\t}, [attrs, textareaRef]);\n\n\tconst dataMaxLength = attrs['data-maxlength'];\n\n\t// Special use-case for AI Chat Input (AI-658)\n\tReact.useEffect(() => {\n\t\tif (autoExpand && textareaRef.current) {\n\t\t\ttextareaRef.current.style.height = '0px';\n\t\t\tconst scrollHeight = textareaRef.current.scrollHeight + 4;\n\t\t\ttextareaRef.current.style.height = scrollHeight + 'px';\n\t\t}\n\t}, [value, autoExpand]);\n\n\tconst hasMaxLength = typeof maxLength !== 'undefined' && Number(maxLength) > 0;\n\tconst hasDataMaxLength = typeof dataMaxLength !== 'undefined' && Number(dataMaxLength) > 0;\n\n\tconst displayCounter = hasMaxLength || hasDataMaxLength;\n\n\tif (hasMaxLength && isNaN(Number(maxLength))) {\n\t\tthrow new Error('maxLength should have type number');\n\t}\n\n\tif (hasDataMaxLength && isNaN(Number(hasDataMaxLength))) {\n\t\tthrow new Error('data-maxlength should have type number');\n\t}\n\n\tif (hasMaxLength && hasDataMaxLength) {\n\t\tthrow new Error('maxLength and data-maxlength should not be used at the same time');\n\t}\n\n\tconst inputClasses = classnames(\n\t\tattrs.class || attrs.className,\n\t\tclassName,\n\t\tstyles['MrlTextarea'],\n\t\t'MrlTextarea',\n\t\t'mrl-textarea',\n\t\t{\n\t\t\t[styles['MrlTextarea--auto-expand']]: autoExpand,\n\t\t\t[styles['MrlTextarea--read-only']]: state === 'read-only'\n\t\t}\n\t);\n\n\tdelete attrs.class;\n\tdelete attrs.className;\n\n\tconst attributes = setAttributes(attrs);\n\n\t/**\n\t * Handle focus events\n\t *\n\t * @param {React.FocusEvent<HTMLTextAreaElement>} e - focus event\n\t */\n\tconst handleOnFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\tvalueOnFocusRef.current = e.target.value;\n\n\t\tif (typeof attributes.onFocus === 'function') {\n\t\t\tattributes.onFocus(e);\n\t\t}\n\t};\n\n\t/**\n\t * Handle blur events\n\t *\n\t * @param {React.FocusEvent<HTMLTextAreaElement>} e - blur event\n\t */\n\tconst handleOnBlur = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\t// the value itself is never emitted — only the fact that it changed.\n\t\tif (e.target.value !== valueOnFocusRef.current) {\n\t\t\ttrackInteraction({ action: 'change' });\n\t\t}\n\n\t\tif (typeof attributes.onBlur === 'function') {\n\t\t\tattributes.onBlur(e);\n\t\t}\n\t};\n\n\tconst renderCounter = () => {\n\t\tconst displayedValue = dataMaxLength ? dataMaxLength : maxLength;\n\t\tconst valueExceedsDataMaxLength = dataMaxLength && value ? value.length > dataMaxLength : false;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName={classnames('MrlCounter', {\n\t\t\t\t\t\t'MrlCounter-overMaxLength': valueExceedsDataMaxLength\n\t\t\t\t\t})}\n\t\t\t\t\tid={`${inputId}-visible-counter`}\n\t\t\t\t>\n\t\t\t\t\t{value?.length || 0}/{displayedValue}\n\t\t\t\t</span>\n\t\t\t\t<p style={{ display: 'none' }} id={`${inputId}-counter`}>\n\t\t\t\t\t{`${displayedValue - (value?.length || 0)} of ${displayedValue} characters remaining`}\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"MrlTextarea--wrapper\">\n\t\t\t\t<textarea\n\t\t\t\t\t{...rest}\n\t\t\t\t\t{...attributes}\n\t\t\t\t\tid={inputId}\n\t\t\t\t\tonBlur={handleOnBlur}\n\t\t\t\t\tonFocus={handleOnFocus}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tclassName={inputClasses}\n\t\t\t\t\t// Force value if defined (controlled component) or pass\n\t\t\t\t\t// undefined and fallback to the default (uncontrolled)\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\taria-describedby={`${inputId}-counter`}\n\t\t\t\t\tmaxLength={hasMaxLength ? maxLength : undefined}\n\t\t\t\t\tref={textareaRef}\n\t\t\t\t\treadOnly={state === 'read-only'}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{displayCounter && state !== 'read-only' && (\n\t\t\t\t<span className={classnames(styles['MrlForm-counter'], 'MrlForm-counter')}>\n\t\t\t\t\t{renderCounter()}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</>\n\t);\n}\n"],"names":["MrlTextarea","_ref","_ref$attrs","attrs","className","inputId","_ref$state","state","maxLength","placeholder","eventId","value","_ref$autoExpand","autoExpand","rest","_objectWithoutProperties","_excluded","textareaRef","React","useRef","valueOnFocusRef","trackInteraction","useMrlTrackInteraction","useEffect","current","autofocus","focus","dataMaxLength","style","height","scrollHeight","hasMaxLength","Number","hasDataMaxLength","displayCounter","isNaN","Error","inputClasses","classnames","class","styles","attributes","setAttributes","handleOnFocus","e","target","onFocus","handleOnBlur","action","onBlur","renderCounter","displayedValue","valueExceedsDataMaxLength","length","createElement","Fragment","id","concat","display","_extends","disabled","undefined","ref","readOnly"],"mappings":";;;;;;;;AAiDA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAAC,IAAA,EAWO;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAVjCE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IACVE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,OAAO,GAAAJ,IAAA,CAAPI,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K;GAAY,CAChC,CACG,CAAC,EACL2B,cAAc,IAAI3B,KAAK,KAAK,WAAW,iBACvCW,KAAA,CAAAoC,aAAA,CAAA,MAAA,EAAA;IAAMlD,SAAS,EAAEkC,UAAU,CAACE,MAAM,CAAC,iBAAiB,CAAC,EAAE,iBAAiB;AAAE,GAAA,EACxEU,aAAa,EACT,CAEN,CAAC;AAEL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["import { DataQa } from '../../utils/dataQa';\n\n/**\n * Alignment & justification options for grid containers\n */\nexport type AlignOptions = 'start' | 'center' | 'end';\nexport type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';\n\n/**\n * Number of columns a `col` can span. There is no `col-0` class — a column\n * always occupies at least one of the twelve tracks.\n */\nexport type ColSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * Number of columns an `offset` can skip. `0` is meaningful here: it is how a\n * larger breakpoint cancels an offset inherited from a smaller one.\n */\nexport type OffsetSpan = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n\n/**\n * @deprecated Use `ColSpan` for spans or `OffsetSpan` for offsets. This union\n * allowed `col={0}`, which never produced a class.\n */\nexport type NumCols = 0 | ColSpan;\n\n/**\n * Interface of available class selectors per breakpoint.\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\ntype GridClassConfig = {\n\tcol?: ColSpan;\n\toffset?: OffsetSpan;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\ntype ColumnConfig = ColSpan | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/**\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/**\n\t * @deprecated Alias of `col`, kept for backwards compatibility. It resolves\n\t * to the same un-prefixed tier, so passing both `col` and `xs` emits two\n\t * competing classes and the larger span wins on CSS source order rather\n\t * than the one you wrote last. Pass only one.\n\t */\n\txs?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the sm breakpoint up.\n\t */\n\tsm?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the md breakpoint up.\n\t */\n\tmd?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the lg breakpoint up.\n\t */\n\tlg?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xl breakpoint up.\n\t */\n\txl?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xxl breakpoint up.\n\t */\n\txxl?: ColumnConfig;\n}\n\n/**\n * Breakpoint keys in ascending order. Drives both class generation and the\n * filtering that keeps grid props from reaching the DOM.\n */\nexport const GRID_SIZE_KEYS = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'] as const;\n\n/**\n * Available gutter sizes for customizing the grid\n */\nexport type GutterSizes = 0 | 1 | 2;\n\n/**\n * Gutter size to modifier class. `1` is the default declared on `.row`, so it\n * needs no class.\n */\nexport const GUTTER_CLASS: Record<GutterSizes, string | undefined> = {\n\t0: 'MrlRow-gutter--none',\n\t1: undefined,\n\t2: 'MrlRow-gutter--double'\n};\n\n/**\n * Roles a generic layout wrapper may safely carry.\n *\n * Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)\n * are deliberately excluded: they promise an APG keyboard contract — roving\n * tabindex or `aria-activedescendant`, arrow-key navigation, selection state —\n * that these divs do not implement. The roles below are structural only and\n * carry no interaction contract, so they are safe to forward.\n *\n * `list`/`listitem` in particular is how a row of columns is announced as\n * \"list, N items\", and is the standard workaround for Safari/VoiceOver\n * dropping implicit list semantics. `region` needs an accessible name to be\n * exposed as a landmark; the type cannot enforce that.\n *\n * Page landmarks belong to the layout components (MrlMain, MrlPage).\n */\nexport type SafeLayoutRole = 'group' | 'list' | 'listitem' | 'none' | 'presentation' | 'region';\n\n/**\n * Shared props for the grid components: every `div` attribute, with `role`\n * narrowed to {@link SafeLayoutRole}.\n */\nexport type GridBaseProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'role'> &\n\tDataQa & {\n\t\t/**\n\t\t * Structural role for the wrapper. Composite widget roles are not\n\t\t * accepted — see {@link SafeLayoutRole}.\n\t\t */\n\t\trole?: SafeLayoutRole;\n\t};\n"],"names":["GRID_SIZE_KEYS","GUTTER_CLASS","undefined"],"mappings":"AAEA;AACA;AACA;;AAIA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AA2CA;AACA;AACA;AACA;IACaA,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;;AAEzE;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,IAAMC,YAAqD,GAAG;AACpE,EAAA,CAAC,EAAE,qBAAqB;AACxB,EAAA,CAAC,EAAEC,SAAS;AACZ,EAAA,CAAC,EAAE;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["import { DataQa } from '../../utils/dataQa';\n\n/**\n * Alignment & justification options for grid containers\n */\nexport type AlignOptions = 'start' | 'center' | 'end';\nexport type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';\n\n/**\n * Number of columns a `col` can span. There is no `col-0` class — a column\n * always occupies at least one of the twelve tracks.\n */\nexport type ColSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * Number of columns an `offset` can skip. `0` is meaningful here: it is how a\n * larger breakpoint cancels an offset inherited from a smaller one.\n */\nexport type OffsetSpan = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n\n/**\n * @deprecated Use `ColSpan` for spans or `OffsetSpan` for offsets. This union\n * allowed `col={0}`, which never produced a class.\n */\nexport type NumCols = 0 | ColSpan;\n\n/**\n * Interface of available class selectors per breakpoint.\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\nexport type GridClassConfig = {\n\tcol?: ColSpan;\n\toffset?: OffsetSpan;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\nexport type ColumnConfig = ColSpan | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/**\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/**\n\t * @deprecated Alias of `col`, kept for backwards compatibility. It resolves\n\t * to the same un-prefixed tier, so passing both `col` and `xs` emits two\n\t * competing classes and the larger span wins on CSS source order rather\n\t * than the one you wrote last. Pass only one.\n\t */\n\txs?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the sm breakpoint up.\n\t */\n\tsm?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the md breakpoint up.\n\t */\n\tmd?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the lg breakpoint up.\n\t */\n\tlg?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xl breakpoint up.\n\t */\n\txl?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xxl breakpoint up.\n\t */\n\txxl?: ColumnConfig;\n}\n\n/**\n * Breakpoint keys in ascending order. Drives both class generation and the\n * filtering that keeps grid props from reaching the DOM.\n */\nexport const GRID_SIZE_KEYS = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'] as const;\n\n/**\n * Available gutter sizes for customizing the grid\n */\nexport type GutterSizes = 0 | 1 | 2;\n\n/**\n * Gutter size to modifier class. `1` is the default declared on `.row`, so it\n * needs no class.\n */\nexport const GUTTER_CLASS: Record<GutterSizes, string | undefined> = {\n\t0: 'MrlRow-gutter--none',\n\t1: undefined,\n\t2: 'MrlRow-gutter--double'\n};\n\n/**\n * Roles a generic layout wrapper may safely carry.\n *\n * Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)\n * are deliberately excluded: they promise an APG keyboard contract — roving\n * tabindex or `aria-activedescendant`, arrow-key navigation, selection state —\n * that these divs do not implement. The roles below are structural only and\n * carry no interaction contract, so they are safe to forward.\n *\n * `list`/`listitem` in particular is how a row of columns is announced as\n * \"list, N items\", and is the standard workaround for Safari/VoiceOver\n * dropping implicit list semantics. `region` needs an accessible name to be\n * exposed as a landmark; the type cannot enforce that.\n *\n * Page landmarks belong to the layout components (MrlMain, MrlPage).\n */\nexport type SafeLayoutRole = 'group' | 'list' | 'listitem' | 'none' | 'presentation' | 'region';\n\n/**\n * Shared props for the grid components: every `div` attribute, with `role`\n * narrowed to {@link SafeLayoutRole}.\n */\nexport type GridBaseProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'role'> &\n\tDataQa & {\n\t\t/**\n\t\t * Structural role for the wrapper. Composite widget roles are not\n\t\t * accepted — see {@link SafeLayoutRole}.\n\t\t */\n\t\trole?: SafeLayoutRole;\n\t};\n"],"names":["GRID_SIZE_KEYS","GUTTER_CLASS","undefined"],"mappings":"AAEA;AACA;AACA;;AAIA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AA2CA;AACA;AACA;AACA;IACaA,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;;AAEzE;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,IAAMC,YAAqD,GAAG;AACpE,EAAA,CAAC,EAAE,qBAAqB;AACxB,EAAA,CAAC,EAAEC,SAAS;AACZ,EAAA,CAAC,EAAE;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MrlLiveRegion.js","sources":["../../../../../src/components/live-region/MrlLiveRegion/MrlLiveRegion.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport uniqueId from 'lodash.uniqueid';\nimport * as React from 'react';\nimport { useMemo, useState } from 'react';\n\ntype AriaRelevant = 'additions' | 'all' | 'removals' | 'text' | 'additions text' | undefined;\n\nexport interface MrlLiveRegionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n\t/** Sets `aria-atomic`: announce the whole region on every change instead of only the changed part. */\n\tariaAtomic?: boolean;\n\t/** Sets `aria-live`: how urgently screen readers announce changes. */\n\tariaLive: 'polite' | 'assertive' | 'off';\n\t/** Sets `aria-relevant`: which kinds of change are announced. */\n\tariaRelevant?: AriaRelevant;\n\tid?: string;\n\t/** Empties the region one second after `srContent` changes. */\n\tshouldClearContent?: boolean;\n\t/** Text announced by the live region. */\n\tsrContent: string;\n\t/** Shows the text on screen. By default the region is visually hidden. */\n\tvisible?: boolean;\n}\n\n/**\n * Live region component to render an HTML live region with the provided content.\n *\n * @param props - The live region component props.\n * @returns The live region component.\n */\nexport const MrlLiveRegion = ({\n\tariaAtomic,\n\tariaLive,\n\tariaRelevant,\n\tid,\n\tsrContent,\n\tvisible = false,\n\tshouldClearContent = false,\n\t...props\n}: MrlLiveRegionProps): React.ReactElement => {\n\tconst [content, setContent] = useState('');\n\n\tReact.useEffect(() => {\n\t\tsetContent(srContent);\n\n\t\tif (shouldClearContent) {\n\t\t\tconst contentTimeout = setTimeout(() => {\n\t\t\t\tsetContent('');\n\t\t\t\tclearTimeout(contentTimeout);\n\t\t\t}, 1000);\n\n\t\t\treturn () => clearTimeout(contentTimeout);\n\t\t}\n\t}, [shouldClearContent, srContent]);\n\n\tconst nodeId = useMemo(() => id || uniqueId('live-region-'), [id]);\n\n\tconst dataQaProp = (props as { 'data-qa'?: string })['data-qa'];\n\tconst dataQa = dataQaProp || `${nodeId}-live-region`;\n\n\tconst classes = classNames('MrlLiveRegion', {\n\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t'mrl-visually-hidden': !visible\n\t});\n\n\treturn (\n\t\t<p\n\t\t\t{...(ariaAtomic ? { 'aria-atomic': ariaAtomic } : {})}\n\t\t\taria-live={ariaLive}\n\t\t\t{...(ariaRelevant ? { 'aria-relevant': ariaRelevant } : {})}\n\t\t\tclassName={classes}\n\t\t\tdata-qa={dataQa}\n\t\t\tid={nodeId}\n\t\t\t{...props}\n\t\t>\n\t\t\t{content}\n\t\t</p>\n\t);\n};\n"],"names":["MrlLiveRegion","_ref","ariaAtomic","ariaLive","ariaRelevant","id","srContent","_ref$visible","visible","_ref$shouldClearConte","shouldClearContent","props","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","content","setContent","React","useEffect","contentTimeout","setTimeout","clearTimeout","nodeId","useMemo","uniqueId","dataQaProp","dataQa","concat","classes","classNames","createElement","_extends","className"],"mappings":";;;;;;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,aAAa,GAAGC,IAAA,IASiB;AAAA,EAAA,IAR7CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,SAAS,GAAAL,IAAA,CAATK,SAAS;IAAAC,YAAA,GAAAN,IAAA,CACTO,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,YAAA;IAAAE,qBAAA,GAAAR,IAAA,CACfS,kBAAkB;AAAlBA,IAAAA,kBAAkB,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;AACvBE,IAAAA,KAAK,GAAAC,wBAAA,CAAAX,IAAA,EAAAY,SAAA,CAAA;AAER,EAAA,IAAA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;AACnB,IAAA,SAAA,EAASF,MAAO;AAChBxB,IAAAA,EAAE,EAAEoB;GAAO,EACPd,KAAK,CAAA,EAERO,OACC,CAAC;AAEN;;;;"}
1
+ {"version":3,"file":"MrlLiveRegion.js","sources":["../../../../../src/components/live-region/MrlLiveRegion/MrlLiveRegion.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport uniqueId from 'lodash.uniqueid';\nimport * as React from 'react';\nimport { useMemo, useState } from 'react';\n\nexport type AriaRelevant = 'additions' | 'all' | 'removals' | 'text' | 'additions text' | undefined;\n\nexport interface MrlLiveRegionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n\t/** Sets `aria-atomic`: announce the whole region on every change instead of only the changed part. */\n\tariaAtomic?: boolean;\n\t/** Sets `aria-live`: how urgently screen readers announce changes. */\n\tariaLive: 'polite' | 'assertive' | 'off';\n\t/** Sets `aria-relevant`: which kinds of change are announced. */\n\tariaRelevant?: AriaRelevant;\n\tid?: string;\n\t/** Empties the region one second after `srContent` changes. */\n\tshouldClearContent?: boolean;\n\t/** Text announced by the live region. */\n\tsrContent: string;\n\t/** Shows the text on screen. By default the region is visually hidden. */\n\tvisible?: boolean;\n}\n\n/**\n * Live region component to render an HTML live region with the provided content.\n *\n * @param props - The live region component props.\n * @returns The live region component.\n */\nexport const MrlLiveRegion = ({\n\tariaAtomic,\n\tariaLive,\n\tariaRelevant,\n\tid,\n\tsrContent,\n\tvisible = false,\n\tshouldClearContent = false,\n\t...props\n}: MrlLiveRegionProps): React.ReactElement => {\n\tconst [content, setContent] = useState('');\n\n\tReact.useEffect(() => {\n\t\tsetContent(srContent);\n\n\t\tif (shouldClearContent) {\n\t\t\tconst contentTimeout = setTimeout(() => {\n\t\t\t\tsetContent('');\n\t\t\t\tclearTimeout(contentTimeout);\n\t\t\t}, 1000);\n\n\t\t\treturn () => clearTimeout(contentTimeout);\n\t\t}\n\t}, [shouldClearContent, srContent]);\n\n\tconst nodeId = useMemo(() => id || uniqueId('live-region-'), [id]);\n\n\tconst dataQaProp = (props as { 'data-qa'?: string })['data-qa'];\n\tconst dataQa = dataQaProp || `${nodeId}-live-region`;\n\n\tconst classes = classNames('MrlLiveRegion', {\n\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t'mrl-visually-hidden': !visible\n\t});\n\n\treturn (\n\t\t<p\n\t\t\t{...(ariaAtomic ? { 'aria-atomic': ariaAtomic } : {})}\n\t\t\taria-live={ariaLive}\n\t\t\t{...(ariaRelevant ? { 'aria-relevant': ariaRelevant } : {})}\n\t\t\tclassName={classes}\n\t\t\tdata-qa={dataQa}\n\t\t\tid={nodeId}\n\t\t\t{...props}\n\t\t>\n\t\t\t{content}\n\t\t</p>\n\t);\n};\n"],"names":["MrlLiveRegion","_ref","ariaAtomic","ariaLive","ariaRelevant","id","srContent","_ref$visible","visible","_ref$shouldClearConte","shouldClearContent","props","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","content","setContent","React","useEffect","contentTimeout","setTimeout","clearTimeout","nodeId","useMemo","uniqueId","dataQaProp","dataQa","concat","classes","classNames","createElement","_extends","className"],"mappings":";;;;;;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,aAAa,GAAGC,IAAA,IASiB;AAAA,EAAA,IAR7CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,SAAS,GAAAL,IAAA,CAATK,SAAS;IAAAC,YAAA,GAAAN,IAAA,CACTO,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,YAAA;IAAAE,qBAAA,GAAAR,IAAA,CACfS,kBAAkB;AAAlBA,IAAAA,kBAAkB,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;AACvBE,IAAAA,KAAK,GAAAC,wBAAA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EAAE,EAAA;AAC1D+B,IAAAA,SAAS,EAAEJ,OAAQ;AACnB,IAAA,SAAA,EAASF,MAAO;AAChBxB,IAAAA,EAAE,EAAEoB;GAAO,EACPd,KAAK,CAAA,EAERO,OACC,CAAC;AAEN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MrlPopover.js","sources":["../../../../../src/components/popover/MrlPopover/MrlPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { close } from '@muraldevkit/ds-icons';\nimport { MrlIconButton } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlFocusTrap } from '../../focus-trap/MrlFocusTrap/MrlFocusTrap';\nimport { MrlPortal, PortalProps } from '../../portal/MrlPortal';\nimport { MrlSvg } from '../../svg/MrlSvg/MrlSvg';\nimport { useTriggerPosition } from '../../../hooks/useTriggerPosition';\nimport { useBrowserEdgeScroll } from '../../menu/hooks/useBrowserEdgeScroll';\nimport { useClickOutside } from '../../../hooks/useClickOutside';\nimport { useSubMenuElementPosition } from '../../menu/hooks/useSubMenuElementPosition';\nimport { MenuPosition, MenuAlignment, ActionState, CustomMenuPosition } from '../../menu/constants';\nimport {\n\tpreventDefault,\n\tgetFocusableElementsInsideElement,\n\tfindAdjacentInteractiveElement,\n\tisElementAriaDisabled\n} from '../../../utils';\nimport { PORTAL_LAYERS } from '../../../utils/layers';\nimport { useTransition, animated } from '@react-spring/web';\nimport { SELECT_MENU_LIST_CLASS_NAME } from '../../form/select/MrlSelect/MrlSelect';\nimport { MULTI_SELECT_MENU_LIST_CLASS_NAME } from '../../form/select/MrlMultiSelect/MrlMultiSelect';\nimport styles from './MrlPopover.module.scss';\nimport { flipPosition } from '../../menu/utilities/flip-position';\nimport { getDataPoint } from './utilities/get-data-point';\nimport { getOffset } from './utilities/get-offset';\nimport { useMrlPopoverEventHandlers } from './hooks/use-mrl-popover-event-handlers';\nimport { MrlPopoverContext } from './context/MrlPopoverContext';\nimport { MrlPopoverScrollContainer } from './MrlPopoverScrollContainer';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nconst POPOVER_CLICKOUTSIDE_WHITELIST = [\n\t'#mrl-select-portal',\n\t'#mrl-popover-menu-portal',\n\t`.${SELECT_MENU_LIST_CLASS_NAME}`,\n\t`.${MULTI_SELECT_MENU_LIST_CLASS_NAME}`\n];\n\ntype RenderPropFn = ({ closeMenu }: { closeMenu: () => void }) => JSX.Element;\n\nexport interface MrlPopoverProps {\n\t/**\n\t * Set initial state of menu\n\t * @default { actionType: null, isOpen: false }\n\t */\n\tactionState?: ActionState;\n\n\t/** Label for the popover */\n\tariaLabel?: string;\n\n\t/** ID of element to associate a label */\n\tariaLabelledBy?: string;\n\n\t/** Children to be rendered within the menu component*/\n\tchildren: React.ReactNode | RenderPropFn;\n\n\t/** Custom class names for the popover */\n\tclassName?: string;\n\n\t/** Custom position for the menu */\n\tcustomPosition?: CustomMenuPosition;\n\n\t/**\n\t * If the popover should disable click to open\n\t *\n\t * Example usage: if you do not want your component opened via click, set to true\n\t */\n\tdisableClickToOpen?: boolean;\n\n\t/**\n\t * If the popover should close when clicking outside of the menu\n\t *\n\t * Example usage: MrlCallout component should not close when clicking outside, so it's set to true\n\t */\n\tdisableClickOutside?: boolean;\n\n\t/**\n\t * Disable flipping of the popover when it goes off the screen\n\t * @default false\n\t */\n\tdisableFlipping?: boolean;\n\n\t/**\n\t * If the popover should disable focus trap\n\t *\n\t * The impact of enabling or disabling focus trap:\n\t * - enabled : focus will remain trapped in the popover until a user closes the popover\n\t * - disabled : focus will move to the next interactive element in the DOM when the user\n\t * tabs out of the popover. Focus will move to the trigger when the user shift+tabs out of the popover\n\t *\n\t * Additional scenarios to consider with focus trap is disabled. When hasCloseButton is set to true/false:\n\t * - true : if a user shows the close button, the popover will stay open until explicitly dismissed\n\t * - false : if a user hides the close button, the popover will close when a user tabs out of it from the beginning or end\n\t */\n\tdisableFocusTrap?: boolean;\n\n\t/** If the popover should have a close button */\n\thasCloseButton?: boolean;\n\n\t/** Unique identifier for the menu */\n\tid?: string;\n\n\t/** If the menu is a submenu */\n\tisSubMenu?: boolean;\n\n\t/**\n\t * Horizontal and vertical alignment of the menu relative to the trigger element\n\t *\n\t * This does not impact submenus\n\t * @default 'bottom'\n\t */\n\tposition?: MenuPosition;\n\n\t/**\n\t * Alignment of the popover along the axis perpendicular to its position\n\t * - For position 'top'/'bottom': 'start' = left, 'end' = right, 'center' = center horizontally\n\t * - For position 'left'/'right': 'start' = top, 'end' = bottom, 'center' = center vertically\n\t *\n\t * @default 'center'\n\t *\n\t * This does not impact submenus\n\t */\n\talignment?: MenuAlignment;\n\n\t/**\n\t * spacing of menu\n\t * - 'default' has 16px padding\n\t * - 'compact' has 12px padding\n\t */\n\tspacing?: 'default' | 'compact';\n\n\t/**\n\t * Reference to the DOM element that triggers this menu.\n\t */\n\ttriggerRef?: React.RefObject<HTMLElement>;\n\n\t/**\n\t * If the menu should be rendered with the inverse theme\n\t * @default 'primary'\n\t */\n\tkind?: 'primary' | 'inverse';\n\n\t/**\n\t * If the menu should have a pointer element\n\t * @default false\n\t */\n\tpoint?: boolean;\n\n\t/**\n\t * Configuration for the portal component\n\t */\n\tportalProps?: Omit<PortalProps, 'children'>;\n\n\t/**\n\t * ARIA role of the popover container, e.g. `dialog` when it holds interactive content.\n\t * A role that is a valid `aria-haspopup` value (`dialog`, `grid`, `listbox`, `menu`, `tree`)\n\t * is also announced on the trigger.\n\t */\n\trole?: React.AriaRole;\n\n\t/**\n\t * Offset in pixels for the popover\n\t *\n\t * The popover automatically calculates the proper offset based on the position and alignment\n\t * this prop will override those values.\n\t */\n\toffset?: number;\n\n\t/**\n\t * Callback to be called when the menu is opened\n\t */\n\tonOpen?: () => void;\n\n\t/**\n\t * Callback to be called when the menu is closed\n\t * @param type - type of close event\n\t */\n\tonClose?: (type?: string) => void;\n\n\t/**\n\t * data-qa attribute for the popover\n\t */\n\t['data-qa']?: string;\n\n\t/**\n\t * Enables interaction tracking for this popover. Provide a stable, non-PII id\n\t * (e.g. 'sticky-note-color-picker'). When omitted, the popover emits no analytics.\n\t */\n\teventId?: string;\n}\n\nconst ARIA_HASPOPUP_ROLES = new Set(['dialog', 'grid', 'listbox', 'menu', 'tree']);\n\n/**\n * Maps the popover role to the trigger's `aria-haspopup`, falling back to the generic 'true'.\n * @param {React.AriaRole} role - The role of the popover container\n * @returns {string} The `aria-haspopup` value\n */\nconst getAriaHasPopup = (role?: React.AriaRole): string =>\n\trole && ARIA_HASPOPUP_ROLES.has(role) ? role : 'true';\n\n/**\n * MrlPopover\n *\n * Renders a popover component with position and alignment relative to a trigger element\n * @param {MrlPopoverProps} props - The props for the MrlPopover component\n * @returns {Element} - rendered MrlPopover component\n */\nexport function MrlPopover({\n\talignment = 'center',\n\tariaLabel,\n\tariaLabelledBy,\n\tchildren,\n\tclassName,\n\tcustomPosition,\n\tdisableClickToOpen = false,\n\tdisableClickOutside = false,\n\tdisableFlipping = false,\n\tdisableFocusTrap = false,\n\thasCloseButton = false,\n\tspacing = 'default',\n\tid,\n\tisSubMenu = false,\n\tactionState = { actionType: null, isOpen: false },\n\tposition = 'bottom',\n\tpoint = true,\n\tportalProps = { id: PORTAL_LAYERS.POPOVER.name },\n\tkind = 'primary',\n\trole,\n\toffset,\n\tonClose,\n\tonOpen,\n\teventId,\n\ttriggerRef,\n\t...rest\n}: MrlPopoverProps): JSX.Element {\n\tconst [state, setState] = React.useState({\n\t\tactionType: null,\n\t\tisOpen: actionState.isOpen || false\n\t} as ActionState);\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlPopover', eventId);\n\t// the popover opens and closes from several paths (trigger click, keyboard, click\n\t// outside, close button), so open/close is emitted from the resulting state.\n\tconst wasOpenRef = React.useRef(actionState.isOpen || false);\n\n\tReact.useEffect(() => {\n\t\tif (wasOpenRef.current === state.isOpen) return;\n\n\t\twasOpenRef.current = state.isOpen;\n\n\t\ttrackInteraction({\n\t\t\taction: state.isOpen ? 'open' : 'close',\n\t\t\tmetadata: { isSubMenu },\n\t\t\tvariant: position\n\t\t});\n\t}, [state.isOpen, isSubMenu, position, trackInteraction]);\n\n\t// stores all of the interactive elements in the popover for focus management\n\tconst [interactiveElements, setInteractiveElements] = React.useState<HTMLElement[]>([]);\n\tconst [menuRect, setMenuRect] = React.useState<DOMRect | null>(null);\n\tconst menuRef = React.useRef<HTMLDivElement>(null);\n\t/** Snapshot of trigger `aria-expanded` before we manage it; restored on popover unmount only. */\n\tconst triggerExpandedRestoreRef = React.useRef<{\n\t\tel: HTMLElement;\n\t\tvalue: string | null;\n\t} | null>(null);\n\n\t/**\n\t * Checks if the trigger element is disabled\n\t * @returns {boolean} - true if the trigger element is disabled, false otherwise\n\t */\n\tconst isTriggerDisabled = React.useCallback((): boolean => {\n\t\treturn isElementAriaDisabled(triggerRef?.current);\n\t}, [triggerRef]);\n\n\t/**\n\t * Opening and closing the menu\n\t */\n\tconst closeMenu = React.useCallback(() => {\n\t\tsetState({ actionType: null, isOpen: false });\n\t\tonClose?.();\n\t}, [onClose]);\n\n\tconst {\n\t\thandleClose,\n\t\thandleMenuKey,\n\t\thideMenuHover,\n\t\thandleTriggerSiblingKey,\n\t\ttoggleMenuKey,\n\t\ttoggleMenuTrigger,\n\t\tshowMenuHover\n\t} = useMrlPopoverEventHandlers({\n\t\tcloseMenu,\n\t\tdisableClickToOpen,\n\t\tdisableFocusTrap,\n\t\thasCloseButton,\n\t\tinteractiveElements,\n\t\tisSubMenu,\n\t\tisTriggerDisabled,\n\t\tmenuRef,\n\t\tsetState,\n\t\tstate,\n\t\ttriggerRef\n\t});\n\n\tuseClickOutside(\n\t\tmenuRef,\n\t\ttriggerRef,\n\t\t'mouseup',\n\t\tcloseMenu,\n\t\tdisableClickOutside || !state.isOpen,\n\t\tPOPOVER_CLICKOUTSIDE_WHITELIST\n\t);\n\n\tReact.useEffect(() => {\n\t\tif (isTriggerDisabled()) return;\n\n\t\tif (!isSubMenu) {\n\t\t\tsetState({ actionType: actionState.actionType, isOpen: actionState.isOpen });\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [isSubMenu, actionState.actionType, actionState.isOpen]);\n\n\t// This use effect handles storing the rect in state for positioning calculations\n\tReact.useLayoutEffect(() => {\n\t\tif (!state.isOpen) return;\n\n\t\t// For consistent calculations, we are storing the menu rect in state\n\t\t// Anytime we need to use the menu rect, we want to make sure the values are based\n\t\t// on the original state of the menu for proper transformations\n\t\tif (!menuRect && menuRef.current) {\n\t\t\tconst newRect = menuRef.current?.getBoundingClientRect();\n\t\t\tsetMenuRect(newRect || null);\n\t\t}\n\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, isSubMenu]);\n\n\t// This use effect handles getting and setting the interactive elements in the popover.\n\t// These elements are used for focus management when focus trap is not enabled to ensure\n\t// that our tab order matches the visual order of the page\n\tReact.useEffect(() => {\n\t\tif (state.isOpen && !isSubMenu && menuRef.current) {\n\t\t\tif (disableFocusTrap) {\n\t\t\t\t// set the interactive elements so we can track focus location\n\t\t\t\tconst elements = getFocusableElementsInsideElement(menuRef.current as HTMLElement);\n\t\t\t\tsetInteractiveElements(elements);\n\n\t\t\t\t// without focus trap enabled, we want to focus the first interactive element\n\t\t\t\telements[0].focus();\n\t\t\t}\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, menuRef.current]);\n\n\t// This use effect handles setting all of the event handlers for different parts of the component.\n\t// - trigger event handlers\n\t// - submenu event handlers\n\t// - menu event handlers\n\t// - \"next element\" event handlers, which are event handlers attached to the next interactive element after the trigger\n\t//\n\tReact.useEffect(() => {\n\t\tconst triggerElement = triggerRef?.current;\n\t\tconst menuElement = menuRef?.current;\n\t\tconst nextElement = findAdjacentInteractiveElement(triggerRef, 'next');\n\n\t\tif (triggerElement) {\n\t\t\ttriggerElement.addEventListener('mousedown', (e) => e.stopPropagation());\n\t\t\ttriggerElement.addEventListener('click', toggleMenuTrigger);\n\t\t\ttriggerElement.addEventListener('keydown', toggleMenuKey);\n\n\t\t\tif (nextElement) nextElement.addEventListener('keydown', handleTriggerSiblingKey);\n\n\t\t\t// Setup event listeners for when the menu is a submenu\n\t\t\tif (isSubMenu) {\n\t\t\t\tconst menuElement = menuRef?.current;\n\n\t\t\t\ttriggerElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\ttriggerElement.addEventListener('mouseout', hideMenuHover);\n\n\t\t\t\tif (menuElement) {\n\t\t\t\t\tmenuElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\t\tmenuElement.addEventListener('mouseout', hideMenuHover);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\ttriggerElement.removeEventListener('mousedown', preventDefault);\n\t\t\t\ttriggerElement.removeEventListener('click', toggleMenuTrigger);\n\t\t\t\ttriggerElement.removeEventListener('keydown', toggleMenuKey);\n\n\t\t\t\tif (nextElement) nextElement.removeEventListener('keydown', handleTriggerSiblingKey);\n\n\t\t\t\tif (isSubMenu) {\n\t\t\t\t\ttriggerElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\ttriggerElement.removeEventListener('mouseout', hideMenuHover);\n\n\t\t\t\t\tif (menuElement) {\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseout', hideMenuHover);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tcloseMenu,\n\t\tisSubMenu,\n\t\ttoggleMenuKey,\n\t\ttoggleMenuTrigger,\n\t\ttriggerRef?.current,\n\t\thideMenuHover,\n\t\tshowMenuHover,\n\t\thasCloseButton,\n\t\thandleClose\n\t]);\n\n\t/**\n\t * Announce the popover's role on the trigger when it is a valid `aria-haspopup` value, otherwise\n\t * fall back to the generic 'true' (see ARIA in HTML). Restore the previous DOM value when the trigger changes or this popover unmounts so host-owned\n\t * ARIA (e.g. aria-haspopup=\"menu\") is not left stale after a callout dismisses.\n\t */\n\tReact.useEffect(() => {\n\t\tconst el = triggerRef?.current;\n\t\tif (!el) return;\n\n\t\tconst previousValue = el.getAttribute('aria-haspopup');\n\t\tel.setAttribute('aria-haspopup', getAriaHasPopup(role));\n\n\t\t// Restore the previous value of the aria-haspopup attribute when the callout is removed from the DOM\n\t\treturn () => {\n\t\t\tif (previousValue === null) {\n\t\t\t\tel.removeAttribute('aria-haspopup');\n\t\t\t} else {\n\t\t\t\tel.setAttribute('aria-haspopup', previousValue);\n\t\t\t}\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [triggerRef?.current, role]);\n\n\tReact.useEffect(() => {\n\t\tconst el = triggerRef?.current;\n\t\tif (!el) return;\n\n\t\t// Store the previous value of the aria-expanded attribute when the callout is added to the DOM\n\t\tif (!triggerExpandedRestoreRef.current || triggerExpandedRestoreRef.current.el !== el) {\n\t\t\ttriggerExpandedRestoreRef.current = {\n\t\t\t\tel,\n\t\t\t\tvalue: el.hasAttribute('aria-expanded') ? el.getAttribute('aria-expanded') : null\n\t\t\t};\n\t\t}\n\n\t\t// Set the aria-expanded attribute to the current state of the popover\n\t\tel.setAttribute('aria-expanded', state.isOpen.toString());\n\n\t\tif (state.isOpen) onOpen?.();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, onOpen, triggerRef?.current]);\n\n\t/**\n\t * Restore the previous value of the aria-expanded attribute when the callout is removed from the DOM\n\t */\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tconst snap = triggerExpandedRestoreRef.current;\n\t\t\tif (!snap) return;\n\t\t\tconst { el, value } = snap;\n\n\t\t\tif (!document?.documentElement?.contains(el)) return;\n\n\t\t\tif (value === null) {\n\t\t\t\tel.removeAttribute('aria-expanded');\n\t\t\t} else {\n\t\t\t\tel.setAttribute('aria-expanded', value);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\t/**\n\t * Setup positioning styles, submenu positioning styles, scroll styles, and transition.\n\t */\n\tconst memoizedCustomPosition = React.useMemo(() => customPosition, [customPosition]);\n\tconst customPopoverPosition = memoizedCustomPosition || { left: 0, top: 0 };\n\n\tconst menuPosition = useTriggerPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\t{\n\t\t\talign: alignment,\n\t\t\tcustomPosition: customPopoverPosition,\n\t\t\tposition: position\n\t\t},\n\t\tstate.isOpen,\n\t\toffset || getOffset(position, point),\n\t\tisSubMenu,\n\t\tdisableFlipping\n\t);\n\n\t// Only while open: isPositioned resets on close, which would cut the leave transition short\n\tconst isAwaitingPosition = !isSubMenu && state.isOpen && !menuPosition.isPositioned;\n\tconst hideUntilPositionedStyles = isAwaitingPosition ? { opacity: 0 } : undefined;\n\n\tconst subMenuPosition = useSubMenuElementPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\tisSubMenu,\n\t\tstate.isOpen,\n\t\tmenuRect,\n\t\t!isSubMenu\n\t);\n\n\tconst menuPositionState = menuPosition.flipped ? flipPosition(position) : position;\n\tconst scrollStyles = useBrowserEdgeScroll(menuRef, menuPositionState, alignment);\n\n\tconst inlineStyles = {\n\t\tmenu: {\n\t\t\tleft: menuPosition.left,\n\t\t\tposition: 'fixed' as const,\n\t\t\ttop: menuPosition.top\n\t\t},\n\t\tsubmenu: {\n\t\t\tleft: subMenuPosition.left,\n\t\t\ttop: subMenuPosition.top\n\t\t}\n\t};\n\n\t/**\n\t * React Spring transitions for the menu\n\t */\n\tconst transitions = useTransition(state.isOpen, {\n\t\tconfig: { duration: 150 },\n\t\tenter: { opacity: 1, transform: 'translateY(0)' },\n\t\tfrom: { opacity: 0, transform: 'translateY(4px)' },\n\t\tleave: { opacity: 0, transform: 'translateY(4px)' }\n\t});\n\n\tconst menuClasses = classnames(\n\t\tstyles['MrlPopover'],\n\t\t'MrlPopover',\n\t\tstyles['MrlPopover--scrolling'],\n\t\tclassName,\n\t\t{\n\t\t\t[styles['MrlPopover--submenu']]: isSubMenu,\n\t\t\t[styles['inverse']]: kind === 'inverse',\n\t\t\t[styles['primary']]: kind === 'primary',\n\t\t\t[styles['compact']]: spacing === 'compact',\n\t\t\t[styles['default']]: spacing === 'default'\n\t\t}\n\t);\n\n\tconst positionStyles = isSubMenu ? inlineStyles.submenu : inlineStyles.menu;\n\n\tconst renderMenu = () => {\n\t\tconst inlineScrollStyles = isSubMenu ? {} : scrollStyles ? scrollStyles.styles : {};\n\t\tconst scrollClasses = classnames(\n\t\t\tstyles['MrlPopover--content'],\n\t\t\tstyles['MrlPopover--scrolling--content']\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{transitions(\n\t\t\t\t\t(style, item) =>\n\t\t\t\t\t\titem && (\n\t\t\t\t\t\t\t<MrlFocusTrap disabled={disableFocusTrap} containerRef={menuRef}>\n\t\t\t\t\t\t\t\t<animated.div\n\t\t\t\t\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\t\t\t\t\tclassName={menuClasses}\n\t\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\t\trole={role}\n\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\tstyle={{ ...positionStyles, ...style, ...hideUntilPositionedStyles }}\n\t\t\t\t\t\t\t\t\tonKeyDown={handleMenuKey}\n\t\t\t\t\t\t\t\t\tref={menuRef}\n\t\t\t\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<MrlPopoverScrollContainer className={scrollClasses} style={inlineScrollStyles}>\n\t\t\t\t\t\t\t\t\t\t{typeof children === 'function' && children({ closeMenu })}\n\t\t\t\t\t\t\t\t\t\t{typeof children !== 'function' && children}\n\t\t\t\t\t\t\t\t\t\t{hasCloseButton && (\n\t\t\t\t\t\t\t\t\t\t\t<MrlIconButton\n\t\t\t\t\t\t\t\t\t\t\t\tdata-qa=\"popover-close-button\"\n\t\t\t\t\t\t\t\t\t\t\t\twrapperClassName={styles['MrlPopover--close']}\n\t\t\t\t\t\t\t\t\t\t\t\ticon={<MrlSvg svg={close} />}\n\t\t\t\t\t\t\t\t\t\t\t\tkind={kind === 'inverse' ? 'ghost-inverse' : 'ghost'}\n\t\t\t\t\t\t\t\t\t\t\t\ttext=\"Close\"\n\t\t\t\t\t\t\t\t\t\t\t\tstate=\"default\"\n\t\t\t\t\t\t\t\t\t\t\t\tposition=\"right\"\n\t\t\t\t\t\t\t\t\t\t\t\ttipAnchor=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseUp={closeMenu}\n\t\t\t\t\t\t\t\t\t\t\t\tonKeyDown={handleClose}\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t{point && (\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={styles['MrlPopover--point']}\n\t\t\t\t\t\t\t\t\t\t\t\tdata-point={getDataPoint(menuPositionState, alignment)}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</MrlPopoverScrollContainer>\n\t\t\t\t\t\t\t\t</animated.div>\n\t\t\t\t\t\t\t</MrlFocusTrap>\n\t\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n\n\t/* eslint-disable */\n\treturn (\n\t\t<MrlPopoverContext.Provider\n\t\t\tvalue={{\n\t\t\t\tcloseMenu\n\t\t\t}}\n\t\t>\n\t\t\t{isSubMenu ? (\n\t\t\t\trenderMenu()\n\t\t\t) : (\n\t\t\t\t<MrlPortal layer={portalProps.layer || PORTAL_LAYERS.POPOVER} {...portalProps}>\n\t\t\t\t\t{renderMenu()}\n\t\t\t\t</MrlPortal>\n\t\t\t)}\n\t\t</MrlPopoverContext.Provider>\n\t);\n\t/* eslint-enable */\n}\n\nMrlPopover.componentType = 'Popover';\n"],"names":["POPOVER_CLICKOUTSIDE_WHITELIST","concat","SELECT_MENU_LIST_CLASS_NAME","MULTI_SELECT_MENU_LIST_CLASS_NAME","ARIA_HASPOPUP_ROLES","Set","getAriaHasPopup","role","has","MrlPopover","_ref","_ref$alignment","alignment","ariaLabel","ariaLabelledBy","children","className","customPosition","_ref$disableClickToOp","disableClickToOpen","_ref$disableClickOuts","disableClickOutside","_ref$disableFlipping","disableFlipping","_ref$disableFocusTrap","disableFocusTrap","_ref$hasCloseButton","hasCloseButton","_ref$spacing","spacing","id","_ref$isSubMenu","isSubMenu","_ref$actionState","actionState","actionType","isOpen","_ref$position","position","_ref$point","point","_ref$portalProps","portalProps","PORTAL_LAYERS","POPOVER","name","_ref$kind","kind","offset","onClose","onOpen","eventId","triggerRef","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","state","setState","trackInteraction","useMrlTrackInteraction","wasOpenRef","useRef","useEffect","current","action","metadata","variant","_React$useState3","_React$useState4","interactiveElements","setInteractiveElements","_React$useState5","_React$useState6","menuRect","setMenuRect","menuRef","triggerExpandedRestoreRef","isTriggerDisabled","useCallback","isElementAriaDisabled","closeMenu","_useMrlPopoverEventHa","useMrlPopoverEventHandlers","handleClose","handleMenuKey","hideMenuHover","handleTriggerSiblingKey","toggleMenuKey","toggleMenuTrigger","showMenuHover","useClickOutside","useLayoutEffect","_menuRef$current","newRect","getBoundingClientRect","elements","getFocusableElementsInsideElement","focus","triggerElement","menuElement","nextElement","findAdjacentInteractiveElement","addEventListener","e","stopPropagation","removeEventListener","preventDefault","el","previousValue","getAttribute","setAttribute","removeAttribute","value","hasAttribute","toString","_document","_document$documentEle","snap","document","documentElement","contains","memoizedCustomPosition","useMemo","customPopoverPosition","left","top","menuPosition","useTriggerPosition","align","getOffset","isAwaitingPosition","isPositioned","hideUntilPositionedStyles","opacity","undefined","subMenuPosition","useSubMenuElementPosition","menuPositionState","flipped","flipPosition","scrollStyles","useBrowserEdgeScroll","inlineStyles","menu","submenu","transitions","useTransition","config","duration","enter","transform","from","leave","menuClasses","classnames","styles","positionStyles","renderMenu","inlineScrollStyles","scrollClasses","createElement","Fragment","style","item","MrlFocusTrap","disabled","containerRef","animated","div","_extends","tabIndex","_objectSpread","onKeyDown","ref","MrlPopoverScrollContainer","MrlIconButton","wrapperClassName","icon","MrlSvg","svg","close","text","tipAnchor","onMouseUp","size","getDataPoint","MrlPopoverContext","Provider","MrlPortal","layer","componentType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAMA,8BAA8B,GAAG,CACtC,oBAAoB,EACpB,0BAA0B,EAAA,GAAA,CAAAC,MAAA,CACtBC,2BAA2B,CAAA,EAAA,GAAA,CAAAD,MAAA,CAC3BE,iCAAiC,CAAA,CACrC;AA2JD,IAAMC,mBAAmB,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;;AAElF;AACA;AACA;AACA;AACA;AACA,IAAMC,eAAe,GAAIC,IAAqB,IAC7CA,IAAI,IAAIH,mBAAmB,CAACI,GAAG,CAACD,IAAI,CAAC,GAAGA,IAAI,GAAG,MAAM;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,UAAUA,CAAAC,IAAA,EA2BO;AAAA,EAAA,IAAAC,cAAA,GAAAD,IAAA,CA1BhCE,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,QAAQ,GAAAA,cAAA;IACpBE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACdC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,cAAc,GAAAP,IAAA,CAAdO,cAAc;IAAAC,qBAAA,GAAAR,IAAA,CACd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AACvC,MAAA,YAAA,EAAY8B,YAAY,CAAChD,iBAAiB,EAAElI,SAAS;AAAE,KACvD,CAEwB,CACd,CACD,CAEjB,CACC,CAAC;EAEL,CAAC;;AAED;AACA,EAAA,oBACC6C,KAAA,CAAA4G,aAAA,CAAC0B,iBAAiB,CAACC,QAAQ,EAAA;AAC1B3E,IAAAA,KAAK,EAAE;AACNhC,MAAAA;AACD;AAAE,GAAA,EAEDrD,SAAS,GACTkI,UAAU,EAAE,gBAEZzG,KAAA,CAAA4G,aAAA,CAAC4B,SAAS,EAAAnB,QAAA,CAAA;AAACoB,IAAAA,KAAK,EAAExJ,WAAW,CAACwJ,KAAK,IAAIvJ,aAAa,CAACC;AAAQ,GAAA,EAAKF,WAAW,CAAA,EAC3EwH,UAAU,EACD,CAEe,CAAC;AAE9B;AACD;AAEAzJ,UAAU,CAAC0L,aAAa,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"MrlPopover.js","sources":["../../../../../src/components/popover/MrlPopover/MrlPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { close } from '@muraldevkit/ds-icons';\nimport { MrlIconButton } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlFocusTrap } from '../../focus-trap/MrlFocusTrap/MrlFocusTrap';\nimport { MrlPortal, PortalProps } from '../../portal/MrlPortal';\nimport { MrlSvg } from '../../svg/MrlSvg/MrlSvg';\nimport { useTriggerPosition } from '../../../hooks/useTriggerPosition';\nimport { useBrowserEdgeScroll } from '../../menu/hooks/useBrowserEdgeScroll';\nimport { useClickOutside } from '../../../hooks/useClickOutside';\nimport { useSubMenuElementPosition } from '../../menu/hooks/useSubMenuElementPosition';\nimport { MenuPosition, MenuAlignment, ActionState, CustomMenuPosition } from '../../menu/constants';\nimport {\n\tpreventDefault,\n\tgetFocusableElementsInsideElement,\n\tfindAdjacentInteractiveElement,\n\tisElementAriaDisabled\n} from '../../../utils';\nimport { PORTAL_LAYERS } from '../../../utils/layers';\nimport { useTransition, animated } from '@react-spring/web';\nimport { SELECT_MENU_LIST_CLASS_NAME } from '../../form/select/MrlSelect/MrlSelect';\nimport { MULTI_SELECT_MENU_LIST_CLASS_NAME } from '../../form/select/MrlMultiSelect/MrlMultiSelect';\nimport styles from './MrlPopover.module.scss';\nimport { flipPosition } from '../../menu/utilities/flip-position';\nimport { getDataPoint } from './utilities/get-data-point';\nimport { getOffset } from './utilities/get-offset';\nimport { useMrlPopoverEventHandlers } from './hooks/use-mrl-popover-event-handlers';\nimport { MrlPopoverContext } from './context/MrlPopoverContext';\nimport { MrlPopoverScrollContainer } from './MrlPopoverScrollContainer';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nconst POPOVER_CLICKOUTSIDE_WHITELIST = [\n\t'#mrl-select-portal',\n\t'#mrl-popover-menu-portal',\n\t`.${SELECT_MENU_LIST_CLASS_NAME}`,\n\t`.${MULTI_SELECT_MENU_LIST_CLASS_NAME}`\n];\n\nexport type RenderPropFn = ({ closeMenu }: { closeMenu: () => void }) => JSX.Element;\n\nexport interface MrlPopoverProps {\n\t/**\n\t * Set initial state of menu\n\t * @default { actionType: null, isOpen: false }\n\t */\n\tactionState?: ActionState;\n\n\t/** Label for the popover */\n\tariaLabel?: string;\n\n\t/** ID of element to associate a label */\n\tariaLabelledBy?: string;\n\n\t/** Children to be rendered within the menu component*/\n\tchildren: React.ReactNode | RenderPropFn;\n\n\t/** Custom class names for the popover */\n\tclassName?: string;\n\n\t/** Custom position for the menu */\n\tcustomPosition?: CustomMenuPosition;\n\n\t/**\n\t * If the popover should disable click to open\n\t *\n\t * Example usage: if you do not want your component opened via click, set to true\n\t */\n\tdisableClickToOpen?: boolean;\n\n\t/**\n\t * If the popover should close when clicking outside of the menu\n\t *\n\t * Example usage: MrlCallout component should not close when clicking outside, so it's set to true\n\t */\n\tdisableClickOutside?: boolean;\n\n\t/**\n\t * Disable flipping of the popover when it goes off the screen\n\t * @default false\n\t */\n\tdisableFlipping?: boolean;\n\n\t/**\n\t * If the popover should disable focus trap\n\t *\n\t * The impact of enabling or disabling focus trap:\n\t * - enabled : focus will remain trapped in the popover until a user closes the popover\n\t * - disabled : focus will move to the next interactive element in the DOM when the user\n\t * tabs out of the popover. Focus will move to the trigger when the user shift+tabs out of the popover\n\t *\n\t * Additional scenarios to consider with focus trap is disabled. When hasCloseButton is set to true/false:\n\t * - true : if a user shows the close button, the popover will stay open until explicitly dismissed\n\t * - false : if a user hides the close button, the popover will close when a user tabs out of it from the beginning or end\n\t */\n\tdisableFocusTrap?: boolean;\n\n\t/** If the popover should have a close button */\n\thasCloseButton?: boolean;\n\n\t/** Unique identifier for the menu */\n\tid?: string;\n\n\t/** If the menu is a submenu */\n\tisSubMenu?: boolean;\n\n\t/**\n\t * Horizontal and vertical alignment of the menu relative to the trigger element\n\t *\n\t * This does not impact submenus\n\t * @default 'bottom'\n\t */\n\tposition?: MenuPosition;\n\n\t/**\n\t * Alignment of the popover along the axis perpendicular to its position\n\t * - For position 'top'/'bottom': 'start' = left, 'end' = right, 'center' = center horizontally\n\t * - For position 'left'/'right': 'start' = top, 'end' = bottom, 'center' = center vertically\n\t *\n\t * @default 'center'\n\t *\n\t * This does not impact submenus\n\t */\n\talignment?: MenuAlignment;\n\n\t/**\n\t * spacing of menu\n\t * - 'default' has 16px padding\n\t * - 'compact' has 12px padding\n\t */\n\tspacing?: 'default' | 'compact';\n\n\t/**\n\t * Reference to the DOM element that triggers this menu.\n\t */\n\ttriggerRef?: React.RefObject<HTMLElement>;\n\n\t/**\n\t * If the menu should be rendered with the inverse theme\n\t * @default 'primary'\n\t */\n\tkind?: 'primary' | 'inverse';\n\n\t/**\n\t * If the menu should have a pointer element\n\t * @default false\n\t */\n\tpoint?: boolean;\n\n\t/**\n\t * Configuration for the portal component\n\t */\n\tportalProps?: Omit<PortalProps, 'children'>;\n\n\t/**\n\t * ARIA role of the popover container, e.g. `dialog` when it holds interactive content.\n\t * A role that is a valid `aria-haspopup` value (`dialog`, `grid`, `listbox`, `menu`, `tree`)\n\t * is also announced on the trigger.\n\t */\n\trole?: React.AriaRole;\n\n\t/**\n\t * Offset in pixels for the popover\n\t *\n\t * The popover automatically calculates the proper offset based on the position and alignment\n\t * this prop will override those values.\n\t */\n\toffset?: number;\n\n\t/**\n\t * Callback to be called when the menu is opened\n\t */\n\tonOpen?: () => void;\n\n\t/**\n\t * Callback to be called when the menu is closed\n\t * @param type - type of close event\n\t */\n\tonClose?: (type?: string) => void;\n\n\t/**\n\t * data-qa attribute for the popover\n\t */\n\t['data-qa']?: string;\n\n\t/**\n\t * Enables interaction tracking for this popover. Provide a stable, non-PII id\n\t * (e.g. 'sticky-note-color-picker'). When omitted, the popover emits no analytics.\n\t */\n\teventId?: string;\n}\n\nconst ARIA_HASPOPUP_ROLES = new Set(['dialog', 'grid', 'listbox', 'menu', 'tree']);\n\n/**\n * Maps the popover role to the trigger's `aria-haspopup`, falling back to the generic 'true'.\n * @param {React.AriaRole} role - The role of the popover container\n * @returns {string} The `aria-haspopup` value\n */\nconst getAriaHasPopup = (role?: React.AriaRole): string =>\n\trole && ARIA_HASPOPUP_ROLES.has(role) ? role : 'true';\n\n/**\n * MrlPopover\n *\n * Renders a popover component with position and alignment relative to a trigger element\n * @param {MrlPopoverProps} props - The props for the MrlPopover component\n * @returns {Element} - rendered MrlPopover component\n */\nexport function MrlPopover({\n\talignment = 'center',\n\tariaLabel,\n\tariaLabelledBy,\n\tchildren,\n\tclassName,\n\tcustomPosition,\n\tdisableClickToOpen = false,\n\tdisableClickOutside = false,\n\tdisableFlipping = false,\n\tdisableFocusTrap = false,\n\thasCloseButton = false,\n\tspacing = 'default',\n\tid,\n\tisSubMenu = false,\n\tactionState = { actionType: null, isOpen: false },\n\tposition = 'bottom',\n\tpoint = true,\n\tportalProps = { id: PORTAL_LAYERS.POPOVER.name },\n\tkind = 'primary',\n\trole,\n\toffset,\n\tonClose,\n\tonOpen,\n\teventId,\n\ttriggerRef,\n\t...rest\n}: MrlPopoverProps): JSX.Element {\n\tconst [state, setState] = React.useState({\n\t\tactionType: null,\n\t\tisOpen: actionState.isOpen || false\n\t} as ActionState);\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlPopover', eventId);\n\t// the popover opens and closes from several paths (trigger click, keyboard, click\n\t// outside, close button), so open/close is emitted from the resulting state.\n\tconst wasOpenRef = React.useRef(actionState.isOpen || false);\n\n\tReact.useEffect(() => {\n\t\tif (wasOpenRef.current === state.isOpen) return;\n\n\t\twasOpenRef.current = state.isOpen;\n\n\t\ttrackInteraction({\n\t\t\taction: state.isOpen ? 'open' : 'close',\n\t\t\tmetadata: { isSubMenu },\n\t\t\tvariant: position\n\t\t});\n\t}, [state.isOpen, isSubMenu, position, trackInteraction]);\n\n\t// stores all of the interactive elements in the popover for focus management\n\tconst [interactiveElements, setInteractiveElements] = React.useState<HTMLElement[]>([]);\n\tconst [menuRect, setMenuRect] = React.useState<DOMRect | null>(null);\n\tconst menuRef = React.useRef<HTMLDivElement>(null);\n\t/** Snapshot of trigger `aria-expanded` before we manage it; restored on popover unmount only. */\n\tconst triggerExpandedRestoreRef = React.useRef<{\n\t\tel: HTMLElement;\n\t\tvalue: string | null;\n\t} | null>(null);\n\n\t/**\n\t * Checks if the trigger element is disabled\n\t * @returns {boolean} - true if the trigger element is disabled, false otherwise\n\t */\n\tconst isTriggerDisabled = React.useCallback((): boolean => {\n\t\treturn isElementAriaDisabled(triggerRef?.current);\n\t}, [triggerRef]);\n\n\t/**\n\t * Opening and closing the menu\n\t */\n\tconst closeMenu = React.useCallback(() => {\n\t\tsetState({ actionType: null, isOpen: false });\n\t\tonClose?.();\n\t}, [onClose]);\n\n\tconst {\n\t\thandleClose,\n\t\thandleMenuKey,\n\t\thideMenuHover,\n\t\thandleTriggerSiblingKey,\n\t\ttoggleMenuKey,\n\t\ttoggleMenuTrigger,\n\t\tshowMenuHover\n\t} = useMrlPopoverEventHandlers({\n\t\tcloseMenu,\n\t\tdisableClickToOpen,\n\t\tdisableFocusTrap,\n\t\thasCloseButton,\n\t\tinteractiveElements,\n\t\tisSubMenu,\n\t\tisTriggerDisabled,\n\t\tmenuRef,\n\t\tsetState,\n\t\tstate,\n\t\ttriggerRef\n\t});\n\n\tuseClickOutside(\n\t\tmenuRef,\n\t\ttriggerRef,\n\t\t'mouseup',\n\t\tcloseMenu,\n\t\tdisableClickOutside || !state.isOpen,\n\t\tPOPOVER_CLICKOUTSIDE_WHITELIST\n\t);\n\n\tReact.useEffect(() => {\n\t\tif (isTriggerDisabled()) return;\n\n\t\tif (!isSubMenu) {\n\t\t\tsetState({ actionType: actionState.actionType, isOpen: actionState.isOpen });\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [isSubMenu, actionState.actionType, actionState.isOpen]);\n\n\t// This use effect handles storing the rect in state for positioning calculations\n\tReact.useLayoutEffect(() => {\n\t\tif (!state.isOpen) return;\n\n\t\t// For consistent calculations, we are storing the menu rect in state\n\t\t// Anytime we need to use the menu rect, we want to make sure the values are based\n\t\t// on the original state of the menu for proper transformations\n\t\tif (!menuRect && menuRef.current) {\n\t\t\tconst newRect = menuRef.current?.getBoundingClientRect();\n\t\t\tsetMenuRect(newRect || null);\n\t\t}\n\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, isSubMenu]);\n\n\t// This use effect handles getting and setting the interactive elements in the popover.\n\t// These elements are used for focus management when focus trap is not enabled to ensure\n\t// that our tab order matches the visual order of the page\n\tReact.useEffect(() => {\n\t\tif (state.isOpen && !isSubMenu && menuRef.current) {\n\t\t\tif (disableFocusTrap) {\n\t\t\t\t// set the interactive elements so we can track focus location\n\t\t\t\tconst elements = getFocusableElementsInsideElement(menuRef.current as HTMLElement);\n\t\t\t\tsetInteractiveElements(elements);\n\n\t\t\t\t// without focus trap enabled, we want to focus the first interactive element\n\t\t\t\telements[0].focus();\n\t\t\t}\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, menuRef.current]);\n\n\t// This use effect handles setting all of the event handlers for different parts of the component.\n\t// - trigger event handlers\n\t// - submenu event handlers\n\t// - menu event handlers\n\t// - \"next element\" event handlers, which are event handlers attached to the next interactive element after the trigger\n\t//\n\tReact.useEffect(() => {\n\t\tconst triggerElement = triggerRef?.current;\n\t\tconst menuElement = menuRef?.current;\n\t\tconst nextElement = findAdjacentInteractiveElement(triggerRef, 'next');\n\n\t\tif (triggerElement) {\n\t\t\ttriggerElement.addEventListener('mousedown', (e) => e.stopPropagation());\n\t\t\ttriggerElement.addEventListener('click', toggleMenuTrigger);\n\t\t\ttriggerElement.addEventListener('keydown', toggleMenuKey);\n\n\t\t\tif (nextElement) nextElement.addEventListener('keydown', handleTriggerSiblingKey);\n\n\t\t\t// Setup event listeners for when the menu is a submenu\n\t\t\tif (isSubMenu) {\n\t\t\t\tconst menuElement = menuRef?.current;\n\n\t\t\t\ttriggerElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\ttriggerElement.addEventListener('mouseout', hideMenuHover);\n\n\t\t\t\tif (menuElement) {\n\t\t\t\t\tmenuElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\t\tmenuElement.addEventListener('mouseout', hideMenuHover);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\ttriggerElement.removeEventListener('mousedown', preventDefault);\n\t\t\t\ttriggerElement.removeEventListener('click', toggleMenuTrigger);\n\t\t\t\ttriggerElement.removeEventListener('keydown', toggleMenuKey);\n\n\t\t\t\tif (nextElement) nextElement.removeEventListener('keydown', handleTriggerSiblingKey);\n\n\t\t\t\tif (isSubMenu) {\n\t\t\t\t\ttriggerElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\ttriggerElement.removeEventListener('mouseout', hideMenuHover);\n\n\t\t\t\t\tif (menuElement) {\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseout', hideMenuHover);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tcloseMenu,\n\t\tisSubMenu,\n\t\ttoggleMenuKey,\n\t\ttoggleMenuTrigger,\n\t\ttriggerRef?.current,\n\t\thideMenuHover,\n\t\tshowMenuHover,\n\t\thasCloseButton,\n\t\thandleClose\n\t]);\n\n\t/**\n\t * Announce the popover's role on the trigger when it is a valid `aria-haspopup` value, otherwise\n\t * fall back to the generic 'true' (see ARIA in HTML). Restore the previous DOM value when the trigger changes or this popover unmounts so host-owned\n\t * ARIA (e.g. aria-haspopup=\"menu\") is not left stale after a callout dismisses.\n\t */\n\tReact.useEffect(() => {\n\t\tconst el = triggerRef?.current;\n\t\tif (!el) return;\n\n\t\tconst previousValue = el.getAttribute('aria-haspopup');\n\t\tel.setAttribute('aria-haspopup', getAriaHasPopup(role));\n\n\t\t// Restore the previous value of the aria-haspopup attribute when the callout is removed from the DOM\n\t\treturn () => {\n\t\t\tif (previousValue === null) {\n\t\t\t\tel.removeAttribute('aria-haspopup');\n\t\t\t} else {\n\t\t\t\tel.setAttribute('aria-haspopup', previousValue);\n\t\t\t}\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [triggerRef?.current, role]);\n\n\tReact.useEffect(() => {\n\t\tconst el = triggerRef?.current;\n\t\tif (!el) return;\n\n\t\t// Store the previous value of the aria-expanded attribute when the callout is added to the DOM\n\t\tif (!triggerExpandedRestoreRef.current || triggerExpandedRestoreRef.current.el !== el) {\n\t\t\ttriggerExpandedRestoreRef.current = {\n\t\t\t\tel,\n\t\t\t\tvalue: el.hasAttribute('aria-expanded') ? el.getAttribute('aria-expanded') : null\n\t\t\t};\n\t\t}\n\n\t\t// Set the aria-expanded attribute to the current state of the popover\n\t\tel.setAttribute('aria-expanded', state.isOpen.toString());\n\n\t\tif (state.isOpen) onOpen?.();\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, onOpen, triggerRef?.current]);\n\n\t/**\n\t * Restore the previous value of the aria-expanded attribute when the callout is removed from the DOM\n\t */\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tconst snap = triggerExpandedRestoreRef.current;\n\t\t\tif (!snap) return;\n\t\t\tconst { el, value } = snap;\n\n\t\t\tif (!document?.documentElement?.contains(el)) return;\n\n\t\t\tif (value === null) {\n\t\t\t\tel.removeAttribute('aria-expanded');\n\t\t\t} else {\n\t\t\t\tel.setAttribute('aria-expanded', value);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\t/**\n\t * Setup positioning styles, submenu positioning styles, scroll styles, and transition.\n\t */\n\tconst memoizedCustomPosition = React.useMemo(() => customPosition, [customPosition]);\n\tconst customPopoverPosition = memoizedCustomPosition || { left: 0, top: 0 };\n\n\tconst menuPosition = useTriggerPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\t{\n\t\t\talign: alignment,\n\t\t\tcustomPosition: customPopoverPosition,\n\t\t\tposition: position\n\t\t},\n\t\tstate.isOpen,\n\t\toffset || getOffset(position, point),\n\t\tisSubMenu,\n\t\tdisableFlipping\n\t);\n\n\t// Only while open: isPositioned resets on close, which would cut the leave transition short\n\tconst isAwaitingPosition = !isSubMenu && state.isOpen && !menuPosition.isPositioned;\n\tconst hideUntilPositionedStyles = isAwaitingPosition ? { opacity: 0 } : undefined;\n\n\tconst subMenuPosition = useSubMenuElementPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\tisSubMenu,\n\t\tstate.isOpen,\n\t\tmenuRect,\n\t\t!isSubMenu\n\t);\n\n\tconst menuPositionState = menuPosition.flipped ? flipPosition(position) : position;\n\tconst scrollStyles = useBrowserEdgeScroll(menuRef, menuPositionState, alignment);\n\n\tconst inlineStyles = {\n\t\tmenu: {\n\t\t\tleft: menuPosition.left,\n\t\t\tposition: 'fixed' as const,\n\t\t\ttop: menuPosition.top\n\t\t},\n\t\tsubmenu: {\n\t\t\tleft: subMenuPosition.left,\n\t\t\ttop: subMenuPosition.top\n\t\t}\n\t};\n\n\t/**\n\t * React Spring transitions for the menu\n\t */\n\tconst transitions = useTransition(state.isOpen, {\n\t\tconfig: { duration: 150 },\n\t\tenter: { opacity: 1, transform: 'translateY(0)' },\n\t\tfrom: { opacity: 0, transform: 'translateY(4px)' },\n\t\tleave: { opacity: 0, transform: 'translateY(4px)' }\n\t});\n\n\tconst menuClasses = classnames(\n\t\tstyles['MrlPopover'],\n\t\t'MrlPopover',\n\t\tstyles['MrlPopover--scrolling'],\n\t\tclassName,\n\t\t{\n\t\t\t[styles['MrlPopover--submenu']]: isSubMenu,\n\t\t\t[styles['inverse']]: kind === 'inverse',\n\t\t\t[styles['primary']]: kind === 'primary',\n\t\t\t[styles['compact']]: spacing === 'compact',\n\t\t\t[styles['default']]: spacing === 'default'\n\t\t}\n\t);\n\n\tconst positionStyles = isSubMenu ? inlineStyles.submenu : inlineStyles.menu;\n\n\tconst renderMenu = () => {\n\t\tconst inlineScrollStyles = isSubMenu ? {} : scrollStyles ? scrollStyles.styles : {};\n\t\tconst scrollClasses = classnames(\n\t\t\tstyles['MrlPopover--content'],\n\t\t\tstyles['MrlPopover--scrolling--content']\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{transitions(\n\t\t\t\t\t(style, item) =>\n\t\t\t\t\t\titem && (\n\t\t\t\t\t\t\t<MrlFocusTrap disabled={disableFocusTrap} containerRef={menuRef}>\n\t\t\t\t\t\t\t\t<animated.div\n\t\t\t\t\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\t\t\t\t\tclassName={menuClasses}\n\t\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\t\trole={role}\n\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\tstyle={{ ...positionStyles, ...style, ...hideUntilPositionedStyles }}\n\t\t\t\t\t\t\t\t\tonKeyDown={handleMenuKey}\n\t\t\t\t\t\t\t\t\tref={menuRef}\n\t\t\t\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<MrlPopoverScrollContainer className={scrollClasses} style={inlineScrollStyles}>\n\t\t\t\t\t\t\t\t\t\t{typeof children === 'function' && children({ closeMenu })}\n\t\t\t\t\t\t\t\t\t\t{typeof children !== 'function' && children}\n\t\t\t\t\t\t\t\t\t\t{hasCloseButton && (\n\t\t\t\t\t\t\t\t\t\t\t<MrlIconButton\n\t\t\t\t\t\t\t\t\t\t\t\tdata-qa=\"popover-close-button\"\n\t\t\t\t\t\t\t\t\t\t\t\twrapperClassName={styles['MrlPopover--close']}\n\t\t\t\t\t\t\t\t\t\t\t\ticon={<MrlSvg svg={close} />}\n\t\t\t\t\t\t\t\t\t\t\t\tkind={kind === 'inverse' ? 'ghost-inverse' : 'ghost'}\n\t\t\t\t\t\t\t\t\t\t\t\ttext=\"Close\"\n\t\t\t\t\t\t\t\t\t\t\t\tstate=\"default\"\n\t\t\t\t\t\t\t\t\t\t\t\tposition=\"right\"\n\t\t\t\t\t\t\t\t\t\t\t\ttipAnchor=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseUp={closeMenu}\n\t\t\t\t\t\t\t\t\t\t\t\tonKeyDown={handleClose}\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t{point && (\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={styles['MrlPopover--point']}\n\t\t\t\t\t\t\t\t\t\t\t\tdata-point={getDataPoint(menuPositionState, alignment)}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</MrlPopoverScrollContainer>\n\t\t\t\t\t\t\t\t</animated.div>\n\t\t\t\t\t\t\t</MrlFocusTrap>\n\t\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n\n\t/* eslint-disable */\n\treturn (\n\t\t<MrlPopoverContext.Provider\n\t\t\tvalue={{\n\t\t\t\tcloseMenu\n\t\t\t}}\n\t\t>\n\t\t\t{isSubMenu ? (\n\t\t\t\trenderMenu()\n\t\t\t) : (\n\t\t\t\t<MrlPortal layer={portalProps.layer || PORTAL_LAYERS.POPOVER} {...portalProps}>\n\t\t\t\t\t{renderMenu()}\n\t\t\t\t</MrlPortal>\n\t\t\t)}\n\t\t</MrlPopoverContext.Provider>\n\t);\n\t/* eslint-enable */\n}\n\nMrlPopover.componentType = 'Popover';\n"],"names":["POPOVER_CLICKOUTSIDE_WHITELIST","concat","SELECT_MENU_LIST_CLASS_NAME","MULTI_SELECT_MENU_LIST_CLASS_NAME","ARIA_HASPOPUP_ROLES","Set","getAriaHasPopup","role","has","MrlPopover","_ref","_ref$alignment","alignment","ariaLabel","ariaLabelledBy","children","className","customPosition","_ref$disableClickToOp","disableClickToOpen","_ref$disableClickOuts","disableClickOutside","_ref$disableFlipping","disableFlipping","_ref$disableFocusTrap","disableFocusTrap","_ref$hasCloseButton","hasCloseButton","_ref$spacing","spacing","id","_ref$isSubMenu","isSubMenu","_ref$actionState","actionState","actionType","isOpen","_ref$position","position","_ref$point","point","_ref$portalProps","portalProps","PORTAL_LAYERS","POPOVER","name","_ref$kind","kind","offset","onClose","onOpen","eventId","triggerRef","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","state","setState","trackInteraction","useMrlTrackInteraction","wasOpenRef","useRef","useEffect","current","action","metadata","variant","_React$useState3","_React$useState4","interactiveElements","setInteractiveElements","_React$useState5","_React$useState6","menuRect","setMenuRect","menuRef","triggerExpandedRestoreRef","isTriggerDisabled","useCallback","isElementAriaDisabled","closeMenu","_useMrlPopoverEventHa","useMrlPopoverEventHandlers","handleClose","handleMenuKey","hideMenuHover","handleTriggerSiblingKey","toggleMenuKey","toggleMenuTrigger","showMenuHover","useClickOutside","useLayoutEffect","_menuRef$current","newRect","getBoundingClientRect","elements","getFocusableElementsInsideElement","focus","triggerElement","menuElement","nextElement","findAdjacentInteractiveElement","addEventListener","e","stopPropagation","removeEventListener","preventDefault","el","previousValue","getAttribute","setAttribute","removeAttribute","value","hasAttribute","toString","_document","_document$documentEle","snap","document","documentElement","contains","memoizedCustomPosition","useMemo","customPopoverPosition","left","top","menuPosition","useTriggerPosition","align","getOffset","isAwaitingPosition","isPositioned","hideUntilPositionedStyles","opacity","undefined","subMenuPosition","useSubMenuElementPosition","menuPositionState","flipped","flipPosition","scrollStyles","useBrowserEdgeScroll","inlineStyles","menu","submenu","transitions","useTransition","config","duration","enter","transform","from","leave","menuClasses","classnames","styles","positionStyles","renderMenu","inlineScrollStyles","scrollClasses","createElement","Fragment","style","item","MrlFocusTrap","disabled","containerRef","animated","div","_extends","tabIndex","_objectSpread","onKeyDown","ref","MrlPopoverScrollContainer","MrlIconButton","wrapperClassName","icon","MrlSvg","svg","close","text","tipAnchor","onMouseUp","size","getDataPoint","MrlPopoverContext","Provider","MrlPortal","layer","componentType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAMA,8BAA8B,GAAG,CACtC,oBAAoB,EACpB,0BAA0B,EAAA,GAAA,CAAAC,MAAA,CACtBC,2BAA2B,CAAA,EAAA,GAAA,CAAAD,MAAA,CAC3BE,iCAAiC,CAAA,CACrC;AA2JD,IAAMC,mBAAmB,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;;AAElF;AACA;AACA;AACA;AACA;AACA,IAAMC,eAAe,GAAIC,IAAqB,IAC7CA,IAAI,IAAIH,mBAAmB,CAACI,GAAG,CAACD,IAAI,CAAC,GAAGA,IAAI,GAAG,MAAM;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SA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