@muraldevkit/ui-toolkit 4.78.2 → 4.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/components/avatar/MrlAvatarButton/MrlAvatarButton.js +2 -1
  2. package/dist/cjs/components/avatar/MrlAvatarButton/MrlAvatarButton.js.map +1 -1
  3. package/dist/cjs/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js +4 -2
  4. package/dist/cjs/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js.map +1 -1
  5. package/dist/cjs/components/button/MrlButton/MrlButton.js +2 -1
  6. package/dist/cjs/components/button/MrlButton/MrlButton.js.map +1 -1
  7. package/dist/cjs/components/button/MrlIconButton/MrlIconButton.js +3 -1
  8. package/dist/cjs/components/button/MrlIconButton/MrlIconButton.js.map +1 -1
  9. package/dist/cjs/components/link/MrlLinkButton/MrlLinkButton.js +2 -1
  10. package/dist/cjs/components/link/MrlLinkButton/MrlLinkButton.js.map +1 -1
  11. package/dist/cjs/components/pagination/MrlPaginationButton/MrlPaginationButton.js +4 -2
  12. package/dist/cjs/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
  13. package/dist/cjs/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
  14. package/dist/cjs/components/tooltip/MrlTooltip/MrlTooltip.js +5 -0
  15. package/dist/cjs/components/tooltip/MrlTooltip/MrlTooltip.js.map +1 -1
  16. package/dist/cjs/version.js +1 -1
  17. package/dist/cjs/version.js.map +1 -1
  18. package/dist/components/avatar/MrlAvatarButton/MrlAvatarButton.d.ts +2 -1
  19. package/dist/components/button/MrlButton/MrlButton.d.ts +1 -19
  20. package/dist/components/button/MrlIconButton/MrlIconButton.d.ts +8 -0
  21. package/dist/components/link/MrlLinkButton/MrlLinkButton.d.ts +1 -1
  22. package/dist/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +9 -1
  23. package/dist/components/svg/config.d.ts +1 -1
  24. package/dist/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +1 -0
  25. package/dist/components/tooltip/MrlTooltip/MrlTooltip.d.ts +11 -3
  26. package/dist/components/tooltip/MrlTooltip/index.d.ts +1 -1
  27. package/dist/esm/components/avatar/MrlAvatarButton/MrlAvatarButton.js +2 -1
  28. package/dist/esm/components/avatar/MrlAvatarButton/MrlAvatarButton.js.map +1 -1
  29. package/dist/esm/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js +4 -2
  30. package/dist/esm/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js.map +1 -1
  31. package/dist/esm/components/button/MrlButton/MrlButton.js +2 -1
  32. package/dist/esm/components/button/MrlButton/MrlButton.js.map +1 -1
  33. package/dist/esm/components/button/MrlIconButton/MrlIconButton.js +3 -1
  34. package/dist/esm/components/button/MrlIconButton/MrlIconButton.js.map +1 -1
  35. package/dist/esm/components/link/MrlLinkButton/MrlLinkButton.js +2 -1
  36. package/dist/esm/components/link/MrlLinkButton/MrlLinkButton.js.map +1 -1
  37. package/dist/esm/components/pagination/MrlPaginationButton/MrlPaginationButton.js +4 -2
  38. package/dist/esm/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
  39. package/dist/esm/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
  40. package/dist/esm/components/tooltip/MrlTooltip/MrlTooltip.js +5 -0
  41. package/dist/esm/components/tooltip/MrlTooltip/MrlTooltip.js.map +1 -1
  42. package/dist/esm/version.js +1 -1
  43. package/dist/esm/version.js.map +1 -1
  44. package/dist/types/components/avatar/MrlAvatarButton/MrlAvatarButton.d.ts +2 -1
  45. package/dist/types/components/button/MrlButton/MrlButton.d.ts +1 -19
  46. package/dist/types/components/button/MrlIconButton/MrlIconButton.d.ts +8 -0
  47. package/dist/types/components/link/MrlLinkButton/MrlLinkButton.d.ts +1 -1
  48. package/dist/types/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +9 -1
  49. package/dist/types/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +1 -0
  50. package/dist/types/components/tooltip/MrlTooltip/MrlTooltip.d.ts +11 -3
  51. package/dist/types/components/tooltip/MrlTooltip/index.d.ts +1 -1
  52. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MrlIconButton.js","sources":["../../../../../src/components/button/MrlIconButton/MrlIconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tbuttonDefaults,\n\tMrlButtonKind,\n\tMrlButtonSize,\n\tMrlGhostIconButtonSize,\n\tToggleAria\n} from '../constants';\nimport { _isDisabled, _isSelected, _isToggleButton, _spinnerProps } from '../helpers';\nimport { AttrsObject, MrlComponentProps, setAttributes, getUniqueId } from '../../../utils';\nimport { MrlTooltipAnchor, MrlTooltipDefaults, MrlTooltipPosition } from '../../tooltip/constants';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltip } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport type { MrlButtonState, ToggleStyle } from '../MrlButton/MrlButton';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\nimport './MrlIconButton.scss';\n\nexport interface MrlIconButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'button'> {\n\t/**\n\t * Applies additional HTML attributes to the button element.\n\t * @deprecated\n\t */\n\tattrs?: AttrsObject;\n\t/**\n\t * Allow developers to add badge to buttons.\n\t */\n\tbadge?: React.ReactElement;\n\t/** Additional class to add to the button */\n\tclassName?: string;\n\t/**\n\t * Allows developers the ability to disable built in event listeners so they can manage user\n\t * interactions from the application.\n\t */\n\tdisableEvents?: boolean;\n\n\t/** Whether to disable the tooltip hover action that keeps it open */\n\tdisableTooltipHover?: boolean;\n\n\t/**\n\t * The icon that will be rendered.\n\t */\n\ticon: React.ReactElement;\n\t/**\n\t * Changes the visual emphasis of the button.\n\t *\n\t * Note: size=\"xsmall\" should ONLY be used with a kind of `ghost` or `ghost-inverse`.\n\t */\n\tkind?: MrlButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * onKeyDown event for the button.\n\t */\n\tonKeyUp?: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * onMouseUp event for the button.\n\t */\n\tonMouseUp?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * The placement of the tooltip in relation to the button.\n\t */\n\tposition?: MrlTooltipPosition;\n\t/**\n\t * Changes the size of the button so it can scale with its surrounding context.\n\t *\n\t * Note: size=\"xsmall\" should ONLY be used with a kind of `ghost` or `ghost-inverse`.\n\t */\n\tsize?: MrlButtonSize | MrlGhostIconButtonSize;\n\t/**\n\t * Changes the state of the button based on user permissions or actions.\n\t *\n\t * Note: The Basic Button does not fully support state=\"disabled\", use\n\t * the 'disabled' prop instead. Since it does not support state=\"disabled\",\n\t * it also doesn't not support state=\"selected-disabled\".\n\t */\n\tstate?: MrlButtonState;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\t/**\n\t * The arrow position of the tooltip in relation to the button.\n\t */\n\ttipAnchor?: MrlTooltipAnchor;\n\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'board-share-cta'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\n\t/**\n\t * Determines which aria setup to use for various toggle/selected styles.\n\t * pressed - use for an traditional “toggle button”\n\t * selected - use for tabs and custom select options\n\t * expanded - use for menus, panels, and popovers\n\t * checked - use for custom [radiobutton](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/#wai-aria-roles-states-and-properties-16)\n\t * \t\tor [checkbox](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/#wai-aria-roles-states-and-properties-5) inputs\n\t */\n\ttoggleAria?: ToggleAria;\n\t/**\n\t * Selected state variant when the button is a Toggle Button. The visual styles\n\t * are also impacted by the \"kind\" prop. Toggle buttons are only supported\n\t * when \"kind\" is set to either \"ghost\" or \"ghost-inverse\". Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\ttoggleStyle?: ToggleStyle;\n\n\t/**\n\t * An optional class name to add to the tooltip wrapper.\n\t */\n\twrapperClassName?: string;\n\n\t/**\n\t * Controlled state that overrides the internal state management.\n\t * When provided, this takes precedence over the `state` prop and allows\n\t * the parent component to fully control the icon button's state.\n\t */\n\tcontrolledState?: MrlButtonState;\n}\n\nexport const MrlIconButton = React.forwardRef<HTMLButtonElement, MrlIconButtonProps>(\n\tfunction MrlIconButton(\n\t\t{\n\t\t\t['aria-label']: ariaLabel,\n\t\t\tattrs = {},\n\t\t\tbadge,\n\t\t\tclassName,\n\t\t\tdisableEvents = false,\n\t\t\tdisableTooltipHover = false,\n\t\t\ticon,\n\t\t\t// We intentionally deviate from the basic button for icon-buttons since the vast\n\t\t\t// majority of icon buttons are ghost buttons. The proptype remains\n\t\t\t// consistent with the basic button however to keep our code DRY.\n\t\t\tkind = 'ghost',\n\t\t\tloading = false,\n\t\t\tloadingText = spinnerDefaults.text,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tonMouseUp,\n\t\t\tposition = MrlTooltipDefaults.position,\n\t\t\ttoggleAria = buttonDefaults.toggleAria,\n\t\t\ttoggleStyle,\n\t\t\ttext,\n\t\t\ttipAnchor = MrlTooltipDefaults.anchor,\n\t\t\teventId,\n\t\t\tsize = buttonDefaults.size,\n\t\t\tstate = buttonDefaults.state,\n\t\t\twrapperClassName,\n\t\t\tcontrolledState,\n\t\t\t...remainingProps\n\t\t}: MrlIconButtonProps,\n\t\tref\n\t) {\n\t\t/**\n\t\t * Determine the effective button state.\n\t\t * Uses controlledState if provided (controlled mode),\n\t\t * otherwise falls back to the state prop (uncontrolled mode).\n\t\t * This allows the component to work in both controlled and uncontrolled scenarios.\n\t\t */\n\t\tconst effectiveButtonState = controlledState ?? state;\n\n\t\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(effectiveButtonState));\n\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlIconButton', eventId);\n\n\t\tconst buttonRef = React.useRef<HTMLButtonElement>(null);\n\t\tReact.useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(\n\t\t\tref,\n\t\t\t() => buttonRef.current\n\t\t);\n\n\t\t/**\n\t\t * MrlIconButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'\n\t\t */\n\t\tconst isToggleButton = toggleStyle && _isToggleButton(toggleStyle);\n\n\t\t/**\n\t\t * We need to watch the value of state to keep in sync\n\t\t * the value of state passed as props and the internal\n\t\t * isSelected piece of state.\n\t\t */\n\t\tReact.useEffect(() => {\n\t\t\t// allows consumers to set the 'selected' or 'selected-disabled' state from a parent component.\n\t\t\tsetIsSelected(_isSelected(effectiveButtonState));\n\t\t}, [effectiveButtonState]);\n\n\t\t/**\n\t\t * Handle onClick events\n\t\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t\t */\n\t\tfunction handleOnClick(e: React.MouseEvent<HTMLButtonElement>) {\n\t\t\te.stopPropagation();\n\n\t\t\tif (_isDisabled(effectiveButtonState, loading) || disableEvents) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttrackInteraction({ action: 'click', variant: kind });\n\n\t\t\tif (isToggleButton && !controlledState) {\n\t\t\t\tsetIsSelected((prevIsSelected) => !prevIsSelected);\n\t\t\t}\n\n\t\t\tif (onClick && typeof onClick === 'function') {\n\t\t\t\tonClick(e);\n\t\t\t}\n\t\t}\n\n\t\tconst classNames = classnames(\n\t\t\t'mrlIconButton',\n\t\t\t`mrlIconButton--${size}`,\n\t\t\t`mrlIconButton--${kind}`,\n\t\t\tisToggleButton && toggleStyle && `toggleStyle--${toggleStyle}`,\n\t\t\tattrs.class || attrs.className,\n\t\t\tclassName\n\t\t);\n\n\t\tdelete attrs.class;\n\t\tdelete attrs.className;\n\n\t\tconst getAriaLabel = (): string => {\n\t\t\t// Set loading text if loading\n\t\t\tif (loading) return `${loadingText} ${text}`;\n\n\t\t\t// Only set aria-label if we have actual content\n\t\t\tconst hasAriaLabel = ariaLabel && ariaLabel.trim() !== '';\n\n\t\t\t// If we have a custom ariaLabel, override the default text\n\t\t\tif (hasAriaLabel) return ariaLabel;\n\n\t\t\t// Fallback to icon button text\n\t\t\treturn text;\n\t\t};\n\n\t\tconst ariaLabelValue = getAriaLabel();\n\n\t\tconst attributes = setAttributes(attrs, {\n\t\t\t'aria-disabled': _isDisabled(effectiveButtonState, loading),\n\t\t\t'aria-label': ariaLabelValue,\n\t\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\t\ttype: 'button'\n\t\t});\n\n\t\t// MrlSvg should always have size=\"auto\"\n\t\tconst iconWithSizeAuto = React.useMemo(\n\t\t\t() =>\n\t\t\t\tReact.cloneElement(icon, {\n\t\t\t\t\tsize: 'auto'\n\t\t\t\t}),\n\t\t\t[icon]\n\t\t);\n\n\t\tconst spinnerProps = _spinnerProps(kind, size);\n\t\tconst spinner = <MrlSpinner kind={spinnerProps.kind} size={spinnerProps.size} />;\n\n\t\tconst dataQaProp = (remainingProps as { 'data-qa'?: string })['data-qa'];\n\t\tconst tooltipQa = dataQaProp ? `${dataQaProp}-tooltip` : getUniqueId('tooltip');\n\t\tconst tooltipContentClass =\n\t\t\tsize === 'xsmall' || size === 'small' ? `mrlIconButton--${size}-wrapper` : undefined;\n\n\t\treturn (\n\t\t\t<MrlTooltip\n\t\t\t\tanchor={tipAnchor}\n\t\t\t\tdataQa={tooltipQa}\n\t\t\t\tposition={position}\n\t\t\t\ttext={text}\n\t\t\t\ttooltipClass={classnames('mrlIconButton-wrapper', wrapperClassName)}\n\t\t\t\ttooltipContentClass={tooltipContentClass}\n\t\t\t\tdisableTooltipHover={disableTooltipHover}\n\t\t\t\tsrAnnouncement={false}\n\t\t\t>\n\t\t\t\t<button\n\t\t\t\t\t{...attributes}\n\t\t\t\t\t{...remainingProps}\n\t\t\t\t\tclassName={classNames}\n\t\t\t\t\tref={buttonRef}\n\t\t\t\t\tonClick={handleOnClick}\n\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\tonMouseUp={onMouseUp}\n\t\t\t\t>\n\t\t\t\t\t{loading ? spinner : iconWithSizeAuto}\n\t\t\t\t\t{badge}\n\t\t\t\t</button>\n\t\t\t</MrlTooltip>\n\t\t);\n\t}\n);\n"],"names":["MrlIconButton","React","forwardRef","_ref","ref","ariaLabel","_ref$attrs","attrs","badge","className","_ref$disableEvents","disableEvents","_ref$disableTooltipHo","disableTooltipHover","icon","_ref$kind","kind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","onKeyUp","onMouseUp","_ref$position","position","MrlTooltipDefaults","_ref$toggleAria","toggleAria","buttonDefaults","toggleStyle","_ref$tipAnchor","tipAnchor","anchor","eventId","_ref$size","size","_ref$state","state","wrapperClassName","controlledState","remainingProps","_objectWithoutProperties","_excluded","effectiveButtonState","_React$useState","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","trackInteraction","useMrlTrackInteraction","buttonRef","useRef","useImperativeHandle","current","isToggleButton","_isToggleButton","useEffect","handleOnClick","e","stopPropagation","_isDisabled","action","variant","prevIsSelected","classNames","classnames","concat","class","getAriaLabel","hasAriaLabel","trim","ariaLabelValue","attributes","setAttributes","_objectSpread","type","iconWithSizeAuto","useMemo","cloneElement","spinnerProps","_spinnerProps","spinner","createElement","MrlSpinner","dataQaProp","tooltipQa","getUniqueId","tooltipContentClass","undefined","MrlTooltip","dataQa","tooltipClass","srAnnouncement","_extends"],"mappings":";;;;;;;;;;;;;AA4IO,IAAMA,aAAa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,YAAY,CAAC/C;AAAK,GAAE,CAAC;AAEhF,EAAA,IAAMoD,UAAU,GAAI/C,cAAc,CAA4B,SAAS,CAAC;EACxE,IAAMgD,SAAS,GAAGD,UAAU,GAAA,EAAA,CAAAlB,MAAA,CAAMkB,UAAU,EAAA,UAAA,CAAA,GAAaE,WAAW,CAAC,SAAS,CAAC;AAC/E,EAAA,IAAMC,mBAAmB,GACxBvD,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,OAAO,GAAA,iBAAA,CAAAkC,MAAA,CAAqBlC,IAAI,gBAAawD,SAAS;AAErF,EAAA,oBACC7F,KAAA,CAAAuF,aAAA,CAACO,UAAU,EAAA;AACV5D,IAAAA,MAAM,EAAED,SAAU;AAClB8D,IAAAA,MAAM,EAAEL,SAAU;AAClBhE,IAAAA,QAAQ,EAAEA,QAAS;AACnBL,IAAAA,IAAI,EAAEA,IAAK;AACX2E,IAAAA,YAAY,EAAE1B,UAAU,CAAC,uBAAuB,EAAE9B,gBAAgB,CAAE;AACpEoD,IAAAA,mBAAmB,EAAEA,mBAAoB;AACzChF,IAAAA,mBAAmB,EAAEA,mBAAoB;AACzCqF,IAAAA,cAAc,EAAE;GAAM,eAEtBjG,KAAA,CAAAuF,aAAA,CAAA,QAAA,EAAAW,QAAA,CAAA,EAAA,EACKrB,UAAU,EACVnC,cAAc,EAAA;AAClBlC,IAAAA,SAAS,EAAE6D,UAAW;AACtBlE,IAAAA,GAAG,EAAEoD,SAAU;AACfjC,IAAAA,OAAO,EAAEwC,aAAc;AACvBvC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,SAAS,EAAEA;GAAU,CAAA,EAEpBP,OAAO,GAAGqE,OAAO,GAAGL,gBAAgB,EACpC1E,KACM,CACG,CAAC;AAEf,CACD;;;;"}
1
+ {"version":3,"file":"MrlIconButton.js","sources":["../../../../../src/components/button/MrlIconButton/MrlIconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tbuttonDefaults,\n\tMrlButtonKind,\n\tMrlButtonSize,\n\tMrlGhostIconButtonSize,\n\tToggleAria\n} from '../constants';\nimport { _isDisabled, _isSelected, _isToggleButton, _spinnerProps } from '../helpers';\nimport { AttrsObject, MrlComponentProps, setAttributes, getUniqueId } from '../../../utils';\nimport { MrlTooltipAnchor, MrlTooltipDefaults, MrlTooltipPosition } from '../../tooltip/constants';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltip, type MrlTooltipProps } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport type { MrlButtonState, ToggleStyle } from '../MrlButton/MrlButton';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\nimport './MrlIconButton.scss';\n\nexport interface MrlIconButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'button'> {\n\t/**\n\t * Applies additional HTML attributes to the button element.\n\t * @deprecated\n\t */\n\tattrs?: AttrsObject;\n\t/**\n\t * Allow developers to add badge to buttons.\n\t */\n\tbadge?: React.ReactElement;\n\t/** Additional class to add to the button */\n\tclassName?: string;\n\t/**\n\t * Allows developers the ability to disable built in event listeners so they can manage user\n\t * interactions from the application.\n\t */\n\tdisableEvents?: boolean;\n\n\t/** Whether to disable the tooltip hover action that keeps it open */\n\tdisableTooltipHover?: boolean;\n\n\t/**\n\t * The icon that will be rendered.\n\t */\n\ticon: React.ReactElement;\n\t/**\n\t * Changes the visual emphasis of the button.\n\t *\n\t * Note: size=\"xsmall\" should ONLY be used with a kind of `ghost` or `ghost-inverse`.\n\t */\n\tkind?: MrlButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * onKeyDown event for the button.\n\t */\n\tonKeyUp?: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * onMouseUp event for the button.\n\t */\n\tonMouseUp?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * The placement of the tooltip in relation to the button.\n\t */\n\tposition?: MrlTooltipPosition;\n\t/**\n\t * Changes the size of the button so it can scale with its surrounding context.\n\t *\n\t * Note: size=\"xsmall\" should ONLY be used with a kind of `ghost` or `ghost-inverse`.\n\t */\n\tsize?: MrlButtonSize | MrlGhostIconButtonSize;\n\t/**\n\t * Changes the state of the button based on user permissions or actions.\n\t *\n\t * Note: The Basic Button does not fully support state=\"disabled\", use\n\t * the 'disabled' prop instead. Since it does not support state=\"disabled\",\n\t * it also doesn't not support state=\"selected-disabled\".\n\t */\n\tstate?: MrlButtonState;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\t/**\n\t * The arrow position of the tooltip in relation to the button.\n\t */\n\ttipAnchor?: MrlTooltipAnchor;\n\n\t/**\n\t * Renders custom tooltip content instead of the plain `text`. Receives `text` as\n\t * its argument. `text` is still required and used for accessibility.\n\t *\n\t * Note: `MrlTooltip` is memoized, so this function should be memoized by consumers.\n\t */\n\ttooltipCustomRender?: MrlTooltipProps['customRender'];\n\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'board-share-cta'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\n\t/**\n\t * Determines which aria setup to use for various toggle/selected styles.\n\t * pressed - use for an traditional “toggle button”\n\t * selected - use for tabs and custom select options\n\t * expanded - use for menus, panels, and popovers\n\t * checked - use for custom [radiobutton](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/#wai-aria-roles-states-and-properties-16)\n\t * \t\tor [checkbox](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/#wai-aria-roles-states-and-properties-5) inputs\n\t */\n\ttoggleAria?: ToggleAria;\n\t/**\n\t * Selected state variant when the button is a Toggle Button. The visual styles\n\t * are also impacted by the \"kind\" prop. Toggle buttons are only supported\n\t * when \"kind\" is set to either \"ghost\" or \"ghost-inverse\". Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\ttoggleStyle?: ToggleStyle;\n\n\t/**\n\t * An optional class name to add to the tooltip wrapper.\n\t */\n\twrapperClassName?: string;\n\n\t/**\n\t * Controlled state that overrides the internal state management.\n\t * When provided, this takes precedence over the `state` prop and allows\n\t * the parent component to fully control the icon button's state.\n\t */\n\tcontrolledState?: MrlButtonState;\n}\n\nexport const MrlIconButton = React.forwardRef<HTMLButtonElement, MrlIconButtonProps>(\n\tfunction MrlIconButton(\n\t\t{\n\t\t\t['aria-label']: ariaLabel,\n\t\t\tattrs = {},\n\t\t\tbadge,\n\t\t\tclassName,\n\t\t\tdisableEvents = false,\n\t\t\tdisableTooltipHover = false,\n\t\t\ticon,\n\t\t\t// We intentionally deviate from the basic button for icon-buttons since the vast\n\t\t\t// majority of icon buttons are ghost buttons. The proptype remains\n\t\t\t// consistent with the basic button however to keep our code DRY.\n\t\t\tkind = 'ghost',\n\t\t\tloading = false,\n\t\t\tloadingText = spinnerDefaults.text,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tonMouseUp,\n\t\t\tposition = MrlTooltipDefaults.position,\n\t\t\ttoggleAria = buttonDefaults.toggleAria,\n\t\t\ttoggleStyle,\n\t\t\ttext,\n\t\t\ttipAnchor = MrlTooltipDefaults.anchor,\n\t\t\ttooltipCustomRender,\n\t\t\teventId,\n\t\t\tsize = buttonDefaults.size,\n\t\t\tstate = buttonDefaults.state,\n\t\t\twrapperClassName,\n\t\t\tcontrolledState,\n\t\t\t...remainingProps\n\t\t}: MrlIconButtonProps,\n\t\tref\n\t) {\n\t\t/**\n\t\t * Determine the effective button state.\n\t\t * Uses controlledState if provided (controlled mode),\n\t\t * otherwise falls back to the state prop (uncontrolled mode).\n\t\t * This allows the component to work in both controlled and uncontrolled scenarios.\n\t\t */\n\t\tconst effectiveButtonState = controlledState ?? state;\n\n\t\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(effectiveButtonState));\n\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlIconButton', eventId);\n\n\t\tconst buttonRef = React.useRef<HTMLButtonElement>(null);\n\t\tReact.useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(\n\t\t\tref,\n\t\t\t() => buttonRef.current\n\t\t);\n\n\t\t/**\n\t\t * MrlIconButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'\n\t\t */\n\t\tconst isToggleButton = toggleStyle && _isToggleButton(toggleStyle);\n\n\t\t/**\n\t\t * We need to watch the value of state to keep in sync\n\t\t * the value of state passed as props and the internal\n\t\t * isSelected piece of state.\n\t\t */\n\t\tReact.useEffect(() => {\n\t\t\t// allows consumers to set the 'selected' or 'selected-disabled' state from a parent component.\n\t\t\tsetIsSelected(_isSelected(effectiveButtonState));\n\t\t}, [effectiveButtonState]);\n\n\t\t/**\n\t\t * Handle onClick events\n\t\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t\t */\n\t\tfunction handleOnClick(e: React.MouseEvent<HTMLButtonElement>) {\n\t\t\te.stopPropagation();\n\n\t\t\tif (_isDisabled(effectiveButtonState, loading) || disableEvents) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttrackInteraction({ action: 'click', variant: kind });\n\n\t\t\tif (isToggleButton && !controlledState) {\n\t\t\t\tsetIsSelected((prevIsSelected) => !prevIsSelected);\n\t\t\t}\n\n\t\t\tif (onClick && typeof onClick === 'function') {\n\t\t\t\tonClick(e);\n\t\t\t}\n\t\t}\n\n\t\tconst classNames = classnames(\n\t\t\t'mrlIconButton',\n\t\t\t`mrlIconButton--${size}`,\n\t\t\t`mrlIconButton--${kind}`,\n\t\t\tisToggleButton && toggleStyle && `toggleStyle--${toggleStyle}`,\n\t\t\tattrs.class || attrs.className,\n\t\t\tclassName\n\t\t);\n\n\t\tdelete attrs.class;\n\t\tdelete attrs.className;\n\n\t\tconst getAriaLabel = (): string => {\n\t\t\t// Set loading text if loading\n\t\t\tif (loading) return `${loadingText} ${text}`;\n\n\t\t\t// Only set aria-label if we have actual content\n\t\t\tconst hasAriaLabel = ariaLabel && ariaLabel.trim() !== '';\n\n\t\t\t// If we have a custom ariaLabel, override the default text\n\t\t\tif (hasAriaLabel) return ariaLabel;\n\n\t\t\t// Fallback to icon button text\n\t\t\treturn text;\n\t\t};\n\n\t\tconst ariaLabelValue = getAriaLabel();\n\n\t\tconst attributes = setAttributes(attrs, {\n\t\t\t'aria-disabled': _isDisabled(effectiveButtonState, loading),\n\t\t\t'aria-label': ariaLabelValue,\n\t\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\t\ttype: 'button'\n\t\t});\n\n\t\t// MrlSvg should always have size=\"auto\"\n\t\tconst iconWithSizeAuto = React.useMemo(\n\t\t\t() =>\n\t\t\t\tReact.cloneElement(icon, {\n\t\t\t\t\tsize: 'auto'\n\t\t\t\t}),\n\t\t\t[icon]\n\t\t);\n\n\t\tconst spinnerProps = _spinnerProps(kind, size);\n\t\tconst spinner = <MrlSpinner kind={spinnerProps.kind} size={spinnerProps.size} />;\n\n\t\tconst dataQaProp = (remainingProps as { 'data-qa'?: string })['data-qa'];\n\t\tconst tooltipQa = dataQaProp ? `${dataQaProp}-tooltip` : getUniqueId('tooltip');\n\t\tconst tooltipContentClass =\n\t\t\tsize === 'xsmall' || size === 'small' ? `mrlIconButton--${size}-wrapper` : undefined;\n\n\t\treturn (\n\t\t\t<MrlTooltip\n\t\t\t\tanchor={tipAnchor}\n\t\t\t\tdataQa={tooltipQa}\n\t\t\t\tposition={position}\n\t\t\t\ttext={text}\n\t\t\t\tcustomRender={tooltipCustomRender}\n\t\t\t\ttooltipClass={classnames('mrlIconButton-wrapper', wrapperClassName)}\n\t\t\t\ttooltipContentClass={tooltipContentClass}\n\t\t\t\tdisableTooltipHover={disableTooltipHover}\n\t\t\t\tsrAnnouncement={false}\n\t\t\t>\n\t\t\t\t<button\n\t\t\t\t\t{...attributes}\n\t\t\t\t\t{...remainingProps}\n\t\t\t\t\tclassName={classNames}\n\t\t\t\t\tref={buttonRef}\n\t\t\t\t\tonClick={handleOnClick}\n\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\tonMouseUp={onMouseUp}\n\t\t\t\t>\n\t\t\t\t\t{loading ? spinner : iconWithSizeAuto}\n\t\t\t\t\t{badge}\n\t\t\t\t</button>\n\t\t\t</MrlTooltip>\n\t\t);\n\t}\n);\n"],"names":["MrlIconButton","React","forwardRef","_ref","ref","ariaLabel","_ref$attrs","attrs","badge","className","_ref$disableEvents","disableEvents","_ref$disableTooltipHo","disableTooltipHover","icon","_ref$kind","kind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","onKeyUp","onMouseUp","_ref$position","position","MrlTooltipDefaults","_ref$toggleAria","toggleAria","buttonDefaults","toggleStyle","_ref$tipAnchor","tipAnchor","anchor","tooltipCustomRender","eventId","_ref$size","size","_ref$state","state","wrapperClassName","controlledState","remainingProps","_objectWithoutProperties","_excluded","effectiveButtonState","_React$useState","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","trackInteraction","useMrlTrackInteraction","buttonRef","useRef","useImperativeHandle","current","isToggleButton","_isToggleButton","useEffect","handleOnClick","e","stopPropagation","_isDisabled","action","variant","prevIsSelected","classNames","classnames","concat","class","getAriaLabel","hasAriaLabel","trim","ariaLabelValue","attributes","setAttributes","_objectSpread","type","iconWithSizeAuto","useMemo","cloneElement","spinnerProps","_spinnerProps","spinner","createElement","MrlSpinner","dataQaProp","tooltipQa","getUniqueId","tooltipContentClass","undefined","MrlTooltip","dataQa","customRender","tooltipClass","srAnnouncement","_extends"],"mappings":";;;;;;;;;;;;;AAoJO,IAAMA,aAAa,gBAAGC,KAAK,CAACC,UAAU,CAC5C,SAASF,aAAaA,CAAAG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bottom',
89
89
  anchor: tooltip.anchor || 'center',
90
90
  text: tooltip.text,
91
- dataQa: tooltip.dataQa
91
+ dataQa: tooltip.dataQa,
92
+ customRender: tooltip.customRender
92
93
  }, renderLinkButton());
93
94
  });
