@doist/reactist 33.1.0 → 33.2.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 (65) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/reactist.cjs.development.js +378 -144
  3. package/dist/reactist.cjs.development.js.map +1 -1
  4. package/dist/reactist.cjs.production.min.js +1 -1
  5. package/dist/reactist.cjs.production.min.js.map +1 -1
  6. package/es/checkbox-field/checkbox-field.js.map +1 -1
  7. package/es/components/color-picker/deprecated-button/deprecated-button.js +0 -5
  8. package/es/components/color-picker/deprecated-button/deprecated-button.js.map +1 -1
  9. package/es/components/color-picker/deprecated-dropdown/dropdown.js +5 -4
  10. package/es/components/color-picker/deprecated-dropdown/dropdown.js.map +1 -1
  11. package/es/icons/alert-icon.js.map +1 -1
  12. package/es/icons/banner-icon.js.map +1 -1
  13. package/es/icons/close-icon.js.map +1 -1
  14. package/es/icons/password-hidden-icon.js.map +1 -1
  15. package/es/icons/password-visible-icon.js.map +1 -1
  16. package/es/select-field/select-field.js.map +1 -1
  17. package/es/stack/stack.js +3 -1
  18. package/es/stack/stack.js.map +1 -1
  19. package/es/tabs/tabs.js +354 -125
  20. package/es/tabs/tabs.js.map +1 -1
  21. package/es/text-area/text-area.js.map +1 -1
  22. package/es/toast/use-toasts.js +1 -1
  23. package/es/toast/use-toasts.js.map +1 -1
  24. package/es/tooltip/tooltip.js +6 -2
  25. package/es/tooltip/tooltip.js.map +1 -1
  26. package/es/utils/common-helpers.js +11 -6
  27. package/es/utils/common-helpers.js.map +1 -1
  28. package/es/utils/polymorphism.js.map +1 -1
  29. package/lib/checkbox-field/checkbox-field.d.ts +1 -0
  30. package/lib/checkbox-field/checkbox-field.js.map +1 -1
  31. package/lib/components/color-picker/deprecated-button/deprecated-button.js +0 -5
  32. package/lib/components/color-picker/deprecated-button/deprecated-button.js.map +1 -1
  33. package/lib/components/color-picker/deprecated-dropdown/dropdown.d.ts +5 -3
  34. package/lib/components/color-picker/deprecated-dropdown/dropdown.js +5 -5
  35. package/lib/components/color-picker/deprecated-dropdown/dropdown.js.map +1 -1
  36. package/lib/components/icons/ThreeDotsIcon.svg.d.ts +3 -9
  37. package/lib/icons/alert-icon.d.ts +2 -2
  38. package/lib/icons/alert-icon.js.map +1 -1
  39. package/lib/icons/banner-icon.d.ts +2 -2
  40. package/lib/icons/banner-icon.js.map +1 -1
  41. package/lib/icons/close-icon.d.ts +2 -2
  42. package/lib/icons/close-icon.js.map +1 -1
  43. package/lib/icons/password-hidden-icon.d.ts +2 -2
  44. package/lib/icons/password-hidden-icon.js.map +1 -1
  45. package/lib/icons/password-visible-icon.d.ts +2 -2
  46. package/lib/icons/password-visible-icon.js.map +1 -1
  47. package/lib/modal/modal-stories-components.d.ts +10 -9
  48. package/lib/select-field/select-field.js.map +1 -1
  49. package/lib/stack/stack.js +3 -1
  50. package/lib/stack/stack.js.map +1 -1
  51. package/lib/tabs/tabs.js +353 -124
  52. package/lib/tabs/tabs.js.map +1 -1
  53. package/lib/text-area/text-area.js.map +1 -1
  54. package/lib/toast/use-toasts.js +1 -1
  55. package/lib/toast/use-toasts.js.map +1 -1
  56. package/lib/tooltip/tooltip.d.ts +2 -1
  57. package/lib/tooltip/tooltip.js +6 -2
  58. package/lib/tooltip/tooltip.js.map +1 -1
  59. package/lib/utils/common-helpers.js +11 -6
  60. package/lib/utils/common-helpers.js.map +1 -1
  61. package/lib/utils/polymorphism.d.ts +1 -2
  62. package/lib/utils/polymorphism.js.map +1 -1
  63. package/lib/utils/storybook-helper.d.ts +4 -3
  64. package/package.json +23 -11
  65. /package/styles/{stack.css → divider.css} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"text-area.js","sources":["../../src/text-area/text-area.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport classNames from 'classnames'\nimport { useMergeRefs } from 'use-callback-ref'\n\nimport { BaseField } from '../base-field'\nimport { Box } from '../box'\n\nimport styles from './text-area.module.css'\n\nimport type { BaseFieldVariantProps, FieldComponentProps } from '../base-field'\n\ninterface TextAreaProps\n extends Omit<FieldComponentProps<HTMLTextAreaElement>, 'characterCountPosition'>,\n Omit<\n BaseFieldVariantProps,\n 'supportsStartAndEndSlots' | 'endSlot' | 'endSlotPosition' | 'value'\n > {\n /**\n * The value of the text area.\n *\n * If this prop is not specified, the text area will be uncontrolled and the component will\n * manage its own state.\n */\n value?: string\n\n /**\n * The number of visible text lines for the text area.\n *\n * If it is specified, it must be a positive integer. If it is not specified, the default\n * value is 2 (set by the browser).\n *\n * When `autoExpand` is true, this value serves the purpose of specifying the minimum number\n * of rows that the textarea will shrink to when the content is not large enough to make it\n * expand.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n */\n rows?: number\n\n /**\n * If `true`, the textarea will be automatically resized to fit the content, and the ability to\n * manually resize the textarea will be disabled.\n */\n autoExpand?: boolean\n\n /**\n * If `true`, the ability to manually resize the textarea will be disabled.\n *\n * When `autoExpand` is true, this property serves no purpose, because the ability to manually\n * resize the textarea is always disabled when `autoExpand` is true.\n */\n disableResize?: boolean\n}\n\nconst TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n {\n variant = 'default',\n id,\n label,\n value,\n auxiliaryLabel,\n message,\n tone,\n maxWidth,\n maxLength,\n hidden,\n 'aria-describedby': ariaDescribedBy,\n rows,\n autoExpand = false,\n disableResize = false,\n onChange: originalOnChange,\n ...props\n },\n ref,\n) {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const internalRef = React.useRef<HTMLTextAreaElement>(null)\n const combinedRef = useMergeRefs([ref, internalRef])\n\n useAutoExpand({ value, autoExpand, containerRef, internalRef })\n\n const textAreaClassName = classNames([\n autoExpand ? styles.disableResize : null,\n disableResize ? styles.disableResize : null,\n ])\n\n return (\n <BaseField\n variant={variant}\n id={id}\n label={label}\n value={value}\n auxiliaryLabel={auxiliaryLabel}\n message={message}\n tone={tone}\n hidden={hidden}\n aria-describedby={ariaDescribedBy}\n className={[\n styles.textAreaContainer,\n tone === 'error' ? styles.error : null,\n variant === 'bordered' ? styles.bordered : null,\n ]}\n maxWidth={maxWidth}\n maxLength={maxLength}\n >\n {({ onChange, characterCountElement, ...extraProps }) => (\n <Box\n width=\"full\"\n display=\"flex\"\n className={styles.innerContainer}\n ref={containerRef}\n >\n <textarea\n {...props}\n {...extraProps}\n ref={combinedRef}\n rows={rows}\n className={textAreaClassName}\n maxLength={maxLength}\n onChange={(event) => {\n originalOnChange?.(event)\n onChange?.(event)\n }}\n />\n </Box>\n )}\n </BaseField>\n )\n})\n\nfunction useAutoExpand({\n value,\n autoExpand,\n containerRef,\n internalRef,\n}: {\n value: string | undefined\n autoExpand: boolean\n containerRef: React.RefObject<HTMLDivElement>\n internalRef: React.RefObject<HTMLTextAreaElement>\n}) {\n const isControlled = value !== undefined\n\n React.useEffect(\n function setupAutoExpandWhenUncontrolled() {\n const textAreaElement = internalRef.current\n if (!textAreaElement || !autoExpand || isControlled) {\n return undefined\n }\n\n const containerElement = containerRef.current\n\n function handleAutoExpand(value: string) {\n if (containerElement) {\n containerElement.dataset.replicatedValue = value\n }\n }\n\n function handleInput(event: Event) {\n handleAutoExpand((event.currentTarget as HTMLTextAreaElement).value)\n }\n\n // Apply change initially, in case the text area has a non-empty initial value\n handleAutoExpand(textAreaElement.value)\n textAreaElement.addEventListener('input', handleInput)\n return () => textAreaElement.removeEventListener('input', handleInput)\n },\n [autoExpand, containerRef, internalRef, isControlled],\n )\n\n React.useEffect(\n function setupAutoExpandWhenControlled() {\n if (!isControlled || !autoExpand) {\n return\n }\n\n const containerElement = containerRef.current\n if (containerElement) {\n containerElement.dataset.replicatedValue = value\n }\n },\n [value, containerRef, isControlled, autoExpand],\n )\n}\n\nexport { TextArea }\nexport type { TextAreaProps }\n"],"names":["TextArea","React","forwardRef","t0","ref","$","_c","ariaDescribedBy","auxiliaryLabel","hidden","id","label","maxLength","maxWidth","message","originalOnChange","props","rows","t1","t2","t3","tone","value","variant","autoExpand","disableResize","onChange","undefined","containerRef","useRef","internalRef","t4","combinedRef","useMergeRefs","t5","useAutoExpand","t6","styles","t7","t8","classNames","textAreaClassName","t9","error","t10","bordered","t11","textAreaContainer","t12","t13","characterCountElement","extraProps","createElement","Box","width","display","className","innerContainer","_extends","event","BaseField","isControlled","setupAutoExpandWhenUncontrolled","textAreaElement","current","containerElement","handleAutoExpand","value_0","dataset","replicatedValue","handleInput","currentTarget","addEventListener","removeEventListener","useEffect","setupAutoExpandWhenControlled","containerElement_0"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDMA,MAAAA,QAAQ,gBAAGC,gBAAK,CAACC,UAAU,CAAqC,SAAAF,QAAAA,CAAAG,EAAA,EAAAC,GAAA,EAAA;EAAA,MAAAC,CAAA,GAAAC,sBAAA,CAAA,EAAA,CAAA,CAAA;AAAA,EAAA,IAAAC,eAAA,CAAA;AAAA,EAAA,IAAAC,cAAA,CAAA;AAAA,EAAA,IAAAC,MAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,KAAA,CAAA;AAAA,EAAA,IAAAC,SAAA,CAAA;AAAA,EAAA,IAAAC,QAAA,CAAA;AAAA,EAAA,IAAAC,OAAA,CAAA;AAAA,EAAA,IAAAC,gBAAA,CAAA;AAAA,EAAA,IAAAC,KAAA,CAAA;AAAA,EAAA,IAAAC,IAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,IAAA,CAAA;AAAA,EAAA,IAAAC,KAAA,CAAA;EAAA,IAAAjB,CAAA,QAAAF,EAAA,EAAA;AAClE,IAAA,CAAA;AAAAoB,MAAAA,OAAA,EAAAL,EAAA;MAAAR,EAAA;MAAAC,KAAA;MAAAW,KAAA;MAAAd,cAAA;MAAAM,OAAA;MAAAO,IAAA;MAAAR,QAAA;MA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AxD,CAAA,QAAAiB,KAAA,EAAA;AAGGF,IAAAA,EAAA,YAAAuD,6BAAA,GAAA;AACI,MAAA,IAAI,CAACd,YAA2B,IAA5B,CAAkBrC,UAAU,EAAA;AAAA,QAAA,OAAA;AAAA,OAAA;AAIhC,MAAA,MAAAoD,kBAAA,GAAyBhD,YAAY,CAAAoC,OAAQ,CAAA;AAC7C,MAAA,IAAIC,kBAAgB,EAAA;AAChBA,QAAAA,kBAAgB,CAAAG,OAAQ,CAAAC,eAAA,GAAmB/C,KAAH,CAAA;AAAA,OAAA;KAE/C,CAAA;IACDS,EAAA,GAAA,CAACT,KAAK,EAAEM,YAAY,EAAEiC,YAAY,EAAErC,UAAU,CAAC,CAAA;AAAAnB,IAAAA,CAAA,MAAAmB,UAAA,CAAA;AAAAnB,IAAAA,CAAA,MAAAuB,YAAA,CAAA;AAAAvB,IAAAA,CAAA,MAAAwD,YAAA,CAAA;AAAAxD,IAAAA,CAAA,MAAAiB,KAAA,CAAA;AAAAjB,IAAAA,CAAA,OAAAe,EAAA,CAAA;AAAAf,IAAAA,CAAA,OAAA0B,EAAA,CAAA;AAAA,GAAA,MAAA;AAAAX,IAAAA,EAAA,GAAAf,CAAA,CAAA,EAAA,CAAA,CAAA;AAAA0B,IAAAA,EAAA,GAAA1B,CAAA,CAAA,EAAA,CAAA,CAAA;AAAA,GAAA;AAXnDJ,EAAAA,gBAAK,CAAAyE,SAAU,CACXtD,EASC,EACDW,EACJ,CAAC,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"text-area.js","sources":["../../src/text-area/text-area.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport classNames from 'classnames'\nimport { useMergeRefs } from 'use-callback-ref'\n\nimport { BaseField } from '../base-field'\nimport { Box } from '../box'\n\nimport styles from './text-area.module.css'\n\nimport type { BaseFieldVariantProps, FieldComponentProps } from '../base-field'\n\ninterface TextAreaProps\n extends Omit<FieldComponentProps<HTMLTextAreaElement>, 'characterCountPosition'>,\n Omit<\n BaseFieldVariantProps,\n 'supportsStartAndEndSlots' | 'endSlot' | 'endSlotPosition' | 'value'\n > {\n /**\n * The value of the text area.\n *\n * If this prop is not specified, the text area will be uncontrolled and the component will\n * manage its own state.\n */\n value?: string\n\n /**\n * The number of visible text lines for the text area.\n *\n * If it is specified, it must be a positive integer. If it is not specified, the default\n * value is 2 (set by the browser).\n *\n * When `autoExpand` is true, this value serves the purpose of specifying the minimum number\n * of rows that the textarea will shrink to when the content is not large enough to make it\n * expand.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n */\n rows?: number\n\n /**\n * If `true`, the textarea will be automatically resized to fit the content, and the ability to\n * manually resize the textarea will be disabled.\n */\n autoExpand?: boolean\n\n /**\n * If `true`, the ability to manually resize the textarea will be disabled.\n *\n * When `autoExpand` is true, this property serves no purpose, because the ability to manually\n * resize the textarea is always disabled when `autoExpand` is true.\n */\n disableResize?: boolean\n}\n\nconst TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n {\n variant = 'default',\n id,\n label,\n value,\n auxiliaryLabel,\n message,\n tone,\n maxWidth,\n maxLength,\n hidden,\n 'aria-describedby': ariaDescribedBy,\n rows,\n autoExpand = false,\n disableResize = false,\n onChange: originalOnChange,\n ...props\n },\n ref,\n) {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const internalRef = React.useRef<HTMLTextAreaElement>(null)\n const combinedRef = useMergeRefs([ref, internalRef])\n\n useAutoExpand({ value, autoExpand, containerRef, internalRef })\n\n const textAreaClassName = classNames([\n autoExpand ? styles.disableResize : null,\n disableResize ? styles.disableResize : null,\n ])\n\n return (\n <BaseField\n variant={variant}\n id={id}\n label={label}\n value={value}\n auxiliaryLabel={auxiliaryLabel}\n message={message}\n tone={tone}\n hidden={hidden}\n aria-describedby={ariaDescribedBy}\n className={[\n styles.textAreaContainer,\n tone === 'error' ? styles.error : null,\n variant === 'bordered' ? styles.bordered : null,\n ]}\n maxWidth={maxWidth}\n maxLength={maxLength}\n >\n {({ onChange, characterCountElement, ...extraProps }) => (\n <Box\n width=\"full\"\n display=\"flex\"\n className={styles.innerContainer}\n ref={containerRef}\n >\n <textarea\n {...props}\n {...extraProps}\n ref={combinedRef}\n rows={rows}\n className={textAreaClassName}\n maxLength={maxLength}\n onChange={(event) => {\n originalOnChange?.(event)\n onChange?.(event)\n }}\n />\n </Box>\n )}\n </BaseField>\n )\n})\n\nfunction useAutoExpand({\n value,\n autoExpand,\n containerRef,\n internalRef,\n}: {\n value: string | undefined\n autoExpand: boolean\n containerRef: React.RefObject<HTMLDivElement | null>\n internalRef: React.RefObject<HTMLTextAreaElement | null>\n}) {\n const isControlled = value !== undefined\n\n React.useEffect(\n function setupAutoExpandWhenUncontrolled() {\n const textAreaElement = internalRef.current\n if (!textAreaElement || !autoExpand || isControlled) {\n return undefined\n }\n\n const containerElement = containerRef.current\n\n function handleAutoExpand(value: string) {\n if (containerElement) {\n containerElement.dataset.replicatedValue = value\n }\n }\n\n function handleInput(event: Event) {\n handleAutoExpand((event.currentTarget as HTMLTextAreaElement).value)\n }\n\n // Apply change initially, in case the text area has a non-empty initial value\n handleAutoExpand(textAreaElement.value)\n textAreaElement.addEventListener('input', handleInput)\n return () => textAreaElement.removeEventListener('input', handleInput)\n },\n [autoExpand, containerRef, internalRef, isControlled],\n )\n\n React.useEffect(\n function setupAutoExpandWhenControlled() {\n if (!isControlled || !autoExpand) {\n return\n }\n\n const containerElement = containerRef.current\n if (containerElement) {\n containerElement.dataset.replicatedValue = value\n }\n },\n [value, containerRef, isControlled, autoExpand],\n )\n}\n\nexport { TextArea }\nexport type { TextAreaProps }\n"],"names":["TextArea","React","forwardRef","t0","ref","$","_c","ariaDescribedBy","auxiliaryLabel","hidden","id","label","maxLength","maxWidth","message","originalOnChange","props","rows","t1","t2","t3","tone","value","variant","autoExpand","disableResize","onChange","undefined","containerRef","useRef","internalRef","t4","combinedRef","useMergeRefs","t5","useAutoExpand","t6","styles","t7","t8","classNames","textAreaClassName","t9","error","t10","bordered","t11","textAreaContainer","t12","t13","characterCountElement","extraProps","createElement","Box","width","display","className","innerContainer","_extends","event","BaseField","isControlled","setupAutoExpandWhenUncontrolled","textAreaElement","current","containerElement","handleAutoExpand","value_0","dataset","replicatedValue","handleInput","currentTarget","addEventListener","removeEventListener","useEffect","setupAutoExpandWhenControlled","containerElement_0"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDMA,MAAAA,QAAQ,gBAAGC,gBAAK,CAACC,UAAU,CAAqC,SAAAF,QAAAA,CAAAG,EAAA,EAAAC,GAAA,EAAA;EAAA,MAAAC,CAAA,GAAAC,sBAAA,CAAA,EAAA,CAAA,CAAA;AAAA,EAAA,IAAAC,eAAA,CAAA;AAAA,EAAA,IAAAC,cAAA,CAAA;AAAA,EAAA,IAAAC,MAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,KAAA,CAAA;AAAA,EAAA,IAAAC,SAAA,CAAA;AAAA,EAAA,IAAAC,QAAA,CAAA;AAAA,EAAA,IAAAC,OAAA,CAAA;AAAA,EAAA,IAAAC,gBAAA,CAAA;AAAA,EAAA,IAAAC,KAAA,CAAA;AAAA,EAAA,IAAAC,IAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;AAAA,EAAA,IAAAC,IAAA,CAAA;AAAA,EAAA,IAAAC,KAAA,CAAA;EAAA,IAAAjB,CAAA,QAAAF,EAAA,EAAA;AAClE,IAAA,CAAA;AAAAoB,MAAAA,OAAA,EAAAL,EAAA;MAAAR,EAAA;MAAAC,KAAA;MAAAW,KAAA;MAAAd,cAAA;MAAAM,OAAA;MAAAO,IAAA;MAAAR,QAAA;MAAAD,SAAA;MAAAH,MAAA;AAAA,MAAA,kBAAA,EAAAF,eAAA;MAAAU,IAAA;AAAAO,MAAAA,UAAA,EAAAL,EAAA;A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AA5B,CAAkBrC,UAAU,EAAA;AAAA,QAAA,OAAA;AAAA,OAAA;AAIhC,MAAA,MAAAoD,kBAAA,GAAyBhD,YAAY,CAAAoC,OAAQ,CAAA;AAC7C,MAAA,IAAIC,kBAAgB,EAAA;AAChBA,QAAAA,kBAAgB,CAAAG,OAAQ,CAAAC,eAAA,GAAmB/C,KAAH,CAAA;AAAA,OAAA;KAE/C,CAAA;IACDS,EAAA,GAAA,CAACT,KAAK,EAAEM,YAAY,EAAEiC,YAAY,EAAErC,UAAU,CAAC,CAAA;AAAAnB,IAAAA,CAAA,MAAAmB,UAAA,CAAA;AAAAnB,IAAAA,CAAA,MAAAuB,YAAA,CAAA;AAAAvB,IAAAA,CAAA,MAAAwD,YAAA,CAAA;AAAAxD,IAAAA,CAAA,MAAAiB,KAAA,CAAA;AAAAjB,IAAAA,CAAA,OAAAe,EAAA,CAAA;AAAAf,IAAAA,CAAA,OAAA0B,EAAA,CAAA;AAAA,GAAA,MAAA;AAAAX,IAAAA,EAAA,GAAAf,CAAA,CAAA,EAAA,CAAA,CAAA;AAAA0B,IAAAA,EAAA,GAAA1B,CAAA,CAAA,EAAA,CAAA,CAAA;AAAA,GAAA;AAXnDJ,EAAAA,gBAAK,CAAAyE,SAAU,CACXtD,EASC,EACDW,EACJ,CAAC,CAAA;AAAA;;;;"}
@@ -42,7 +42,7 @@ const InternalToast = /*#__PURE__*/React__default["default"].forwardRef(function
42
42
  onRemoveToast
43
43
  } = t0;
44
44
  const showDismissButton = t1 === undefined ? true : t1;
45
- const timeoutRef = React__default["default"].useRef();
45
+ const timeoutRef = React__default["default"].useRef(undefined);
46
46
  let t2;
47
47
  if ($[0] !== onDismiss || $[1] !== onRemoveToast || $[2] !== toastId) {
48
48
  t2 = function removeToast() {
@@ -1 +1 @@
1
- {"version":3,"file":"use-toasts.js","sources":["../../src/toast/use-toasts.tsx"],"sourcesContent":["import React from 'react'\n\nimport { Portal } from '@ariakit/react'\n\nimport { Box } from '../box'\nimport { Stack } from '../stack'\nimport { generateElementId } from '../utils/common-helpers'\n\nimport { isActionObject, StaticToast } from './static-toast'\nimport { useToastsAnimation } from './toast-animation'\n\nimport styles from './toast.module.css'\n\nimport type { Space } from '../utils/common-types'\nimport type { StaticToastProps } from './static-toast'\n\n/**\n * The props needed to fire up a new notification toast.\n */\ntype ToastProps = StaticToastProps & {\n /**\n * The number of seconds the toast is expected to be shown before it is dismissed automatically,\n * or false to disable auto-dismiss.\n *\n * It defaults to whatever is the autoDismissDelay set in the ToastsProvider.\n */\n autoDismissDelay?: number | false\n\n /**\n * The label for the button that dismisses the toast.\n *\n * It defaults to the value set in the ToastsProvider, but individual toasts can have a\n * different value if needed.\n */\n dismissLabel?: string\n\n /**\n * Whether to show the dismiss button or not.\n *\n * Use this value with care. If combined with disabling `autoDismissDelay`, it may leave you\n * with toasts that the user won't be able to dismiss at will. It then is your responsibility to\n * dismiss the toast by calling the function returned by `showToast`.\n */\n showDismissButton?: boolean\n}\n\n//\n// InternalToast component and its props\n//\n\ntype InternalToastProps = Omit<ToastProps, 'autoDismissDelay' | 'dismissLabel'> &\n Required<Pick<ToastProps, 'autoDismissDelay' | 'dismissLabel'>> & {\n toastId: string\n onRemoveToast: (toastId: string) => void\n }\n\n/** @private */\nconst InternalToast = React.forwardRef<HTMLDivElement, InternalToastProps>(function InternalToast(\n {\n message,\n description,\n icon,\n action,\n autoDismissDelay,\n dismissLabel,\n showDismissButton = true,\n toastId,\n onDismiss,\n onRemoveToast,\n },\n ref,\n) {\n const timeoutRef = React.useRef<number | undefined>()\n\n const removeToast = React.useCallback(\n function removeToast() {\n onRemoveToast(toastId)\n onDismiss?.()\n },\n [onDismiss, onRemoveToast, toastId],\n )\n\n const startTimeout = React.useCallback(\n function startTimeout() {\n if (!autoDismissDelay) return\n timeoutRef.current = window.setTimeout(removeToast, autoDismissDelay * 1000)\n },\n [autoDismissDelay, removeToast],\n )\n\n const stopTimeout = React.useCallback(function stopTimeout() {\n clearTimeout(timeoutRef.current)\n timeoutRef.current = undefined\n }, [])\n\n React.useEffect(\n function setupAutoDismiss() {\n stopTimeout()\n startTimeout()\n\n return stopTimeout\n },\n [startTimeout, stopTimeout],\n )\n\n /**\n * If the action is toast action object and not a custom element,\n * the `onClick` property is wrapped in another handler responsible\n * for removing the toast when the action is triggered.\n */\n const actionWithCustomActionHandler = React.useMemo(() => {\n if (!isActionObject(action)) {\n return action\n }\n\n return {\n ...action,\n closeToast: action.closeToast ?? true,\n onClick: function handleActionClick() {\n if (!action) {\n return\n }\n\n action.onClick()\n\n if (action.closeToast ?? true) {\n removeToast()\n }\n },\n }\n }, [action, removeToast])\n\n return (\n <StaticToast\n ref={ref}\n message={message}\n description={description}\n icon={icon}\n action={actionWithCustomActionHandler}\n onDismiss={showDismissButton ? removeToast : undefined}\n dismissLabel={dismissLabel}\n // @ts-expect-error\n onMouseEnter={stopTimeout}\n onMouseLeave={startTimeout}\n />\n )\n})\n\n//\n// Internal state and context\n//\n\ntype InternalToastEntry = Omit<InternalToastProps, 'onRemoveToast'>\ntype ToastsList = readonly InternalToastEntry[]\n\ntype ShowToastAction = (props: ToastProps) => () => void\nconst ToastsContext = React.createContext<ShowToastAction>(() => () => undefined)\n\n/**\n * The props needed by the ToastsProvider component.\n *\n * @see ToastsProvider\n */\ntype ToastsProviderProps = {\n /**\n * The default label to apply to toast dismiss buttons.\n *\n * This is useful in environments that need locatization, so you do not need to pass the same\n * translated label every time you trigger a toast.\n *\n * However, you can still apply a different label to a specific toast, by passing a different\n * value when calling showToast.\n *\n * @default 'Close'\n */\n defaultDismissLabel?: string\n\n /**\n * The default number of seconds after which the toast will be dismissed automatically.\n *\n * You can pass a different value to a specific toast when calling `showToast`. You can even\n * pass `false` if you want a certain toast to never be dismissed automatically.\n *\n * @default 10 (seconds)\n */\n defaultAutoDismissDelay?: number\n\n /**\n * The padding used to separate the toasts from the viewport borders.\n *\n * @default 'large'\n */\n padding?: Space\n\n /**\n * The app wrapped by the provider.\n */\n children: NonNullable<React.ReactNode>\n\n /**\n * Custom classname for the toasts container, if you need to fine-tune the position or other styles\n */\n containerClassName?: string\n}\n\n/**\n * Provides the state management and rendering of the toasts currently active.\n *\n * You need to render this near the top of your app components tree, in order to `useToasts`.\n *\n * @see useToasts\n */\nfunction ToastsProvider({\n children,\n padding = 'large',\n defaultAutoDismissDelay = 10 /* seconds */,\n defaultDismissLabel = 'Close',\n containerClassName,\n}: ToastsProviderProps) {\n const [toasts, setToasts] = React.useState<ToastsList>([])\n const { mappedRef, animateRemove } = useToastsAnimation()\n\n const removeToast = React.useCallback(\n function onRemoveToast(toastId: string) {\n animateRemove(toastId, () => {\n setToasts((list) => {\n const index = list.findIndex((n) => n.toastId === toastId)\n if (index < 0) return list\n const copy = [...list]\n copy.splice(index, 1)\n return copy\n })\n })\n },\n [animateRemove],\n )\n\n const showToast = React.useCallback(\n function showToast(props: ToastProps) {\n const toastId = generateElementId('toast')\n const newToast: InternalToastEntry = {\n autoDismissDelay: defaultAutoDismissDelay,\n dismissLabel: defaultDismissLabel,\n ...props,\n toastId,\n }\n setToasts((list) => [...list, newToast])\n return () => removeToast(toastId)\n },\n [defaultAutoDismissDelay, defaultDismissLabel, removeToast],\n )\n\n return (\n <ToastsContext.Provider value={showToast}>\n {children}\n <Portal>\n {toasts.length === 0 ? null : (\n <Box\n className={[styles.stackedToastsView, containerClassName]}\n position=\"fixed\"\n width=\"full\"\n paddingX={padding}\n paddingBottom={padding}\n data-testid=\"toasts-container\"\n >\n <Stack space=\"medium\">\n {toasts.map(({ toastId, ...props }) => (\n <InternalToast\n key={toastId}\n ref={mappedRef(toastId)}\n toastId={toastId}\n onRemoveToast={removeToast}\n {...props}\n />\n ))}\n </Stack>\n </Box>\n )}\n </Portal>\n </ToastsContext.Provider>\n )\n}\n\n/**\n * Provides a function `showToast` that shows a new toast every time you call it.\n *\n * ```jsx\n * const showToast = useToasts()\n *\n * <button onClick={() => showToast({ message: 'Hello' })}>\n * Say hello\n * </button>\n * ```\n *\n * All toasts fired via this function are rendered in a global fixed location, and stacked one on\n * top of the other.\n *\n * When called, `showToast` returns a function that dismisses the toast when called.\n *\n * @see ToastsProvider\n */\nfunction useToasts() {\n return React.useContext(ToastsContext)\n}\n\n/**\n * Adds a toast to be rendered, stacked alongside any other currently active toasts.\n *\n * For most situations, you should prefer to use the `showToast` function obtained from `useToasts`.\n * This component is provided for convenience to render toasts in the markup, but it has some\n * peculiarities, which are discussed below.\n *\n * Internally, this calls `showToast`. It is provided for two reasons:\n *\n * 1. Convenience, when you want to fire a toast in markup/jsx code. Keep in mind, though, that\n * toasts rendered in this way will be removed from view when the context where it is rendered\n * is unmounted. Unlike toasts fired with `showToast`, which will normally be dismissed, either\n * by the user or after a delay. They'll still be animated on their way out, though.\n * 2. When combined with disabling dismissing it (e.g. `showDismissButton={false}` and\n * `autoDismissDelay={false}` it provides a way to show \"permanent\" toasts that only go away when\n * the component ceases to be rendered).\n *\n * This is useful for cases when the consumer wants to control when a toast is visible, and to keep\n * it visible based on an app-specific condition.\n *\n * Something important to note about this component is that it triggers the toast based on the props\n * passed when first rendered, and it does not update the toast if these props change on subsequent\n * renders. In this sense, this is an imperative component, more than a descriptive one. This is\n * done to simplify the internals, and to keep it in line with how `showToast` works: you fire up a\n * toast imperatively, and you loose control over it. It remains rendered according to the props you\n * first passed.\n *\n * @see useToasts\n */\nfunction Toast(props: ToastProps) {\n const showToast = useToasts()\n const propsRef = React.useRef<ToastProps>(props)\n React.useEffect(() => {\n const dismissToast = showToast(propsRef.current)\n return dismissToast\n }, [showToast])\n return null\n}\n\nexport { Toast, ToastsProvider, useToasts }\nexport type { ToastProps, ToastsProviderProps }\n"],"names":["InternalToast","React","forwardRef","t0","ref","$","_c","message","description","icon","action","autoDismissDelay","dismissLabel","showDismissButton","t1","toastId","onDismiss","onRemoveToast","undefined","timeoutRef","useRef","t2","removeToast","t3","startTimeout","current","window","setTimeout","t4","Symbol","for","stopTimeout","clearTimeout","t5","t6","setupAutoDismiss","useEffect","t7","bb0","isActionObject","t8","closeToast","t9","handleActionClick","onClick","t10","actionWithCustomActionHandler","createElement","StaticToast","ToastsContext","createContext","ToastsProvider","children","padding","defaultAutoDismissDelay","defaultDismissLabel","containerClassName","toasts","setToasts","useState","mappedRef","animateRemove","useToastsAnimation","list","index","findIndex","n","copy","splice","showToast","props","toastId_0","generateElementId","newToast","list_0","length","Box","className","styles","stackedToastsView","position","width","Stack","space","map","toastId_1","props_0","_extends","Portal","Provider","useToasts","useContext","Toast","propsRef","dismissToast"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA;AACA;AACA;;AA4BA;AACA;AACA;;AAQA;AACA,MAAMA,aAAa,gBAAGC,yBAAK,CAACC,UAAU,CAAqC,SAAAF,aAAAA,CAAAG,EAAA,EAAAC,GAAA,EAAA;EAAA,MAAAC,CAAA,GAAAC,sBAAA,CAAA,EAAA,CAAA,CAAA;AACvE,EAAA,MAAA;IAAAC,OAAA;IAAAC,WAAA;IAAAC,IAAA;IAAAC,MAAA;IAAAC,gBAAA;IAAAC,YAAA;AAAAC,IAAAA,iBAAA,EAAAC,EAAA;IAAAC,OAAA;IAAAC,SAAA;AAAAC,IAAAA,aAAAA;AAAA,GAAA,GAAAd,EAWC,CAAA;EAJG,MAAAU,iBAAA,GAAAC,EAAwB,KAAxBI,SAAwB,GAAxB,IAAwB,GAAxBJ,EAAwB,CAAA;AAO5B,EAAA,MAAAK,UAAA,GAAmBlB,yBAAK,CAAAmB,MAAO,EAAsB,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;EAAA,IAAAhB,CAAA,CAAAW,CAAAA,CAAAA,KAAAA,SAAA,IAAAX,CAAA,QAAAY,aAAA,IAAAZ,CAAA,CAAA,CAAA,CAAA,KAAAU,OAAA,EAAA;AAGjDM,IAAAA,EAAA,YAAAC,WAAA,GAAA;MACIL,aAAa,CAACF,OAAO,CAAC,CAAA;AACtBC,MAAAA,SAAS,IAAI,CAAA;KAChB,CAAA;AAAAX,IAAAA,CAAA,MAAAW,SAAA,CAAA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AAAW,EAAA,CAAA;EAAA,IAAAT,CAAA,QAAAgE,SAAA,EAAA;AAChClE,IAAAA,EAAA,GAAAA,MAAA;AACZ,MAAA,MAAA2F,YAAA,GAAqBzB,SAAS,CAACwB,QAAQ,CAAApE,OAAQ,CAAC,CAAA;AAAA,MAAA,OACzCqE,YAAY,CAAA;KACtB,CAAA;IAAEhF,EAAA,GAAA,CAACuD,SAAS,CAAC,CAAA;AAAAhE,IAAAA,CAAA,MAAAgE,SAAA,CAAA;AAAAhE,IAAAA,CAAA,MAAAF,EAAA,CAAA;AAAAE,IAAAA,CAAA,MAAAS,EAAA,CAAA;AAAA,GAAA,MAAA;AAAAX,IAAAA,EAAA,GAAAE,CAAA,CAAA,CAAA,CAAA,CAAA;AAAAS,IAAAA,EAAA,GAAAT,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAHdJ,EAAAA,yBAAK,CAAAmC,SAAU,CAACjC,EAGf,EAAEW,EAAW,CAAC,CAAA;AAAA,EAAA,OACR,IAAI,CAAA;AAAA;;;;;;"}
1
+ {"version":3,"file":"use-toasts.js","sources":["../../src/toast/use-toasts.tsx"],"sourcesContent":["import React from 'react'\n\nimport { Portal } from '@ariakit/react'\n\nimport { Box } from '../box'\nimport { Stack } from '../stack'\nimport { generateElementId } from '../utils/common-helpers'\n\nimport { isActionObject, StaticToast } from './static-toast'\nimport { useToastsAnimation } from './toast-animation'\n\nimport styles from './toast.module.css'\n\nimport type { Space } from '../utils/common-types'\nimport type { StaticToastProps } from './static-toast'\n\n/**\n * The props needed to fire up a new notification toast.\n */\ntype ToastProps = StaticToastProps & {\n /**\n * The number of seconds the toast is expected to be shown before it is dismissed automatically,\n * or false to disable auto-dismiss.\n *\n * It defaults to whatever is the autoDismissDelay set in the ToastsProvider.\n */\n autoDismissDelay?: number | false\n\n /**\n * The label for the button that dismisses the toast.\n *\n * It defaults to the value set in the ToastsProvider, but individual toasts can have a\n * different value if needed.\n */\n dismissLabel?: string\n\n /**\n * Whether to show the dismiss button or not.\n *\n * Use this value with care. If combined with disabling `autoDismissDelay`, it may leave you\n * with toasts that the user won't be able to dismiss at will. It then is your responsibility to\n * dismiss the toast by calling the function returned by `showToast`.\n */\n showDismissButton?: boolean\n}\n\n//\n// InternalToast component and its props\n//\n\ntype InternalToastProps = Omit<ToastProps, 'autoDismissDelay' | 'dismissLabel'> &\n Required<Pick<ToastProps, 'autoDismissDelay' | 'dismissLabel'>> & {\n toastId: string\n onRemoveToast: (toastId: string) => void\n }\n\n/** @private */\nconst InternalToast = React.forwardRef<HTMLDivElement, InternalToastProps>(function InternalToast(\n {\n message,\n description,\n icon,\n action,\n autoDismissDelay,\n dismissLabel,\n showDismissButton = true,\n toastId,\n onDismiss,\n onRemoveToast,\n },\n ref,\n) {\n const timeoutRef = React.useRef<number | undefined>(undefined)\n\n const removeToast = React.useCallback(\n function removeToast() {\n onRemoveToast(toastId)\n onDismiss?.()\n },\n [onDismiss, onRemoveToast, toastId],\n )\n\n const startTimeout = React.useCallback(\n function startTimeout() {\n if (!autoDismissDelay) return\n timeoutRef.current = window.setTimeout(removeToast, autoDismissDelay * 1000)\n },\n [autoDismissDelay, removeToast],\n )\n\n const stopTimeout = React.useCallback(function stopTimeout() {\n clearTimeout(timeoutRef.current)\n timeoutRef.current = undefined\n }, [])\n\n React.useEffect(\n function setupAutoDismiss() {\n stopTimeout()\n startTimeout()\n\n return stopTimeout\n },\n [startTimeout, stopTimeout],\n )\n\n /**\n * If the action is toast action object and not a custom element,\n * the `onClick` property is wrapped in another handler responsible\n * for removing the toast when the action is triggered.\n */\n const actionWithCustomActionHandler = React.useMemo(() => {\n if (!isActionObject(action)) {\n return action\n }\n\n return {\n ...action,\n closeToast: action.closeToast ?? true,\n onClick: function handleActionClick() {\n if (!action) {\n return\n }\n\n action.onClick()\n\n if (action.closeToast ?? true) {\n removeToast()\n }\n },\n }\n }, [action, removeToast])\n\n return (\n <StaticToast\n ref={ref}\n message={message}\n description={description}\n icon={icon}\n action={actionWithCustomActionHandler}\n onDismiss={showDismissButton ? removeToast : undefined}\n dismissLabel={dismissLabel}\n // @ts-expect-error\n onMouseEnter={stopTimeout}\n onMouseLeave={startTimeout}\n />\n )\n})\n\n//\n// Internal state and context\n//\n\ntype InternalToastEntry = Omit<InternalToastProps, 'onRemoveToast'>\ntype ToastsList = readonly InternalToastEntry[]\n\ntype ShowToastAction = (props: ToastProps) => () => void\nconst ToastsContext = React.createContext<ShowToastAction>(() => () => undefined)\n\n/**\n * The props needed by the ToastsProvider component.\n *\n * @see ToastsProvider\n */\ntype ToastsProviderProps = {\n /**\n * The default label to apply to toast dismiss buttons.\n *\n * This is useful in environments that need locatization, so you do not need to pass the same\n * translated label every time you trigger a toast.\n *\n * However, you can still apply a different label to a specific toast, by passing a different\n * value when calling showToast.\n *\n * @default 'Close'\n */\n defaultDismissLabel?: string\n\n /**\n * The default number of seconds after which the toast will be dismissed automatically.\n *\n * You can pass a different value to a specific toast when calling `showToast`. You can even\n * pass `false` if you want a certain toast to never be dismissed automatically.\n *\n * @default 10 (seconds)\n */\n defaultAutoDismissDelay?: number\n\n /**\n * The padding used to separate the toasts from the viewport borders.\n *\n * @default 'large'\n */\n padding?: Space\n\n /**\n * The app wrapped by the provider.\n */\n children: NonNullable<React.ReactNode>\n\n /**\n * Custom classname for the toasts container, if you need to fine-tune the position or other styles\n */\n containerClassName?: string\n}\n\n/**\n * Provides the state management and rendering of the toasts currently active.\n *\n * You need to render this near the top of your app components tree, in order to `useToasts`.\n *\n * @see useToasts\n */\nfunction ToastsProvider({\n children,\n padding = 'large',\n defaultAutoDismissDelay = 10 /* seconds */,\n defaultDismissLabel = 'Close',\n containerClassName,\n}: ToastsProviderProps) {\n const [toasts, setToasts] = React.useState<ToastsList>([])\n const { mappedRef, animateRemove } = useToastsAnimation()\n\n const removeToast = React.useCallback(\n function onRemoveToast(toastId: string) {\n animateRemove(toastId, () => {\n setToasts((list) => {\n const index = list.findIndex((n) => n.toastId === toastId)\n if (index < 0) return list\n const copy = [...list]\n copy.splice(index, 1)\n return copy\n })\n })\n },\n [animateRemove],\n )\n\n const showToast = React.useCallback(\n function showToast(props: ToastProps) {\n const toastId = generateElementId('toast')\n const newToast: InternalToastEntry = {\n autoDismissDelay: defaultAutoDismissDelay,\n dismissLabel: defaultDismissLabel,\n ...props,\n toastId,\n }\n setToasts((list) => [...list, newToast])\n return () => removeToast(toastId)\n },\n [defaultAutoDismissDelay, defaultDismissLabel, removeToast],\n )\n\n return (\n <ToastsContext.Provider value={showToast}>\n {children}\n <Portal>\n {toasts.length === 0 ? null : (\n <Box\n className={[styles.stackedToastsView, containerClassName]}\n position=\"fixed\"\n width=\"full\"\n paddingX={padding}\n paddingBottom={padding}\n data-testid=\"toasts-container\"\n >\n <Stack space=\"medium\">\n {toasts.map(({ toastId, ...props }) => (\n <InternalToast\n key={toastId}\n ref={mappedRef(toastId)}\n toastId={toastId}\n onRemoveToast={removeToast}\n {...props}\n />\n ))}\n </Stack>\n </Box>\n )}\n </Portal>\n </ToastsContext.Provider>\n )\n}\n\n/**\n * Provides a function `showToast` that shows a new toast every time you call it.\n *\n * ```jsx\n * const showToast = useToasts()\n *\n * <button onClick={() => showToast({ message: 'Hello' })}>\n * Say hello\n * </button>\n * ```\n *\n * All toasts fired via this function are rendered in a global fixed location, and stacked one on\n * top of the other.\n *\n * When called, `showToast` returns a function that dismisses the toast when called.\n *\n * @see ToastsProvider\n */\nfunction useToasts() {\n return React.useContext(ToastsContext)\n}\n\n/**\n * Adds a toast to be rendered, stacked alongside any other currently active toasts.\n *\n * For most situations, you should prefer to use the `showToast` function obtained from `useToasts`.\n * This component is provided for convenience to render toasts in the markup, but it has some\n * peculiarities, which are discussed below.\n *\n * Internally, this calls `showToast`. It is provided for two reasons:\n *\n * 1. Convenience, when you want to fire a toast in markup/jsx code. Keep in mind, though, that\n * toasts rendered in this way will be removed from view when the context where it is rendered\n * is unmounted. Unlike toasts fired with `showToast`, which will normally be dismissed, either\n * by the user or after a delay. They'll still be animated on their way out, though.\n * 2. When combined with disabling dismissing it (e.g. `showDismissButton={false}` and\n * `autoDismissDelay={false}` it provides a way to show \"permanent\" toasts that only go away when\n * the component ceases to be rendered).\n *\n * This is useful for cases when the consumer wants to control when a toast is visible, and to keep\n * it visible based on an app-specific condition.\n *\n * Something important to note about this component is that it triggers the toast based on the props\n * passed when first rendered, and it does not update the toast if these props change on subsequent\n * renders. In this sense, this is an imperative component, more than a descriptive one. This is\n * done to simplify the internals, and to keep it in line with how `showToast` works: you fire up a\n * toast imperatively, and you loose control over it. It remains rendered according to the props you\n * first passed.\n *\n * @see useToasts\n */\nfunction Toast(props: ToastProps) {\n const showToast = useToasts()\n const propsRef = React.useRef<ToastProps>(props)\n React.useEffect(() => {\n const dismissToast = showToast(propsRef.current)\n return dismissToast\n }, [showToast])\n return null\n}\n\nexport { Toast, ToastsProvider, useToasts }\nexport type { ToastProps, ToastsProviderProps }\n"],"names":["InternalToast","React","forwardRef","t0","ref","$","_c","message","description","icon","action","autoDismissDelay","dismissLabel","showDismissButton","t1","toastId","onDismiss","onRemoveToast","undefined","timeoutRef","useRef","t2","removeToast","t3","startTimeout","current","window","setTimeout","t4","Symbol","for","stopTimeout","clearTimeout","t5","t6","setupAutoDismiss","useEffect","t7","bb0","isActionObject","t8","closeToast","t9","handleActionClick","onClick","t10","actionWithCustomActionHandler","createElement","StaticToast","ToastsContext","createContext","ToastsProvider","children","padding","defaultAutoDismissDelay","defaultDismissLabel","containerClassName","toasts","setToasts","useState","mappedRef","animateRemove","useToastsAnimation","list","index","findIndex","n","copy","splice","showToast","props","toastId_0","generateElementId","newToast","list_0","length","Box","className","styles","stackedToastsView","position","width","Stack","space","map","toastId_1","props_0","_extends","Portal","Provider","useToasts","useContext","Toast","propsRef","dismissToast"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA;AACA;AACA;;AA4BA;AACA;AACA;;AAQA;AACA,MAAMA,aAAa,gBAAGC,yBAAK,CAACC,UAAU,CAAqC,SAAAF,aAAAA,CAA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AA,CAAA,CAAA,CAAA,CAAA;AAAAS,IAAAA,EAAA,GAAAT,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAHdJ,EAAAA,yBAAK,CAAAmC,SAAU,CAACjC,EAGf,EAAEW,EAAW,CAAC,CAAA;AAAA,EAAA,OACR,IAAI,CAAA;AAAA;;;;;;"}
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import type { TooltipStore, TooltipStoreState } from '@ariakit/react';
3
+ import type { JSX } from 'react';
3
4
  import type { ObfuscatedClassName } from '../utils/common-types';
4
5
  declare function TooltipProvider({ showTimeout, hideTimeout, children, }: React.PropsWithChildren<{
5
6
  showTimeout?: number;
6
7
  hideTimeout?: number;
7
- }>): React.JSX.Element;
8
+ }>): JSX.Element;
8
9
  interface TooltipProps extends ObfuscatedClassName {
9
10
  /**
10
11
  * The element that triggers the tooltip. Generally a button or link.
@@ -96,13 +96,17 @@ const Tooltip = /*#__PURE__*/React__namespace.forwardRef(({
96
96
  }
97
97
 
98
98
  /* eslint-disable react-hooks/refs */
99
- if (typeof child.ref === 'string') {
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') {
100
103
  throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
101
104
  }
105
+ const childRef = rawRef;
102
106
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(react.TooltipAnchor, {
103
107
  render: child,
104
108
  store: tooltip,
105
- ref: child.ref
109
+ ref: childRef
106
110
  }), isOpen && content ? /*#__PURE__*/React__namespace.createElement(react.Tooltip, {
107
111
  store: tooltip,
108
112
  gutter: gapSize,
@@ -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 { 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 if (typeof child.ref === 'string') {\n throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded')\n }\n\n return (\n <>\n <TooltipAnchor render={child} store={tooltip} ref={child.ref} />\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","Error","Fragment","TooltipAnchor","render","store","AriakitTooltip","gutter","Box","className","styles","background","borderRadius","paddingX","paddingY","maxWidth","width","overflow","textAlign","TooltipArrow","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,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,CA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eACFxC,gBAAA,CAAAe,aAAA,CAAC6B,OAAG,EAAA;AACAC,MAAAA,SAAS,EAAE,CAACC,yBAAM,CAAClB,OAAO,EAAEL,yBAAyB,CAAE;AACvDwB,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;GAGJhC,EAAAA,SAAS,gBAAGtB,gBAAA,CAAAe,aAAA,CAACwC,kBAAY,EAAA,IAAE,CAAC,GAAG,IAAI,EACnC,OAAOpC,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OACjC,CAAC,GACjB,IACN,CAAC,CAAA;AAEP;AACJ,CACJ,EAAC;AAEDF,OAAO,CAACuC,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 /* 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,CAA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AAyB,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,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;;;;;"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var reactCompilerRuntime = require('react-compiler-runtime');
5
6
  var React = require('react');
6
7
 
7
8
  function _interopNamespace(e) {
@@ -37,13 +38,17 @@ function generateElementId(prefix) {
37
38
  * @deprecated Use `useId` available from React 18 or above instead.
38
39
  */
39
40
  function useId(providedId) {
40
- const ref = React__namespace.useRef(providedId ?? null);
41
- // eslint-disable-next-line react-hooks/refs
42
- if (!ref.current) {
43
- ref.current = generateElementId('element');
41
+ const $ = reactCompilerRuntime.c(2);
42
+ let t0;
43
+ if ($[0] !== providedId) {
44
+ t0 = () => providedId || generateElementId("element");
45
+ $[0] = providedId;
46
+ $[1] = t0;
47
+ } else {
48
+ t0 = $[1];
44
49
  }
45
- // eslint-disable-next-line react-hooks/refs
46
- return ref.current;
50
+ const [id] = React__namespace.useState(t0);
51
+ return id;
47
52
  }
48
53
 
49
54
  exports.generateElementId = generateElementId;
@@ -1 +1 @@
1
- {"version":3,"file":"common-helpers.js","sources":["../../src/utils/common-helpers.ts"],"sourcesContent":["import * as React from 'react'\n\nlet uid = 0\nfunction uniqueId() {\n return uid++\n}\n\nexport function generateElementId(prefix: string): string {\n const num = uniqueId()\n return `${prefix}-${num}`\n}\n\n/**\n * @deprecated Use `useId` available from React 18 or above instead.\n */\nexport function useId(providedId?: string): string {\n const ref = React.useRef<string | null>(providedId ?? null)\n // eslint-disable-next-line react-hooks/refs\n if (!ref.current) {\n ref.current = generateElementId('element')\n }\n // eslint-disable-next-line react-hooks/refs\n return ref.current\n}\n"],"names":["uid","uniqueId","generateElementId","prefix","num","useId","providedId","ref","React","useRef","current"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAIA,GAAG,GAAG,CAAC,CAAA;AACX,SAASC,QAAQA,GAAG;AAChB,EAAA,OAAOD,GAAG,EAAE,CAAA;AAChB,CAAA;AAEO,SAASE,iBAAiBA,CAACC,MAAc,EAAU;AACtD,EAAA,MAAMC,GAAG,GAAGH,QAAQ,EAAE,CAAA;AACtB,EAAA,OAAO,CAAGE,EAAAA,MAAM,CAAIC,CAAAA,EAAAA,GAAG,CAAE,CAAA,CAAA;AAC7B,CAAA;;AAEA;AACA;AACA;AACO,SAASC,KAAKA,CAACC,UAAmB,EAAU;EAC/C,MAAMC,GAAG,GAAGC,gBAAK,CAACC,MAAM,CAAgBH,UAAU,IAAI,IAAI,CAAC,CAAA;AAC3D;AACA,EAAA,IAAI,CAACC,GAAG,CAACG,OAAO,EAAE;AACdH,IAAAA,GAAG,CAACG,OAAO,GAAGR,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAC9C,GAAA;AACA;EACA,OAAOK,GAAG,CAACG,OAAO,CAAA;AACtB;;;;;"}
1
+ {"version":3,"file":"common-helpers.js","sources":["../../src/utils/common-helpers.ts"],"sourcesContent":["import * as React from 'react'\n\nlet uid = 0\nfunction uniqueId() {\n return uid++\n}\n\nexport function generateElementId(prefix: string): string {\n const num = uniqueId()\n return `${prefix}-${num}`\n}\n\n/**\n * @deprecated Use `useId` available from React 18 or above instead.\n */\nexport function useId(providedId?: string): string {\n const [id] = React.useState<string>(() => providedId || generateElementId('element'))\n return id\n}\n"],"names":["uid","uniqueId","generateElementId","prefix","num","useId","providedId","$","_c","t0","id","React","useState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAIA,GAAG,GAAG,CAAC,CAAA;AACX,SAASC,QAAQA,GAAG;AAChB,EAAA,OAAOD,GAAG,EAAE,CAAA;AAChB,CAAA;AAEO,SAASE,iBAAiBA,CAACC,MAAc,EAAU;AACtD,EAAA,MAAMC,GAAG,GAAGH,QAAQ,EAAE,CAAA;AACtB,EAAA,OAAO,CAAGE,EAAAA,MAAM,CAAIC,CAAAA,EAAAA,GAAG,CAAE,CAAA,CAAA;AAC7B,CAAA;;AAEA;AACA;AACA;AACO,SAAAC,MAAAC,UAAA,EAAA;EAAA,MAAAC,CAAA,GAAAC,sBAAA,CAAA,CAAA,CAAA,CAAA;AAAA,EAAA,IAAAC,EAAA,CAAA;EAAA,IAAAF,CAAA,QAAAD,UAAA,EAAA;IACiCG,EAAA,GAAAA,MAAMH,UAA0C,IAA5BJ,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAAAK,IAAAA,CAAA,MAAAD,UAAA,CAAA;AAAAC,IAAAA,CAAA,MAAAE,EAAA,CAAA;AAAA,GAAA,MAAA;AAAAA,IAAAA,EAAA,GAAAF,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAApF,EAAA,MAAA,CAAAG,EAAA,CAAaC,GAAAA,gBAAK,CAAAC,QAAS,CAASH,EAAgD,CAAC,CAAA;AAAA,EAAA,OAC9EC,EAAE,CAAA;AAAA;;;;;"}
@@ -66,7 +66,7 @@ type ElementByTagOrAny<ComponentType extends React.ElementType> = ComponentType
66
66
  * @see WithObfuscatedClassName
67
67
  */
68
68
  interface ForwardRefFunction<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode> {
69
- (props: PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>, ref: ((instance: ElementByTagOrAny<ComponentType> | null) => void) | React.MutableRefObject<ElementByTagOrAny<ComponentType> | null> | null): React.ReactElement | null;
69
+ (props: React.PropsWithoutRef<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>, ref: React.ForwardedRef<ElementByTagOrAny<ComponentType>>): React.ReactElement | null;
70
70
  displayName?: string;
71
71
  }
72
72
  /**
@@ -120,7 +120,6 @@ interface PolymorphicComponent<ComponentType extends React.ElementType, OwnProps
120
120
  <TT extends React.ElementType = ComponentType>(props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>): React.ReactElement | null;
121
121
  readonly $$typeof: symbol;
122
122
  defaultProps?: Partial<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
123
- propTypes?: React.WeakValidationMap<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
124
123
  displayName?: string;
125
124
  }
126
125
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport * as React from 'react'\n\nimport type { ObfuscatedClassName } from './common-types'\n\ntype Merge<P1, P2> = Omit<P1, keyof P2> & P2\n\ntype EmptyObject = {\n [K in any]: never\n}\n\ntype ObfuscateClassNameMode = 'keepClassName' | 'obfuscateClassName' | 'omitClassName'\n\n/**\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This can be customized via the second generic parameter, as there are cases where it may be\n * needed to omit this behaviour and keep the `className`. You can also instruct it to remove the\n * `className` prop while not replacing it with the `exceptionallySetClassName` one.\n *\n * @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop\n * @see PolymorphicComponent for details about this feature\n */\ntype WithObfuscatedClassName<\n Props,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> = 'className' extends keyof Props\n ? ShouldObfuscateClassName extends 'obfuscateClassName'\n ? Omit<Props, 'className'> & ObfuscatedClassName\n : ShouldObfuscateClassName extends 'omitClassName'\n ? Omit<Props, 'className'>\n : ShouldObfuscateClassName extends 'keepClassName'\n ? Props\n : never\n : Props\n\ntype PolymorphicProp<ComponentType extends React.ElementType> = {\n /**\n * Used to instruct this component what React element to render as. It can be both a string\n * representing a HTML tag name, or a React component.\n *\n * When using this prop, the component you apply it to will also recognize in its props types\n * all the props from the component or HTML element you are rendering it as.\n *\n * Some uses for this feature:\n *\n * - Using some of our layout components, while at the same time being able to set them to use\n * semantic HTML elements needed for accessibility purposes (e.g. `nav`, `main`, etc).\n * - Using a design system link component, but have it internally use a client-side router link\n * implemented via a React component (e.g. react-router's `Link`).\n *\n * Keep in mind that not all compositions of this kind may work well, especially when composing\n * with another React component and not with a HTML tag name. In particular, if the components\n * being composed have opposing concerns of clashing features (e.g. they have contradicting\n * styles applied to them) things may not go well. In those cases prefer to nest them instead.\n *\n * @see PolymorphicComponent\n */\n as?: ComponentType\n}\n\n/**\n * Given a component or element type, and a set of additional props, this builds the entire set of\n * props for a polymorphic component.\n *\n * It does three things:\n *\n * 1. it merges the element type props with the `OwnProps`\n * 2. it adds the `as` prop to allow for polymorphism to happen\n * 3. it optionally obfuscates or omits the className prop if present\n *\n * @see PolymorphicProp\n * @see WithObfuscatedClassName\n */\ntype PolymorphicComponentProps<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> = Merge<\n WithObfuscatedClassName<React.ComponentProps<ComponentType>, ShouldObfuscateClassName>,\n OwnProps & PolymorphicProp<ComponentType>\n>\n\ntype ElementTagNameMap = HTMLElementTagNameMap &\n Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>\n\ntype ElementByTag<TagName extends keyof ElementTagNameMap> = ElementTagNameMap[TagName]\n\ntype ElementByTagOrAny<ComponentType extends React.ElementType> =\n ComponentType extends keyof ElementTagNameMap ? ElementByTag<ComponentType> : any\n\n/**\n * The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via\n * the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.\n *\n * @see PolymorphicComponentProps\n * @see WithObfuscatedClassName\n */\ninterface ForwardRefFunction<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> {\n (\n props: PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>,\n ref:\n | ((instance: ElementByTagOrAny<ComponentType> | null) => void)\n | React.MutableRefObject<ElementByTagOrAny<ComponentType> | null>\n | null,\n ): React.ReactElement | null\n displayName?: string\n}\n\n/**\n * A component that can customize the React element type that it renders (a.k.a. a polymorphic\n * component). This is achieved by passing a prop `as={ElementType}` or `as=\"html-tag-name\"`.\n *\n * It transparently takes care of forwarding refs, and properly sets the ref type depending on the\n * element type.\n *\n * ## Recognizing props based on the polymorphic type\n *\n * The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop\n * component or HTML element is, the type system will automatically allow you to pass props that are\n * not explicitly defined by you, but that are recognized as valid props to be passed to the\n * component you are rendering.\n *\n * For instance, see the following example:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor=\"field-id\">Hello</Box>\n * ```\n *\n * The `htmlFor` prop is exclusive to label elements. If you omit the `as=\"label\"` prop, the type\n * system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of\n * an incorrect type to such prop. For instance, the example below will issue a type error:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor={123}>Hello</Box>\n * ```\n *\n * ## Omitting or obfuscating the `className` prop\n *\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This is to discourage customizing design system components via custom styling, while still\n * leaving the door open to do it as an escape hatch when the design system still has shortcomings\n * with respect to the product designs we want to achieve.\n *\n * The cumbersome name also serves the purpose of aiding in easily searching for the places in the\n * code where this escape hatch was needed, in order to identify areas where the design system\n * components need to improve to better match our needs.\n *\n * This behaviour can be customized via an optional second generic argument that allows to disable\n * this feature, or to omit the `className` altogether without replacing it with the obfuscated prop\n * name.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\ninterface PolymorphicComponent<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName',\n> {\n <TT extends React.ElementType = ComponentType>(\n props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>,\n ): React.ReactElement | null\n readonly $$typeof: symbol\n defaultProps?: Partial<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >\n propTypes?: React.WeakValidationMap<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >\n displayName?: string\n}\n\n/**\n * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a\n * convenience over merely using React.forwardRef directly, and then manually forcing the resulting\n * value to be typed using `as PolymorphicComponent<…>`.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\nfunction polymorphicComponent<\n ComponentType extends React.ElementType = 'div',\n OwnProps = EmptyObject,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName',\n>(render: ForwardRefFunction<ComponentType, OwnProps, ShouldObfuscateClassName>) {\n return React.forwardRef(render) as PolymorphicComponent<\n ComponentType,\n OwnProps,\n ShouldObfuscateClassName\n >\n}\n\nexport type { PolymorphicComponent, PolymorphicComponentProps }\nexport { polymorphicComponent }\n"],"names":["polymorphicComponent","render","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoBA,CAI3BC,MAA6E,EAAE;AAC7E,EAAA,oBAAOC,gBAAK,CAACC,UAAU,CAACF,MAAM,CAAC,CAAA;AAKnC;;;;"}
1
+ {"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react'\n\nimport type { ObfuscatedClassName } from './common-types'\n\ntype Merge<P1, P2> = Omit<P1, keyof P2> & P2\n\ntype EmptyObject = {\n [K in any]: never\n}\n\ntype ObfuscateClassNameMode = 'keepClassName' | 'obfuscateClassName' | 'omitClassName'\n\n/**\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This can be customized via the second generic parameter, as there are cases where it may be\n * needed to omit this behaviour and keep the `className`. You can also instruct it to remove the\n * `className` prop while not replacing it with the `exceptionallySetClassName` one.\n *\n * @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop\n * @see PolymorphicComponent for details about this feature\n */\ntype WithObfuscatedClassName<\n Props,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> = 'className' extends keyof Props\n ? ShouldObfuscateClassName extends 'obfuscateClassName'\n ? Omit<Props, 'className'> & ObfuscatedClassName\n : ShouldObfuscateClassName extends 'omitClassName'\n ? Omit<Props, 'className'>\n : ShouldObfuscateClassName extends 'keepClassName'\n ? Props\n : never\n : Props\n\ntype PolymorphicProp<ComponentType extends React.ElementType> = {\n /**\n * Used to instruct this component what React element to render as. It can be both a string\n * representing a HTML tag name, or a React component.\n *\n * When using this prop, the component you apply it to will also recognize in its props types\n * all the props from the component or HTML element you are rendering it as.\n *\n * Some uses for this feature:\n *\n * - Using some of our layout components, while at the same time being able to set them to use\n * semantic HTML elements needed for accessibility purposes (e.g. `nav`, `main`, etc).\n * - Using a design system link component, but have it internally use a client-side router link\n * implemented via a React component (e.g. react-router's `Link`).\n *\n * Keep in mind that not all compositions of this kind may work well, especially when composing\n * with another React component and not with a HTML tag name. In particular, if the components\n * being composed have opposing concerns of clashing features (e.g. they have contradicting\n * styles applied to them) things may not go well. In those cases prefer to nest them instead.\n *\n * @see PolymorphicComponent\n */\n as?: ComponentType\n}\n\n/**\n * Given a component or element type, and a set of additional props, this builds the entire set of\n * props for a polymorphic component.\n *\n * It does three things:\n *\n * 1. it merges the element type props with the `OwnProps`\n * 2. it adds the `as` prop to allow for polymorphism to happen\n * 3. it optionally obfuscates or omits the className prop if present\n *\n * @see PolymorphicProp\n * @see WithObfuscatedClassName\n */\ntype PolymorphicComponentProps<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> = Merge<\n WithObfuscatedClassName<React.ComponentProps<ComponentType>, ShouldObfuscateClassName>,\n OwnProps & PolymorphicProp<ComponentType>\n>\n\ntype ElementTagNameMap = HTMLElementTagNameMap &\n Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>\n\ntype ElementByTag<TagName extends keyof ElementTagNameMap> = ElementTagNameMap[TagName]\n\ntype ElementByTagOrAny<ComponentType extends React.ElementType> =\n ComponentType extends keyof ElementTagNameMap ? ElementByTag<ComponentType> : any\n\n/**\n * The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via\n * the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.\n *\n * @see PolymorphicComponentProps\n * @see WithObfuscatedClassName\n */\ninterface ForwardRefFunction<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> {\n (\n props: React.PropsWithoutRef<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >,\n ref: React.ForwardedRef<ElementByTagOrAny<ComponentType>>,\n ): React.ReactElement | null\n displayName?: string\n}\n\n/**\n * A component that can customize the React element type that it renders (a.k.a. a polymorphic\n * component). This is achieved by passing a prop `as={ElementType}` or `as=\"html-tag-name\"`.\n *\n * It transparently takes care of forwarding refs, and properly sets the ref type depending on the\n * element type.\n *\n * ## Recognizing props based on the polymorphic type\n *\n * The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop\n * component or HTML element is, the type system will automatically allow you to pass props that are\n * not explicitly defined by you, but that are recognized as valid props to be passed to the\n * component you are rendering.\n *\n * For instance, see the following example:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor=\"field-id\">Hello</Box>\n * ```\n *\n * The `htmlFor` prop is exclusive to label elements. If you omit the `as=\"label\"` prop, the type\n * system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of\n * an incorrect type to such prop. For instance, the example below will issue a type error:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor={123}>Hello</Box>\n * ```\n *\n * ## Omitting or obfuscating the `className` prop\n *\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This is to discourage customizing design system components via custom styling, while still\n * leaving the door open to do it as an escape hatch when the design system still has shortcomings\n * with respect to the product designs we want to achieve.\n *\n * The cumbersome name also serves the purpose of aiding in easily searching for the places in the\n * code where this escape hatch was needed, in order to identify areas where the design system\n * components need to improve to better match our needs.\n *\n * This behaviour can be customized via an optional second generic argument that allows to disable\n * this feature, or to omit the `className` altogether without replacing it with the obfuscated prop\n * name.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\ninterface PolymorphicComponent<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName',\n> {\n <TT extends React.ElementType = ComponentType>(\n props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>,\n ): React.ReactElement | null\n readonly $$typeof: symbol\n defaultProps?: Partial<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >\n displayName?: string\n}\n\n/**\n * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a\n * convenience over merely using React.forwardRef directly, and then manually forcing the resulting\n * value to be typed using `as PolymorphicComponent<…>`.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\nfunction polymorphicComponent<\n ComponentType extends React.ElementType = 'div',\n OwnProps = EmptyObject,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName',\n>(render: ForwardRefFunction<ComponentType, OwnProps, ShouldObfuscateClassName>) {\n return React.forwardRef(render) as PolymorphicComponent<\n ComponentType,\n OwnProps,\n ShouldObfuscateClassName\n >\n}\n\nexport type { PolymorphicComponent, PolymorphicComponentProps }\nexport { polymorphicComponent }\n"],"names":["polymorphicComponent","render","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoBA,CAI3BC,MAA6E,EAAE;AAC7E,EAAA,oBAAOC,gBAAK,CAACC,UAAU,CAACF,MAAM,CAAC,CAAA;AAKnC;;;;"}
@@ -1,5 +1,6 @@
1
1
  import '../styles/design-tokens.css';
2
2
  import * as React from 'react';
3
+ import type { JSX } from 'react';
3
4
  import type { BoxProps } from '../box';
4
5
  import type { Space } from './common-types';
5
6
  type SelectTypeOptionsProp<T> = Extract<T, PropertyKey>[] | readonly Extract<T, PropertyKey>[];
@@ -45,11 +46,11 @@ declare function Wrapper({ title, children, border, }: {
45
46
  title?: React.ReactNode;
46
47
  children: React.ReactNode;
47
48
  border?: boolean;
48
- }): React.JSX.Element;
49
- declare function ResponsiveWidthRef(): React.JSX.Element;
49
+ }): JSX.Element;
50
+ declare function ResponsiveWidthRef(): JSX.Element;
50
51
  declare function Placeholder({ label, width, height, }: {
51
52
  label?: React.ReactNode;
52
- } & Pick<React.CSSProperties, 'width' | 'height'>): React.JSX.Element;
53
+ } & Pick<React.CSSProperties, 'width' | 'height'>): JSX.Element;
53
54
  type PartialProps<T extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>> = Partial<React.ComponentProps<T>>;
54
55
  export { disableResponsiveProps, Placeholder, ResponsiveWidthRef, reusableBoxProps, select, selectCount, selectSize, selectWithNone, times, Wrapper, };
55
56
  export type { PartialProps };
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.1.0",
4
+ "version": "33.2.1",
5
5
  "repository": "https://github.com/Doist/reactist",
6
6
  "homepage": "https://github.com/Doist/reactist#readme",
7
7
  "bugs": {
@@ -38,7 +38,7 @@
38
38
  "scripts": {
39
39
  "postinstall": "patch-package",
40
40
  "setup": "npm install && npm run validate",
41
- "validate": "npm run lint && npm run type-check && npm run test",
41
+ "validate": "npm run lint && npm run type-check && npm run type-check:react18 && npm run test && npm run test:react18",
42
42
  "start": "ON_SUCCESS=\"./scripts/organize-styles.sh\" rollup -c --watch --no-watch.clearScreen",
43
43
  "prestart:yalc": "npm run clean && yalc publish",
44
44
  "start:yalc": "ON_SUCCESS=\"npm run start:yalc:success\" rollup -c --watch --no-watch.clearScreen",
@@ -49,8 +49,11 @@
49
49
  "clean": "rimraf es lib styles dist",
50
50
  "test": "jest --passWithNoTests",
51
51
  "test:watch": "npm run test -- --watch",
52
+ "test:react18": "jest --config jest.config.react18.js",
53
+ "test:react18:watch": "npm run test:react18 -- --watch",
52
54
  "test:coverage": "npm run test -- --coverage",
53
55
  "type-check": "tsc --noEmit -p ./tsconfig.json",
56
+ "type-check:react18": "tsc --noEmit -p ./tsconfig.react18.json",
54
57
  "lint": "eslint --format codeframe --cache --ext js,jsx,ts,tsx ./",
55
58
  "storybook": "storybook dev -p 6006",
56
59
  "prettify": "prettier --write \"./**/*.{js,jsx,ts,tsx,json,css,scss,less,md,mdx}\"",
@@ -59,10 +62,9 @@
59
62
  "peerDependencies": {
60
63
  "@ariakit/react": "~0.4.19",
61
64
  "classnames": "^2.2.5",
62
- "prop-types": "^15.6.2",
63
- "react": ">=18.0.0 <19.0.0",
65
+ "react": ">=18.0.0 <20.0.0",
64
66
  "react-compiler-runtime": "^1.0.0",
65
- "react-dom": ">=18.0.0 <19.0.0"
67
+ "react-dom": ">=18.0.0 <20.0.0"
66
68
  },
67
69
  "devDependencies": {
68
70
  "@ariakit/react": "0.4.19",
@@ -95,8 +97,10 @@
95
97
  "@types/jest": "28.1.8",
96
98
  "@types/jest-axe": "^3.5.3",
97
99
  "@types/marked": "^4.0.8",
98
- "@types/react": "18.3.1",
99
- "@types/react-dom": "18.3.0",
100
+ "@types/react": "19.2.17",
101
+ "@types/react-18": "npm:@types/react@^18.3",
102
+ "@types/react-dom": "19.2.3",
103
+ "@types/react-dom-18": "npm:@types/react-dom@^18.3",
100
104
  "@typescript-eslint/eslint-plugin": "8.46.2",
101
105
  "@typescript-eslint/parser": "8.46.2",
102
106
  "@vitejs/plugin-react": "5.2.0",
@@ -125,11 +129,13 @@
125
129
  "mockdate": "^3.0.2",
126
130
  "plop": "^3.1.1",
127
131
  "prettier": "3.6.2",
128
- "react": "18.3.1",
132
+ "react": "19.2.7",
133
+ "react-18": "npm:react@18.3.1",
129
134
  "react-compiler-runtime": "1.0.0",
130
- "react-dom": "18.3.1",
131
135
  "react-docgen-typescript": "2.4.0",
132
- "react-is": "18.3.1",
136
+ "react-dom": "19.2.7",
137
+ "react-dom-18": "npm:react-dom@18.3.1",
138
+ "react-is": "19.2.7",
133
139
  "rimraf": "^3.0.2",
134
140
  "rollup": "2.79.2",
135
141
  "rollup-plugin-styles": "4.0.0",
@@ -154,6 +160,12 @@
154
160
  "pretty-format": {
155
161
  "react-is": "$react-is"
156
162
  },
157
- "react-element-to-jsx-string": "15.0.0"
163
+ "react-element-to-jsx-string": "15.0.0",
164
+ "react-dom-18": {
165
+ "react": "$react"
166
+ },
167
+ "@types/react-dom-18": {
168
+ "@types/react": "$@types/react"
169
+ }
158
170
  }
159
171
  }
File without changes