@protonradio/proton-ui 0.11.11 → 0.11.13-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/components/ActionMenu/ActionMenu.cjs.js +1 -1
  2. package/dist/components/Banner/Banner.cjs.js +1 -1
  3. package/dist/components/Button/Button.cjs.js +1 -1
  4. package/dist/components/ButtonGroup/ButtonGroup.cjs.js +1 -1
  5. package/dist/components/ButtonWithSelect/ButtonWithSelect.es.js +13 -13
  6. package/dist/components/DataTable/DataTable.cjs.js +1 -1
  7. package/dist/components/Dialog/Dialog.cjs.js +1 -1
  8. package/dist/components/Input/BaseInput/Input.cjs.js +1 -1
  9. package/dist/components/Input/SearchInput/SearchInput.cjs.js +1 -1
  10. package/dist/components/Input/SearchInput/SearchInput.cjs.js.map +1 -1
  11. package/dist/components/Input/SearchInput/SearchInput.es.js +1 -1
  12. package/dist/components/Input/SearchInput/SearchInput.es.js.map +1 -1
  13. package/dist/components/Menu/MenuTrigger.cjs.js +1 -1
  14. package/dist/components/Modal/Modal.cjs.js +1 -1
  15. package/dist/components/Switch/Switch.cjs.js +1 -1
  16. package/dist/components/Table/Collection/collectionParser.cjs.js +1 -1
  17. package/dist/components/Table/Collection/useTableCollection.cjs.js +1 -1
  18. package/dist/components/Text/TextEmphasis/TextEmphasis.cjs.js +1 -1
  19. package/dist/components/Text/TextEmphasis/TextEmphasis.cjs.js.map +1 -1
  20. package/dist/components/Text/TextEmphasis/TextEmphasis.es.js +15 -15
  21. package/dist/components/Text/TextEmphasis/TextEmphasis.es.js.map +1 -1
  22. package/dist/components/ThemeProvider.cjs.js +1 -1
  23. package/dist/components/Tooltip/Tooltip.cjs.js +1 -1
  24. package/dist/components/Tooltip/Tooltip.cjs.js.map +1 -1
  25. package/dist/components/Tooltip/Tooltip.es.js +71 -56
  26. package/dist/components/Tooltip/Tooltip.es.js.map +1 -1
  27. package/dist/components/Waveform/Waveform.cjs.js +1 -1
  28. package/dist/hooks/useBreakpoint.cjs.js +1 -1
  29. package/dist/hooks/useIsClosing.cjs.js +1 -1
  30. package/dist/index.cjs.js +1 -1
  31. package/dist/index.d.ts +52 -25
  32. package/dist/index.es.js +6 -6
  33. package/dist/node_modules/@react-aria/focus/dist/FocusScope.cjs.js +1 -1
  34. package/dist/node_modules/@react-aria/form/dist/useFormValidation.cjs.js +1 -1
  35. package/dist/node_modules/@react-aria/i18n/dist/context.cjs.js +1 -1
  36. package/dist/node_modules/@react-aria/i18n/dist/context.es.js +3 -3
  37. package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.cjs.js +1 -1
  38. package/dist/node_modules/@react-aria/interactions/dist/useFocusable.cjs.js +1 -1
  39. package/dist/node_modules/@react-aria/interactions/dist/useFocusable.cjs.js.map +1 -1
  40. package/dist/node_modules/@react-aria/interactions/dist/useFocusable.es.js +20 -30
  41. package/dist/node_modules/@react-aria/interactions/dist/useFocusable.es.js.map +1 -1
  42. package/dist/node_modules/@react-aria/interactions/dist/usePress.cjs.js +2 -2
  43. package/dist/node_modules/@react-aria/overlays/dist/Overlay.cjs.js +1 -1
  44. package/dist/node_modules/@react-aria/ssr/dist/SSRProvider.es.js.map +1 -1
  45. package/dist/node_modules/@react-stately/form/dist/useFormValidationState.cjs.js +1 -1
  46. package/dist/node_modules/@react-stately/radio/dist/useRadioGroupState.cjs.js +1 -1
  47. package/dist/node_modules/@react-stately/utils/dist/useControlledState.cjs.js +1 -1
  48. package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs.js +5 -5
  49. package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js +14 -14
  50. package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.es.js +2 -2
  51. package/dist/style.css +1 -1
  52. package/package.json +1 -1
  53. package/dist/node_modules/react-aria-components/dist/OverlayArrow.cjs.js +0 -2
  54. package/dist/node_modules/react-aria-components/dist/OverlayArrow.cjs.js.map +0 -1
  55. package/dist/node_modules/react-aria-components/dist/OverlayArrow.es.js +0 -37
  56. package/dist/node_modules/react-aria-components/dist/OverlayArrow.es.js.map +0 -1
  57. package/dist/node_modules/react-aria-components/dist/Tooltip.cjs.js +0 -2
  58. package/dist/node_modules/react-aria-components/dist/Tooltip.cjs.js.map +0 -1
  59. package/dist/node_modules/react-aria-components/dist/Tooltip.es.js +0 -98
  60. package/dist/node_modules/react-aria-components/dist/Tooltip.es.js.map +0 -1
  61. package/dist/node_modules/react-aria-components/dist/utils.cjs.js +0 -2
  62. package/dist/node_modules/react-aria-components/dist/utils.cjs.js.map +0 -1
  63. package/dist/node_modules/react-aria-components/dist/utils.es.js +0 -89
  64. package/dist/node_modules/react-aria-components/dist/utils.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.cjs.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n Tooltip as AriaTooltip,\r\n TooltipProps as AriaTooltipProps,\r\n TooltipTrigger as AriaTooltipTrigger,\r\n Focusable,\r\n OverlayArrow,\r\n TooltipTriggerComponentProps,\r\n} from \"react-aria-components\";\r\n\r\nimport { useRef, useState } from \"react\";\r\nimport { useTheme } from \"../ThemeProvider\";\r\n\r\nimport { csx } from \"../../utils\";\r\nimport \"../Dialog/Dialog.css\";\r\nimport \"./Tooltip.css\";\r\n\r\nexport interface TooltipProps extends Omit<AriaTooltipProps, \"children\"> {\r\n children: React.ReactNode;\r\n arrow?: boolean;\r\n}\r\n\r\nfunction Tooltip({ children, arrow, ...props }: TooltipProps) {\r\n const { style, className } = useTheme();\r\n\r\n return (\r\n <AriaTooltip\r\n {...props}\r\n className={csx(\"proton__Tooltip\", \"proton-Dialog\", className)}\r\n style={style as React.CSSProperties}\r\n >\r\n {arrow && (\r\n <OverlayArrow className={csx(\"proton__TooltipArrow\", className)}>\r\n <svg width={8} height={8} viewBox=\"0 0 8 8\">\r\n <path d=\"M0 0 L4 4 L8 0\" />\r\n </svg>\r\n </OverlayArrow>\r\n )}\r\n\r\n {children}\r\n </AriaTooltip>\r\n );\r\n}\r\n\r\nexport interface TooltipTriggerProps\r\n extends TooltipProps,\r\n TooltipTriggerComponentProps {\r\n children: React.ReactNode;\r\n /**\r\n * The content to display in the tooltip. Zero-length titles string are never displayed.\r\n */\r\n content: string | React.ReactNode;\r\n /**\r\n * Whether to disable the trigger click feature.\r\n */\r\n disableTriggerClick?: boolean;\r\n}\r\n\r\n/**\r\n * Proton's TooltipTrigger component deviates from the Aria TooltipTrigger in that on mobile,\r\n * the trigger also opens the tooltip on click as well as hover & focus. This is to improve\r\n * accessibility and usability on mobile.\r\n *\r\n * If you wish to disable the trigger click feature, you can set the `disableTriggerClick` prop.\r\n * This is useful when using an info only Tooltip that might wrap a clickable element.\r\n *\r\n * API:\r\n * - {@link TooltipTriggerProps}\r\n * - extends {@link TooltipProps}\r\n * - extends {@link TooltipTriggerComponentProps}\r\n *\r\n * @example\r\n * ```tsx\r\n <TooltipTrigger content={...} placement=\"top\" arrow isDisabled={disabled}>\r\n {children}\r\n </TooltipTrigger>\r\n * ```\r\n */\r\nexport function TooltipTrigger({\r\n children,\r\n // trigger props\r\n delay = 500,\r\n closeDelay = 500,\r\n isDisabled,\r\n defaultOpen,\r\n onOpenChange,\r\n disableTriggerClick,\r\n // tooltip props\r\n content,\r\n ...tooltipProps\r\n}: TooltipTriggerProps) {\r\n const [isOpen, setIsOpen] = useState(false);\r\n const triggerClickRef = useRef<boolean>(false);\r\n const hasHovered = useRef<boolean>(false);\r\n\r\n if (content === \"\") return null;\r\n\r\n return (\r\n <AriaTooltipTrigger\r\n delay={delay}\r\n closeDelay={closeDelay}\r\n isDisabled={isDisabled}\r\n isOpen={isOpen}\r\n defaultOpen={defaultOpen}\r\n onOpenChange={(openState) => {\r\n // When opened via hover, we want to disable the trigger click feature as it causes\r\n // the tooltip state to get out of sync with the trigger state.\r\n if (openState && !triggerClickRef.current) hasHovered.current = true;\r\n\r\n if (onOpenChange) onOpenChange(openState);\r\n\r\n // If the tooltip is clicked, it manually calls setIsOpen, so we don't want to call\r\n // it again here.\r\n if (!triggerClickRef.current) setIsOpen(openState);\r\n triggerClickRef.current = false;\r\n }}\r\n >\r\n {disableTriggerClick ? (\r\n <span className=\"proton__TooltipTrigger\" aria-label=\"Show tooltip\">\r\n {children}\r\n </span>\r\n ) : (\r\n <Focusable>\r\n <div\r\n role=\"button\"\r\n aria-label=\"Show tooltip\"\r\n className=\"proton__TooltipTrigger\"\r\n data-hovered={isOpen}\r\n onMouseEnter={() => {\r\n if (!isDisabled) {\r\n setIsOpen(true);\r\n }\r\n }}\r\n onMouseLeave={() => {\r\n if (!isDisabled) {\r\n setIsOpen(false);\r\n }\r\n }}\r\n onClick={() => {\r\n if (disableTriggerClick || isDisabled) return;\r\n\r\n // Once hovered it's safe to assume the user isn't trying to use via a touch device,\r\n // so we can safely disable the trigger click feature.\r\n if (hasHovered.current) return;\r\n\r\n triggerClickRef.current = true;\r\n setIsOpen(!isOpen);\r\n }}\r\n >\r\n {children}\r\n </div>\r\n </Focusable>\r\n )}\r\n <Tooltip {...tooltipProps}>{content}</Tooltip>\r\n </AriaTooltipTrigger>\r\n );\r\n}\r\n"],"names":["Tooltip","children","arrow","props","style","className","useTheme","jsxs","AriaTooltip","csx","jsx","OverlayArrow","TooltipTrigger","delay","closeDelay","isDisabled","defaultOpen","onOpenChange","disableTriggerClick","content","tooltipProps","isOpen","setIsOpen","useState","triggerClickRef","useRef","hasHovered","AriaTooltipTrigger","openState","Focusable"],"mappings":"4eAuBA,SAASA,EAAQ,CAAE,SAAAC,EAAU,MAAAC,EAAO,GAAGC,GAAuB,CAC5D,KAAM,CAAE,MAAAC,EAAO,UAAAC,CAAU,EAAIC,EAAS,SAAA,EAGpC,OAAAC,EAAA,kBAAA,KAACC,EAAA,QAAA,CACE,GAAGL,EACJ,UAAWM,EAAA,IAAI,kBAAmB,gBAAiBJ,CAAS,EAC5D,MAAAD,EAEC,SAAA,CACCF,GAAAQ,EAAA,kBAAA,IAACC,gBAAa,UAAWF,EAAA,IAAI,uBAAwBJ,CAAS,EAC5D,iCAAC,MAAI,CAAA,MAAO,EAAG,OAAQ,EAAG,QAAQ,UAChC,SAAAK,EAAAA,kBAAAA,IAAC,QAAK,EAAE,iBAAiB,EAC3B,CACF,CAAA,EAGDT,CAAA,CAAA,CAAA,CAGP,CAoCO,SAASW,EAAe,CAC7B,SAAAX,EAEA,MAAAY,EAAQ,IACR,WAAAC,EAAa,IACb,WAAAC,EACA,YAAAC,EACA,aAAAC,EACA,oBAAAC,EAEA,QAAAC,EACA,GAAGC,CACL,EAAwB,CACtB,KAAM,CAACC,EAAQC,CAAS,EAAIC,WAAS,EAAK,EACpCC,EAAkBC,SAAgB,EAAK,EACvCC,EAAaD,SAAgB,EAAK,EAEpC,OAAAN,IAAY,GAAW,KAGzBZ,EAAA,kBAAA,KAACoB,EAAA,eAAA,CACC,MAAAd,EACA,WAAAC,EACA,WAAAC,EACA,OAAAM,EACA,YAAAL,EACA,aAAeY,GAAc,CAGvBA,GAAa,CAACJ,EAAgB,YAAoB,QAAU,IAE5DP,KAA2BW,CAAS,EAInCJ,EAAgB,SAASF,EAAUM,CAAS,EACjDJ,EAAgB,QAAU,EAC5B,EAEC,SAAA,CACCN,EAAAR,EAAAA,kBAAAA,IAAC,QAAK,UAAU,yBAAyB,aAAW,eACjD,SAAAT,CACH,CAAA,EAEAS,EAAAA,kBAAAA,IAACmB,EAAAA,UACC,CAAA,SAAAnB,EAAA,kBAAA,IAAC,MAAA,CACC,KAAK,SACL,aAAW,eACX,UAAU,yBACV,eAAcW,EACd,aAAc,IAAM,CACbN,GACHO,EAAU,EAAI,CAElB,EACA,aAAc,IAAM,CACbP,GACHO,EAAU,EAAK,CAEnB,EACA,QAAS,IAAM,CACTJ,GAAuBH,GAIvBW,EAAW,UAEfF,EAAgB,QAAU,GAC1BF,EAAU,CAACD,CAAM,EACnB,EAEC,SAAApB,CAAA,CAAA,EAEL,EAEDS,EAAA,kBAAA,IAAAV,EAAA,CAAS,GAAGoB,EAAe,SAAQD,CAAA,CAAA,CAAA,CAAA,CAAA,CAG1C"}
