@muraldevkit/ui-toolkit 4.78.1 → 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 (60) 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/form/select/MrlCreatableSelect/MrlCreatableSelect.js +8 -4
  10. package/dist/cjs/components/form/select/MrlCreatableSelect/MrlCreatableSelect.js.map +1 -1
  11. package/dist/cjs/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.js +8 -4
  12. package/dist/cjs/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.js.map +1 -1
  13. package/dist/cjs/components/link/MrlLinkButton/MrlLinkButton.js +2 -1
  14. package/dist/cjs/components/link/MrlLinkButton/MrlLinkButton.js.map +1 -1
  15. package/dist/cjs/components/pagination/MrlPaginationButton/MrlPaginationButton.js +4 -2
  16. package/dist/cjs/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
  17. package/dist/cjs/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
  18. package/dist/cjs/components/tooltip/MrlTooltip/MrlTooltip.js +5 -0
  19. package/dist/cjs/components/tooltip/MrlTooltip/MrlTooltip.js.map +1 -1
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/cjs/version.js.map +1 -1
  22. package/dist/components/avatar/MrlAvatarButton/MrlAvatarButton.d.ts +2 -1
  23. package/dist/components/button/MrlButton/MrlButton.d.ts +1 -19
  24. package/dist/components/button/MrlIconButton/MrlIconButton.d.ts +8 -0
  25. package/dist/components/link/MrlLinkButton/MrlLinkButton.d.ts +1 -1
  26. package/dist/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +9 -1
  27. package/dist/components/svg/config.d.ts +1 -1
  28. package/dist/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +1 -0
  29. package/dist/components/tooltip/MrlTooltip/MrlTooltip.d.ts +11 -3
  30. package/dist/components/tooltip/MrlTooltip/index.d.ts +1 -1
  31. package/dist/esm/components/avatar/MrlAvatarButton/MrlAvatarButton.js +2 -1
  32. package/dist/esm/components/avatar/MrlAvatarButton/MrlAvatarButton.js.map +1 -1
  33. package/dist/esm/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js +4 -2
  34. package/dist/esm/components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js.map +1 -1
  35. package/dist/esm/components/button/MrlButton/MrlButton.js +2 -1
  36. package/dist/esm/components/button/MrlButton/MrlButton.js.map +1 -1
  37. package/dist/esm/components/button/MrlIconButton/MrlIconButton.js +3 -1
  38. package/dist/esm/components/button/MrlIconButton/MrlIconButton.js.map +1 -1
  39. package/dist/esm/components/form/select/MrlCreatableSelect/MrlCreatableSelect.js +8 -4
  40. package/dist/esm/components/form/select/MrlCreatableSelect/MrlCreatableSelect.js.map +1 -1
  41. package/dist/esm/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.js +8 -4
  42. package/dist/esm/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.js.map +1 -1
  43. package/dist/esm/components/link/MrlLinkButton/MrlLinkButton.js +2 -1
  44. package/dist/esm/components/link/MrlLinkButton/MrlLinkButton.js.map +1 -1
  45. package/dist/esm/components/pagination/MrlPaginationButton/MrlPaginationButton.js +4 -2
  46. package/dist/esm/components/pagination/MrlPaginationButton/MrlPaginationButton.js.map +1 -1
  47. package/dist/esm/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
  48. package/dist/esm/components/tooltip/MrlTooltip/MrlTooltip.js +5 -0
  49. package/dist/esm/components/tooltip/MrlTooltip/MrlTooltip.js.map +1 -1
  50. package/dist/esm/version.js +1 -1
  51. package/dist/esm/version.js.map +1 -1
  52. package/dist/types/components/avatar/MrlAvatarButton/MrlAvatarButton.d.ts +2 -1
  53. package/dist/types/components/button/MrlButton/MrlButton.d.ts +1 -19
  54. package/dist/types/components/button/MrlIconButton/MrlIconButton.d.ts +8 -0
  55. package/dist/types/components/link/MrlLinkButton/MrlLinkButton.d.ts +1 -1
  56. package/dist/types/components/pagination/MrlPaginationButton/MrlPaginationButton.d.ts +9 -1
  57. package/dist/types/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +1 -0
  58. package/dist/types/components/tooltip/MrlTooltip/MrlTooltip.d.ts +11 -3
  59. package/dist/types/components/tooltip/MrlTooltip/index.d.ts +1 -1
  60. package/package.json +1 -1