94
95
 
@@ -1 +1 @@
1
- {"version":3,"file":"MrlLinkButton.js","sources":["../../../../../src/components/link/MrlLinkButton/MrlLinkButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { buttonDefaults, MrlButtonKind, MrlButtonSize, IconPosition } from '../../button/constants';\nimport { _spinnerProps } from '../../button/helpers';\nimport { defaults, LinkTargetType, MrlLinkButtonKind } from '../constants';\nimport type { TooltipConfig } from '../../button/MrlButton/MrlButton';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltip } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { MrlComponentProps } from '../../../utils';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport './MrlLinkButton.global.scss';\n\nexport interface MrlLinkButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'a'> {\n\t/** Specifies where to redirect the linked document */\n\thref: string;\n\t/** Specifies how to open the linked document */\n\ttarget?: LinkTargetType;\n\t/**\n\t * Allow developers to add icon to buttons.\n\t */\n\ticon?: React.ReactElement;\n\t/**\n\t * Allows developers to right-align an icon within a button.\n\t */\n\ticonPos?: IconPosition;\n\t/**\n\t * Changes the visual emphasis of the button.\n\t */\n\tkind?: MrlLinkButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.SyntheticEvent<HTMLAnchorElement>) => void;\n\t/**\n\t * Changes the size of the button so it can scale with its surrounding context.\n\t */\n\tsize?: MrlButtonSize;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\n\t/**\n\t * Tooltip configuration for the button\n\t */\n\ttooltip?: TooltipConfig;\n\n\t/**\n\t * Enables interaction tracking for this link button. Provide a stable, non-PII id\n\t * (e.g. 'upgrade-plan-cta'). When omitted, the link button emits no analytics.\n\t */\n\teventId?: string;\n}\n\n/**\n * Warning: use this component with care. Our links generally do not look like buttons.\n * If this interaction does not navigate the user - use `MrlButton`.\n */\nexport const MrlLinkButton = React.forwardRef<HTMLAnchorElement, MrlLinkButtonProps>(\n\tfunction MrlLinkButton(\n\t\t{\n\t\t\tclassName,\n\t\t\thref,\n\t\t\ticon,\n\t\t\ticonPos = buttonDefaults.iconPos,\n\t\t\tkind = defaults.linkButtonKind,\n\t\t\tloading = false,\n\t\t\tloadingText = spinnerDefaults.text,\n\t\t\tonClick,\n\t\t\ttarget = defaults.target,\n\t\t\ttext,\n\t\t\tsize = buttonDefaults.size,\n\t\t\ttooltip,\n\t\t\teventId,\n\t\t\t...remainingProps\n\t\t}: MrlLinkButtonProps,\n\t\tref\n\t) {\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlLinkButton', eventId);\n\n\t\t/**\n\t\t * If the link has an href of `#` and an `onClick`\n\t\t * then a button should be used instead. Links should navigate\n\t\t * the user somewhere, and this pattern shows us that we aren't\n\t\t * navigating but are performing an action instead.\n\t\t */\n\t\tif (href === '#' && onClick) {\n\t\t\tconsole.error('Error: `MrlLinkButton` should have an href that navigates the user somewhere');\n\t\t}\n\n\t\t/**\n\t\t * Handle onClick events\n\t\t *\n\t\t * @param {React.MouseEvent<HTMLAnchorElement>} e - mouse event\n\t\t */\n\t\tfunction handleOnClick(e: React.MouseEvent<HTMLAnchorElement>) {\n\t\t\te.stopPropagation();\n\n\t\t\ttrackInteraction({ action: 'click', metadata: { target }, variant: kind });\n\n\t\t\tif (onClick && typeof onClick === 'function') {\n\t\t\t\tonClick(e);\n\t\t\t}\n\t\t}\n\n\t\tconst classNames = classnames(\n\t\t\t'mrlButton mrlLinkButton',\n\t\t\t`mrlButton--${size}`,\n\t\t\t`mrlButton--${kind}`,\n\t\t\t!icon && loading && `mrlButton--loading`,\n\t\t\ticon && `mrlButton--icon-${iconPos}`,\n\t\t\tclassName\n\t\t);\n\n\t\tconst spinnerProps = _spinnerProps(kind as MrlButtonKind, size);\n\t\tconst spinnerClass = icon ? '' : 'mrlButton-spinner';\n\t\tconst spinner = (\n\t\t\t<MrlSpinner\n\t\t\t\tclassName={spinnerClass}\n\t\t\t\tkind={spinnerProps.kind}\n\t\t\t\trole=\"none\"\n\t\t\t\tsize={spinnerProps.size}\n\t\t\t\ttext={loadingText}\n\t\t\t/>\n\t\t);\n\n\t\tconst renderLinkButton = () => (\n\t\t\t<a\n\t\t\t\t{...remainingProps}\n\t\t\t\tclassName={classNames}\n\t\t\t\thref={href}\n\t\t\t\ttarget={target}\n\t\t\t\tref={ref}\n\t\t\t\tonClick={handleOnClick}\n\t\t\t>\n\t\t\t\t{loading ? spinner : icon}\n\t\t\t\t<span className=\"mrlButton-text\">{text}</span>\n\t\t\t</a>\n\t\t);\n\n\t\treturn !tooltip ? (\n\t\t\trenderLinkButton()\n\t\t) : (\n\t\t\t<MrlTooltip\n\t\t\t\tposition={tooltip.position || 'bottom'}\n\t\t\t\tanchor={tooltip.anchor || 'center'}\n\t\t\t\ttext={tooltip.text}\n\t\t\t\tdataQa={tooltip.dataQa}\n\t\t\t>\n\t\t\t\t{renderLinkButton()}\n\t\t\t</MrlTooltip>\n\t\t);\n\t}\n);\n"],"names":["MrlLinkButton","React","forwardRef","_ref","ref","className","href","icon","_ref$iconPos","iconPos","buttonDefaults","_ref$kind","kind","defaults","linkButtonKind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","_ref$target","target","_ref$size","size","tooltip","eventId","remainingProps","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","console","error","handleOnClick","e","stopPropagation","action","metadata","variant","classNames","classnames","concat","spinnerProps","_spinnerProps","spinnerClass","spinner","createElement","MrlSpinner","role","renderLinkButton","_extends","MrlTooltip","position","anchor","dataQa"],"mappings":";;;;;;;;;;;;AAmEA;AACA;AACA;AACA;AACO,IAAMA,aAAa,gBAAGC,KAAK,CAACC,UAAU,CAC5C,SAASF,aAAaA,CAAAG,IAAA,EAiBrBC,GAAG,EACF;AAAA,EAAA,IAhBAC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IAAAC,YAAA,GAAAL,IAAA,CACJM,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAGE,cAAc,CAACD,OAAO,GAAAD,YAAA;IAAAG,SAAA,GAAAR,IAAA,CAChCS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGE,QAAQ,CAACC,cAAc,GAAAH,SAAA;IAAAI,YAAA,GAAAZ,IAAA,CAC9Ba,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,YAAA;IAAAE,gBAAA,GAAAd,IAAA,CACfe,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAA,MAAA,GAAGE,eAAe,CAACC,IAAI,GAAAH,gBAAA;IAClCI,OAAO,GAAAlB,IAAA,CAAPkB,OAAO;IAAAC,WAAA,GAAAnB,IAAA,CACPoB,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,MAAA,GAAGT,QAAQ,CAACU,MAAM,GAAAD,WAAA;IACxBF,IAAI,GAAAjB,IAAA,CAAJiB,IAAI;IAAAI,SAAA,GAAArB,IAAA,CACJsB,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGd,cAAc,CAACe,IAAI,GAAAD,SAAA;IAC1BE,OAAO,GAAAvB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C,IAAAA,SAAS,EAAEyC,YAAa;IACxBlC,IAAI,EAAEgC,YAAY,CAAChC,IAAK;AACxBsC,IAAAA,IAAI,EAAC,MAAM;IACXzB,IAAI,EAAEmB,YAAY,CAACnB,IAAK;AACxBL,IAAAA,IAAI,EAAEF;AAAY,GAClB,CACD;EAED,IAAMiC,gBAAgB,GAAGA,mBACxBlD,KAAA,CAAA+C,aAAA,CAAA,GAAA,EAAAI,QAAA,CAAA,EAAA,EACKxB,cAAc,EAAA;AAClBvB,IAAAA,SAAS,EAAEoC,UAAW;AACtBnC,IAAAA,IAAI,EAAEA,IAAK;AACXiB,IAAAA,MAAM,EAAEA,MAAO;AACfnB,IAAAA,GAAG,EAAEA,GAAI;AACTiB,IAAAA,OAAO,EAAEc;GAAc,CAAA,EAEtBnB,OAAO,GAAG+B,OAAO,GAAGxC,IAAI,eACzBN,KAAA,CAAA+C,aAAA,CAAA,MAAA,EAAA;AAAM3C,IAAAA,SAAS,EAAC;GAAgB,EAAEe,IAAW,CAC3C,CACH;EAED,OAAO,CAACM,OAAO,GACdyB,gBAAgB,EAAE,gBAElBlD,KAAA,CAAA+C,aAAA,CAACK,UAAU,EAAA;AACVC,IAAAA,QAAQ,EAAE5B,OAAO,CAAC4B,QAAQ,IAAI,QAAS;AACvCC,IAAAA,MAAM,EAAE7B,OAAO,CAAC6B,MAAM,IAAI,QAAS;IACnCnC,IAAI,EAAEM,OAAO,CAACN,IAAK;IACnBoC,MAAM,EAAE9B,OAAO,CAAC8B;GAAO,EAEtBL,gBAAgB,EACN,CACZ;AACF,CACD;;;;"}
1
+ {"version":3,"file":"MrlLinkButton.js","sources":["../../../../../src/components/link/MrlLinkButton/MrlLinkButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { buttonDefaults, MrlButtonKind, MrlButtonSize, IconPosition } from '../../button/constants';\nimport { _spinnerProps } from '../../button/helpers';\nimport { defaults, LinkTargetType, MrlLinkButtonKind } from '../constants';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltip, type TooltipConfig } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { MrlComponentProps } from '../../../utils';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport './MrlLinkButton.global.scss';\n\nexport interface MrlLinkButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'a'> {\n\t/** Specifies where to redirect the linked document */\n\thref: string;\n\t/** Specifies how to open the linked document */\n\ttarget?: LinkTargetType;\n\t/**\n\t * Allow developers to add icon to buttons.\n\t */\n\ticon?: React.ReactElement;\n\t/**\n\t * Allows developers to right-align an icon within a button.\n\t */\n\ticonPos?: IconPosition;\n\t/**\n\t * Changes the visual emphasis of the button.\n\t */\n\tkind?: MrlLinkButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.SyntheticEvent<HTMLAnchorElement>) => void;\n\t/**\n\t * Changes the size of the button so it can scale with its surrounding context.\n\t */\n\tsize?: MrlButtonSize;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\n\t/**\n\t * Tooltip configuration for the button\n\t */\n\ttooltip?: TooltipConfig;\n\n\t/**\n\t * Enables interaction tracking for this link button. Provide a stable, non-PII id\n\t * (e.g. 'upgrade-plan-cta'). When omitted, the link button emits no analytics.\n\t */\n\teventId?: string;\n}\n\n/**\n * Warning: use this component with care. Our links generally do not look like buttons.\n * If this interaction does not navigate the user - use `MrlButton`.\n */\nexport const MrlLinkButton = React.forwardRef<HTMLAnchorElement, MrlLinkButtonProps>(\n\tfunction MrlLinkButton(\n\t\t{\n\t\t\tclassName,\n\t\t\thref,\n\t\t\ticon,\n\t\t\ticonPos = buttonDefaults.iconPos,\n\t\t\tkind = defaults.linkButtonKind,\n\t\t\tloading = false,\n\t\t\tloadingText = spinnerDefaults.text,\n\t\t\tonClick,\n\t\t\ttarget = defaults.target,\n\t\t\ttext,\n\t\t\tsize = buttonDefaults.size,\n\t\t\ttooltip,\n\t\t\teventId,\n\t\t\t...remainingProps\n\t\t}: MrlLinkButtonProps,\n\t\tref\n\t) {\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlLinkButton', eventId);\n\n\t\t/**\n\t\t * If the link has an href of `#` and an `onClick`\n\t\t * then a button should be used instead. Links should navigate\n\t\t * the user somewhere, and this pattern shows us that we aren't\n\t\t * navigating but are performing an action instead.\n\t\t */\n\t\tif (href === '#' && onClick) {\n\t\t\tconsole.error('Error: `MrlLinkButton` should have an href that navigates the user somewhere');\n\t\t}\n\n\t\t/**\n\t\t * Handle onClick events\n\t\t *\n\t\t * @param {React.MouseEvent<HTMLAnchorElement>} e - mouse event\n\t\t */\n\t\tfunction handleOnClick(e: React.MouseEvent<HTMLAnchorElement>) {\n\t\t\te.stopPropagation();\n\n\t\t\ttrackInteraction({ action: 'click', metadata: { target }, variant: kind });\n\n\t\t\tif (onClick && typeof onClick === 'function') {\n\t\t\t\tonClick(e);\n\t\t\t}\n\t\t}\n\n\t\tconst classNames = classnames(\n\t\t\t'mrlButton mrlLinkButton',\n\t\t\t`mrlButton--${size}`,\n\t\t\t`mrlButton--${kind}`,\n\t\t\t!icon && loading && `mrlButton--loading`,\n\t\t\ticon && `mrlButton--icon-${iconPos}`,\n\t\t\tclassName\n\t\t);\n\n\t\tconst spinnerProps = _spinnerProps(kind as MrlButtonKind, size);\n\t\tconst spinnerClass = icon ? '' : 'mrlButton-spinner';\n\t\tconst spinner = (\n\t\t\t<MrlSpinner\n\t\t\t\tclassName={spinnerClass}\n\t\t\t\tkind={spinnerProps.kind}\n\t\t\t\trole=\"none\"\n\t\t\t\tsize={spinnerProps.size}\n\t\t\t\ttext={loadingText}\n\t\t\t/>\n\t\t);\n\n\t\tconst renderLinkButton = () => (\n\t\t\t<a\n\t\t\t\t{...remainingProps}\n\t\t\t\tclassName={classNames}\n\t\t\t\thref={href}\n\t\t\t\ttarget={target}\n\t\t\t\tref={ref}\n\t\t\t\tonClick={handleOnClick}\n\t\t\t>\n\t\t\t\t{loading ? spinner : icon}\n\t\t\t\t<span className=\"mrlButton-text\">{text}</span>\n\t\t\t</a>\n\t\t);\n\n\t\treturn !tooltip ? (\n\t\t\trenderLinkButton()\n\t\t) : (\n\t\t\t<MrlTooltip\n\t\t\t\tposition={tooltip.position || 'bottom'}\n\t\t\t\tanchor={tooltip.anchor || 'center'}\n\t\t\t\ttext={tooltip.text}\n\t\t\t\tdataQa={tooltip.dataQa}\n\t\t\t\tcustomRender={tooltip.customRender}\n\t\t\t>\n\t\t\t\t{renderLinkButton()}\n\t\t\t</MrlTooltip>\n\t\t);\n\t}\n);\n"],"names":["MrlLinkButton","React","forwardRef","_ref","ref","className","href","icon","_ref$iconPos","iconPos","buttonDefaults","_ref$kind","kind","defaults","linkButtonKind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","_ref$target","target","_ref$size","size","tooltip","eventId","remainingProps","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","console","error","handleOnClick","e","stopPropagation","action","metadata","variant","classNames","classnames","concat","spinnerProps","_spinnerProps","spinnerClass","spinner","createElement","MrlSpinner","role","renderLinkButton","_extends","MrlTooltip","position","anchor","dataQa","customRender"],"mappings":";;;;;;;;;;;;AAkEA;AACA;AACA;AACA;AACO,IAAMA,aAAa,gBAAGC,KAAK,CAACC,UAAU,CAC5C,SAASF,aAAaA,CAAAG,IAAA,EAiBrBC,GAAG,EACF;AAAA,EAAA,IAhBAC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IAAAC,YAAA,GAAAL,IA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AACfnB,IAAAA,GAAG,EAAEA,GAAI;AACTiB,IAAAA,OAAO,EAAEc;GAAc,CAAA,EAEtBnB,OAAO,GAAG+B,OAAO,GAAGxC,IAAI,eACzBN,KAAA,CAAA+C,aAAA,CAAA,MAAA,EAAA;AAAM3C,IAAAA,SAAS,EAAC;GAAgB,EAAEe,IAAW,CAC3C,CACH;EAED,OAAO,CAACM,OAAO,GACdyB,gBAAgB,EAAE,gBAElBlD,KAAA,CAAA+C,aAAA,CAACK,UAAU,EAAA;AACVC,IAAAA,QAAQ,EAAE5B,OAAO,CAAC4B,QAAQ,IAAI,QAAS;AACvCC,IAAAA,MAAM,EAAE7B,OAAO,CAAC6B,MAAM,IAAI,QAAS;IACnCnC,IAAI,EAAEM,OAAO,CAACN,IAAK;IACnBoC,MAAM,EAAE9B,OAAO,CAAC8B,MAAO;IACvBC,YAAY,EAAE/B,OAAO,CAAC+B;GAAa,EAElCN,gBAAgB,EACN,CACZ;AACF,CACD;;;;"}
@@ -8,7 +8,7 @@ import { chevronLeft, chevronRight, chevronGoToLast, chevronGoToFirst } from '@m
8
8
  import styles from '../MrlPagination/MrlPagination.module.scss.js';
