@muraldevkit/ui-toolkit 4.79.1 → 4.81.0-dev-Rwvu.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/avatar/MrlAvatar/MrlAvatar.js.map +1 -1
- package/dist/cjs/components/badge/MrlBadge/MrlBadge.js.map +1 -1
- package/dist/cjs/components/badge/MrlBadgeNotification/MrlBadgeNotification.js.map +1 -1
- package/dist/cjs/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js.map +1 -1
- package/dist/cjs/components/callout/MrlCallout/MrlCallout.js.map +1 -1
- package/dist/cjs/components/empty/default/MrlEmpty.js.map +1 -1
- package/dist/cjs/components/empty/large/MrlEmptyLarge.js.map +1 -1
- package/dist/cjs/components/form/date-picker/MrlDatePicker.js.map +1 -1
- package/dist/cjs/components/form/select/MrlCreatableSelect/MrlCreatableSelect.js.map +1 -1
- package/dist/cjs/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.js.map +1 -1
- package/dist/cjs/components/form/select/MrlMultiSelect/MrlMultiSelect.js.map +1 -1
- package/dist/cjs/components/form/select/MrlSelect/MrlSelect.js.map +1 -1
- package/dist/cjs/components/form/switch/MrlSwitch/MrlSwitch.js.map +1 -1
- package/dist/cjs/components/form/text-input/MrlEditableTextInput/MrlEditableTextInput.js.map +1 -1
- package/dist/cjs/components/form/textarea/MrlEditableTextarea/MrlEditableTextarea.js.map +1 -1
- package/dist/cjs/components/grid/MrlCol/MrlCol.js +58 -55
- package/dist/cjs/components/grid/MrlCol/MrlCol.js.map +1 -1
- package/dist/cjs/components/grid/MrlGrid/MrlGrid.js +3 -5
- package/dist/cjs/components/grid/MrlGrid/MrlGrid.js.map +1 -1
- package/dist/cjs/components/grid/MrlRow/MrlRow.js +10 -8
- package/dist/cjs/components/grid/MrlRow/MrlRow.js.map +1 -1
- package/dist/cjs/components/grid/constants.js +47 -9
- package/dist/cjs/components/grid/constants.js.map +1 -1
- package/dist/cjs/components/layout/MrlSidebar/MrlSidebar.js.map +1 -1
- package/dist/cjs/components/live-region/MrlLiveRegion/MrlLiveRegion.js.map +1 -1
- package/dist/cjs/components/notification/MrlToast/MrlToast.js.map +1 -1
- package/dist/cjs/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
- package/dist/cjs/components/portal/MrlPortal.js.map +1 -1
- package/dist/cjs/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.js.map +1 -1
- package/dist/cjs/components/svg/MrlSvg/MrlSvg.js.map +1 -1
- package/dist/cjs/components/table/MrlTableCell/MrlTableCell.js.map +1 -1
- package/dist/cjs/components/table/MrlTableColumn/MrlTableColumn.js.map +1 -1
- package/dist/cjs/components/tabs/MrlTab/MrlTab.js.map +1 -1
- package/dist/cjs/components/tabs/MrlTabGroup/MrlTabGroup.js.map +1 -1
- package/dist/cjs/components/tabs/MrlTabLink/MrlTabLink.js.map +1 -1
- package/dist/cjs/components/tabs/MrlTabs/MrlTabs.js.map +1 -1
- package/dist/cjs/components/text/MrlTextHeading/MrlTextHeading.js.map +1 -1
- package/dist/cjs/components/toolbar/MrlToolbar/MrlToolbar.js.map +1 -1
- package/dist/cjs/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/components/avatar/MrlAvatar/MrlAvatar.d.ts +8 -0
- package/dist/components/badge/MrlBadge/MrlBadge.d.ts +2 -0
- package/dist/components/badge/MrlBadgeNotification/MrlBadgeNotification.d.ts +1 -0
- package/dist/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.d.ts +1 -0
- package/dist/components/callout/MrlCallout/MrlCallout.d.ts +9 -0
- package/dist/components/empty/default/MrlEmpty.d.ts +4 -0
- package/dist/components/empty/large/MrlEmptyLarge.d.ts +4 -0
- package/dist/components/form/date-picker/MrlDatePicker.d.ts +2 -0
- package/dist/components/form/select/MrlCreatableSelect/MrlCreatableSelect.d.ts +4 -0
- package/dist/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.d.ts +4 -0
- package/dist/components/form/select/MrlMultiSelect/MrlMultiSelect.d.ts +3 -0
- package/dist/components/form/select/MrlSelect/MrlSelect.d.ts +3 -0
- package/dist/components/form/switch/MrlSwitch/MrlSwitch.d.ts +3 -0
- package/dist/components/form/text-input/MrlEditableTextInput/MrlEditableTextInput.d.ts +3 -0
- package/dist/components/form/textarea/MrlEditableTextarea/MrlEditableTextarea.d.ts +3 -0
- package/dist/components/grid/MrlCol/MrlCol.d.ts +4 -6
- package/dist/components/grid/MrlCol/index.d.ts +1 -1
- package/dist/components/grid/MrlGrid/MrlGrid.d.ts +4 -4
- package/dist/components/grid/MrlGrid/index.d.ts +1 -1
- package/dist/components/grid/MrlRow/MrlRow.d.ts +7 -7
- package/dist/components/grid/MrlRow/index.d.ts +1 -1
- package/dist/components/grid/constants.d.ts +76 -12
- package/dist/components/grid/index.d.ts +1 -0
- package/dist/components/layout/MrlSidebar/MrlSidebar.d.ts +2 -0
- package/dist/components/live-region/MrlLiveRegion/MrlLiveRegion.d.ts +6 -0
- package/dist/components/notification/MrlToast/MrlToast.d.ts +8 -0
- package/dist/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +1 -0
- package/dist/components/portal/MrlPortal.d.ts +1 -0
- package/dist/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.d.ts +10 -0
- package/dist/components/svg/MrlSvg/MrlSvg.d.ts +1 -0
- package/dist/components/table/MrlTableCell/MrlTableCell.d.ts +3 -0
- package/dist/components/table/MrlTableColumn/MrlTableColumn.d.ts +3 -0
- package/dist/components/tabs/MrlTab/MrlTab.d.ts +2 -0
- package/dist/components/tabs/MrlTabGroup/MrlTabGroup.d.ts +1 -0
- package/dist/components/tabs/MrlTabLink/MrlTabLink.d.ts +1 -0
- package/dist/components/tabs/MrlTabs/MrlTabs.d.ts +2 -0
- package/dist/components/text/MrlTextHeading/MrlTextHeading.d.ts +1 -0
- package/dist/components/toolbar/MrlToolbar/MrlToolbar.d.ts +12 -0
- package/dist/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +2 -0
- package/dist/esm/components/avatar/MrlAvatar/MrlAvatar.js.map +1 -1
- package/dist/esm/components/badge/MrlBadge/MrlBadge.js.map +1 -1
- package/dist/esm/components/badge/MrlBadgeNotification/MrlBadgeNotification.js.map +1 -1
- package/dist/esm/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js.map +1 -1
- package/dist/esm/components/callout/MrlCallout/MrlCallout.js.map +1 -1
- package/dist/esm/components/empty/default/MrlEmpty.js.map +1 -1
- package/dist/esm/components/empty/large/MrlEmptyLarge.js.map +1 -1
- package/dist/esm/components/form/date-picker/MrlDatePicker.js.map +1 -1
- package/dist/esm/components/form/select/MrlCreatableSelect/MrlCreatableSelect.js.map +1 -1
- package/dist/esm/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.js.map +1 -1
- package/dist/esm/components/form/select/MrlMultiSelect/MrlMultiSelect.js.map +1 -1
- package/dist/esm/components/form/select/MrlSelect/MrlSelect.js.map +1 -1
- package/dist/esm/components/form/switch/MrlSwitch/MrlSwitch.js.map +1 -1
- package/dist/esm/components/form/text-input/MrlEditableTextInput/MrlEditableTextInput.js.map +1 -1
- package/dist/esm/components/form/textarea/MrlEditableTextarea/MrlEditableTextarea.js.map +1 -1
- package/dist/esm/components/grid/MrlCol/MrlCol.js +59 -56
- package/dist/esm/components/grid/MrlCol/MrlCol.js.map +1 -1
- package/dist/esm/components/grid/MrlGrid/MrlGrid.js +3 -5
- package/dist/esm/components/grid/MrlGrid/MrlGrid.js.map +1 -1
- package/dist/esm/components/grid/MrlRow/MrlRow.js +10 -8
- package/dist/esm/components/grid/MrlRow/MrlRow.js.map +1 -1
- package/dist/esm/components/grid/constants.js +46 -9
- package/dist/esm/components/grid/constants.js.map +1 -1
- package/dist/esm/components/layout/MrlSidebar/MrlSidebar.js.map +1 -1
- package/dist/esm/components/live-region/MrlLiveRegion/MrlLiveRegion.js.map +1 -1
- package/dist/esm/components/notification/MrlToast/MrlToast.js.map +1 -1
- package/dist/esm/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
- package/dist/esm/components/portal/MrlPortal.js.map +1 -1
- package/dist/esm/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.js.map +1 -1
- package/dist/esm/components/svg/MrlSvg/MrlSvg.js.map +1 -1
- package/dist/esm/components/table/MrlTableCell/MrlTableCell.js.map +1 -1
- package/dist/esm/components/table/MrlTableColumn/MrlTableColumn.js.map +1 -1
- package/dist/esm/components/tabs/MrlTab/MrlTab.js.map +1 -1
- package/dist/esm/components/tabs/MrlTabGroup/MrlTabGroup.js.map +1 -1
- package/dist/esm/components/tabs/MrlTabLink/MrlTabLink.js.map +1 -1
- package/dist/esm/components/tabs/MrlTabs/MrlTabs.js.map +1 -1
- package/dist/esm/components/text/MrlTextHeading/MrlTextHeading.js.map +1 -1
- package/dist/esm/components/toolbar/MrlToolbar/MrlToolbar.js.map +1 -1
- package/dist/esm/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/styles/MrlSidebar/module.scss +2 -2
- package/dist/styles/grid/global.scss +97 -2
- package/dist/styles.css +1 -7
- package/dist/types/components/avatar/MrlAvatar/MrlAvatar.d.ts +8 -0
- package/dist/types/components/badge/MrlBadge/MrlBadge.d.ts +2 -0
- package/dist/types/components/badge/MrlBadgeNotification/MrlBadgeNotification.d.ts +1 -0
- package/dist/types/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.d.ts +1 -0
- package/dist/types/components/callout/MrlCallout/MrlCallout.d.ts +9 -0
- package/dist/types/components/empty/default/MrlEmpty.d.ts +4 -0
- package/dist/types/components/empty/large/MrlEmptyLarge.d.ts +4 -0
- package/dist/types/components/form/date-picker/MrlDatePicker.d.ts +2 -0
- package/dist/types/components/form/select/MrlCreatableSelect/MrlCreatableSelect.d.ts +4 -0
- package/dist/types/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.d.ts +4 -0
- package/dist/types/components/form/select/MrlMultiSelect/MrlMultiSelect.d.ts +3 -0
- package/dist/types/components/form/select/MrlSelect/MrlSelect.d.ts +3 -0
- package/dist/types/components/form/switch/MrlSwitch/MrlSwitch.d.ts +3 -0
- package/dist/types/components/form/text-input/MrlEditableTextInput/MrlEditableTextInput.d.ts +3 -0
- package/dist/types/components/form/textarea/MrlEditableTextarea/MrlEditableTextarea.d.ts +3 -0
- package/dist/types/components/grid/MrlCol/MrlCol.d.ts +4 -6
- package/dist/types/components/grid/MrlCol/index.d.ts +1 -1
- package/dist/types/components/grid/MrlGrid/MrlGrid.d.ts +4 -4
- package/dist/types/components/grid/MrlGrid/index.d.ts +1 -1
- package/dist/types/components/grid/MrlRow/MrlRow.d.ts +7 -7
- package/dist/types/components/grid/MrlRow/index.d.ts +1 -1
- package/dist/types/components/grid/constants.d.ts +76 -12
- package/dist/types/components/grid/index.d.ts +1 -0
- package/dist/types/components/layout/MrlSidebar/MrlSidebar.d.ts +2 -0
- package/dist/types/components/live-region/MrlLiveRegion/MrlLiveRegion.d.ts +6 -0
- package/dist/types/components/notification/MrlToast/MrlToast.d.ts +8 -0
- package/dist/types/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +1 -0
- package/dist/types/components/portal/MrlPortal.d.ts +1 -0
- package/dist/types/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.d.ts +10 -0
- package/dist/types/components/svg/MrlSvg/MrlSvg.d.ts +1 -0
- package/dist/types/components/table/MrlTableCell/MrlTableCell.d.ts +3 -0
- package/dist/types/components/table/MrlTableColumn/MrlTableColumn.d.ts +3 -0
- package/dist/types/components/tabs/MrlTab/MrlTab.d.ts +2 -0
- package/dist/types/components/tabs/MrlTabGroup/MrlTabGroup.d.ts +1 -0
- package/dist/types/components/tabs/MrlTabLink/MrlTabLink.d.ts +1 -0
- package/dist/types/components/tabs/MrlTabs/MrlTabs.d.ts +2 -0
- package/dist/types/components/text/MrlTextHeading/MrlTextHeading.d.ts +1 -0
- package/dist/types/components/toolbar/MrlToolbar/MrlToolbar.d.ts +12 -0
- package/dist/types/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +2 -0
- package/package.json +1 -1
- package/dist/styles/grid/variables.scss +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlEditableTextarea.js","sources":["../../../../../../src/components/form/textarea/MrlEditableTextarea/MrlEditableTextarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { edit, error as errorIcon } from '@muraldevkit/ds-icons';\n\nimport styles from './MrlEditableTextarea.module.scss';\nimport './MrlEditableTextarea.global.scss';\nimport { useIsEditable } from '../../hooks/useIsEditable';\nimport { useActiveColor } from '../../hooks/useActiveColor';\nimport { MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { InputStates, MrlFormInputError } from '../../constants';\nimport { MrlEditableTextareaRightButton } from './MrlEditableTextareaRightButton';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\ninterface MrlEditableTextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n\t/** The value of the textarea used to make it a controlled input */\n\tvalue: string;\n\t/**\n\t * \tValue of the label text assigned to the input.\n\t * This is used to describe to the user what field they will be editing when interacting with the edit buton.\n\t */\n\tinputLabelText: string;\n\t/**\n\t * The maximum number of characters that the user can enter.\n\t * If undefined or set to \"0\", removes the character counter from the textarea\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Id of the text input.\n\t */\n\tinputId: string;\n\t/**\n\t * Text placeholder for the text input.\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Changes the state of the input based on user permissions or actions.\n\t */\n\tstate?: InputStates;\n\t/** Additional class to add to the textarea */\n\tclassName?: string;\n\t'data-qa': string;\n\terror?: MrlFormInputError;\n\t/* Expost isEditable and setIsEditable as optionally controlled state */\n\tisEditable?: boolean;\n\tsetIsEditable?: (isEditableUpdate: boolean) => void;\n\t/** Autoexpand will automatically adjust the height of the textarea based on the amount of text within it */\n\tautoExpand?: boolean;\n\n\t/**\n\t * Enables interaction tracking for this textarea. Provide a stable, non-PII id\n\t * (e.g. 'mural-description'). When omitted, the textarea emits no analytics.\n\t *\n\t * Note: the textarea's value is never emitted, and `change` is emitted once per\n\t * editing session (on blur, when the value actually changed) rather than per keystroke.\n\t */\n\teventId?: string;\n}\n\n/**\n * Allows the user to input plain text in a multi-line format\n * @param {MrlEditableTextareaProps} props - the component props\n * @returns a textarea element\n */\nexport const MrlEditableTextarea = React.forwardRef<HTMLButtonElement, MrlEditableTextareaProps>(\n\tfunction MrlEditableTextarea(\n\t\tprops: MrlEditableTextareaProps,\n\t\tref: React.Ref<HTMLButtonElement>\n\t): JSX.Element {\n\t\tconst {\n\t\t\tautoExpand = false,\n\t\t\tclassName,\n\t\t\tinputId,\n\t\t\tinputLabelText,\n\t\t\tmaxLength,\n\t\t\tplaceholder,\n\t\t\tstate,\n\t\t\tvalue,\n\t\t\terror,\n\t\t\tisEditable: controlledIsEditable,\n\t\t\tsetIsEditable: controlledIsEditableUpdate,\n\t\t\teventId,\n\t\t\t...attrs\n\t\t} = props;\n\n\t\t// html id to be reference by input and error description to relay the error for a specific input\n\t\tconst describedById = `${inputId}-description`;\n\t\tconst textareaRef = React.useRef<HTMLTextAreaElement>(null);\n\t\tconst iconRef = React.useRef<HTMLButtonElement>(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('MrlEditableTextarea', eventId);\n\n\t\tconst { hasActiveColor, setHasActiveColor } = useActiveColor(state);\n\t\tconst { isEditable, isEditing, setIsEditable, setIsEditing } = useIsEditable({\n\t\t\tchangeHandler: controlledIsEditableUpdate,\n\t\t\tinitialValue: false,\n\t\t\tstate,\n\t\t\tvalue: controlledIsEditable\n\t\t});\n\t\t// Allows us to track if the user has edited the input previously.\n\t\t// This helps conditionally focus the icon only when the user is done editing the input.\n\t\tconst [hasEdited, setHasEdited] = React.useState(false);\n\n\t\tReact.useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(\n\t\t\tref,\n\t\t\t() => iconRef.current\n\t\t);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (iconRef.current && (attrs.autoFocus || hasEdited)) {\n\t\t\t\ticonRef.current.focus();\n\t\t\t}\n\t\t}, [attrs, iconRef, hasEdited]);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (textareaRef.current) {\n\t\t\t\tif (isEditable) {\n\t\t\t\t\ttextareaRef.current.focus();\n\t\t\t\t} else {\n\t\t\t\t\ttextareaRef.current.style.height = 'auto';\n\t\t\t\t\tif (!textareaRef.current.value || textareaRef.current.value === '') {\n\t\t\t\t\t\ttextareaRef.current.style.height = '40px';\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttextareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}, [isEditable, isEditing]);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!autoExpand || !textareaRef.current) return;\n\n\t\t\ttextareaRef.current.style.height = 'auto';\n\t\t\tif (!textareaRef.current.value || textareaRef.current.value === '') {\n\t\t\t\ttextareaRef.current.style.height = '40px';\n\t\t\t} else {\n\t\t\t\ttextareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;\n\t\t\t}\n\t\t}, [autoExpand, value]);\n\n\t\tconst onKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\tconst { key } = event;\n\n\t\t\tif (key === 'Escape') {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsEditable(false);\n\t\t\t\tsetIsEditing(false);\n\t\t\t}\n\t\t};\n\n\t\tconst handleOnBlur = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\t\t\t\tsetIsEditable(false);\n\t\t\t\tsetIsEditing(false);\n\t\t\t\tsetHasEdited(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 attrs.onBlur === 'function') {\n\t\t\t\t\tattrs.onBlur(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor, setIsEditable, setIsEditing, trackInteraction]\n\t\t);\n\n\t\tconst handleOnFocus = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tsetIsEditable(true);\n\t\t\t\tsetIsEditing(true);\n\t\t\t\tsetHasEdited(true);\n\t\t\t\tvalueOnFocusRef.current = e.target.value;\n\n\t\t\t\tif (typeof attrs.onFocus === 'function') {\n\t\t\t\t\tattrs.onFocus(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor, setIsEditable, setIsEditing]\n\t\t);\n\n\t\tconst handleOnMouseEnter = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tif (typeof attrs.onMouseEnter === 'function') {\n\t\t\t\t\tattrs.onMouseEnter(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor]\n\t\t);\n\n\t\tconst handleOnMouseLeave = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\t\t\t\tif (typeof attrs.onMouseLeave === 'function') {\n\t\t\t\t\tattrs.onMouseLeave(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor]\n\t\t);\n\n\t\tconst onClickEdit = React.useCallback(() => {\n\t\t\ttrackInteraction({ action: 'edit' });\n\n\t\t\tsetIsEditable(true);\n\t\t\tsetIsEditing(true);\n\t\t\tsetHasEdited(true);\n\t\t}, [setIsEditable, setIsEditing, setHasEdited, trackInteraction]);\n\n\t\tconst hasCounter =\n\t\t\ttypeof maxLength !== 'undefined' && Number(maxLength) > 0 && state !== 'read-only';\n\n\t\tif (hasCounter && isNaN(Number(maxLength))) {\n\t\t\tthrow new Error('maxLength should have type number');\n\t\t}\n\n\t\tconst hasErrorMessage = state === 'error' && error?.message;\n\n\t\tconst inputClasses = classnames(\n\t\t\tclassName,\n\t\t\tstyles['MrlEditableTextarea'],\n\t\t\t{\n\t\t\t\t[styles['MrlEditableTextarea--readOnly']]: state === 'read-only'\n\t\t\t},\n\t\t\t'MrlEditableTextarea',\n\t\t\t'mrl-textarea'\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className={`${styles['MrlEditableTextarea--wrapper']} MrlEditableTextarea--wrapper`}>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\t{...attrs}\n\t\t\t\t\t\tid={inputId}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tclassName={inputClasses}\n\t\t\t\t\t\tdefaultValue={value}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\t\taria-describedby={hasErrorMessage ? describedById : 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\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tmaxLength={hasCounter ? maxLength : undefined}\n\t\t\t\t\t\treadOnly={state === 'read-only' || !isEditable}\n\t\t\t\t\t\tref={textareaRef}\n\t\t\t\t\t\ttabIndex={!isEditable ? -1 : 0}\n\t\t\t\t\t/>\n\t\t\t\t\t{state !== 'read-only' && state !== 'disabled' && !isEditable && (\n\t\t\t\t\t\t<MrlEditableTextareaRightButton\n\t\t\t\t\t\t\taction={onClickEdit}\n\t\t\t\t\t\t\ticon={edit}\n\t\t\t\t\t\t\tlabel={`Edit ${inputLabelText}`}\n\t\t\t\t\t\t\tdataQa={attrs['data-qa'] && `${attrs['data-qa']}-edit`}\n\t\t\t\t\t\t\thasActiveColor={hasActiveColor || isEditable}\n\t\t\t\t\t\t\tsetHasActiveColor={setHasActiveColor}\n\t\t\t\t\t\t\tref={iconRef}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{hasCounter && isEditable && (\n\t\t\t\t\t<span className={styles['MrlForm-counter']}>\n\t\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t\t{value?.length || 0}/{maxLength}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<p style={{ display: 'none' }} aria-live=\"polite\" id={`${inputId}-counter`}>\n\t\t\t\t\t\t\t{`${maxLength - (value?.length || 0)} of ${maxLength} 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\t{state === 'error' && error?.message && (\n\t\t\t\t\t<span className={styles['MrlEditableTextarea-errorMessage']}>\n\t\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\t\tclassName={styles['MrlEditableTextarea-errorIcon']}\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tsvg={errorIcon}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span id={describedById}>{`${error?.message}`}</span>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t}\n);\n"],"names":["MrlEditableTextarea","React","forwardRef","props","ref","_props$autoExpand","autoExpand","className","inputId","inputLabelText","maxLength","placeholder","state","value","error","controlledIsEditable","isEditable","controlledIsEditableUpdate","setIsEditable","eventId","attrs","_objectWithoutProperties","_excluded","describedById","concat","textareaRef","useRef","iconRef","valueOnFocusRef","trackInteraction","useMrlTrackInteraction","_useActiveColor","useActiveColor","hasActiveColor","setHasActiveColor","_useIsEditable","useIsEditable","changeHandler","initialValue","isEditing","setIsEditing","_React$useState","useState","_React$useState2","_slicedToArray","hasEdited","setHasEdited","useImperativeHandle","current","useEffect","autoFocus","focus","style","height","scrollHeight","onKeyDown","event","key","stopPropagation","preventDefault","handleOnBlur","useCallback","e","target","action","onBlur","handleOnFocus","onFocus","handleOnMouseEnter","onMouseEnter","handleOnMouseLeave","onMouseLeave","onClickEdit","hasCounter","Number","isNaN","Error","hasErrorMessage","message","inputClasses","classnames","styles","createElement","Fragment","_extends","id","defaultValue","disabled","undefined","readOnly","tabIndex","MrlEditableTextareaRightButton","icon","edit","label","dataQa","length","display","MrlSvg","svg","errorIcon","size"],"mappings":";;;;;;;;;;;;AA0DA;AACA;AACA;AACA;AACA;AACO,IAAMA,mBAAmB,gBAAGC,KAAK,CAACC,UAAU,CAClD,SAASF,mBAAmBA,CAC3BG,KAA+B,EAC/BC,GAAiC,EACnB;AACd,EAAA,IAAAC,iBAAA,GAcIF,KAAK,CAbRG,UAAU;AAAVA,IAAAA,UAAU,GAAAD,iBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,iBAAA;IAClBE,SAAS,GAYNJ,KAAK,CAZRI,SAAS;IACTC,OAAO,GAWJL,KAAK,CAXRK,OAAO;IACPC,cAAc,GAUXN,KAAK,CAVRM,cAAc;IACdC,SAAS,GASNP,KAAK,CATRO,SAAS;IACTC,WAAW,GAQRR,KAAK,CARRQ,WAAW;IACXC,KAAK,GAOFT,KAAK,CAPRS,KAAK;IACLC,KAAK,GAMFV,KAAK,CANRU,KAAK;IACLC,OAAK,GAKFX,KAAK,CALRW,KAAK;IACOC,oBAAoB,GAI7BZ,KAAK,CAJRa,UAAU;IACKC,0BA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G,KAAA,CAAAiF,aAAA,CAAA,MAAA,EAAA;AAAMG,IAAAA,EAAE,EAAE9D;AAAc,GAAA,EAAA,EAAA,CAAAC,MAAA,CAAKV,OAAK,KAAA,IAAA,IAALA,OAAK,KAAA,MAAA,GAAA,MAAA,GAALA,OAAK,CAAEgE,OAAO,CAAS,CAC/C,CAEN,CAAC;AAEL,CACD;;;;"}
|
|
1
|
+
{"version":3,"file":"MrlEditableTextarea.js","sources":["../../../../../../src/components/form/textarea/MrlEditableTextarea/MrlEditableTextarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { edit, error as errorIcon } from '@muraldevkit/ds-icons';\n\nimport styles from './MrlEditableTextarea.module.scss';\nimport './MrlEditableTextarea.global.scss';\nimport { useIsEditable } from '../../hooks/useIsEditable';\nimport { useActiveColor } from '../../hooks/useActiveColor';\nimport { MrlSvg } from '../../../svg/MrlSvg/MrlSvg';\nimport { InputStates, MrlFormInputError } from '../../constants';\nimport { MrlEditableTextareaRightButton } from './MrlEditableTextareaRightButton';\nimport { useMrlTrackInteraction } from '../../../../hooks/useMrlAnalytics';\n\ninterface MrlEditableTextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n\t/** The value of the textarea used to make it a controlled input */\n\tvalue: string;\n\t/**\n\t * \tValue of the label text assigned to the input.\n\t * This is used to describe to the user what field they will be editing when interacting with the edit buton.\n\t */\n\tinputLabelText: string;\n\t/**\n\t * The maximum number of characters that the user can enter.\n\t * If undefined or set to \"0\", removes the character counter from the textarea\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Id of the text input.\n\t */\n\tinputId: string;\n\t/**\n\t * Text placeholder for the text input.\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Changes the state of the input based on user permissions or actions.\n\t */\n\tstate?: InputStates;\n\t/** Additional class to add to the textarea */\n\tclassName?: string;\n\t'data-qa': string;\n\t/** Error shown under the field when `state` is 'error'. */\n\terror?: MrlFormInputError;\n\t/** Whether the field is in edit mode. Omit to let the component manage it; pair with `setIsEditable` to control it. */\n\tisEditable?: boolean;\n\t/** Called when the field wants to enter or leave edit mode. Required when `isEditable` is controlled. */\n\tsetIsEditable?: (isEditableUpdate: boolean) => void;\n\t/** Autoexpand will automatically adjust the height of the textarea based on the amount of text within it */\n\tautoExpand?: boolean;\n\n\t/**\n\t * Enables interaction tracking for this textarea. Provide a stable, non-PII id\n\t * (e.g. 'mural-description'). When omitted, the textarea emits no analytics.\n\t *\n\t * Note: the textarea's value is never emitted, and `change` is emitted once per\n\t * editing session (on blur, when the value actually changed) rather than per keystroke.\n\t */\n\teventId?: string;\n}\n\n/**\n * Allows the user to input plain text in a multi-line format\n * @param {MrlEditableTextareaProps} props - the component props\n * @returns a textarea element\n */\nexport const MrlEditableTextarea = React.forwardRef<HTMLButtonElement, MrlEditableTextareaProps>(\n\tfunction MrlEditableTextarea(\n\t\tprops: MrlEditableTextareaProps,\n\t\tref: React.Ref<HTMLButtonElement>\n\t): JSX.Element {\n\t\tconst {\n\t\t\tautoExpand = false,\n\t\t\tclassName,\n\t\t\tinputId,\n\t\t\tinputLabelText,\n\t\t\tmaxLength,\n\t\t\tplaceholder,\n\t\t\tstate,\n\t\t\tvalue,\n\t\t\terror,\n\t\t\tisEditable: controlledIsEditable,\n\t\t\tsetIsEditable: controlledIsEditableUpdate,\n\t\t\teventId,\n\t\t\t...attrs\n\t\t} = props;\n\n\t\t// html id to be reference by input and error description to relay the error for a specific input\n\t\tconst describedById = `${inputId}-description`;\n\t\tconst textareaRef = React.useRef<HTMLTextAreaElement>(null);\n\t\tconst iconRef = React.useRef<HTMLButtonElement>(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('MrlEditableTextarea', eventId);\n\n\t\tconst { hasActiveColor, setHasActiveColor } = useActiveColor(state);\n\t\tconst { isEditable, isEditing, setIsEditable, setIsEditing } = useIsEditable({\n\t\t\tchangeHandler: controlledIsEditableUpdate,\n\t\t\tinitialValue: false,\n\t\t\tstate,\n\t\t\tvalue: controlledIsEditable\n\t\t});\n\t\t// Allows us to track if the user has edited the input previously.\n\t\t// This helps conditionally focus the icon only when the user is done editing the input.\n\t\tconst [hasEdited, setHasEdited] = React.useState(false);\n\n\t\tReact.useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(\n\t\t\tref,\n\t\t\t() => iconRef.current\n\t\t);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (iconRef.current && (attrs.autoFocus || hasEdited)) {\n\t\t\t\ticonRef.current.focus();\n\t\t\t}\n\t\t}, [attrs, iconRef, hasEdited]);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (textareaRef.current) {\n\t\t\t\tif (isEditable) {\n\t\t\t\t\ttextareaRef.current.focus();\n\t\t\t\t} else {\n\t\t\t\t\ttextareaRef.current.style.height = 'auto';\n\t\t\t\t\tif (!textareaRef.current.value || textareaRef.current.value === '') {\n\t\t\t\t\t\ttextareaRef.current.style.height = '40px';\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttextareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}, [isEditable, isEditing]);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!autoExpand || !textareaRef.current) return;\n\n\t\t\ttextareaRef.current.style.height = 'auto';\n\t\t\tif (!textareaRef.current.value || textareaRef.current.value === '') {\n\t\t\t\ttextareaRef.current.style.height = '40px';\n\t\t\t} else {\n\t\t\t\ttextareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;\n\t\t\t}\n\t\t}, [autoExpand, value]);\n\n\t\tconst onKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\tconst { key } = event;\n\n\t\t\tif (key === 'Escape') {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsEditable(false);\n\t\t\t\tsetIsEditing(false);\n\t\t\t}\n\t\t};\n\n\t\tconst handleOnBlur = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\t\t\t\tsetIsEditable(false);\n\t\t\t\tsetIsEditing(false);\n\t\t\t\tsetHasEdited(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 attrs.onBlur === 'function') {\n\t\t\t\t\tattrs.onBlur(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor, setIsEditable, setIsEditing, trackInteraction]\n\t\t);\n\n\t\tconst handleOnFocus = React.useCallback(\n\t\t\t(e: React.FocusEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tsetIsEditable(true);\n\t\t\t\tsetIsEditing(true);\n\t\t\t\tsetHasEdited(true);\n\t\t\t\tvalueOnFocusRef.current = e.target.value;\n\n\t\t\t\tif (typeof attrs.onFocus === 'function') {\n\t\t\t\t\tattrs.onFocus(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor, setIsEditable, setIsEditing]\n\t\t);\n\n\t\tconst handleOnMouseEnter = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(true);\n\t\t\t\tif (typeof attrs.onMouseEnter === 'function') {\n\t\t\t\t\tattrs.onMouseEnter(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor]\n\t\t);\n\n\t\tconst handleOnMouseLeave = React.useCallback(\n\t\t\t(e: React.MouseEvent<HTMLTextAreaElement>) => {\n\t\t\t\tsetHasActiveColor(false);\n\t\t\t\tif (typeof attrs.onMouseLeave === 'function') {\n\t\t\t\t\tattrs.onMouseLeave(e);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[attrs, setHasActiveColor]\n\t\t);\n\n\t\tconst onClickEdit = React.useCallback(() => {\n\t\t\ttrackInteraction({ action: 'edit' });\n\n\t\t\tsetIsEditable(true);\n\t\t\tsetIsEditing(true);\n\t\t\tsetHasEdited(true);\n\t\t}, [setIsEditable, setIsEditing, setHasEdited, trackInteraction]);\n\n\t\tconst hasCounter =\n\t\t\ttypeof maxLength !== 'undefined' && Number(maxLength) > 0 && state !== 'read-only';\n\n\t\tif (hasCounter && isNaN(Number(maxLength))) {\n\t\t\tthrow new Error('maxLength should have type number');\n\t\t}\n\n\t\tconst hasErrorMessage = state === 'error' && error?.message;\n\n\t\tconst inputClasses = classnames(\n\t\t\tclassName,\n\t\t\tstyles['MrlEditableTextarea'],\n\t\t\t{\n\t\t\t\t[styles['MrlEditableTextarea--readOnly']]: state === 'read-only'\n\t\t\t},\n\t\t\t'MrlEditableTextarea',\n\t\t\t'mrl-textarea'\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className={`${styles['MrlEditableTextarea--wrapper']} MrlEditableTextarea--wrapper`}>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\t{...attrs}\n\t\t\t\t\t\tid={inputId}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tclassName={inputClasses}\n\t\t\t\t\t\tdefaultValue={value}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdisabled={state === 'disabled'}\n\t\t\t\t\t\taria-invalid={state === 'error'}\n\t\t\t\t\t\taria-describedby={hasErrorMessage ? describedById : 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\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tmaxLength={hasCounter ? maxLength : undefined}\n\t\t\t\t\t\treadOnly={state === 'read-only' || !isEditable}\n\t\t\t\t\t\tref={textareaRef}\n\t\t\t\t\t\ttabIndex={!isEditable ? -1 : 0}\n\t\t\t\t\t/>\n\t\t\t\t\t{state !== 'read-only' && state !== 'disabled' && !isEditable && (\n\t\t\t\t\t\t<MrlEditableTextareaRightButton\n\t\t\t\t\t\t\taction={onClickEdit}\n\t\t\t\t\t\t\ticon={edit}\n\t\t\t\t\t\t\tlabel={`Edit ${inputLabelText}`}\n\t\t\t\t\t\t\tdataQa={attrs['data-qa'] && `${attrs['data-qa']}-edit`}\n\t\t\t\t\t\t\thasActiveColor={hasActiveColor || isEditable}\n\t\t\t\t\t\t\tsetHasActiveColor={setHasActiveColor}\n\t\t\t\t\t\t\tref={iconRef}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{hasCounter && isEditable && (\n\t\t\t\t\t<span className={styles['MrlForm-counter']}>\n\t\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t\t{value?.length || 0}/{maxLength}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<p style={{ display: 'none' }} aria-live=\"polite\" id={`${inputId}-counter`}>\n\t\t\t\t\t\t\t{`${maxLength - (value?.length || 0)} of ${maxLength} 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\t{state === 'error' && error?.message && (\n\t\t\t\t\t<span className={styles['MrlEditableTextarea-errorMessage']}>\n\t\t\t\t\t\t<MrlSvg\n\t\t\t\t\t\t\tclassName={styles['MrlEditableTextarea-errorIcon']}\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tsvg={errorIcon}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span id={describedById}>{`${error?.message}`}</span>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t}\n);\n"],"names":["MrlEditableTextarea","React","forwardRef","props","ref","_props$autoExpand","autoExpand","className","inputId","inputLabelText","maxLength","placeholder","state","value","error","controlledIsEditable","isEditable","controlledIsEditableUpdate","setIsEditable","eventId","attrs","_objectWithoutProperties","_excluded","describedById","concat","textareaRef","useRef","iconRef","valueOnFocusRef","trackInteraction","useMrlTrackInteraction","_useActiveColor","useActiveColor","hasActiveColor","setHasActiveColor","_useIsEditable","useIsEditable","changeHandler","initialValue","isEditing","setIsEditing","_React$useState","useState","_React$useState2","_slicedToArray","hasEdited","setHasEdited","useImperativeHandle","current","useEffect","autoFocus","focus","style","height","scrollHeight","onKeyDown","event","key","stopPropagation","preventDefault","handleOnBlur","useCallback","e","target","action","onBlur","handleOnFocus","onFocus","handleOnMouseEnter","onMouseEnter","handleOnMouseLeave","onMouseLeave","onClickEdit","hasCounter","Number","isNaN","Error","hasErrorMessage","message","inputClasses","classnames","styles","createElement","Fragment","_extends","id","defaultValue","disabled","undefined","readOnly","tabIndex","MrlEditableTextareaRightButton","icon","edit","label","dataQa","length","display","MrlSvg","svg","errorIcon","size"],"mappings":";;;;;;;;;;;;AA4DA;AACA;AACA;AACA;AACA;AACO,IAAMA,mBAAmB,gBAAGC,KAAK,CAACC,UAAU,CAClD,SAASF,mBAAmBA,CAC3BG,KAA+B,EAC/BC,GAAiC,EACnB;AACd,EAAA,IAAAC,iBAAA,GAcIF,KAAK,CAbRG,UAAU;AAAVA,IAAAA,UAAU,GAAAD,iBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,iBAAA;IAClBE,SAAS,GAYNJ,KAAK,CAZRI,SAAS;IACTC,OAAO,GAWJL,KAAK,CAXRK,OAAO;IACPC,cAAc,GAUXN,KAAK,CAVRM,cAAc;IACdC,SAAS,GASNP,KAAK,CATRO,SAAS;IACTC,WAAW,GAQRR,KAAK,CARRQ,WAAW;IACXC,KAAK,GAOFT,KAAK,CAPRS,KAAK;IACLC,KAAK,GAMFV,KAAK,CANRU,KAAK;IACLC,OAAK,G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B,IAAAA,GAAG,EAAEC,KAAU;AACfC,IAAAA,IAAI,EAAC;AAAO,GACZ,CAAC,eACFpG,KAAA,CAAAiF,aAAA,CAAA,MAAA,EAAA;AAAMG,IAAAA,EAAE,EAAE9D;AAAc,GAAA,EAAA,EAAA,CAAAC,MAAA,CAAKV,OAAK,KAAA,IAAA,IAALA,OAAK,KAAA,MAAA,GAAA,MAAA,GAALA,OAAK,CAAEgE,OAAO,CAAS,CAC/C,CAEN,CAAC;AAEL,CACD;;;;"}
|
|
@@ -1,41 +1,57 @@
|
|
|
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 {
|
|
4
|
+
import { GRID_SIZE_KEYS } from '../constants.js';
|
|
5
5
|
|
|
6
|
-
var _excluded = ["children", "className"];
|
|
7
|
-
|
|
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);
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* There is no `col-0` class, so a zero span produces nothing. `ColSpan` already
|
|
19
|
+
* rules it out, but this is a published component and JavaScript consumers are
|
|
20
|
+
* not held to that — hence a runtime check rather than a type-level one.
|
|
21
|
+
*/
|
|
22
|
+
var isZeroSpan = val => val === 0;
|
|
8
23
|
|
|
9
24
|
/**
|
|
10
25
|
* Creates the size classes for the grid.
|
|
26
|
+
*
|
|
27
|
+
* `offset: 0` is kept, because `offset-<size>-0` is how a breakpoint cancels an
|
|
28
|
+
* offset set on a smaller one. `col: 0` is dropped, because there is no
|
|
29
|
+
* `col-0` class — a column always spans at least one track.
|
|
11
30
|
* @param props - component props
|
|
12
|
-
* @returns an array of size classes
|
|
31
|
+
* @returns an array of size classes
|
|
13
32
|
*/
|
|
14
33
|
var createSizeClasses = props => {
|
|
15
34
|
var classes = [];
|
|
16
|
-
for (var size of
|
|
35
|
+
for (var size of GRID_SIZE_KEYS) {
|
|
17
36
|
// get the value based on the prop key from the component props
|
|
18
37
|
var value = props[size];
|
|
38
|
+
if (value === undefined) continue;
|
|
19
39
|
|
|
20
|
-
//
|
|
21
|
-
if (value) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
40
|
+
// if the value is a number or `auto`, then it is a column size
|
|
41
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
42
|
+
if (!isZeroSpan(value)) classes.push(getGridClass(size, 'col', value));
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
27
45
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
46
|
+
// if the value is an object, then we need to compose multiple classes
|
|
47
|
+
// based on the keyvalue pairings
|
|
48
|
+
for (var _ref3 of Object.entries(value)) {
|
|
49
|
+
var _ref2 = _slicedToArray(_ref3, 2);
|
|
50
|
+
var key = _ref2[0];
|
|
51
|
+
var val = _ref2[1];
|
|
52
|
+
if (val === undefined) continue;
|
|
53
|
+
if (key === 'col' && isZeroSpan(val)) continue;
|
|
54
|
+
classes.push(getGridClass(size, key, val));
|
|
39
55
|
}
|
|
40
56
|
}
|
|
41
57
|
if (classes.length === 0) classes.push('col');
|
|
@@ -43,44 +59,31 @@ var createSizeClasses = props => {
|
|
|
43
59
|
};
|
|
44
60
|
|
|
45
61
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param props
|
|
48
|
-
* @returns
|
|
62
|
+
* MrlCol React component. Creates a grid column.
|
|
63
|
+
* @param props - component props
|
|
64
|
+
* @returns a MrlCol React component.
|
|
49
65
|
*/
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
function MrlCol(_ref4) {
|
|
67
|
+
var children = _ref4.children,
|
|
68
|
+
className = _ref4.className,
|
|
69
|
+
col = _ref4.col,
|
|
70
|
+
lg = _ref4.lg,
|
|
71
|
+
md = _ref4.md,
|
|
72
|
+
sm = _ref4.sm,
|
|
73
|
+
xl = _ref4.xl,
|
|
74
|
+
xs = _ref4.xs,
|
|
75
|
+
xxl = _ref4.xxl,
|
|
76
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
77
|
+
var columnClasses = createSizeClasses({
|
|
61
78
|
col,
|
|
62
|
-
xs,
|
|
63
|
-
sm,
|
|
64
|
-
md,
|
|
65
79
|
lg,
|
|
80
|
+
md,
|
|
81
|
+
sm,
|
|
66
82
|
xl,
|
|
83
|
+
xs,
|
|
67
84
|
xxl
|
|
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);
|
|
85
|
+
});
|
|
86
|
+
var allClasses = classnames('MrlCol', className, columnClasses);
|
|
84
87
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
85
88
|
className: allClasses
|
|
86
89
|
}), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {
|
|
1
|
+
{"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { 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 * There is no `col-0` class, so a zero span produces nothing. `ColSpan` already\n * rules it out, but this is a published component and JavaScript consumers are\n * not held to that — hence a runtime check rather than a type-level one.\n */\nconst isZeroSpan = (val: unknown): boolean => val === 0;\n\n/**\n * Creates the size classes for the grid.\n *\n * `offset: 0` is kept, because `offset-<size>-0` is how a breakpoint cancels an\n * offset set on a smaller one. `col: 0` is dropped, because there is no\n * `col-0` class — a column always spans at least one track.\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\tif (value === undefined) continue;\n\n\t\t// if the value is a number or `auto`, then it is a column size\n\t\tif (typeof value === 'number' || typeof value === 'string') {\n\t\t\tif (!isZeroSpan(value)) classes.push(getGridClass(size, 'col', value));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if the value is an object, then we need to compose multiple classes\n\t\t// based on the keyvalue pairings\n\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\tif (val === undefined) continue;\n\t\t\tif (key === 'col' && isZeroSpan(val)) continue;\n\t\t\tclasses.push(getGridClass(size, key, val));\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('MrlCol', 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":["getGridClass","size","type","val","concat","isZeroSpan","createSizeClasses","props","classes","GRID_SIZE_KEYS","value","undefined","push","_ref3","Object","entries","_ref2","_slicedToArray","key","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,GAAA,CAAA,CAAAE,MAAA,CAAIH,IAAI,EAAA,GAAA,CAAA,CAAAG,MAA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ED;AACA;AACA;AACA;AACA;AACO,SAASY,MAAMA,CAAAC,KAAA,EAWO;AAAA,EAAA,IAV5BC,QAAQ,GAAAD,KAAA,CAARC,QAAQ;IACRC,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,CAAC,QAAQ,EAAEb,SAAS,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;;;;"}
|
|
@@ -3,18 +3,16 @@ import * as React from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
|
|
5
5
|
var _excluded = ["children", "className"];
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
|
-
* MrlGrid React component.
|
|
7
|
+
* MrlGrid React component. Primary container of a grid.
|
|
9
8
|
* @param props - component props
|
|
10
9
|
* @returns a MrlGrid React component.
|
|
11
10
|
*/
|
|
12
11
|
function MrlGrid(_ref) {
|
|
13
12
|
var children = _ref.children,
|
|
14
|
-
|
|
15
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
13
|
+
className = _ref.className,
|
|
16
14
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
-
var allClasses = classnames('container', className);
|
|
15
|
+
var allClasses = classnames('container', 'MrlGrid', className);
|
|
18
16
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
19
17
|
className: allClasses
|
|
20
18
|
}), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {
|
|
1
|
+
{"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { GridBaseProps } from '../constants';\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":";;;;;AAOA;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,26 +1,28 @@
|
|
|
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';
|
|
4
5
|
|
|
5
|
-
var _excluded = ["align", "children", "className", "justify"];
|
|
6
|
+
var _excluded = ["align", "children", "className", "gutter", "justify"];
|
|
6
7
|
/**
|
|
7
|
-
* MrlRow React component.
|
|
8
|
+
* MrlRow React component. Creates a grid row.
|
|
8
9
|
* @param props - component props
|
|
9
10
|
* @returns a MrlRow React component.
|
|
10
11
|
*/
|
|
11
12
|
function MrlRow(_ref) {
|
|
12
13
|
var align = _ref.align,
|
|
13
14
|
children = _ref.children,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
className = _ref.className,
|
|
16
|
+
_ref$gutter = _ref.gutter,
|
|
17
|
+
gutter = _ref$gutter === void 0 ? 1 : _ref$gutter,
|
|
16
18
|
justify = _ref.justify,
|
|
17
19
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
-
var alignClass = align
|
|
20
|
+
var alignClass = align && "align-items-".concat(align);
|
|
19
21
|
var justifyClass = justify && "justify-content-".concat(justify);
|
|
20
|
-
var allClasses = classnames('row', className, alignClass, justifyClass);
|
|
21
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
22
|
+
var allClasses = classnames('row', 'MrlRow', className, alignClass, justifyClass, GUTTER_CLASS[gutter]);
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
22
24
|
className: allClasses
|
|
23
|
-
}
|
|
25
|
+
}), children);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
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 {
|
|
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;;;;"}
|
|
@@ -3,23 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Number of columns a `col` can span. There is no `col-0` class — a column
|
|
7
|
+
* always occupies at least one of the twelve tracks.
|
|
7
8
|
*/
|
|
8
|
-
var GridSizes = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Number of columns
|
|
11
|
+
* Number of columns an `offset` can skip. `0` is meaningful here: it is how a
|
|
12
|
+
* larger breakpoint cancels an offset inherited from a smaller one.
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - columns "col-<size>-<number>"
|
|
18
|
-
* - offsets "offset-<size>-<number>""
|
|
16
|
+
* @deprecated Use `ColSpan` for spans or `OffsetSpan` for offsets. This union
|
|
17
|
+
* allowed `col={0}`, which never produced a class.
|
|
19
18
|
*/
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
|
-
* Interface of available class selectors
|
|
21
|
+
* Interface of available class selectors per breakpoint.
|
|
23
22
|
*
|
|
24
23
|
* Example interface:
|
|
25
24
|
* {
|
|
@@ -32,9 +31,47 @@ var GridSizes = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
|
32
31
|
* Options to configure the number of columns to span on different screen sizes.
|
|
33
32
|
*/
|
|
34
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Breakpoint keys in ascending order. Drives both class generation and the
|
|
36
|
+
* filtering that keeps grid props from reaching the DOM.
|
|
37
|
+
*/
|
|
38
|
+
var GRID_SIZE_KEYS = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
39
|
+
|
|
35
40
|
/**
|
|
36
41
|
* Available gutter sizes for customizing the grid
|
|
37
42
|
*/
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Gutter size to modifier class. `1` is the default declared on `.row`, so it
|
|
46
|
+
* needs no class.
|
|
47
|
+
*/
|
|
48
|
+
var GUTTER_CLASS = {
|
|
49
|
+
0: 'MrlRow-gutter--none',
|
|
50
|
+
1: undefined,
|
|
51
|
+
2: 'MrlRow-gutter--double'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Roles a generic layout wrapper may safely carry.
|
|
56
|
+
*
|
|
57
|
+
* Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)
|
|
58
|
+
* are deliberately excluded: they promise an APG keyboard contract — roving
|
|
59
|
+
* tabindex or `aria-activedescendant`, arrow-key navigation, selection state —
|
|
60
|
+
* that these divs do not implement. The roles below are structural only and
|
|
61
|
+
* carry no interaction contract, so they are safe to forward.
|
|
62
|
+
*
|
|
63
|
+
* `list`/`listitem` in particular is how a row of columns is announced as
|
|
64
|
+
* "list, N items", and is the standard workaround for Safari/VoiceOver
|
|
65
|
+
* dropping implicit list semantics. `region` needs an accessible name to be
|
|
66
|
+
* exposed as a landmark; the type cannot enforce that.
|
|
67
|
+
*
|
|
68
|
+
* Page landmarks belong to the layout components (MrlMain, MrlPage).
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Shared props for the grid components: every `div` attribute, with `role`
|
|
73
|
+
* narrowed to {@link SafeLayoutRole}.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export { GRID_SIZE_KEYS, GUTTER_CLASS };
|
|
40
77
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
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 *
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["import { DataQa } from '../../utils/dataQa';\n\n/**\n * Alignment & justification options for grid containers\n */\nexport type AlignOptions = 'start' | 'center' | 'end';\nexport type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';\n\n/**\n * Number of columns a `col` can span. There is no `col-0` class — a column\n * always occupies at least one of the twelve tracks.\n */\nexport type ColSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * Number of columns an `offset` can skip. `0` is meaningful here: it is how a\n * larger breakpoint cancels an offset inherited from a smaller one.\n */\nexport type OffsetSpan = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n\n/**\n * @deprecated Use `ColSpan` for spans or `OffsetSpan` for offsets. This union\n * allowed `col={0}`, which never produced a class.\n */\nexport type NumCols = 0 | ColSpan;\n\n/**\n * Interface of available class selectors per breakpoint.\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\ntype GridClassConfig = {\n\tcol?: ColSpan;\n\toffset?: OffsetSpan;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\ntype ColumnConfig = ColSpan | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/**\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/**\n\t * @deprecated Alias of `col`, kept for backwards compatibility. It resolves\n\t * to the same un-prefixed tier, so passing both `col` and `xs` emits two\n\t * competing classes and the larger span wins on CSS source order rather\n\t * than the one you wrote last. Pass only one.\n\t */\n\txs?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span 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 declared on `.row`, so it\n * needs no class.\n */\nexport const GUTTER_CLASS: Record<GutterSizes, string | undefined> = {\n\t0: 'MrlRow-gutter--none',\n\t1: undefined,\n\t2: 'MrlRow-gutter--double'\n};\n\n/**\n * Roles a generic layout wrapper may safely carry.\n *\n * Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)\n * are deliberately excluded: they promise an APG keyboard contract — roving\n * tabindex or `aria-activedescendant`, arrow-key navigation, selection state —\n * that these divs do not implement. The roles below are structural only and\n * carry no interaction contract, so they are safe to forward.\n *\n * `list`/`listitem` in particular is how a row of columns is announced as\n * \"list, N items\", and is the standard workaround for Safari/VoiceOver\n * dropping implicit list semantics. `region` needs an accessible name to be\n * exposed as a landmark; the type cannot enforce that.\n *\n * Page landmarks belong to the layout components (MrlMain, MrlPage).\n */\nexport type SafeLayoutRole = 'group' | 'list' | 'listitem' | 'none' | 'presentation' | 'region';\n\n/**\n * Shared props for the grid components: every `div` attribute, with `role`\n * narrowed to {@link SafeLayoutRole}.\n */\nexport type GridBaseProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'role'> &\n\tDataQa & {\n\t\t/**\n\t\t * Structural role for the wrapper. Composite widget roles are not\n\t\t * accepted — see {@link SafeLayoutRole}.\n\t\t */\n\t\trole?: SafeLayoutRole;\n\t};\n"],"names":["GRID_SIZE_KEYS","GUTTER_CLASS","undefined"],"mappings":"AAEA;AACA;AACA;;AAIA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AA2CA;AACA;AACA;AACA;IACaA,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;;AAEzE;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,IAAMC,YAAqD,GAAG;AACpE,EAAA,CAAC,EAAE,qBAAqB;AACxB,EAAA,CAAC,EAAEC,SAAS;AACZ,EAAA,CAAC,EAAE;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlSidebar.js","sources":["../../../../../src/components/layout/MrlSidebar/MrlSidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { menu, close } from '@muraldevkit/ds-icons';\nimport { MrlIconButton } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlFocusTrap } from '../../focus-trap/MrlFocusTrap/MrlFocusTrap';\nimport { MrlSvg } from '../../svg/MrlSvg/MrlSvg';\nimport { LayoutComponent, LayoutSection } from '../constants';\nimport { useBreakpoint } from '../../../hooks/useBreakpoint';\nimport { isMobile } from '../utils';\nimport { useLayoutContext } from '../context/LayoutContext';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlSidebar.module.scss';\n\nexport type MrlSidebarHookInfo = { source: 'userInteraction' | 'imperativeHandler' };\n\ninterface MrlSidebarHook {\n\thookClose?: (info: MrlSidebarHookInfo) => void;\n\thookOpen?: (info: MrlSidebarHookInfo) => void;\n}\n\ninterface MrlSidebarAnalytics {\n\t/**\n\t * Enables interaction tracking for this sidebar. Provide a stable, non-PII id\n\t * (e.g. 'dashboard-sidebar'). When omitted, the sidebar emits no analytics.\n\t */\n\teventId?: string;\n}\n\ntype MrlSidebar = LayoutComponent & LayoutSection & MrlSidebarHook & MrlSidebarAnalytics;\nexport interface MrlSidebarHandle {\n\tclose: () => void;\n\topen: () => void;\n\ttoggle: () => void;\n}\n\n/**\n * MrlSidebar React component.\n * @param props - component props\n * @returns a MrlSidebar React component.\n */\nexport const MrlSidebar = React.forwardRef<MrlSidebarHandle, MrlSidebar>(function MrlSidebar(\n\t{ children, className = '', hookOpen, hookClose, eventId, ...rest }: MrlSidebar,\n\tref: React.Ref<MrlSidebarHandle>\n): JSX.Element {\n\tconst [isExpanded, setIsExpanded] = React.useState<boolean>(false);\n\tconst trackInteraction = useMrlTrackInteraction('MrlSidebar', eventId);\n\tconst setExpandedAndNotify = React.useCallback(\n\t\t(expanded: boolean, info: MrlSidebarHookInfo) => {\n\t\t\t// every open/close path funnels through here, including the imperative handle\n\t\t\ttrackInteraction({ action: expanded ? 'open' : 'close', metadata: { source: info.source } });\n\n\t\t\tif (expanded) {\n\t\t\t\thookOpen?.(info);\n\t\t\t} else {\n\t\t\t\thookClose?.(info);\n\t\t\t}\n\t\t\tsetIsExpanded(expanded);\n\t\t},\n\t\t[hookOpen, hookClose, trackInteraction]\n\t);\n\n\tconst { isTopbarRendered } = useLayoutContext();\n\n\tReact.useImperativeHandle(ref, () => {\n\t\treturn {\n\t\t\tclose() {\n\t\t\t\tsetExpandedAndNotify(false, { source: 'imperativeHandler' });\n\t\t\t},\n\t\t\topen() {\n\t\t\t\tsetExpandedAndNotify(true, { source: 'imperativeHandler' });\n\t\t\t},\n\t\t\ttoggle() {\n\t\t\t\tsetExpandedAndNotify(!isExpanded, { source: 'imperativeHandler' });\n\t\t\t}\n\t\t};\n\t}, [isExpanded, setExpandedAndNotify]);\n\n\tconst breakpoint = useBreakpoint();\n\tconst renderMobile = isMobile(breakpoint);\n\n\tconst sidebarRef = React.useRef<HTMLDivElement>(null);\n\tconst triggerRef = React.useRef<HTMLButtonElement>(null);\n\n\t// If both of these are true, then we want to set focus trap disabled to \"False\"\n\t// which is kind of confusing, because these values actually return true.\n\t// So, we need to negate them. Don't worry, it works.\n\tconst shouldFocusTrap = !(renderMobile && isExpanded);\n\n\tconst offsetClass = classnames(isTopbarRendered && styles['MrlSidebar--offset']);\n\n\tconst sidebarClasses = classnames(styles['MrlSidebar'], 'MrlSidebar', className, offsetClass, {\n\t\t[styles['MrlSidebar--mobile']]: renderMobile,\n\t\t[styles['MrlSidebar--mobile--open']]: renderMobile && isExpanded\n\t});\n\n\tconst overlayClasses = classnames(\n\t\tstyles['MrlSidebar-overlay'],\n\t\t'MrlSidebar-overlay',\n\t\trenderMobile && isExpanded && styles['MrlSidebar-overlay--visible'],\n\t\toffsetClass\n\t);\n\n\tconst sidebarContentClasses = classnames(styles['MrlSidebar-content'], 'MrlSidebar-content', {\n\t\t[styles['MrlSidebar-content--visible']]: isExpanded || !renderMobile\n\t});\n\n\tconst handleKeyUp = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\n\t\tif (e.key === 'Escape') {\n\t\t\tsetExpandedAndNotify(false, { source: 'userInteraction' });\n\t\t\ttriggerRef.current?.focus();\n\t\t}\n\t};\n\n\tconst handleClick = (e: React.SyntheticEvent<HTMLElement, Event>) => {\n\t\te.preventDefault();\n\t\tsetExpandedAndNotify(!isExpanded, { source: 'userInteraction' });\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{\n\t\t\t\t// If the sidebar is rendered on mobile, we want to render the menu button and overlay.\n\t\t\t\trenderMobile && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t<MrlIconButton\n\t\t\t\t\t\t\t\twrapperClassName={classnames(\n\t\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu-trigger'],\n\t\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu']\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\ticon={<MrlSvg svg={menu} />}\n\t\t\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t\t\tref={triggerRef}\n\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\ttext=\"Open\"\n\t\t\t\t\t\t\t\ttipAnchor=\"center\"\n\t\t\t\t\t\t\t\ttoggleAria=\"expanded\"\n\t\t\t\t\t\t\t\tstate=\"default\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={overlayClasses}\n\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t// we only want to allow click events on the overlay if the sidebar is expanded\n\t\t\t\t\t\t\t// otherwise pointer events are none and no click events are allowed\n\t\t\t\t\t\t\t{...(isExpanded && { onClick: handleClick })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\t\t\t<section\n\t\t\t\t{...rest}\n\t\t\t\tclassName={sidebarClasses}\n\t\t\t\tonKeyUp={handleKeyUp}\n\t\t\t\tref={sidebarRef}\n\t\t\t\trole=\"presentation\"\n\t\t\t\t{...(renderMobile && { 'aria-hidden': !isExpanded })}\n\t\t\t>\n\t\t\t\t<MrlFocusTrap disabled={shouldFocusTrap} containerRef={sidebarRef}>\n\t\t\t\t\t{isExpanded && (\n\t\t\t\t\t\t<MrlIconButton\n\t\t\t\t\t\t\twrapperClassName={classnames(\n\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu-trigger'],\n\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu'],\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t[styles['MrlSidebar-menu-close']]: isExpanded,\n\t\t\t\t\t\t\t\t\t'MrlSidebar-menu-close': isExpanded\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\ticon={<MrlSvg svg={close} />}\n\t\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\ttext=\"Close\"\n\t\t\t\t\t\t\ttipAnchor=\"center\"\n\t\t\t\t\t\t\ttoggleAria=\"expanded\"\n\t\t\t\t\t\t\tstate=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<div className={sidebarContentClasses}>{children}</div>\n\t\t\t\t</MrlFocusTrap>\n\t\t\t</section>\n\t\t</>\n\t);\n});\n"],"names":["MrlSidebar","React","forwardRef","_ref","ref","children","_ref$className","className","hookOpen","hookClose","eventId","rest","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isExpanded","setIsExpanded","trackInteraction","useMrlTrackInteraction","setExpandedAndNotify","useCallback","expanded","info","action","metadata","source","_useLayoutContext","useLayoutContext","isTopbarRendered","useImperativeHandle","close","open","toggle","breakpoint","useBreakpoint","renderMobile","isMobile","sidebarRef","useRef","triggerRef","shouldFocusTrap","offsetClass","classnames","styles","sidebarClasses","overlayClasses","sidebarContentClasses","handleKeyUp","e","preventDefault","stopPropagation","key","_triggerRef$current","current","focus","handleClick","createElement","Fragment","MrlIconButton","wrapperClassName","icon","MrlSvg","svg","menu","kind","onClick","position","size","text","tipAnchor","toggleAria","state","_extends","role","tabIndex","onKeyUp","MrlFocusTrap","disabled","containerRef"],"mappings":";;;;;;;;;;;;;;AAoCA;AACA;AACA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,KAAK,CAACC,UAAU,CAA+B,SAASF,UAAUA,CAAAG,IAAA,EAE3FC,GAAgC,EAClB;AAAA,EAAA,IAFZC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,cAAA,GAAAH,IAAA,CAAEI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IAAEE,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,SAAS,GAAAN,IAAA,CAATM,SAAS;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAT,IAAA,EAAAU,SAAA,CAAA;AAGjE,EAAA,IAAAC,eAAA,GAAoCb,KAAK,CAACc,QAAQ,CAAU,KAAK,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA,EAAA,CAAA,CAAA;AAA3DI,IAAAA,UAAU,GAAAF,gBAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,aAAa,GAAAH,gBAAA,CAAA,CAAA,CAAA;AAChC,EAAA,IAAMI,gBAAgB,GAAGC,sBAAsB,CAAC,YAAY,EAAEX,OAAO,CAAC;EACtE,IAAMY,oBAAoB,GAAGrB,KAAK,CAACsB,WAAW,CAC7C,CAACC,QAAiB,EAAEC,IAA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AE0C;AAAsB,GAAA,EAAE5C,QAAc,CACzC,CACN,CACR,CAAC;AAEL,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"MrlSidebar.js","sources":["../../../../../src/components/layout/MrlSidebar/MrlSidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { menu, close } from '@muraldevkit/ds-icons';\nimport { MrlIconButton } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlFocusTrap } from '../../focus-trap/MrlFocusTrap/MrlFocusTrap';\nimport { MrlSvg } from '../../svg/MrlSvg/MrlSvg';\nimport { LayoutComponent, LayoutSection } from '../constants';\nimport { useBreakpoint } from '../../../hooks/useBreakpoint';\nimport { isMobile } from '../utils';\nimport { useLayoutContext } from '../context/LayoutContext';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlSidebar.module.scss';\n\nexport type MrlSidebarHookInfo = { source: 'userInteraction' | 'imperativeHandler' };\n\ninterface MrlSidebarHook {\n\t/** Called on every close request, even if the sidebar is already closed. `info.source` tells whether a user or the imperative handle made it. */\n\thookClose?: (info: MrlSidebarHookInfo) => void;\n\t/** Called on every open request, even if the sidebar is already open. `info.source` tells whether a user or the imperative handle made it. */\n\thookOpen?: (info: MrlSidebarHookInfo) => void;\n}\n\ninterface MrlSidebarAnalytics {\n\t/**\n\t * Enables interaction tracking for this sidebar. Provide a stable, non-PII id\n\t * (e.g. 'dashboard-sidebar'). When omitted, the sidebar emits no analytics.\n\t */\n\teventId?: string;\n}\n\ntype MrlSidebar = LayoutComponent & LayoutSection & MrlSidebarHook & MrlSidebarAnalytics;\nexport interface MrlSidebarHandle {\n\tclose: () => void;\n\topen: () => void;\n\ttoggle: () => void;\n}\n\n/**\n * MrlSidebar React component.\n * @param props - component props\n * @returns a MrlSidebar React component.\n */\nexport const MrlSidebar = React.forwardRef<MrlSidebarHandle, MrlSidebar>(function MrlSidebar(\n\t{ children, className = '', hookOpen, hookClose, eventId, ...rest }: MrlSidebar,\n\tref: React.Ref<MrlSidebarHandle>\n): JSX.Element {\n\tconst [isExpanded, setIsExpanded] = React.useState<boolean>(false);\n\tconst trackInteraction = useMrlTrackInteraction('MrlSidebar', eventId);\n\tconst setExpandedAndNotify = React.useCallback(\n\t\t(expanded: boolean, info: MrlSidebarHookInfo) => {\n\t\t\t// every open/close path funnels through here, including the imperative handle\n\t\t\ttrackInteraction({ action: expanded ? 'open' : 'close', metadata: { source: info.source } });\n\n\t\t\tif (expanded) {\n\t\t\t\thookOpen?.(info);\n\t\t\t} else {\n\t\t\t\thookClose?.(info);\n\t\t\t}\n\t\t\tsetIsExpanded(expanded);\n\t\t},\n\t\t[hookOpen, hookClose, trackInteraction]\n\t);\n\n\tconst { isTopbarRendered } = useLayoutContext();\n\n\tReact.useImperativeHandle(ref, () => {\n\t\treturn {\n\t\t\tclose() {\n\t\t\t\tsetExpandedAndNotify(false, { source: 'imperativeHandler' });\n\t\t\t},\n\t\t\topen() {\n\t\t\t\tsetExpandedAndNotify(true, { source: 'imperativeHandler' });\n\t\t\t},\n\t\t\ttoggle() {\n\t\t\t\tsetExpandedAndNotify(!isExpanded, { source: 'imperativeHandler' });\n\t\t\t}\n\t\t};\n\t}, [isExpanded, setExpandedAndNotify]);\n\n\tconst breakpoint = useBreakpoint();\n\tconst renderMobile = isMobile(breakpoint);\n\n\tconst sidebarRef = React.useRef<HTMLDivElement>(null);\n\tconst triggerRef = React.useRef<HTMLButtonElement>(null);\n\n\t// If both of these are true, then we want to set focus trap disabled to \"False\"\n\t// which is kind of confusing, because these values actually return true.\n\t// So, we need to negate them. Don't worry, it works.\n\tconst shouldFocusTrap = !(renderMobile && isExpanded);\n\n\tconst offsetClass = classnames(isTopbarRendered && styles['MrlSidebar--offset']);\n\n\tconst sidebarClasses = classnames(styles['MrlSidebar'], 'MrlSidebar', className, offsetClass, {\n\t\t[styles['MrlSidebar--mobile']]: renderMobile,\n\t\t[styles['MrlSidebar--mobile--open']]: renderMobile && isExpanded\n\t});\n\n\tconst overlayClasses = classnames(\n\t\tstyles['MrlSidebar-overlay'],\n\t\t'MrlSidebar-overlay',\n\t\trenderMobile && isExpanded && styles['MrlSidebar-overlay--visible'],\n\t\toffsetClass\n\t);\n\n\tconst sidebarContentClasses = classnames(styles['MrlSidebar-content'], 'MrlSidebar-content', {\n\t\t[styles['MrlSidebar-content--visible']]: isExpanded || !renderMobile\n\t});\n\n\tconst handleKeyUp = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\n\t\tif (e.key === 'Escape') {\n\t\t\tsetExpandedAndNotify(false, { source: 'userInteraction' });\n\t\t\ttriggerRef.current?.focus();\n\t\t}\n\t};\n\n\tconst handleClick = (e: React.SyntheticEvent<HTMLElement, Event>) => {\n\t\te.preventDefault();\n\t\tsetExpandedAndNotify(!isExpanded, { source: 'userInteraction' });\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{\n\t\t\t\t// If the sidebar is rendered on mobile, we want to render the menu button and overlay.\n\t\t\t\trenderMobile && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t<MrlIconButton\n\t\t\t\t\t\t\t\twrapperClassName={classnames(\n\t\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu-trigger'],\n\t\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu']\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\ticon={<MrlSvg svg={menu} />}\n\t\t\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t\t\tref={triggerRef}\n\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\ttext=\"Open\"\n\t\t\t\t\t\t\t\ttipAnchor=\"center\"\n\t\t\t\t\t\t\t\ttoggleAria=\"expanded\"\n\t\t\t\t\t\t\t\tstate=\"default\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={overlayClasses}\n\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t// we only want to allow click events on the overlay if the sidebar is expanded\n\t\t\t\t\t\t\t// otherwise pointer events are none and no click events are allowed\n\t\t\t\t\t\t\t{...(isExpanded && { onClick: handleClick })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\t\t\t<section\n\t\t\t\t{...rest}\n\t\t\t\tclassName={sidebarClasses}\n\t\t\t\tonKeyUp={handleKeyUp}\n\t\t\t\tref={sidebarRef}\n\t\t\t\trole=\"presentation\"\n\t\t\t\t{...(renderMobile && { 'aria-hidden': !isExpanded })}\n\t\t\t>\n\t\t\t\t<MrlFocusTrap disabled={shouldFocusTrap} containerRef={sidebarRef}>\n\t\t\t\t\t{isExpanded && (\n\t\t\t\t\t\t<MrlIconButton\n\t\t\t\t\t\t\twrapperClassName={classnames(\n\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu-trigger'],\n\t\t\t\t\t\t\t\tstyles['MrlSidebar-menu'],\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t[styles['MrlSidebar-menu-close']]: isExpanded,\n\t\t\t\t\t\t\t\t\t'MrlSidebar-menu-close': isExpanded\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\ticon={<MrlSvg svg={close} />}\n\t\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\ttext=\"Close\"\n\t\t\t\t\t\t\ttipAnchor=\"center\"\n\t\t\t\t\t\t\ttoggleAria=\"expanded\"\n\t\t\t\t\t\t\tstate=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<div className={sidebarContentClasses}>{children}</div>\n\t\t\t\t</MrlFocusTrap>\n\t\t\t</section>\n\t\t</>\n\t);\n});\n"],"names":["MrlSidebar","React","forwardRef","_ref","ref","children","_ref$className","className","hookOpen","hookClose","eventId","rest","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","isExpanded","setIsExpanded","trackInteraction","useMrlTrackInteraction","setExpandedAndNotify","useCallback","expanded","info","action","metadata","source","_useLayoutContext","useLayoutContext","isTopbarRendered","useImperativeHandle","close","open","toggle","breakpoint","useBreakpoint","renderMobile","isMobile","sidebarRef","useRef","triggerRef","shouldFocusTrap","offsetClass","classnames","styles","sidebarClasses","overlayClasses","sidebarContentClasses","handleKeyUp","e","preventDefault","stopPropagation","key","_triggerRef$current","current","focus","handleClick","createElement","Fragment","MrlIconButton","wrapperClassName","icon","MrlSvg","svg","menu","kind","onClick","position","size","text","tipAnchor","toggleAria","state","_extends","role","tabIndex","onKeyUp","MrlFocusTrap","disabled","containerRef"],"mappings":";;;;;;;;;;;;;;AAsCA;AACA;AACA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,KAAK,CAACC,UAAU,CAA+B,SAASF,UAAUA,CAAAG,IAAA,EAE3FC,GAAgC,EAClB;AAAA,EAAA,IAFZC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,cAAA,GAAAH,IAAA,CAAEI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IAAEE,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,SAAS,GAAAN,IAAA,CAATM,SAAS;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAT,IAAA,EAAAU,SAAA,CAAA;AAGjE,EAAA,IAAAC,eAAA,GAAoCb,KAAK,CAACc,QAAQ,CAAU,KAAK,CAAC;IAAAC,gBAAA,GAAAC,cA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,OAAO,EAAEV,WAAY;AACrBW,IAAAA,QAAQ,EAAC,QAAQ;AACjBC,IAAAA,IAAI,EAAC,QAAQ;AACbC,IAAAA,IAAI,EAAC,OAAO;AACZC,IAAAA,SAAS,EAAC,QAAQ;AAClBC,IAAAA,UAAU,EAAC,UAAU;AACrBC,IAAAA,KAAK,EAAC;AAAS,GACf,CACD,eACDzE,KAAA,CAAA0D,aAAA,CAAA,KAAA,EAAA;AAAKpD,IAAAA,SAAS,EAAE0C;AAAsB,GAAA,EAAE5C,QAAc,CACzC,CACN,CACR,CAAC;AAEL,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlLiveRegion.js","sources":["../../../../../src/components/live-region/MrlLiveRegion/MrlLiveRegion.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport uniqueId from 'lodash.uniqueid';\nimport * as React from 'react';\nimport { useMemo, useState } from 'react';\n\ntype AriaRelevant = 'additions' | 'all' | 'removals' | 'text' | 'additions text' | undefined;\n\nexport interface MrlLiveRegionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n\tariaAtomic?: boolean;\n\tariaLive: 'polite' | 'assertive' | 'off';\n\tariaRelevant?: AriaRelevant;\n\tid?: string;\n\tshouldClearContent?: boolean;\n\tsrContent: string;\n\tvisible?: boolean;\n}\n\n/**\n * Live region component to render an HTML live region with the provided content.\n *\n * @param props - The live region component props.\n * @returns The live region component.\n */\nexport const MrlLiveRegion = ({\n\tariaAtomic,\n\tariaLive,\n\tariaRelevant,\n\tid,\n\tsrContent,\n\tvisible = false,\n\tshouldClearContent = false,\n\t...props\n}: MrlLiveRegionProps): React.ReactElement => {\n\tconst [content, setContent] = useState('');\n\n\tReact.useEffect(() => {\n\t\tsetContent(srContent);\n\n\t\tif (shouldClearContent) {\n\t\t\tconst contentTimeout = setTimeout(() => {\n\t\t\t\tsetContent('');\n\t\t\t\tclearTimeout(contentTimeout);\n\t\t\t}, 1000);\n\n\t\t\treturn () => clearTimeout(contentTimeout);\n\t\t}\n\t}, [shouldClearContent, srContent]);\n\n\tconst nodeId = useMemo(() => id || uniqueId('live-region-'), [id]);\n\n\tconst dataQaProp = (props as { 'data-qa'?: string })['data-qa'];\n\tconst dataQa = dataQaProp || `${nodeId}-live-region`;\n\n\tconst classes = classNames('MrlLiveRegion', {\n\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t'mrl-visually-hidden': !visible\n\t});\n\n\treturn (\n\t\t<p\n\t\t\t{...(ariaAtomic ? { 'aria-atomic': ariaAtomic } : {})}\n\t\t\taria-live={ariaLive}\n\t\t\t{...(ariaRelevant ? { 'aria-relevant': ariaRelevant } : {})}\n\t\t\tclassName={classes}\n\t\t\tdata-qa={dataQa}\n\t\t\tid={nodeId}\n\t\t\t{...props}\n\t\t>\n\t\t\t{content}\n\t\t</p>\n\t);\n};\n"],"names":["MrlLiveRegion","_ref","ariaAtomic","ariaLive","ariaRelevant","id","srContent","_ref$visible","visible","_ref$shouldClearConte","shouldClearContent","props","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","content","setContent","React","useEffect","contentTimeout","setTimeout","clearTimeout","nodeId","useMemo","uniqueId","dataQaProp","dataQa","concat","classes","classNames","createElement","_extends","className"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"MrlLiveRegion.js","sources":["../../../../../src/components/live-region/MrlLiveRegion/MrlLiveRegion.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport uniqueId from 'lodash.uniqueid';\nimport * as React from 'react';\nimport { useMemo, useState } from 'react';\n\ntype AriaRelevant = 'additions' | 'all' | 'removals' | 'text' | 'additions text' | undefined;\n\nexport interface MrlLiveRegionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n\t/** Sets `aria-atomic`: announce the whole region on every change instead of only the changed part. */\n\tariaAtomic?: boolean;\n\t/** Sets `aria-live`: how urgently screen readers announce changes. */\n\tariaLive: 'polite' | 'assertive' | 'off';\n\t/** Sets `aria-relevant`: which kinds of change are announced. */\n\tariaRelevant?: AriaRelevant;\n\tid?: string;\n\t/** Empties the region one second after `srContent` changes. */\n\tshouldClearContent?: boolean;\n\t/** Text announced by the live region. */\n\tsrContent: string;\n\t/** Shows the text on screen. By default the region is visually hidden. */\n\tvisible?: boolean;\n}\n\n/**\n * Live region component to render an HTML live region with the provided content.\n *\n * @param props - The live region component props.\n * @returns The live region component.\n */\nexport const MrlLiveRegion = ({\n\tariaAtomic,\n\tariaLive,\n\tariaRelevant,\n\tid,\n\tsrContent,\n\tvisible = false,\n\tshouldClearContent = false,\n\t...props\n}: MrlLiveRegionProps): React.ReactElement => {\n\tconst [content, setContent] = useState('');\n\n\tReact.useEffect(() => {\n\t\tsetContent(srContent);\n\n\t\tif (shouldClearContent) {\n\t\t\tconst contentTimeout = setTimeout(() => {\n\t\t\t\tsetContent('');\n\t\t\t\tclearTimeout(contentTimeout);\n\t\t\t}, 1000);\n\n\t\t\treturn () => clearTimeout(contentTimeout);\n\t\t}\n\t}, [shouldClearContent, srContent]);\n\n\tconst nodeId = useMemo(() => id || uniqueId('live-region-'), [id]);\n\n\tconst dataQaProp = (props as { 'data-qa'?: string })['data-qa'];\n\tconst dataQa = dataQaProp || `${nodeId}-live-region`;\n\n\tconst classes = classNames('MrlLiveRegion', {\n\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t'mrl-visually-hidden': !visible\n\t});\n\n\treturn (\n\t\t<p\n\t\t\t{...(ariaAtomic ? { 'aria-atomic': ariaAtomic } : {})}\n\t\t\taria-live={ariaLive}\n\t\t\t{...(ariaRelevant ? { 'aria-relevant': ariaRelevant } : {})}\n\t\t\tclassName={classes}\n\t\t\tdata-qa={dataQa}\n\t\t\tid={nodeId}\n\t\t\t{...props}\n\t\t>\n\t\t\t{content}\n\t\t</p>\n\t);\n};\n"],"names":["MrlLiveRegion","_ref","ariaAtomic","ariaLive","ariaRelevant","id","srContent","_ref$visible","visible","_ref$shouldClearConte","shouldClearContent","props","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","content","setContent","React","useEffect","contentTimeout","setTimeout","clearTimeout","nodeId","useMemo","uniqueId","dataQaProp","dataQa","concat","classes","classNames","createElement","_extends","className"],"mappings":";;;;;;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,aAAa,GAAGC,IAAA,IASiB;AAAA,EAAA,IAR7CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,SAAS,GAAAL,IAAA,CAATK,SAAS;IAAAC,YAAA,GAAAN,IAAA,CACTO,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,YAAA;IAAAE,qBAAA,GAAAR,IAAA,CACfS,kBAAkB;AAAlBA,IAAAA,kBAAkB,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;AACvBE,IAAAA,KAAK,GAAAC,wBAAA,CAAAX,IAAA,EAAAY,SAAA,CAAA;AAER,EAAA,IAAAC,SAAA,GAA8BC,QAAQ,CAAC,EAAE,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAnCI,IAAAA,OAAO,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,UAAU,GAAAH,UAAA,CAAA,CAAA,CAAA;EAE1BI,KAAK,CAACC,SAAS,CAAC,MAAM;IACrBF,UAAU,CAACb,SAAS,CAAC;AAErB,IAAA,IAAII,kBAAkB,EAAE;AACvB,MAAA,IAAMY,cAAc,GAAGC,UAAU,CAAC,MAAM;QACvCJ,UAAU,CAAC,EAAE,CAAC;QACdK,YAAY,CAACF,cAAc,CAAC;MAC7B,CAAC,EAAE,IAAI,CAAC;AAER,MAAA,OAAO,MAAME,YAAY,CAACF,cAAc,CAAC;AAC1C,IAA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