@muraldevkit/ui-toolkit 4.77.0-dev-yOaq.1 → 4.77.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/cjs/components/button/MrlButton/MrlButton.js +16 -8
  2. package/dist/cjs/components/button/MrlButton/MrlButton.js.map +1 -1
  3. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
  4. package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
  5. package/dist/cjs/components/filter/MrlFilterItem/MrlFilterItem.js +2 -1
  6. package/dist/cjs/components/filter/MrlFilterItem/MrlFilterItem.js.map +1 -1
  7. package/dist/cjs/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js.map +1 -1
  8. package/dist/cjs/components/form/label/MrlLabel/MrlLabel.js.map +1 -1
  9. package/dist/cjs/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.js.map +1 -1
  10. package/dist/cjs/components/form/text-input/MrlTextInput/MrlTextInput.js.map +1 -1
  11. package/dist/cjs/components/grid/MrlCol/MrlCol.js +49 -42
  12. package/dist/cjs/components/grid/MrlCol/MrlCol.js.map +1 -1
  13. package/dist/cjs/components/grid/MrlGrid/MrlGrid.js +6 -4
  14. package/dist/cjs/components/grid/MrlGrid/MrlGrid.js.map +1 -1
  15. package/dist/cjs/components/grid/MrlRow/MrlRow.js +8 -10
  16. package/dist/cjs/components/grid/MrlRow/MrlRow.js.map +1 -1
  17. package/dist/cjs/components/grid/constants.js +8 -27
  18. package/dist/cjs/components/grid/constants.js.map +1 -1
  19. package/dist/cjs/components/link/MrlLink/MrlLink.js.map +1 -1
  20. package/dist/cjs/components/menu/MrlMenu/MrlMenu.js.map +1 -1
  21. package/dist/cjs/components/menu/MrlMenuGroup/MrlMenuGroup.js +4 -1
  22. package/dist/cjs/components/menu/MrlMenuGroup/MrlMenuGroup.js.map +1 -1
  23. package/dist/cjs/components/menu/MrlMenuItem/MrlMenuItem.js +2 -1
  24. package/dist/cjs/components/menu/MrlMenuItem/MrlMenuItem.js.map +1 -1
  25. package/dist/cjs/components/menu/MrlMenuItemLink/MrlMenuItemLink.js +8 -4
  26. package/dist/cjs/components/menu/MrlMenuItemLink/MrlMenuItemLink.js.map +1 -1
  27. package/dist/cjs/components/modal/MrlModalContent/MrlModalContent.js +1 -1
  28. package/dist/cjs/components/modal/MrlModalContent/MrlModalContent.js.map +1 -1
  29. package/dist/cjs/components/modal/MrlModalFooter/MrlModalFooter.js +2 -1
  30. package/dist/cjs/components/modal/MrlModalFooter/MrlModalFooter.js.map +1 -1
  31. package/dist/cjs/components/modal/MrlModalHeader/MrlModalHeader.js +1 -1
  32. package/dist/cjs/components/modal/MrlModalHeader/MrlModalHeader.js.map +1 -1
  33. package/dist/cjs/components/panel/MrlPanel/MrlPanel.js.map +1 -1
  34. package/dist/cjs/components/panel/MrlPanelFooter/MrlPanelFooter.js +2 -1
  35. package/dist/cjs/components/panel/MrlPanelFooter/MrlPanelFooter.js.map +1 -1
  36. package/dist/cjs/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js +2 -1
  37. package/dist/cjs/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js.map +1 -1
  38. package/dist/cjs/version.js +1 -1
  39. package/dist/cjs/version.js.map +1 -1
  40. package/dist/components/button/MrlButton/MrlButton.d.ts +6 -0
  41. package/dist/components/filter/MrlFilterItem/MrlFilterItem.d.ts +6 -3
  42. package/dist/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.d.ts +10 -2
  43. package/dist/components/form/label/MrlLabel/MrlLabel.d.ts +5 -1
  44. package/dist/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.d.ts +2 -0
  45. package/dist/components/form/text-input/MrlTextInput/MrlTextInput.d.ts +5 -1
  46. package/dist/components/grid/MrlCol/MrlCol.d.ts +6 -4
  47. package/dist/components/grid/MrlCol/index.d.ts +1 -1
  48. package/dist/components/grid/MrlGrid/MrlGrid.d.ts +4 -5
  49. package/dist/components/grid/MrlGrid/index.d.ts +1 -1
  50. package/dist/components/grid/MrlRow/MrlRow.d.ts +7 -7
  51. package/dist/components/grid/MrlRow/index.d.ts +1 -1
  52. package/dist/components/grid/constants.d.ts +6 -20
  53. package/dist/components/link/MrlLink/MrlLink.d.ts +2 -0
  54. package/dist/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
  55. package/dist/components/menu/MrlMenuGroup/MrlMenuGroup.d.ts +15 -1
  56. package/dist/components/menu/MrlMenuItem/MrlMenuItem.d.ts +14 -6
  57. package/dist/components/menu/MrlMenuItemLink/MrlMenuItemLink.d.ts +16 -7
  58. package/dist/components/modal/MrlModalContent/MrlModalContent.d.ts +5 -2
  59. package/dist/components/modal/MrlModalFooter/MrlModalFooter.d.ts +4 -2
  60. package/dist/components/modal/MrlModalHeader/MrlModalHeader.d.ts +4 -3
  61. package/dist/components/panel/MrlPanel/MrlPanel.d.ts +2 -1
  62. package/dist/components/panel/MrlPanelFooter/MrlPanelFooter.d.ts +6 -3
  63. package/dist/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.d.ts +4 -2
  64. package/dist/esm/components/button/MrlButton/MrlButton.js +16 -8
  65. package/dist/esm/components/button/MrlButton/MrlButton.js.map +1 -1
  66. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
  67. package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
  68. package/dist/esm/components/filter/MrlFilterItem/MrlFilterItem.js +2 -1
  69. package/dist/esm/components/filter/MrlFilterItem/MrlFilterItem.js.map +1 -1
  70. package/dist/esm/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.js.map +1 -1
  71. package/dist/esm/components/form/label/MrlLabel/MrlLabel.js.map +1 -1
  72. package/dist/esm/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.js.map +1 -1
  73. package/dist/esm/components/form/text-input/MrlTextInput/MrlTextInput.js.map +1 -1
  74. package/dist/esm/components/grid/MrlCol/MrlCol.js +50 -43
  75. package/dist/esm/components/grid/MrlCol/MrlCol.js.map +1 -1
  76. package/dist/esm/components/grid/MrlGrid/MrlGrid.js +6 -4
  77. package/dist/esm/components/grid/MrlGrid/MrlGrid.js.map +1 -1
  78. package/dist/esm/components/grid/MrlRow/MrlRow.js +8 -10
  79. package/dist/esm/components/grid/MrlRow/MrlRow.js.map +1 -1
  80. package/dist/esm/components/grid/constants.js +8 -26
  81. package/dist/esm/components/grid/constants.js.map +1 -1
  82. package/dist/esm/components/link/MrlLink/MrlLink.js.map +1 -1
  83. package/dist/esm/components/menu/MrlMenu/MrlMenu.js.map +1 -1
  84. package/dist/esm/components/menu/MrlMenuGroup/MrlMenuGroup.js +4 -1
  85. package/dist/esm/components/menu/MrlMenuGroup/MrlMenuGroup.js.map +1 -1
  86. package/dist/esm/components/menu/MrlMenuItem/MrlMenuItem.js +2 -1
  87. package/dist/esm/components/menu/MrlMenuItem/MrlMenuItem.js.map +1 -1
  88. package/dist/esm/components/menu/MrlMenuItemLink/MrlMenuItemLink.js +8 -4
  89. package/dist/esm/components/menu/MrlMenuItemLink/MrlMenuItemLink.js.map +1 -1
  90. package/dist/esm/components/modal/MrlModalContent/MrlModalContent.js +1 -1
  91. package/dist/esm/components/modal/MrlModalContent/MrlModalContent.js.map +1 -1
  92. package/dist/esm/components/modal/MrlModalFooter/MrlModalFooter.js +2 -1
  93. package/dist/esm/components/modal/MrlModalFooter/MrlModalFooter.js.map +1 -1
  94. package/dist/esm/components/modal/MrlModalHeader/MrlModalHeader.js +1 -1
  95. package/dist/esm/components/modal/MrlModalHeader/MrlModalHeader.js.map +1 -1
  96. package/dist/esm/components/panel/MrlPanel/MrlPanel.js.map +1 -1
  97. package/dist/esm/components/panel/MrlPanelFooter/MrlPanelFooter.js +2 -1
  98. package/dist/esm/components/panel/MrlPanelFooter/MrlPanelFooter.js.map +1 -1
  99. package/dist/esm/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js +2 -1
  100. package/dist/esm/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.js.map +1 -1
  101. package/dist/esm/version.js +1 -1
  102. package/dist/esm/version.js.map +1 -1
  103. package/dist/styles/MrlSidebar/module.scss +2 -2
  104. package/dist/styles/grid/global.scss +2 -98
  105. package/dist/styles/grid/variables.scss +18 -2
  106. package/dist/styles.css +6 -1
  107. package/dist/types/components/button/MrlButton/MrlButton.d.ts +6 -0
  108. package/dist/types/components/filter/MrlFilterItem/MrlFilterItem.d.ts +6 -3
  109. package/dist/types/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.d.ts +10 -2
  110. package/dist/types/components/form/label/MrlLabel/MrlLabel.d.ts +5 -1
  111. package/dist/types/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.d.ts +2 -0
  112. package/dist/types/components/form/text-input/MrlTextInput/MrlTextInput.d.ts +5 -1
  113. package/dist/types/components/grid/MrlCol/MrlCol.d.ts +6 -4
  114. package/dist/types/components/grid/MrlCol/index.d.ts +1 -1
  115. package/dist/types/components/grid/MrlGrid/MrlGrid.d.ts +4 -5
  116. package/dist/types/components/grid/MrlGrid/index.d.ts +1 -1
  117. package/dist/types/components/grid/MrlRow/MrlRow.d.ts +7 -7
  118. package/dist/types/components/grid/MrlRow/index.d.ts +1 -1
  119. package/dist/types/components/grid/constants.d.ts +6 -20
  120. package/dist/types/components/link/MrlLink/MrlLink.d.ts +2 -0
  121. package/dist/types/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
  122. package/dist/types/components/menu/MrlMenuGroup/MrlMenuGroup.d.ts +15 -1
  123. package/dist/types/components/menu/MrlMenuItem/MrlMenuItem.d.ts +14 -6
  124. package/dist/types/components/menu/MrlMenuItemLink/MrlMenuItemLink.d.ts +16 -7
  125. package/dist/types/components/modal/MrlModalContent/MrlModalContent.d.ts +5 -2
  126. package/dist/types/components/modal/MrlModalFooter/MrlModalFooter.d.ts +4 -2
  127. package/dist/types/components/modal/MrlModalHeader/MrlModalHeader.d.ts +4 -3
  128. package/dist/types/components/panel/MrlPanel/MrlPanel.d.ts +2 -1
  129. package/dist/types/components/panel/MrlPanelFooter/MrlPanelFooter.d.ts +6 -3
  130. package/dist/types/components/panel/MrlPanelStickyHeader/MrlPanelStickyHeader.d.ts +4 -2
  131. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MrlLegacySelect.js","sources":["../../../../../../src/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { chevronDownFilled, chevronUpFilled } from '@muraldevkit/ds-icons';\nimport { MrlPortal } from '../../../portal/MrlPortal';\nimport { MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { SelectStates, selectDefaults, InputKinds, InputSizes } from '../../constants';\nimport { useSelect } from '../context/SelectContext';\nimport { getActionFromKey, actions, getUpdatedIndex } from '../../utils';\nimport { AttrsObject, setAttributes } from '../../../../utils';\nimport { useCoordinate } from '../../../../hooks';\nimport { PORTAL_LAYERS } from '../../../../utils/layers';\nimport { useClickOutside } from '../../../../hooks/useClickOutside';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlLegacySelect.module.scss';\n\nexport interface MrlLegacySelectProptypes extends React.HTMLAttributes<HTMLDivElement> {\n\t/** Additional function to be run when the value of the select changes */\n\thookChange?: (newValue?: string) => void | undefined;\n\n\t/** State of the select element based on user actions or permissions */\n\tstate?: SelectStates;\n\n\t/**\n\t * By default, we will select the first item in the list.\n\t * To select a different option by default, pass that item’s value as the defaultValue to the mrlSelect element.\n\t */\n\tdefaultValue?: string;\n\n\t/**\n\t * Because this is a custom element, we can't use a standard \"for\" attribute setup. The label\n\t * element needs to have an id and then we reference via the select with aria\n\t */\n\tlabelId: string;\n\n\t/**\n\t * Changes the visual style of the select trigger; Use 'inline when your select is inline\n\t * with other content\n\t */\n\tkind?: InputKinds;\n\n\t/**\n\t * Changes the visual size of the select trigger; Currently only supported when kind=\"inline\"\n\t */\n\tsize?: InputSizes;\n\n\t/**\n\t * Applies additional HTML attributes to the `mrl-select` element after the\n\t * hydration process. It is recommended only to use when overwriting an attribute\n\t * assigned internally by the design system.\n\t * When using in a framework wrapper (e.g., React), treat it as an object and don't stringify.\n\t * Otherwise, the value object needs to be stringified to not receive `\"[Object object]\"`.\n\t * Example: `attrs='{ \"tabindex\": \"1\" }'`\n\t */\n\tattrs?: AttrsObject;\n\n\t/**\n\t * menu - list of options for the user to chose from; expects an `MrlLegacySelectMenu` component\n\t */\n\tchildren?: React.ReactNode;\n\n\t/**\n\t * optional id - we will generate a unique one if it isn't given.\n\t * ID will be decorated with `${id}-mrl-select` to not conflict with aria controls.\n\t */\n\tid?: string;\n\n\t/**\n\t * optional value - control which item is selected by passing an `MrlLegacySelectItem` value (overrides `defaultValue`)\n\t * Can be used in conjunction with `hookChange` to create a controlled component.\n\t */\n\tvalue?: string;\n\n\t/**\n\t * Enables interaction tracking for this select. Provide a stable, non-PII id\n\t * (e.g. 'workspace-role-select'). When omitted, the select emits no analytics.\n\t */\n\teventId?: string;\n}\n\n/**\n * Creates and exports component class for Mural Select\n *\n * @param {MrlLegacySelectProptypes} props the props for your MrlLink\n * @returns {React.ReactElement} an a element containing the text you pass\n */\nexport const MrlLegacySelect = ({\n\tattrs = {},\n\tchildren,\n\tkind = selectDefaults.kind,\n\tlabelId,\n\tsize = selectDefaults.size,\n\teventId,\n\t...theRest\n}: MrlLegacySelectProptypes): React.ReactElement => {\n\tconst selectRef = React.useRef<HTMLDivElement>(null);\n\tconst portalRef = React.useRef<HTMLDivElement>(null);\n\tconst { dispatch, state: dispatchState } = useSelect();\n\tconst trackInteraction = useMrlTrackInteraction('MrlLegacySelect', eventId);\n\tconst coords = useCoordinate<HTMLDivElement | null>(selectRef.current, false, dispatchState.open);\n\n\tconst handleOpen = React.useCallback(\n\t\t(e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n\t\t\te.stopPropagation();\n\n\t\t\tif (dispatchState.open) {\n\t\t\t\ttrackInteraction({ action: 'close' });\n\t\t\t\tdispatch({ payload: 'mouse', type: 'close' });\n\t\t\t} else {\n\t\t\t\ttrackInteraction({ action: 'open' });\n\t\t\t\tdispatch({ type: 'open' });\n\t\t\t}\n\t\t\ttheRest.onClick?.(e);\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[dispatchState.open, trackInteraction]\n\t);\n\n\tconst handleKeyPress = React.useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\t// trap tab when we are open\n\t\t\tif (dispatchState.open && event.key === 'Tab') {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst action = getActionFromKey(event, dispatchState.open);\n\t\t\tswitch (action) {\n\t\t\t\tcase actions.Last:\n\t\t\t\tcase actions.First:\n\t\t\t\t\tdispatch({ type: 'open' });\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Type:\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tdispatch({ type: 'open' });\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Open:\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tdispatch({ type: 'open' });\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\ttheRest.onKeyDown?.(event);\n\t\t},\n\t\t// only want to rereun this when our keydown changes or our state changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[dispatchState, theRest.onKeyDown]\n\t);\n\n\t/**\n\t * @TODO: move menu key handling to MrlLegacySelectMenu\n\t */\n\tconst handleGlobalKeyPress = React.useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tconst action = getActionFromKey(event as unknown as React.KeyboardEvent, dispatchState.open);\n\t\t\tconst items = portalRef?.current?.querySelectorAll('.mrl-selectItem') || [];\n\t\t\tconst lastItemIndex = items?.length - 1;\n\t\t\tconst firstItemIndex = 0;\n\t\t\tconst focusIndex = dispatchState.focusIndex || 0;\n\n\t\t\tswitch (action) {\n\t\t\t\tcase actions.PageDown:\n\t\t\t\tcase actions.Last:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\tpayload: getUpdatedIndex(focusIndex, lastItemIndex, action),\n\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.PageUp:\n\t\t\t\tcase actions.First:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\tpayload: getUpdatedIndex(focusIndex, lastItemIndex, action),\n\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Previous:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// if not our first item then focus next.\n\t\t\t\t\tif (firstItemIndex !== focusIndex) {\n\t\t\t\t\t\tdispatch({\n\t\t\t\t\t\t\tpayload: focusIndex - 1,\n\t\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Next:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// if not our last item then focus next.\n\t\t\t\t\tif (lastItemIndex !== focusIndex) {\n\t\t\t\t\t\tdispatch({\n\t\t\t\t\t\t\tpayload: focusIndex + 1,\n\t\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.CloseSelect:\n\t\t\t\tcase actions.Close:\n\t\t\t\t\tdispatch({ payload: 'keyboard', type: 'close' });\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t// only want to change when state changes or we have different children.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[dispatchState, children]\n\t);\n\n\t/**\n\t * Detects if the select element has moved and closes the menu if it has\n\t *\n\t * We are using requestAnimationFrame to check the position of the select element\n\t * and compare it to the last known position. If the position has changed, we close\n\t * the menu.\n\t */\n\tconst lastPosition = React.useRef<DOMRect | null>(null);\n\tconst animationFrameRef = React.useRef<number | null>(null);\n\n\tReact.useEffect(() => {\n\t\tconst checkPositionChange = () => {\n\t\t\tif (selectRef.current && dispatchState.open) {\n\t\t\t\tconst currentPosition = selectRef.current.getBoundingClientRect();\n\n\t\t\t\t// If the last position is different than the current position, we know that the\n\t\t\t\t// menu has scrolled and we should close it.\n\t\t\t\tif (lastPosition.current && lastPosition.current.y !== currentPosition.y) {\n\t\t\t\t\tlastPosition.current = null;\n\t\t\t\t\tdispatch({ payload: 'mouse', type: 'close' });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlastPosition.current = currentPosition;\n\t\t\t}\n\t\t\tanimationFrameRef.current = requestAnimationFrame(checkPositionChange);\n\t\t};\n\n\t\tif (dispatchState.open) {\n\t\t\tanimationFrameRef.current = requestAnimationFrame(checkPositionChange);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (animationFrameRef.current) {\n\t\t\t\tcancelAnimationFrame(animationFrameRef.current);\n\t\t\t}\n\t\t};\n\t}, [dispatch, dispatchState.open]);\n\n\t/**\n\t * Sets focus to select element when it is closed\n\t */\n\tReact.useEffect(() => {\n\t\tif (!dispatchState.open && dispatchState.actionType === 'keyboard') {\n\t\t\tselectRef.current?.focus();\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [dispatchState.open]);\n\n\t/**\n\t * @TODO: move menu key handling to MrlLegacySelectMenu\n\t */\n\tReact.useEffect(() => {\n\t\tif (dispatchState.disabled || dispatchState.readOnly) {\n\t\t\treturn;\n\t\t}\n\n\t\tdocument?.addEventListener('keydown', handleGlobalKeyPress);\n\n\t\treturn () => {\n\t\t\tdocument?.removeEventListener('keydown', handleGlobalKeyPress);\n\t\t};\n\t}, [handleGlobalKeyPress, dispatchState.disabled, dispatchState.readOnly]);\n\n\t/**\n\t * This useEffect is responsible for setting the value if it passed in or changed\n\t * when the select is being used as a controlled component\n\t */\n\tReact.useEffect(() => {\n\t\tconst value = dispatchState.controlledValue;\n\n\t\tif (value && value !== dispatchState.selectedItem) {\n\t\t\tdispatch({ payload: value, type: 'select' });\n\n\t\t\tif (children) {\n\t\t\t\t// The first child is an instance of MrlLegacySelectMenu, so let's grab that\n\t\t\t\t// because we are looking to match the value against the children passed\n\t\t\t\t// into the MrlLegacySelectMenu component\n\t\t\t\tconst selectMenu = React.Children.toArray(children)[0];\n\n\t\t\t\tif (React.isValidElement(selectMenu)) {\n\t\t\t\t\t// Now let's grab the children of the array\n\t\t\t\t\tconst menuChildren = React.Children.toArray(selectMenu.props.children);\n\n\t\t\t\t\t// Once we have the children, we want to iterate over them to check to see if\n\t\t\t\t\t// the controlled value passed to the component matches any of the items in the menu\n\t\t\t\t\tconst matchedItem = menuChildren.find(\n\t\t\t\t\t\t(item) =>\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tReact.isValidElement(item) && (item as any).props.value === value\n\t\t\t\t\t);\n\n\t\t\t\t\t// If we found a match, we want to set the selected text to the value of the item's children\n\t\t\t\t\tif (matchedItem && React.isValidElement(matchedItem)) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tconst selectedText = (matchedItem as any).props.children;\n\t\t\t\t\t\tdispatch({ payload: selectedText, type: 'selectedText' });\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}, [children, dispatchState.controlledValue, dispatchState.selectedItem]);\n\n\tconst attributes = setAttributes(attrs, {\n\t\t'aria-controls': dispatchState.id,\n\t\t'aria-disabled': dispatchState.disabled ? 'true' : 'false',\n\t\t'aria-expanded': dispatchState.open.toString(),\n\t\t'aria-haspopup': 'listbox',\n\t\t'aria-labelledby': labelId,\n\t\trole: 'combobox',\n\t\t...(!dispatchState.disabled && { tabIndex: '0' })\n\t});\n\n\tconst allClasses = classnames('mrl-select', attributes.className, theRest.className, {\n\t\t[styles['mrl-select']]: true,\n\t\t[styles['mrl-select--disabled']]: dispatchState.disabled,\n\t\t[styles['mrl-select--read-only']]: dispatchState.readOnly\n\t});\n\n\tconst selectClasses = classnames('mrl-select-trigger', {\n\t\t[styles['mrl-select-trigger']]: true,\n\t\t[styles['mrl-select-trigger--border']]: kind === 'default',\n\t\t[styles[`mrl-select-trigger--${kind}`]]: kind !== 'default',\n\t\t[styles[`mrl-select-trigger--${size}`]]: size !== 'default'\n\t});\n\n\tconst svgClasses = classnames({\n\t\t[styles['mrl-is--open']]: dispatchState.open,\n\t\t[styles['mrl-select-trigger-indicator']]: true\n\t});\n\n\tconst selectedText = React.useMemo(() => {\n\t\tif (dispatchState.selectedText) {\n\t\t\treturn dispatchState.selectedText;\n\t\t}\n\n\t\tif (children) {\n\t\t\treturn React.Children.toArray(children)[0];\n\t\t}\n\n\t\treturn 'loading...';\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [dispatchState.selectedText]);\n\n\tconst closeSelect = () => dispatch({ payload: 'mouse', type: 'close' });\n\tuseClickOutside(selectRef, portalRef, 'mousedown', closeSelect);\n\n\treturn (\n\t\t<div\n\t\t\t{...attributes}\n\t\t\t{...theRest}\n\t\t\t{...(!dispatchState.disabled && !dispatchState.readOnly && { onClick: handleOpen })}\n\t\t\t{...(!dispatchState.disabled && !dispatchState.readOnly && { onKeyDown: handleKeyPress })}\n\t\t\tdata-value={dispatchState.selectedItem}\n\t\t\tid={dispatchState.id}\n\t\t\tclassName={allClasses}\n\t\t\tref={selectRef}\n\t\t>\n\t\t\t<div className={selectClasses}>\n\t\t\t\t<span>{selectedText}</span>\n\t\t\t\t{!dispatchState.readOnly && (\n\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\tsvg={dispatchState.open ? chevronUpFilled : chevronDownFilled}\n\t\t\t\t\t\tclassName={svgClasses}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{dispatchState.open && (\n\t\t\t\t<MrlPortal id=\"mrl-select-portal\" layer={PORTAL_LAYERS.SELECT}>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={portalRef}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tleft: coords.left,\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: coords.top + coords.height,\n\t\t\t\t\t\t\twidth: `${coords.width}px`\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</MrlPortal>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["MrlLegacySelect","_ref","_ref$attrs","attrs","children","_ref$kind","kind","selectDefaults","labelId","_ref$size","size","eventId","theRest","_objectWithoutProperties","_excluded","selectRef","React","useRef","portalRef","_useSelect","useSelect","dispatch","dispatchState","state","trackInteraction","useMrlTrackInteraction","coords","useCoordinate","current","open","handleOpen","useCallback","e","_theRest$onClick","stopPropagation","action","payload","type","onClick","call","handleKeyPress","event","_theRest$onKeyDown","key","preventDefault","getActionFromKey","actions","Last","First","Type","Open","onKeyDown","handleGlobalKeyPress","_portalRef$current","items","querySelectorAll","lastItemIndex","length","firstItemIndex","focusIndex","PageDown","getUpdatedIndex","PageUp","Previous","Next","CloseSelect","Close","lastPosition","animationFrameRef","useEffect","checkPositionChange","currentPosition","getBoundingClientRect","y","requestAnimationFrame","cancelAnimationFrame","actionType","_selectRef$current","focus","_document","disabled","readOnly","document","addEventListener","_document2","removeEventListener","value","controlledValue","selectedItem","selectMenu","Children","toArray","isValidElement","menuChildren","props","matchedItem","find","item","selectedText","attributes","setAttributes","_objectSpread","id","toString","role","tabIndex","allClasses","classnames","className","styles","selectClasses","concat","svgClasses","useMemo","closeSelect","useClickOutside","createElement","_extends","ref","MrlSvg","svg","chevronUpFilled","chevronDownFilled","MrlPortal","layer","PORTAL_LAYERS","SELECT","style","left","position","top","height","width"],"mappings":";;;;;;;;;;;;;;;;;AAgFA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,eAAe,GAAGC,IAAA,IAQqB;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAPnDE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IACVE,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,SAAA,GAAAJ,IAAA,CACRK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGE,cAAc,CAACD,IAAI,GAAAD,SAAA;IAC1BG,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAAC,SAAA,GAAAR,IAAA,CACPS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGF,cAAc,CAACG,IAAI,GAAAD,SAAA;IAC1BE,OAAO,GAAAV,IAAA,CAAPU,OAAO;AACJC,IAAAA,OAAO,GAAAC,wBAAA,CAAAZ,IAAA,EAAAa,SAAA,CAAA;AAEV,EAAA,IAAMC,SAAS,GAAGC,KAAK,CAACC,MAAM,CAAiB,IAAI,CAAC;AACpD,EAAA,IAAMC,SAAS,GAAGF,KAAK,CAACC,MAAM,CAAiB,IAAI,CAAC;AACpD,EAAA,IAAAE,UAAA,GAA2CC,SAAS,EAAE;IAA9CC,QAAQ,GAAAF,UAAA,CAARE,QAAQ;IAASC,aAAa,GAAAH,UAAA,CAApBI,KAAK;AACvB,EAAA,IAAMC,gBAAgB,GAAGC,sBAAsB,CAAC,i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CAACgF,EAAG;AACrBM,IAAAA,SAAS,EAAEF,UAAW;AACtBY,IAAAA,GAAG,EAAEvG;GAAU,CAAA,eAEfC,KAAA,CAAAoG,aAAA,CAAA,KAAA,EAAA;AAAKR,IAAAA,SAAS,EAAEE;AAAc,GAAA,eAC7B9F,KAAA,CAAAoG,aAAA,CAAA,MAAA,EAAA,IAAA,EAAOlB,YAAmB,CAAC,EAC1B,CAAC5E,aAAa,CAAC2D,QAAQ,iBACvBjE,KAAA,CAAAoG,aAAA,CAACG,MAAM,EAAA;AACNC,IAAAA,GAAG,EAAElG,aAAa,CAACO,IAAI,GAAG4F,eAAe,GAAGC,iBAAkB;AAC9Dd,IAAAA,SAAS,EAAEI,UAAW;AACtBtG,IAAAA,IAAI,EAAC;GACL,CAEE,CAAC,EACLY,aAAa,CAACO,IAAI,iBAClBb,KAAA,CAAAoG,aAAA,CAACO,SAAS,EAAA;AAACrB,IAAAA,EAAE,EAAC,mBAAmB;IAACsB,KAAK,EAAEC,aAAa,CAACC;GAAO,eAC7D9G,KAAA,CAAAoG,aAAA,CAAA,KAAA,EAAA;AACCE,IAAAA,GAAG,EAAEpG,SAAU;AACf6G,IAAAA,KAAK,EAAE;MACNC,IAAI,EAAEtG,MAAM,CAACsG,IAAI;AACjBC,MAAAA,QAAQ,EAAE,UAAU;AACpBC,MAAAA,GAAG,EAAExG,MAAM,CAACwG,GAAG,GAAGxG,MAAM,CAACyG,MAAM;AAC/BC,MAAAA,KAAK,EAAA,EAAA,CAAArB,MAAA,CAAKrF,MAAM,CAAC0G,KAAK,EAAA,IAAA;AACvB;GAAE,EAEDhI,QACG,CACK,CAER,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlLegacySelect.js","sources":["../../../../../../src/components/form/legacy-select/MrlLegacySelect/MrlLegacySelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { chevronDownFilled, chevronUpFilled } from '@muraldevkit/ds-icons';\nimport { MrlPortal } from '../../../portal/MrlPortal';\nimport { MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { SelectStates, selectDefaults, InputKinds, InputSizes } from '../../constants';\nimport { useSelect } from '../context/SelectContext';\nimport { getActionFromKey, actions, getUpdatedIndex } from '../../utils';\nimport { AttrsObject, setAttributes } from '../../../../utils';\nimport { useCoordinate } from '../../../../hooks';\nimport { PORTAL_LAYERS } from '../../../../utils/layers';\nimport { useClickOutside } from '../../../../hooks/useClickOutside';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlLegacySelect.module.scss';\n\nexport interface MrlLegacySelectProptypes extends React.HTMLAttributes<HTMLDivElement> {\n\t/** Additional function to be run when the value of the select changes */\n\thookChange?: (newValue?: string) => void | undefined;\n\n\t/** State of the select element based on user actions or permissions */\n\tstate?: SelectStates;\n\n\t/**\n\t * By default, we will select the first item in the list.\n\t * To select a different option by default, pass that item’s value as the defaultValue to the mrlSelect element.\n\t */\n\tdefaultValue?: string;\n\n\t/**\n\t * Because this is a custom element, we can't use a standard \"for\" attribute setup. The label\n\t * element needs to have an id and then we reference via the select with aria\n\t */\n\tlabelId: string;\n\n\t/**\n\t * Changes the visual style of the select trigger; Use 'inline when your select is inline\n\t * with other content\n\t */\n\tkind?: InputKinds;\n\n\t/**\n\t * Changes the visual size of the select trigger; Currently only supported when kind=\"inline\"\n\t */\n\tsize?: InputSizes;\n\n\t/**\n\t * Applies additional HTML attributes to the `mrl-select` element after the\n\t * hydration process. It is recommended only to use when overwriting an attribute\n\t * assigned internally by the design system.\n\t * When using in a framework wrapper (e.g., React), treat it as an object and don't stringify.\n\t * Otherwise, the value object needs to be stringified to not receive `\"[Object object]\"`.\n\t * Example: `attrs='{ \"tabindex\": \"1\" }'`\n\t *\n\t * @deprecated - use the regular HTML attributes instead.\n\t */\n\tattrs?: AttrsObject;\n\n\t/**\n\t * menu - list of options for the user to chose from; expects an `MrlLegacySelectMenu` component\n\t */\n\tchildren?: React.ReactNode;\n\n\t/**\n\t * optional id - we will generate a unique one if it isn't given.\n\t * ID will be decorated with `${id}-mrl-select` to not conflict with aria controls.\n\t */\n\tid?: string;\n\n\t/**\n\t * optional value - control which item is selected by passing an `MrlLegacySelectItem` value (overrides `defaultValue`)\n\t * Can be used in conjunction with `hookChange` to create a controlled component.\n\t */\n\tvalue?: string;\n\n\t/**\n\t * Enables interaction tracking for this select. Provide a stable, non-PII id\n\t * (e.g. 'workspace-role-select'). When omitted, the select emits no analytics.\n\t */\n\teventId?: string;\n}\n\n/**\n * Creates and exports component class for Mural Select\n *\n * @param {MrlLegacySelectProptypes} props the props for your MrlLink\n * @returns {React.ReactElement} an a element containing the text you pass\n */\nexport const MrlLegacySelect = ({\n\tattrs = {},\n\tchildren,\n\tkind = selectDefaults.kind,\n\tlabelId,\n\tsize = selectDefaults.size,\n\teventId,\n\t...theRest\n}: MrlLegacySelectProptypes): React.ReactElement => {\n\tconst selectRef = React.useRef<HTMLDivElement>(null);\n\tconst portalRef = React.useRef<HTMLDivElement>(null);\n\tconst { dispatch, state: dispatchState } = useSelect();\n\tconst trackInteraction = useMrlTrackInteraction('MrlLegacySelect', eventId);\n\tconst coords = useCoordinate<HTMLDivElement | null>(selectRef.current, false, dispatchState.open);\n\n\tconst handleOpen = React.useCallback(\n\t\t(e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n\t\t\te.stopPropagation();\n\n\t\t\tif (dispatchState.open) {\n\t\t\t\ttrackInteraction({ action: 'close' });\n\t\t\t\tdispatch({ payload: 'mouse', type: 'close' });\n\t\t\t} else {\n\t\t\t\ttrackInteraction({ action: 'open' });\n\t\t\t\tdispatch({ type: 'open' });\n\t\t\t}\n\t\t\ttheRest.onClick?.(e);\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[dispatchState.open, trackInteraction]\n\t);\n\n\tconst handleKeyPress = React.useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\t// trap tab when we are open\n\t\t\tif (dispatchState.open && event.key === 'Tab') {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst action = getActionFromKey(event, dispatchState.open);\n\t\t\tswitch (action) {\n\t\t\t\tcase actions.Last:\n\t\t\t\tcase actions.First:\n\t\t\t\t\tdispatch({ type: 'open' });\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Type:\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tdispatch({ type: 'open' });\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Open:\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tdispatch({ type: 'open' });\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\ttheRest.onKeyDown?.(event);\n\t\t},\n\t\t// only want to rereun this when our keydown changes or our state changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[dispatchState, theRest.onKeyDown]\n\t);\n\n\t/**\n\t * @TODO: move menu key handling to MrlLegacySelectMenu\n\t */\n\tconst handleGlobalKeyPress = React.useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tconst action = getActionFromKey(event as unknown as React.KeyboardEvent, dispatchState.open);\n\t\t\tconst items = portalRef?.current?.querySelectorAll('.mrl-selectItem') || [];\n\t\t\tconst lastItemIndex = items?.length - 1;\n\t\t\tconst firstItemIndex = 0;\n\t\t\tconst focusIndex = dispatchState.focusIndex || 0;\n\n\t\t\tswitch (action) {\n\t\t\t\tcase actions.PageDown:\n\t\t\t\tcase actions.Last:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\tpayload: getUpdatedIndex(focusIndex, lastItemIndex, action),\n\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.PageUp:\n\t\t\t\tcase actions.First:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\tpayload: getUpdatedIndex(focusIndex, lastItemIndex, action),\n\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Previous:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// if not our first item then focus next.\n\t\t\t\t\tif (firstItemIndex !== focusIndex) {\n\t\t\t\t\t\tdispatch({\n\t\t\t\t\t\t\tpayload: focusIndex - 1,\n\t\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.Next:\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// if not our last item then focus next.\n\t\t\t\t\tif (lastItemIndex !== focusIndex) {\n\t\t\t\t\t\tdispatch({\n\t\t\t\t\t\t\tpayload: focusIndex + 1,\n\t\t\t\t\t\t\ttype: 'focus'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase actions.CloseSelect:\n\t\t\t\tcase actions.Close:\n\t\t\t\t\tdispatch({ payload: 'keyboard', type: 'close' });\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t// only want to change when state changes or we have different children.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[dispatchState, children]\n\t);\n\n\t/**\n\t * Detects if the select element has moved and closes the menu if it has\n\t *\n\t * We are using requestAnimationFrame to check the position of the select element\n\t * and compare it to the last known position. If the position has changed, we close\n\t * the menu.\n\t */\n\tconst lastPosition = React.useRef<DOMRect | null>(null);\n\tconst animationFrameRef = React.useRef<number | null>(null);\n\n\tReact.useEffect(() => {\n\t\tconst checkPositionChange = () => {\n\t\t\tif (selectRef.current && dispatchState.open) {\n\t\t\t\tconst currentPosition = selectRef.current.getBoundingClientRect();\n\n\t\t\t\t// If the last position is different than the current position, we know that the\n\t\t\t\t// menu has scrolled and we should close it.\n\t\t\t\tif (lastPosition.current && lastPosition.current.y !== currentPosition.y) {\n\t\t\t\t\tlastPosition.current = null;\n\t\t\t\t\tdispatch({ payload: 'mouse', type: 'close' });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlastPosition.current = currentPosition;\n\t\t\t}\n\t\t\tanimationFrameRef.current = requestAnimationFrame(checkPositionChange);\n\t\t};\n\n\t\tif (dispatchState.open) {\n\t\t\tanimationFrameRef.current = requestAnimationFrame(checkPositionChange);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (animationFrameRef.current) {\n\t\t\t\tcancelAnimationFrame(animationFrameRef.current);\n\t\t\t}\n\t\t};\n\t}, [dispatch, dispatchState.open]);\n\n\t/**\n\t * Sets focus to select element when it is closed\n\t */\n\tReact.useEffect(() => {\n\t\tif (!dispatchState.open && dispatchState.actionType === 'keyboard') {\n\t\t\tselectRef.current?.focus();\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [dispatchState.open]);\n\n\t/**\n\t * @TODO: move menu key handling to MrlLegacySelectMenu\n\t */\n\tReact.useEffect(() => {\n\t\tif (dispatchState.disabled || dispatchState.readOnly) {\n\t\t\treturn;\n\t\t}\n\n\t\tdocument?.addEventListener('keydown', handleGlobalKeyPress);\n\n\t\treturn () => {\n\t\t\tdocument?.removeEventListener('keydown', handleGlobalKeyPress);\n\t\t};\n\t}, [handleGlobalKeyPress, dispatchState.disabled, dispatchState.readOnly]);\n\n\t/**\n\t * This useEffect is responsible for setting the value if it passed in or changed\n\t * when the select is being used as a controlled component\n\t */\n\tReact.useEffect(() => {\n\t\tconst value = dispatchState.controlledValue;\n\n\t\tif (value && value !== dispatchState.selectedItem) {\n\t\t\tdispatch({ payload: value, type: 'select' });\n\n\t\t\tif (children) {\n\t\t\t\t// The first child is an instance of MrlLegacySelectMenu, so let's grab that\n\t\t\t\t// because we are looking to match the value against the children passed\n\t\t\t\t// into the MrlLegacySelectMenu component\n\t\t\t\tconst selectMenu = React.Children.toArray(children)[0];\n\n\t\t\t\tif (React.isValidElement(selectMenu)) {\n\t\t\t\t\t// Now let's grab the children of the array\n\t\t\t\t\tconst menuChildren = React.Children.toArray(selectMenu.props.children);\n\n\t\t\t\t\t// Once we have the children, we want to iterate over them to check to see if\n\t\t\t\t\t// the controlled value passed to the component matches any of the items in the menu\n\t\t\t\t\tconst matchedItem = menuChildren.find(\n\t\t\t\t\t\t(item) =>\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tReact.isValidElement(item) && (item as any).props.value === value\n\t\t\t\t\t);\n\n\t\t\t\t\t// If we found a match, we want to set the selected text to the value of the item's children\n\t\t\t\t\tif (matchedItem && React.isValidElement(matchedItem)) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tconst selectedText = (matchedItem as any).props.children;\n\t\t\t\t\t\tdispatch({ payload: selectedText, type: 'selectedText' });\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}, [children, dispatchState.controlledValue, dispatchState.selectedItem]);\n\n\tconst attributes = setAttributes(attrs, {\n\t\t'aria-controls': dispatchState.id,\n\t\t'aria-disabled': dispatchState.disabled ? 'true' : 'false',\n\t\t'aria-expanded': dispatchState.open.toString(),\n\t\t'aria-haspopup': 'listbox',\n\t\t'aria-labelledby': labelId,\n\t\trole: 'combobox',\n\t\t...(!dispatchState.disabled && { tabIndex: '0' })\n\t});\n\n\tconst allClasses = classnames('mrl-select', attributes.className, theRest.className, {\n\t\t[styles['mrl-select']]: true,\n\t\t[styles['mrl-select--disabled']]: dispatchState.disabled,\n\t\t[styles['mrl-select--read-only']]: dispatchState.readOnly\n\t});\n\n\tconst selectClasses = classnames('mrl-select-trigger', {\n\t\t[styles['mrl-select-trigger']]: true,\n\t\t[styles['mrl-select-trigger--border']]: kind === 'default',\n\t\t[styles[`mrl-select-trigger--${kind}`]]: kind !== 'default',\n\t\t[styles[`mrl-select-trigger--${size}`]]: size !== 'default'\n\t});\n\n\tconst svgClasses = classnames({\n\t\t[styles['mrl-is--open']]: dispatchState.open,\n\t\t[styles['mrl-select-trigger-indicator']]: true\n\t});\n\n\tconst selectedText = React.useMemo(() => {\n\t\tif (dispatchState.selectedText) {\n\t\t\treturn dispatchState.selectedText;\n\t\t}\n\n\t\tif (children) {\n\t\t\treturn React.Children.toArray(children)[0];\n\t\t}\n\n\t\treturn 'loading...';\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [dispatchState.selectedText]);\n\n\tconst closeSelect = () => dispatch({ payload: 'mouse', type: 'close' });\n\tuseClickOutside(selectRef, portalRef, 'mousedown', closeSelect);\n\n\treturn (\n\t\t<div\n\t\t\t{...attributes}\n\t\t\t{...theRest}\n\t\t\t{...(!dispatchState.disabled && !dispatchState.readOnly && { onClick: handleOpen })}\n\t\t\t{...(!dispatchState.disabled && !dispatchState.readOnly && { onKeyDown: handleKeyPress })}\n\t\t\tdata-value={dispatchState.selectedItem}\n\t\t\tid={dispatchState.id}\n\t\t\tclassName={allClasses}\n\t\t\tref={selectRef}\n\t\t>\n\t\t\t<div className={selectClasses}>\n\t\t\t\t<span>{selectedText}</span>\n\t\t\t\t{!dispatchState.readOnly && (\n\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\tsvg={dispatchState.open ? chevronUpFilled : chevronDownFilled}\n\t\t\t\t\t\tclassName={svgClasses}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{dispatchState.open && (\n\t\t\t\t<MrlPortal id=\"mrl-select-portal\" layer={PORTAL_LAYERS.SELECT}>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={portalRef}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tleft: coords.left,\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: coords.top + coords.height,\n\t\t\t\t\t\t\twidth: `${coords.width}px`\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</MrlPortal>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["MrlLegacySelect","_ref","_ref$attrs","attrs","children","_ref$kind","kind","selectDefaults","labelId","_ref$size","size","eventId","theRest","_objectWithoutProperties","_excluded","selectRef","React","useRef","portalRef","_useSelect","useSelect","dispatch","dispatchState","state","trackInteraction","useMrlTrackInteraction","coords","useCoordinate","current","open","handleOpen","useCallback","e","_theRest$onClick","stopPropagation","action","payload","type","onClick","call","handleKeyPress","event","_theRest$onKeyDown","key","preventDefault","getActionFromKey","actions","Last","First","Type","Open","onKeyDown","handleGlobalKeyPress","_portalRef$current","items","querySelectorAll","lastItemIndex","length","firstItemIndex","focusIndex","PageDown","getUpdatedIndex","PageUp","Previous","Next","CloseSelect","Close","lastPosition","animationFrameRef","useEffect","checkPositionChange","currentPosition","getBoundingClientRect","y","requestAnimationFrame","cancelAnimationFrame","actionType","_selectRef$current","focus","_document","disabled","readOnly","document","addEventListener","_document2","removeEventListener","value","controlledValue","selectedItem","selectMenu","Children","toArray","isValidElement","menuChildren","props","matchedItem","find","item","selectedText","attributes","setAttributes","_objectSpread","id","toString","role","tabIndex","allClasses","classnames","className","styles","selectClasses","concat","svgClasses","useMemo","closeSelect","useClickOutside","createElement","_extends","ref","MrlSvg","svg","chevronUpFilled","chevronDownFilled","MrlPortal","layer","PORTAL_LAYERS","SELECT","style","left","position","top","height","width"],"mappings":";;;;;;;;;;;;;;;;;AAkFA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,eAAe,GAAGC,IAAA,IAQqB;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CAPnD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BAAkB;AAC9Dd,IAAAA,SAAS,EAAEI,UAAW;AACtBtG,IAAAA,IAAI,EAAC;GACL,CAEE,CAAC,EACLY,aAAa,CAACO,IAAI,iBAClBb,KAAA,CAAAoG,aAAA,CAACO,SAAS,EAAA;AAACrB,IAAAA,EAAE,EAAC,mBAAmB;IAACsB,KAAK,EAAEC,aAAa,CAACC;GAAO,eAC7D9G,KAAA,CAAAoG,aAAA,CAAA,KAAA,EAAA;AACCE,IAAAA,GAAG,EAAEpG,SAAU;AACf6G,IAAAA,KAAK,EAAE;MACNC,IAAI,EAAEtG,MAAM,CAACsG,IAAI;AACjBC,MAAAA,QAAQ,EAAE,UAAU;AACpBC,MAAAA,GAAG,EAAExG,MAAM,CAACwG,GAAG,GAAGxG,MAAM,CAACyG,MAAM;AAC/BC,MAAAA,KAAK,EAAA,EAAA,CAAArB,MAAA,CAAKrF,MAAM,CAAC0G,KAAK,EAAA,IAAA;AACvB;GAAE,EAEDhI,QACG,CACK,CAER,CAAC;AAER;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MrlTextInput.js","sources":["../../../../../../src/components/form/text-input/MrlTextInput/MrlTextInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { DSIconType, MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { MrlTextInputRightIcon } from './MrlTextInputRightIcon';\nimport { AttrsObject, setAttributes, MrlComponentProps } from '../../../../utils';\nimport { closeAlt } from '@muraldevkit/ds-icons';\nimport { RightActionConfig, InputStates } from '../../constants';\nimport { useActiveColor } from '../../hooks/useActiveColor';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlTextInput.module.scss';\n/**\n * @todo - we need to add static icon support for right\n */\n\ninterface MrlTextInputProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'input'> {\n\t/** Applies additional HTML attributes to the text input element */\n\tattrs?: AttrsObject;\n\t/** Additional function to be run when the input's value is cleared */\n\thookClear?: () => void;\n\t/** Id of the text input */\n\tinputId: string;\n\t/** The value of the text input 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 *\n\t * If undefined or set to \"0\", removes the character counter from the input\n\t */\n\tmaxLength?: number;\n\t/** Text placeholder for the text input */\n\tplaceholder?: string;\n\t/**\n\t * Changes the state of the input based on user permissions or actions.\n\t */\n\tstate?: InputStates;\n\t/** Configures a static icon to persistently display on the left side of the input */\n\tpersistIcon?: DSIconType;\n\t/** Configures an icon to the right side of the input */\n\tdynamicIcon?: RightActionConfig;\n\t/** Preset for setting up a clearable input via a right icon */\n\tisClearable?: boolean;\n\t/**\n\t * Enables interaction tracking for this input. Provide a stable, non-PII id\n\t * (e.g. 'mural-search'). When omitted, the input emits no analytics.\n\t *\n\t * Note: the input'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\n * @param {MrlTextInputProps} props - the component props\n * @param {HTMLInputElement} ref - a ref to the input element in the DOM\n * @returns a text input element\n */\nexport const MrlTextInput = React.forwardRef<HTMLInputElement, MrlTextInputProps>(\n\tfunction MrlTextInput(\n\t\t{\n\t\t\tattrs = {},\n\t\t\tinputId,\n\t\t\tisClearable,\n\t\t\tdynamicIcon,\n\t\t\thookClear,\n\t\t\tmaxLength,\n\t\t\tpersistIcon,\n\t\t\tplaceholder,\n\t\t\tstate,\n\t\t\teventId,\n\t\t\tvalue,\n\t\t\t'aria-describedby': ariaDescribedByProp,\n\t\t\t...rest\n\t\t},\n\t\tref\n\t): JSX.Element {\n\t\tconst textInputRef = React.useRef<HTMLInputElement>(null);\n\t\t// the value when the field gained focus, so `change` can be emitted once per\n\t\t// editing session instead of once per keystroke.\n\t\tconst valueOnFocusRef = React.useRef<string>('');\n\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlTextInput', eventId);\n\n\t\tconst { hasActiveColor, setHasActiveColor } = useActiveColor(state);\n\n\t\tReact.useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(\n\t\t\tref,\n\t\t\t() => textInputRef.current\n\t\t);\n\n\t\tconst clearInput = React.useCallback(() => {\n\t\t\ttrackInteraction({ action: 'clear' });\n\n\t\t\tif (textInputRef.current) {\n\t\t\t\ttextInputRef.current.value = '';\n\t\t\t\ttextInputRef.current.focus();\n\t\t\t}\n\n\t\t\tif (hookClear && typeof hookClear === 'function') {\n\t\t\t\thookClear();\n\t\t\t}\n\t\t}, [hookClear, trackInteraction]);\n\n\t\tconst hasValue = () => {\n\t\t\treturn textInputRef.current?.value !== '' || value !== '';\n\t\t};\n\n\t\tconst initialAttributes = setAttributes(attrs);\n\n\t\tconst { 'aria-describedby': ariaDescribedByAttrs, ...attributes } = initialAttributes;\n\t\tconst ariaDescribedBy = ariaDescribedByProp || ariaDescribedByAttrs;\n\n\t\tconst handleOnBlur = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\n\t\t\t\t// the value itself is never emitted — only the fact that it changed.\n\t\t\t\tif (e.target.value !== valueOnFocusRef.current) {\n\t\t\t\t\ttrackInteraction({ action: 'change' });\n\t\t\t\t}\n\n\t\t\t\tif (typeof rest.onBlur === 'function') {\n\t\t\t\t\trest.onBlur(e);\n\t\t\t\t}\n\n\t\t\t\tif (typeof attributes.onBlur === 'function') {\n\t\t\t\t\tattributes.onBlur(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor, trackInteraction]\n\t\t);\n\n\t\tconst handleOnFocus = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tvalueOnFocusRef.current = e.target.value;\n\n\t\t\t\tif (typeof rest.onFocus === 'function') {\n\t\t\t\t\trest.onFocus(e);\n\t\t\t\t}\n\n\t\t\t\tif (typeof attributes.onFocus === 'function') {\n\t\t\t\t\tattributes.onFocus(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor]\n\t\t);\n\n\t\tconst handleOnMouseEnter = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tif (typeof rest.onMouseEnter === 'function') {\n\t\t\t\t\trest.onMouseEnter(e);\n\t\t\t\t}\n\n\t\t\t\tif (typeof attributes.onMouseEnter === 'function') {\n\t\t\t\t\tattributes.onMouseEnter(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor]\n\t\t);\n\n\t\tconst handleOnMouseLeave = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\t\t\t\tif (typeof rest.onMouseLeave === 'function') {\n\t\t\t\t\trest.onMouseLeave(e);\n\t\t\t\t}\n\t\t\t\tif (typeof attributes.onMouseLeave === 'function') {\n\t\t\t\t\tattributes.onMouseLeave(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor]\n\t\t);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (textInputRef.current) {\n\t\t\t\tif (attributes.autofocus) {\n\t\t\t\t\ttextInputRef.current.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t\t// it should only run on the first render\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []);\n\n\t\tconst stateAllowsClearing = state !== 'disabled' && state !== 'read-only';\n\n\t\tconst inputClasses = classnames(\n\t\t\t'MrlTextInput',\n\t\t\tstyles['MrlTextInput'],\n\t\t\tstyles['mrl-textInput'],\n\t\t\t{\n\t\t\t\t[styles['MrlTextInput--dynamicIcon']]: isClearable && stateAllowsClearing,\n\t\t\t\t[styles['MrlTextInput--persistIcon']]: persistIcon !== undefined,\n\t\t\t\t[styles['MrlTextInput--active']]: hasActiveColor\n\t\t\t},\n\t\t\tattributes.class,\n\t\t\tattributes.className\n\t\t);\n\n\t\tconst hasDynamicIcon =\n\t\t\tstateAllowsClearing && !isClearable && typeof dynamicIcon !== 'undefined';\n\n\t\tconst dataMaxLength = attrs['data-maxlength'];\n\n\t\tconst hasMaxLength = typeof maxLength !== 'undefined' && Number(maxLength) > 0;\n\t\tconst hasDataMaxLength = typeof dataMaxLength !== 'undefined' && Number(dataMaxLength) > 0;\n\n\t\tif (hasMaxLength && isNaN(Number(maxLength))) {\n\t\t\tthrow new Error('maxLength should have type number');\n\t\t}\n\t\tif (hasDataMaxLength && isNaN(Number(dataMaxLength))) {\n\t\t\tthrow new Error('data-maxlength should have type number');\n\t\t}\n\n\t\tif (hasMaxLength && hasDataMaxLength) {\n\t\t\tthrow new Error('maxLength and data-maxlength should not be used at the same time');\n\t\t}\n\n\t\tconst displayCounter = hasMaxLength || hasDataMaxLength;\n\t\tconst counterDisplayValue = hasDataMaxLength ? dataMaxLength : maxLength;\n\t\tconst valueExceedsDataMaxLength = dataMaxLength && value ? value.length > dataMaxLength : false;\n\n\t\t// @todo - 2563 - move to setAttributes\n\t\tdelete attributes.class;\n\t\tdelete attributes.className;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className={styles['mrl-u-focus-wrapper']}>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t{...attributes}\n\t\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\t\tclassName={inputClasses}\n\t\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\t\tmaxLength={hasMaxLength ? maxLength : undefined}\n\t\t\t\t\t\tonBlur={handleOnBlur}\n\t\t\t\t\t\tonFocus={handleOnFocus}\n\t\t\t\t\t\tonMouseEnter={handleOnMouseEnter}\n\t\t\t\t\t\tonMouseLeave={handleOnMouseLeave}\n\t\t\t\t\t\tid={inputId}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\treadOnly={state === 'read-only'}\n\t\t\t\t\t\tref={textInputRef}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t/>\n\t\t\t\t\t<span className={styles['mrl-u-focus-indicator']}></span>\n\t\t\t\t\t{persistIcon && (\n\t\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tclassName={classnames(styles['MrlTextInput-persistIcon'], {\n\t\t\t\t\t\t\t\t[styles['MrlTextInput-persistIcon--active']]: hasActiveColor,\n\t\t\t\t\t\t\t\t[styles['MrlTextInput-persistIcon--disabled']]: state === 'disabled'\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tsvg={persistIcon}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tonMouseEnter={() => setHasActiveColor(true)}\n\t\t\t\t\t\t\tonMouseLeave={() => setHasActiveColor(false)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{/* the clear icon should not be displayed when the input is disabled */}\n\t\t\t\t\t{stateAllowsClearing && hasValue() && isClearable && (\n\t\t\t\t\t\t<MrlTextInputRightIcon\n\t\t\t\t\t\t\taction={clearInput}\n\t\t\t\t\t\t\ticon={closeAlt}\n\t\t\t\t\t\t\tlabel=\"Clear input\"\n\t\t\t\t\t\t\tdataQa={attributes['data-qa'] && `${attributes['data-qa']}-clear`}\n\t\t\t\t\t\t\thasActiveColor={hasActiveColor}\n\t\t\t\t\t\t\tsetHasActiveColor={setHasActiveColor}\n\t\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{hasDynamicIcon && (\n\t\t\t\t\t\t<MrlTextInputRightIcon\n\t\t\t\t\t\t\thasActiveColor={hasActiveColor}\n\t\t\t\t\t\t\tsetHasActiveColor={setHasActiveColor}\n\t\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\t\t{...dynamicIcon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{displayCounter && (\n\t\t\t\t\t<span className={classnames(styles['MrlForm-counter'], 'MrlForm-counter')}>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={classnames('MrlCounter', {\n\t\t\t\t\t\t\t\t'MrlCounter-overMaxLength': valueExceedsDataMaxLength\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tid={`${inputId}-visible-counter`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{value?.length || 0}/{counterDisplayValue}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<p style={{ display: 'none' }} id={`${inputId}-counter`}>\n\t\t\t\t\t\t\t{`${\n\t\t\t\t\t\t\t\tcounterDisplayValue - (value?.length || 0)\n\t\t\t\t\t\t\t} of ${counterDisplayValue} characters remaining`}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t}\n);\n"],"names":["MrlTextInput","React","forwardRef","_ref","ref","_ref$attrs","attrs","inputId","isClearable","dynamicIcon","hookClear","maxLength","persistIcon","placeholder","state","eventId","value","ariaDescribedByProp","rest","_objectWithoutProperties","_excluded","textInputRef","useRef","valueOnFocusRef","trackInteraction","useMrlTrackInteraction","_useActiveColor","useActiveColor","hasActiveColor","setHasActiveColor","useImperativeHandle","current","clearInput","useCallback","action","focus","hasValue","_textInputRef$current","initialAttributes","setAttributes","ariaDescribedByAttrs","attributes","_excluded2","ariaDescribedBy","handleOnBlur","e","target","onBlur","handleOnFocus","onFocus","handleOnMouseEnter","onMouseEnter","handleOnMouseLeave","onMouseLeave","useEffect","autofocus","stateAllowsClearing","inputClasses","classnames","styles","undefined","class","className","hasDynamicIcon","dataMaxLength","hasMaxLength","Number","hasDataMaxLength","isNaN","Error","displayCounter","counterDisplayValue","valueExceedsDataMaxLength","length","createElement","Fragment","_extends","type","disabled","id","read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,MAAA,GAAA,MAAA,GAALA,KAAK,CAAEyD,MAAM,KAAI,CAAC,EAAC,GAAC,EAACF,mBACjB,CAAC,eACPtE,KAAA,CAAAyE,aAAA,CAAA,GAAA,EAAA;AAAGgB,IAAAA,KAAK,EAAE;AAAEC,MAAAA,OAAO,EAAE;KAAS;IAACZ,EAAE,EAAA,EAAA,CAAAU,MAAA,CAAKlF,OAAO,EAAA,UAAA;GAAW,EAAA,EAAA,CAAAkF,MAAA,CAEtDlB,mBAAmB,IAAI,CAAAvD,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,GAAA,MAAA,GAALA,KAAK,CAAEyD,MAAM,KAAI,CAAC,CAAC,EAAA,MAAA,CAAA,CAAAgB,MAAA,CACpClB,mBAAmB,EAAA,uBAAA,CACxB,CACE,CAEN,CAAC;AAEL,CACD;;;;"}
1
+ {"version":3,"file":"MrlTextInput.js","sources":["../../../../../../src/components/form/text-input/MrlTextInput/MrlTextInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { DSIconType, MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { MrlTextInputRightIcon } from './MrlTextInputRightIcon';\nimport { AttrsObject, setAttributes, MrlComponentProps } from '../../../../utils';\nimport { closeAlt } from '@muraldevkit/ds-icons';\nimport { RightActionConfig, InputStates } from '../../constants';\nimport { useActiveColor } from '../../hooks/useActiveColor';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlTextInput.module.scss';\n/**\n * @todo - we need to add static icon support for right\n */\n\ninterface MrlTextInputProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'input'> {\n\t/**\n\t * Applies additional HTML attributes to the text input element\n\t *\n\t * @deprecated - use the regular HTML attributes instead. `data-maxlength` is still read from `attrs` only.\n\t */\n\tattrs?: AttrsObject;\n\t/** Additional function to be run when the input's value is cleared */\n\thookClear?: () => void;\n\t/** Id of the text input */\n\tinputId: string;\n\t/** The value of the text input 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 *\n\t * If undefined or set to \"0\", removes the character counter from the input\n\t */\n\tmaxLength?: number;\n\t/** Text placeholder for the text input */\n\tplaceholder?: string;\n\t/**\n\t * Changes the state of the input based on user permissions or actions.\n\t */\n\tstate?: InputStates;\n\t/** Configures a static icon to persistently display on the left side of the input */\n\tpersistIcon?: DSIconType;\n\t/** Configures an icon to the right side of the input */\n\tdynamicIcon?: RightActionConfig;\n\t/** Preset for setting up a clearable input via a right icon */\n\tisClearable?: boolean;\n\t/**\n\t * Enables interaction tracking for this input. Provide a stable, non-PII id\n\t * (e.g. 'mural-search'). When omitted, the input emits no analytics.\n\t *\n\t * Note: the input'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\n * @param {MrlTextInputProps} props - the component props\n * @param {HTMLInputElement} ref - a ref to the input element in the DOM\n * @returns a text input element\n */\nexport const MrlTextInput = React.forwardRef<HTMLInputElement, MrlTextInputProps>(\n\tfunction MrlTextInput(\n\t\t{\n\t\t\tattrs = {},\n\t\t\tinputId,\n\t\t\tisClearable,\n\t\t\tdynamicIcon,\n\t\t\thookClear,\n\t\t\tmaxLength,\n\t\t\tpersistIcon,\n\t\t\tplaceholder,\n\t\t\tstate,\n\t\t\teventId,\n\t\t\tvalue,\n\t\t\t'aria-describedby': ariaDescribedByProp,\n\t\t\t...rest\n\t\t},\n\t\tref\n\t): JSX.Element {\n\t\tconst textInputRef = React.useRef<HTMLInputElement>(null);\n\t\t// the value when the field gained focus, so `change` can be emitted once per\n\t\t// editing session instead of once per keystroke.\n\t\tconst valueOnFocusRef = React.useRef<string>('');\n\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlTextInput', eventId);\n\n\t\tconst { hasActiveColor, setHasActiveColor } = useActiveColor(state);\n\n\t\tReact.useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(\n\t\t\tref,\n\t\t\t() => textInputRef.current\n\t\t);\n\n\t\tconst clearInput = React.useCallback(() => {\n\t\t\ttrackInteraction({ action: 'clear' });\n\n\t\t\tif (textInputRef.current) {\n\t\t\t\ttextInputRef.current.value = '';\n\t\t\t\ttextInputRef.current.focus();\n\t\t\t}\n\n\t\t\tif (hookClear && typeof hookClear === 'function') {\n\t\t\t\thookClear();\n\t\t\t}\n\t\t}, [hookClear, trackInteraction]);\n\n\t\tconst hasValue = () => {\n\t\t\treturn textInputRef.current?.value !== '' || value !== '';\n\t\t};\n\n\t\tconst initialAttributes = setAttributes(attrs);\n\n\t\tconst { 'aria-describedby': ariaDescribedByAttrs, ...attributes } = initialAttributes;\n\t\tconst ariaDescribedBy = ariaDescribedByProp || ariaDescribedByAttrs;\n\n\t\tconst handleOnBlur = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\n\t\t\t\t// the value itself is never emitted — only the fact that it changed.\n\t\t\t\tif (e.target.value !== valueOnFocusRef.current) {\n\t\t\t\t\ttrackInteraction({ action: 'change' });\n\t\t\t\t}\n\n\t\t\t\tif (typeof rest.onBlur === 'function') {\n\t\t\t\t\trest.onBlur(e);\n\t\t\t\t}\n\n\t\t\t\tif (typeof attributes.onBlur === 'function') {\n\t\t\t\t\tattributes.onBlur(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor, trackInteraction]\n\t\t);\n\n\t\tconst handleOnFocus = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tvalueOnFocusRef.current = e.target.value;\n\n\t\t\t\tif (typeof rest.onFocus === 'function') {\n\t\t\t\t\trest.onFocus(e);\n\t\t\t\t}\n\n\t\t\t\tif (typeof attributes.onFocus === 'function') {\n\t\t\t\t\tattributes.onFocus(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor]\n\t\t);\n\n\t\tconst handleOnMouseEnter = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tif (typeof rest.onMouseEnter === 'function') {\n\t\t\t\t\trest.onMouseEnter(e);\n\t\t\t\t}\n\n\t\t\t\tif (typeof attributes.onMouseEnter === 'function') {\n\t\t\t\t\tattributes.onMouseEnter(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor]\n\t\t);\n\n\t\tconst handleOnMouseLeave = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLInputElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\t\t\t\tif (typeof rest.onMouseLeave === 'function') {\n\t\t\t\t\trest.onMouseLeave(e);\n\t\t\t\t}\n\t\t\t\tif (typeof attributes.onMouseLeave === 'function') {\n\t\t\t\t\tattributes.onMouseLeave(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attributes, rest, setHasActiveColor]\n\t\t);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (textInputRef.current) {\n\t\t\t\tif (attributes.autofocus) {\n\t\t\t\t\ttextInputRef.current.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t\t// it should only run on the first render\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []);\n\n\t\tconst stateAllowsClearing = state !== 'disabled' && state !== 'read-only';\n\n\t\tconst inputClasses = classnames(\n\t\t\t'MrlTextInput',\n\t\t\tstyles['MrlTextInput'],\n\t\t\tstyles['mrl-textInput'],\n\t\t\t{\n\t\t\t\t[styles['MrlTextInput--dynamicIcon']]: isClearable && stateAllowsClearing,\n\t\t\t\t[styles['MrlTextInput--persistIcon']]: persistIcon !== undefined,\n\t\t\t\t[styles['MrlTextInput--active']]: hasActiveColor\n\t\t\t},\n\t\t\tattributes.class,\n\t\t\tattributes.className\n\t\t);\n\n\t\tconst hasDynamicIcon =\n\t\t\tstateAllowsClearing && !isClearable && typeof dynamicIcon !== 'undefined';\n\n\t\tconst dataMaxLength = attrs['data-maxlength'];\n\n\t\tconst hasMaxLength = typeof maxLength !== 'undefined' && Number(maxLength) > 0;\n\t\tconst hasDataMaxLength = typeof dataMaxLength !== 'undefined' && Number(dataMaxLength) > 0;\n\n\t\tif (hasMaxLength && isNaN(Number(maxLength))) {\n\t\t\tthrow new Error('maxLength should have type number');\n\t\t}\n\t\tif (hasDataMaxLength && isNaN(Number(dataMaxLength))) {\n\t\t\tthrow new Error('data-maxlength should have type number');\n\t\t}\n\n\t\tif (hasMaxLength && hasDataMaxLength) {\n\t\t\tthrow new Error('maxLength and data-maxlength should not be used at the same time');\n\t\t}\n\n\t\tconst displayCounter = hasMaxLength || hasDataMaxLength;\n\t\tconst counterDisplayValue = hasDataMaxLength ? dataMaxLength : maxLength;\n\t\tconst valueExceedsDataMaxLength = dataMaxLength && value ? value.length > dataMaxLength : false;\n\n\t\t// @todo - 2563 - move to setAttributes\n\t\tdelete attributes.class;\n\t\tdelete attributes.className;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className={styles['mrl-u-focus-wrapper']}>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t{...attributes}\n\t\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\t\tclassName={inputClasses}\n\t\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\t\tmaxLength={hasMaxLength ? maxLength : undefined}\n\t\t\t\t\t\tonBlur={handleOnBlur}\n\t\t\t\t\t\tonFocus={handleOnFocus}\n\t\t\t\t\t\tonMouseEnter={handleOnMouseEnter}\n\t\t\t\t\t\tonMouseLeave={handleOnMouseLeave}\n\t\t\t\t\t\tid={inputId}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\treadOnly={state === 'read-only'}\n\t\t\t\t\t\tref={textInputRef}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t/>\n\t\t\t\t\t<span className={styles['mrl-u-focus-indicator']}></span>\n\t\t\t\t\t{persistIcon && (\n\t\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tclassName={classnames(styles['MrlTextInput-persistIcon'], {\n\t\t\t\t\t\t\t\t[styles['MrlTextInput-persistIcon--active']]: hasActiveColor,\n\t\t\t\t\t\t\t\t[styles['MrlTextInput-persistIcon--disabled']]: state === 'disabled'\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tsvg={persistIcon}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tonMouseEnter={() => setHasActiveColor(true)}\n\t\t\t\t\t\t\tonMouseLeave={() => setHasActiveColor(false)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{/* the clear icon should not be displayed when the input is disabled */}\n\t\t\t\t\t{stateAllowsClearing && hasValue() && isClearable && (\n\t\t\t\t\t\t<MrlTextInputRightIcon\n\t\t\t\t\t\t\taction={clearInput}\n\t\t\t\t\t\t\ticon={closeAlt}\n\t\t\t\t\t\t\tlabel=\"Clear input\"\n\t\t\t\t\t\t\tdataQa={attributes['data-qa'] && `${attributes['data-qa']}-clear`}\n\t\t\t\t\t\t\thasActiveColor={hasActiveColor}\n\t\t\t\t\t\t\tsetHasActiveColor={setHasActiveColor}\n\t\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{hasDynamicIcon && (\n\t\t\t\t\t\t<MrlTextInputRightIcon\n\t\t\t\t\t\t\thasActiveColor={hasActiveColor}\n\t\t\t\t\t\t\tsetHasActiveColor={setHasActiveColor}\n\t\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\t\t{...dynamicIcon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{displayCounter && (\n\t\t\t\t\t<span className={classnames(styles['MrlForm-counter'], 'MrlForm-counter')}>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={classnames('MrlCounter', {\n\t\t\t\t\t\t\t\t'MrlCounter-overMaxLength': valueExceedsDataMaxLength\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tid={`${inputId}-visible-counter`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{value?.length || 0}/{counterDisplayValue}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<p style={{ display: 'none' }} id={`${inputId}-counter`}>\n\t\t\t\t\t\t\t{`${\n\t\t\t\t\t\t\t\tcounterDisplayValue - (value?.length || 0)\n\t\t\t\t\t\t\t} of ${counterDisplayValue} characters remaining`}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t}\n);\n"],"names":["MrlTextInput","React","forwardRef","_ref","ref","_ref$attrs","attrs","inputId","isClearable","dynamicIcon","hookClear","maxLength","persistIcon","placeholder","state","eventId","value","ariaDescribedByProp","rest","_objectWithoutProperties","_excluded","textInputRef","useRef","valueOnFocusRef","trackInteraction","useMrlTrackInteraction","_useActiveColor","useActiveColor","hasActiveColor","setHasActiveColor","useImperativeHandle","current","clearInput","useCallback","action","focus","hasValue","_textInputRef$current","initialAttributes","setAttributes","ariaDescribedByAttrs","attributes","_excluded2","ariaDescribedBy","handleOnBlur","e","target","onBlur","handleOnFocus","onFocus","handleOnMouseEnter","onMouseEnter","handleOnMouseLeave","onMouseLeave","useEffect","autofocus","stateAllowsClearing","inputClasses","classnames","styles","undefined","class","className","hasDynamicIcon","dataMaxLength","hasMaxLength","Number","hasDataMaxLength","isNaN","Error","displayCounter","counterDisplayValue","valueExceedsDataMaxLength","length","createElement","Fragment","_extends","type","disabled","id","readOnly","MrlSvg","svg","size","MrlTextInputRightIcon","icon","closeAlt","label","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AI,CAAC,EAAC,GAAC,EAACF,mBACjB,CAAC,eACPtE,KAAA,CAAAyE,aAAA,CAAA,GAAA,EAAA;AAAGgB,IAAAA,KAAK,EAAE;AAAEC,MAAAA,OAAO,EAAE;KAAS;IAACZ,EAAE,EAAA,EAAA,CAAAU,MAAA,CAAKlF,OAAO,EAAA,UAAA;GAAW,EAAA,EAAA,CAAAkF,MAAA,CAEtDlB,mBAAmB,IAAI,CAAAvD,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,GAAA,MAAA,GAALA,KAAK,CAAEyD,MAAM,KAAI,CAAC,CAAC,EAAA,MAAA,CAAA,CAAAgB,MAAA,CACpClB,mBAAmB,EAAA,uBAAA,CACxB,CACE,CAEN,CAAC;AAEL,CACD;;;;"}
@@ -1,46 +1,40 @@
1
1
  import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import * as React from 'react';
3
3
  import classnames from 'classnames';
4
- import { GRID_SIZE_KEYS } from '../constants.js';
4
+ import { GridSizes } from '../constants.js';
5
5
 
6
- var _excluded = ["children", "className", "col", "lg", "md", "sm", "xl", "xs", "xxl"];
7
- /**
8
- * Builds a single grid class. The base tier (`col`) and the deprecated `xs`
9
- * alias are un-prefixed; every other breakpoint carries its infix.
10
- * @param size - breakpoint key
11
- * @param type - `col` or `offset`
12
- * @param val - column count, or `auto`
13
- * @returns the grid class name
14
- */
15
- var getGridClass = (size, type, val) => size === 'col' || size === 'xs' ? "".concat(type, "-").concat(val) : "".concat(type, "-").concat(size, "-").concat(val);
6
+ var _excluded = ["children", "className"];
7
+ var getBootstrapClass = (size, type, val) => size === 'col' || size === 'xs' ? "".concat(type, "-").concat(val) : "".concat(type, "-").concat(size, "-").concat(val);
16
8
 
17
9
  /**
18
10
  * Creates the size classes for the grid.
19
11
  * @param props - component props
20
- * @returns an array of size classes
12
+ * @returns an array of size classes based on bootstrap grid API
21
13
  */
22
14
  var createSizeClasses = props => {
23
15
  var classes = [];
24
- for (var size of GRID_SIZE_KEYS) {
16
+ for (var size of GridSizes) {
25
17
  // get the value based on the prop key from the component props
26
18
  var value = props[size];
27
19
 
28
- // create the size class based on the value
20
+ // create the size class based on the value using the bootstrap grid API
29
21
  if (value) {
30
- // if the value is a number or `auto`, then it is a column size
31
- if (typeof value === 'number' || typeof value === 'string') {
32
- classes.push(getGridClass(size, 'col', value));
22
+ // if the value is a number, then it is a column size
23
+ if (typeof value === 'number') {
24
+ classes.push(getBootstrapClass(size, 'col', value));
33
25
  continue;
34
26
  }
35
27
 
36
28
  // if the value is an object, then we need to compose multiple classes
37
29
  // based on the keyvalue pairings
38
- for (var _ref3 of Object.entries(value)) {
39
- var _ref2 = _slicedToArray(_ref3, 2);
40
- var key = _ref2[0];
41
- var val = _ref2[1];
42
- if (val === 0 || val === undefined) continue;
43
- classes.push(getGridClass(size, key, val));
30
+ if (value !== null && typeof value === 'object') {
31
+ for (var _ref3 of Object.entries(value)) {
32
+ var _ref2 = _slicedToArray(_ref3, 2);
33
+ var key = _ref2[0];
34
+ var val = _ref2[1];
35
+ if (val === 0 || val === undefined) continue;
36
+ classes.push(getBootstrapClass(size, key, val));
37
+ }
44
38
  }
45
39
  }
46
40
  }
@@ -49,31 +43,44 @@ var createSizeClasses = props => {
49
43
  };
50
44
 
51
45
  /**
52
- * MrlCol React component. Creates a grid column.
53
- * @param props - component props
54
- * @returns a MrlCol React component.
46
+ * Gets the grid size props from the component props.
47
+ * @param props - component props
48
+ * @returns object of grid size props
55
49
  */
56
- function MrlCol(_ref4) {
57
- var children = _ref4.children,
58
- className = _ref4.className,
59
- col = _ref4.col,
60
- lg = _ref4.lg,
61
- md = _ref4.md,
62
- sm = _ref4.sm,
63
- xl = _ref4.xl,
64
- xs = _ref4.xs,
65
- xxl = _ref4.xxl,
66
- rest = _objectWithoutProperties(_ref4, _excluded);
67
- var columnClasses = createSizeClasses({
50
+ var getGridProps = props => {
51
+ var col = props.col,
52
+ xs = props.xs,
53
+ sm = props.sm,
54
+ md = props.md,
55
+ lg = props.lg,
56
+ xl = props.xl,
57
+ xxl = props.xxl;
58
+
59
+ // eslint-disable-next-line sort-keys
60
+ return {
68
61
  col,
69
- lg,
70
- md,
62
+ xs,
71
63
  sm,
64
+ md,
65
+ lg,
72
66
  xl,
73
- xs,
74
67
  xxl
75
- });
76
- var allClasses = classnames(className, 'MrlCol', columnClasses);
68
+ };
69
+ };
70
+
71
+ /**
72
+ * MrlCol React component.
73
+ * @param props - component props
74
+ * @returns a MrlCol React component.
75
+ */
76
+ function MrlCol(props) {
77
+ var children = props.children,
78
+ _props$className = props.className,
79
+ className = _props$className === void 0 ? '' : _props$className,
80
+ rest = _objectWithoutProperties(props, _excluded);
81
+ var gridProps = getGridProps(props);
82
+ var columnClasses = React.useMemo(() => createSizeClasses(gridProps), [gridProps]);
83
+ var allClasses = classnames(className, columnClasses);
77
84
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
78
85
  className: allClasses
79
86
  }), children);
@@ -1 +1 @@
1
- {"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { GRID_SIZE_KEYS, GridBaseProps, GridColumns } from '../constants';\n\nexport type MrlColProps = GridColumns & GridBaseProps;\n\n/**\n * Builds a single grid class. The base tier (`col`) and the deprecated `xs`\n * alias are un-prefixed; every other breakpoint carries its infix.\n * @param size - breakpoint key\n * @param type - `col` or `offset`\n * @param val - column count, or `auto`\n * @returns the grid class name\n */\nconst getGridClass = (size: string, type: string, val: number | string): string =>\n\tsize === 'col' || size === 'xs' ? `${type}-${val}` : `${type}-${size}-${val}`;\n\n/**\n * Creates the size classes for the grid.\n * @param props - component props\n * @returns an array of size classes\n */\nconst createSizeClasses = (props: GridColumns): string[] => {\n\tconst classes: string[] = [];\n\n\tfor (const size of GRID_SIZE_KEYS) {\n\t\t// get the value based on the prop key from the component props\n\t\tconst value = props[size];\n\n\t\t// create the size class based on the value\n\t\tif (value) {\n\t\t\t// if the value is a number or `auto`, then it is a column size\n\t\t\tif (typeof value === 'number' || typeof value === 'string') {\n\t\t\t\tclasses.push(getGridClass(size, 'col', value));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// if the value is an object, then we need to compose multiple classes\n\t\t\t// based on the keyvalue pairings\n\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\tif (val === 0 || val === undefined) continue;\n\t\t\t\tclasses.push(getGridClass(size, key, val as number));\n\t\t\t}\n\t\t}\n\t}\n\n\tif (classes.length === 0) classes.push('col');\n\n\treturn classes;\n};\n\n/**\n * MrlCol React component. Creates a grid column.\n * @param props - component props\n * @returns a MrlCol React component.\n */\nexport function MrlCol({\n\tchildren,\n\tclassName,\n\tcol,\n\tlg,\n\tmd,\n\tsm,\n\txl,\n\txs,\n\txxl,\n\t...rest\n}: MrlColProps): JSX.Element {\n\tconst columnClasses = createSizeClasses({ col, lg, md, sm, xl, xs, xxl });\n\tconst allClasses = classnames(className, 'MrlCol', columnClasses);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["getGridClass","size","type","val","concat","createSizeClasses","props","classes","GRID_SIZE_KEYS","value","push","_ref3","Object","entries","_ref2","_slicedToArray","key","undefined","length","MrlCol","_ref4","children","className","col","lg","md","sm","xl","xs","xxl","rest","_objectWithoutProperties","_excluded","columnClasses","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,YAAY,GAAGA,CAACC,IAAY,EAAEC,IAAY,EAAEC,GAAoB,KACrEF,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,IAAI,GAAA,EAAA,CAAAG,MAAA,CAAMF,IAAI,OAAAE,MAAA,CAAID,GAAG,CAAA,GAAA,EAAA,CAAAC,MAAA,CAAQF,IAAI,EAAA,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SAAS,GAAAF,KAAA,CAATE,SAAS;IACTC,GAAG,GAAAH,KAAA,CAAHG,GAAG;IACHC,EAAE,GAAAJ,KAAA,CAAFI,EAAE;IACFC,EAAE,GAAAL,KAAA,CAAFK,EAAE;IACFC,EAAE,GAAAN,KAAA,CAAFM,EAAE;IACFC,EAAE,GAAAP,KAAA,CAAFO,EAAE;IACFC,EAAE,GAAAR,KAAA,CAAFQ,EAAE;IACFC,GAAG,GAAAT,KAAA,CAAHS,GAAG;AACAC,IAAAA,IAAI,GAAAC,wBAAA,CAAAX,KAAA,EAAAY,SAAA,CAAA;EAEP,IAAMC,aAAa,GAAG5B,iBAAiB,CAAC;IAAEkB,GAAG;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;AAAEC,IAAAA;AAAI,GAAC,CAAC;EACzE,IAAMK,UAAU,GAAGC,UAAU,CAACb,SAAS,EAAE,QAAQ,EAAEW,aAAa,CAAC;AAEjE,EAAA,oBACCG,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASR,IAAI,EAAA;AAAER,IAAAA,SAAS,EAAEY;AAAW,GAAA,CAAA,EACnCb,QACG,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport { GridSizes, GridColumns } from '../constants';\n\ntype MrlCol = LayoutComponent & GridColumns;\n\nconst getBootstrapClass = (size: string, type: string, val: number | string): string =>\n\tsize === 'col' || size === 'xs' ? `${type}-${val}` : `${type}-${size}-${val}`;\n\n/**\n * Creates the size classes for the grid.\n * @param props - component props\n * @returns an array of size classes based on bootstrap grid API\n */\nconst createSizeClasses = (props: GridColumns): string[] => {\n\tconst classes: string[] = [];\n\n\tfor (const size of GridSizes) {\n\t\t// get the value based on the prop key from the component props\n\t\tconst value = props[size as keyof GridColumns];\n\n\t\t// create the size class based on the value using the bootstrap grid API\n\t\tif (value) {\n\t\t\t// if the value is a number, then it is a column size\n\t\t\tif (typeof value === 'number') {\n\t\t\t\tclasses.push(getBootstrapClass(size, 'col', value));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// if the value is an object, then we need to compose multiple classes\n\t\t\t// based on the keyvalue pairings\n\t\t\tif (value !== null && typeof value === 'object') {\n\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\tif (val === 0 || val === undefined) continue;\n\t\t\t\t\tclasses.push(getBootstrapClass(size, key, val as number));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (classes.length === 0) classes.push('col');\n\n\treturn classes;\n};\n\n/**\n * Gets the grid size props from the component props.\n * @param props - component props\n * @returns object of grid size props\n */\nconst getGridProps = (props: MrlCol): GridColumns => {\n\tconst { col, xs, sm, md, lg, xl, xxl } = props;\n\n\t// eslint-disable-next-line sort-keys\n\treturn { col, xs, sm, md, lg, xl, xxl };\n};\n\n/**\n * MrlCol React component.\n * @param props - component props\n * @returns a MrlCol React component.\n */\nexport function MrlCol(props: MrlCol): JSX.Element {\n\tconst { children, className = '', ...rest } = props;\n\tconst gridProps = getGridProps(props);\n\n\tconst columnClasses = React.useMemo(() => createSizeClasses(gridProps), [gridProps]);\n\tconst allClasses = classnames(className, columnClasses);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["getBootstrapClass","size","type","val","concat","createSizeClasses","props","classes","GridSizes","value","push","_ref3","Object","entries","_ref2","_slicedToArray","key","undefined","length","getGridProps","col","xs","sm","md","lg","xl","xxl","MrlCol","children","_props$className","className","rest","_objectWithoutProperties","_excluded","gridProps","columnClasses","React","useMemo","allClasses","classnames","createElement","_extends"],"mappings":";;;;;;AAOA,IAAMA,iBAAiB,GAAGA,CAACC,IAAY,EAAEC,IAAY,EAAEC,GAAoB,KAC1EF,IAAI,KAA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,EAAA;AAAED,IAAAA,SAAS,EAAEQ;AAAW,GAAA,CAAA,EACnCV,QACG,CAAC;AAER;;;;"}
@@ -3,16 +3,18 @@ import * as React from 'react';
3
3
  import classnames from 'classnames';
4
4
 
5
5
  var _excluded = ["children", "className"];
6
+
6
7
  /**
7
- * MrlGrid React component. Primary container of a grid.
8
+ * MrlCol React component.
8
9
  * @param props - component props
9
- * @returns a MrlGrid React component.
10
+ * @returns a MrlCol React component.
10
11
  */
11
12
  function MrlGrid(_ref) {
12
13
  var children = _ref.children,
13
- className = _ref.className,
14
+ _ref$className = _ref.className,
15
+ className = _ref$className === void 0 ? '' : _ref$className,
14
16
  rest = _objectWithoutProperties(_ref, _excluded);
15
- var allClasses = classnames('container', 'MrlGrid', className);
17
+ var allClasses = classnames('container', className);
16
18
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
17
19
  className: allClasses
18
20
  }), children);
@@ -1 +1 @@
1
- {"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { GridBaseProps } from '../constants';\nimport '../grid.variables.scss';\nimport '../grid.global.scss';\n\nexport type MrlGridProps = GridBaseProps;\n\n/**\n * MrlGrid React component. Primary container of a grid.\n * @param props - component props\n * @returns a MrlGrid React component.\n */\nexport function MrlGrid({ children, className, ...rest }: MrlGridProps): JSX.Element {\n\tconst allClasses = classnames('container', 'MrlGrid', className);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlGrid","_ref","children","className","rest","_objectWithoutProperties","_excluded","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;AAQA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAAC,IAAA,EAA8D;AAAA,EAAA,IAA3DC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA,CAAA;EACrD,IAAMC,UAAU,GAAGC,UAAU,CAAC,WAAW,EAAE,SAAS,EAAEL,SAAS,CAAC;AAEhE,EAAA,oBACCM,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASP,IAAI,EAAA;AAAED,IAAAA,SAAS,EAAEI;AAAW,GAAA,CAAA,EACnCL,QACG,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport '../grid.variables.scss';\nimport '../grid.global.scss';\n\n/**\n * MrlCol React component.\n * @param props - component props\n * @returns a MrlCol React component.\n */\nexport function MrlGrid({ children, className = '', ...rest }: LayoutComponent): JSX.Element {\n\tconst allClasses = classnames('container', className);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlGrid","_ref","children","_ref$className","className","rest","_objectWithoutProperties","_excluded","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAAC,IAAA,EAAsE;AAAA,EAAA,IAAnEC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,cAAA,GAAAF,IAAA,CAAEG,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;AAAKE,IAAAA,IAAI,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA;AAC1D,EAAA,IAAMC,UAAU,GAAGC,UAAU,CAAC,WAAW,EAAEL,SAAS,CAAC;AAErD,EAAA,oBACCM,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASP,IAAI,EAAA;AAAED,IAAAA,SAAS,EAAEI;AAAW,GAAA,CAAA,EACnCN,QACG,CAAC;AAER;;;;"}
@@ -1,28 +1,26 @@
1
1
  import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import * as React from 'react';
3
3
  import classnames from 'classnames';
4
- import { GUTTER_CLASS } from '../constants.js';
5
4
 
6
- var _excluded = ["align", "children", "className", "gutter", "justify"];
5
+ var _excluded = ["align", "children", "className", "justify"];
7
6
  /**
8
- * MrlRow React component. Creates a grid row.
7
+ * MrlRow React component.
9
8
  * @param props - component props
10
9
  * @returns a MrlRow React component.
11
10
  */
12
11
  function MrlRow(_ref) {
13
12
  var align = _ref.align,
14
13
  children = _ref.children,
15
- className = _ref.className,
16
- _ref$gutter = _ref.gutter,
17
- gutter = _ref$gutter === void 0 ? 1 : _ref$gutter,
14
+ _ref$className = _ref.className,
15
+ className = _ref$className === void 0 ? '' : _ref$className,
18
16
  justify = _ref.justify,
19
17
  rest = _objectWithoutProperties(_ref, _excluded);
20
- var alignClass = align && "align-items-".concat(align);
18
+ var alignClass = align ? "align-items-".concat(align) : '';
21
19
  var justifyClass = justify && "justify-content-".concat(justify);
22
- var allClasses = classnames('row', 'MrlRow', className, alignClass, justifyClass, GUTTER_CLASS[gutter]);
23
- return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
20
+ var allClasses = classnames('row', className, alignClass, justifyClass);
21
+ return /*#__PURE__*/React.createElement("div", _extends({
24
22
  className: allClasses
25
- }), children);
23
+ }, rest), children);
26
24
  }
27
25
 
28
26
  export { MrlRow };
@@ -1 +1 @@
1
- {"version":3,"file":"MrlRow.js","sources":["../../../../../src/components/grid/MrlRow/MrlRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tAlignOptions,\n\tGridBaseProps,\n\tGUTTER_CLASS,\n\tGutterSizes,\n\tJustifyOptions\n} from '../constants';\n\nexport interface MrlRowProps extends GridBaseProps {\n\t/**\n\t * Flex alignment of the children within the component.\n\t */\n\talign?: AlignOptions;\n\n\t/**\n\t * Gutter size for columns within the row.\n\t *\n\t * @default 1\n\t */\n\tgutter?: GutterSizes;\n\n\t/**\n\t * Justify content of the children within the component.\n\t */\n\tjustify?: JustifyOptions;\n}\n\n/**\n * MrlRow React component. Creates a grid row.\n * @param props - component props\n * @returns a MrlRow React component.\n */\nexport function MrlRow({\n\talign,\n\tchildren,\n\tclassName,\n\tgutter = 1,\n\tjustify,\n\t...rest\n}: MrlRowProps): JSX.Element {\n\tconst alignClass = align && `align-items-${align}`;\n\tconst justifyClass = justify && `justify-content-${justify}`;\n\n\tconst allClasses = classnames(\n\t\t'row',\n\t\t'MrlRow',\n\t\tclassName,\n\t\talignClass,\n\t\tjustifyClass,\n\t\tGUTTER_CLASS[gutter]\n\t);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlRow","_ref","align","children","className","_ref$gutter","gutter","justify","rest","_objectWithoutProperties","_excluded","alignClass","concat","justifyClass","allClasses","classnames","GUTTER_CLASS","React","createElement","_extends"],"mappings":";;;;;;AA6BA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAAAC,IAAA,EAOO;AAAA,EAAA,IAN5BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAAC,WAAA,GAAAJ,IAAA,CACTK,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,MAAA,GAAG,CAAC,GAAAA,WAAA;IACVE,OAAO,GAAAN,IAAA,CAAPM,OAAO;AACJC,IAAAA,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA;AAEP,EAAA,IAAMC,UAAU,GAAGT,KAAK,mBAAAU,MAAA,CAAmBV,KAAK,CAAE;AAClD,EAAA,IAAMW,YAAY,GAAGN,OAAO,uBAAAK,MAAA,CAAuBL,OAAO,CAAE;AAE5D,EAAA,IAAMO,UAAU,GAAGC,UAAU,CAC5B,KAAK,EACL,QAAQ,EACRX,SAAS,EACTO,UAAU,EACVE,YAAY,EACZG,YAAY,CAACV,MAAM,CACpB,CAAC;AAED,EAAA,oBACCW,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASX,IAAI,EAAA;AAAEJ,IAAAA,SAAS,EAAEU;AAAW,GAAA,CAAA,EACnCX,QACG,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlRow.js","sources":["../../../../../src/components/grid/MrlRow/MrlRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport { AlignOptions, GutterSizes, JustifyOptions } from '../constants';\n\ninterface MrlRow extends LayoutComponent {\n\t/**\n\t * Flex alignment of the children within the component.\n\t */\n\talign?: AlignOptions;\n\n\t/**\n\t * Gutter size for columns within the row\n\t */\n\tgutter?: GutterSizes;\n\n\t/**\n\t * Justify content of the children within the component.\n\t */\n\tjustify?: JustifyOptions;\n}\n\n/**\n * MrlRow React component.\n * @param props - component props\n * @returns a MrlRow React component.\n */\nexport function MrlRow({ align, children, className = '', justify, ...rest }: MrlRow): JSX.Element {\n\tconst alignClass = align ? `align-items-${align}` : '';\n\tconst justifyClass = justify && `justify-content-${justify}`;\n\n\tconst allClasses = classnames('row', className, alignClass, justifyClass);\n\n\treturn (\n\t\t<div className={allClasses} {...rest}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlRow","_ref","align","children","_ref$className","className","justify","rest","_objectWithoutProperties","_excluded","alignClass","concat","justifyClass","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;AAsBA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAAAC,IAAA,EAA6E;AAAA,EAAA,IAA1EC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,cAAA,GAAAH,IAAA,CAAEI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IAAEE,OAAO,GAAAL,IAAA,CAAPK,OAAO;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA;EACzE,IAAMC,UAAU,GAAGR,KAAK,GAAA,cAAA,CAAAS,MAAA,CAAkBT,KAAK,IAAK,EAAE;AACtD,EAAA,IAAMU,YAAY,GAAGN,OAAO,uBAAAK,MAAA,CAAuBL,OAAO,CAAE;EAE5D,IAAMO,UAAU,GAAGC,UAAU,CAAC,KAAK,EAAET,SAAS,EAAEK,UAAU,EAAEE,YAAY,CAAC;AAEzE,EAAA,oBACCG,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAKZ,IAAAA,SAAS,EAAEQ;GAAW,EAAKN,IAAI,CAAA,EAClCJ,QACG,CAAC;AAER;;;;"}
@@ -2,15 +2,20 @@
2
2
  * Alignment & justification options for grid containers
3
3
  */
4
4
 
5
+ /**
6
+ * Available grid sizes
7
+ */
8
+ var GridSizes = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
9
+
5
10
  /**
6
11
  * Number of columns that will be span on the grid.
7
12
  */
8
13
 
9
14
  /**
10
- * The grid classes that can be configured per breakpoint.
15
+ * The type of classes that can be configured based on the bootstrap API.
11
16
  * Current supported:
12
17
  * - columns "col-<size>-<number>"
13
- * - offsets "offset-<size>-<number>"
18
+ * - offsets "offset-<size>-<number>""
14
19
  */
15
20
 
16
21
  /**
@@ -27,32 +32,9 @@
27
32
  * Options to configure the number of columns to span on different screen sizes.
28
33
  */
29
34
 
30
- /**
31
- * Breakpoint keys in ascending order. Drives both class generation and the
32
- * filtering that keeps grid props from reaching the DOM.
33
- */
34
- var GRID_SIZE_KEYS = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
35
-
36
35
  /**
37
36
  * Available gutter sizes for customizing the grid
38
37
  */
39
38
 
40
- /**
41
- * Gutter size to modifier class. `1` is the default gutter declared on `:root`,
42
- * so it needs no class.
43
- */
44
- var GUTTER_CLASS = {
45
- 0: 'MrlRow-gutter--none',
46
- 1: undefined,
47
- 2: 'MrlRow-gutter--double'
48
- };
49
-
50
- /**
51
- * Shared props for the grid components. `role` is intentionally omitted: these
52
- * are generic layout wrappers, and a `role="grid"` would promise interactive
53
- * grid keyboard semantics that they do not implement. Page landmarks belong to
54
- * the layout components (MrlMain, MrlPage).
55
- */
56
-
57
- export { GRID_SIZE_KEYS, GUTTER_CLASS };
39
+ export { GridSizes };
58
40
  //# sourceMappingURL=constants.js.map
@@ -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 that will be span on the grid.\n */\nexport type NumCols = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * The grid classes that can be configured per breakpoint.\n * Current supported:\n * - columns \"col-<size>-<number>\"\n * - offsets \"offset-<size>-<number>\"\n */\ntype GridClass = 'col' | 'offset';\n\n/**\n * Interface of available class selectors based on GridClass\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\ntype GridClassConfig = {\n\t[key in GridClass]?: NumCols;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\ntype ColumnConfig = NumCols | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/*\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/*\n\t * @deprecated Alias of `col`, kept for backwards compatibility.\n\t */\n\txs?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on small devices.\n\t */\n\tsm?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on medium devices.\n\t */\n\tmd?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on large devices.\n\t */\n\tlg?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on extra large devices.\n\t */\n\txl?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on extra extra large devices.\n\t */\n\txxl?: ColumnConfig;\n}\n\n/**\n * 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 gutter declared on `:root`,\n * so it 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 * Shared props for the grid components. `role` is intentionally omitted: these\n * are generic layout wrappers, and a `role=\"grid\"` would promise interactive\n * grid keyboard semantics that they do not implement. Page landmarks belong to\n * the layout components (MrlMain, MrlPage).\n */\nexport type GridBaseProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'role'> & DataQa;\n"],"names":["GRID_SIZE_KEYS","GUTTER_CLASS","undefined"],"mappings":"AAEA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAwCA;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;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["/**\n * Alignment & justification options for grid containers\n */\nexport type AlignOptions = 'start' | 'center' | 'end';\nexport type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';\n\n/**\n * Available grid sizes\n */\nexport const GridSizes = [\n\t'col',\n\t'xs',\n\t'sm',\n\t'md',\n\t'lg',\n\t'xl',\n\t'xxl'\n];\n\n/**\n * Number of columns that will be span on the grid.\n */\nexport type NumCols = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * The type of classes that can be configured based on the bootstrap API.\n * Current supported:\n * - columns \"col-<size>-<number>\"\n * - offsets \"offset-<size>-<number>\"\"\n */\ntype GridClass = 'col' | 'offset';\n\n/**\n * Interface of available class selectors based on GridClass\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\ntype GridClassConfig = {\n\t[key in GridClass]?: NumCols;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\ntype ColumnConfig = NumCols | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/*\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/*\n\t * @deprecated xs maps to col. Bootstrap grid removed xs in favor of col.\n\t */\n\txs?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on small devices.\n\t */\n\tsm?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on medium devices.\n\t */\n\tmd?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on large devices.\n\t */\n\tlg?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on extra large devices.\n\t */\n\txl?: ColumnConfig;\n\n\t/*\n\t * The number of columns to span on extra extra large devices.\n\t */\n\txxl?: ColumnConfig;\n}\n\n/**\n * Available gutter sizes for customizing the grid\n */\nexport type GutterSizes = 0 | 1 | 2;\n"],"names":["GridSizes"],"mappings":"AAAA;AACA;AACA;;AAIA;AACA;AACA;IACaA,SAAS,GAAG,CACxB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK;;AAGN;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAwCA;AACA;AACA;;;;"}