@muraldevkit/ui-toolkit 4.71.0 → 4.72.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 (73) hide show
  1. package/dist/cjs/components/button/MrlButton/MrlButton.js +8 -1
  2. package/dist/cjs/components/button/MrlButton/MrlButton.js.map +1 -1
  3. package/dist/cjs/components/button/MrlIconButton/MrlIconButton.js +1 -4
  4. package/dist/cjs/components/button/MrlIconButton/MrlIconButton.js.map +1 -1
  5. package/dist/cjs/components/table/MrlSmartTable/MrlSmartTable.js +0 -1
  6. package/dist/cjs/components/table/MrlSmartTable/MrlSmartTable.js.map +1 -1
  7. package/dist/cjs/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
  8. package/dist/cjs/components/tooltip/MrlTooltip/MrlTooltip.js +1 -4
  9. package/dist/cjs/components/tooltip/MrlTooltip/MrlTooltip.js.map +1 -1
  10. package/dist/cjs/components/tooltip/MrlTooltipContent/MrlTooltipContent.js +1 -3
  11. package/dist/cjs/components/tooltip/MrlTooltipContent/MrlTooltipContent.js.map +1 -1
  12. package/dist/cjs/components/tooltip/constants.js.map +1 -1
  13. package/dist/cjs/contexts/MrlAnalyticsContext/MrlAnalyticsContext.js +61 -0
  14. package/dist/cjs/contexts/MrlAnalyticsContext/MrlAnalyticsContext.js.map +1 -0
  15. package/dist/cjs/hooks/useMrlAnalytics/useMrlAnalytics.js +68 -0
  16. package/dist/cjs/hooks/useMrlAnalytics/useMrlAnalytics.js.map +1 -0
  17. package/dist/cjs/index.js +6 -0
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/version.js +6 -0
  20. package/dist/cjs/version.js.map +1 -0
  21. package/dist/components/button/MrlButton/MrlButton.d.ts +5 -0
  22. package/dist/components/button/MrlIconButton/MrlIconButton.d.ts +1 -3
  23. package/dist/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +0 -1
  24. package/dist/components/tooltip/MrlTooltip/MrlTooltip.d.ts +1 -3
  25. package/dist/components/tooltip/MrlTooltipContent/MrlTooltipContent.d.ts +1 -3
  26. package/dist/components/tooltip/constants.d.ts +0 -1
  27. package/dist/contexts/MrlAnalyticsContext/MrlAnalyticsContext.d.ts +25 -0
  28. package/dist/contexts/MrlAnalyticsContext/index.d.ts +2 -0
  29. package/dist/contexts/MrlAnalyticsContext/types.d.ts +22 -0
  30. package/dist/contexts/index.d.ts +1 -0
  31. package/dist/esm/components/button/MrlButton/MrlButton.js +8 -1
  32. package/dist/esm/components/button/MrlButton/MrlButton.js.map +1 -1
  33. package/dist/esm/components/button/MrlIconButton/MrlIconButton.js +1 -4
  34. package/dist/esm/components/button/MrlIconButton/MrlIconButton.js.map +1 -1
  35. package/dist/esm/components/table/MrlSmartTable/MrlSmartTable.js +0 -1
  36. package/dist/esm/components/table/MrlSmartTable/MrlSmartTable.js.map +1 -1
  37. package/dist/esm/components/toolbar/MrlToolbarButton/MrlToolbarButton.js.map +1 -1
  38. package/dist/esm/components/tooltip/MrlTooltip/MrlTooltip.js +1 -4
  39. package/dist/esm/components/tooltip/MrlTooltip/MrlTooltip.js.map +1 -1
  40. package/dist/esm/components/tooltip/MrlTooltipContent/MrlTooltipContent.js +1 -3
  41. package/dist/esm/components/tooltip/MrlTooltipContent/MrlTooltipContent.js.map +1 -1
  42. package/dist/esm/components/tooltip/constants.js.map +1 -1
  43. package/dist/esm/contexts/MrlAnalyticsContext/MrlAnalyticsContext.js +39 -0
  44. package/dist/esm/contexts/MrlAnalyticsContext/MrlAnalyticsContext.js.map +1 -0
  45. package/dist/esm/hooks/useMrlAnalytics/useMrlAnalytics.js +45 -0
  46. package/dist/esm/hooks/useMrlAnalytics/useMrlAnalytics.js.map +1 -0
  47. package/dist/esm/index.js +2 -0
  48. package/dist/esm/index.js.map +1 -1
  49. package/dist/esm/version.js +4 -0
  50. package/dist/esm/version.js.map +1 -0
  51. package/dist/hooks/index.d.ts +1 -0
  52. package/dist/hooks/useMrlAnalytics/index.d.ts +1 -0
  53. package/dist/hooks/useMrlAnalytics/useMrlAnalytics.d.ts +21 -0
  54. package/dist/hooks/useMrlAnalytics/useMrlAnalyticsDemo.d.ts +8 -0
  55. package/dist/styles/MrlTooltipContent/variables.scss +0 -4
  56. package/dist/styles.css +1 -1
  57. package/dist/types/components/button/MrlButton/MrlButton.d.ts +5 -0
  58. package/dist/types/components/button/MrlIconButton/MrlIconButton.d.ts +1 -3
  59. package/dist/types/components/toolbar/MrlToolbarButton/MrlToolbarButton.d.ts +0 -1
  60. package/dist/types/components/tooltip/MrlTooltip/MrlTooltip.d.ts +1 -3
  61. package/dist/types/components/tooltip/MrlTooltipContent/MrlTooltipContent.d.ts +1 -3
  62. package/dist/types/components/tooltip/constants.d.ts +0 -1
  63. package/dist/types/contexts/MrlAnalyticsContext/MrlAnalyticsContext.d.ts +25 -0
  64. package/dist/types/contexts/MrlAnalyticsContext/index.d.ts +2 -0
  65. package/dist/types/contexts/MrlAnalyticsContext/types.d.ts +22 -0
  66. package/dist/types/contexts/index.d.ts +1 -0
  67. package/dist/types/hooks/index.d.ts +1 -0
  68. package/dist/types/hooks/useMrlAnalytics/index.d.ts +1 -0
  69. package/dist/types/hooks/useMrlAnalytics/useMrlAnalytics.d.ts +21 -0
  70. package/dist/types/hooks/useMrlAnalytics/useMrlAnalyticsDemo.d.ts +8 -0
  71. package/dist/types/version.d.ts +1 -0
  72. package/dist/version.d.ts +1 -0
  73. package/package.json +2 -1
@@ -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\tMrlTooltipVariant\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';\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 kind of tooltip to be rendered */\n\tkind?: MrlTooltipVariant;\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\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\tkind = 'default',\n\t\tposition = MrlTooltipDefaults.position || 'top',\n\t\tanchor = MrlTooltipDefaults.anchor,\n\t\tsrAnnouncement = true,\n\t\ttooltipClass,\n\t\ttooltipContentClass,\n\t\t...rest\n\t} = props;\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 * 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\tkind={kind}\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$kind","kind","_props$position","position","MrlTooltipDefaults","_props$anchor","anchor","_props$srAnnouncement","srAnnouncement","tooltipClass","tooltipContentClass","rest","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","interaction","setInteraction","triggerRef","useRef","tooltipRef","_React$useState3","_React$useState4","setDisplay","_React$useState5","_React$useState6","id","setId","handleShowTooltip","useCallback","handleFocus","handleHideTooltip","handleKeyDown","e","key","handleSetKeyboardInteraction","handlesetMouseInteraction","useEffect","getUniqueId","trigger","document","querySelector","concat","current","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA;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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EAAEA;AAAoB,GAAA,CACzC,CACY,CAEjB,CACU,CACV,CAAC;AAEL,CAAC;AAED1B,UAAU,CAACkH,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';\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\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\t...rest\n\t} = props;\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 * 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","rest","_objectWithoutProperties","_excluded","_React$useState","useState","_React$useState2","_slicedToArray","interaction","setInteraction","triggerRef","useRef","tooltipRef","_React$useState3","_React$useState4","setDisplay","_React$useState5","_React$useState6","id","setId","handleShowTooltip","useCallback","handleFocus","handleHideTooltip","handleKeyDown","e","key","handleSetKeyboardInteraction","handlesetMouseInteraction","useEffect","getUniqueId","trigger","document","querySelector","concat","current","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,gBAAK,CAACC,IAAI,CAAEC,KAAsB,IAAyB;AACpF,EAAA,IACCC,QAAQ,GAaLD,KAAK,CAbRC,QAAQ;IAAAC,mBAAA,GAaLF,KAAK,CAZRG,YAAY;AAAZA,IAAAA,YAAY,GAAAD,mBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,mBAAA;IAAAE,qBAAA,GAYhBJ,KAAK,CAXRK,mBAAm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A,MAAO;AACfL,IAAAA,MAAM,EAAEA,MAAO;AACf2B,IAAAA,EAAE,EAAEA,EAAG;AACPzB,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,CAACgH,WAAW,GAAG,YAAY;;;;"}
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
29
29
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
30
  var classnames__default = /*#__PURE__*/_interopDefault(classnames);