1
+ {"version":3,"file":"Tooltip.cjs.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React, { ReactNode } from \"react\";\r\nimport { Tooltip as RadixTooltip } from \"radix-ui\";\r\nimport { useTheme } from \"../ThemeProvider\";\r\nimport { csx } from \"../../utils\";\r\nimport \"../Dialog/Dialog.css\";\r\nimport \"./Tooltip.css\";\r\n\r\nexport type TooltipPlacement = \"top\" | \"bottom\" | \"left\" | \"right\";\r\n\r\nexport interface TooltipContentProps {\r\n content: string | ReactNode;\r\n children: ReactNode;\r\n arrow?: boolean;\r\n placement?: TooltipPlacement;\r\n \"data-testid\"?: string;\r\n}\r\n\r\nconst TooltipContent = React.forwardRef<HTMLDivElement, TooltipContentProps>(\r\n (\r\n { content, children, arrow, placement = \"top\", \"data-testid\": testId },\r\n ref\r\n ) => {\r\n const { style, className } = useTheme();\r\n\r\n return (\r\n <RadixTooltip.Content\r\n ref={ref}\r\n side={placement}\r\n className={csx(\"proton__Tooltip\", \"proton-Dialog\", className)}\r\n style={style as React.CSSProperties}\r\n sideOffset={8}\r\n data-testid={testId}\r\n >\r\n {content}\r\n {arrow && (\r\n <RadixTooltip.Arrow\r\n className={csx(\"proton__Tooltip-arrow\", className)}\r\n width={8}\r\n height={8}\r\n >\r\n <svg width={8} height={8} viewBox=\"0 0 8 8\">\r\n <path d=\"M0 0 L4 4 L8 0\" />\r\n </svg>\r\n </RadixTooltip.Arrow>\r\n )}\r\n </RadixTooltip.Content>\r\n );\r\n }\r\n);\r\n\r\nTooltipContent.displayName = \"TooltipContent\";\r\n\r\nexport interface TooltipProps {\r\n /**\r\n * Whether to show an arrow pointing to the tooltip.\r\n * @default true\r\n */\r\n arrow?: boolean;\r\n /**\r\n * The children to display in the tooltip.\r\n */\r\n children: React.ReactNode;\r\n /**\r\n * The content to display in the tooltip. Zero-length titles string are never displayed.\r\n */\r\n content: string | React.ReactNode;\r\n /**\r\n * A test ID.\r\n */\r\n \"data-testid\"?: string;\r\n /**\r\n * The placement of the tooltip.\r\n * @default \"bottom\"\r\n */\r\n placement?: TooltipPlacement;\r\n /**\r\n * Whether to disable the trigger click feature.\r\n * This is useful when using an info only Tooltip that might wrap a clickable element.\r\n */\r\n disableTriggerClick?: boolean;\r\n /**\r\n * Whether the tooltip is disabled.\r\n */\r\n isDisabled?: boolean;\r\n /**\r\n * Delay before showing the tooltip (in milliseconds).\r\n * @default 100\r\n */\r\n delay?: number;\r\n /**\r\n * Whether the tooltip is open by default.\r\n * @default false\r\n */\r\n defaultOpen?: boolean;\r\n /**\r\n * The callback function to call when the tooltip is opened or closed.\r\n */\r\n onOpenChange?: (open: boolean) => void;\r\n}\r\n\r\n/**\r\n * A component that displays a tooltip when the user hovers over the trigger.\r\n * For mobile, use Popover instead.\r\n * API:\r\n * - {@link TooltipTriggerProps}\r\n *\r\n * @example\r\n * ```tsx\r\n <Tooltipcontent={...} placement=\"top\" arrow isDisabled={disabled}>\r\n {children}\r\n </Tooltip>\r\n * ```\r\n */\r\nexport function Tooltip({\r\n arrow = true,\r\n children,\r\n content,\r\n delay = 100,\r\n placement = \"bottom\",\r\n isDisabled,\r\n defaultOpen = false,\r\n onOpenChange,\r\n disableTriggerClick,\r\n \"data-testid\": testId,\r\n}: TooltipProps) {\r\n const [isOpen, setIsOpen] = React.useState(defaultOpen);\r\n const triggerClickRef = React.useRef<boolean>(false);\r\n const hasHovered = React.useRef<boolean>(false);\r\n\r\n if (content === \"\") return null;\r\n\r\n const handleOpenChange = (openState: boolean) => {\r\n // When opened via hover, we want to disable the trigger click feature as it causes\r\n // the tooltip state to get out of sync with the trigger state.\r\n if (openState && !triggerClickRef.current) hasHovered.current = true;\r\n\r\n if (onOpenChange) onOpenChange(openState);\r\n\r\n // If the tooltip is clicked, it manually calls setIsOpen, so we don't want to call\r\n // it again here.\r\n if (!triggerClickRef.current) setIsOpen(openState);\r\n triggerClickRef.current = false;\r\n };\r\n\r\n return (\r\n <RadixTooltip.Provider>\r\n <RadixTooltip.Root\r\n open={isOpen}\r\n defaultOpen={defaultOpen}\r\n onOpenChange={handleOpenChange}\r\n delayDuration={delay}\r\n >\r\n <RadixTooltip.Trigger asChild>\r\n {disableTriggerClick ? (\r\n <span className=\"proton__TooltipTrigger\" aria-label=\"Show tooltip\">\r\n {children}\r\n </span>\r\n ) : (\r\n <div\r\n role=\"button\"\r\n aria-label=\"Show tooltip\"\r\n className=\"proton__TooltipTrigger\"\r\n data-hovered={isOpen}\r\n onClick={() => {\r\n if (disableTriggerClick || isDisabled) return;\r\n\r\n // Once hovered it's safe to assume the user isn't trying to use via a touch device,\r\n // so we can safely disable the trigger click feature.\r\n if (hasHovered.current) return;\r\n\r\n triggerClickRef.current = true;\r\n setIsOpen(!isOpen);\r\n }}\r\n >\r\n {children}\r\n </div>\r\n )}\r\n </RadixTooltip.Trigger>\r\n <RadixTooltip.Portal>\r\n <TooltipContent\r\n content={content}\r\n placement={placement}\r\n arrow={arrow}\r\n data-testid={testId}\r\n >\r\n {children}\r\n </TooltipContent>\r\n </RadixTooltip.Portal>\r\n </RadixTooltip.Root>\r\n </RadixTooltip.Provider>\r\n );\r\n}\r\n\r\nTooltip.displayName = \"Tooltip\";\r\n"],"names":["TooltipContent","React","content","children","arrow","placement","testId","ref","style","className","useTheme","jsxs","RadixTooltip","csx","jsx","Tooltip","delay","isDisabled","defaultOpen","onOpenChange","disableTriggerClick","isOpen","setIsOpen","triggerClickRef","hasHovered","handleOpenChange","openState"],"mappings":"iVAmBMA,EAAiBC,EAAM,WAC3B,CACE,CAAE,QAAAC,EAAS,SAAAC,EAAU,MAAAC,EAAO,UAAAC,EAAY,MAAO,cAAeC,CAAO,EACrEC,IACG,CACH,KAAM,CAAE,MAAAC,EAAO,UAAAC,CAAU,EAAIC,EAAS,SAAA,EAGpC,OAAAC,EAAA,kBAAA,KAACC,EAAAA,QAAa,QAAb,CACC,IAAAL,EACA,KAAMF,EACN,UAAWQ,EAAA,IAAI,kBAAmB,gBAAiBJ,CAAS,EAC5D,MAAAD,EACA,WAAY,EACZ,cAAaF,EAEZ,SAAA,CAAAJ,EACAE,GACCU,EAAA,kBAAA,IAACF,EAAAA,QAAa,MAAb,CACC,UAAWC,EAAAA,IAAI,wBAAyBJ,CAAS,EACjD,MAAO,EACP,OAAQ,EAER,SAACK,EAAA,kBAAA,IAAA,MAAA,CAAI,MAAO,EAAG,OAAQ,EAAG,QAAQ,UAChC,SAACA,EAAAA,kBAAAA,IAAA,OAAA,CAAK,EAAE,gBAAiB,CAAA,EAC3B,CAAA,CACF,CAAA,CAAA,CAAA,CAIR,CACF,EAEAd,EAAe,YAAc,iBA+DtB,SAASe,EAAQ,CACtB,MAAAX,EAAQ,GACR,SAAAD,EACA,QAAAD,EACA,MAAAc,EAAQ,IACR,UAAAX,EAAY,SACZ,WAAAY,EACA,YAAAC,EAAc,GACd,aAAAC,EACA,oBAAAC,EACA,cAAed,CACjB,EAAiB,CACf,KAAM,CAACe,EAAQC,CAAS,EAAIrB,EAAM,SAASiB,CAAW,EAChDK,EAAkBtB,EAAM,OAAgB,EAAK,EAC7CuB,EAAavB,EAAM,OAAgB,EAAK,EAE1C,GAAAC,IAAY,GAAW,OAAA,KAErB,MAAAuB,EAAoBC,GAAuB,CAG3CA,GAAa,CAACH,EAAgB,YAAoB,QAAU,IAE5DJ,KAA2BO,CAAS,EAInCH,EAAgB,SAASD,EAAUI,CAAS,EACjDH,EAAgB,QAAU,EAAA,EAI1B,OAAAT,EAAA,kBAAA,IAACF,EAAa,QAAA,SAAb,CACC,SAAAD,EAAA,kBAAA,KAACC,EAAAA,QAAa,KAAb,CACC,KAAMS,EACN,YAAAH,EACA,aAAcO,EACd,cAAeT,EAEf,SAAA,CAAAF,EAAA,kBAAA,IAACF,EAAa,QAAA,QAAb,CAAqB,QAAO,GAC1B,SAAAQ,EACEN,EAAAA,kBAAAA,IAAA,OAAA,CAAK,UAAU,yBAAyB,aAAW,eACjD,SAAAX,CACH,CAAA,EAEAW,EAAA,kBAAA,IAAC,MAAA,CACC,KAAK,SACL,aAAW,eACX,UAAU,yBACV,eAAcO,EACd,QAAS,IAAM,CACTD,GAAuBH,GAIvBO,EAAW,UAEfD,EAAgB,QAAU,GAC1BD,EAAU,CAACD,CAAM,EACnB,EAEC,SAAAlB,CAAA,CAAA,EAGP,EACAW,EAAAA,kBAAAA,IAACF,EAAa,QAAA,OAAb,CACC,SAAAE,EAAA,kBAAA,IAACd,EAAA,CACC,QAAAE,EACA,UAAAG,EACA,MAAAD,EACA,cAAaE,EAEZ,SAAAH,CAAA,CAAA,EAEL,CAAA,CAAA,CAEJ,CAAA,CAAA,CAEJ,CAEAY,EAAQ,YAAc"}
@@ -1,78 +1,93 @@
1
- import { j as r } from "../../node_modules/react/jsx-runtime.es.js";
2
- import { OverlayArrow as T } from "../../node_modules/react-aria-components/dist/OverlayArrow.es.js";
3
- import { TooltipTrigger as g, Tooltip as j } from "../../node_modules/react-aria-components/dist/Tooltip.es.js";
4
- import { Focusable as $ } from "react-aria";
5
- import { useState as _, useRef as x } from "react";
6
- import { useTheme as v } from "../ThemeProvider.es.js";
1
+ import { j as t } from "../../node_modules/react/jsx-runtime.es.js";
2
+ import n from "react";
3
+ import { Tooltip as o } from "radix-ui";
4
+ import { useTheme as _ } from "../ThemeProvider.es.js";
7
5
  /* empty css */
8
6
  /* empty css */