9
9
  import { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics/useMrlAnalytics.js';
10
10
 
11
- var _excluded = ["buttonClass", "className", "disabled", "kind", "handleClick", "text", "tooltipAnchor", "tooltipPosition", "eventId"];
11
+ var _excluded = ["buttonClass", "className", "disabled", "kind", "handleClick", "text", "tooltipAnchor", "tooltipPosition", "tooltipCustomRender", "eventId"];
12
12
  /**
13
13
  * Pagination button component
14
14
  * @param {MrlPaginationButtonProps} props - the component props
@@ -25,6 +25,7 @@ function MrlPaginationButton(_ref) {
25
25
  tooltipAnchor = _ref$tooltipAnchor === void 0 ? MrlTooltipDefaults.anchor : _ref$tooltipAnchor,
26
26
  _ref$tooltipPosition = _ref.tooltipPosition,
27
27
  tooltipPosition = _ref$tooltipPosition === void 0 ? 'top' : _ref$tooltipPosition,
28
+ tooltipCustomRender = _ref.tooltipCustomRender,
28
29
  eventId = _ref.eventId,
29
30
  rest = _objectWithoutProperties(_ref, _excluded);
30
31
  var trackInteraction = useMrlTrackInteraction('MrlPaginationButton', eventId);
@@ -67,7 +68,8 @@ function MrlPaginationButton(_ref) {
67
68
  state: disabled ? 'disabled' : 'default',
68
69
  text: text || defaultText[kind],
69
70
  size: "xsmall",
70
- tipAnchor: tooltipAnchor
71
+ tipAnchor: tooltipAnchor,
72
+ tooltipCustomRender: tooltipCustomRender
71
73
  })));
72
74
  }
73
75
 
@@ -1 +1 @@
1
- {"version":3,"file":"MrlPaginationButton.js","sources":["../../../../../src/components/pagination/MrlPaginationButton/MrlPaginationButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { MrlIconButton } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlSvg } from '../../svg/MrlSvg/MrlSvg';\nimport { MrlTooltipAnchor, MrlTooltipDefaults, MrlTooltipPosition } from '../../tooltip/constants';\nimport { PaginationButtonType } from '../constants';\nimport {\n\tchevronGoToFirst,\n\tchevronGoToLast,\n\tchevronLeft,\n\tchevronRight\n} from '@muraldevkit/ds-icons';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport styles from '../MrlPagination/MrlPagination.module.scss';\n\ninterface MrlPaginationButtonProps {\n\t/** Additional class to add to the button element */\n\tbuttonClass?: string;\n\t/** Additional class to add to the container element */\n\tclassName?: string;\n\tdisabled?: boolean;\n\t/**\n\t * The type of pagination item.\n\t *\n\t * Known quirk: `kind` doesn't match the rendered aria-label. The `kind` prop is\n\t * `'first' | 'previous' | 'next' | 'last'`, but the rendered aria-labels are\n\t * \"Beginning\", \"Previous\", \"Next\", \"End\" (unless `text` overrides them).\n\t * Matters for tests and for users reading the announcement:\n\t * - `first` → `Beginning`\n\t * - `previous` → `Previous`\n\t * - `next` → `Next`\n\t * - `last` → `End`\n\t */\n\tkind: PaginationButtonType;\n\t/**\n\t * Click event for the button.\n\t */\n\thandleClick?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n\t/** Pagination heading */\n\ttext?: string;\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'templates-pagination'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\t/** The anchor of the tooltips on the buttons */\n\ttooltipAnchor?: MrlTooltipAnchor;\n\t/** The placement of the tooltips on the buttons */\n\ttooltipPosition?: MrlTooltipPosition;\n}\n\n/**\n * Pagination button component\n * @param {MrlPaginationButtonProps} props - the component props\n * @returns a pagintaion button\n */\nexport function MrlPaginationButton({\n\tbuttonClass,\n\tclassName,\n\tdisabled,\n\tkind,\n\thandleClick,\n\ttext,\n\ttooltipAnchor = MrlTooltipDefaults.anchor,\n\ttooltipPosition = 'top',\n\teventId,\n\t...rest\n}: MrlPaginationButtonProps): JSX.Element {\n\tconst trackInteraction = useMrlTrackInteraction('MrlPaginationButton', eventId);\n\n\t/**\n\t * Handle onClick events\n\t *\n\t * @param {React.SyntheticEvent<HTMLButtonElement>} e - click event\n\t */\n\tconst handleOnClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n\t\ttrackInteraction({ action: 'click', variant: kind });\n\n\t\thandleClick?.(e);\n\t};\n\n\tconst itemClasses = classnames(styles['MrlPaginationItem'], className);\n\tconst icons = {\n\t\tfirst: chevronGoToFirst,\n\t\tlast: chevronGoToLast,\n\t\tnext: chevronRight,\n\t\tprevious: chevronLeft\n\t};\n\tconst defaultText = {\n\t\tfirst: 'Beginning',\n\t\tlast: 'End',\n\t\tnext: 'Next',\n\t\tprevious: 'Previous'\n\t};\n\n\treturn (\n\t\t<li className={itemClasses}>\n\t\t\t<MrlIconButton\n\t\t\t\t{...rest}\n\t\t\t\tclassName={buttonClass}\n\t\t\t\tkind=\"ghost\"\n\t\t\t\ticon={<MrlSvg svg={icons[kind]} />}\n\t\t\t\tonClick={handleOnClick}\n\t\t\t\tposition={tooltipPosition}\n\t\t\t\tstate={disabled ? 'disabled' : 'default'}\n\t\t\t\ttext={text || defaultText[kind]}\n\t\t\t\tsize=\"xsmall\"\n\t\t\t\ttipAnchor={tooltipAnchor}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n"],"names":["MrlPaginationButton","_ref","buttonClass","className","disabled","kind","handleClick","text","_ref$tooltipAnchor","tooltipAnchor","MrlTooltipDefaults","anchor","_ref$tooltipPosition","tooltipPosition","eventId","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","handleOnClick","e","action","variant","itemClasses","classnames","styles","icons","first","chevronGoToFirst","last","chevronGoToLast","next","chevronRight","previous","chevronLeft","defaultText","React","createElement","MrlIconButton","_extends","icon","MrlSvg","svg","onClick","position","state","size","tipAnchor"],"mappings":";;;;;;;;;;;AAoDA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAAAC,IAAA,EAWO;AAAA,EAAA,IAVzCC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IACXC,IAAI,GAAAN,IAAA,CAAJM,IAAI;IAAAC,kBAAA,GAAAP,IAAA,CACJQ,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAGE,kBAAkB,CAACC,MAAM,GAAAH,kBAAA;IAAAI,oBAAA,GAAAX,IAAA,CACzCY,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,oBAAA;IACvBE,OAAO,GAAAb,IAAA,CAAPa,OAAO;AACJC,IAAAA,IAAI,GAAAC,wBAAA,CAAAf,IAAA,EAAAgB,SAAA,CAAA;AAEP,EAAA,IAAMC,gBAAgB,GAAGC,sBAAsB,CAAC,qBAAqB,EAAEL,OAAO,CAAC;;AAE/E;AACD;A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AAAA,IAAI,EAAC,QAAQ;AACbC,IAAAA,SAAS,EAAEvC;AAAc,GAAA,CACzB,CACE,CAAC;AAEP;;;;"}
1
+ {"version":3,"file":"MrlPaginationButton.js","sources":["../../../../../src/components/pagination/MrlPaginationButton/MrlPaginationButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { MrlIconButton, MrlIconButtonProps } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlSvg } from '../../svg/MrlSvg/MrlSvg';\nimport { MrlTooltipAnchor, MrlTooltipDefaults, MrlTooltipPosition } from '../../tooltip/constants';\nimport { PaginationButtonType } from '../constants';\nimport {\n\tchevronGoToFirst,\n\tchevronGoToLast,\n\tchevronLeft,\n\tchevronRight\n} from '@muraldevkit/ds-icons';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport styles from '../MrlPagination/MrlPagination.module.scss';\n\ninterface MrlPaginationButtonProps {\n\t/** Additional class to add to the button element */\n\tbuttonClass?: string;\n\t/** Additional class to add to the container element */\n\tclassName?: string;\n\tdisabled?: boolean;\n\t/**\n\t * The type of pagination item.\n\t *\n\t * Known quirk: `kind` doesn't match the rendered aria-label. The `kind` prop is\n\t * `'first' | 'previous' | 'next' | 'last'`, but the rendered aria-labels are\n\t * \"Beginning\", \"Previous\", \"Next\", \"End\" (unless `text` overrides them).\n\t * Matters for tests and for users reading the announcement:\n\t * - `first` → `Beginning`\n\t * - `previous` → `Previous`\n\t * - `next` → `Next`\n\t * - `last` → `End`\n\t */\n\tkind: PaginationButtonType;\n\t/**\n\t * Click event for the button.\n\t */\n\thandleClick?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n\t/** Pagination heading */\n\ttext?: string;\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'templates-pagination'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\t/** The anchor of the tooltips on the buttons */\n\ttooltipAnchor?: MrlTooltipAnchor;\n\t/** The placement of the tooltips on the buttons */\n\ttooltipPosition?: MrlTooltipPosition;\n\t/**\n\t * Renders custom tooltip content instead of the plain label. Receives the resolved\n\t * label (`text` or the default for `kind`) so defaults can be decorated.\n\t *\n\t * Note: `MrlTooltip` is memoized, so this function should be memoized by consumers.\n\t */\n\ttooltipCustomRender?: MrlIconButtonProps['tooltipCustomRender'];\n}\n\n/**\n * Pagination button component\n * @param {MrlPaginationButtonProps} props - the component props\n * @returns a pagintaion button\n */\nexport function MrlPaginationButton({\n\tbuttonClass,\n\tclassName,\n\tdisabled,\n\tkind,\n\thandleClick,\n\ttext,\n\ttooltipAnchor = MrlTooltipDefaults.anchor,\n\ttooltipPosition = 'top',\n\ttooltipCustomRender,\n\teventId,\n\t...rest\n}: MrlPaginationButtonProps): JSX.Element {\n\tconst trackInteraction = useMrlTrackInteraction('MrlPaginationButton', eventId);\n\n\t/**\n\t * Handle onClick events\n\t *\n\t * @param {React.SyntheticEvent<HTMLButtonElement>} e - click event\n\t */\n\tconst handleOnClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n\t\ttrackInteraction({ action: 'click', variant: kind });\n\n\t\thandleClick?.(e);\n\t};\n\n\tconst itemClasses = classnames(styles['MrlPaginationItem'], className);\n\tconst icons = {\n\t\tfirst: chevronGoToFirst,\n\t\tlast: chevronGoToLast,\n\t\tnext: chevronRight,\n\t\tprevious: chevronLeft\n\t};\n\tconst defaultText = {\n\t\tfirst: 'Beginning',\n\t\tlast: 'End',\n\t\tnext: 'Next',\n\t\tprevious: 'Previous'\n\t};\n\n\treturn (\n\t\t<li className={itemClasses}>\n\t\t\t<MrlIconButton\n\t\t\t\t{...rest}\n\t\t\t\tclassName={buttonClass}\n\t\t\t\tkind=\"ghost\"\n\t\t\t\ticon={<MrlSvg svg={icons[kind]} />}\n\t\t\t\tonClick={handleOnClick}\n\t\t\t\tposition={tooltipPosition}\n\t\t\t\tstate={disabled ? 'disabled' : 'default'}\n\t\t\t\ttext={text || defaultText[kind]}\n\t\t\t\tsize=\"xsmall\"\n\t\t\t\ttipAnchor={tooltipAnchor}\n\t\t\t\ttooltipCustomRender={tooltipCustomRender}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n"],"names":["MrlPaginationButton","_ref","buttonClass","className","disabled","kind","handleClick","text","_ref$tooltipAnchor","tooltipAnchor","MrlTooltipDefaults","anchor","_ref$tooltipPosition","tooltipPosition","tooltipCustomRender","eventId","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","handleOnClick","e","action","variant","itemClasses","classnames","styles","icons","first","chevronGoToFirst","last","chevronGoToLast","next","chevronRight","previous","chevronLeft","defaultText","React","createElement","MrlIconButton","_extends","icon","MrlSvg","svg","onClick","position","state","size","tipAnchor"],"mappings":";;;;;;;;;;;AA2DA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAAAC,IAAA,EAYO;AAAA,EAAA,IAXzCC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IACXC,IAAI,GAAAN,IAAA,CAAJM,IAAI;IAAAC,kBAAA,GAAAP,IAAA,CACJQ,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAGE,kBAAkB,CAACC,MAAM,GAAAH,kBAAA;IAAAI,oBAAA,GAAAX,IAAA,CACzCY,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,oBAAA;IACvBE,mBAAmB,GAAAb,IAAA,CAAnBa,mBAAmB;IACnBC,OAAO,GAAAd,IAAA,CAAPc,OAAO;AACJC,IAAAA,IAAI,GAAAC,wBAAA,CAAAhB,IAAA,EAAAiB,SAAA,CAAA;AAEP,EAAA,IAAMC,gBAAgB,GAAGC,sBAAsB,CA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I,IAAI8B,WAAW,CAAChC,IAAI,CAAE;AAChC2C,IAAAA,IAAI,EAAC,QAAQ;AACbC,IAAAA,SAAS,EAAExC,aAAc;AACzBK,IAAAA,mBAAmB,EAAEA;AAAoB,GAAA,CACzC,CACE,CAAC;AAEP;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MrlToolbarButton.js","sources":["../../../../../src/components/toolbar/MrlToolbarButton/MrlToolbarButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MrlIconButton, MrlIconButtonProps } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlMenuItem, MrlMenuItemProps } from '../../menu/MrlMenuItem/MrlMenuItem';\n\nimport styles from './MrlToolbarButton.module.scss';\nimport classnames from 'classnames';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\n/**\n * Props for the MrlToolbarButton component.\n */\nexport interface MrlToolbarButtonProps {\n\t/** Additional class to add to the Toolbar button */\n\tclassName?: string;\n\t/**\n\t * The icon that will be rendered.\n\t */\n\ticon: React.ReactElement;\n\tincludeInRoving?: boolean;\n\t/**\n\t * A prop used to set a toolbar button to never move into the menu.\n\t */\n\tlockedInToolbar?: boolean;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e?: React.MouseEvent<HTMLButtonElement>) => void;\n\t/**\n\t * Props used to control the display of the button in the menu.\n\t */\n\tmenuItemProps?: Omit<MrlMenuItemProps, 'onClick'>;\n\tqa?: string;\n\t/**\n\t * A prop used to render the item in the menu instead of the toolbar.\n\t */\n\trenderInMenu?: boolean;\n\ttext: string;\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'canvas-toolbar-shapes'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\t/**\n\t * Props used to control the display of the button in the toolbar.\n\t */\n\ttoolbarButtonProps?: {\n\t\tbadge?: MrlIconButtonProps['badge'];\n\t\tdisableEvents?: MrlIconButtonProps['disableEvents'];\n\t\tkind?: MrlIconButtonProps['kind'];\n\t\tloading?: MrlIconButtonProps['loading'];\n\t\tloadingText?: MrlIconButtonProps['loadingText'];\n\t\tonKeyUp?: MrlIconButtonProps['onKeyUp'];\n\t\tonMouseUp?: MrlIconButtonProps['onMouseUp'];\n\t\tposition?: MrlIconButtonProps['position'];\n\t\tsize?: MrlIconButtonProps['size'];\n\t\tstate?: MrlIconButtonProps['state'];\n\t\ttipAnchor?: MrlIconButtonProps['tipAnchor'];\n\t\ttoggleAria?: MrlIconButtonProps['toggleAria'];\n\t\ttoggleStyle?: MrlIconButtonProps['toggleStyle'];\n\t};\n}\n\n/**\n * MrlToolbarButton component.\n * @param props The MrlToolbarButton component properties.\n * @returns The MrlToolbarButton component.\n */\nexport const MrlToolbarButton = React.forwardRef<HTMLButtonElement, MrlToolbarButtonProps>(\n\tfunction MrlToolbarButton(props, ref): JSX.Element {\n\t\tconst {\n\t\t\tclassName,\n\t\t\ticon,\n\t\t\tincludeInRoving = false,\n\t\t\tmenuItemProps,\n\t\t\tonClick,\n\t\t\tqa,\n\t\t\trenderInMenu,\n\t\t\ttext,\n\t\t\ttoolbarButtonProps = {\n\t\t\t\tposition: 'bottom',\n\t\t\t\tsize: 'small',\n\t\t\t\tstate: 'default'\n\t\t\t},\n\t\t\t// pulled out of `rest` so the nested MrlIconButton/MrlMenuItem doesn't emit a\n\t\t\t// second, less specific event for the same interaction.\n\t\t\teventId,\n\t\t\t...rest\n\t\t} = props;\n\t\tconst classes = classnames('MrlToolbarButton', className);\n\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlToolbarButton', eventId);\n\n\t\t/**\n\t\t * Handle onClick events\n\t\t *\n\t\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t\t */\n\t\tconst handleOnClick = (e?: React.MouseEvent<HTMLButtonElement>) => {\n\t\t\ttrackInteraction({\n\t\t\t\taction: 'click',\n\t\t\t\tvariant: renderInMenu ? 'menu' : 'toolbar'\n\t\t\t});\n\n\t\t\tonClick?.(e);\n\t\t};\n\n\t\tif (renderInMenu) {\n\t\t\treturn (\n\t\t\t\t<MrlMenuItem {...menuItemProps} className={classes} data-qa={qa} onClick={handleOnClick}>\n\t\t\t\t\t<span className={styles.MrlToolbarButtonIcon}>{icon}</span>\n\t\t\t\t\t{text}\n\t\t\t\t</MrlMenuItem>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<MrlIconButton\n\t\t\t\t{...rest}\n\t\t\t\t{...toolbarButtonProps}\n\t\t\t\tclassName={classes}\n\t\t\t\tdata-qa={qa}\n\t\t\t\tdata-roving={includeInRoving ? 'true' : undefined}\n\t\t\t\ticon={icon}\n\t\t\t\tonClick={handleOnClick}\n\t\t\t\tref={ref}\n\t\t\t\ttext={text}\n\t\t\t/>\n\t\t);\n\t}\n);\n"],"names":["MrlToolbarButton","React","forwardRef","props","ref","className","icon","_props$includeInRovin","includeInRoving","menuItemProps","onClick","qa","renderInMenu","text","_props$toolbarButtonP","toolbarButtonProps","position","size","state","eventId","rest","_objectWithoutProperties","_excluded","classes","classnames","trackInteraction","useMrlTrackInteraction","handleOnClick","e","action","variant","createElement","MrlMenuItem","_extends","styles","MrlToolbarButtonIcon","MrlIconButton","undefined"],"mappings":";;;;;;;;;;AAQA;AACA;AACA;;AAoDA;AACA;AACA;AACA;AACA;AACO,IAAMA,gBAAgB,gBAAGC,KAAK,CAACC,UAAU,CAC/C,SAASF,gBAAgBA,CAACG,KAAK,EAAEC,GAAG,EAAe;AAClD,EAAA,IACCC,SAAS,GAiBNF,KAAK,CAjBRE,SAAS;IACTC,IAAI,GAgBDH,KAAK,CAhBRG,IAAI;IAAAC,qBAAA,GAgBDJ,KAAK,CAfRK,eAAe;AAAfA,IAAAA,eAAe,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;IACvBE,aAAa,GAcVN,KAAK,CAdRM,aAAa;IACbC,OAAO,GAaJP,KAAK,CAbRO,OAAO;IACPC,EAAE,GAYCR,KAAK,CAZRQ,EAAE;IACFC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AAA8B,aAAA,CAACK,aAAa,EAAAH,QAAA,CAAA,EAAA,EACTb,IAAI,EACJL,kBAAkB,EAAA;AACtBV,IAAAA,SAAS,EAAEkB,OAAQ;AACnB,IAAA,SAAA,EAASZ,EAAG;AACZ,IAAA,aAAA,EAAaH,eAAe,GAAG,MAAM,GAAG6B,SAAU;AAClD/B,IAAAA,IAAI,EAAEA,IAAK;AACXI,IAAAA,OAAO,EAAEiB,aAAc;AACvBvB,IAAAA,GAAG,EAAEA,GAAI;AACTS,IAAAA,IAAI,EAAEA;AAAK,GAAA,CACX,CAAC;AAEJ,CACD;;;;"}
1
+ {"version":3,"file":"MrlToolbarButton.js","sources":["../../../../../src/components/toolbar/MrlToolbarButton/MrlToolbarButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MrlIconButton, MrlIconButtonProps } from '../../button/MrlIconButton/MrlIconButton';\nimport { MrlMenuItem, MrlMenuItemProps } from '../../menu/MrlMenuItem/MrlMenuItem';\n\nimport styles from './MrlToolbarButton.module.scss';\nimport classnames from 'classnames';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\n/**\n * Props for the MrlToolbarButton component.\n */\nexport interface MrlToolbarButtonProps {\n\t/** Additional class to add to the Toolbar button */\n\tclassName?: string;\n\t/**\n\t * The icon that will be rendered.\n\t */\n\ticon: React.ReactElement;\n\tincludeInRoving?: boolean;\n\t/**\n\t * A prop used to set a toolbar button to never move into the menu.\n\t */\n\tlockedInToolbar?: boolean;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e?: React.MouseEvent<HTMLButtonElement>) => void;\n\t/**\n\t * Props used to control the display of the button in the menu.\n\t */\n\tmenuItemProps?: Omit<MrlMenuItemProps, 'onClick'>;\n\tqa?: string;\n\t/**\n\t * A prop used to render the item in the menu instead of the toolbar.\n\t */\n\trenderInMenu?: boolean;\n\ttext: string;\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'canvas-toolbar-shapes'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\t/**\n\t * Props used to control the display of the button in the toolbar.\n\t */\n\ttoolbarButtonProps?: {\n\t\tbadge?: MrlIconButtonProps['badge'];\n\t\tdisableEvents?: MrlIconButtonProps['disableEvents'];\n\t\tkind?: MrlIconButtonProps['kind'];\n\t\tloading?: MrlIconButtonProps['loading'];\n\t\tloadingText?: MrlIconButtonProps['loadingText'];\n\t\tonKeyUp?: MrlIconButtonProps['onKeyUp'];\n\t\tonMouseUp?: MrlIconButtonProps['onMouseUp'];\n\t\tposition?: MrlIconButtonProps['position'];\n\t\tsize?: MrlIconButtonProps['size'];\n\t\tstate?: MrlIconButtonProps['state'];\n\t\ttipAnchor?: MrlIconButtonProps['tipAnchor'];\n\t\ttooltipCustomRender?: MrlIconButtonProps['tooltipCustomRender'];\n\t\ttoggleAria?: MrlIconButtonProps['toggleAria'];\n\t\ttoggleStyle?: MrlIconButtonProps['toggleStyle'];\n\t};\n}\n\n/**\n * MrlToolbarButton component.\n * @param props The MrlToolbarButton component properties.\n * @returns The MrlToolbarButton component.\n */\nexport const MrlToolbarButton = React.forwardRef<HTMLButtonElement, MrlToolbarButtonProps>(\n\tfunction MrlToolbarButton(props, ref): JSX.Element {\n\t\tconst {\n\t\t\tclassName,\n\t\t\ticon,\n\t\t\tincludeInRoving = false,\n\t\t\tmenuItemProps,\n\t\t\tonClick,\n\t\t\tqa,\n\t\t\trenderInMenu,\n\t\t\ttext,\n\t\t\ttoolbarButtonProps = {\n\t\t\t\tposition: 'bottom',\n\t\t\t\tsize: 'small',\n\t\t\t\tstate: 'default'\n\t\t\t},\n\t\t\t// pulled out of `rest` so the nested MrlIconButton/MrlMenuItem doesn't emit a\n\t\t\t// second, less specific event for the same interaction.\n\t\t\teventId,\n\t\t\t...rest\n\t\t} = props;\n\t\tconst classes = classnames('MrlToolbarButton', className);\n\n\t\tconst trackInteraction = useMrlTrackInteraction('MrlToolbarButton', eventId);\n\n\t\t/**\n\t\t * Handle onClick events\n\t\t *\n\t\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t\t */\n\t\tconst handleOnClick = (e?: React.MouseEvent<HTMLButtonElement>) => {\n\t\t\ttrackInteraction({\n\t\t\t\taction: 'click',\n\t\t\t\tvariant: renderInMenu ? 'menu' : 'toolbar'\n\t\t\t});\n\n\t\t\tonClick?.(e);\n\t\t};\n\n\t\tif (renderInMenu) {\n\t\t\treturn (\n\t\t\t\t<MrlMenuItem {...menuItemProps} className={classes} data-qa={qa} onClick={handleOnClick}>\n\t\t\t\t\t<span className={styles.MrlToolbarButtonIcon}>{icon}</span>\n\t\t\t\t\t{text}\n\t\t\t\t</MrlMenuItem>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<MrlIconButton\n\t\t\t\t{...rest}\n\t\t\t\t{...toolbarButtonProps}\n\t\t\t\tclassName={classes}\n\t\t\t\tdata-qa={qa}\n\t\t\t\tdata-roving={includeInRoving ? 'true' : undefined}\n\t\t\t\ticon={icon}\n\t\t\t\tonClick={handleOnClick}\n\t\t\t\tref={ref}\n\t\t\t\ttext={text}\n\t\t\t/>\n\t\t);\n\t}\n);\n"],"names":["MrlToolbarButton","React","forwardRef","props","ref","className","icon","_props$includeInRovin","includeInRoving","menuItemProps","onClick","qa","renderInMenu","text","_props$toolbarButtonP","toolbarButtonProps","position","size","state","eventId","rest","_objectWithoutProperties","_excluded","classes","classnames","trackInteraction","useMrlTrackInteraction","handleOnClick","e","action","variant","createElement","MrlMenuItem","_extends","styles","MrlToolbarButtonIcon","MrlIconButton","undefined"],"mappings":";;;;;;;;;;AAQA;AACA;AACA;;AAqDA;AACA;AACA;AACA;AACA;AACO,IAAMA,gBAAgB,gBAAGC,KAAK,CAACC,UAAU,CAC/C,SAASF,gBAAgBA,CAACG,KAAK,EAAEC,GAAG,EAAe;AAClD,EAAA,IACCC,SAAS,GAiBNF,KAAK,CAjBRE,SAAS;IACTC,IAAI,GAgBDH,KAAK,CAhBRG,IAAI;IA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C,MAAA,SAAA,EAASZ,EAAG;AAACD,MAAAA,OAAO,EAAEiB;KAAc,CAAA,eACvF1B,KAAA,CAAA8B,aAAA,CAAA,MAAA,EAAA;MAAM1B,SAAS,EAAE6B,MAAM,CAACC;AAAqB,KAAA,EAAE7B,IAAW,CAAC,EAC1DO,IACW,CAAC;AAEhB,EAAA;EAEA,oBACCZ,KAAA,CAAA8B,aAAA,CAACK,aAAa,EAAAH,QAAA,CAAA,EAAA,EACTb,IAAI,EACJL,kBAAkB,EAAA;AACtBV,IAAAA,SAAS,EAAEkB,OAAQ;AACnB,IAAA,SAAA,EAASZ,EAAG;AACZ,IAAA,aAAA,EAAaH,eAAe,GAAG,MAAM,GAAG6B,SAAU;AAClD/B,IAAAA,IAAI,EAAEA,IAAK;AACXI,IAAAA,OAAO,EAAEiB,aAAc;AACvBvB,IAAAA,GAAG,EAAEA,GAAI;AACTS,IAAAA,IAAI,EAAEA;AAAK,GAAA,CACX,CAAC;AAEJ,CACD;;;;"}
@@ -13,6 +13,11 @@ import { MrlPortal } from '../../portal/MrlPortal.js';
13
13
 