@@ -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,gBAAK,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,0BAAc,CAACD,OAAO,GAAAD,YAAA;IAAAG,SAAA,GAAAR,IAAA,CAChCS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGE,oBAAQ,CAACC,cAAc,GAAAH,SAAA;IAAAI,YAAA,GAAAZ,IAAA,CAC9Ba,OAAO;AAAPA,IAAAA,OAAO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D,gBAAA,CAAA+C,aAAA,CAACK,qBAAU,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,gBAAK,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,0BAAc,CAACD,OAAO,GAAAD,YAAA;IAAAG,SAAA,GAAAR,IAAA,CAChCS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGE,oBAAQ,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,yBAAe,CAACC,IAAI,GAAAH,gBAAA;IAClCI,OAAO,GAAAlB,IAAA,CAAPkB,OAAO;IAAAC,WAAA,GAAAnB,IAAA,CACPoB,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,MAAA,GAAGT,oBAAQ,CAACU,MAAM,GAAAD,WAAA;IACxBF,IAAI,GA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ace(e) {
33
33
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
34
  var classnames__default = /*#__PURE__*/_interopDefault(classnames);
35
35
 
36
- var _excluded = ["buttonClass", "className", "disabled", "kind", "handleClick", "text", "tooltipAnchor", "tooltipPosition", "eventId"];
36
+ var _excluded = ["buttonClass", "className", "disabled", "kind", "handleClick", "text", "tooltipAnchor", "tooltipPosition", "tooltipCustomRender", "eventId"];
37
37
  /**
38
38
  * Pagination button component
39
39
  * @param {MrlPaginationButtonProps} props - the component props
@@ -50,6 +50,7 @@ function MrlPaginationButton(_ref) {
50
50
  tooltipAnchor = _ref$tooltipAnchor === void 0 ? constants.MrlTooltipDefaults.anchor : _ref$tooltipAnchor,
51
51
  _ref$tooltipPosition = _ref.tooltipPosition,
52
52
  tooltipPosition = _ref$tooltipPosition === void 0 ? 'top' : _ref$tooltipPosition,
53
+ tooltipCustomRender = _ref.tooltipCustomRender,
53
54
  eventId = _ref.eventId,
54
55
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
55
56
  var trackInteraction = useMrlAnalytics.useMrlTrackInteraction('MrlPaginationButton', eventId);
@@ -92,7 +93,8 @@ function MrlPaginationButton(_ref) {
92
93
  state: disabled ? 'disabled' : 'default',
93
94
  text: text || defaultText[kind],
94
95
  size: "xsmall",
95
- tipAnchor: tooltipAnchor
96
+ tipAnchor: tooltipAnchor,
97
+ tooltipCustomRender: tooltipCustomRender
96
98
  })));
97
99
  }
98
100
 
@@ -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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A,IAAI,EAAE,MAAM;AACZE,IAAAA,QAAQ,EAAE;GACV;EAED,oBACCG,gBAAA,CAAAC,aAAA,CAAA,IAAA,EAAA;AAAInC,IAAAA,SAAS,EAAEqB;GAAY,eAC1Ba,gBAAA,CAAAC,aAAA,CAACC,2BAAa,EAAAC,iCAAA,KACTzB,IAAI,EAAA;AACRZ,IAAAA,SAAS,EAAED,WAAY;AACvBG,IAAAA,IAAI,EAAC,OAAO;AACZoC,IAAAA,IAAI,eAAEJ,gBAAA,CAAAC,aAAA,CAACI,aAAM,EAAA;MAACC,GAAG,EAAEhB,KAAK,CAACtB,IAAI;AAAE,KAAE,CAAE;AACnCuC,IAAAA,OAAO,EAAExB,aAAc;AACvByB,IAAAA,QAAQ,EAAEhC,eAAgB;AAC1BiC,IAAAA,KAAK,EAAE1C,QAAQ,GAAG,UAAU,GAAG,SAAU;AACzCG,IAAAA,IAAI,EAAEA,IAAI,IAAI6B,WAAW,CAAC/B,IAAI,CAAE;AAChC0C,IAAAA,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,CAA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WAAW,GAAG;AACnBR,IAAAA,KAAK,EAAE,WAAW;AAClBE,IAAAA,IAAI,EAAE,KAAK;AACXE,IAAAA,IAAI,EAAE,MAAM;AACZE,IAAAA,QAAQ,EAAE;GACV;EAED,oBACCG,gBAAA,CAAAC,aAAA,CAAA,IAAA,EAAA;AAAIpC,IAAAA,SAAS,EAAEsB;GAAY,eAC1Ba,gBAAA,CAAAC,aAAA,CAACC,2BAAa,EAAAC,iCAAA,KACTzB,IAAI,EAAA;AACRb,IAAAA,SAAS,EAAED,WAAY;AACvBG,IAAAA,IAAI,EAAC,OAAO;AACZqC,IAAAA,IAAI,eAAEJ,gBAAA,CAAAC,aAAA,CAACI,aAAM,EAAA;MAACC,GAAG,EAAEhB,KAAK,CAACvB,IAAI;AAAE,KAAE,CAAE;AACnCwC,IAAAA,OAAO,EAAExB,aAAc;AACvByB,IAAAA,QAAQ,EAAEjC,eAAgB;AAC1BkC,IAAAA,KAAK,EAAE3C,QAAQ,GAAG,UAAU,GAAG,SAAU;AACzCG,IAAAA,IAAI,EAAEA,IAAI,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,gBAAK,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,YAAY,GAWTT,KAAK,CAXRS,YAAY;IACZC,IAAI,GAUDV,KAAK,CAVRU,IAAI;IAAAC,qBAAA,GAUDX,KAAK,CATRY,kBAAkB;IAAlBA,kBAAkB,GAAAD,qBAAA,KAAA,MAAA,GAAG;AACpBE,MAAAA,QAAQ,EAAE,QAAQ;AAClBC,MAAAA,IAAI,EAAE,OAAO;AACbC,MAAAA,KAAK,EAAE;AACR,KAAC,GAAAJ,qBAAA;IAGDK,OAAO,GAEJhB,KAAK,CAFRgB,OAAO;AACJC,IAAAA,IAAI,GAAAC,iDAAA,CACJlB,KAAK,EAAAmB,SAAA,CAAA;AACT,EAAA,IAAMC,OAAO,GAAGC,2BAAU,CAAC,kBAAkB,EAAEnB,SAAS,CAAC;AAEzD,EAAA,IAAMoB,gBAAgB,GAAGC,sCAAsB,CAAC,kBAAkB,EAAEP,OAAO,CAAC;;AAE5E;AACF;AACA;AACA;AACA;EACE,IAAMQ,aAAa,GAAIC,CAAuC,IAAK;AAClEH,IAAAA,gBAAgB,CAAC;AAChBI,MAAAA,MAAM,EAAE,OAAO;AACfC,MAAAA,OAAO,EAAElB,YAAY,GAAG,MAAM,GAAG;AAClC,KAAC,CAAC;AAEFF,IAAAA,OAAO,aAAPA,OAAO,KAAA,MAAA,GAAA,MAAA,GAAPA,OAAO,CAAGkB,CAAC,CAAC;EACb,CAAC;AAED,EAAA,IAAIhB,YAAY,EAAE;IACjB,oBACCX,gBAAA,CAAA8B,aAAA,CAACC,uBAAW,EAAAC,iCAAA,KAAKxB,aAAa,EAAA;AAAEJ,MAAAA,SAAS,EAAEkB,OAAQ;AAAC,MAAA,SAAA,EAASZ,EAAG;AAACD,MAAAA,OAAO,EAAEiB;KAAc,CAAA,eACvF1B,gBAAA,CAAA8B,aAAA,CAAA,MAAA,EAAA;MAAM1B,SAAS,EAAE6B,+BAAM,CAACC;AAAqB,KAAA,EAAE7B,IAAW,CAAC,EAC1DO,IACW,CAAC;AAEhB,EAAA;EAEA,oBACCZ,gBAAA,CAAA8B,aAAA,CAACK,2BAAa,EAAAH,iCAAA,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,gBAAK,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,YAAY,GAWTT,KAAK,CAXRS,YAAY;IACZC,IAAI,GAUDV,KAAK,CAVRU,IAAI;IAAAC,qBAAA,GAUDX,KAAK,CATRY,kBAAkB;IAAlBA,kBAAkB,GAAAD,qBAAA,KAAA,MAAA,GAAG;AACpBE,MAAAA,QAAQ,EAAE,QAAQ;AAClBC,MAAAA,IAAI,EAAE,OAAO;AACbC,MAAAA,KAAK,EAAE;AACR,KA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AA,OAAO,EAAEiB,aAAc;AACvBvB,IAAAA,GAAG,EAAEA,GAAI;AACTS,IAAAA,IAAI,EAAEA;AAAK,GAAA,CACX,CAAC;AAEJ,CACD;;;;"}
@@ -38,6 +38,11 @@ var classnames__default = /*#__PURE__*/_interopDefault(classnames);
38
38
 
39
39
  var _excluded = ["children", "clickToClose", "disableTooltipHover", "display", "text", "attrs", "dataQa", "position", "anchor", "srAnnouncement", "tooltipClass", "tooltipContentClass", "eventId"],
40
40
  _excluded2 = ["className", "onBlur", "onFocus", "onKeyDown", "onMouseOver", "onMouseOut", "onMouseUp", "children"];
41
+
42
+ /**
43
+ * Tooltip configuration for components that wrap `MrlTooltip` (e.g. `MrlButton`).
44
+ */
45
+
41
46
  /**
42
47
  * MrlTooltip Component
43
48
  *
@@ -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","MrlTooltipContent","_extends","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,gBAAK,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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/BC,KAAK,EAAEH,qBAAa,CAACC,OAAQ;AAC7BhB,IAAAA,SAAS,EAAEe,qBAAa,CAACC,OAAO,CAACC,IAAK;IACtC,SAAA,EAASF,qBAAa,CAACC,OAAO,CAACC;AAAK,GAAA,EAEnCjC,WAAW,CACX,CAACmC,KAAK,EAAEC,IAAI,KACXA,IAAI,iBACHhH,gBAAA,CAAAoF,aAAA,CAAC6B,YAAQ,CAACC,GAAG,EAAA;AAACC,IAAAA,GAAG,EAAE7E,UAAW;IAACyE,KAAK,EAAAT,uCAAA,CAAAA,uCAAA,KAAO9B,YAAY,CAACC,IAAI,CAAA,EAAKsC,KAAK;GAAG,eACxE/G,gBAAA,CAAAoF,aAAA,CAACgC,mCAAiB,EAAAC,iCAAA,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
+ {"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\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,gBAAK,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;IAAAC,eAAA,GAQHb,KAAK,CAPRc,QAAQ;IAARA,QAAQ,GAAAD,eAAA,KAAA,MAAA,GAAGE,4BAAkB,CAACD,QAAQ,IAAI,KAAK,GAAAD,eAAA;IAAAG,aAAA,GAO5ChB,KAAK,CANRiB,MAAM;AAANA,IAAAA,MAAM,GAAAD,aAAA,KAAA,MAAA,GAAGD,4BAAkB,CAACE,MAAM,GAAAD,aAAA;IAAAE,qBAAA,GAM/BlB,KAAK,CALRmB,cAAc;AAAdA,IAAAA,cAAc,GAAAD,qBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,q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AS;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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var TOOLKIT_VERSION = "4.78.1";
3
+ var TOOLKIT_VERSION = "4.79.0";
4
4
 
5
5
  exports.TOOLKIT_VERSION = TOOLKIT_VERSION;
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["export const TOOLKIT_VERSION = \"4.78.1\";"],"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 {};
@@ -80,7 +80,7 @@ export declare const colorPictoStoryData: {
80
80
  export declare const animateStoryData: {
81
81
  args: {
82
82
  delay: number;
83
- state: "stop" | "play";
83
+ state: "play" | "stop";
84
84
  };
85
85
  argTypes: {
86
86
  delay: {
@@ -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';
@@ -108,7 +108,8 @@ var MrlAvatarButton = _ref => {
108
108
  position: tooltip.position || 'bottom',
109
109
  anchor: tooltip.anchor || 'center',
110
110
  text: tooltip.text,
111
- dataQa: tooltip.dataQa
111
+ dataQa: tooltip.dataQa,
112
+ customRender: tooltip.customRender
112
113
  }, renderAvatarButton());
113
114
  };
114
115
 
@@ -1 +1 @@
1
- {"version":3,"file":"MrlAvatarButton.js","sources":["../../../../../src/components/avatar/MrlAvatarButton/MrlAvatarButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classNames from 'classnames';\nimport type { MrlButtonState, TooltipConfig } from '../../button/MrlButton/MrlButton';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltip } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport { MrlAvatar, MrlAvatarPropTypes } from '../MrlAvatar/MrlAvatar';\nimport { _isDisabled, _isSelected } from '../../button/helpers';\nimport { ToggleAria, buttonDefaults } from '../../button/constants';\nimport { setAttributes } from '../../../utils';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlAvatarButton.module.scss';\n\nexport interface MrlAvatarButtonPropTypes\n\textends MrlAvatarPropTypes,\n\t\tReact.HTMLAttributes<HTMLButtonElement> {\n\t/**\n\t * An optional class name to add to button wrapping the MrlAvatar.\n\t */\n\tbuttonClassName?: string;\n\n\t/**\n\t * An optional boolean prop to include the button in roving tabindex\n\t */\n\tincludeInRoving?: boolean;\n\n\t/**\n\t * Selected state variant when the button is a Toggle Button. Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\tisToggleButton?: boolean;\n\n\t/**\n\t * An optional aria-label to apply to the button element\n\t */\n\tlabel?: string;\n\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\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.SyntheticEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * Changes the state of the button based on user permissions or actions.\n\t */\n\tstate?: MrlButtonState;\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\n\t/**\n\t * Tooltip configuration for the button\n\t */\n\ttooltip?: TooltipConfig;\n\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'workspace-member-avatar'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\n\t/**\n\t * Reference to the DOM element that is the MrlAvatarButton\n\t */\n\ttriggerRef?: React.RefObject<HTMLButtonElement>;\n}\n\n/**\n * Renders an avatar button\n * @param {MrlAvatarButtonPropTypes} props the props for your MrlAvatarButton\n * @returns {React.ReactElement} an avatar button containing the props you pass\n */\nexport const MrlAvatarButton = ({\n\tbuttonClassName,\n\tdataQa,\n\tid,\n\tincludeInRoving,\n\tisToggleButton,\n\tlabel,\n\tloading = false,\n\tloadingText = 'Loading',\n\tonClick,\n\tsize,\n\tstate = 'default',\n\ttoggleAria = buttonDefaults.toggleAria,\n\ttooltip,\n\teventId,\n\ttriggerRef,\n\t...rest\n}: MrlAvatarButtonPropTypes): React.ReactElement => {\n\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(state));\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlAvatarButton', eventId);\n\n\t/**\n\t * We need to watch the value of state to keep in sync\n\t * the value of state passed as props and the internal\n\t * isSelected piece of state.\n\t */\n\tReact.useEffect(() => {\n\t\t// allows consumers to set the 'selected' or 'selected-disabled' state from a parent component.\n\t\tsetIsSelected(_isSelected(state));\n\t}, [state]);\n\n\tconst spinner = (\n\t\t<MrlSpinner\n\t\t\tclassName=\"mrlButton-spinner MrlAvatarButton-spinner\"\n\t\t\tkind=\"default\"\n\t\t\trole=\"none\"\n\t\t\tsize=\"small\"\n\t\t\ttext={loadingText}\n\t\t/>\n\t);\n\n\tconst attributes = setAttributes(\n\t\t{},\n\t\t{\n\t\t\t'aria-disabled': _isDisabled(state, loading),\n\t\t\t'aria-label': label,\n\t\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\t\t'data-roving': includeInRoving ? 'true' : undefined,\n\t\t\trole: 'button',\n\t\t\ttype: 'button'\n\t\t}\n\t);\n\n\t/**\n\t * Handle onClick events\n\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t */\n\tfunction handleOnClick(e: React.MouseEvent<HTMLButtonElement>) {\n\t\te.stopPropagation();\n\n\t\tif (_isDisabled(state, loading)) {\n\t\t\treturn;\n\t\t}\n\n\t\ttrackInteraction({ action: 'click', variant: size });\n\n\t\tif (isToggleButton) {\n\t\t\tsetIsSelected((prevIsSelected) => !prevIsSelected);\n\t\t}\n\n\t\tif (onClick && typeof onClick === 'function') {\n\t\t\tonClick(e);\n\t\t}\n\t}\n\n\tconst buttonClasses = classNames('MrlAvatarButton', styles['MrlAvatarButton'], buttonClassName, {\n\t\t[styles['MrlAvatarButton--large']]: size && size === 'large'\n\t});\n\n\tconst renderAvatarButton = () => (\n\t\t<button\n\t\t\t{...attributes}\n\t\t\taria-label={tooltip && tooltip.text}\n\t\t\tclassName={buttonClasses}\n\t\t\tdata-qa={dataQa && `${dataQa}-button`}\n\t\t\tid={id}\n\t\t\tonClick={handleOnClick}\n\t\t\tref={triggerRef}\n\t\t>\n\t\t\t{loading ? spinner : <MrlAvatar dataQa={dataQa} size={size} {...rest} />}\n\t\t</button>\n\t);\n\n\treturn !tooltip ? (\n\t\trenderAvatarButton()\n\t) : (\n\t\t<MrlTooltip\n\t\t\tposition={tooltip.position || 'bottom'}\n\t\t\tanchor={tooltip.anchor || 'center'}\n\t\t\ttext={tooltip.text}\n\t\t\tdataQa={tooltip.dataQa}\n\t\t>\n\t\t\t{renderAvatarButton()}\n\t\t</MrlTooltip>\n\t);\n};\n"],"names":["MrlAvatarButton","_ref","buttonClassName","dataQa","id","includeInRoving","isToggleButton","label","_ref$loading","loading","_ref$loadingText","loadingText","onClick","size","_ref$state","state","_ref$toggleAria","toggleAria","buttonDefaults","tooltip","eventId","triggerRef","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","trackInteraction","useMrlTrackInteraction","useEffect","spinner","createElement","MrlSpinner","className","kind","role","text","attributes","setAttributes","_objectSpread","_isDisabled","concat","undefined","type","handleOnClick","e","stopPropagation","action","variant","prevIsSelected","buttonClasses","classNames","styles","renderAvatarButton","_extends","ref","MrlAvatar","MrlTooltip","position","anchor"],"mappings":";;;;;;;;;;;;;AAoFA;AACA;AACA;AACA;AACA;AACO,IAAMA,eAAe,GAAGC,IAAA,IAiBqB;AAAA,EAAA,IAhBnDC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,EAAE,GAAAH,IAAA,CAAFG,EAAE;IACFC,eAAe,GAAAJ,IAAA,CAAfI,eAAe;IACfC,cAAc,GAAAL,IAAA,CAAdK,cAAc;IACdC,KAAK,GAAAN,IAAA,CAALM,KAAK;IAAAC,YAAA,GAAAP,IAAA,CACLQ,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,KAAK,GAAAA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D,MAAM,CAAC,wBAAwB,CAAC,GAAG7C,IAAI,IAAIA,IAAI,KAAK;AACtD,GAAC,CAAC;EAEF,IAAM8C,kBAAkB,GAAGA,mBAC1BjC,KAAA,CAAAW,aAAA,CAAA,QAAA,EAAAuB,QAAA,CAAA,EAAA,EACKjB,UAAU,EAAA;AACd,IAAA,YAAA,EAAYxB,OAAO,IAAIA,OAAO,CAACuB,IAAK;AACpCH,IAAAA,SAAS,EAAEiB,aAAc;AACzB,IAAA,SAAA,EAASrD,MAAM,IAAA,EAAA,CAAA4C,MAAA,CAAO5C,MAAM,EAAA,SAAA,CAAU;AACtCC,IAAAA,EAAE,EAAEA,EAAG;AACPQ,IAAAA,OAAO,EAAEsC,aAAc;AACvBW,IAAAA,GAAG,EAAExC;GAAW,CAAA,EAEfZ,OAAO,GAAG2B,OAAO,gBAAGV,KAAA,CAAAW,aAAA,CAACyB,SAAS,EAAAF,QAAA,CAAA;AAACzD,IAAAA,MAAM,EAAEA,MAAO;AAACU,IAAAA,IAAI,EAAEA;GAAK,EAAKS,IAAI,CAAG,CAChE,CACR;EAED,OAAO,CAACH,OAAO,GACdwC,kBAAkB,EAAE,gBAEpBjC,KAAA,CAAAW,aAAA,CAAC0B,UAAU,EAAA;AACVC,IAAAA,QAAQ,EAAE7C,OAAO,CAAC6C,QAAQ,IAAI,QAAS;AACvCC,IAAAA,MAAM,EAAE9C,OAAO,CAAC8C,MAAM,IAAI,QAAS;IACnCvB,IAAI,EAAEvB,OAAO,CAACuB,IAAK;IACnBvC,MAAM,EAAEgB,OAAO,CAAChB;GAAO,EAEtBwD,kBAAkB,EACR,CACZ;AACF;;;;"}
1
+ {"version":3,"file":"MrlAvatarButton.js","sources":["../../../../../src/components/avatar/MrlAvatarButton/MrlAvatarButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classNames from 'classnames';\nimport type { MrlButtonState } from '../../button/MrlButton/MrlButton';\nimport { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner';\nimport { MrlTooltip, type TooltipConfig } from '../../tooltip/MrlTooltip/MrlTooltip';\nimport { MrlAvatar, MrlAvatarPropTypes } from '../MrlAvatar/MrlAvatar';\nimport { _isDisabled, _isSelected } from '../../button/helpers';\nimport { ToggleAria, buttonDefaults } from '../../button/constants';\nimport { setAttributes } from '../../../utils';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport styles from './MrlAvatarButton.module.scss';\n\nexport interface MrlAvatarButtonPropTypes\n\textends MrlAvatarPropTypes,\n\t\tReact.HTMLAttributes<HTMLButtonElement> {\n\t/**\n\t * An optional class name to add to button wrapping the MrlAvatar.\n\t */\n\tbuttonClassName?: string;\n\n\t/**\n\t * An optional boolean prop to include the button in roving tabindex\n\t */\n\tincludeInRoving?: boolean;\n\n\t/**\n\t * Selected state variant when the button is a Toggle Button. Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\tisToggleButton?: boolean;\n\n\t/**\n\t * An optional aria-label to apply to the button element\n\t */\n\tlabel?: string;\n\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\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.SyntheticEvent<HTMLButtonElement>) => void;\n\n\t/**\n\t * Changes the state of the button based on user permissions or actions.\n\t */\n\tstate?: MrlButtonState;\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\n\t/**\n\t * Tooltip configuration for the button\n\t */\n\ttooltip?: TooltipConfig;\n\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'workspace-member-avatar'). When omitted, the button emits no analytics.\n\t */\n\teventId?: string;\n\n\t/**\n\t * Reference to the DOM element that is the MrlAvatarButton\n\t */\n\ttriggerRef?: React.RefObject<HTMLButtonElement>;\n}\n\n/**\n * Renders an avatar button\n * @param {MrlAvatarButtonPropTypes} props the props for your MrlAvatarButton\n * @returns {React.ReactElement} an avatar button containing the props you pass\n */\nexport const MrlAvatarButton = ({\n\tbuttonClassName,\n\tdataQa,\n\tid,\n\tincludeInRoving,\n\tisToggleButton,\n\tlabel,\n\tloading = false,\n\tloadingText = 'Loading',\n\tonClick,\n\tsize,\n\tstate = 'default',\n\ttoggleAria = buttonDefaults.toggleAria,\n\ttooltip,\n\teventId,\n\ttriggerRef,\n\t...rest\n}: MrlAvatarButtonPropTypes): React.ReactElement => {\n\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(state));\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlAvatarButton', eventId);\n\n\t/**\n\t * We need to watch the value of state to keep in sync\n\t * the value of state passed as props and the internal\n\t * isSelected piece of state.\n\t */\n\tReact.useEffect(() => {\n\t\t// allows consumers to set the 'selected' or 'selected-disabled' state from a parent component.\n\t\tsetIsSelected(_isSelected(state));\n\t}, [state]);\n\n\tconst spinner = (\n\t\t<MrlSpinner\n\t\t\tclassName=\"mrlButton-spinner MrlAvatarButton-spinner\"\n\t\t\tkind=\"default\"\n\t\t\trole=\"none\"\n\t\t\tsize=\"small\"\n\t\t\ttext={loadingText}\n\t\t/>\n\t);\n\n\tconst attributes = setAttributes(\n\t\t{},\n\t\t{\n\t\t\t'aria-disabled': _isDisabled(state, loading),\n\t\t\t'aria-label': label,\n\t\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\t\t'data-roving': includeInRoving ? 'true' : undefined,\n\t\t\trole: 'button',\n\t\t\ttype: 'button'\n\t\t}\n\t);\n\n\t/**\n\t * Handle onClick events\n\t * @param {React.MouseEvent<HTMLButtonElement>} e - mouse event\n\t */\n\tfunction handleOnClick(e: React.MouseEvent<HTMLButtonElement>) {\n\t\te.stopPropagation();\n\n\t\tif (_isDisabled(state, loading)) {\n\t\t\treturn;\n\t\t}\n\n\t\ttrackInteraction({ action: 'click', variant: size });\n\n\t\tif (isToggleButton) {\n\t\t\tsetIsSelected((prevIsSelected) => !prevIsSelected);\n\t\t}\n\n\t\tif (onClick && typeof onClick === 'function') {\n\t\t\tonClick(e);\n\t\t}\n\t}\n\n\tconst buttonClasses = classNames('MrlAvatarButton', styles['MrlAvatarButton'], buttonClassName, {\n\t\t[styles['MrlAvatarButton--large']]: size && size === 'large'\n\t});\n\n\tconst renderAvatarButton = () => (\n\t\t<button\n\t\t\t{...attributes}\n\t\t\taria-label={tooltip && tooltip.text}\n\t\t\tclassName={buttonClasses}\n\t\t\tdata-qa={dataQa && `${dataQa}-button`}\n\t\t\tid={id}\n\t\t\tonClick={handleOnClick}\n\t\t\tref={triggerRef}\n\t\t>\n\t\t\t{loading ? spinner : <MrlAvatar dataQa={dataQa} size={size} {...rest} />}\n\t\t</button>\n\t);\n\n\treturn !tooltip ? (\n\t\trenderAvatarButton()\n\t) : (\n\t\t<MrlTooltip\n\t\t\tposition={tooltip.position || 'bottom'}\n\t\t\tanchor={tooltip.anchor || 'center'}\n\t\t\ttext={tooltip.text}\n\t\t\tdataQa={tooltip.dataQa}\n\t\t\tcustomRender={tooltip.customRender}\n\t\t>\n\t\t\t{renderAvatarButton()}\n\t\t</MrlTooltip>\n\t);\n};\n"],"names":["MrlAvatarButton","_ref","buttonClassName","dataQa","id","includeInRoving","isToggleButton","label","_ref$loading","loading","_ref$loadingText","loadingText","onClick","size","_ref$state","state","_ref$toggleAria","toggleAria","buttonDefaults","tooltip","eventId","triggerRef","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","trackInteraction","useMrlTrackInteraction","useEffect","spinner","createElement","MrlSpinner","className","kind","role","text","attributes","setAttributes","_objectSpread","_isDisabled","concat","undefined","type","handleOnClick","e","stopPropagation","action","variant","prevIsSelected","buttonClasses","classNames","styles","renderAvatarButton","_extends","ref","MrlAvatar","MrlTooltip","position","anchor","customRender"],"mappings":";;;;;;;;;;;;;AAoFA;AACA;AACA;AACA;AACA;AACO,IAAMA,eAAe,GAAGC,IAAA,IAiBqB;AAAA,EAAA,IAhBnDC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,EAAE,GAAAH,IAAA,CAAFG,EAAE;IACFC,eAAe,GAAAJ,IAAA,CAAfI,eAAe;IACfC,cAAc,GAAAL,IAAA,CAAdK,cAAc;IACdC,KAAK,GAAAN,IAAA,CAALM,KAAK;IAAAC,YAAA,GAAAP,IAAA,CACLQ,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,YAAA;IAAAE,gBAAA,GAAAT,IAAA,CACfU,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAA,MAAA,GAAG,SAAS,GAAAA,gBAAA;IACvBE,OAAO,GAAAX,IAAA,CAAPW,OAAO;IACPC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;IAAAC,UAAA,GAAAb,IAAA,CACJc,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,SAAS,GAAAA,UAAA;IAAAE,eAAA,GAAAf,IAAA,CACjBgB,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAA,MAAA,GAAGE,cAAc,CAACD,UAAU,GAAAD,eAAA;IACtCG,OAAO,GAAAlB,IAAA,CAAPkB,OAAO;IACPC,OAAO,GAAAnB,IAAA,CAAPmB,OAAO;IACPC,UAAU,GAAApB,IAAA,CAAVoB,UAAU;AACPC,IAAAA,IAAI,GAAAC,wBAAA,CAAAtB,IA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AAEA,MAAO;AAACU,IAAAA,IAAI,EAAEA;GAAK,EAAKS,IAAI,CAAG,CAChE,CACR;EAED,OAAO,CAACH,OAAO,GACdwC,kBAAkB,EAAE,gBAEpBjC,KAAA,CAAAW,aAAA,CAAC0B,UAAU,EAAA;AACVC,IAAAA,QAAQ,EAAE7C,OAAO,CAAC6C,QAAQ,IAAI,QAAS;AACvCC,IAAAA,MAAM,EAAE9C,OAAO,CAAC8C,MAAM,IAAI,QAAS;IACnCvB,IAAI,EAAEvB,OAAO,CAACuB,IAAK;IACnBvC,MAAM,EAAEgB,OAAO,CAAChB,MAAO;IACvB+D,YAAY,EAAE/C,OAAO,CAAC+C;GAAa,EAElCP,kBAAkB,EACR,CACZ;AACF;;;;"}
@@ -9,7 +9,7 @@ import { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics/useMrlAna
9
9
  import { setAttributes } from '../../../utils/setAttributes/setAttributes.js';
10
10
  import { MrlTooltip } from '../../tooltip/MrlTooltip/MrlTooltip.js';
11
11
 
12
- var _excluded = ["attrs", "badge", "disableEvents", "icon", "kind", "loading", "onClick", "position", "toggleAria", "toggleStyle", "text", "tipAnchor", "eventId", "size", "state"];
12
+ var _excluded = ["attrs", "badge", "disableEvents", "icon", "kind", "loading", "onClick", "position", "toggleAria", "toggleStyle", "text", "tipAnchor", "tooltipCustomRender", "eventId", "size", "state"];
13
13
  var MrlAnimatedIconButton = /*#__PURE__*/React.forwardRef(function MrlAnimatedIconButton(_ref, ref) {
14
14
  var _ref$attrs = _ref.attrs,
15
15
  attrs = _ref$attrs === void 0 ? {} : _ref$attrs,
@@ -30,6 +30,7 @@ var MrlAnimatedIconButton = /*#__PURE__*/React.forwardRef(function MrlAnimatedIc
30
30
  text = _ref.text,
31
31
  _ref$tipAnchor = _ref.tipAnchor,
32
32
  tipAnchor = _ref$tipAnchor === void 0 ? MrlTooltipDefaults.anchor : _ref$tipAnchor,
33
+ tooltipCustomRender = _ref.tooltipCustomRender,
33
34
  eventId = _ref.eventId,
34
35
  _ref$size = _ref.size,
35
36
  size = _ref$size === void 0 ? buttonDefaults.size : _ref$size,
@@ -184,7 +185,8 @@ var MrlAnimatedIconButton = /*#__PURE__*/React.forwardRef(function MrlAnimatedIc
184
185
  return /*#__PURE__*/React.createElement(MrlTooltip, {
185
186
  anchor: tipAnchor,
186
187
  position: position,
187
- text: text
188
+ text: text,
189
+ customRender: tooltipCustomRender
188
190
  }, /*#__PURE__*/React.createElement("button", _extends({}, attributes, remainingProps, {
189
191
  className: classNames,
190
192
  ref: buttonRef,