9
- import { csx as d } from "../../utils/string.es.js";
10
- function w({ children: e, arrow: n, ...l }) {
11
- const { style: o, className: t } = v();
12
- return /* @__PURE__ */ r.jsxs(
13
- j,
14
- {
15
- ...l,
16
- className: d("proton__Tooltip", "proton-Dialog", t),
17
- style: o,
18
- children: [
19
- n && /* @__PURE__ */ r.jsx(T, { className: d("proton__TooltipArrow", t), children: /* @__PURE__ */ r.jsx("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ r.jsx("path", { d: "M0 0 L4 4 L8 0" }) }) }),
20
- e
21
- ]
22
- }
23
- );
24
- }
25
- function k({
7
+ import { csx as j } from "../../utils/string.es.js";
8
+ const T = n.forwardRef(
9
+ ({ content: l, children: e, arrow: s, placement: p = "top", "data-testid": d }, c) => {
10
+ const { style: i, className: r } = _();
11
+ return /* @__PURE__ */ t.jsxs(
12
+ o.Content,
13
+ {
14
+ ref: c,
15
+ side: p,
16
+ className: j("proton__Tooltip", "proton-Dialog", r),
17
+ style: i,
18
+ sideOffset: 8,
19
+ "data-testid": d,
20
+ children: [
21
+ l,
22
+ s && /* @__PURE__ */ t.jsx(
23
+ o.Arrow,
24
+ {
25
+ className: j("proton__Tooltip-arrow", r),
26
+ width: 8,
27
+ height: 8,
28
+ children: /* @__PURE__ */ t.jsx("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ t.jsx("path", { d: "M0 0 L4 4 L8 0" }) })
29
+ }
30
+ )
31
+ ]
32
+ }
33
+ );
34
+ }
35
+ );
36
+ T.displayName = "TooltipContent";
37
+ function N({
38
+ arrow: l = !0,
26
39
  children: e,
27
- // trigger props
28
- delay: n = 500,
29
- closeDelay: l = 500,
30
- isDisabled: o,
31
- defaultOpen: t,
32
- onOpenChange: c,
33
- disableTriggerClick: f,
34
- // tooltip props
35
- content: u,
36
- ...h
40
+ content: s,
41
+ delay: p = 100,
42
+ placement: d = "bottom",
43
+ isDisabled: c,
44
+ defaultOpen: i = !1,
45
+ onOpenChange: r,
46
+ disableTriggerClick: m,
47
+ "data-testid": g
37
48
  }) {
38
- const [a, s] = _(!1), i = x(!1), m = x(!1);
39
- return u === "" ? null : /* @__PURE__ */ r.jsxs(
40
- g,
49
+ const [u, h] = n.useState(i), a = n.useRef(!1), x = n.useRef(!1);
50
+ if (s === "") return null;
51
+ const w = (f) => {
52
+ f && !a.current && (x.current = !0), r && r(f), a.current || h(f), a.current = !1;
53
+ };
54
+ return /* @__PURE__ */ t.jsx(o.Provider, { children: /* @__PURE__ */ t.jsxs(
55
+ o.Root,
41
56
  {
42
- delay: n,
43
- closeDelay: l,
44
- isDisabled: o,
45
- isOpen: a,
46
- defaultOpen: t,
47
- onOpenChange: (p) => {
48
- p && !i.current && (m.current = !0), c && c(p), i.current || s(p), i.current = !1;
49
- },
57
+ open: u,
58
+ defaultOpen: i,
59
+ onOpenChange: w,
60
+ delayDuration: p,
50
61
  children: [
51
- f ? /* @__PURE__ */ r.jsx("span", { className: "proton__TooltipTrigger", "aria-label": "Show tooltip", children: e }) : /* @__PURE__ */ r.jsx($, { children: /* @__PURE__ */ r.jsx(
62
+ /* @__PURE__ */ t.jsx(o.Trigger, { asChild: !0, children: m ? /* @__PURE__ */ t.jsx("span", { className: "proton__TooltipTrigger", "aria-label": "Show tooltip", children: e }) : /* @__PURE__ */ t.jsx(
52
63
  "div",
53
64
  {
54
65
  role: "button",
55
66
  "aria-label": "Show tooltip",
56
67
  className: "proton__TooltipTrigger",
57
- "data-hovered": a,
58
- onMouseEnter: () => {
59
- o || s(!0);
60
- },
61
- onMouseLeave: () => {
62
- o || s(!1);
63
- },
68
+ "data-hovered": u,
64
69
  onClick: () => {
65
- f || o || m.current || (i.current = !0, s(!a));
70
+ m || c || x.current || (a.current = !0, h(!u));
66
71
  },
67
72
  children: e
68
73
  }
69
74
  ) }),
70
- /* @__PURE__ */ r.jsx(w, { ...h, children: u })
75
+ /* @__PURE__ */ t.jsx(o.Portal, { children: /* @__PURE__ */ t.jsx(
76
+ T,
77
+ {
78
+ content: s,
79
+ placement: d,
80
+ arrow: l,
81
+ "data-testid": g,
82
+ children: e
83
+ }
84
+ ) })
71
85
  ]
72
86
  }
73
- );
87
+ ) });
74
88
  }
89
+ N.displayName = "Tooltip";
75
90
  export {
76
- k as TooltipTrigger
91
+ N as Tooltip
77
92
  };
78
93
  //# sourceMappingURL=Tooltip.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.es.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n Tooltip as AriaTooltip,\r\n TooltipProps as AriaTooltipProps,\r\n TooltipTrigger as AriaTooltipTrigger,\r\n Focusable,\r\n OverlayArrow,\r\n TooltipTriggerComponentProps,\r\n} from \"react-aria-components\";\r\n\r\nimport { useRef, useState } from \"react\";\r\nimport { useTheme } from \"../ThemeProvider\";\r\n\r\nimport { csx } from \"../../utils\";\r\nimport \"../Dialog/Dialog.css\";\r\nimport \"./Tooltip.css\";\r\n\r\nexport interface TooltipProps extends Omit<AriaTooltipProps, \"children\"> {\r\n children: React.ReactNode;\r\n arrow?: boolean;\r\n}\r\n\r\nfunction Tooltip({ children, arrow, ...props }: TooltipProps) {\r\n const { style, className } = useTheme();\r\n\r\n return (\r\n <AriaTooltip\r\n {...props}\r\n className={csx(\"proton__Tooltip\", \"proton-Dialog\", className)}\r\n style={style as React.CSSProperties}\r\n >\r\n {arrow && (\r\n <OverlayArrow className={csx(\"proton__TooltipArrow\", className)}>\r\n <svg width={8} height={8} viewBox=\"0 0 8 8\">\r\n <path d=\"M0 0 L4 4 L8 0\" />\r\n </svg>\r\n </OverlayArrow>\r\n )}\r\n\r\n {children}\r\n </AriaTooltip>\r\n );\r\n}\r\n\r\nexport interface TooltipTriggerProps\r\n extends TooltipProps,\r\n TooltipTriggerComponentProps {\r\n children: React.ReactNode;\r\n /**\r\n * The content to display in the tooltip. Zero-length titles string are never displayed.\r\n */\r\n content: string | React.ReactNode;\r\n /**\r\n * Whether to disable the trigger click feature.\r\n */\r\n disableTriggerClick?: boolean;\r\n}\r\n\r\n/**\r\n * Proton's TooltipTrigger component deviates from the Aria TooltipTrigger in that on mobile,\r\n * the trigger also opens the tooltip on click as well as hover & focus. This is to improve\r\n * accessibility and usability on mobile.\r\n *\r\n * If you wish to disable the trigger click feature, you can set the `disableTriggerClick` prop.\r\n * This is useful when using an info only Tooltip that might wrap a clickable element.\r\n *\r\n * API:\r\n * - {@link TooltipTriggerProps}\r\n * - extends {@link TooltipProps}\r\n * - extends {@link TooltipTriggerComponentProps}\r\n *\r\n * @example\r\n * ```tsx\r\n <TooltipTrigger content={...} placement=\"top\" arrow isDisabled={disabled}>\r\n {children}\r\n </TooltipTrigger>\r\n * ```\r\n */\r\nexport function TooltipTrigger({\r\n children,\r\n // trigger props\r\n delay = 500,\r\n closeDelay = 500,\r\n isDisabled,\r\n defaultOpen,\r\n onOpenChange,\r\n disableTriggerClick,\r\n // tooltip props\r\n content,\r\n ...tooltipProps\r\n}: TooltipTriggerProps) {\r\n const [isOpen, setIsOpen] = useState(false);\r\n const triggerClickRef = useRef<boolean>(false);\r\n const hasHovered = useRef<boolean>(false);\r\n\r\n if (content === \"\") return null;\r\n\r\n return (\r\n <AriaTooltipTrigger\r\n delay={delay}\r\n closeDelay={closeDelay}\r\n isDisabled={isDisabled}\r\n isOpen={isOpen}\r\n defaultOpen={defaultOpen}\r\n onOpenChange={(openState) => {\r\n // When opened via hover, we want to disable the trigger click feature as it causes\r\n // the tooltip state to get out of sync with the trigger state.\r\n if (openState && !triggerClickRef.current) hasHovered.current = true;\r\n\r\n if (onOpenChange) onOpenChange(openState);\r\n\r\n // If the tooltip is clicked, it manually calls setIsOpen, so we don't want to call\r\n // it again here.\r\n if (!triggerClickRef.current) setIsOpen(openState);\r\n triggerClickRef.current = false;\r\n }}\r\n >\r\n {disableTriggerClick ? (\r\n <span className=\"proton__TooltipTrigger\" aria-label=\"Show tooltip\">\r\n {children}\r\n </span>\r\n ) : (\r\n <Focusable>\r\n <div\r\n role=\"button\"\r\n aria-label=\"Show tooltip\"\r\n className=\"proton__TooltipTrigger\"\r\n data-hovered={isOpen}\r\n onMouseEnter={() => {\r\n if (!isDisabled) {\r\n setIsOpen(true);\r\n }\r\n }}\r\n onMouseLeave={() => {\r\n if (!isDisabled) {\r\n setIsOpen(false);\r\n }\r\n }}\r\n onClick={() => {\r\n if (disableTriggerClick || isDisabled) return;\r\n\r\n // Once hovered it's safe to assume the user isn't trying to use via a touch device,\r\n // so we can safely disable the trigger click feature.\r\n if (hasHovered.current) return;\r\n\r\n triggerClickRef.current = true;\r\n setIsOpen(!isOpen);\r\n }}\r\n >\r\n {children}\r\n </div>\r\n </Focusable>\r\n )}\r\n <Tooltip {...tooltipProps}>{content}</Tooltip>\r\n </AriaTooltipTrigger>\r\n );\r\n}\r\n"],"names":["Tooltip","children","arrow","props","style","className","useTheme","jsxs","AriaTooltip","csx","jsx","OverlayArrow","TooltipTrigger","delay","closeDelay","isDisabled","defaultOpen","onOpenChange","disableTriggerClick","content","tooltipProps","isOpen","setIsOpen","useState","triggerClickRef","useRef","hasHovered","AriaTooltipTrigger","openState","Focusable"],"mappings":";;;;;;;;;AAuBA,SAASA,EAAQ,EAAE,UAAAC,GAAU,OAAAC,GAAO,GAAGC,KAAuB;AAC5D,QAAM,EAAE,OAAAC,GAAO,WAAAC,EAAU,IAAIC,EAAS;AAGpC,SAAAC,gBAAAA,EAAA;AAAA,IAACC;AAAAA,IAAA;AAAA,MACE,GAAGL;AAAA,MACJ,WAAWM,EAAI,mBAAmB,iBAAiBJ,CAAS;AAAA,MAC5D,OAAAD;AAAA,MAEC,UAAA;AAAA,QACCF,KAAAQ,gBAAAA,EAAA,IAACC,KAAa,WAAWF,EAAI,wBAAwBJ,CAAS,GAC5D,gCAAC,OAAI,EAAA,OAAO,GAAG,QAAQ,GAAG,SAAQ,WAChC,UAAAK,gBAAAA,EAAAA,IAAC,UAAK,GAAE,kBAAiB,GAC3B,EACF,CAAA;AAAA,QAGDT;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;AAoCO,SAASW,EAAe;AAAA,EAC7B,UAAAX;AAAA;AAAA,EAEA,OAAAY,IAAQ;AAAA,EACR,YAAAC,IAAa;AAAA,EACb,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,qBAAAC;AAAA;AAAA,EAEA,SAAAC;AAAA,EACA,GAAGC;AACL,GAAwB;AACtB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAkBC,EAAgB,EAAK,GACvCC,IAAaD,EAAgB,EAAK;AAEpC,SAAAN,MAAY,KAAW,OAGzBZ,gBAAAA,EAAA;AAAA,IAACoB;AAAAA,IAAA;AAAA,MACC,OAAAd;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,QAAAM;AAAA,MACA,aAAAL;AAAA,MACA,cAAc,CAACY,MAAc;AAG3B,QAAIA,KAAa,CAACJ,EAAgB,cAAoB,UAAU,KAE5DP,OAA2BW,CAAS,GAInCJ,EAAgB,WAASF,EAAUM,CAAS,GACjDJ,EAAgB,UAAU;AAAA,MAC5B;AAAA,MAEC,UAAA;AAAA,QACCN,IAAAR,gBAAAA,EAAAA,IAAC,UAAK,WAAU,0BAAyB,cAAW,gBACjD,UAAAT,EACH,CAAA,IAEAS,gBAAAA,EAAAA,IAACmB,GACC,EAAA,UAAAnB,gBAAAA,EAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,WAAU;AAAA,YACV,gBAAcW;AAAA,YACd,cAAc,MAAM;AAClB,cAAKN,KACHO,EAAU,EAAI;AAAA,YAElB;AAAA,YACA,cAAc,MAAM;AAClB,cAAKP,KACHO,EAAU,EAAK;AAAA,YAEnB;AAAA,YACA,SAAS,MAAM;AACb,cAAIJ,KAAuBH,KAIvBW,EAAW,YAEfF,EAAgB,UAAU,IAC1BF,EAAU,CAACD,CAAM;AAAA,YACnB;AAAA,YAEC,UAAApB;AAAA,UAAA;AAAA,QAAA,GAEL;AAAA,QAEDS,gBAAAA,EAAA,IAAAV,GAAA,EAAS,GAAGoB,GAAe,UAAQD,EAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG1C;"}
1
+ {"version":3,"file":"Tooltip.es.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React, { ReactNode } from \"react\";\r\nimport { Tooltip as RadixTooltip } from \"radix-ui\";\r\nimport { useTheme } from \"../ThemeProvider\";\r\nimport { csx } from \"../../utils\";\r\nimport \"../Dialog/Dialog.css\";\r\nimport \"./Tooltip.css\";\r\n\r\nexport type TooltipPlacement = \"top\" | \"bottom\" | \"left\" | \"right\";\r\n\r\nexport interface TooltipContentProps {\r\n content: string | ReactNode;\r\n children: ReactNode;\r\n arrow?: boolean;\r\n placement?: TooltipPlacement;\r\n \"data-testid\"?: string;\r\n}\r\n\r\nconst TooltipContent = React.forwardRef<HTMLDivElement, TooltipContentProps>(\r\n (\r\n { content, children, arrow, placement = \"top\", \"data-testid\": testId },\r\n ref\r\n ) => {\r\n const { style, className } = useTheme();\r\n\r\n return (\r\n <RadixTooltip.Content\r\n ref={ref}\r\n side={placement}\r\n className={csx(\"proton__Tooltip\", \"proton-Dialog\", className)}\r\n style={style as React.CSSProperties}\r\n sideOffset={8}\r\n data-testid={testId}\r\n >\r\n {content}\r\n {arrow && (\r\n <RadixTooltip.Arrow\r\n className={csx(\"proton__Tooltip-arrow\", className)}\r\n width={8}\r\n height={8}\r\n >\r\n <svg width={8} height={8} viewBox=\"0 0 8 8\">\r\n <path d=\"M0 0 L4 4 L8 0\" />\r\n </svg>\r\n </RadixTooltip.Arrow>\r\n )}\r\n </RadixTooltip.Content>\r\n );\r\n }\r\n);\r\n\r\nTooltipContent.displayName = \"TooltipContent\";\r\n\r\nexport interface TooltipProps {\r\n /**\r\n * Whether to show an arrow pointing to the tooltip.\r\n * @default true\r\n */\r\n arrow?: boolean;\r\n /**\r\n * The children to display in the tooltip.\r\n */\r\n children: React.ReactNode;\r\n /**\r\n * The content to display in the tooltip. Zero-length titles string are never displayed.\r\n */\r\n content: string | React.ReactNode;\r\n /**\r\n * A test ID.\r\n */\r\n \"data-testid\"?: string;\r\n /**\r\n * The placement of the tooltip.\r\n * @default \"bottom\"\r\n */\r\n placement?: TooltipPlacement;\r\n /**\r\n * Whether to disable the trigger click feature.\r\n * This is useful when using an info only Tooltip that might wrap a clickable element.\r\n */\r\n disableTriggerClick?: boolean;\r\n /**\r\n * Whether the tooltip is disabled.\r\n */\r\n isDisabled?: boolean;\r\n /**\r\n * Delay before showing the tooltip (in milliseconds).\r\n * @default 100\r\n */\r\n delay?: number;\r\n /**\r\n * Whether the tooltip is open by default.\r\n * @default false\r\n */\r\n defaultOpen?: boolean;\r\n /**\r\n * The callback function to call when the tooltip is opened or closed.\r\n */\r\n onOpenChange?: (open: boolean) => void;\r\n}\r\n\r\n/**\r\n * A component that displays a tooltip when the user hovers over the trigger.\r\n * For mobile, use Popover instead.\r\n * API:\r\n * - {@link TooltipTriggerProps}\r\n *\r\n * @example\r\n * ```tsx\r\n <Tooltipcontent={...} placement=\"top\" arrow isDisabled={disabled}>\r\n {children}\r\n </Tooltip>\r\n * ```\r\n */\r\nexport function Tooltip({\r\n arrow = true,\r\n children,\r\n content,\r\n delay = 100,\r\n placement = \"bottom\",\r\n isDisabled,\r\n defaultOpen = false,\r\n onOpenChange,\r\n disableTriggerClick,\r\n \"data-testid\": testId,\r\n}: TooltipProps) {\r\n const [isOpen, setIsOpen] = React.useState(defaultOpen);\r\n const triggerClickRef = React.useRef<boolean>(false);\r\n const hasHovered = React.useRef<boolean>(false);\r\n\r\n if (content === \"\") return null;\r\n\r\n const handleOpenChange = (openState: boolean) => {\r\n // When opened via hover, we want to disable the trigger click feature as it causes\r\n // the tooltip state to get out of sync with the trigger state.\r\n if (openState && !triggerClickRef.current) hasHovered.current = true;\r\n\r\n if (onOpenChange) onOpenChange(openState);\r\n\r\n // If the tooltip is clicked, it manually calls setIsOpen, so we don't want to call\r\n // it again here.\r\n if (!triggerClickRef.current) setIsOpen(openState);\r\n triggerClickRef.current = false;\r\n };\r\n\r\n return (\r\n <RadixTooltip.Provider>\r\n <RadixTooltip.Root\r\n open={isOpen}\r\n defaultOpen={defaultOpen}\r\n onOpenChange={handleOpenChange}\r\n delayDuration={delay}\r\n >\r\n <RadixTooltip.Trigger asChild>\r\n {disableTriggerClick ? (\r\n <span className=\"proton__TooltipTrigger\" aria-label=\"Show tooltip\">\r\n {children}\r\n </span>\r\n ) : (\r\n <div\r\n role=\"button\"\r\n aria-label=\"Show tooltip\"\r\n className=\"proton__TooltipTrigger\"\r\n data-hovered={isOpen}\r\n onClick={() => {\r\n if (disableTriggerClick || isDisabled) return;\r\n\r\n // Once hovered it's safe to assume the user isn't trying to use via a touch device,\r\n // so we can safely disable the trigger click feature.\r\n if (hasHovered.current) return;\r\n\r\n triggerClickRef.current = true;\r\n setIsOpen(!isOpen);\r\n }}\r\n >\r\n {children}\r\n </div>\r\n )}\r\n </RadixTooltip.Trigger>\r\n <RadixTooltip.Portal>\r\n <TooltipContent\r\n content={content}\r\n placement={placement}\r\n arrow={arrow}\r\n data-testid={testId}\r\n >\r\n {children}\r\n </TooltipContent>\r\n </RadixTooltip.Portal>\r\n </RadixTooltip.Root>\r\n </RadixTooltip.Provider>\r\n );\r\n}\r\n\r\nTooltip.displayName = \"Tooltip\";\r\n"],"names":["TooltipContent","React","content","children","arrow","placement","testId","ref","style","className","useTheme","jsxs","RadixTooltip","csx","jsx","Tooltip","delay","isDisabled","defaultOpen","onOpenChange","disableTriggerClick","isOpen","setIsOpen","triggerClickRef","hasHovered","handleOpenChange","openState"],"mappings":";;;;;;;AAmBA,MAAMA,IAAiBC,EAAM;AAAA,EAC3B,CACE,EAAE,SAAAC,GAAS,UAAAC,GAAU,OAAAC,GAAO,WAAAC,IAAY,OAAO,eAAeC,EAAO,GACrEC,MACG;AACH,UAAM,EAAE,OAAAC,GAAO,WAAAC,EAAU,IAAIC,EAAS;AAGpC,WAAAC,gBAAAA,EAAA;AAAA,MAACC,EAAa;AAAA,MAAb;AAAA,QACC,KAAAL;AAAA,QACA,MAAMF;AAAA,QACN,WAAWQ,EAAI,mBAAmB,iBAAiBJ,CAAS;AAAA,QAC5D,OAAAD;AAAA,QACA,YAAY;AAAA,QACZ,eAAaF;AAAA,QAEZ,UAAA;AAAA,UAAAJ;AAAA,UACAE,KACCU,gBAAAA,EAAA;AAAA,YAACF,EAAa;AAAA,YAAb;AAAA,cACC,WAAWC,EAAI,yBAAyBJ,CAAS;AAAA,cACjD,OAAO;AAAA,cACP,QAAQ;AAAA,cAER,UAACK,gBAAAA,EAAA,IAAA,OAAA,EAAI,OAAO,GAAG,QAAQ,GAAG,SAAQ,WAChC,UAACA,gBAAAA,EAAAA,IAAA,QAAA,EAAK,GAAE,iBAAiB,CAAA,GAC3B;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAd,EAAe,cAAc;AA+DtB,SAASe,EAAQ;AAAA,EACtB,OAAAX,IAAQ;AAAA,EACR,UAAAD;AAAA,EACA,SAAAD;AAAA,EACA,OAAAc,IAAQ;AAAA,EACR,WAAAX,IAAY;AAAA,EACZ,YAAAY;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,eAAed;AACjB,GAAiB;AACf,QAAM,CAACe,GAAQC,CAAS,IAAIrB,EAAM,SAASiB,CAAW,GAChDK,IAAkBtB,EAAM,OAAgB,EAAK,GAC7CuB,IAAavB,EAAM,OAAgB,EAAK;AAE1C,MAAAC,MAAY,GAAW,QAAA;AAErB,QAAAuB,IAAmB,CAACC,MAAuB;AAG/C,IAAIA,KAAa,CAACH,EAAgB,cAAoB,UAAU,KAE5DJ,OAA2BO,CAAS,GAInCH,EAAgB,WAASD,EAAUI,CAAS,GACjDH,EAAgB,UAAU;AAAA,EAAA;AAI1B,SAAAT,gBAAAA,EAAA,IAACF,EAAa,UAAb,EACC,UAAAD,gBAAAA,EAAA;AAAA,IAACC,EAAa;AAAA,IAAb;AAAA,MACC,MAAMS;AAAA,MACN,aAAAH;AAAA,MACA,cAAcO;AAAA,MACd,eAAeT;AAAA,MAEf,UAAA;AAAA,QAAAF,gBAAAA,EAAA,IAACF,EAAa,SAAb,EAAqB,SAAO,IAC1B,UAAAQ,IACEN,gBAAAA,EAAAA,IAAA,QAAA,EAAK,WAAU,0BAAyB,cAAW,gBACjD,UAAAX,EACH,CAAA,IAEAW,gBAAAA,EAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,WAAU;AAAA,YACV,gBAAcO;AAAA,YACd,SAAS,MAAM;AACb,cAAID,KAAuBH,KAIvBO,EAAW,YAEfD,EAAgB,UAAU,IAC1BD,EAAU,CAACD,CAAM;AAAA,YACnB;AAAA,YAEC,UAAAlB;AAAA,UAAA;AAAA,QAAA,GAGP;AAAA,QACAW,gBAAAA,EAAAA,IAACF,EAAa,QAAb,EACC,UAAAE,gBAAAA,EAAA;AAAA,UAACd;AAAA,UAAA;AAAA,YACC,SAAAE;AAAA,YACA,WAAAG;AAAA,YACA,OAAAD;AAAA,YACA,eAAaE;AAAA,YAEZ,UAAAH;AAAA,UAAA;AAAA,QAAA,GAEL;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;AAEAY,EAAQ,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../node_modules/react/jsx-runtime.cjs.js"),v=require("react"),H=require("../ThemeProvider.cjs.js");;/* empty css */const L=require("./WaveformBar.cjs.js"),$=require("../../utils/string.cjs.js"),X=K(100);function F({data:e,resolution:t=2,startDuration:s,endDuration:a,currentTime:m=0,showTimestamps:g=!1,totalDuration:l,disabled:f,disabledMessage:d,onClick:h,"data-testid":p}){var P;const{className:_}=H.useTheme(),o=v.useRef(null),[W,B]=v.useState([]),[j,b]=v.useState(null),[w,I]=v.useState(!1),[N,q]=v.useState(!1),y=e||X,M=t;v.useEffect(()=>{if(!o.current)return;const r=i=>{const x=Math.floor(i/(t+M)),R=G(y,x);B(R)},n=o.current.clientWidth;r(n);const c=new ResizeObserver(i=>{i&&i[0]&&r(i[0].contentRect.width)});return c.observe(o.current),()=>c.disconnect()},[y,t,M]),v.useEffect(()=>{const r=setTimeout(()=>I(!0),50),n=setTimeout(()=>q(!0),500);return()=>{clearTimeout(r),clearTimeout(n)}},[]);const A=r=>{if(!o.current)return;const n=o.current.getBoundingClientRect(),i=(r.clientX-n.left)/n.width*l;b(i)},z=()=>{b(null)},O=t+M,E=(r,n)=>{var x;const c=r/l*100;return(n==="start"?Math.floor(c/100*W.length):Math.ceil(c/100*W.length))*O/((x=o.current)==null?void 0:x.clientWidth)*100},V=(P=o.current)==null?void 0:P.clientWidth,S=v.useMemo(()=>f&&d?d:e?null:"Waveform Unavailable",[f,d,e]);return u.jsxRuntimeExports.jsxs("div",{className:$.csx("proton-Waveform",_),"data-testid":p,children:[g&&u.jsxRuntimeExports.jsx(T,{direction:"left",seconds:m}),u.jsxRuntimeExports.jsxs("div",{ref:o,className:"proton-Waveform__container",onMouseMove:A,onMouseLeave:z,onClick:r=>{if(!o.current||f)return;const n=o.current.getBoundingClientRect(),i=(r.clientX-n.left)/n.width*l;h==null||h(i,r)},"data-disabled":f,"data-testid":"waveform-container",children:[s!==void 0&&a!==void 0&&u.jsxRuntimeExports.jsx("div",{className:"proton-Waveform__active-region",style:{left:o.current?`calc(${E(s,"start")}%`:"0%",right:o.current?`calc(${100-E(a,"end")}% - 2px)`:"0%"}}),j!==null&&u.jsxRuntimeExports.jsx("div",{className:"proton-Waveform__hover-line",style:{left:`${j/l*100}%`}}),W.map((r,n)=>{const c=n/W.length*l,i=s!==void 0&&a!==void 0&&(c<s||c>a),x=m===0?!1:c<=m,R=j!==null&&c<=j;return u.jsxRuntimeExports.jsx(L.WaveformBar,{amplitude:r,isDisabled:f||i,isPlayed:x,isHovered:R,isVisible:w,hasAnimated:N,resolution:t,spacing:M,index:n},n)})]}),S&&u.jsxRuntimeExports.jsx("div",{className:"proton-Waveform__bar-unavailable",style:{fontSize:V<325?"0.85rem":"1rem"},children:S}),g&&u.jsxRuntimeExports.jsx(T,{direction:"right",seconds:l})]})}function T({direction:e,seconds:t}){return u.jsxRuntimeExports.jsx("div",{className:$.csx("proton-Waveform__timestamp",`proton-Waveform__timestamp--${e}`),children:U(t)})}function U(e){const t=Math.floor(e/60),s=Math.floor(e%60);return`${t}:${s<10?"0":""}${s.toFixed(0)}`}function G(e,t){const s=e.length,a=s/t,m=new Array(t).fill(0).map((g,l)=>{const f=l*a,d=Math.floor(f),h=Math.min(d+1,s-1),p=f-d;return e[d]*(1-p)+e[h]*p});return J(m)}function J(e){const t=Math.min(...e),s=Math.max(...e);return e.map(a=>{const m=(a-t)/(s-t);return Math.max(m*.8+.1,.1)})}function K(e){return Array.from({length:e},(t,s)=>{const m=s/(e-1)*6*2*Math.PI-Math.PI/2;return Math.sin(m)*.5+.5})}exports.Waveform=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../node_modules/react/jsx-runtime.cjs.js"),v=require("react"),H=require("../ThemeProvider.cjs.js");;/* empty css */const L=require("./WaveformBar.cjs.js"),T=require("../../utils/string.cjs.js"),X=K(100);function F({data:e,resolution:t=2,startDuration:s,endDuration:a,currentTime:m=0,showTimestamps:g=!1,totalDuration:l,disabled:f,disabledMessage:d,onClick:h,"data-testid":p}){var P;const{className:_}=H.useTheme(),o=v.useRef(null),[W,$]=v.useState([]),[j,y]=v.useState(null),[w,I]=v.useState(!1),[N,q]=v.useState(!1),E=e||X,M=t;v.useEffect(()=>{if(!o.current)return;const r=i=>{const x=Math.floor(i/(t+M)),R=G(E,x);$(R)},n=o.current.clientWidth;r(n);const c=new ResizeObserver(i=>{i&&i[0]&&r(i[0].contentRect.width)});return c.observe(o.current),()=>c.disconnect()},[E,t,M]),v.useEffect(()=>{const r=setTimeout(()=>I(!0),50),n=setTimeout(()=>q(!0),500);return()=>{clearTimeout(r),clearTimeout(n)}},[]);const A=r=>{if(!o.current)return;const n=o.current.getBoundingClientRect(),i=(r.clientX-n.left)/n.width*l;y(i)},z=()=>{y(null)},O=t+M,b=(r,n)=>{var x;const c=r/l*100;return(n==="start"?Math.floor(c/100*W.length):Math.ceil(c/100*W.length))*O/((x=o.current)==null?void 0:x.clientWidth)*100},V=(P=o.current)==null?void 0:P.clientWidth,B=v.useMemo(()=>f&&d?d:e?null:"Waveform Unavailable",[f,d,e]);return u.jsxRuntimeExports.jsxs("div",{className:T.csx("proton-Waveform",_),"data-testid":p,children:[g&&u.jsxRuntimeExports.jsx(S,{direction:"left",seconds:m}),u.jsxRuntimeExports.jsxs("div",{ref:o,className:"proton-Waveform__container",onMouseMove:A,onMouseLeave:z,onClick:r=>{if(!o.current||f)return;const n=o.current.getBoundingClientRect(),i=(r.clientX-n.left)/n.width*l;h==null||h(i,r)},"data-disabled":f,"data-testid":"waveform-container",children:[s!==void 0&&a!==void 0&&u.jsxRuntimeExports.jsx("div",{className:"proton-Waveform__active-region",style:{left:o.current?`calc(${b(s,"start")}%`:"0%",right:o.current?`calc(${100-b(a,"end")}% - 2px)`:"0%"}}),j!==null&&u.jsxRuntimeExports.jsx("div",{className:"proton-Waveform__hover-line",style:{left:`${j/l*100}%`}}),W.map((r,n)=>{const c=n/W.length*l,i=s!==void 0&&a!==void 0&&(c<s||c>a),x=m===0?!1:c<=m,R=j!==null&&c<=j;return u.jsxRuntimeExports.jsx(L.WaveformBar,{amplitude:r,isDisabled:f||i,isPlayed:x,isHovered:R,isVisible:w,hasAnimated:N,resolution:t,spacing:M,index:n},n)})]}),B&&u.jsxRuntimeExports.jsx("div",{className:"proton-Waveform__bar-unavailable",style:{fontSize:V<325?"0.85rem":"1rem"},children:B}),g&&u.jsxRuntimeExports.jsx(S,{direction:"right",seconds:l})]})}function S({direction:e,seconds:t}){return u.jsxRuntimeExports.jsx("div",{className:T.csx("proton-Waveform__timestamp",`proton-Waveform__timestamp--${e}`),children:U(t)})}function U(e){const t=Math.floor(e/60),s=Math.floor(e%60);return`${t}:${s<10?"0":""}${s.toFixed(0)}`}function G(e,t){const s=e.length,a=s/t,m=new Array(t).fill(0).map((g,l)=>{const f=l*a,d=Math.floor(f),h=Math.min(d+1,s-1),p=f-d;return e[d]*(1-p)+e[h]*p});return J(m)}function J(e){const t=Math.min(...e),s=Math.max(...e);return e.map(a=>{const m=(a-t)/(s-t);return Math.max(m*.8+.1,.1)})}function K(e){return Array.from({length:e},(t,s)=>{const m=s/(e-1)*6*2*Math.PI-Math.PI/2;return Math.sin(m)*.5+.5})}exports.Waveform=F;
2
2
  //# sourceMappingURL=Waveform.cjs.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");function c(t,i="down"){const e=i==="down"?`(max-width: ${t}px)`:`(min-width: ${t}px)`,[o,r]=d.useState(()=>typeof window<"u"?window.matchMedia(e).matches:!1);return d.useEffect(()=>{if(typeof window>"u")return;const n=window.matchMedia(e),a=s=>{r(s.matches)};return n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[e]),o}exports.useBreakpoint=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react");function c(t,d="down"){const e=d==="down"?`(max-width: ${t}px)`:`(min-width: ${t}px)`,[o,r]=a.useState(()=>typeof window<"u"?window.matchMedia(e).matches:!1);return a.useEffect(()=>{if(typeof window>"u")return;const n=window.matchMedia(e),i=s=>{r(s.matches)};return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e]),o}exports.useBreakpoint=c;
2
2
  //# sourceMappingURL=useBreakpoint.cjs.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react");function g({duration:i=200,onClose:t,overlayRef:e}){const[r,c]=s.useState(!1),[u,n]=s.useState(),a=s.useCallback(()=>{if(i<=0){console.warn("useIsClosing: Duration must be positive. Executing onClose immediately."),t==null||t();return}c(!0),e!=null&&e.current&&e.current.classList.add("proton-ScreenOverlay__fade-out");const d=setTimeout(()=>{t==null||t(),c(!1)},i);n(d)},[i,t,e]);return s.useEffect(()=>()=>{u&&clearTimeout(u)},[u]),{isClosing:r,handleClose:a}}exports.useIsClosing=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react");function d({duration:i=200,onClose:t,overlayRef:e}){const[r,c]=s.useState(!1),[u,n]=s.useState(),a=s.useCallback(()=>{if(i<=0){console.warn("useIsClosing: Duration must be positive. Executing onClose immediately."),t==null||t();return}c(!0),e!=null&&e.current&&e.current.classList.add("proton-ScreenOverlay__fade-out");const g=setTimeout(()=>{t==null||t(),c(!1)},i);n(g)},[i,t,e]);return s.useEffect(()=>()=>{u&&clearTimeout(u)},[u]),{isClosing:r,handleClose:a}}exports.useIsClosing=d;
2
2
  //# sourceMappingURL=useIsClosing.cjs.js.map
package/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./components/ActionMenu/ActionMenu.cjs.js"),r=require("./components/Badge/Badge.cjs.js"),e=require("./components/Banner/Banner.cjs.js"),t=require("./components/Button/Button.cjs.js"),i=require("./components/ButtonGroup/ButtonGroup.cjs.js"),u=require("./components/ButtonWithSelect/ButtonWithSelect.cjs.js"),a=require("./components/DataTable/DataTable.cjs.js"),c=require("./components/Dialog/Dialog.cjs.js"),s=require("./components/Elevation/Elevation.cjs.js"),l=require("./components/Icon/Icon.cjs.js"),T=require("./components/ImageBackground/ImageBackground.cjs.js"),p=require("./components/Input/BaseInput/Input.cjs.js"),B=require("./components/Input/CopyInput/CopyInput.cjs.js"),q=require("./components/Input/SearchInput/SearchInput.cjs.js"),g=require("./components/Menu/MenuTrigger.cjs.js"),S=require("./components/Modal/Modal.cjs.js"),I=require("./components/Popover/Popover.cjs.js"),m=require("./components/ScreenOverlay/ScreenOverlay.cjs.js"),h=require("./components/Select/Select.cjs.js"),d=require("./components/Switch/Switch.cjs.js"),v=require("./components/Table/Table.cjs.js"),E=require("./components/Text/TextEllipsis/TextEllipsis.cjs.js"),N=require("./components/Text/TextEmphasis/TextEmphasis.cjs.js"),o=require("./components/ThemeProvider.cjs.js"),b=require("./components/Tombstone/Tombstone.cjs.js"),A=require("./components/Tooltip/Tooltip.cjs.js"),M=require("./components/Waveform/Waveform.cjs.js");exports.ActionMenu=n.ActionMenu;exports.Badge=r.Badge;exports.BadgeVariants=r.BadgeVariants;exports.BANNER_ICONS=e.BANNER_ICONS;exports.BANNER_VARIANTS=e.BANNER_VARIANTS;exports.Banner=e.Banner;exports.Button=t.Button;exports.ButtonSizes=t.ButtonSizes;exports.ButtonVariants=t.ButtonVariants;exports.ButtonGroup=i.ButtonGroup;exports.ButtonWithSelect=u.ButtonWithSelect;exports.DataTable=a.DataTable;exports.Dialog=c.Dialog;exports.Elevation=s.Elevation;exports.Icon=l.Icon;exports.ImageBackground=T.ImageBackground;exports.Input=p.Input;exports.CopyInput=B.CopyInput;exports.SearchInput=q.SearchInput;exports.MenuTrigger=g.MenuTrigger;exports.Modal=S.Modal;exports.Popover=I.Popover;exports.ScreenOverlay=m.ScreenOverlay;exports.Select=h.Select;exports.Switch=d.Switch;exports.Table=v.Table;exports.TextEllipsis=E.TextEllipsis;exports.TextEmphasis=N.TextEmphasis;exports.ThemeProvider=o.ThemeProvider;exports.useTheme=o.useTheme;exports.Tombstone=b.Tombstone;exports.TooltipTrigger=A.TooltipTrigger;exports.Waveform=M.Waveform;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./components/ActionMenu/ActionMenu.cjs.js"),r=require("./components/Badge/Badge.cjs.js"),e=require("./components/Banner/Banner.cjs.js"),t=require("./components/Button/Button.cjs.js"),i=require("./components/ButtonGroup/ButtonGroup.cjs.js"),u=require("./components/ButtonWithSelect/ButtonWithSelect.cjs.js"),a=require("./components/DataTable/DataTable.cjs.js"),c=require("./components/Dialog/Dialog.cjs.js"),s=require("./components/Elevation/Elevation.cjs.js"),l=require("./components/Icon/Icon.cjs.js"),T=require("./components/ImageBackground/ImageBackground.cjs.js"),p=require("./components/Input/BaseInput/Input.cjs.js"),B=require("./components/Input/CopyInput/CopyInput.cjs.js"),q=require("./components/Input/SearchInput/SearchInput.cjs.js"),S=require("./components/Menu/MenuTrigger.cjs.js"),g=require("./components/Modal/Modal.cjs.js"),I=require("./components/Popover/Popover.cjs.js"),m=require("./components/ScreenOverlay/ScreenOverlay.cjs.js"),h=require("./components/Select/Select.cjs.js"),d=require("./components/Switch/Switch.cjs.js"),v=require("./components/Table/Table.cjs.js"),E=require("./components/Text/TextEllipsis/TextEllipsis.cjs.js"),N=require("./components/Text/TextEmphasis/TextEmphasis.cjs.js"),o=require("./components/ThemeProvider.cjs.js"),b=require("./components/Tombstone/Tombstone.cjs.js"),A=require("./components/Tooltip/Tooltip.cjs.js"),M=require("./components/Waveform/Waveform.cjs.js");exports.ActionMenu=n.ActionMenu;exports.Badge=r.Badge;exports.BadgeVariants=r.BadgeVariants;exports.BANNER_ICONS=e.BANNER_ICONS;exports.BANNER_VARIANTS=e.BANNER_VARIANTS;exports.Banner=e.Banner;exports.Button=t.Button;exports.ButtonSizes=t.ButtonSizes;exports.ButtonVariants=t.ButtonVariants;exports.ButtonGroup=i.ButtonGroup;exports.ButtonWithSelect=u.ButtonWithSelect;exports.DataTable=a.DataTable;exports.Dialog=c.Dialog;exports.Elevation=s.Elevation;exports.Icon=l.Icon;exports.ImageBackground=T.ImageBackground;exports.Input=p.Input;exports.CopyInput=B.CopyInput;exports.SearchInput=q.SearchInput;exports.MenuTrigger=S.MenuTrigger;exports.Modal=g.Modal;exports.Popover=I.Popover;exports.ScreenOverlay=m.ScreenOverlay;exports.Select=h.Select;exports.Switch=d.Switch;exports.Table=v.Table;exports.TextEllipsis=E.TextEllipsis;exports.TextEmphasis=N.TextEmphasis;exports.ThemeProvider=o.ThemeProvider;exports.useTheme=o.useTheme;exports.Tombstone=b.Tombstone;exports.Tooltip=A.Tooltip;exports.Waveform=M.Waveform;
2
2
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -8,8 +8,6 @@ import { ReactElement } from 'react';
8
8
  import { ReactNode } from 'react';
9
9
  import { RefAttributes } from 'react';
10
10
  import { Selection as Selection_2 } from '@react-types/shared';
11
- import { TooltipProps as TooltipProps_2 } from 'react-aria-components';
12
- import { TooltipTriggerComponentProps } from 'react-aria-components';
13
11
 
14
12
  /**
15
13
  * A controlled ActionMenu to display a menu of actions.
@@ -1149,11 +1147,10 @@ declare interface TextEllipsisProps {
1149
1147
  *
1150
1148
  * API:
1151
1149
  * - {@link TextEmphasisProps}
1152
- * - extends {@link React.HTMLAttributes}
1153
1150
  */
1154
1151
  export declare const TextEmphasis: ({ to, children, tooltipProps, "data-testid": testId, }: TextEmphasisProps) => JSX_2.Element;
1155
1152
 
1156
- declare interface TextEmphasisProps extends React.HTMLAttributes<HTMLSpanElement> {
1153
+ declare interface TextEmphasisProps {
1157
1154
  /**
1158
1155
  * The URL that the text emphasis should link to. Turns the element into an `a` tag.
1159
1156
  */
@@ -1165,7 +1162,7 @@ declare interface TextEmphasisProps extends React.HTMLAttributes<HTMLSpanElement
1165
1162
  /**
1166
1163
  * Props to pass to the tooltip trigger. When provided, the text emphasis will be wrapped in a tooltip trigger.
1167
1164
  */
1168
- tooltipProps?: Omit<TooltipTriggerProps, "children">;
1165
+ tooltipProps?: Omit<TooltipProps, "children">;
1169
1166
  /**
1170
1167
  * A test ID.
1171
1168
  */
@@ -1219,43 +1216,73 @@ declare interface TombstoneProps {
1219
1216
  width?: string;
1220
1217
  }
1221
1218
 
1222
- export declare interface TooltipProps extends Omit<TooltipProps_2, "children"> {
1223
- children: React.ReactNode;
1224
- arrow?: boolean;
1225
- }
1226
-
1227
1219
  /**
1228
- * Proton's TooltipTrigger component deviates from the Aria TooltipTrigger in that on mobile,
1229
- * the trigger also opens the tooltip on click as well as hover & focus. This is to improve
1230
- * accessibility and usability on mobile.
1231
- *
1232
- * If you wish to disable the trigger click feature, you can set the `disableTriggerClick` prop.
1233
- * This is useful when using an info only Tooltip that might wrap a clickable element.
1234
- *
1220
+ * A component that displays a tooltip when the user hovers over the trigger.
1221
+ * For mobile, use Popover instead.
1235
1222
  * API:
1236
1223
  * - {@link TooltipTriggerProps}
1237
- * - extends {@link TooltipProps}
1238
- * - extends {@link TooltipTriggerComponentProps}
1239
1224
  *
1240
1225
  * @example
1241
1226
  * ```tsx
1242
- <TooltipTrigger content={...} placement="top" arrow isDisabled={disabled}>
1227
+ <Tooltipcontent={...} placement="top" arrow isDisabled={disabled}>
1243
1228
  {children}
1244
- </TooltipTrigger>
1229
+ </Tooltip>
1245
1230
  * ```
1246
1231
  */
1247
- export declare function TooltipTrigger({ children, delay, closeDelay, isDisabled, defaultOpen, onOpenChange, disableTriggerClick, content, ...tooltipProps }: TooltipTriggerProps): JSX_2.Element;
1232
+ export declare function Tooltip({ arrow, children, content, delay, placement, isDisabled, defaultOpen, onOpenChange, disableTriggerClick, "data-testid": testId, }: TooltipProps): JSX_2.Element;
1248
1233
 
1249
- export declare interface TooltipTriggerProps extends TooltipProps, TooltipTriggerComponentProps {
1250
- children: React.ReactNode;
1234
+ export declare namespace Tooltip {
1235
+ var displayName: string;
1236
+ }
1237
+
1238
+ export declare type TooltipPlacement = "top" | "bottom" | "left" | "right";
1239
+
1240
+ declare interface TooltipProps {
1241
+ /**
1242
+ * Whether to show an arrow pointing to the tooltip.
1243
+ * @default true
1244
+ */
1245
+ arrow?: boolean;
1246
+ /**
1247
+ * The children to display in the tooltip.
1248
+ */
1249
+ children: default_2.ReactNode;
1251
1250
  /**
1252
1251
  * The content to display in the tooltip. Zero-length titles string are never displayed.
1253
1252
  */
1254
- content: string | React.ReactNode;
1253
+ content: string | default_2.ReactNode;
1254
+ /**
1255
+ * A test ID.
1256
+ */
1257
+ "data-testid"?: string;
1258
+ /**
1259
+ * The placement of the tooltip.
1260
+ * @default "bottom"
1261
+ */
1262
+ placement?: TooltipPlacement;
1255
1263
  /**
1256
1264
  * Whether to disable the trigger click feature.
1265
+ * This is useful when using an info only Tooltip that might wrap a clickable element.
1257
1266
  */
1258
1267
  disableTriggerClick?: boolean;
1268
+ /**
1269
+ * Whether the tooltip is disabled.
1270
+ */
1271
+ isDisabled?: boolean;
1272
+ /**
1273
+ * Delay before showing the tooltip (in milliseconds).
1274
+ * @default 100
1275
+ */
1276
+ delay?: number;
1277
+ /**
1278
+ * Whether the tooltip is open by default.
1279
+ * @default false
1280
+ */
1281
+ defaultOpen?: boolean;
1282
+ /**
1283
+ * The callback function to call when the tooltip is opened or closed.
1284
+ */
1285
+ onOpenChange?: (open: boolean) => void;
1259
1286
  }
1260
1287
 
1261
1288
  export declare const useTheme: () => ThemeContextType;
package/dist/index.es.js CHANGED
@@ -2,8 +2,8 @@ import { ActionMenu as e } from "./components/ActionMenu/ActionMenu.es.js";
2
2
  import { Badge as p, BadgeVariants as m } from "./components/Badge/Badge.es.js";
3
3
  import { BANNER_ICONS as f, BANNER_VARIANTS as a, Banner as n } from "./components/Banner/Banner.es.js";
4
4
  import { Button as u, ButtonSizes as l, ButtonVariants as B } from "./components/Button/Button.es.js";
5
- import { ButtonGroup as g } from "./components/ButtonGroup/ButtonGroup.es.js";
6
- import { ButtonWithSelect as c } from "./components/ButtonWithSelect/ButtonWithSelect.es.js";
5
+ import { ButtonGroup as s } from "./components/ButtonGroup/ButtonGroup.es.js";
6
+ import { ButtonWithSelect as S } from "./components/ButtonWithSelect/ButtonWithSelect.es.js";
7
7
  import { DataTable as I } from "./components/DataTable/DataTable.es.js";
8
8
  import { Dialog as N } from "./components/Dialog/Dialog.es.js";
9
9
  import { Elevation as v } from "./components/Elevation/Elevation.es.js";
@@ -23,7 +23,7 @@ import { TextEllipsis as U } from "./components/Text/TextEllipsis/TextEllipsis.e
23
23
  import { TextEmphasis as Y } from "./components/Text/TextEmphasis/TextEmphasis.es.js";
24
24
  import { ThemeProvider as $, useTheme as oo } from "./components/ThemeProvider.es.js";
25
25
  import { Tombstone as eo } from "./components/Tombstone/Tombstone.es.js";
26
- import { TooltipTrigger as po } from "./components/Tooltip/Tooltip.es.js";
26
+ import { Tooltip as po } from "./components/Tooltip/Tooltip.es.js";
27
27
  import { Waveform as xo } from "./components/Waveform/Waveform.es.js";
28
28
  export {
29
29
  e as ActionMenu,
@@ -33,10 +33,10 @@ export {
33
33
  m as BadgeVariants,
34
34
  n as Banner,
35
35
  u as Button,
36
- g as ButtonGroup,
36
+ s as ButtonGroup,
37
37
  l as ButtonSizes,
38
38
  B as ButtonVariants,
39
- c as ButtonWithSelect,
39
+ S as ButtonWithSelect,
40
40
  C as CopyInput,
41
41
  I as DataTable,
42
42
  N as Dialog,
@@ -56,7 +56,7 @@ export {
56
56
  Y as TextEmphasis,
57
57
  $ as ThemeProvider,
58
58
  eo as Tombstone,
59
- po as TooltipTrigger,
59
+ po as Tooltip,
60
60
  xo as Waveform,
61
61
  oo as useTheme
62
62
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@react-aria/utils"),I=require("../../interactions/dist/useFocusVisible.cjs.js"),K=require("../../interactions/dist/focusSafely.cjs.js"),N=require("react"),D=N.createContext(null),R="react-aria-focus-scope-restore";let v=null;function P(e){let{children:t,contain:r,restoreFocus:u,autoFocus:n}=e,i=N.useRef(null),a=N.useRef(null),o=N.useRef([]),{parentNode:E}=N.useContext(D)||{},l=N.useMemo(()=>new x({scopeRef:o}),[o]);d.useLayoutEffect(()=>{let f=E||m.root;if(m.getTreeNode(f.scopeRef)&&v&&!L(v,f.scopeRef)){let s=m.getTreeNode(v);s&&(f=s)}f.addChild(l),m.addNode(l)},[l,E]),d.useLayoutEffect(()=>{let f=m.getTreeNode(o);f&&(f.contain=!!r)},[r]),d.useLayoutEffect(()=>{var f;let s=(f=i.current)===null||f===void 0?void 0:f.nextSibling,p=[],y=F=>F.stopPropagation();for(;s&&s!==a.current;)p.push(s),s.addEventListener(R,y),s=s.nextSibling;return o.current=p,()=>{for(let F of p)F.removeEventListener(R,y)}},[t]),V(o,u,r),J(o,r),j(o,u,r),W(o,n),N.useEffect(()=>{const f=d.getActiveElement(d.getOwnerDocument(o.current?o.current[0]:void 0));let s=null;if(g(f,o.current)){for(let p of m.traverse())p.scopeRef&&g(f,p.scopeRef.current)&&(s=p);s===m.getTreeNode(o)&&(v=s.scopeRef)}},[o]),d.useLayoutEffect(()=>()=>{var f,s,p;let y=(p=(s=m.getTreeNode(o))===null||s===void 0||(f=s.parent)===null||f===void 0?void 0:f.scopeRef)!==null&&p!==void 0?p:null;(o===v||L(o,v))&&(!y||m.getTreeNode(y))&&(v=y),m.removeTreeNode(o)},[o]);let b=N.useMemo(()=>q(o),[]),c=N.useMemo(()=>({focusManager:b,parentNode:l}),[l,b]);return N.createElement(D.Provider,{value:c},N.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,N.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function q(e){return{focusNext(t={}){let r=e.current,{from:u,tabbable:n,wrap:i,accept:a}=t;var o;let E=u||d.getActiveElement(d.getOwnerDocument((o=r[0])!==null&&o!==void 0?o:void 0)),l=r[0].previousElementSibling,b=w(r),c=h(b,{tabbable:n,accept:a},r);c.currentNode=g(E,r)?E:l;let f=c.nextNode();return!f&&i&&(c.currentNode=l,f=c.nextNode()),f&&T(f,!0),f},focusPrevious(t={}){let r=e.current,{from:u,tabbable:n,wrap:i,accept:a}=t;var o;let E=u||d.getActiveElement(d.getOwnerDocument((o=r[0])!==null&&o!==void 0?o:void 0)),l=r[r.length-1].nextElementSibling,b=w(r),c=h(b,{tabbable:n,accept:a},r);c.currentNode=g(E,r)?E:l;let f=c.previousNode();return!f&&i&&(c.currentNode=l,f=c.previousNode()),f&&T(f,!0),f},focusFirst(t={}){let r=e.current,{tabbable:u,accept:n}=t,i=w(r),a=h(i,{tabbable:u,accept:n},r);a.currentNode=r[0].previousElementSibling;let o=a.nextNode();return o&&T(o,!0),o},focusLast(t={}){let r=e.current,{tabbable:u,accept:n}=t,i=w(r),a=h(i,{tabbable:u,accept:n},r);a.currentNode=r[r.length-1].nextElementSibling;let o=a.previousNode();return o&&T(o,!0),o}}}function w(e){return e[0].parentElement}function S(e){let t=m.getTreeNode(v);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function z(e){if(e.checked)return!0;let t=[];if(!e.form)t=[...d.getOwnerDocument(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(i=>!i.form);else{var r,u;let i=(u=e.form)===null||u===void 0||(r=u.elements)===null||r===void 0?void 0:r.namedItem(e.name);t=[...i??[]]}return t?!t.some(i=>i.checked):!1}function J(e,t){let r=N.useRef(void 0),u=N.useRef(void 0);d.useLayoutEffect(()=>{let n=e.current;if(!t){u.current&&(cancelAnimationFrame(u.current),u.current=void 0);return}const i=d.getOwnerDocument(n?n[0]:void 0);let a=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!S(e)||l.isComposing)return;let b=d.getActiveElement(i),c=e.current;if(!c||!g(b,c))return;let f=w(c),s=h(f,{tabbable:!0},c);if(!b)return;s.currentNode=b;let p=l.shiftKey?s.previousNode():s.nextNode();p||(s.currentNode=l.shiftKey?c[c.length-1].nextElementSibling:c[0].previousElementSibling,p=l.shiftKey?s.previousNode():s.nextNode()),l.preventDefault(),p&&T(p,!0)},o=l=>{(!v||L(v,e))&&g(d.getEventTarget(l),e.current)?(v=e,r.current=d.getEventTarget(l)):S(e)&&!$(d.getEventTarget(l),e)?r.current?r.current.focus():v&&v.current&&C(v.current):S(e)&&(r.current=d.getEventTarget(l))},E=l=>{u.current&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{let b=I.getInteractionModality(),c=(b==="virtual"||b===null)&&d.isAndroid()&&d.isChrome(),f=d.getActiveElement(i);if(!c&&f&&S(e)&&!$(f,e)){v=e;let p=d.getEventTarget(l);if(p&&p.isConnected){var s;r.current=p,(s=r.current)===null||s===void 0||s.focus()}else v.current&&C(v.current)}})};return i.addEventListener("keydown",a,!1),i.addEventListener("focusin",o,!1),n==null||n.forEach(l=>l.addEventListener("focusin",o,!1)),n==null||n.forEach(l=>l.addEventListener("focusout",E,!1)),()=>{i.removeEventListener("keydown",a,!1),i.removeEventListener("focusin",o,!1),n==null||n.forEach(l=>l.removeEventListener("focusin",o,!1)),n==null||n.forEach(l=>l.removeEventListener("focusout",E,!1))}},[e,t]),d.useLayoutEffect(()=>()=>{u.current&&cancelAnimationFrame(u.current)},[u])}function _(e){return $(e)}function g(e,t){return!e||!t?!1:t.some(r=>r.contains(e))}function $(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of m.traverse(m.getTreeNode(t)))if(r&&g(e,r.current))return!0;return!1}function U(e){return $(e,v)}function L(e,t){var r;let u=(r=m.getTreeNode(t))===null||r===void 0?void 0:r.parent;for(;u;){if(u.scopeRef===e)return!0;u=u.parent}return!1}function T(e,t=!1){if(e!=null&&!t)try{K.focusSafely(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function O(e,t=!0){let r=e[0].previousElementSibling,u=w(e),n=h(u,{tabbable:t},e);n.currentNode=r;let i=n.nextNode();return t&&!i&&(u=w(e),n=h(u,{tabbable:!1},e),n.currentNode=r,i=n.nextNode()),i}function C(e,t=!0){T(O(e,t))}function W(e,t){const r=N.useRef(t);N.useEffect(()=>{if(r.current){v=e;const u=d.getOwnerDocument(e.current?e.current[0]:void 0);!g(d.getActiveElement(u),v.current)&&e.current&&C(e.current)}r.current=!1},[e])}function V(e,t,r){d.useLayoutEffect(()=>{if(t||r)return;let u=e.current;const n=d.getOwnerDocument(u?u[0]:void 0);let i=a=>{let o=d.getEventTarget(a);g(o,e.current)?v=e:_(o)||(v=null)};return n.addEventListener("focusin",i,!1),u==null||u.forEach(a=>a.addEventListener("focusin",i,!1)),()=>{n.removeEventListener("focusin",i,!1),u==null||u.forEach(a=>a.removeEventListener("focusin",i,!1))}},[e,t,r])}function k(e){let t=m.getTreeNode(v);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function j(e,t,r){const u=N.useRef(typeof document<"u"?d.getActiveElement(d.getOwnerDocument(e.current?e.current[0]:void 0)):null);d.useLayoutEffect(()=>{let n=e.current;const i=d.getOwnerDocument(n?n[0]:void 0);if(!t||r)return;let a=()=>{(!v||L(v,e))&&g(d.getActiveElement(i),e.current)&&(v=e)};return i.addEventListener("focusin",a,!1),n==null||n.forEach(o=>o.addEventListener("focusin",a,!1)),()=>{i.removeEventListener("focusin",a,!1),n==null||n.forEach(o=>o.removeEventListener("focusin",a,!1))}},[e,r]),d.useLayoutEffect(()=>{const n=d.getOwnerDocument(e.current?e.current[0]:void 0);if(!t)return;let i=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!S(e)||a.isComposing)return;let o=n.activeElement;if(!$(o,e)||!k(e))return;let E=m.getTreeNode(e);if(!E)return;let l=E.nodeToRestore,b=h(n.body,{tabbable:!0});b.currentNode=o;let c=a.shiftKey?b.previousNode():b.nextNode();if((!l||!l.isConnected||l===n.body)&&(l=void 0,E.nodeToRestore=void 0),(!c||!$(c,e))&&l){b.currentNode=l;do c=a.shiftKey?b.previousNode():b.nextNode();while($(c,e));a.preventDefault(),a.stopPropagation(),c?T(c,!0):_(l)?T(l,!0):o.blur()}};return r||n.addEventListener("keydown",i,!0),()=>{r||n.removeEventListener("keydown",i,!0)}},[e,t,r]),d.useLayoutEffect(()=>{const n=d.getOwnerDocument(e.current?e.current[0]:void 0);if(!t)return;let i=m.getTreeNode(e);if(i){var a;return i.nodeToRestore=(a=u.current)!==null&&a!==void 0?a:void 0,()=>{let o=m.getTreeNode(e);if(!o)return;let E=o.nodeToRestore,l=d.getActiveElement(n);if(t&&E&&(l&&$(l,e)||l===n.body&&k(e))){let b=m.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let c=b.getTreeNode(e);for(;c;){if(c.nodeToRestore&&c.nodeToRestore.isConnected){M(c.nodeToRestore);return}c=c.parent}for(c=b.getTreeNode(e);c;){if(c.scopeRef&&c.scopeRef.current&&m.getTreeNode(c.scopeRef)){let f=O(c.scopeRef.current,!0);M(f);return}c=c.parent}}})}}}},[e,t])}function M(e){e.dispatchEvent(new CustomEvent(R,{bubbles:!0,cancelable:!0}))&&T(e)}function h(e,t,r){let u=t!=null&&t.tabbable?d.isTabbable:d.isFocusable,n=(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null,i=d.getOwnerDocument(n),a=d.createShadowTreeWalker(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(o){var E;return!(t==null||(E=t.from)===null||E===void 0)&&E.contains(o)||t!=null&&t.tabbable&&o.tagName==="INPUT"&&o.getAttribute("type")==="radio"&&(!z(o)||a.currentNode.tagName==="INPUT"&&a.currentNode.type==="radio"&&a.currentNode.name===o.name)?NodeFilter.FILTER_REJECT:u(o)&&(!r||g(o,r))&&(!(t!=null&&t.accept)||t.accept(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(a.currentNode=t.from),a}class A{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,u){let n=this.fastMap.get(r??null);if(!n)return;let i=new x({scopeRef:t});n.addChild(i),i.parent=n,this.fastMap.set(t,i),u&&(i.nodeToRestore=u)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let u=r.parent;for(let i of this.traverse())i!==r&&r.nodeToRestore&&i.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&g(i.nodeToRestore,r.scopeRef.current)&&(i.nodeToRestore=r.nodeToRestore);let n=r.children;u&&(u.removeChild(r),n.size>0&&n.forEach(i=>u&&u.addChild(i))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var t;let r=new A;var u;for(let n of this.traverse())r.addTreeNode(n.scopeRef,(u=(t=n.parent)===null||t===void 0?void 0:t.scopeRef)!==null&&u!==void 0?u:null,n.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new x({scopeRef:null}),this.fastMap.set(null,this.root)}}class x{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let m=new A;exports.FocusScope=P;exports.focusScopeTree=m;exports.getFocusableTreeWalker=h;exports.isElementInChildOfActiveScope=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@react-aria/utils"),I=require("../../interactions/dist/useFocusVisible.cjs.js"),K=require("../../interactions/dist/focusSafely.cjs.js"),N=require("react"),D=N.createContext(null),R="react-aria-focus-scope-restore";let v=null;function P(e){let{children:t,contain:r,restoreFocus:u,autoFocus:n}=e,i=N.useRef(null),a=N.useRef(null),o=N.useRef([]),{parentNode:E}=N.useContext(D)||{},l=N.useMemo(()=>new x({scopeRef:o}),[o]);d.useLayoutEffect(()=>{let f=E||m.root;if(m.getTreeNode(f.scopeRef)&&v&&!L(v,f.scopeRef)){let s=m.getTreeNode(v);s&&(f=s)}f.addChild(l),m.addNode(l)},[l,E]),d.useLayoutEffect(()=>{let f=m.getTreeNode(o);f&&(f.contain=!!r)},[r]),d.useLayoutEffect(()=>{var f;let s=(f=i.current)===null||f===void 0?void 0:f.nextSibling,p=[],y=F=>F.stopPropagation();for(;s&&s!==a.current;)p.push(s),s.addEventListener(R,y),s=s.nextSibling;return o.current=p,()=>{for(let F of p)F.removeEventListener(R,y)}},[t]),B(o,u,r),J(o,r),V(o,u,r),W(o,n),N.useEffect(()=>{const f=d.getActiveElement(d.getOwnerDocument(o.current?o.current[0]:void 0));let s=null;if(g(f,o.current)){for(let p of m.traverse())p.scopeRef&&g(f,p.scopeRef.current)&&(s=p);s===m.getTreeNode(o)&&(v=s.scopeRef)}},[o]),d.useLayoutEffect(()=>()=>{var f,s,p;let y=(p=(s=m.getTreeNode(o))===null||s===void 0||(f=s.parent)===null||f===void 0?void 0:f.scopeRef)!==null&&p!==void 0?p:null;(o===v||L(o,v))&&(!y||m.getTreeNode(y))&&(v=y),m.removeTreeNode(o)},[o]);let b=N.useMemo(()=>q(o),[]),c=N.useMemo(()=>({focusManager:b,parentNode:l}),[l,b]);return N.createElement(D.Provider,{value:c},N.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,N.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function q(e){return{focusNext(t={}){let r=e.current,{from:u,tabbable:n,wrap:i,accept:a}=t;var o;let E=u||d.getActiveElement(d.getOwnerDocument((o=r[0])!==null&&o!==void 0?o:void 0)),l=r[0].previousElementSibling,b=w(r),c=h(b,{tabbable:n,accept:a},r);c.currentNode=g(E,r)?E:l;let f=c.nextNode();return!f&&i&&(c.currentNode=l,f=c.nextNode()),f&&T(f,!0),f},focusPrevious(t={}){let r=e.current,{from:u,tabbable:n,wrap:i,accept:a}=t;var o;let E=u||d.getActiveElement(d.getOwnerDocument((o=r[0])!==null&&o!==void 0?o:void 0)),l=r[r.length-1].nextElementSibling,b=w(r),c=h(b,{tabbable:n,accept:a},r);c.currentNode=g(E,r)?E:l;let f=c.previousNode();return!f&&i&&(c.currentNode=l,f=c.previousNode()),f&&T(f,!0),f},focusFirst(t={}){let r=e.current,{tabbable:u,accept:n}=t,i=w(r),a=h(i,{tabbable:u,accept:n},r);a.currentNode=r[0].previousElementSibling;let o=a.nextNode();return o&&T(o,!0),o},focusLast(t={}){let r=e.current,{tabbable:u,accept:n}=t,i=w(r),a=h(i,{tabbable:u,accept:n},r);a.currentNode=r[r.length-1].nextElementSibling;let o=a.previousNode();return o&&T(o,!0),o}}}function w(e){return e[0].parentElement}function S(e){let t=m.getTreeNode(v);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function z(e){if(e.checked)return!0;let t=[];if(!e.form)t=[...d.getOwnerDocument(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(i=>!i.form);else{var r,u;let i=(u=e.form)===null||u===void 0||(r=u.elements)===null||r===void 0?void 0:r.namedItem(e.name);t=[...i??[]]}return t?!t.some(i=>i.checked):!1}function J(e,t){let r=N.useRef(void 0),u=N.useRef(void 0);d.useLayoutEffect(()=>{let n=e.current;if(!t){u.current&&(cancelAnimationFrame(u.current),u.current=void 0);return}const i=d.getOwnerDocument(n?n[0]:void 0);let a=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!S(e)||l.isComposing)return;let b=d.getActiveElement(i),c=e.current;if(!c||!g(b,c))return;let f=w(c),s=h(f,{tabbable:!0},c);if(!b)return;s.currentNode=b;let p=l.shiftKey?s.previousNode():s.nextNode();p||(s.currentNode=l.shiftKey?c[c.length-1].nextElementSibling:c[0].previousElementSibling,p=l.shiftKey?s.previousNode():s.nextNode()),l.preventDefault(),p&&T(p,!0)},o=l=>{(!v||L(v,e))&&g(d.getEventTarget(l),e.current)?(v=e,r.current=d.getEventTarget(l)):S(e)&&!$(d.getEventTarget(l),e)?r.current?r.current.focus():v&&v.current&&C(v.current):S(e)&&(r.current=d.getEventTarget(l))},E=l=>{u.current&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{let b=I.getInteractionModality(),c=(b==="virtual"||b===null)&&d.isAndroid()&&d.isChrome(),f=d.getActiveElement(i);if(!c&&f&&S(e)&&!$(f,e)){v=e;let p=d.getEventTarget(l);if(p&&p.isConnected){var s;r.current=p,(s=r.current)===null||s===void 0||s.focus()}else v.current&&C(v.current)}})};return i.addEventListener("keydown",a,!1),i.addEventListener("focusin",o,!1),n==null||n.forEach(l=>l.addEventListener("focusin",o,!1)),n==null||n.forEach(l=>l.addEventListener("focusout",E,!1)),()=>{i.removeEventListener("keydown",a,!1),i.removeEventListener("focusin",o,!1),n==null||n.forEach(l=>l.removeEventListener("focusin",o,!1)),n==null||n.forEach(l=>l.removeEventListener("focusout",E,!1))}},[e,t]),d.useLayoutEffect(()=>()=>{u.current&&cancelAnimationFrame(u.current)},[u])}function _(e){return $(e)}function g(e,t){return!e||!t?!1:t.some(r=>r.contains(e))}function $(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of m.traverse(m.getTreeNode(t)))if(r&&g(e,r.current))return!0;return!1}function U(e){return $(e,v)}function L(e,t){var r;let u=(r=m.getTreeNode(t))===null||r===void 0?void 0:r.parent;for(;u;){if(u.scopeRef===e)return!0;u=u.parent}return!1}function T(e,t=!1){if(e!=null&&!t)try{K.focusSafely(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function O(e,t=!0){let r=e[0].previousElementSibling,u=w(e),n=h(u,{tabbable:t},e);n.currentNode=r;let i=n.nextNode();return t&&!i&&(u=w(e),n=h(u,{tabbable:!1},e),n.currentNode=r,i=n.nextNode()),i}function C(e,t=!0){T(O(e,t))}function W(e,t){const r=N.useRef(t);N.useEffect(()=>{if(r.current){v=e;const u=d.getOwnerDocument(e.current?e.current[0]:void 0);!g(d.getActiveElement(u),v.current)&&e.current&&C(e.current)}r.current=!1},[e])}function B(e,t,r){d.useLayoutEffect(()=>{if(t||r)return;let u=e.current;const n=d.getOwnerDocument(u?u[0]:void 0);let i=a=>{let o=d.getEventTarget(a);g(o,e.current)?v=e:_(o)||(v=null)};return n.addEventListener("focusin",i,!1),u==null||u.forEach(a=>a.addEventListener("focusin",i,!1)),()=>{n.removeEventListener("focusin",i,!1),u==null||u.forEach(a=>a.removeEventListener("focusin",i,!1))}},[e,t,r])}function k(e){let t=m.getTreeNode(v);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function V(e,t,r){const u=N.useRef(typeof document<"u"?d.getActiveElement(d.getOwnerDocument(e.current?e.current[0]:void 0)):null);d.useLayoutEffect(()=>{let n=e.current;const i=d.getOwnerDocument(n?n[0]:void 0);if(!t||r)return;let a=()=>{(!v||L(v,e))&&g(d.getActiveElement(i),e.current)&&(v=e)};return i.addEventListener("focusin",a,!1),n==null||n.forEach(o=>o.addEventListener("focusin",a,!1)),()=>{i.removeEventListener("focusin",a,!1),n==null||n.forEach(o=>o.removeEventListener("focusin",a,!1))}},[e,r]),d.useLayoutEffect(()=>{const n=d.getOwnerDocument(e.current?e.current[0]:void 0);if(!t)return;let i=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!S(e)||a.isComposing)return;let o=n.activeElement;if(!$(o,e)||!k(e))return;let E=m.getTreeNode(e);if(!E)return;let l=E.nodeToRestore,b=h(n.body,{tabbable:!0});b.currentNode=o;let c=a.shiftKey?b.previousNode():b.nextNode();if((!l||!l.isConnected||l===n.body)&&(l=void 0,E.nodeToRestore=void 0),(!c||!$(c,e))&&l){b.currentNode=l;do c=a.shiftKey?b.previousNode():b.nextNode();while($(c,e));a.preventDefault(),a.stopPropagation(),c?T(c,!0):_(l)?T(l,!0):o.blur()}};return r||n.addEventListener("keydown",i,!0),()=>{r||n.removeEventListener("keydown",i,!0)}},[e,t,r]),d.useLayoutEffect(()=>{const n=d.getOwnerDocument(e.current?e.current[0]:void 0);if(!t)return;let i=m.getTreeNode(e);if(i){var a;return i.nodeToRestore=(a=u.current)!==null&&a!==void 0?a:void 0,()=>{let o=m.getTreeNode(e);if(!o)return;let E=o.nodeToRestore,l=d.getActiveElement(n);if(t&&E&&(l&&$(l,e)||l===n.body&&k(e))){let b=m.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let c=b.getTreeNode(e);for(;c;){if(c.nodeToRestore&&c.nodeToRestore.isConnected){M(c.nodeToRestore);return}c=c.parent}for(c=b.getTreeNode(e);c;){if(c.scopeRef&&c.scopeRef.current&&m.getTreeNode(c.scopeRef)){let f=O(c.scopeRef.current,!0);M(f);return}c=c.parent}}})}}}},[e,t])}function M(e){e.dispatchEvent(new CustomEvent(R,{bubbles:!0,cancelable:!0}))&&T(e)}function h(e,t,r){let u=t!=null&&t.tabbable?d.isTabbable:d.isFocusable,n=(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null,i=d.getOwnerDocument(n),a=d.createShadowTreeWalker(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(o){var E;return!(t==null||(E=t.from)===null||E===void 0)&&E.contains(o)||t!=null&&t.tabbable&&o.tagName==="INPUT"&&o.getAttribute("type")==="radio"&&(!z(o)||a.currentNode.tagName==="INPUT"&&a.currentNode.type==="radio"&&a.currentNode.name===o.name)?NodeFilter.FILTER_REJECT:u(o)&&(!r||g(o,r))&&(!(t!=null&&t.accept)||t.accept(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(a.currentNode=t.from),a}class A{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,u){let n=this.fastMap.get(r??null);if(!n)return;let i=new x({scopeRef:t});n.addChild(i),i.parent=n,this.fastMap.set(t,i),u&&(i.nodeToRestore=u)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let u=r.parent;for(let i of this.traverse())i!==r&&r.nodeToRestore&&i.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&g(i.nodeToRestore,r.scopeRef.current)&&(i.nodeToRestore=r.nodeToRestore);let n=r.children;u&&(u.removeChild(r),n.size>0&&n.forEach(i=>u&&u.addChild(i))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var t;let r=new A;var u;for(let n of this.traverse())r.addTreeNode(n.scopeRef,(u=(t=n.parent)===null||t===void 0?void 0:t.scopeRef)!==null&&u!==void 0?u:null,n.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new x({scopeRef:null}),this.fastMap.set(null,this.root)}}class x{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let m=new A;exports.FocusScope=P;exports.focusScopeTree=m;exports.getFocusableTreeWalker=h;exports.isElementInChildOfActiveScope=U;
2
2
  //# sourceMappingURL=FocusScope.cjs.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../interactions/dist/useFocusVisible.cjs.js"),f=require("react"),o=require("@react-aria/utils");function E(n,e,t){let{validationBehavior:c,focus:m}=n;o.useLayoutEffect(()=>{if(c==="native"&&(t!=null&&t.current)&&!t.current.disabled){let a=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";t.current.setCustomValidity(a),t.current.hasAttribute("title")||(t.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(h(t.current))}});let r=f.useRef(!1),d=o.useEffectEvent(()=>{r.current||e.resetValidation()}),v=o.useEffectEvent(a=>{var i;e.displayValidation.isInvalid||e.commitValidation();let l=t==null||(i=t.current)===null||i===void 0?void 0:i.form;if(!a.defaultPrevented&&t&&l&&b(l)===t.current){var u;m?m():(u=t.current)===null||u===void 0||u.focus(),g.setInteractionModality("keyboard")}a.preventDefault()}),s=o.useEffectEvent(()=>{e.commitValidation()});f.useEffect(()=>{let a=t==null?void 0:t.current;if(!a)return;let i=a.form,l=i==null?void 0:i.reset;return i&&(i.reset=()=>{r.current=!window.event||window.event.type==="message"&&window.event.target instanceof MessagePort,l==null||l.call(i),r.current=!1}),a.addEventListener("invalid",v),a.addEventListener("change",s),i==null||i.addEventListener("reset",d),()=>{a.removeEventListener("invalid",v),a.removeEventListener("change",s),i==null||i.removeEventListener("reset",d),i&&(i.reset=l)}},[t,v,s,d,c])}function y(n){let e=n.validity;return{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing,valid:e.valid}}function h(n){return{isInvalid:!n.validity.valid,validationDetails:y(n),validationErrors:n.validationMessage?[n.validationMessage]:[]}}function b(n){for(let e=0;e<n.elements.length;e++){let t=n.elements[e];if(!t.validity.valid)return t}return null}exports.useFormValidation=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../interactions/dist/useFocusVisible.cjs.js"),f=require("react"),o=require("@react-aria/utils");function E(n,e,t){let{validationBehavior:c,focus:m}=n;o.useLayoutEffect(()=>{if(c==="native"&&(t!=null&&t.current)&&!t.current.disabled){let a=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";t.current.setCustomValidity(a),t.current.hasAttribute("title")||(t.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(h(t.current))}});let r=f.useRef(!1),d=o.useEffectEvent(()=>{r.current||e.resetValidation()}),v=o.useEffectEvent(a=>{var i;e.displayValidation.isInvalid||e.commitValidation();let l=t==null||(i=t.current)===null||i===void 0?void 0:i.form;if(!a.defaultPrevented&&t&&l&&M(l)===t.current){var u;m?m():(u=t.current)===null||u===void 0||u.focus(),g.setInteractionModality("keyboard")}a.preventDefault()}),s=o.useEffectEvent(()=>{e.commitValidation()});f.useEffect(()=>{let a=t==null?void 0:t.current;if(!a)return;let i=a.form,l=i==null?void 0:i.reset;return i&&(i.reset=()=>{r.current=!window.event||window.event.type==="message"&&window.event.target instanceof MessagePort,l==null||l.call(i),r.current=!1}),a.addEventListener("invalid",v),a.addEventListener("change",s),i==null||i.addEventListener("reset",d),()=>{a.removeEventListener("invalid",v),a.removeEventListener("change",s),i==null||i.removeEventListener("reset",d),i&&(i.reset=l)}},[t,v,s,d,c])}function y(n){let e=n.validity;return{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing,valid:e.valid}}function h(n){return{isInvalid:!n.validity.valid,validationDetails:y(n),validationErrors:n.validationMessage?[n.validationMessage]:[]}}function M(n){for(let e=0;e<n.elements.length;e++){let t=n.elements[e];if(!t.validity.valid)return t}return null}exports.useFormValidation=E;
2
2
  //# sourceMappingURL=useFormValidation.cjs.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./useDefaultLocale.cjs.js"),e=require("react"),a=e.createContext(null);function c(){let t=o.useDefaultLocale();return e.useContext(a)||t}exports.useLocale=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./useDefaultLocale.cjs.js"),e=require("react"),c=e.createContext(null);function f(){let t=o.useDefaultLocale();return e.useContext(c)||t}exports.useLocale=f;
2
2
  //# sourceMappingURL=context.cjs.js.map
@@ -1,9 +1,9 @@
1
1
  import { useDefaultLocale as t } from "./useDefaultLocale.es.js";
2
- import a, { useContext as f } from "react";
3
- const o = /* @__PURE__ */ a.createContext(null);
2
+ import f, { useContext as o } from "react";
3
+ const a = /* @__PURE__ */ f.createContext(null);
4
4
  function $() {
5
5
  let e = t();
6
- return f(o) || e;
6
+ return o(a) || e;
7
7
  }
8
8
  export {
9
9
  $ as useLocale
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./utils.cjs.js"),a=require("react"),r=require("@react-aria/utils");function m(b){let{isDisabled:v,onBlurWithin:u,onFocusWithin:s,onFocusWithinChange:t}=b,n=a.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:f}=r.useGlobalListeners(),i=a.useCallback(e=>{e.currentTarget.contains(e.target)&&n.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(n.current.isFocusWithin=!1,f(),u&&u(e),t&&t(!1))},[u,t,n,f]),g=c.useSyntheticBlurEvent(i),W=a.useCallback(e=>{if(!e.currentTarget.contains(e.target))return;const o=r.getOwnerDocument(e.target),T=r.getActiveElement(o);if(!n.current.isFocusWithin&&T===r.getEventTarget(e.nativeEvent)){s&&s(e),t&&t(!0),n.current.isFocusWithin=!0,g(e);let h=e.currentTarget;l(o,"focus",d=>{if(n.current.isFocusWithin&&!r.nodeContains(h,d.target)){let F=new o.defaultView.FocusEvent("blur",{relatedTarget:d.target});c.setEventTarget(F,h);let E=c.createSyntheticEvent(F);i(E)}},{capture:!0})}},[s,t,g,l,i]);return v?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:W,onBlur:i}}}exports.useFocusWithin=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./utils.cjs.js"),a=require("react"),r=require("@react-aria/utils");function m(v){let{isDisabled:W,onBlurWithin:u,onFocusWithin:s,onFocusWithinChange:t}=v,n=a.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:f}=r.useGlobalListeners(),i=a.useCallback(e=>{e.currentTarget.contains(e.target)&&n.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(n.current.isFocusWithin=!1,f(),u&&u(e),t&&t(!1))},[u,t,n,f]),g=c.useSyntheticBlurEvent(i),b=a.useCallback(e=>{if(!e.currentTarget.contains(e.target))return;const o=r.getOwnerDocument(e.target),T=r.getActiveElement(o);if(!n.current.isFocusWithin&&T===r.getEventTarget(e.nativeEvent)){s&&s(e),t&&t(!0),n.current.isFocusWithin=!0,g(e);let h=e.currentTarget;l(o,"focus",d=>{if(n.current.isFocusWithin&&!r.nodeContains(h,d.target)){let F=new o.defaultView.FocusEvent("blur",{relatedTarget:d.target});c.setEventTarget(F,h);let E=c.createSyntheticEvent(F);i(E)}},{capture:!0})}},[s,t,g,l,i]);return W?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:b,onBlur:i}}}exports.useFocusWithin=m;
2
2
  //# sourceMappingURL=useFocusWithin.cjs.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./focusSafely.cjs.js"),d=require("./useFocus.cjs.js"),P=require("./useKeyboard.cjs.js"),c=require("@react-aria/utils"),r=require("react");let a=r.createContext(null);function $(e){let t=r.useContext(a)||{};c.useSyncRef(t,e);let{ref:u,...o}=t;return o}const x=r.forwardRef(function(t,u){let{children:o,...s}=t,n=c.useObjectRef(u),f={...s,ref:n};return r.createElement(a.Provider,{value:f},o)});function F(e,t){let{focusProps:u}=d.useFocus(e),{keyboardProps:o}=P.useKeyboard(e),s=c.mergeProps(u,o),n=$(t),f=e.isDisabled?{}:n,l=r.useRef(e.autoFocus);r.useEffect(()=>{l.current&&t.current&&b.focusSafely(t.current),l.current=!1},[t]);let i=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(i=void 0),{focusableProps:c.mergeProps({...s,tabIndex:i},f)}}exports.FocusableContext=a;exports.FocusableProvider=x;exports.useFocusable=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./focusSafely.cjs.js"),d=require("./useFocus.cjs.js"),P=require("./useKeyboard.cjs.js"),o=require("@react-aria/utils"),r=require("react");let a=r.createContext(null);function $(e){let t=r.useContext(a)||{};o.useSyncRef(t,e);let{ref:s,...u}=t;return u}function x(e,t){let{focusProps:s}=d.useFocus(e),{keyboardProps:u}=P.useKeyboard(e),f=o.mergeProps(s,u),l=$(t),i=e.isDisabled?{}:l,c=r.useRef(e.autoFocus);r.useEffect(()=>{c.current&&t.current&&b.focusSafely(t.current),c.current=!1},[t]);let n=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(n=void 0),{focusableProps:o.mergeProps({...f,tabIndex:n},i)}}exports.FocusableContext=a;exports.useFocusable=x;
2
2
  //# sourceMappingURL=useFocusable.cjs.js.map