@doist/reactist 33.2.1 → 33.2.2

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.
@@ -70,19 +70,9 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
70
70
  if (!child) {
71
71
  return child;
72
72
  }
73
-
74
- /* eslint-disable react-hooks/refs */
75
- const rawRef = 'ref' in child.props ? child.props.ref :
76
- // child.ref access kept for React 18 compatibility
77
- child.ref;
78
- if (typeof rawRef === 'string') {
79
- throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
80
- }
81
- const childRef = rawRef;
82
73
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TooltipAnchor, {
83
74
  render: child,
84
- store: tooltip,
85
- ref: childRef
75
+ store: tooltip
86
76
  }), isOpen && content ? /*#__PURE__*/React.createElement(Tooltip$1, {
87
77
  store: tooltip,
88
78
  gutter: gapSize,
@@ -98,7 +88,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
98
88
  textAlign: "center"
99
89
  })
100
90
  }, withArrow ? /*#__PURE__*/React.createElement(TooltipArrow, null) : null, typeof content === 'function' ? content() : content) : null);
101
- /* eslint-enable react-hooks/refs */
102
91
  });
103
92
  Tooltip.displayName = 'Tooltip';
104
93
 
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n Tooltip as AriakitTooltip,\n TooltipAnchor,\n TooltipArrow,\n useTooltipStore,\n} from '@ariakit/react'\n\nimport { Box } from '../box'\n\nimport styles from './tooltip.module.css'\n\nimport type { TooltipStore, TooltipStoreState } from '@ariakit/react'\nimport type { JSX } from 'react'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst defaultShowTimeout = 500\nconst defaultHideTimeout = 100\n\ntype TooltipContextState = {\n showTimeout: number\n hideTimeout: number\n}\n\nconst TooltipContext = React.createContext<TooltipContextState>({\n showTimeout: defaultShowTimeout,\n hideTimeout: defaultHideTimeout,\n})\n\nfunction TooltipProvider({\n showTimeout = defaultShowTimeout,\n hideTimeout = defaultHideTimeout,\n children,\n}: React.PropsWithChildren<{\n showTimeout?: number\n hideTimeout?: number\n}>) {\n const value = React.useMemo(() => ({ showTimeout, hideTimeout }), [showTimeout, hideTimeout])\n return <TooltipContext.Provider value={value}>{children}</TooltipContext.Provider>\n}\n\ninterface TooltipProps extends ObfuscatedClassName {\n /**\n * The element that triggers the tooltip. Generally a button or link.\n *\n * It should be an interactive element accessible both via mouse and keyboard interactions.\n */\n children: React.ReactNode\n\n /**\n * The content to show in the tooltip.\n *\n * It can be rich content provided via React elements, or string content. It should not include\n * interactive elements inside it. This includes links or buttons.\n *\n * You can provide a function instead of the content itself. In this case, the function should\n * return the desired content. This is useful if the content is expensive to generate. It can\n * also be useful if the content dynamically changes often, so every time you trigger the\n * tooltip the content may have changed (e.g. if you show a ticking time clock in the tooltip).\n *\n * The trigger element will be associated to this content via `aria-describedby`. This means\n * that the tooltip content will be read by assistive technologies such as screen readers. It\n * will likely read this content right after reading the trigger element label.\n */\n content: React.ReactNode | (() => React.ReactNode)\n\n /**\n * How to place the tooltip relative to its trigger element.\n *\n * The possible values are \"top\", \"bottom\", \"left\", \"right\". Additionally, any of these values\n * can be combined with `-start` or `-end` for even more control. For instance `top-start` will\n * place the tooltip at the top, but with the start (e.g. left) side of the toolip and the\n * trigger aligned. If neither `-start` or `-end` are provided, the tooltip is centered along\n * the vertical or horizontal axis with the trigger.\n *\n * The position is enforced whenever possible, but tooltips can appear in different positions\n * if the specified one would make the tooltip intersect with the viewport edges.\n *\n * @default 'top'\n */\n position?: TooltipStoreState['placement']\n\n /**\n * The separation (in pixels) between the trigger element and the tooltip.\n * @default 3\n */\n gapSize?: number\n\n /**\n * Whether to show an arrow-like element attached to the tooltip, and pointing towards the\n * trigger element.\n * @default false\n */\n withArrow?: boolean\n\n /**\n * The amount of time in milliseconds to wait before showing the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 500\n */\n showTimeout?: number\n\n /**\n * The amount of time in milliseconds to wait before hiding the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 100\n */\n hideTimeout?: number\n}\n\nconst Tooltip = React.forwardRef<TooltipStore, TooltipProps>(\n (\n {\n children,\n content,\n position = 'top',\n gapSize = 3,\n withArrow = false,\n showTimeout,\n hideTimeout,\n exceptionallySetClassName,\n },\n ref,\n ) => {\n const { showTimeout: globalShowTimeout, hideTimeout: globalHideTimeout } =\n React.useContext(TooltipContext)\n\n const tooltip = useTooltipStore({\n placement: position,\n showTimeout: showTimeout ?? globalShowTimeout,\n hideTimeout: hideTimeout ?? globalHideTimeout,\n })\n\n React.useImperativeHandle(ref, () => tooltip, [tooltip])\n\n const isOpen = tooltip.useState('open')\n\n const child = React.Children.only(\n children as React.FunctionComponentElement<JSX.IntrinsicElements['div']> | null,\n )\n\n if (!child) {\n return child\n }\n\n /* eslint-disable react-hooks/refs */\n const rawRef =\n 'ref' in child.props\n ? child.props.ref\n : // child.ref access kept for React 18 compatibility\n (child as { ref?: unknown }).ref\n\n if (typeof rawRef === 'string') {\n throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded')\n }\n\n const childRef = rawRef as React.Ref<HTMLDivElement>\n\n return (\n <>\n <TooltipAnchor render={child} store={tooltip} ref={childRef} />\n {isOpen && content ? (\n <AriakitTooltip\n store={tooltip}\n gutter={gapSize}\n render={\n <Box\n className={[styles.tooltip, exceptionallySetClassName]}\n background=\"toast\"\n borderRadius=\"standard\"\n paddingX=\"small\"\n paddingY=\"xsmall\"\n maxWidth=\"medium\"\n width=\"fitContent\"\n overflow=\"hidden\"\n textAlign=\"center\"\n />\n }\n >\n {withArrow ? <TooltipArrow /> : null}\n {typeof content === 'function' ? content() : content}\n </AriakitTooltip>\n ) : null}\n </>\n )\n /* eslint-enable react-hooks/refs */\n },\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type { TooltipProps }\nexport { Tooltip, TooltipProvider }\n"],"names":["defaultShowTimeout","defaultHideTimeout","TooltipContext","React","createContext","showTimeout","hideTimeout","TooltipProvider","t0","$","_c","t1","t2","children","undefined","t3","value","t4","createElement","Provider","Tooltip","forwardRef","content","position","gapSize","withArrow","exceptionallySetClassName","ref","globalShowTimeout","globalHideTimeout","useContext","tooltip","useTooltipStore","placement","useImperativeHandle","isOpen","useState","child","Children","only","rawRef","props","Error","childRef","Fragment","TooltipAnchor","render","store","AriakitTooltip","gutter","Box","className","styles","background","borderRadius","paddingX","paddingY","maxWidth","width","overflow","textAlign","TooltipArrow","displayName"],"mappings":";;;;;;AAiBA,MAAMA,kBAAkB,GAAG,GAAG,CAAA;AAC9B,MAAMC,kBAAkB,GAAG,GAAG,CAAA;AAO9B,MAAMC,cAAc,gBAAGC,KAAK,CAACC,aAAa,CAAsB;AAC5DC,EAAAA,WAAW,EAAEL,kBAAkB;AAC/BM,EAAAA,WAAW,EAAEL,kBAAAA;AACjB,CAAC,CAAC,CAAA;AAEF,SAAAM,gBAAAC,EAAA,EAAA;EAAA,MAAAC,CAAA,GAAAC,CAAA,CAAA,CAAA,CAAA,CAAA;AAAyB,EAAA,MAAA;AAAAL,IAAAA,WAAA,EAAAM,EAAA;AAAAL,IAAAA,WAAA,EAAAM,EAAA;AAAAC,IAAAA,QAAAA;AAAA,GAAA,GAAAL,EAOvB,CAAA;EANE,MAAAH,WAAA,GAAAM,EAAgC,KAAhCG,SAAgC,GAAhCd,kBAAgC,GAAhCW,EAAgC,CAAA;EAChC,MAAAL,WAAA,GAAAM,EAAgC,KAAhCE,SAAgC,GAAhCb,kBAAgC,GAAhCW,EAAgC,CAAA;AAAA,EAAA,IAAAG,EAAA,CAAA;AAAA,EAAA,IAAAN,CAAA,CAAAH,CAAAA,CAAAA,KAAAA,WAAA,IAAAG,CAAA,QAAAJ,WAAA,EAAA;IAMGU,EAAA,GAAA;MAAAV,WAAA;AAAAC,MAAAA,WAAAA;KAA4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AAM,eACF3C,KAAA,CAAAe,aAAA,CAACgC,GAAG,EAAA;AACAC,MAAAA,SAAS,EAAE,CAACC,gBAAM,CAACrB,OAAO,EAAEL,yBAAyB,CAAE;AACvD2B,MAAAA,UAAU,EAAC,OAAO;AAClBC,MAAAA,YAAY,EAAC,UAAU;AACvBC,MAAAA,QAAQ,EAAC,OAAO;AAChBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,KAAK,EAAC,YAAY;AAClBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,SAAS,EAAC,QAAA;KACb,CAAA;GAGJnC,EAAAA,SAAS,gBAAGtB,KAAA,CAAAe,aAAA,CAAC2C,YAAY,EAAA,IAAE,CAAC,GAAG,IAAI,EACnC,OAAOvC,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OACjC,CAAC,GACjB,IACN,CAAC,CAAA;AAEP;AACJ,CACJ,EAAC;AAEDF,OAAO,CAAC0C,WAAW,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n Tooltip as AriakitTooltip,\n TooltipAnchor,\n TooltipArrow,\n useTooltipStore,\n} from '@ariakit/react'\n\nimport { Box } from '../box'\n\nimport styles from './tooltip.module.css'\n\nimport type { TooltipStore, TooltipStoreState } from '@ariakit/react'\nimport type { JSX } from 'react'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst defaultShowTimeout = 500\nconst defaultHideTimeout = 100\n\ntype TooltipContextState = {\n showTimeout: number\n hideTimeout: number\n}\n\nconst TooltipContext = React.createContext<TooltipContextState>({\n showTimeout: defaultShowTimeout,\n hideTimeout: defaultHideTimeout,\n})\n\nfunction TooltipProvider({\n showTimeout = defaultShowTimeout,\n hideTimeout = defaultHideTimeout,\n children,\n}: React.PropsWithChildren<{\n showTimeout?: number\n hideTimeout?: number\n}>) {\n const value = React.useMemo(() => ({ showTimeout, hideTimeout }), [showTimeout, hideTimeout])\n return <TooltipContext.Provider value={value}>{children}</TooltipContext.Provider>\n}\n\ninterface TooltipProps extends ObfuscatedClassName {\n /**\n * The element that triggers the tooltip. Generally a button or link.\n *\n * It should be an interactive element accessible both via mouse and keyboard interactions.\n */\n children: React.ReactNode\n\n /**\n * The content to show in the tooltip.\n *\n * It can be rich content provided via React elements, or string content. It should not include\n * interactive elements inside it. This includes links or buttons.\n *\n * You can provide a function instead of the content itself. In this case, the function should\n * return the desired content. This is useful if the content is expensive to generate. It can\n * also be useful if the content dynamically changes often, so every time you trigger the\n * tooltip the content may have changed (e.g. if you show a ticking time clock in the tooltip).\n *\n * The trigger element will be associated to this content via `aria-describedby`. This means\n * that the tooltip content will be read by assistive technologies such as screen readers. It\n * will likely read this content right after reading the trigger element label.\n */\n content: React.ReactNode | (() => React.ReactNode)\n\n /**\n * How to place the tooltip relative to its trigger element.\n *\n * The possible values are \"top\", \"bottom\", \"left\", \"right\". Additionally, any of these values\n * can be combined with `-start` or `-end` for even more control. For instance `top-start` will\n * place the tooltip at the top, but with the start (e.g. left) side of the toolip and the\n * trigger aligned. If neither `-start` or `-end` are provided, the tooltip is centered along\n * the vertical or horizontal axis with the trigger.\n *\n * The position is enforced whenever possible, but tooltips can appear in different positions\n * if the specified one would make the tooltip intersect with the viewport edges.\n *\n * @default 'top'\n */\n position?: TooltipStoreState['placement']\n\n /**\n * The separation (in pixels) between the trigger element and the tooltip.\n * @default 3\n */\n gapSize?: number\n\n /**\n * Whether to show an arrow-like element attached to the tooltip, and pointing towards the\n * trigger element.\n * @default false\n */\n withArrow?: boolean\n\n /**\n * The amount of time in milliseconds to wait before showing the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 500\n */\n showTimeout?: number\n\n /**\n * The amount of time in milliseconds to wait before hiding the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 100\n */\n hideTimeout?: number\n}\n\nconst Tooltip = React.forwardRef<TooltipStore, TooltipProps>(\n (\n {\n children,\n content,\n position = 'top',\n gapSize = 3,\n withArrow = false,\n showTimeout,\n hideTimeout,\n exceptionallySetClassName,\n },\n ref,\n ) => {\n const { showTimeout: globalShowTimeout, hideTimeout: globalHideTimeout } =\n React.useContext(TooltipContext)\n\n const tooltip = useTooltipStore({\n placement: position,\n showTimeout: showTimeout ?? globalShowTimeout,\n hideTimeout: hideTimeout ?? globalHideTimeout,\n })\n\n React.useImperativeHandle(ref, () => tooltip, [tooltip])\n\n const isOpen = tooltip.useState('open')\n\n const child = React.Children.only(\n children as React.FunctionComponentElement<JSX.IntrinsicElements['div']> | null,\n )\n\n if (!child) {\n return child\n }\n\n return (\n <>\n <TooltipAnchor render={child} store={tooltip} />\n {isOpen && content ? (\n <AriakitTooltip\n store={tooltip}\n gutter={gapSize}\n render={\n <Box\n className={[styles.tooltip, exceptionallySetClassName]}\n background=\"toast\"\n borderRadius=\"standard\"\n paddingX=\"small\"\n paddingY=\"xsmall\"\n maxWidth=\"medium\"\n width=\"fitContent\"\n overflow=\"hidden\"\n textAlign=\"center\"\n />\n }\n >\n {withArrow ? <TooltipArrow /> : null}\n {typeof content === 'function' ? content() : content}\n </AriakitTooltip>\n ) : null}\n </>\n )\n },\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type { TooltipProps }\nexport { Tooltip, TooltipProvider }\n"],"names":["defaultShowTimeout","defaultHideTimeout","TooltipContext","React","createContext","showTimeout","hideTimeout","TooltipProvider","t0","$","_c","t1","t2","children","undefined","t3","value","t4","createElement","Provider","Tooltip","forwardRef","content","position","gapSize","withArrow","exceptionallySetClassName","ref","globalShowTimeout","globalHideTimeout","useContext","tooltip","useTooltipStore","placement","useImperativeHandle","isOpen","useState","child","Children","only","Fragment","TooltipAnchor","render","store","AriakitTooltip","gutter","Box","className","styles","background","borderRadius","paddingX","paddingY","maxWidth","width","overflow","textAlign","TooltipArrow","displayName"],"mappings":";;;;;;AA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-disable react-hooks/refs */
99
- const rawRef = 'ref' in child.props ? child.props.ref :
100
- // child.ref access kept for React 18 compatibility
101
- child.ref;
102
- if (typeof rawRef === 'string') {
103
- throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
104
- }
105
- const childRef = rawRef;
106
97
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(react.TooltipAnchor, {
107
98
  render: child,
108
- store: tooltip,
109
- ref: childRef
99
+ store: tooltip
110
100
  }), isOpen && content ? /*#__PURE__*/React__namespace.createElement(react.Tooltip, {
111
101
  store: tooltip,
112
102
  gutter: gapSize,
@@ -122,7 +112,6 @@ const Tooltip = /*#__PURE__*/React__namespace.forwardRef(({
122
112
  textAlign: "center"
123
113
  })
124
114
  }, withArrow ? /*#__PURE__*/React__namespace.createElement(react.TooltipArrow, null) : null, typeof content === 'function' ? content() : content) : null);
125
- /* eslint-enable react-hooks/refs */
126
115
  });