31
31
 
32
- var _excluded = ["anchor", "attrs", "dataQa", "id", "kind", "position", "text", "tooltipContentClass", "customRender"];
32
+ var _excluded = ["anchor", "attrs", "dataQa", "id", "position", "text", "tooltipContentClass", "customRender"];
33
33
  /**
34
34
  * MrlTooltipContent Component
35
35
  *
@@ -43,7 +43,6 @@ var MrlTooltipContent = props => {
43
43
  attrs = props.attrs,
44
44
  dataQa = props.dataQa,
45
45
  id = props.id,
46
- kind = props.kind,
47
46
  position = props.position,
48
47
  text = props.text,
49
48
  tooltipContentClass = props.tooltipContentClass,
@@ -54,7 +53,6 @@ var MrlTooltipContent = props => {
54
53
  var tooltipClasses = classnames__default.default('mrl-tooltip-content', {
55
54
  ["".concat(classes)]: classes !== undefined,
56
55
  'has-custom-render': typeof customRender === 'function',
57
- 'mrl-tooltip-content--inverse': kind === 'inverse',
58
56
  ["".concat(tooltipContentClass)]: tooltipContentClass !== undefined
59
57
  });
60
58
  return /*#__PURE__*/React__namespace.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
@@ -1 +1 @@
1
- {"version":3,"file":"MrlTooltipContent.js","sources":["../../../../../src/components/tooltip/MrlTooltipContent/MrlTooltipContent.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, setAttributes, setClasses } from '../../../utils';\nimport {\n\tMrlTooltipAnchor,\n\tMrlTooltipDefaults,\n\tMrlTooltipPosition,\n\tMrlTooltipVariant\n} from '../constants';\nimport './MrlTooltipContent.global.scss';\n\ninterface MrlTooltipContentProps {\n\t/**\n\t * The arrow position of the tooltip in relation to its trigger's content.\n\t * Note, if the content is shorter than the width of the trigger, always use\n\t * \"center\" to ensure the arrow does not become misaligned.\n\t */\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/** dataQa attribute for tooltip */\n\tdataQa?: string;\n\n\t/** The kind of tooltip to be rendered */\n\tkind: MrlTooltipVariant;\n\n\t/** The id of the tooltip used for aria-describedby in the parent component */\n\tid?: string;\n\n\t/** The placement of the tooltip in relation to its trigger */\n\tposition: MrlTooltipPosition;\n\n\t/** The tooltip content to display */\n\ttext: 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\n/**\n * MrlTooltipContent Component\n *\n * The tooltip content is the text that is displayed when the user hovers over the trigger.\n * IMPORTANT: This component is not intended to be used directly, it should always be a child of MrlTooltip.\n * @param {MrlTooltipContentProps} props - the props of the tooltip content\n * @returns {HTMLElement} a configured Tooltip Content component\n */\nexport const MrlTooltipContent = (props: MrlTooltipContentProps): React.ReactElement => {\n\tconst {\n\t\tanchor,\n\t\tattrs,\n\t\tdataQa,\n\t\tid,\n\t\tkind,\n\t\tposition,\n\t\ttext,\n\t\ttooltipContentClass,\n\t\tcustomRender,\n\t\t...rest\n\t} = props;\n\n\tconst attributes = setAttributes(attrs, MrlTooltipDefaults.attrs);\n\tconst classes = setClasses(attrs, {});\n\tconst tooltipClasses = classnames('mrl-tooltip-content', {\n\t\t[`${classes}`]: classes !== undefined,\n\t\t'has-custom-render': typeof customRender === 'function',\n\t\t'mrl-tooltip-content--inverse': kind === 'inverse',\n\t\t[`${tooltipContentClass}`]: tooltipContentClass !== undefined\n\t});\n\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-anchor={anchor}\n\t\t\tdata-position={position}\n\t\t\tdata-qa={dataQa}\n\t\t\tid={id}\n\t\t\trole=\"tooltip\"\n\t\t\t{...attributes}\n\t\t\tclassName={tooltipClasses}\n\t\t>\n\t\t\t{customRender && typeof customRender === 'function' ? customRender(text) : text}\n\t\t\t<div className=\"mrl-tooltip-content__hover\" />\n\t\t</div>\n\t);\n};\n"],"names":["MrlTooltipContent","props","anchor","attrs","dataQa","id","kind","position","text","tooltipContentClass","customRender","rest","_objectWithoutProperties","_excluded","attributes","setAttributes","MrlTooltipDefaults","classes","setClasses","tooltipClasses","classnames","concat","undefined","React","createElement","_extends","role","className"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,iBAAiB,GAAIC,KAA6B,IAAyB;AACvF,EAAA,IACCC,MAAM,GAUHD,KAAK,CAVRC,MAAM;IACNC,KAAK,GASFF,KAAK,CATRE,KAAK;IACLC,MAAM,GAQHH,KAAK,CARRG,MAAM;IACNC,EAAE,GAOCJ,KAAK,CAPRI,EAAE;IACFC,IAAI,GAMDL,KAAK,CANRK,IAAI;IACJC,QAAQ,GAKLN,KAAK,CALRM,QAAQ;IACRC,IAAI,GAIDP,KAAK,CAJRO,IAAI;IACJC,mBAAmB,GAGhBR,KAAK,CAHRQ,mBAAmB;IACnBC,YAAY,GAETT,KAAK,CAFRS,YAAY;AACTC,IAAAA,IAAI,GAAAC,iDAAA,CACJX,KAAK,EAAAY,SAAA,CAAA;EAET,IAAMC,UAAU,GAAGC,2BAAa,CAACZ,KAAK,EAAEa,4BAAkB,CAACb,KAAK,CAAC;EACjE,IAAMc,OAAO,GAAGC,wBAAU,CAACf,KAAK,EAAE,EAAE,CAAC;AACrC,EAAA,IAAMgB,cAAc,GAAGC,2BAAU,CAAC,qBAAqB,EAAE;AACxD,IAAA,CAAA,EAAA,CAAAC,MAAA,CAAIJ,OAAO,CAAA,GAAKA,OAAO,KAAKK,SAAS;AACrC,IAAA,mBAAmB,EAAE,OAAOZ,YAAY,KAAK,UAAU;IACvD,8BAA8B,EAAEJ,IAAI,KAAK,SAAS;AAClD,IAAA,CAAA,EAAA,CAAAe,MAAA,CAAIZ,mBAAmB,CAAA,GAAKA,mBAAmB,KAAKa;AACrD,GAAC,CAAC;AAEF,EAAA,oBACCC,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,iCAAA,KACKd,IAAI,EAAA;AACR,IAAA,aAAA,EAAaT,MAAO;AACpB,IAAA,eAAA,EAAeK,QAAS;AACxB,IAAA,SAAA,EAASH,MAAO;AAChBC,IAAAA,EAAE,EAAEA,EAAG;AACPqB,IAAAA,IAAI,EAAC;AAAS,GAAA,EACVZ,UAAU,EAAA;AACda,IAAAA,SAAS,EAAER;AAAe,GAAA,CAAA,EAEzBT,YAAY,IAAI,OAAOA,YAAY,KAAK,UAAU,GAAGA,YAAY,CAACF,IAAI,CAAC,GAAGA,IAAI,eAC/Ee,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKG,IAAAA,SAAS,EAAC;AAA4B,GAAE,CACzC,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlTooltipContent.js","sources":["../../../../../src/components/tooltip/MrlTooltipContent/MrlTooltipContent.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { AttrsObject, setAttributes, setClasses } from '../../../utils';\nimport { MrlTooltipAnchor, MrlTooltipDefaults, MrlTooltipPosition } from '../constants';\nimport './MrlTooltipContent.global.scss';\n\ninterface MrlTooltipContentProps {\n\t/**\n\t * The arrow position of the tooltip in relation to its trigger's content.\n\t * Note, if the content is shorter than the width of the trigger, always use\n\t * \"center\" to ensure the arrow does not become misaligned.\n\t */\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/** dataQa attribute for tooltip */\n\tdataQa?: string;\n\n\t/** The id of the tooltip used for aria-describedby in the parent component */\n\tid?: string;\n\n\t/** The placement of the tooltip in relation to its trigger */\n\tposition: MrlTooltipPosition;\n\n\t/** The tooltip content to display */\n\ttext: 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\n/**\n * MrlTooltipContent Component\n *\n * The tooltip content is the text that is displayed when the user hovers over the trigger.\n * IMPORTANT: This component is not intended to be used directly, it should always be a child of MrlTooltip.\n * @param {MrlTooltipContentProps} props - the props of the tooltip content\n * @returns {HTMLElement} a configured Tooltip Content component\n */\nexport const MrlTooltipContent = (props: MrlTooltipContentProps): React.ReactElement => {\n\tconst { anchor, attrs, dataQa, id, position, text, tooltipContentClass, customRender, ...rest } =\n\t\tprops;\n\n\tconst attributes = setAttributes(attrs, MrlTooltipDefaults.attrs);\n\tconst classes = setClasses(attrs, {});\n\tconst tooltipClasses = classnames('mrl-tooltip-content', {\n\t\t[`${classes}`]: classes !== undefined,\n\t\t'has-custom-render': typeof customRender === 'function',\n\t\t[`${tooltipContentClass}`]: tooltipContentClass !== undefined\n\t});\n\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-anchor={anchor}\n\t\t\tdata-position={position}\n\t\t\tdata-qa={dataQa}\n\t\t\tid={id}\n\t\t\trole=\"tooltip\"\n\t\t\t{...attributes}\n\t\t\tclassName={tooltipClasses}\n\t\t>\n\t\t\t{customRender && typeof customRender === 'function' ? customRender(text) : text}\n\t\t\t<div className=\"mrl-tooltip-content__hover\" />\n\t\t</div>\n\t);\n};\n"],"names":["MrlTooltipContent","props","anchor","attrs","dataQa","id","position","text","tooltipContentClass","customRender","rest","_objectWithoutProperties","_excluded","attributes","setAttributes","MrlTooltipDefaults","classes","setClasses","tooltipClasses","classnames","concat","undefined","React","createElement","_extends","role","className"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,iBAAiB,GAAIC,KAA6B,IAAyB;AACvF,EAAA,IAAQC,MAAM,GACbD,KAAK,CADEC,MAAM;IAAEC,KAAK,GACpBF,KAAK,CADUE,KAAK;IAAEC,MAAM,GAC5BH,KAAK,CADiBG,MAAM;IAAEC,EAAE,GAChCJ,KAAK,CADyBI,EAAE;IAAEC,QAAQ,GAC1CL,KAAK,CAD6BK,QAAQ;IAAEC,IAAI,GAChDN,KAAK,CADuCM,IAAI;IAAEC,mBAAmB,GACrEP,KAAK,CAD6CO,mBAAmB;IAAEC,YAAY,GACnFR,KAAK,CADkEQ,YAAY;AAAKC,IAAAA,IAAI,GAAAC,iDAAA,CAC5FV,KAAK,EAAAW,SAAA,CAAA;EAEN,IAAMC,UAAU,GAAGC,2BAAa,CAACX,KAAK,EAAEY,4BAAkB,CAACZ,KAAK,CAAC;EACjE,IAAMa,OAAO,GAAGC,wBAAU,CAACd,KAAK,EAAE,EAAE,CAAC;AACrC,EAAA,IAAMe,cAAc,GAAGC,2BAAU,CAAC,qBAAqB,EAAE;AACxD,IAAA,CAAA,EAAA,CAAAC,MAAA,CAAIJ,OAAO,CAAA,GAAKA,OAAO,KAAKK,SAAS;AACrC,IAAA,mBAAmB,EAAE,OAAOZ,YAAY,KAAK,UAAU;AACvD,IAAA,CAAA,EAAA,CAAAW,MAAA,CAAIZ,mBAAmB,CAAA,GAAKA,mBAAmB,KAAKa;AACrD,GAAC,CAAC;AAEF,EAAA,oBACCC,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,iCAAA,KACKd,IAAI,EAAA;AACR,IAAA,aAAA,EAAaR,MAAO;AACpB,IAAA,eAAA,EAAeI,QAAS;AACxB,IAAA,SAAA,EAASF,MAAO;AAChBC,IAAAA,EAAE,EAAEA,EAAG;AACPoB,IAAAA,IAAI,EAAC;AAAS,GAAA,EACVZ,UAAU,EAAA;AACda,IAAAA,SAAS,EAAER;AAAe,GAAA,CAAA,EAEzBT,YAAY,IAAI,OAAOA,YAAY,KAAK,UAAU,GAAGA,YAAY,CAACF,IAAI,CAAC,GAAGA,IAAI,eAC/Ee,gBAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKG,IAAAA,SAAS,EAAC;AAA4B,GAAE,CACzC,CAAC;AAER;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/components/tooltip/constants.ts"],"sourcesContent":["import { AttrsObject } from '../../utils';\n\n/**\n * Defines all the values allowed for tooltip props.\n * Used for Storybook and testing\n */\nexport const allowedMrlTooltipValues = {\n\tanchors: ['start', 'center', 'end'] as const,\n\tpositions: ['top', 'bottom', 'left', 'right'] as const,\n\tstate: ['show', 'hide'] as const\n};\n\nexport type MrlTooltipPosition = (typeof allowedMrlTooltipValues.positions)[number];\nexport type MrlTooltipAnchor = (typeof allowedMrlTooltipValues.anchors)[number];\nexport type MrlTooltipState = (typeof allowedMrlTooltipValues.state)[number];\n\nexport interface MrlTooltipDefaults {\n\tanchor: MrlTooltipAnchor;\n\tattrs: AttrsObject;\n\tposition: MrlTooltipPosition;\n\tstate: MrlTooltipState;\n}\n\n/**\n * Default values for props on the Tooltip component;\n * Shared between the component and Storybook\n */\nexport const MrlTooltipDefaults: MrlTooltipDefaults = {\n\tanchor: 'center',\n\tattrs: {},\n\tposition: 'right',\n\tstate: 'hide'\n};\n\nexport type MrlTooltipVariant = 'default' | 'inverse';\n\nexport type TooltipAlignment = 'start' | 'end' | 'center';\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';\n"],"names":["allowedMrlTooltipValues","anchors","positions","state","MrlTooltipDefaults","anchor","attrs","position"],"mappings":";;AAEA;AACA;AACA;AACA;AACO,IAAMA,uBAAuB,GAAG;AACtCC,EAAAA,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAU;EAC5CC,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU;AACtDC,EAAAA,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM;AACvB;AAaA;AACA;AACA;AACA;AACO,IAAMC,kBAAsC,GAAG;AACrDC,EAAAA,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,EAAE;AACTC,EAAAA,QAAQ,EAAE,OAAO;AACjBJ,EAAAA,KAAK,EAAE;AACR;;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/tooltip/constants.ts"],"sourcesContent":["import { AttrsObject } from '../../utils';\n\n/**\n * Defines all the values allowed for tooltip props.\n * Used for Storybook and testing\n */\nexport const allowedMrlTooltipValues = {\n\tanchors: ['start', 'center', 'end'] as const,\n\tpositions: ['top', 'bottom', 'left', 'right'] as const,\n\tstate: ['show', 'hide'] as const\n};\n\nexport type MrlTooltipPosition = (typeof allowedMrlTooltipValues.positions)[number];\nexport type MrlTooltipAnchor = (typeof allowedMrlTooltipValues.anchors)[number];\nexport type MrlTooltipState = (typeof allowedMrlTooltipValues.state)[number];\n\nexport interface MrlTooltipDefaults {\n\tanchor: MrlTooltipAnchor;\n\tattrs: AttrsObject;\n\tposition: MrlTooltipPosition;\n\tstate: MrlTooltipState;\n}\n\n/**\n * Default values for props on the Tooltip component;\n * Shared between the component and Storybook\n */\nexport const MrlTooltipDefaults: MrlTooltipDefaults = {\n\tanchor: 'center',\n\tattrs: {},\n\tposition: 'right',\n\tstate: 'hide'\n};\n\nexport type TooltipAlignment = 'start' | 'end' | 'center';\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';\n"],"names":["allowedMrlTooltipValues","anchors","positions","state","MrlTooltipDefaults","anchor","attrs","position"],"mappings":";;AAEA;AACA;AACA;AACA;AACO,IAAMA,uBAAuB,GAAG;AACtCC,EAAAA,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAU;EAC5CC,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU;AACtDC,EAAAA,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM;AACvB;AAaA;AACA;AACA;AACA;AACO,IAAMC,kBAAsC,GAAG;AACrDC,EAAAA,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,EAAE;AACTC,EAAAA,QAAQ,EAAE,OAAO;AACjBJ,EAAAA,KAAK,EAAE;AACR;;;;;"}
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var index = require('../../utils/noop/index.js');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
25
+
26
+ /** Default is a no-op: components emit nothing until a consumer provides `track`. */
27
+ var initialContext = {
28
+ track: index.noop
29
+ };
30
+ var MrlAnalyticsContext = /*#__PURE__*/React.createContext(initialContext);
31
+ /**
32
+ * Injects the app's analytics transport into the toolkit. Wrap the app once;
33
+ * every instrumented Mrl* component below emits through the provided `track`.
34
+ *
35
+ * @param props - the provider props
36
+ * @param props.track - the transport that receives each MrlAnalyticsEvent (default no-op)
37
+ * @param props.children - the subtree that can emit analytics
38
+ * @returns the provider wrapping `children`
39
+ */
40
+ var MrlAnalyticsProvider = _ref => {
41
+ var track = _ref.track,
42
+ children = _ref.children;
43
+ // Latest-ref pattern: the app's transport lives in a ref, so a new `track`
44
+ // identity never invalidates the context value.
45
+ var trackRef = React__namespace.useRef(track !== null && track !== void 0 ? track : index.noop);
46
+ React__namespace.useLayoutEffect(() => {
47
+ trackRef.current = track !== null && track !== void 0 ? track : index.noop;
48
+ });
49
+
50
+ // Created once; identity never changes regardless of what the app passes.
51
+ var value = React__namespace.useMemo(() => ({
52
+ track: event => trackRef.current(event)
53
+ }), []);
54
+ return /*#__PURE__*/React__namespace.createElement(MrlAnalyticsContext.Provider, {
55
+ value: value
56
+ }, children);
57
+ };
58
+
59
+ exports.MrlAnalyticsContext = MrlAnalyticsContext;
60
+ exports.MrlAnalyticsProvider = MrlAnalyticsProvider;
61
+ //# sourceMappingURL=MrlAnalyticsContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MrlAnalyticsContext.js","sources":["../../../../src/contexts/MrlAnalyticsContext/MrlAnalyticsContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createContext } from 'react';\nimport { noop } from '../../utils';\nimport { MrlTrack } from './types';\n\nexport interface MrlAnalyticsContextProps {\n\ttrack: MrlTrack;\n}\n\n/** Default is a no-op: components emit nothing until a consumer provides `track`. */\nconst initialContext: MrlAnalyticsContextProps = {\n\ttrack: noop\n};\n\nexport const MrlAnalyticsContext = createContext<MrlAnalyticsContextProps>(initialContext);\n\nexport interface MrlAnalyticsProviderProps {\n\t/**\n\t * The transport the app injects. Receives a MrlAnalyticsEvent and forwards it\n\t * wherever the app tracks (in murally: a wrapper over trackWithSegment).\n\t * Omit it and the toolkit stays silent — safe for consumers with no analytics.\n\t */\n\ttrack?: MrlTrack;\n\tchildren: React.ReactNode;\n}\n\n/**\n * Injects the app's analytics transport into the toolkit. Wrap the app once;\n * every instrumented Mrl* component below emits through the provided `track`.\n *\n * @param props - the provider props\n * @param props.track - the transport that receives each MrlAnalyticsEvent (default no-op)\n * @param props.children - the subtree that can emit analytics\n * @returns the provider wrapping `children`\n */\nexport const MrlAnalyticsProvider = ({ track, children }: MrlAnalyticsProviderProps) => {\n\t// Latest-ref pattern: the app's transport lives in a ref, so a new `track`\n\t// identity never invalidates the context value.\n\tconst trackRef = React.useRef<MrlTrack>(track ?? noop);\n\n\tReact.useLayoutEffect(() => {\n\t\ttrackRef.current = track ?? noop;\n\t});\n\n\t// Created once; identity never changes regardless of what the app passes.\n\tconst value = React.useMemo<MrlAnalyticsContextProps>(\n\t\t() => ({ track: (event) => trackRef.current(event) }),\n\t\t[]\n\t);\n\n\treturn <MrlAnalyticsContext.Provider value={value}>{children}</MrlAnalyticsContext.Provider>;\n};\n"],"names":["initialContext","track","noop","MrlAnalyticsContext","createContext","MrlAnalyticsProvider","_ref","children","trackRef","React","useRef","useLayoutEffect","current","value","useMemo","event","createElement","Provider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA;AACA,IAAMA,cAAwC,GAAG;AAChDC,EAAAA,KAAK,EAAEC;AACR,CAAC;IAEYC,mBAAmB,gBAAGC,mBAAa,CAA2BJ,cAAc;AAYzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMK,oBAAoB,GAAGC,IAAA,IAAoD;AAAA,EAAA,IAAjDL,KAAK,GAAAK,IAAA,CAALL,KAAK;IAAEM,QAAQ,GAAAD,IAAA,CAARC,QAAQ;AACrD;AACA;AACA,EAAA,IAAMC,QAAQ,GAAGC,gBAAK,CAACC,MAAM,CAAWT,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,GAALA,KAAK,GAAIC,UAAI,CAAC;EAEtDO,gBAAK,CAACE,eAAe,CAAC,MAAM;IAC3BH,QAAQ,CAACI,OAAO,GAAGX,KAAK,aAALA,KAAK,KAAA,MAAA,GAALA,KAAK,GAAIC,UAAI;AACjC,EAAA,CAAC,CAAC;;AAEF;AACA,EAAA,IAAMW,KAAK,GAAGJ,gBAAK,CAACK,OAAO,CAC1B,OAAO;AAAEb,IAAAA,KAAK,EAAGc,KAAK,IAAKP,QAAQ,CAACI,OAAO,CAACG,KAAK;GAAG,CAAC,EACrD,EACD,CAAC;AAED,EAAA,oBAAON,gBAAA,CAAAO,aAAA,CAACb,mBAAmB,CAACc,QAAQ,EAAA;AAACJ,IAAAA,KAAK,EAAEA;AAAM,GAAA,EAAEN,QAAuC,CAAC;AAC7F;;;;;"}
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var version = require('../../version.js');
5
+ var MrlAnalyticsContext = require('../../contexts/MrlAnalyticsContext/MrlAnalyticsContext.js');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
+
27
+ /**
28
+ * Raw accessor for the analytics context.
29
+ *
30
+ * @returns the injected `track` transport (default no-op)
31
+ */
32
+ var useMrlAnalytics = () => React__namespace.useContext(MrlAnalyticsContext.MrlAnalyticsContext);
33
+ /**
34
+ * Component-facing helper. Binds component identity + trackingId once, then
35
+ * `emit({ action })` per interaction. No-ops entirely when trackingId is absent,
36
+ * so instrumentation is opt-in and attributable.
37
+ *
38
+ * @param component - the emitting component's name, e.g. 'MrlButton'
39
+ * @param trackingId - consumer-supplied, non-PII id; undefined disables emission
40
+ * @returns an `emit` callback that fires a single interaction per call
41
+ */
42
+ var useMrlTrackInteraction = (component, trackingId) => {
43
+ var _useMrlAnalytics = useMrlAnalytics(),
44
+ track = _useMrlAnalytics.track;
45
+ return React__namespace.useCallback(_ref => {
46
+ var action = _ref.action,
47
+ variant = _ref.variant,
48
+ metadata = _ref.metadata;
49
+ // opt-in: no id → no event (volume + PII guard)
50
+ if (!trackingId) return;
51
+ try {
52
+ track({
53
+ action,
54
+ component,
55
+ metadata,
56
+ toolkitVersion: version.TOOLKIT_VERSION,
57
+ trackingId,
58
+ variant
59
+ });
60
+ } catch (e) {
61
+ return;
62
+ }
63
+ }, [track, component, trackingId]);
64
+ };
65
+
66
+ exports.useMrlAnalytics = useMrlAnalytics;
67
+ exports.useMrlTrackInteraction = useMrlTrackInteraction;
68
+ //# sourceMappingURL=useMrlAnalytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMrlAnalytics.js","sources":["../../../../src/hooks/useMrlAnalytics/useMrlAnalytics.ts"],"sourcesContent":["import * as React from 'react';\nimport { MrlAnalyticsContext } from '../../contexts/MrlAnalyticsContext';\nimport { MrlAnalyticsEvent, MrlTrack } from '../../contexts/MrlAnalyticsContext/types';\nimport { TOOLKIT_VERSION } from '../../version';\n\n/**\n * Raw accessor for the analytics context.\n *\n * @returns the injected `track` transport (default no-op)\n */\nexport const useMrlAnalytics = (): { track: MrlTrack } => React.useContext(MrlAnalyticsContext);\n\ntype EmitArgs = Pick<MrlAnalyticsEvent, 'action' | 'variant' | 'metadata'>;\n\n/**\n * Component-facing helper. Binds component identity + trackingId once, then\n * `emit({ action })` per interaction. No-ops entirely when trackingId is absent,\n * so instrumentation is opt-in and attributable.\n *\n * @param component - the emitting component's name, e.g. 'MrlButton'\n * @param trackingId - consumer-supplied, non-PII id; undefined disables emission\n * @returns an `emit` callback that fires a single interaction per call\n */\nexport const useMrlTrackInteraction = (component: string, trackingId?: string) => {\n\tconst { track } = useMrlAnalytics();\n\n\treturn React.useCallback(\n\t\t({ action, variant, metadata }: EmitArgs) => {\n\t\t\t// opt-in: no id → no event (volume + PII guard)\n\t\t\tif (!trackingId) return;\n\t\t\ttry {\n\t\t\t\ttrack({\n\t\t\t\t\taction,\n\t\t\t\t\tcomponent,\n\t\t\t\t\tmetadata,\n\t\t\t\t\ttoolkitVersion: TOOLKIT_VERSION,\n\t\t\t\t\ttrackingId,\n\t\t\t\t\tvariant\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t},\n\t\t[track, component, trackingId]\n\t);\n};\n"],"names":["useMrlAnalytics","React","useContext","MrlAnalyticsContext","useMrlTrackInteraction","component","trackingId","_useMrlAnalytics","track","useCallback","_ref","action","variant","metadata","toolkitVersion","TOOLKIT_VERSION","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACO,IAAMA,eAAe,GAAGA,MAA2BC,gBAAK,CAACC,UAAU,CAACC,uCAAmB;AAI9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACaC,sBAAsB,GAAGA,CAACC,SAAiB,EAAEC,UAAmB,KAAK;AACjF,EAAA,IAAAC,gBAAA,GAAkBP,eAAe,EAAE;IAA3BQ,KAAK,GAAAD,gBAAA,CAALC,KAAK;AAEb,EAAA,OAAOP,gBAAK,CAACQ,WAAW,CACvBC,IAAA,IAA6C;AAAA,IAAA,IAA1CC,MAAM,GAAAD,IAAA,CAANC,MAAM;MAAEC,OAAO,GAAAF,IAAA,CAAPE,OAAO;MAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;AAC3B;IACA,IAAI,CAACP,UAAU,EAAE;IACjB,IAAI;AACHE,MAAAA,KAAK,CAAC;QACLG,MAAM;QACNN,SAAS;QACTQ,QAAQ;AACRC,QAAAA,cAAc,EAAEC,uBAAe;QAC/BT,UAAU;AACVM,QAAAA;AACD,OAAC,CAAC;IACH,CAAC,CAAC,OAAOI,CAAC,EAAE;AACX,MAAA;AACD,IAAA;EACD,CAAC,EACD,CAACR,KAAK,EAAEH,SAAS,EAAEC,UAAU,CAC9B,CAAC;AACF;;;;;"}
package/dist/cjs/index.js CHANGED
@@ -7,6 +7,7 @@ var MrlPortal = require('./components/portal/MrlPortal.js');
7
7
  var actions = require('./components/button/MrlProcessingButton/actions.js');
8
8
  var MrlMultiCreatableSelect = require('./components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.js');
9
9
  var MrlMultiSelect = require('./components/form/select/MrlMultiSelect/MrlMultiSelect.js');
10
+ var MrlAnalyticsContext = require('./contexts/MrlAnalyticsContext/MrlAnalyticsContext.js');
10
11
  var MrlAnimatedIconButton = require('./components/button/MrlAnimatedIconButton/MrlAnimatedIconButton.js');
11
12
  var MrlAvatar = require('./components/avatar/MrlAvatar/MrlAvatar.js');
12
13
  var MrlAvatarButton = require('./components/avatar/MrlAvatarButton/MrlAvatarButton.js');
@@ -143,6 +144,7 @@ var index$8 = require('./hooks/useBreakpoint/index.js');
143
144
  var index$9 = require('./hooks/useCoordinate/index.js');
144
145
  var index$a = require('./hooks/useElementDimensions/index.js');
145
146
  var index$b = require('./hooks/useHasFocusableDescendant/index.js');
147
+ var useMrlAnalytics = require('./hooks/useMrlAnalytics/useMrlAnalytics.js');
146
148
  var index$c = require('./hooks/useScrollbarInfo/index.js');
147
149
 
148
150
 
@@ -167,6 +169,8 @@ exports.MrlMultiCreatableSelect = MrlMultiCreatableSelect.MrlMultiCreatableSelec
167
169
  exports.MULTI_SELECT_CLASS_NAME_PREFIX = MrlMultiSelect.MULTI_SELECT_CLASS_NAME_PREFIX;
168
170
  exports.MULTI_SELECT_MENU_LIST_CLASS_NAME = MrlMultiSelect.MULTI_SELECT_MENU_LIST_CLASS_NAME;
169
171
  exports.MrlMultiSelect = MrlMultiSelect.MrlMultiSelect;
172
+ exports.MrlAnalyticsContext = MrlAnalyticsContext.MrlAnalyticsContext;
173
+ exports.MrlAnalyticsProvider = MrlAnalyticsContext.MrlAnalyticsProvider;
170
174
  exports.MrlAnimatedIconButton = MrlAnimatedIconButton.MrlAnimatedIconButton;
171
175
  exports.MrlAvatar = MrlAvatar.MrlAvatar;
172
176
  exports.defaultAvatarValues = MrlAvatar.defaultAvatarValues;
@@ -331,5 +335,7 @@ exports.useBreakpoint = index$8.useBreakpoint;
331
335
  exports.useCoordinate = index$9.useCoordinate;
332
336
  exports.useElementDimensions = index$a.useElementDimensions;
333
337
  exports.useHasFocusableDescendant = index$b.useHasFocusableDescendant;
338
+ exports.useMrlAnalytics = useMrlAnalytics.useMrlAnalytics;
339
+ exports.useMrlTrackInteraction = useMrlAnalytics.useMrlTrackInteraction;
334
340
  exports.useScrollbarInfo = index$c.useScrollbarInfo;
335
341
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var TOOLKIT_VERSION = "4.72.0";
4
+
5
+ exports.TOOLKIT_VERSION = TOOLKIT_VERSION;
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["export const TOOLKIT_VERSION = \"4.72.0\";"],"names":["TOOLKIT_VERSION"],"mappings":";;AAAO,IAAMA,eAAe,GAAG;;;;"}
@@ -81,6 +81,11 @@ export interface MrlButtonProps extends Omit<MrlComponentProps, 'style'>, React.
81
81
  * Icon buttons require a text label to ensure accessibility.
82
82
  */
83
83
  text: string;
84
+ /**
85
+ * Enables interaction tracking for this button. Provide a stable, non-PII id
86
+ * (e.g. 'board-share-cta'). When omitted, the button emits no analytics.
87
+ */
88
+ trackingId?: string;
84
89
  /**
85
90
  * Determines which aria setup to use for various toggle/selected styles.
86
91
  * pressed - use for an traditional “toggle button”
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { MrlButtonKind, MrlButtonSize, MrlGhostIconButtonSize, ToggleAria } from '../constants';
3
3
  import { AttrsObject, MrlComponentProps } from '../../../utils';
4
- import { MrlTooltipAnchor, MrlTooltipPosition, MrlTooltipVariant } from '../../tooltip/constants';
4
+ import { MrlTooltipAnchor, MrlTooltipPosition } from '../../tooltip/constants';
5
5
  import { MrlButtonState, ToggleStyle } from '../../';
6
6
  import './MrlIconButton.scss';
7
7
  export interface MrlIconButtonProps extends Omit<MrlComponentProps, 'style'>, React.ComponentProps<'button'> {
@@ -96,8 +96,6 @@ export interface MrlIconButtonProps extends Omit<MrlComponentProps, 'style'>, Re
96
96
  * informs the component that this is a toggle button and to add that functionality
97
97
  */
98
98
  toggleStyle?: ToggleStyle;
99
- /** tooltip varient kind */
100
- tooltipKind?: MrlTooltipVariant;
101
99
  /**
102
100
  * An optional class name to add to the tooltip wrapper.
103
101
  */
@@ -46,7 +46,6 @@ export interface MrlToolbarButtonProps {
46
46
  tipAnchor?: MrlIconButtonProps['tipAnchor'];
47
47
  toggleAria?: MrlIconButtonProps['toggleAria'];
48
48
  toggleStyle?: MrlIconButtonProps['toggleStyle'];
49
- tooltipKind?: MrlIconButtonProps['tooltipKind'];
50
49
  };
51
50
  }
52
51
  /**
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { AttrsObject } from '../../../utils';
3
- import { MrlTooltipAnchor, MrlTooltipPosition, MrlTooltipState, MrlTooltipVariant } from '../constants';
3
+ import { MrlTooltipAnchor, MrlTooltipPosition, MrlTooltipState } from '../constants';
4
4
  import '../../../styles/shared/a11y-helpers/a11y.global.scss';
5
5
  interface MrlTooltipProps {
6
6
  /** The arrow position of the tooltip in relation to its trigger's content */
@@ -27,8 +27,6 @@ interface MrlTooltipProps {
27
27
  display?: MrlTooltipState;
28
28
  /** Whether to disable the tooltip hover action that keeps it open */
29
29
  disableTooltipHover?: boolean;
30
- /** The kind of tooltip to be rendered */
31
- kind?: MrlTooltipVariant;
32
30
  /** The placement of the tooltip in relation to its trigger */
33
31
  position?: MrlTooltipPosition;
34
32
  /** Whether to announce the tooltip content to screen readers */
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { AttrsObject } from '../../../utils';
3
- import { MrlTooltipAnchor, MrlTooltipPosition, MrlTooltipVariant } from '../constants';
3
+ import { MrlTooltipAnchor, MrlTooltipPosition } from '../constants';
4
4
  import './MrlTooltipContent.global.scss';
5
5
  interface MrlTooltipContentProps {
6
6
  /**
@@ -18,8 +18,6 @@ interface MrlTooltipContentProps {
18
18
  attrs: AttrsObject;
19
19
  /** dataQa attribute for tooltip */
20
20
  dataQa?: string;
21
- /** The kind of tooltip to be rendered */
22
- kind: MrlTooltipVariant;
23
21
  /** The id of the tooltip used for aria-describedby in the parent component */
24
22
  id?: string;
25
23
  /** The placement of the tooltip in relation to its trigger */
@@ -22,6 +22,5 @@ export interface MrlTooltipDefaults {
22
22
  * Shared between the component and Storybook
23
23
  */
24
24
  export declare const MrlTooltipDefaults: MrlTooltipDefaults;
25
- export type MrlTooltipVariant = 'default' | 'inverse';
26
25
  export type TooltipAlignment = 'start' | 'end' | 'center';
27
26
  export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { MrlTrack } from './types';
3
+ export interface MrlAnalyticsContextProps {
4
+ track: MrlTrack;
5
+ }
6
+ export declare const MrlAnalyticsContext: React.Context<MrlAnalyticsContextProps>;
7
+ export interface MrlAnalyticsProviderProps {
8
+ /**
9
+ * The transport the app injects. Receives a MrlAnalyticsEvent and forwards it
10
+ * wherever the app tracks (in murally: a wrapper over trackWithSegment).
11
+ * Omit it and the toolkit stays silent — safe for consumers with no analytics.
12
+ */
13
+ track?: MrlTrack;
14
+ children: React.ReactNode;
15
+ }
16
+ /**
17
+ * Injects the app's analytics transport into the toolkit. Wrap the app once;
18
+ * every instrumented Mrl* component below emits through the provided `track`.
19
+ *
20
+ * @param props - the provider props
21
+ * @param props.track - the transport that receives each MrlAnalyticsEvent (default no-op)
22
+ * @param props.children - the subtree that can emit analytics
23
+ * @returns the provider wrapping `children`
24
+ */
25
+ export declare const MrlAnalyticsProvider: ({ track, children }: MrlAnalyticsProviderProps) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './MrlAnalyticsContext';
2
+ export * from './types';
@@ -0,0 +1,22 @@
1
+ /** Values allowed in analytics payloads. No free-text/PII — see MrlAnalyticsProvider docs. */
2
+ export type MrlAnalyticsValue = string | number | boolean;
3
+ /** The canonical interaction a Mrl* component emits. Transport-agnostic. */
4
+ export interface MrlAnalyticsEvent {
5
+ /** Component identity, e.g. 'MrlButton', 'MrlMenu', 'MrlModal'. Set by the component. */
6
+ component: string;
7
+ /** Interaction type, e.g. 'click' | 'open' | 'close' | 'select' | 'change'. Set by the component. */
8
+ action: string;
9
+ /** ui-toolkit version for internal tracking */
10
+ toolkitVersion: string;
11
+ /**
12
+ * Consumer-supplied attribution id. REQUIRED for an event to fire (opt-in).
13
+ * Must be a stable, non-PII identifier (e.g. 'board-share', not the user's name).
14
+ */
15
+ trackingId: string;
16
+ /** Non-PII component variant, e.g. button kind/size. Set by the component. */
17
+ variant?: string;
18
+ /** Curated, non-PII extra context. Never button labels, input values, etc. */
19
+ metadata?: Record<string, MrlAnalyticsValue>;
20
+ }
21
+ /** The one function the toolkit calls. The app decides what it does. */
22
+ export type MrlTrack = (event: MrlAnalyticsEvent) => void;
@@ -1 +1,2 @@
1
+ export * from './MrlAnalyticsContext';
1
2
  export * from './MrlTabContext';
@@ -4,11 +4,12 @@ import classnames from 'classnames';
4
4
  import { buttonDefaults, allowedButtonValues } from '../constants.js';
5
5
  import { _isSelected, _isDisabled, _spinnerProps } from '../helpers.js';
6
6
  import { spinnerDefaults } from '../../loader/constants.js';
7
+ import { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics/useMrlAnalytics.js';
7
8
  import { setAttributes } from '../../../utils/setAttributes/setAttributes.js';
8
9
  import { MrlTooltip } from '../../tooltip/MrlTooltip/MrlTooltip.js';
9
10
  import { MrlSpinner } from '../../loader/MrlSpinner/MrlSpinner.js';
10
11
 
11
- var _excluded = ["attrs", "badge", "className", "disabled", "disableEvents", "icon", "iconPos", "kind", "loading", "loadingText", "onClick", "toggleAria", "toggleStyle", "text", "size", "state", "tooltip"];
12
+ var _excluded = ["attrs", "badge", "className", "disabled", "disableEvents", "icon", "iconPos", "kind", "loading", "loadingText", "onClick", "toggleAria", "toggleStyle", "text", "trackingId", "size", "state", "tooltip"];
12
13
  var MrlButton = /*#__PURE__*/React.forwardRef(function MrlButton(_ref, ref) {
13
14
  var attrs = _ref.attrs,
14
15
  badge = _ref.badge,
@@ -31,6 +32,7 @@ var MrlButton = /*#__PURE__*/React.forwardRef(function MrlButton(_ref, ref) {
31
32
  toggleAria = _ref$toggleAria === void 0 ? buttonDefaults.toggleAria : _ref$toggleAria,
32
33
  toggleStyle = _ref.toggleStyle,
33
34
  text = _ref.text,
35
+ trackingId = _ref.trackingId,
34
36
  _ref$size = _ref.size,
35
37
  size = _ref$size === void 0 ? buttonDefaults.size : _ref$size,
36
38
  _ref$state = _ref.state,
@@ -41,6 +43,7 @@ var MrlButton = /*#__PURE__*/React.forwardRef(function MrlButton(_ref, ref) {
41
43
  _React$useState2 = _slicedToArray(_React$useState, 2),
42
44
  isSelected = _React$useState2[0],
43
45
  setIsSelected = _React$useState2[1];
46
+ var trackInteraction = useMrlTrackInteraction('MrlButton', trackingId);
44
47
 
45
48
  /**
46
49
  * MrlButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'
@@ -67,6 +70,10 @@ var MrlButton = /*#__PURE__*/React.forwardRef(function MrlButton(_ref, ref) {
67
70
  if (_isDisabled(state, loading) || disabled || disableEvents) {
68
71
  return;
69
72
  }
73
+ trackInteraction({
74
+ action: 'click',
75
+ variant: kind
76
+ });
70
77
  if (isToggleButton) {
71
78
  setIsSelected(prevIsSelected => !prevIsSelected);
72
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MrlButton.js","sources":["../../../../../src/components/button/MrlButton/MrlButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tallowedButtonValues,\n\tbuttonDefaults,\n\tMrlButtonKind,\n\tMrlButtonSize,\n\tToggleAria,\n\tIconPosition\n} from '../constants';\nimport { _isDisabled, _isSelected, _spinnerProps } from '../helpers';\nimport { MrlSpinner, MrlTooltipAnchor, MrlTooltipPosition, MrlTooltip } from '../../';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { AttrsObject, MrlComponentProps, setAttributes } from '../../../utils';\n\nimport './MrlButton.global.scss';\n\nexport type MrlButtonState = (typeof allowedButtonValues.states)[number];\nexport type ToggleStyle = (typeof allowedButtonValues.toggleStyles)[number];\n\nexport interface TooltipConfig {\n\t/**\n\t * The text to display in the tooltip\n\t */\n\ttext: string;\n\t/**\n\t * The position of the tooltip relative to the button\n\t */\n\tposition?: MrlTooltipPosition;\n\n\t/**\n\t * The anchor of the tooltip relative to the button\n\t */\n\tanchor?: MrlTooltipAnchor;\n\n\t/**\n\t * The data-qa attribute for the tooltip\n\t */\n\tdataQa?: string;\n}\n\nexport interface MrlButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'button'> {\n\t/**\n\t * Applies additional HTML attributes to the button element.\n\t *\n\t * @deprecated\n\t */\n\tattrs?: AttrsObject;\n\t/**\n\t * Allow developers to add badge to buttons.\n\t */\n\tbadge?: React.ReactElement;\n\n\t/**\n\t * @deprecated - Use state=\"disabled\" or \"selected-disabled\" or \"skeleton\" instead.\n\t * Allow developers to change the disabled state based on user interactions.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Allows developers the ability to disable built in event listeners so they can manage user\n\t * interactions from the application.\n\t */\n\tdisableEvents?: boolean;\n\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?: MrlButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.SyntheticEvent<HTMLButtonElement>) => 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 * Changes the state of the button based on user permissions or actions.\n\t */\n\tstate?: MrlButtonState;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\t/**\n\t * 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 * Selected state variant when the button is a Toggle Button. The visual styles\n\t * are also impacted by the \"kind\" prop. Toggle buttons are only supported\n\t * when \"kind\" is set to either \"ghost\" or \"ghost-inverse\". Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\ttoggleStyle?: ToggleStyle;\n}\n\nexport const MrlButton = React.forwardRef<HTMLButtonElement, MrlButtonProps>(function MrlButton(\n\t{\n\t\tattrs,\n\t\tbadge,\n\t\tclassName,\n\t\tdisabled = buttonDefaults.disabled,\n\t\tdisableEvents = false,\n\t\ticon,\n\t\ticonPos = buttonDefaults.iconPos,\n\t\tkind = buttonDefaults.kind,\n\t\tloading = false,\n\t\tloadingText = spinnerDefaults.text,\n\t\tonClick,\n\t\ttoggleAria = buttonDefaults.toggleAria,\n\t\ttoggleStyle,\n\t\ttext,\n\t\tsize = buttonDefaults.size,\n\t\tstate = buttonDefaults.state,\n\t\ttooltip,\n\t\t...remainingProps\n\t}: MrlButtonProps,\n\tref\n) {\n\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(state));\n\n\t/**\n\t * MrlButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'\n\t */\n\tconst isToggleButton = toggleStyle && allowedButtonValues.toggleStyles.includes(toggleStyle);\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\t/**\n\t * Handle onClick events\n\t *\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) || disabled || disableEvents) {\n\t\t\treturn;\n\t\t}\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 classNames = classnames(\n\t\t'mrlButton',\n\t\t`mrlButton--${size}`,\n\t\t`mrlButton--${kind}`,\n\t\tstate === 'skeleton' && `mrlButton--skeleton`,\n\t\t!icon && loading && `mrlButton--loading`,\n\t\tisToggleButton && `toggleStyle--${toggleStyle}`,\n\t\ticon && `mrlButton--icon-${iconPos}`,\n\t\tclassName,\n\t\tattrs?.class || attrs?.className\n\t);\n\n\tif (attrs && attrs.class) delete attrs.class;\n\tif (attrs && attrs.className) delete attrs.className;\n\n\tconst spinnerProps = _spinnerProps(kind, size);\n\tconst spinner = (\n\t\t<MrlSpinner kind={spinnerProps.kind} role=\"none\" size={spinnerProps.size} text={loadingText} />\n\t);\n\n\tconst attributes = setAttributes(attrs || {}, {\n\t\t'aria-disabled': _isDisabled(state, loading) || disabled,\n\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\trole: 'button',\n\t\ttype: 'button'\n\t});\n\n\tconst renderButton = () => (\n\t\t<button\n\t\t\t{...attributes}\n\t\t\t{...remainingProps}\n\t\t\tclassName={classNames}\n\t\t\tref={ref}\n\t\t\tonClick={handleOnClick}\n\t\t>\n\t\t\t{loading ? spinner : icon}\n\t\t\t<span className=\"mrlButton-text\">{text}</span>\n\t\t\t{badge}\n\t\t</button>\n\t);\n\n\treturn !tooltip ? (\n\t\trenderButton()\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{renderButton()}\n\t\t</MrlTooltip>\n\t);\n});\n"],"names":["MrlButton","React","forwardRef","_ref","ref","attrs","badge","className","_ref$disabled","disabled","buttonDefaults","_ref$disableEvents","disableEvents","icon","_ref$iconPos","iconPos","_ref$kind","kind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","_ref$toggleAria","toggleAria","toggleStyle","_ref$size","size","_ref$state","state","tooltip","remainingProps","_objectWithoutProperties","_excluded","_React$useState","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","isToggleButton","allowedButtonValues","toggleStyles","includes","useEffect","handleOnClick","e","stopPropagation","_isDisabled","prevIsSelected","classNames","classnames","concat","class","spinnerProps","_spinnerProps","spinner","createElement","MrlSpinner","role","attributes","setAttributes","_objectSpread","type","renderButton","_extends","MrlTooltip","position","anchor","dataQa"],"mappings":";;;;;;;;;;;AA8HO,IAAMA,SAAS,gBAAGC,KAAK,CAACC,UAAU,CAAoC,SAASF,SAASA,CAAAG,IAAA,EAqB9FC,GAAG,EACF;AAAA,EAAA,IApBAC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,aAAA,GAAAL,IAAA,CACTM,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAA,MAAA,GAAGE,cAAc,CAACD,QAAQ,GAAAD,aAAA;IAAAG,kBAAA,GAAAR,IAAA,CAClCS,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,kBAAA;IACrBE,IAAI,GAAAV,IAAA,CAAJU,IAAI;IAAAC,YAAA,GAAAX,IAAA,CACJY,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAGJ,cAAc,CAACK,OAAO,GAAAD,YAAA;IAAAE,SAAA,GAAAb,IAAA,CAChCc,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGN,cAAc,CAACO,IAAI,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CAAC0B,OAAO,GACdmC,YAAY,EAAE,gBAEdlE,KAAA,CAAA2D,aAAA,CAACS,UAAU,EAAA;AACVC,IAAAA,QAAQ,EAAEtC,OAAO,CAACsC,QAAQ,IAAI,QAAS;AACvCC,IAAAA,MAAM,EAAEvC,OAAO,CAACuC,MAAM,IAAI,QAAS;IACnChD,IAAI,EAAES,OAAO,CAACT,IAAK;IACnBiD,MAAM,EAAExC,OAAO,CAACwC;GAAO,EAEtBL,YAAY,EACF,CACZ;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"MrlButton.js","sources":["../../../../../src/components/button/MrlButton/MrlButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tallowedButtonValues,\n\tbuttonDefaults,\n\tMrlButtonKind,\n\tMrlButtonSize,\n\tToggleAria,\n\tIconPosition\n} from '../constants';\nimport { _isDisabled, _isSelected, _spinnerProps } from '../helpers';\nimport { MrlSpinner, MrlTooltipAnchor, MrlTooltipPosition, MrlTooltip } from '../../';\nimport { spinnerDefaults } from '../../loader/constants';\nimport { AttrsObject, MrlComponentProps, setAttributes } from '../../../utils';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nimport './MrlButton.global.scss';\n\nexport type MrlButtonState = (typeof allowedButtonValues.states)[number];\nexport type ToggleStyle = (typeof allowedButtonValues.toggleStyles)[number];\n\nexport interface TooltipConfig {\n\t/**\n\t * The text to display in the tooltip\n\t */\n\ttext: string;\n\t/**\n\t * The position of the tooltip relative to the button\n\t */\n\tposition?: MrlTooltipPosition;\n\n\t/**\n\t * The anchor of the tooltip relative to the button\n\t */\n\tanchor?: MrlTooltipAnchor;\n\n\t/**\n\t * The data-qa attribute for the tooltip\n\t */\n\tdataQa?: string;\n}\n\nexport interface MrlButtonProps\n\textends Omit<MrlComponentProps, 'style'>,\n\t\tReact.ComponentProps<'button'> {\n\t/**\n\t * Applies additional HTML attributes to the button element.\n\t *\n\t * @deprecated\n\t */\n\tattrs?: AttrsObject;\n\t/**\n\t * Allow developers to add badge to buttons.\n\t */\n\tbadge?: React.ReactElement;\n\n\t/**\n\t * @deprecated - Use state=\"disabled\" or \"selected-disabled\" or \"skeleton\" instead.\n\t * Allow developers to change the disabled state based on user interactions.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Allows developers the ability to disable built in event listeners so they can manage user\n\t * interactions from the application.\n\t */\n\tdisableEvents?: boolean;\n\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?: MrlButtonKind;\n\t/**\n\t * Displays a spinner in the button to indicate some action is in progress.\n\t */\n\tloading?: boolean;\n\t/**\n\t * Text for the spinner when the button is in a loading state.\n\t */\n\tloadingText?: string;\n\t/**\n\t * onClick event for the button.\n\t */\n\tonClick?: (e: React.SyntheticEvent<HTMLButtonElement>) => 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 * Changes the state of the button based on user permissions or actions.\n\t */\n\tstate?: MrlButtonState;\n\t/**\n\t * The textual label describing the button's purpose/action.\n\t * Icon buttons require a text label to ensure accessibility.\n\t */\n\ttext: string;\n\t/**\n\t * Enables interaction tracking for this button. Provide a stable, non-PII id\n\t * (e.g. 'board-share-cta'). When omitted, the button emits no analytics.\n\t */\n\ttrackingId?: string;\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 * Selected state variant when the button is a Toggle Button. The visual styles\n\t * are also impacted by the \"kind\" prop. Toggle buttons are only supported\n\t * when \"kind\" is set to either \"ghost\" or \"ghost-inverse\". Setting this prop\n\t * informs the component that this is a toggle button and to add that functionality\n\t */\n\ttoggleStyle?: ToggleStyle;\n}\n\nexport const MrlButton = React.forwardRef<HTMLButtonElement, MrlButtonProps>(function MrlButton(\n\t{\n\t\tattrs,\n\t\tbadge,\n\t\tclassName,\n\t\tdisabled = buttonDefaults.disabled,\n\t\tdisableEvents = false,\n\t\ticon,\n\t\ticonPos = buttonDefaults.iconPos,\n\t\tkind = buttonDefaults.kind,\n\t\tloading = false,\n\t\tloadingText = spinnerDefaults.text,\n\t\tonClick,\n\t\ttoggleAria = buttonDefaults.toggleAria,\n\t\ttoggleStyle,\n\t\ttext,\n\t\ttrackingId,\n\t\tsize = buttonDefaults.size,\n\t\tstate = buttonDefaults.state,\n\t\ttooltip,\n\t\t...remainingProps\n\t}: MrlButtonProps,\n\tref\n) {\n\tconst [isSelected, setIsSelected] = React.useState(() => _isSelected(state));\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlButton', trackingId);\n\n\t/**\n\t * MrlButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'\n\t */\n\tconst isToggleButton = toggleStyle && allowedButtonValues.toggleStyles.includes(toggleStyle);\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\t/**\n\t * Handle onClick events\n\t *\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) || disabled || disableEvents) {\n\t\t\treturn;\n\t\t}\n\n\t\ttrackInteraction({ action: 'click', variant: kind });\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 classNames = classnames(\n\t\t'mrlButton',\n\t\t`mrlButton--${size}`,\n\t\t`mrlButton--${kind}`,\n\t\tstate === 'skeleton' && `mrlButton--skeleton`,\n\t\t!icon && loading && `mrlButton--loading`,\n\t\tisToggleButton && `toggleStyle--${toggleStyle}`,\n\t\ticon && `mrlButton--icon-${iconPos}`,\n\t\tclassName,\n\t\tattrs?.class || attrs?.className\n\t);\n\n\tif (attrs && attrs.class) delete attrs.class;\n\tif (attrs && attrs.className) delete attrs.className;\n\n\tconst spinnerProps = _spinnerProps(kind, size);\n\tconst spinner = (\n\t\t<MrlSpinner kind={spinnerProps.kind} role=\"none\" size={spinnerProps.size} text={loadingText} />\n\t);\n\n\tconst attributes = setAttributes(attrs || {}, {\n\t\t'aria-disabled': _isDisabled(state, loading) || disabled,\n\t\t...(isToggleButton && { [`aria-${toggleAria}`]: isSelected || false }),\n\t\trole: 'button',\n\t\ttype: 'button'\n\t});\n\n\tconst renderButton = () => (\n\t\t<button\n\t\t\t{...attributes}\n\t\t\t{...remainingProps}\n\t\t\tclassName={classNames}\n\t\t\tref={ref}\n\t\t\tonClick={handleOnClick}\n\t\t>\n\t\t\t{loading ? spinner : icon}\n\t\t\t<span className=\"mrlButton-text\">{text}</span>\n\t\t\t{badge}\n\t\t</button>\n\t);\n\n\treturn !tooltip ? (\n\t\trenderButton()\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{renderButton()}\n\t\t</MrlTooltip>\n\t);\n});\n"],"names":["MrlButton","React","forwardRef","_ref","ref","attrs","badge","className","_ref$disabled","disabled","buttonDefaults","_ref$disableEvents","disableEvents","icon","_ref$iconPos","iconPos","_ref$kind","kind","_ref$loading","loading","_ref$loadingText","loadingText","spinnerDefaults","text","onClick","_ref$toggleAria","toggleAria","toggleStyle","trackingId","_ref$size","size","_ref$state","state","tooltip","remainingProps","_objectWithoutProperties","_excluded","_React$useState","useState","_isSelected","_React$useState2","_slicedToArray","isSelected","setIsSelected","trackInteraction","useMrlTrackInteraction","isToggleButton","allowedButtonValues","toggleStyles","includes","useEffect","handleOnClick","e","stopPropagation","_isDisabled","action","variant","prevIsSelected","classNames","classnames","concat","class","spinnerProps","_spinnerProps","spinner","createElement","MrlSpinner","role","attributes","setAttributes","_objectSpread","type","renderButton","_extends","MrlTooltip","position","anchor","dataQa"],"mappings":";;;;;;;;;;;;AAoIO,IAAMA,SAAS,gBAAGC,KAAK,CAACC,UAAU,CAAoC,SAASF,SAASA,CAAAG,IAAA,EAsB9FC,GAAG,EACF;AAAA,EAAA,IArBAC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,aAAA,GAAAL,IAAA,CACTM,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAA,MAAA,GAAGE,cAAc,CAACD,QAAQ,GAAAD,aAAA;IAAAG,kBAAA,GAAAR,IAAA,CAClCS,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,kBAAA;IACrBE,IAAI,GAAAV,IAAA,CAAJU,IAAI;IAAAC,YAAA,GAAAX,IAAA,CACJY,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAGJ,cAAc,CAACK,OAAO,GAAAD,YAAA;IAAAE,SAAA,GAAAb,IAAA,CAChCc,IAAI;AAAJA,IAAAA,IAAI,G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