14
14
  var _excluded = ["children", "clickToClose", "disableTooltipHover", "display", "text", "attrs", "dataQa", "position", "anchor", "srAnnouncement", "tooltipClass", "tooltipContentClass", "eventId"],
15
15
  _excluded2 = ["className", "onBlur", "onFocus", "onKeyDown", "onMouseOver", "onMouseOut", "onMouseUp", "children"];
16
+
17
+ /**
18
+ * Tooltip configuration for components that wrap `MrlTooltip` (e.g. `MrlButton`).
19
+ */
20
+
16
21
  /**
17
22
  * MrlTooltip Component
18
23
  *
@@ -1 +1 @@
1
- {"version":3,"file":"MrlTooltip.js","sources":["../../../../../src/components/tooltip/MrlTooltip/MrlTooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { AttrsObject, getUniqueId } from '../../../utils';\nimport {\n\tMrlTooltipAnchor,\n\tMrlTooltipDefaults,\n\tMrlTooltipPosition,\n\tMrlTooltipState\n} from '../constants';\nimport { MrlTooltipContent } from '../MrlTooltipContent/MrlTooltipContent';\nimport { curryHandlers } from '../utils';\nimport classNames from 'classnames';\nimport { MrlPortal } from '../../portal';\nimport '../../../styles/shared/a11y-helpers/a11y.global.scss';\nimport { useTooltipPosition } from '../useTooltipPosition';\nimport { useTransition, animated } from '@react-spring/web';\nimport { PORTAL_LAYERS } from '../../../utils/layers';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\ninterface MrlTooltipProps {\n\t/** The arrow position of the tooltip in relation to its trigger's content */\n\tanchor?: MrlTooltipAnchor;\n\n\t/**\n\t * Attributes that are applied to the component during the initial render.\n\t *\n\t * Example usage: html attributes, custom data attributes (data-qa), aria\n\t * @deprecated please use props for component instead\n\t */\n\tattrs?: AttrsObject;\n\n\t/**\n\t * Children to be rendered within the tooltip. The first child is used as the trigger.\n\t *\n\t * Warning: The tooltip is only setup to work with a single trigger. If multiple children\n\t * are passed in the component will not have event handling for the additional child elements.\n\t */\n\tchildren: React.ReactElement;\n\n\t/** Whether the tooltip should close when clicked */\n\tclickToClose?: boolean;\n\n\t/** The data-qa attribute for the tooltip */\n\tdataQa?: string;\n\n\t/** The state value to determine if the tooltip should be displayed */\n\tdisplay?: MrlTooltipState;\n\n\t/** Whether to disable the tooltip hover action that keeps it open */\n\tdisableTooltipHover?: boolean;\n\n\t/** The placement of the tooltip in relation to its trigger */\n\tposition?: MrlTooltipPosition;\n\n\t/** Whether to announce the tooltip content to screen readers */\n\tsrAnnouncement?: boolean;\n\n\t/** The textual label of tooltip */\n\ttext: string;\n\n\t/** A custom class selector to be applied to the tooltip wrapper */\n\ttooltipClass?: string;\n\n\t/** A class to be applied ot the tooltip content */\n\ttooltipContentClass?: string;\n\n\t/** A custom render function to render the tooltip content */\n\tcustomRender?: (text?: string) => React.ReactNode;\n\n\t/**\n\t * Enables interaction tracking for this tooltip. Provide a stable, non-PII id\n\t * (e.g. 'facilitation-timer-tooltip'). When omitted, the tooltip emits no analytics.\n\t *\n\t * Note: tooltips open on hover, so an instrumented tooltip is a high-volume source.\n\t * Only add an id where the reveal itself is the signal you need.\n\t */\n\teventId?: string;\n}\n\n/**\n * MrlTooltip Component\n *\n * This component is not displayed when rendering this component if the primary pointing device can’t hover. Examples include touchscreens and screens that use a basic drawing stylus.\n * Pointing devices that can hover, but for which doing so is inconvenient and not part of the normal way they are used, also match this criteria. For example, a touchscreen where a long press is treated as hovering.\n * @param {MrlTooltipProps} props - The props of the component\n * @returns {HTMLElement} a configured Tooltip component\n */\nexport const MrlTooltip = React.memo((props: MrlTooltipProps): React.ReactElement => {\n\tconst {\n\t\tchildren,\n\t\tclickToClose = true,\n\t\tdisableTooltipHover = false,\n\t\tdisplay: defaultDisplay = 'hide',\n\t\ttext,\n\t\tattrs = {},\n\t\tdataQa,\n\t\tposition = MrlTooltipDefaults.position || 'top',\n\t\tanchor = MrlTooltipDefaults.anchor,\n\t\tsrAnnouncement = true,\n\t\ttooltipClass,\n\t\ttooltipContentClass,\n\t\teventId,\n\t\t...rest\n\t} = props;\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlTooltip', eventId);\n\n\tconst [interaction, setInteraction] = React.useState('mouse');\n\n\tconst triggerRef = React.useRef<HTMLElement | null>(null);\n\n\tconst tooltipRef = React.useRef<HTMLDivElement>(null);\n\n\t/**\n\t * State value to determine if the tooltip should be displayed\n\t */\n\tconst [display, setDisplay] = React.useState<MrlTooltipState>(defaultDisplay);\n\n\t/**\n\t * State value to determine if the tooltip should be displayed\n\t */\n\tconst [id, setId] = React.useState<string>('');\n\n\t/**\n\t * The tooltip shows and hides from hover, focus and click, so open/close is emitted\n\t * from the resulting display state rather than from each individual handler.\n\t */\n\tconst previousDisplayRef = React.useRef<MrlTooltipState>(defaultDisplay);\n\n\tReact.useEffect(() => {\n\t\tif (previousDisplayRef.current === display) return;\n\n\t\tpreviousDisplayRef.current = display;\n\n\t\ttrackInteraction({\n\t\t\taction: display === 'show' ? 'open' : 'close',\n\t\t\tmetadata: { interaction },\n\t\t\tvariant: position\n\t\t});\n\t\t// `interaction` only annotates the event; it must not re-trigger it\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [display, position, trackInteraction]);\n\n\t/**\n\t * Event handler to show tooltip when the trigger is focused\n\t */\n\tconst handleShowTooltip = React.useCallback(() => {\n\t\tsetDisplay('show');\n\t}, []);\n\n\tconst handleFocus = React.useCallback(() => {\n\t\tif (interaction === 'keyboard') {\n\t\t\thandleShowTooltip();\n\t\t}\n\t}, [interaction, handleShowTooltip]);\n\n\t/**\n\t * Event handler to hide the tooltip on mouseout\n\t */\n\tconst handleHideTooltip = (): void => {\n\t\tsetDisplay('hide');\n\t};\n\n\t/**\n\t * Event handler to hide the tooltip when a user presses escape\n\t * @param {React.KeyboardEvent} e Keyboard event\n\t */\n\tconst handleKeyDown = (e: React.KeyboardEvent): void => {\n\t\tif (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ') {\n\t\t\thandleHideTooltip();\n\t\t}\n\t};\n\n\tconst handleSetKeyboardInteraction = (e: KeyboardEvent) => {\n\t\tif (e.key === 'Tab' || e.key === 'Enter' || e.key === ' ') {\n\t\t\tsetInteraction('keyboard');\n\t\t}\n\t};\n\n\tconst handlesetMouseInteraction = () => setInteraction('mouse');\n\n\t/**\n\t * Setup of the initial component attributes and events\n\t */\n\tReact.useEffect(() => {\n\t\tif (id === '') setId(getUniqueId('mrl-tooltip'));\n\t}, [id]);\n\n\tReact.useEffect(() => {\n\t\tsetDisplay(defaultDisplay);\n\t}, [defaultDisplay]);\n\n\t/**\n\t * Setting the triggerRef to the trigger element\n\t *\n\t * We need to use 'querySelector' because we cannot pass a ref to the child object. There are\n\t * some situations where the child component may not accept a ref, for example: a react router\n\t * link is passed as a child. In older versions of react router you could not pass a ref to the\n\t * component so this causes an issue.\n\t */\n\tReact.useEffect(() => {\n\t\tconst trigger = document.querySelector(`[data-tooltip-id=\"${id}\"]`);\n\t\ttriggerRef.current = trigger as HTMLElement;\n\t}, [id]);\n\n\tReact.useEffect(() => {\n\t\tconst currentTooltipRef = tooltipRef.current;\n\n\t\tdocument.addEventListener('keydown', handleSetKeyboardInteraction);\n\t\tdocument.addEventListener('mousedown', handlesetMouseInteraction);\n\n\t\tif (!disableTooltipHover && currentTooltipRef) {\n\t\t\tcurrentTooltipRef.addEventListener('mouseover', handleShowTooltip);\n\t\t\tcurrentTooltipRef.addEventListener('mouseout', handleHideTooltip);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (!disableTooltipHover && currentTooltipRef) {\n\t\t\t\tcurrentTooltipRef.removeEventListener('mouseover', handleShowTooltip);\n\t\t\t\tcurrentTooltipRef.removeEventListener('mouseout', handleHideTooltip);\n\t\t\t}\n\n\t\t\tdocument.removeEventListener('keydown', handleSetKeyboardInteraction);\n\t\t\tdocument.removeEventListener('mousedown', handlesetMouseInteraction);\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [handleShowTooltip, tooltipRef.current]);\n\n\tconst positionStyles = useTooltipPosition(\n\t\ttriggerRef,\n\t\ttooltipRef,\n\t\t{\n\t\t\talign: anchor,\n\t\t\tposition: position\n\t\t},\n\t\tdisplay === 'show',\n\t\t-1\n\t);\n\n\tconst inlineStyles = {\n\t\tmenu: {\n\t\t\tleft: positionStyles.left,\n\t\t\tposition: 'fixed' as const,\n\t\t\ttop: positionStyles.top\n\t\t}\n\t};\n\n\tconst transitions = useTransition(display === 'show', {\n\t\tconfig: { duration: display === 'show' ? 150 : 25 },\n\t\tenter: { opacity: 1 },\n\t\tfrom: { opacity: 0 },\n\t\tleave: { opacity: 0 }\n\t});\n\n\treturn (\n\t\t<>\n\t\t\t{React.Children.map(children, (child, index) => {\n\t\t\t\tif (index === 0 && React.isValidElement(child)) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\tonBlur,\n\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\tonKeyDown,\n\t\t\t\t\t\tonMouseOver,\n\t\t\t\t\t\tonMouseOut,\n\t\t\t\t\t\tonMouseUp,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t...otherProps\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t} = (child as any).props;\n\n\t\t\t\t\treturn React.cloneElement(child as React.ReactElement, {\n\t\t\t\t\t\t'aria-describedby': display === 'show' && srAnnouncement ? id : undefined,\n\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\ttooltipClass,\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'mrl-tooltip-trigger',\n\t\t\t\t\t\t\tdisplay === 'show' && 'mrl-tooltip-trigger--active'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tonBlur: curryHandlers(onBlur, handleHideTooltip),\n\t\t\t\t\t\t...(clickToClose && !disableTooltipHover\n\t\t\t\t\t\t\t? { onMouseUp: curryHandlers(onMouseUp, handleHideTooltip) }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\tonFocus: curryHandlers(onFocus, handleFocus),\n\t\t\t\t\t\tonKeyDown: curryHandlers(onKeyDown, handleKeyDown),\n\t\t\t\t\t\tonMouseOut: curryHandlers(onMouseOut, handleHideTooltip),\n\t\t\t\t\t\tonMouseOver: curryHandlers(onMouseOver, handleShowTooltip),\n\t\t\t\t\t\t...otherProps,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t['data-tooltip-id']: id\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t})}\n\t\t\t<MrlPortal\n\t\t\t\tid={PORTAL_LAYERS.TOOLTIP.name}\n\t\t\t\tlayer={PORTAL_LAYERS.TOOLTIP}\n\t\t\t\tclassName={PORTAL_LAYERS.TOOLTIP.name}\n\t\t\t\tdata-qa={PORTAL_LAYERS.TOOLTIP.name}\n\t\t\t>\n\t\t\t\t{transitions(\n\t\t\t\t\t(style, item) =>\n\t\t\t\t\t\titem && (\n\t\t\t\t\t\t\t<animated.div ref={tooltipRef} style={{ ...inlineStyles.menu, ...style }}>\n\t\t\t\t\t\t\t\t<MrlTooltipContent\n\t\t\t\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t\t\t\tattrs={attrs}\n\t\t\t\t\t\t\t\t\tanchor={anchor}\n\t\t\t\t\t\t\t\t\tdataQa={dataQa}\n\t\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\t\tposition={position}\n\t\t\t\t\t\t\t\t\ttext={text}\n\t\t\t\t\t\t\t\t\ttooltipContentClass={tooltipContentClass}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</animated.div>\n\t\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</MrlPortal>\n\t\t</>\n\t);\n});\n\nMrlTooltip.displayName = 'MrlTooltip';\n"],"names":["MrlTooltip","React","memo","props","children","_props$clickToClose","clickToClose","_props$disableTooltip","disableTooltipHover","_props$display","display","defaultDisplay","text","_props$attrs","attrs","dataQa","_props$position","position","MrlTooltipDefaults","_props$anchor","anchor","_props$srAnnouncement","srAnnouncement","tooltipClass","tooltipContentClass","eventId","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","_React$useState","useState","_React$useState2","_slicedToArray","interaction","setInteraction","triggerRef","useRef","tooltipRef","_React$useState3","_React$useState4","setDisplay","_React$useState5","_React$useState6","id","setId","previousDisplayRef","useEffect","current","action","metadata","variant","handleShowTooltip","useCallback","handleFocus","handleHideTooltip","handleKeyDown","e","key","handleSetKeyboardInteraction","handlesetMouseInteraction","getUniqueId","trigger","document","querySelector","concat","currentTooltipRef","addEventListener","removeEventListener","positionStyles","useTooltipPosition","align","inlineStyles","menu","left","top","transitions","useTransition","config","duration","enter","opacity","from","leave","createElement","Fragment","Children","map","child","index","isValidElement","_props","className","onBlur","onFocus","onKeyDown","onMouseOver","onMouseOut","onMouseUp","otherProps","_excluded2","cloneElement","_objectSpread","undefined","classNames","curryHandlers","MrlPortal","PORTAL_LAYERS","TOOLTIP","name","layer","style","item","animated","div","ref","MrlTooltip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":3,"file":"MrlTooltip.js","sources":["../../../../../src/components/tooltip/MrlTooltip/MrlTooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { AttrsObject, getUniqueId } from '../../../utils';\nimport {\n\tMrlTooltipAnchor,\n\tMrlTooltipDefaults,\n\tMrlTooltipPosition,\n\tMrlTooltipState\n} from '../constants';\nimport { MrlTooltipContent } from '../MrlTooltipContent/MrlTooltipContent';\nimport { curryHandlers } from '../utils';\nimport classNames from 'classnames';\nimport { MrlPortal } from '../../portal';\nimport '../../../styles/shared/a11y-helpers/a11y.global.scss';\nimport { useTooltipPosition } from '../useTooltipPosition';\nimport { useTransition, animated } from '@react-spring/web';\nimport { PORTAL_LAYERS } from '../../../utils/layers';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nexport interface MrlTooltipProps {\n\t/** The arrow position of the tooltip in relation to its trigger's content */\n\tanchor?: MrlTooltipAnchor;\n\n\t/**\n\t * Attributes that are applied to the component during the initial render.\n\t *\n\t * Example usage: html attributes, custom data attributes (data-qa), aria\n\t * @deprecated please use props for component instead\n\t */\n\tattrs?: AttrsObject;\n\n\t/**\n\t * Children to be rendered within the tooltip. The first child is used as the trigger.\n\t *\n\t * Warning: The tooltip is only setup to work with a single trigger. If multiple children\n\t * are passed in the component will not have event handling for the additional child elements.\n\t */\n\tchildren: React.ReactElement;\n\n\t/** Whether the tooltip should close when clicked */\n\tclickToClose?: boolean;\n\n\t/** The data-qa attribute for the tooltip */\n\tdataQa?: string;\n\n\t/** The state value to determine if the tooltip should be displayed */\n\tdisplay?: MrlTooltipState;\n\n\t/** Whether to disable the tooltip hover action that keeps it open */\n\tdisableTooltipHover?: boolean;\n\n\t/** The placement of the tooltip in relation to its trigger */\n\tposition?: MrlTooltipPosition;\n\n\t/** Whether to announce the tooltip content to screen readers */\n\tsrAnnouncement?: boolean;\n\n\t/** The textual label of tooltip */\n\ttext: string;\n\n\t/** A custom class selector to be applied to the tooltip wrapper */\n\ttooltipClass?: string;\n\n\t/** A class to be applied ot the tooltip content */\n\ttooltipContentClass?: string;\n\n\t/**\n\t * Renders custom tooltip content instead of the plain `text`. Receives `text` as\n\t * its argument. `text` is still required and used for accessibility.\n\t *\n\t * Note: `MrlTooltip` is memoized, so this function should be memoized by consumers.\n\t */\n\tcustomRender?: (text?: string) => React.ReactNode;\n\n\t/**\n\t * Enables interaction tracking for this tooltip. Provide a stable, non-PII id\n\t * (e.g. 'facilitation-timer-tooltip'). When omitted, the tooltip emits no analytics.\n\t *\n\t * Note: tooltips open on hover, so an instrumented tooltip is a high-volume source.\n\t * Only add an id where the reveal itself is the signal you need.\n\t */\n\teventId?: string;\n}\n\n/**\n * Tooltip configuration for components that wrap `MrlTooltip` (e.g. `MrlButton`).\n */\nexport type TooltipConfig = Pick<\n\tMrlTooltipProps,\n\t'anchor' | 'customRender' | 'dataQa' | 'position' | 'text'\n>;\n\n/**\n * MrlTooltip Component\n *\n * This component is not displayed when rendering this component if the primary pointing device can’t hover. Examples include touchscreens and screens that use a basic drawing stylus.\n * Pointing devices that can hover, but for which doing so is inconvenient and not part of the normal way they are used, also match this criteria. For example, a touchscreen where a long press is treated as hovering.\n * @param {MrlTooltipProps} props - The props of the component\n * @returns {HTMLElement} a configured Tooltip component\n */\nexport const MrlTooltip = React.memo((props: MrlTooltipProps): React.ReactElement => {\n\tconst {\n\t\tchildren,\n\t\tclickToClose = true,\n\t\tdisableTooltipHover = false,\n\t\tdisplay: defaultDisplay = 'hide',\n\t\ttext,\n\t\tattrs = {},\n\t\tdataQa,\n\t\tposition = MrlTooltipDefaults.position || 'top',\n\t\tanchor = MrlTooltipDefaults.anchor,\n\t\tsrAnnouncement = true,\n\t\ttooltipClass,\n\t\ttooltipContentClass,\n\t\teventId,\n\t\t...rest\n\t} = props;\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlTooltip', eventId);\n\n\tconst [interaction, setInteraction] = React.useState('mouse');\n\n\tconst triggerRef = React.useRef<HTMLElement | null>(null);\n\n\tconst tooltipRef = React.useRef<HTMLDivElement>(null);\n\n\t/**\n\t * State value to determine if the tooltip should be displayed\n\t */\n\tconst [display, setDisplay] = React.useState<MrlTooltipState>(defaultDisplay);\n\n\t/**\n\t * State value to determine if the tooltip should be displayed\n\t */\n\tconst [id, setId] = React.useState<string>('');\n\n\t/**\n\t * The tooltip shows and hides from hover, focus and click, so open/close is emitted\n\t * from the resulting display state rather than from each individual handler.\n\t */\n\tconst previousDisplayRef = React.useRef<MrlTooltipState>(defaultDisplay);\n\n\tReact.useEffect(() => {\n\t\tif (previousDisplayRef.current === display) return;\n\n\t\tpreviousDisplayRef.current = display;\n\n\t\ttrackInteraction({\n\t\t\taction: display === 'show' ? 'open' : 'close',\n\t\t\tmetadata: { interaction },\n\t\t\tvariant: position\n\t\t});\n\t\t// `interaction` only annotates the event; it must not re-trigger it\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [display, position, trackInteraction]);\n\n\t/**\n\t * Event handler to show tooltip when the trigger is focused\n\t */\n\tconst handleShowTooltip = React.useCallback(() => {\n\t\tsetDisplay('show');\n\t}, []);\n\n\tconst handleFocus = React.useCallback(() => {\n\t\tif (interaction === 'keyboard') {\n\t\t\thandleShowTooltip();\n\t\t}\n\t}, [interaction, handleShowTooltip]);\n\n\t/**\n\t * Event handler to hide the tooltip on mouseout\n\t */\n\tconst handleHideTooltip = (): void => {\n\t\tsetDisplay('hide');\n\t};\n\n\t/**\n\t * Event handler to hide the tooltip when a user presses escape\n\t * @param {React.KeyboardEvent} e Keyboard event\n\t */\n\tconst handleKeyDown = (e: React.KeyboardEvent): void => {\n\t\tif (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ') {\n\t\t\thandleHideTooltip();\n\t\t}\n\t};\n\n\tconst handleSetKeyboardInteraction = (e: KeyboardEvent) => {\n\t\tif (e.key === 'Tab' || e.key === 'Enter' || e.key === ' ') {\n\t\t\tsetInteraction('keyboard');\n\t\t}\n\t};\n\n\tconst handlesetMouseInteraction = () => setInteraction('mouse');\n\n\t/**\n\t * Setup of the initial component attributes and events\n\t */\n\tReact.useEffect(() => {\n\t\tif (id === '') setId(getUniqueId('mrl-tooltip'));\n\t}, [id]);\n\n\tReact.useEffect(() => {\n\t\tsetDisplay(defaultDisplay);\n\t}, [defaultDisplay]);\n\n\t/**\n\t * Setting the triggerRef to the trigger element\n\t *\n\t * We need to use 'querySelector' because we cannot pass a ref to the child object. There are\n\t * some situations where the child component may not accept a ref, for example: a react router\n\t * link is passed as a child. In older versions of react router you could not pass a ref to the\n\t * component so this causes an issue.\n\t */\n\tReact.useEffect(() => {\n\t\tconst trigger = document.querySelector(`[data-tooltip-id=\"${id}\"]`);\n\t\ttriggerRef.current = trigger as HTMLElement;\n\t}, [id]);\n\n\tReact.useEffect(() => {\n\t\tconst currentTooltipRef = tooltipRef.current;\n\n\t\tdocument.addEventListener('keydown', handleSetKeyboardInteraction);\n\t\tdocument.addEventListener('mousedown', handlesetMouseInteraction);\n\n\t\tif (!disableTooltipHover && currentTooltipRef) {\n\t\t\tcurrentTooltipRef.addEventListener('mouseover', handleShowTooltip);\n\t\t\tcurrentTooltipRef.addEventListener('mouseout', handleHideTooltip);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (!disableTooltipHover && currentTooltipRef) {\n\t\t\t\tcurrentTooltipRef.removeEventListener('mouseover', handleShowTooltip);\n\t\t\t\tcurrentTooltipRef.removeEventListener('mouseout', handleHideTooltip);\n\t\t\t}\n\n\t\t\tdocument.removeEventListener('keydown', handleSetKeyboardInteraction);\n\t\t\tdocument.removeEventListener('mousedown', handlesetMouseInteraction);\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [handleShowTooltip, tooltipRef.current]);\n\n\tconst positionStyles = useTooltipPosition(\n\t\ttriggerRef,\n\t\ttooltipRef,\n\t\t{\n\t\t\talign: anchor,\n\t\t\tposition: position\n\t\t},\n\t\tdisplay === 'show',\n\t\t-1\n\t);\n\n\tconst inlineStyles = {\n\t\tmenu: {\n\t\t\tleft: positionStyles.left,\n\t\t\tposition: 'fixed' as const,\n\t\t\ttop: positionStyles.top\n\t\t}\n\t};\n\n\tconst transitions = useTransition(display === 'show', {\n\t\tconfig: { duration: display === 'show' ? 150 : 25 },\n\t\tenter: { opacity: 1 },\n\t\tfrom: { opacity: 0 },\n\t\tleave: { opacity: 0 }\n\t});\n\n\treturn (\n\t\t<>\n\t\t\t{React.Children.map(children, (child, index) => {\n\t\t\t\tif (index === 0 && React.isValidElement(child)) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\tonBlur,\n\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\tonKeyDown,\n\t\t\t\t\t\tonMouseOver,\n\t\t\t\t\t\tonMouseOut,\n\t\t\t\t\t\tonMouseUp,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t...otherProps\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t} = (child as any).props;\n\n\t\t\t\t\treturn React.cloneElement(child as React.ReactElement, {\n\t\t\t\t\t\t'aria-describedby': display === 'show' && srAnnouncement ? id : undefined,\n\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\ttooltipClass,\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'mrl-tooltip-trigger',\n\t\t\t\t\t\t\tdisplay === 'show' && 'mrl-tooltip-trigger--active'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tonBlur: curryHandlers(onBlur, handleHideTooltip),\n\t\t\t\t\t\t...(clickToClose && !disableTooltipHover\n\t\t\t\t\t\t\t? { onMouseUp: curryHandlers(onMouseUp, handleHideTooltip) }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\tonFocus: curryHandlers(onFocus, handleFocus),\n\t\t\t\t\t\tonKeyDown: curryHandlers(onKeyDown, handleKeyDown),\n\t\t\t\t\t\tonMouseOut: curryHandlers(onMouseOut, handleHideTooltip),\n\t\t\t\t\t\tonMouseOver: curryHandlers(onMouseOver, handleShowTooltip),\n\t\t\t\t\t\t...otherProps,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t['data-tooltip-id']: id\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t})}\n\t\t\t<MrlPortal\n\t\t\t\tid={PORTAL_LAYERS.TOOLTIP.name}\n\t\t\t\tlayer={PORTAL_LAYERS.TOOLTIP}\n\t\t\t\tclassName={PORTAL_LAYERS.TOOLTIP.name}\n\t\t\t\tdata-qa={PORTAL_LAYERS.TOOLTIP.name}\n\t\t\t>\n\t\t\t\t{transitions(\n\t\t\t\t\t(style, item) =>\n\t\t\t\t\t\titem && (\n\t\t\t\t\t\t\t<animated.div ref={tooltipRef} style={{ ...inlineStyles.menu, ...style }}>\n\t\t\t\t\t\t\t\t<MrlTooltipContent\n\t\t\t\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t\t\t\tattrs={attrs}\n\t\t\t\t\t\t\t\t\tanchor={anchor}\n\t\t\t\t\t\t\t\t\tdataQa={dataQa}\n\t\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\t\tposition={position}\n\t\t\t\t\t\t\t\t\ttext={text}\n\t\t\t\t\t\t\t\t\ttooltipContentClass={tooltipContentClass}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</animated.div>\n\t\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</MrlPortal>\n\t\t</>\n\t);\n});\n\nMrlTooltip.displayName = 'MrlTooltip';\n"],"names":["MrlTooltip","React","memo","props","children","_props$clickToClose","clickToClose","_props$disableTooltip","disableTooltipHover","_props$display","display","defaultDisplay","text","_props$attrs","attrs","dataQa","_props$position","position","MrlTooltipDefaults","_props$anchor","anchor","_props$srAnnouncement","srAnnouncement","tooltipClass","tooltipContentClass","eventId","rest","_objectWithoutProperties","_excluded","trackInteraction","useMrlTrackInteraction","_React$useState","useState","_React$useState2","_slicedToArray","interaction","setInteraction","triggerRef","useRef","tooltipRef","_React$useState3","_React$useState4","setDisplay","_React$useState5","_React$useState6","id","setId","previousDisplayRef","useEffect","current","action","metadata","variant","handleShowTooltip","useCallback","handleFocus","handleHideTooltip","handleKeyDown","e","key","handleSetKeyboardInteraction","handlesetMouseInteraction","getUniqueId","trigger","document","querySelector","concat","currentTooltipRef","addEventListener","removeEventListener","positionStyles","useTooltipPosition","align","inlineStyles","menu","left","top","transitions","useTransition","config","duration","enter","opacity","from","leave","createElement","Fragment","Children","map","child","index","isValidElement","_props","className","onBlur","onFocus","onKeyDown","onMouseOver","onMouseOut","onMouseUp","otherProps","_excluded2","cloneElement","_objectSpread","undefined","classNames","curryHandlers","MrlPortal","PORTAL_LAYERS","TOOLTIP","name","layer","style","item","animated","div","ref","MrlTooltipContent","_extends","displayName"],"mappings":";;;;;;;;;;;;;;;;AAmFA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,KAAK,CAACC,IAAI,CAAEC,KAAsB,IAAyB;AACpF,EAAA,IACCC,QAAQ,GAcLD,KAAK,CAdRC,QAAQ;IAAAC,mBAAA,GAcLF,KAAK,CAbRG,YAAY;AAAZA,IAAAA,YAAY,GAAAD,mBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,mBAAA;IAAAE,qBAAA,GAahBJ,KAAK,CAZRK,mBAAmB;AAAnBA,IAAAA,mBAAmB,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;IAAAE,cAAA,GAYxBN,KAAK,CAXRO,OAAO;AAAEC,IAAAA,cAAc,GAAAF,cAAA,KAAA,MAAA,GAAG,MAAM,GAAAA,cAAA;IAChCG,IAAI,GAUDT,KAAK,CAVRS,IAAI;IAAAC,YAAA,GAUDV,KAAK,CATRW,KAAK;AAALA,IAAAA,KAAK,GAAAD,YAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,YAAA;IACVE,MAAM,GAQHZ,KAAK,CARRY,MAAM;I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AAT,cAAA,CAAAA,cAAA,KAAO9B,YAAY,CAACC,IAAI,CAAA,EAAKsC,KAAK;GAAG,eACxE/G,KAAA,CAAAoF,aAAA,CAACgC,iBAAiB,EAAAC,QAAA,KACb5F,IAAI,EAAA;AACRZ,IAAAA,KAAK,EAAEA,KAAM;AACbM,IAAAA,MAAM,EAAEA,MAAO;AACfL,IAAAA,MAAM,EAAEA,MAAO;AACf8B,IAAAA,EAAE,EAAEA,EAAG;AACP5B,IAAAA,QAAQ,EAAEA,QAAS;AACnBL,IAAAA,IAAI,EAAEA,IAAK;AACXY,IAAAA,mBAAmB,EAAEA;AAAoB,GAAA,CACzC,CACY,CAEjB,CACU,CACV,CAAC;AAEL,CAAC;AAEDxB,UAAU,CAACuH,WAAW,GAAG,YAAY;;;;"}
@@ -1,4 +1,4 @@
1
- var TOOLKIT_VERSION = "4.78.2";
1
+ var TOOLKIT_VERSION = "4.79.0";
2
2
 
3
3
  export { TOOLKIT_VERSION };
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["export const TOOLKIT_VERSION = \"4.78.2\";"],"names":["TOOLKIT_VERSION"],"mappings":"AAAO,IAAMA,eAAe,GAAG;;;;"}
1
+ {"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["export const TOOLKIT_VERSION = \"4.79.0\";"],"names":["TOOLKIT_VERSION"],"mappings":"AAAO,IAAMA,eAAe,GAAG;;;;"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import type { MrlButtonState, TooltipConfig } from '../../button/MrlButton/MrlButton';
2
+ import type { MrlButtonState } from '../../button/MrlButton/MrlButton';
3
+ import { type TooltipConfig } from '../../tooltip/MrlTooltip/MrlTooltip';
3
4
  import { MrlAvatarPropTypes } from '../MrlAvatar/MrlAvatar';
4
5
  import { ToggleAria } from '../../button/constants';
5
6
  export interface MrlAvatarButtonPropTypes extends MrlAvatarPropTypes, React.HTMLAttributes<HTMLButtonElement> {
@@ -1,28 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { allowedButtonValues, MrlButtonKind, MrlButtonSize, ToggleAria, IconPosition } from '../constants';
3
- import { MrlTooltipAnchor, MrlTooltipPosition } from '../../tooltip/constants';
3
+ import { type TooltipConfig } from '../../tooltip/MrlTooltip/MrlTooltip';
4
4
  import { AttrsObject, MrlComponentProps } from '../../../utils';
5
5
  import './MrlButton.global.scss';
6
6
  export type MrlButtonState = (typeof allowedButtonValues.states)[number];
7
7
  export type ToggleStyle = (typeof allowedButtonValues.toggleStyles)[number];
8
- export interface TooltipConfig {
9
- /**
10
- * The text to display in the tooltip
11
- */
12
- text: string;
13
- /**
14
- * The position of the tooltip relative to the button
15
- */
16
- position?: MrlTooltipPosition;
17
- /**
18
- * The anchor of the tooltip relative to the button
19
- */
20
- anchor?: MrlTooltipAnchor;
21
- /**
22
- * The data-qa attribute for the tooltip
23
- */
24
- dataQa?: string;
25
- }
26
8
  export interface MrlButtonProps extends Omit<MrlComponentProps, 'style'>, React.ComponentProps<'button'> {
27
9
  /**
28
10
  * Applies additional HTML attributes to the button element.
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { MrlButtonKind, MrlButtonSize, MrlGhostIconButtonSize, ToggleAria } from '../constants';
3
3
  import { AttrsObject, MrlComponentProps } from '../../../utils';
4
4
  import { MrlTooltipAnchor, MrlTooltipPosition } from '../../tooltip/constants';
5
+ import { type MrlTooltipProps } from '../../tooltip/MrlTooltip/MrlTooltip';
5
6
  import type { MrlButtonState, ToggleStyle } from '../MrlButton/MrlButton';
6
7
  import './MrlIconButton.scss';
7
8
  export interface MrlIconButtonProps extends Omit<MrlComponentProps, 'style'>, React.ComponentProps<'button'> {
@@ -80,6 +81,13 @@ export interface MrlIconButtonProps extends Omit<MrlComponentProps, 'style'>, Re
80
81
  * The arrow position of the tooltip in relation to the button.
81
82
  */
82
83
  tipAnchor?: MrlTooltipAnchor;
84
+ /**
85
+ * Renders custom tooltip content instead of the plain `text`. Receives `text` as
86
+ * its argument. `text` is still required and used for accessibility.
87
+ *
88
+ * Note: `MrlTooltip` is memoized, so this function should be memoized by consumers.
89
+ */
90
+ tooltipCustomRender?: MrlTooltipProps['customRender'];
83
91
  /**
84
92
  * Enables interaction tracking for this button. Provide a stable, non-PII id
85
93
  * (e.g. 'board-share-cta'). When omitted, the button emits no analytics.
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { MrlButtonSize, IconPosition } from '../../button/constants';
3
3
  import { LinkTargetType, MrlLinkButtonKind } from '../constants';
4
- import type { TooltipConfig } from '../../button/MrlButton/MrlButton';
4
+ import { type TooltipConfig } from '../../tooltip/MrlTooltip/MrlTooltip';
5
5
  import { MrlComponentProps } from '../../../utils';
6
6
  import './MrlLinkButton.global.scss';
7
7
  export interface MrlLinkButtonProps extends Omit<MrlComponentProps, 'style'>, React.ComponentProps<'a'> {
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { MrlIconButtonProps } from '../../button/MrlIconButton/MrlIconButton';
2
3
  import { MrlTooltipAnchor, MrlTooltipPosition } from '../../tooltip/constants';
3
4
  import { PaginationButtonType } from '../constants';
4
5
  interface MrlPaginationButtonProps {
@@ -35,11 +36,18 @@ interface MrlPaginationButtonProps {
35
36
  tooltipAnchor?: MrlTooltipAnchor;
36
37
  /** The placement of the tooltips on the buttons */
37
38
  tooltipPosition?: MrlTooltipPosition;
39
+ /**
40
+ * Renders custom tooltip content instead of the plain label. Receives the resolved
41
+ * label (`text` or the default for `kind`) so defaults can be decorated.
42
+ *
43
+ * Note: `MrlTooltip` is memoized, so this function should be memoized by consumers.
44
+ */
45
+ tooltipCustomRender?: MrlIconButtonProps['tooltipCustomRender'];
38
46
  }
39
47
  /**
40
48
  * Pagination button component
41
49
  * @param {MrlPaginationButtonProps} props - the component props
42
50
  * @returns a pagintaion button
43
51
  */
44
- export declare function MrlPaginationButton({ buttonClass, className, disabled, kind, handleClick, text, tooltipAnchor, tooltipPosition, eventId, ...rest }: MrlPaginationButtonProps): JSX.Element;
52
+ export declare function MrlPaginationButton({ buttonClass, className, disabled, kind, handleClick, text, tooltipAnchor, tooltipPosition, tooltipCustomRender, eventId, ...rest }: MrlPaginationButtonProps): JSX.Element;
45
53
  export {};
@@ -50,6 +50,7 @@ export interface MrlToolbarButtonProps {
50
50
  size?: MrlIconButtonProps['size'];
51
51
  state?: MrlIconButtonProps['state'];
52
52
  tipAnchor?: MrlIconButtonProps['tipAnchor'];
53
+ tooltipCustomRender?: MrlIconButtonProps['tooltipCustomRender'];
53
54
  toggleAria?: MrlIconButtonProps['toggleAria'];
54
55
  toggleStyle?: MrlIconButtonProps['toggleStyle'];
55
56
  };
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { AttrsObject } from '../../../utils';
3
3
  import { MrlTooltipAnchor, MrlTooltipPosition, MrlTooltipState } from '../constants';
4
4
  import '../../../styles/shared/a11y-helpers/a11y.global.scss';
5
- interface MrlTooltipProps {
5
+ export interface MrlTooltipProps {
6
6
  /** The arrow position of the tooltip in relation to its trigger's content */
7
7
  anchor?: MrlTooltipAnchor;
8
8
  /**
@@ -37,7 +37,12 @@ interface MrlTooltipProps {
37
37
  tooltipClass?: string;
38
38
  /** A class to be applied ot the tooltip content */
39
39
  tooltipContentClass?: string;
40
- /** A custom render function to render the tooltip content */
40
+ /**
41
+ * Renders custom tooltip content instead of the plain `text`. Receives `text` as
42
+ * its argument. `text` is still required and used for accessibility.
43
+ *
44
+ * Note: `MrlTooltip` is memoized, so this function should be memoized by consumers.
45
+ */
41
46
  customRender?: (text?: string) => React.ReactNode;
42
47
  /**
43
48
  * Enables interaction tracking for this tooltip. Provide a stable, non-PII id
@@ -48,6 +53,10 @@ interface MrlTooltipProps {
48
53
  */
49
54
  eventId?: string;
50
55
  }
56
+ /**
57
+ * Tooltip configuration for components that wrap `MrlTooltip` (e.g. `MrlButton`).
58
+ */
59
+ export type TooltipConfig = Pick<MrlTooltipProps, 'anchor' | 'customRender' | 'dataQa' | 'position' | 'text'>;
51
60
  /**
52
61
  * MrlTooltip Component
53
62
  *
@@ -57,4 +66,3 @@ interface MrlTooltipProps {
57
66
  * @returns {HTMLElement} a configured Tooltip component
58
67
  */
59
68
  export declare const MrlTooltip: React.MemoExoticComponent<(props: MrlTooltipProps) => React.ReactElement>;
60
- export {};
@@ -1 +1 @@
1
- export { MrlTooltip } from './MrlTooltip';
1
+ export { MrlTooltip, type MrlTooltipProps, type TooltipConfig } from './MrlTooltip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muraldevkit/ui-toolkit",
3
- "version": "4.78.2",
3
+ "version": "4.79.0",
4
4
  "description": "Mural's UI Toolkit",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",