127
116
  Tooltip.displayName = 'Tooltip';
128
117
 
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n Tooltip as AriakitTooltip,\n TooltipAnchor,\n TooltipArrow,\n useTooltipStore,\n} from '@ariakit/react'\n\nimport { Box } from '../box'\n\nimport styles from './tooltip.module.css'\n\nimport type { TooltipStore, TooltipStoreState } from '@ariakit/react'\nimport type { JSX } from 'react'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst defaultShowTimeout = 500\nconst defaultHideTimeout = 100\n\ntype TooltipContextState = {\n showTimeout: number\n hideTimeout: number\n}\n\nconst TooltipContext = React.createContext<TooltipContextState>({\n showTimeout: defaultShowTimeout,\n hideTimeout: defaultHideTimeout,\n})\n\nfunction TooltipProvider({\n showTimeout = defaultShowTimeout,\n hideTimeout = defaultHideTimeout,\n children,\n}: React.PropsWithChildren<{\n showTimeout?: number\n hideTimeout?: number\n}>) {\n const value = React.useMemo(() => ({ showTimeout, hideTimeout }), [showTimeout, hideTimeout])\n return <TooltipContext.Provider value={value}>{children}</TooltipContext.Provider>\n}\n\ninterface TooltipProps extends ObfuscatedClassName {\n /**\n * The element that triggers the tooltip. Generally a button or link.\n *\n * It should be an interactive element accessible both via mouse and keyboard interactions.\n */\n children: React.ReactNode\n\n /**\n * The content to show in the tooltip.\n *\n * It can be rich content provided via React elements, or string content. It should not include\n * interactive elements inside it. This includes links or buttons.\n *\n * You can provide a function instead of the content itself. In this case, the function should\n * return the desired content. This is useful if the content is expensive to generate. It can\n * also be useful if the content dynamically changes often, so every time you trigger the\n * tooltip the content may have changed (e.g. if you show a ticking time clock in the tooltip).\n *\n * The trigger element will be associated to this content via `aria-describedby`. This means\n * that the tooltip content will be read by assistive technologies such as screen readers. It\n * will likely read this content right after reading the trigger element label.\n */\n content: React.ReactNode | (() => React.ReactNode)\n\n /**\n * How to place the tooltip relative to its trigger element.\n *\n * The possible values are \"top\", \"bottom\", \"left\", \"right\". Additionally, any of these values\n * can be combined with `-start` or `-end` for even more control. For instance `top-start` will\n * place the tooltip at the top, but with the start (e.g. left) side of the toolip and the\n * trigger aligned. If neither `-start` or `-end` are provided, the tooltip is centered along\n * the vertical or horizontal axis with the trigger.\n *\n * The position is enforced whenever possible, but tooltips can appear in different positions\n * if the specified one would make the tooltip intersect with the viewport edges.\n *\n * @default 'top'\n */\n position?: TooltipStoreState['placement']\n\n /**\n * The separation (in pixels) between the trigger element and the tooltip.\n * @default 3\n */\n gapSize?: number\n\n /**\n * Whether to show an arrow-like element attached to the tooltip, and pointing towards the\n * trigger element.\n * @default false\n */\n withArrow?: boolean\n\n /**\n * The amount of time in milliseconds to wait before showing the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 500\n */\n showTimeout?: number\n\n /**\n * The amount of time in milliseconds to wait before hiding the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 100\n */\n hideTimeout?: number\n}\n\nconst Tooltip = React.forwardRef<TooltipStore, TooltipProps>(\n (\n {\n children,\n content,\n position = 'top',\n gapSize = 3,\n withArrow = false,\n showTimeout,\n hideTimeout,\n exceptionallySetClassName,\n },\n ref,\n ) => {\n const { showTimeout: globalShowTimeout, hideTimeout: globalHideTimeout } =\n React.useContext(TooltipContext)\n\n const tooltip = useTooltipStore({\n placement: position,\n showTimeout: showTimeout ?? globalShowTimeout,\n hideTimeout: hideTimeout ?? globalHideTimeout,\n })\n\n React.useImperativeHandle(ref, () => tooltip, [tooltip])\n\n const isOpen = tooltip.useState('open')\n\n const child = React.Children.only(\n children as React.FunctionComponentElement<JSX.IntrinsicElements['div']> | null,\n )\n\n if (!child) {\n return child\n }\n\n /* eslint-disable react-hooks/refs */\n const rawRef =\n 'ref' in child.props\n ? child.props.ref\n : // child.ref access kept for React 18 compatibility\n (child as { ref?: unknown }).ref\n\n if (typeof rawRef === 'string') {\n throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded')\n }\n\n const childRef = rawRef as React.Ref<HTMLDivElement>\n\n return (\n <>\n <TooltipAnchor render={child} store={tooltip} ref={childRef} />\n {isOpen && content ? (\n <AriakitTooltip\n store={tooltip}\n gutter={gapSize}\n render={\n <Box\n className={[styles.tooltip, exceptionallySetClassName]}\n background=\"toast\"\n borderRadius=\"standard\"\n paddingX=\"small\"\n paddingY=\"xsmall\"\n maxWidth=\"medium\"\n width=\"fitContent\"\n overflow=\"hidden\"\n textAlign=\"center\"\n />\n }\n >\n {withArrow ? <TooltipArrow /> : null}\n {typeof content === 'function' ? content() : content}\n </AriakitTooltip>\n ) : null}\n </>\n )\n /* eslint-enable react-hooks/refs */\n },\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type { TooltipProps }\nexport { Tooltip, TooltipProvider }\n"],"names":["defaultShowTimeout","defaultHideTimeout","TooltipContext","React","createContext","showTimeout","hideTimeout","TooltipProvider","t0","$","_c","t1","t2","children","undefined","t3","value","t4","createElement","Provider","Tooltip","forwardRef","content","position","gapSize","withArrow","exceptionallySetClassName","ref","globalShowTimeout","globalHideTimeout","useContext","tooltip","useTooltipStore","placement","useImperativeHandle","isOpen","useState","child","Children","only","rawRef","props","Error","childRef","Fragment","TooltipAnchor","render","store","AriakitTooltip","gutter","Box","className","styles","background","borderRadius","paddingX","paddingY","maxWidth","width","overflow","textAlign","TooltipArrow","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAMA,kBAAkB,GAAG,GAAG,CAAA;AAC9B,MAAMC,kBAAkB,GAAG,GAAG,CAAA;AAO9B,MAAMC,cAAc,gBAAGC,gBAAK,CAACC,aAAa,CAAsB;AAC5DC,EAAAA,WAAW,EAAEL,kBAAkB;AAC/BM,EAAAA,WAAW,EAAEL,kBAAAA;AACjB,CAAC,CAAC,CAAA;AAEF,SAAAM,gBAAAC,EAAA,EAAA;EAAA,MAAAC,CAAA,GAAAC,sBAAA,CAAA,CAAA,CAAA,CAAA;AAAyB,EAAA,MAAA;AAAAL,IAAAA,WAAA,EAAAM,EAAA;AAAAL,IAAAA,WAAA,EAAAM,EAAA;AAAAC,IAAAA,QAAAA;AAAA,GAAA,GAAAL,EAOvB,CAAA;EANE,MAAAH,WAAA,GAAAM,EAAgC,KAAhCG,SAAgC,GAAhCd,kBAAgC,GAAhCW,EAAgC,CAAA;EAChC,MAAAL,WAAA,GAAAM,EAAgC,KAAhCE,SAAgC,GAAhCb,kBAAgC,GAAhCW,EAAgC,CAAA;AAAA,EAAA,IAAAG,EAAA,CAAA;AAAA,EAAA,IAAAN,CAAA,CAAAH,CAAAA,CAAAA,KAAAA,WAAA,IAAAG,CAAA,QAAAJ,WAAA,EAAA;IAMGU,EAAA,GAAA;MAAAV,WAAA;AAAAC,MAAAA,WAAAA;KAA4B,CAAA;AAAAG,IAAAA,CAAA,MAAAH,WAAA,CAAA;AAAAG,IAAAA,CAAA,MAAAJ,WAAA,CAAA;AAAAI,IAAAA,CAAA,MAAAM,EAAA,CAAA;AAAA,GAAA,MAA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B,MAAAA,UAAU,EAAC,OAAO;AAClBC,MAAAA,YAAY,EAAC,UAAU;AACvBC,MAAAA,QAAQ,EAAC,OAAO;AAChBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,KAAK,EAAC,YAAY;AAClBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,SAAS,EAAC,QAAA;KACb,CAAA;GAGJnC,EAAAA,SAAS,gBAAGtB,gBAAA,CAAAe,aAAA,CAAC2C,kBAAY,EAAA,IAAE,CAAC,GAAG,IAAI,EACnC,OAAOvC,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OACjC,CAAC,GACjB,IACN,CAAC,CAAA;AAEP;AACJ,CACJ,EAAC;AAEDF,OAAO,CAAC0C,WAAW,GAAG,SAAS;;;;;"}
1
+ {"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n Tooltip as AriakitTooltip,\n TooltipAnchor,\n TooltipArrow,\n useTooltipStore,\n} from '@ariakit/react'\n\nimport { Box } from '../box'\n\nimport styles from './tooltip.module.css'\n\nimport type { TooltipStore, TooltipStoreState } from '@ariakit/react'\nimport type { JSX } from 'react'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst defaultShowTimeout = 500\nconst defaultHideTimeout = 100\n\ntype TooltipContextState = {\n showTimeout: number\n hideTimeout: number\n}\n\nconst TooltipContext = React.createContext<TooltipContextState>({\n showTimeout: defaultShowTimeout,\n hideTimeout: defaultHideTimeout,\n})\n\nfunction TooltipProvider({\n showTimeout = defaultShowTimeout,\n hideTimeout = defaultHideTimeout,\n children,\n}: React.PropsWithChildren<{\n showTimeout?: number\n hideTimeout?: number\n}>) {\n const value = React.useMemo(() => ({ showTimeout, hideTimeout }), [showTimeout, hideTimeout])\n return <TooltipContext.Provider value={value}>{children}</TooltipContext.Provider>\n}\n\ninterface TooltipProps extends ObfuscatedClassName {\n /**\n * The element that triggers the tooltip. Generally a button or link.\n *\n * It should be an interactive element accessible both via mouse and keyboard interactions.\n */\n children: React.ReactNode\n\n /**\n * The content to show in the tooltip.\n *\n * It can be rich content provided via React elements, or string content. It should not include\n * interactive elements inside it. This includes links or buttons.\n *\n * You can provide a function instead of the content itself. In this case, the function should\n * return the desired content. This is useful if the content is expensive to generate. It can\n * also be useful if the content dynamically changes often, so every time you trigger the\n * tooltip the content may have changed (e.g. if you show a ticking time clock in the tooltip).\n *\n * The trigger element will be associated to this content via `aria-describedby`. This means\n * that the tooltip content will be read by assistive technologies such as screen readers. It\n * will likely read this content right after reading the trigger element label.\n */\n content: React.ReactNode | (() => React.ReactNode)\n\n /**\n * How to place the tooltip relative to its trigger element.\n *\n * The possible values are \"top\", \"bottom\", \"left\", \"right\". Additionally, any of these values\n * can be combined with `-start` or `-end` for even more control. For instance `top-start` will\n * place the tooltip at the top, but with the start (e.g. left) side of the toolip and the\n * trigger aligned. If neither `-start` or `-end` are provided, the tooltip is centered along\n * the vertical or horizontal axis with the trigger.\n *\n * The position is enforced whenever possible, but tooltips can appear in different positions\n * if the specified one would make the tooltip intersect with the viewport edges.\n *\n * @default 'top'\n */\n position?: TooltipStoreState['placement']\n\n /**\n * The separation (in pixels) between the trigger element and the tooltip.\n * @default 3\n */\n gapSize?: number\n\n /**\n * Whether to show an arrow-like element attached to the tooltip, and pointing towards the\n * trigger element.\n * @default false\n */\n withArrow?: boolean\n\n /**\n * The amount of time in milliseconds to wait before showing the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 500\n */\n showTimeout?: number\n\n /**\n * The amount of time in milliseconds to wait before hiding the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 100\n */\n hideTimeout?: number\n}\n\nconst Tooltip = React.forwardRef<TooltipStore, TooltipProps>(\n (\n {\n children,\n content,\n position = 'top',\n gapSize = 3,\n withArrow = false,\n showTimeout,\n hideTimeout,\n exceptionallySetClassName,\n },\n ref,\n ) => {\n const { showTimeout: globalShowTimeout, hideTimeout: globalHideTimeout } =\n React.useContext(TooltipContext)\n\n const tooltip = useTooltipStore({\n placement: position,\n showTimeout: showTimeout ?? globalShowTimeout,\n hideTimeout: hideTimeout ?? globalHideTimeout,\n })\n\n React.useImperativeHandle(ref, () => tooltip, [tooltip])\n\n const isOpen = tooltip.useState('open')\n\n const child = React.Children.only(\n children as React.FunctionComponentElement<JSX.IntrinsicElements['div']> | null,\n )\n\n if (!child) {\n return child\n }\n\n return (\n <>\n <TooltipAnchor render={child} store={tooltip} />\n {isOpen && content ? (\n <AriakitTooltip\n store={tooltip}\n gutter={gapSize}\n render={\n <Box\n className={[styles.tooltip, exceptionallySetClassName]}\n background=\"toast\"\n borderRadius=\"standard\"\n paddingX=\"small\"\n paddingY=\"xsmall\"\n maxWidth=\"medium\"\n width=\"fitContent\"\n overflow=\"hidden\"\n textAlign=\"center\"\n />\n }\n >\n {withArrow ? <TooltipArrow /> : null}\n {typeof content === 'function' ? content() : content}\n </AriakitTooltip>\n ) : null}\n </>\n )\n },\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type { TooltipProps }\nexport { Tooltip, TooltipProvider }\n"],"names":["defaultShowTimeout","defaultHideTimeout","TooltipContext","React","createContext","showTimeout","hideTimeout","TooltipProvider","t0","$","_c","t1","t2","children","undefined","t3","value","t4","createElement","Provider","Tooltip","forwardRef","content","position","gapSize","withArrow","exceptionallySetClassName","ref","globalShowTimeout","globalHideTimeout","useContext","tooltip","useTooltipStore","placement","useImperativeHandle","isOpen","useState","child","Children","only","Fragment","TooltipAnchor","render","store","AriakitTooltip","gutter","Box","className","styles","background","borderRadius","paddingX","paddingY","maxWidth","width","overflow","textAlign","TooltipArrow","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAMA,kBAAkB,GAAG,GAAG,CAAA;AAC9B,MAAMC,kBAAkB,GAAG,GAAG,CAAA;AAO9B,MAAMC,cAA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AA;AAChB,GAAA;AAEA,EAAA,oBACIlC,gBAAA,CAAAe,aAAA,CAAAf,gBAAA,CAAAqC,QAAA,EAAA,IAAA,eACIrC,gBAAA,CAAAe,aAAA,CAACuB,mBAAa,EAAA;AAACC,IAAAA,MAAM,EAAEL,KAAM;AAACM,IAAAA,KAAK,EAAEZ,OAAAA;GAAU,CAAC,EAC/CI,MAAM,IAAIb,OAAO,gBACdnB,gBAAA,CAAAe,aAAA,CAAC0B,aAAc,EAAA;AACXD,IAAAA,KAAK,EAAEZ,OAAQ;AACfc,IAAAA,MAAM,EAAErB,OAAQ;AAChBkB,IAAAA,MAAM,eACFvC,gBAAA,CAAAe,aAAA,CAAC4B,OAAG,EAAA;AACAC,MAAAA,SAAS,EAAE,CAACC,yBAAM,CAACjB,OAAO,EAAEL,yBAAyB,CAAE;AACvDuB,MAAAA,UAAU,EAAC,OAAO;AAClBC,MAAAA,YAAY,EAAC,UAAU;AACvBC,MAAAA,QAAQ,EAAC,OAAO;AAChBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,KAAK,EAAC,YAAY;AAClBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,SAAS,EAAC,QAAA;KACb,CAAA;GAGJ/B,EAAAA,SAAS,gBAAGtB,gBAAA,CAAAe,aAAA,CAACuC,kBAAY,EAAA,IAAE,CAAC,GAAG,IAAI,EACnC,OAAOnC,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OACjC,CAAC,GACjB,IACN,CAAC,CAAA;AAEX,CACJ,EAAC;AAEDF,OAAO,CAACsC,WAAW,GAAG,SAAS;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@doist/reactist",
3
3
  "description": "Open source React components by Doist",
4
- "version": "33.2.1",
4
+ "version": "33.2.2",
5
5
  "repository": "https://github.com/Doist/reactist",
6
6
  "homepage": "https://github.com/Doist/reactist#readme",
7
7
  "bugs": {