@redsift/design-system 11.6.0-muiv5-alpha.2 → 11.6.0-muiv5-alpha.4

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 (178) hide show
  1. package/components/alert/Alert.js +8 -8
  2. package/components/alert/Alert.js.map +1 -1
  3. package/components/app-bar/AppBar.js +11 -11
  4. package/components/app-bar/AppBar.js.map +1 -1
  5. package/components/app-container/AppContainer.js +16 -16
  6. package/components/app-container/AppContainer.js.map +1 -1
  7. package/components/app-container/context.js +2 -2
  8. package/components/app-container/context.js.map +1 -1
  9. package/components/app-content/AppContent.js +2 -2
  10. package/components/app-content/AppContent.js.map +1 -1
  11. package/components/app-side-panel/AppSidePanel.js +8 -8
  12. package/components/app-side-panel/AppSidePanel.js.map +1 -1
  13. package/components/app-side-panel/useAppSidePanel.js +2 -2
  14. package/components/app-side-panel/useAppSidePanel.js.map +1 -1
  15. package/components/badge/Badge.js +2 -2
  16. package/components/badge/Badge.js.map +1 -1
  17. package/components/breadcrumb-item/BreadcrumbItem.js +2 -2
  18. package/components/breadcrumb-item/BreadcrumbItem.js.map +1 -1
  19. package/components/breadcrumbs/Breadcrumbs.js +7 -7
  20. package/components/breadcrumbs/Breadcrumbs.js.map +1 -1
  21. package/components/button/Button.js +7 -7
  22. package/components/button/Button.js.map +1 -1
  23. package/components/button-group/ButtonGroup.js +4 -4
  24. package/components/button-group/ButtonGroup.js.map +1 -1
  25. package/components/button-link/ButtonLink.js +6 -6
  26. package/components/button-link/ButtonLink.js.map +1 -1
  27. package/components/card/Card.js +7 -7
  28. package/components/card/Card.js.map +1 -1
  29. package/components/card-actions/CardActions.js +2 -2
  30. package/components/card-actions/CardActions.js.map +1 -1
  31. package/components/card-body/CardBody.js +2 -2
  32. package/components/card-body/CardBody.js.map +1 -1
  33. package/components/card-header/CardHeader.js +7 -7
  34. package/components/card-header/CardHeader.js.map +1 -1
  35. package/components/checkbox/Checkbox.js +7 -7
  36. package/components/checkbox/Checkbox.js.map +1 -1
  37. package/components/checkbox-group/CheckboxGroup.js +7 -7
  38. package/components/checkbox-group/CheckboxGroup.js.map +1 -1
  39. package/components/checkbox-group/context.js +2 -2
  40. package/components/checkbox-group/context.js.map +1 -1
  41. package/components/conditional-wrapper/ConditionalWrapper.js +2 -2
  42. package/components/conditional-wrapper/ConditionalWrapper.js.map +1 -1
  43. package/components/detailed-card/DetailedCard.js +20 -20
  44. package/components/detailed-card/DetailedCard.js.map +1 -1
  45. package/components/detailed-card/types.d.ts +10 -1
  46. package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js +3 -3
  47. package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js.map +1 -1
  48. package/components/detailed-card-header/DetailedCardHeader.js +4 -4
  49. package/components/detailed-card-header/DetailedCardHeader.js.map +1 -1
  50. package/components/detailed-card-section/DetailedCardSection.js +10 -10
  51. package/components/detailed-card-section/DetailedCardSection.js.map +1 -1
  52. package/components/detailed-card-section-item/DetailedCardSectionItem.js +12 -12
  53. package/components/detailed-card-section-item/DetailedCardSectionItem.js.map +1 -1
  54. package/components/flexbox/Flexbox.js +3 -3
  55. package/components/flexbox/Flexbox.js.map +1 -1
  56. package/components/focus-within-group/FocusWithinGroup.js +2 -2
  57. package/components/focus-within-group/FocusWithinGroup.js.map +1 -1
  58. package/components/focus-within-group/context.js +2 -2
  59. package/components/focus-within-group/context.js.map +1 -1
  60. package/components/grid/Grid.js +3 -3
  61. package/components/grid/Grid.js.map +1 -1
  62. package/components/grid-item/GridItem.js +2 -2
  63. package/components/grid-item/GridItem.js.map +1 -1
  64. package/components/heading/Heading.js +2 -2
  65. package/components/heading/Heading.js.map +1 -1
  66. package/components/icon/Icon.js +5 -5
  67. package/components/icon/Icon.js.map +1 -1
  68. package/components/icon-button/IconButton.js +6 -6
  69. package/components/icon-button/IconButton.js.map +1 -1
  70. package/components/icon-button-link/IconButtonLink.js +5 -5
  71. package/components/icon-button-link/IconButtonLink.js.map +1 -1
  72. package/components/item/Item.js +19 -19
  73. package/components/item/Item.js.map +1 -1
  74. package/components/link/Link.js +5 -5
  75. package/components/link/Link.js.map +1 -1
  76. package/components/link-button/LinkButton.js +5 -5
  77. package/components/link-button/LinkButton.js.map +1 -1
  78. package/components/listbox/ActiveDescendantListbox.d.ts +1 -1
  79. package/components/listbox/ActiveDescendantListbox.js +3 -3
  80. package/components/listbox/ActiveDescendantListbox.js.map +1 -1
  81. package/components/listbox/Listbox.js +8 -8
  82. package/components/listbox/Listbox.js.map +1 -1
  83. package/components/listbox/RovingTabindexListbox.d.ts +1 -1
  84. package/components/listbox/RovingTabindexListbox.js +3 -3
  85. package/components/listbox/RovingTabindexListbox.js.map +1 -1
  86. package/components/listbox/context.js +2 -2
  87. package/components/listbox/context.js.map +1 -1
  88. package/components/number/Number.js +2 -2
  89. package/components/number/Number.js.map +1 -1
  90. package/components/number-field/NumberField.js +16 -16
  91. package/components/number-field/NumberField.js.map +1 -1
  92. package/components/pill/Pill.js +10 -10
  93. package/components/pill/Pill.js.map +1 -1
  94. package/components/progress-bar/ProgressBar.js +2 -2
  95. package/components/progress-bar/ProgressBar.js.map +1 -1
  96. package/components/radio/Radio.js +6 -6
  97. package/components/radio/Radio.js.map +1 -1
  98. package/components/radio-group/RadioGroup.js +7 -7
  99. package/components/radio-group/RadioGroup.js.map +1 -1
  100. package/components/radio-group/context.js +2 -2
  101. package/components/radio-group/context.js.map +1 -1
  102. package/components/shield/Shield.js +5 -5
  103. package/components/shield/Shield.js.map +1 -1
  104. package/components/side-navigation-menu/SideNavigationMenu.js +16 -16
  105. package/components/side-navigation-menu/SideNavigationMenu.js.map +1 -1
  106. package/components/side-navigation-menu/context.js +2 -2
  107. package/components/side-navigation-menu/context.js.map +1 -1
  108. package/components/side-navigation-menu-bar/SideNavigationMenuBar.js +7 -7
  109. package/components/side-navigation-menu-bar/SideNavigationMenuBar.js.map +1 -1
  110. package/components/side-navigation-menu-bar/context.js +2 -2
  111. package/components/side-navigation-menu-bar/context.js.map +1 -1
  112. package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js +4 -4
  113. package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js.map +1 -1
  114. package/components/side-navigation-menu-item/SideNavigationMenuItem.js +9 -9
  115. package/components/side-navigation-menu-item/SideNavigationMenuItem.js.map +1 -1
  116. package/components/skeleton/Skeleton.js +4 -4
  117. package/components/skeleton/Skeleton.js.map +1 -1
  118. package/components/skeleton-circle/SkeletonCircle.js +4 -4
  119. package/components/skeleton-circle/SkeletonCircle.js.map +1 -1
  120. package/components/skeleton-text/SkeletonText.js +4 -4
  121. package/components/skeleton-text/SkeletonText.js.map +1 -1
  122. package/components/spinner/Spinner.js +2 -2
  123. package/components/spinner/Spinner.js.map +1 -1
  124. package/components/switch/Switch.js +9 -9
  125. package/components/switch/Switch.js.map +1 -1
  126. package/components/switch-group/SwitchGroup.js +7 -7
  127. package/components/switch-group/SwitchGroup.js.map +1 -1
  128. package/components/switch-group/context.js +2 -2
  129. package/components/switch-group/context.js.map +1 -1
  130. package/components/text/Text.js +2 -2
  131. package/components/text/Text.js.map +1 -1
  132. package/components/text-area/TextArea.js +11 -11
  133. package/components/text-area/TextArea.js.map +1 -1
  134. package/components/text-field/TextField.js +13 -13
  135. package/components/text-field/TextField.js.map +1 -1
  136. package/components/theme/context.js +2 -2
  137. package/components/theme/context.js.map +1 -1
  138. package/package.json +6 -2
  139. package/react-aria/react-aria/focus/useFocusable.js +2 -2
  140. package/react-aria/react-aria/focus/useFocusable.js.map +1 -1
  141. package/react-aria/react-aria/i18n/context.js +4 -4
  142. package/react-aria/react-aria/i18n/context.js.map +1 -1
  143. package/react-aria/react-aria/interactions/context.js +2 -2
  144. package/react-aria/react-aria/interactions/context.js.map +1 -1
  145. package/react-aria/react-aria/ssr/SSRProvider.js +13 -13
  146. package/react-aria/react-aria/ssr/SSRProvider.js.map +1 -1
  147. package/react-aria/react-aria/utils/mergeProps.js +2 -2
  148. package/react-aria/react-aria/utils/mergeProps.js.map +1 -1
  149. package/react-aria/react-aria/utils/useLayoutEffect.js +2 -2
  150. package/react-aria/react-aria/utils/useLayoutEffect.js.map +1 -1
  151. package/utils/filterComponents.js +2 -2
  152. package/utils/filterComponents.js.map +1 -1
  153. package/utils/isComponent.js +2 -2
  154. package/utils/isComponent.js.map +1 -1
  155. package/utils/useId.js +4 -4
  156. package/utils/useId.js.map +1 -1
  157. package/_virtual/jsx-runtime.js +0 -4
  158. package/_virtual/jsx-runtime.js.map +0 -1
  159. package/_virtual/react-jsx-runtime.development.js +0 -4
  160. package/_virtual/react-jsx-runtime.development.js.map +0 -1
  161. package/_virtual/react-jsx-runtime.production.min.js +0 -4
  162. package/_virtual/react-jsx-runtime.production.min.js.map +0 -1
  163. package/packages/popovers/src/components/tooltip/Tooltip.js +0 -62
  164. package/packages/popovers/src/components/tooltip/Tooltip.js.map +0 -1
  165. package/packages/popovers/src/components/tooltip/context.js +0 -6
  166. package/packages/popovers/src/components/tooltip/context.js.map +0 -1
  167. package/packages/popovers/src/components/tooltip/types.js +0 -28
  168. package/packages/popovers/src/components/tooltip/types.js.map +0 -1
  169. package/packages/popovers/src/components/tooltip/useTooltip.js +0 -78
  170. package/packages/popovers/src/components/tooltip/useTooltip.js.map +0 -1
  171. package/packages/popovers/src/components/tooltip/useTooltipContext.js +0 -13
  172. package/packages/popovers/src/components/tooltip/useTooltipContext.js.map +0 -1
  173. package/packages/popovers/src/components/tooltip-content/TooltipContent.js +0 -80
  174. package/packages/popovers/src/components/tooltip-content/TooltipContent.js.map +0 -1
  175. package/packages/popovers/src/components/tooltip-content/styles.js +0 -128
  176. package/packages/popovers/src/components/tooltip-content/styles.js.map +0 -1
  177. package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js +0 -47
  178. package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import React, {\n ComponentProps,\n FocusEvent,\n forwardRef,\n MutableRefObject,\n useCallback,\n useEffect,\n useState,\n} from 'react';\nimport classNames from 'classnames';\nimport { useFocusRing } from '../../react-aria/react-aria/focus';\nimport { useFocusWithin } from '../../react-aria/react-aria/interactions';\nimport { ButtonsColorPalette, Comp } from '../../types';\nimport { warnIfNoAccessibleLabelFound } from '../../utils/warnIfNoAccessibleLabelFound';\nimport { TextAreaProps, TextAreaVariant } from './types';\nimport { StyledTextArea } from './styles';\nimport { Icon } from '../../components/icon';\nimport { useTheme } from '../theme';\nimport { useComputeNumberOfRows } from '../../hooks';\nimport { useId } from '../../utils';\nimport { Flexbox } from '../flexbox';\n\nconst COMPONENT_NAME = 'TextArea';\nconst CLASSNAME = 'redsift-text-area';\n\n/**\n * The TextArea component.\n * Can be used as controlled or uncontrolled.\n */\nexport const TextArea: Comp<TextAreaProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n after,\n autoFocus,\n className,\n color: propsColor,\n defaultValue = '',\n forceColor,\n isColored = true,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n label,\n leftIcon,\n minimumRows,\n name,\n onBlur: onBlurProps,\n onChange,\n onFocus: onFocusProps,\n placeholder,\n textareaProps,\n textareaRef: propsTextareaRef,\n theme: propsTheme,\n value: propsValue,\n variant = TextAreaVariant.default,\n width = '100%',\n ...forwardedProps\n } = props;\n\n const theme = useTheme(propsTheme);\n const color = Object.values(ButtonsColorPalette).includes(propsColor!) ? propsColor : isColored ? 'primary' : 'grey';\n const isGradient = color === ButtonsColorPalette.radar;\n\n const _textareaRef = React.useRef(null);\n const textareaRef = propsTextareaRef ?? _textareaRef;\n\n const {\n isFocusVisible,\n isFocused,\n focusProps: { onFocus, onBlur },\n } = useFocusRing({\n autoFocus,\n });\n const [isFocusWithin, setFocusWithin] = useState(Boolean(autoFocus));\n const { focusWithinProps } = useFocusWithin({\n onFocusWithinChange: (isFocusWithin) => setFocusWithin(isFocusWithin),\n });\n\n const [value, setValue] = useState(defaultValue);\n const isControlled = propsValue !== null && propsValue !== undefined;\n\n const [labelId] = useId();\n\n warnIfNoAccessibleLabelFound(props as ComponentProps<'label'>, [label], 'TextArea');\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(event.target.value, name, event);\n } else {\n setValue(event.target.value);\n }\n },\n [onChange]\n );\n\n const { rows, recomputeNumberOfRows } = useComputeNumberOfRows(minimumRows || 4);\n useEffect(() => {\n // Recompute the number of rows for the first rendering\n if (textareaRef && textareaRef.current) {\n recomputeNumberOfRows(textareaRef.current);\n }\n }, [textareaRef, recomputeNumberOfRows, value]);\n\n return (\n <StyledTextArea\n width={width}\n {...focusWithinProps}\n {...forwardedProps}\n $hasContent={isFocusWithin || Boolean(isControlled ? propsValue : value) || Boolean(placeholder)}\n $hasLeftIcon={Boolean(leftIcon)}\n $color={color}\n $isGradient={isGradient}\n $isDisabled={isDisabled}\n $isFocusVisible={isFocusVisible}\n $isInvalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n $isRequired={isRequired}\n $isFocused={Boolean(isFocused || forceColor)}\n $theme={theme}\n $variant={variant}\n className={classNames(TextArea.className, className)}\n ref={ref as MutableRefObject<HTMLDivElement>}\n >\n <fieldset aria-hidden=\"true\" className={`${TextArea.className}-text-area-wrapper__fieldset`}>\n <legend id={labelId} className={`${TextArea.className}-text-area-wrapper-fieldset__legend`}>\n {label ? <span>{label}</span> : null}\n </legend>\n </fieldset>\n {label ? (\n <label className={`${TextArea.className}__label`}>\n <span>{label}</span>\n </label>\n ) : null}\n <div className={`${TextArea.className}__text-area-wrapper`}>\n {leftIcon ? (\n <Icon color={isDisabled ? 'question' : 'black'} {...leftIcon} aria-hidden=\"true\" className=\"left\" />\n ) : null}\n <div className={`${TextArea.className}-text-area-wrapper__text-area`}>\n <textarea\n {...textareaProps}\n onBlur={(event) => {\n onBlur?.(event);\n onBlurProps?.(event as unknown as FocusEvent<HTMLDivElement, Element>);\n }}\n onFocus={(event) => {\n onFocus?.(event);\n onFocusProps?.(event as unknown as FocusEvent<HTMLDivElement, Element>);\n }}\n aria-disabled={isDisabled}\n aria-invalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby || (label ? labelId : undefined)}\n aria-readonly={isReadOnly}\n aria-required={isRequired}\n autoFocus={autoFocus}\n disabled={isDisabled}\n name={name}\n onChange={handleChange}\n placeholder={placeholder}\n ref={textareaRef as MutableRefObject<HTMLTextAreaElement>}\n value={isControlled ? propsValue : value}\n rows={rows}\n />\n </div>\n {after ? (\n <Flexbox className={`${TextArea.className}-text-area-wrapper__toolbar`} gap=\"8px\">\n {typeof after === 'function'\n ? after(\n isControlled ? propsValue : value,\n isDisabled,\n isInvalid || (isRequired && !(isControlled ? propsValue : value)),\n isRequired\n )\n : after}\n </Flexbox>\n ) : null}\n </div>\n </StyledTextArea>\n );\n});\nTextArea.className = CLASSNAME;\nTextArea.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","TextArea","forwardRef","props","ref","ariaLabel","ariaLabelledby","after","autoFocus","className","color","propsColor","defaultValue","forceColor","isColored","isDisabled","isInvalid","isReadOnly","isRequired","label","leftIcon","minimumRows","name","onBlur","onBlurProps","onChange","onFocus","onFocusProps","placeholder","textareaProps","textareaRef","propsTextareaRef","theme","propsTheme","value","propsValue","variant","TextAreaVariant","default","width","forwardedProps","_objectWithoutProperties","_excluded","useTheme","Object","values","ButtonsColorPalette","includes","isGradient","radar","_textareaRef","React","useRef","isFocusVisible","isFocused","focusProps","useFocusRing","isFocusWithin","setFocusWithin","useState","Boolean","focusWithinProps","useFocusWithin","onFocusWithinChange","setValue","isControlled","undefined","labelId","useId","warnIfNoAccessibleLabelFound","handleChange","useCallback","event","target","rows","recomputeNumberOfRows","useComputeNumberOfRows","useEffect","current","createElement","StyledTextArea","_extends","$hasContent","$hasLeftIcon","$color","$isGradient","$isDisabled","$isFocusVisible","$isInvalid","$isRequired","$isFocused","$theme","$variant","classNames","id","Icon","disabled","Flexbox","gap","displayName"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAMA,cAAc,GAAG,UAAU,CAAA;AACjC,MAAMC,SAAS,GAAG,mBAAmB,CAAA;;AAErC;AACA;AACA;AACA;AACO,MAAMC,QAA6C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACtF,MAAM;AACJ,MAAA,YAAY,EAAEC,SAAS;AACvB,MAAA,iBAAiB,EAAEC,cAAc;MACjCC,KAAK;MACLC,SAAS;MACTC,SAAS;AACTC,MAAAA,KAAK,EAAEC,UAAU;AACjBC,MAAAA,YAAY,GAAG,EAAE;MACjBC,UAAU;AACVC,MAAAA,SAAS,GAAG,IAAI;MAChBC,UAAU;MACVC,SAAS;MACTC,UAAU;MACVC,UAAU;MACVC,KAAK;MACLC,QAAQ;MACRC,WAAW;MACXC,IAAI;AACJC,MAAAA,MAAM,EAAEC,WAAW;MACnBC,QAAQ;AACRC,MAAAA,OAAO,EAAEC,YAAY;MACrBC,WAAW;MACXC,aAAa;AACbC,MAAAA,WAAW,EAAEC,gBAAgB;AAC7BC,MAAAA,KAAK,EAAEC,UAAU;AACjBC,MAAAA,KAAK,EAAEC,UAAU;MACjBC,OAAO,GAAGC,eAAe,CAACC,OAAO;AACjCC,MAAAA,KAAK,GAAG,MAAA;AAEV,KAAC,GAAGpC,KAAK;AADJqC,IAAAA,cAAc,GAAAC,wBAAA,CACftC,KAAK,EAAAuC,SAAA,CAAA,CAAA;AAET,EAAA,MAAMV,KAAK,GAAGW,QAAQ,CAACV,UAAU,CAAC,CAAA;EAClC,MAAMvB,KAAK,GAAGkC,MAAM,CAACC,MAAM,CAACC,mBAAmB,CAAC,CAACC,QAAQ,CAACpC,UAAW,CAAC,GAAGA,UAAU,GAAG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,IAAAA,QAAQ,EAAE6C,YAAa;AACvB1C,IAAAA,WAAW,EAAEA,WAAY;AACzBxB,IAAAA,GAAG,EAAE0B,WAAqD;AAC1DI,IAAAA,KAAK,EAAE+B,YAAY,GAAG9B,UAAU,GAAGD,KAAM;AACzCwC,IAAAA,IAAI,EAAEA,IAAAA;GACP,CAAA,CACE,CAAC,EACLnE,KAAK,gBACJ4C,cAAA,CAAA4B,aAAA,CAACkB,OAAO,EAAA;AAACxF,IAAAA,SAAS,EAAG,CAAA,EAAER,QAAQ,CAACQ,SAAU,CAA6B,2BAAA,CAAA;AAACyF,IAAAA,GAAG,EAAC,KAAA;AAAK,GAAA,EAC9E,OAAO3F,KAAK,KAAK,UAAU,GACxBA,KAAK,CACH0D,YAAY,GAAG9B,UAAU,GAAGD,KAAK,EACjCnB,UAAU,EACVC,SAAS,IAAKE,UAAU,IAAI,EAAE+C,YAAY,GAAG9B,UAAU,GAAGD,KAAK,CAAE,EACjEhB,UACF,CAAC,GACDX,KACG,CAAC,GACR,IACD,CACS,CAAC,CAAA;AAErB,CAAC,EAAC;AACFN,QAAQ,CAACQ,SAAS,GAAGT,SAAS,CAAA;AAC9BC,QAAQ,CAACkG,WAAW,GAAGpG,cAAc;;;;"}
1
+ {"version":3,"file":"TextArea.js","sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import React, {\n ComponentProps,\n FocusEvent,\n forwardRef,\n MutableRefObject,\n useCallback,\n useEffect,\n useState,\n} from 'react';\nimport classNames from 'classnames';\nimport { useFocusRing } from '../../react-aria/react-aria/focus';\nimport { useFocusWithin } from '../../react-aria/react-aria/interactions';\nimport { ButtonsColorPalette, Comp } from '../../types';\nimport { warnIfNoAccessibleLabelFound } from '../../utils/warnIfNoAccessibleLabelFound';\nimport { TextAreaProps, TextAreaVariant } from './types';\nimport { StyledTextArea } from './styles';\nimport { Icon } from '../../components/icon';\nimport { useTheme } from '../theme';\nimport { useComputeNumberOfRows } from '../../hooks';\nimport { useId } from '../../utils';\nimport { Flexbox } from '../flexbox';\n\nconst COMPONENT_NAME = 'TextArea';\nconst CLASSNAME = 'redsift-text-area';\n\n/**\n * The TextArea component.\n * Can be used as controlled or uncontrolled.\n */\nexport const TextArea: Comp<TextAreaProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n after,\n autoFocus,\n className,\n color: propsColor,\n defaultValue = '',\n forceColor,\n isColored = true,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n label,\n leftIcon,\n minimumRows,\n name,\n onBlur: onBlurProps,\n onChange,\n onFocus: onFocusProps,\n placeholder,\n textareaProps,\n textareaRef: propsTextareaRef,\n theme: propsTheme,\n value: propsValue,\n variant = TextAreaVariant.default,\n width = '100%',\n ...forwardedProps\n } = props;\n\n const theme = useTheme(propsTheme);\n const color = Object.values(ButtonsColorPalette).includes(propsColor!) ? propsColor : isColored ? 'primary' : 'grey';\n const isGradient = color === ButtonsColorPalette.radar;\n\n const _textareaRef = React.useRef(null);\n const textareaRef = propsTextareaRef ?? _textareaRef;\n\n const {\n isFocusVisible,\n isFocused,\n focusProps: { onFocus, onBlur },\n } = useFocusRing({\n autoFocus,\n });\n const [isFocusWithin, setFocusWithin] = useState(Boolean(autoFocus));\n const { focusWithinProps } = useFocusWithin({\n onFocusWithinChange: (isFocusWithin) => setFocusWithin(isFocusWithin),\n });\n\n const [value, setValue] = useState(defaultValue);\n const isControlled = propsValue !== null && propsValue !== undefined;\n\n const [labelId] = useId();\n\n warnIfNoAccessibleLabelFound(props as ComponentProps<'label'>, [label], 'TextArea');\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(event.target.value, name, event);\n } else {\n setValue(event.target.value);\n }\n },\n [onChange]\n );\n\n const { rows, recomputeNumberOfRows } = useComputeNumberOfRows(minimumRows || 4);\n useEffect(() => {\n // Recompute the number of rows for the first rendering\n if (textareaRef && textareaRef.current) {\n recomputeNumberOfRows(textareaRef.current);\n }\n }, [textareaRef, recomputeNumberOfRows, value]);\n\n return (\n <StyledTextArea\n width={width}\n {...focusWithinProps}\n {...forwardedProps}\n $hasContent={isFocusWithin || Boolean(isControlled ? propsValue : value) || Boolean(placeholder)}\n $hasLeftIcon={Boolean(leftIcon)}\n $color={color}\n $isGradient={isGradient}\n $isDisabled={isDisabled}\n $isFocusVisible={isFocusVisible}\n $isInvalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n $isRequired={isRequired}\n $isFocused={Boolean(isFocused || forceColor)}\n $theme={theme}\n $variant={variant}\n className={classNames(TextArea.className, className)}\n ref={ref as MutableRefObject<HTMLDivElement>}\n >\n <fieldset aria-hidden=\"true\" className={`${TextArea.className}-text-area-wrapper__fieldset`}>\n <legend id={labelId} className={`${TextArea.className}-text-area-wrapper-fieldset__legend`}>\n {label ? <span>{label}</span> : null}\n </legend>\n </fieldset>\n {label ? (\n <label className={`${TextArea.className}__label`}>\n <span>{label}</span>\n </label>\n ) : null}\n <div className={`${TextArea.className}__text-area-wrapper`}>\n {leftIcon ? (\n <Icon color={isDisabled ? 'question' : 'black'} {...leftIcon} aria-hidden=\"true\" className=\"left\" />\n ) : null}\n <div className={`${TextArea.className}-text-area-wrapper__text-area`}>\n <textarea\n {...textareaProps}\n onBlur={(event) => {\n onBlur?.(event);\n onBlurProps?.(event as unknown as FocusEvent<HTMLDivElement, Element>);\n }}\n onFocus={(event) => {\n onFocus?.(event);\n onFocusProps?.(event as unknown as FocusEvent<HTMLDivElement, Element>);\n }}\n aria-disabled={isDisabled}\n aria-invalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby || (label ? labelId : undefined)}\n aria-readonly={isReadOnly}\n aria-required={isRequired}\n autoFocus={autoFocus}\n disabled={isDisabled}\n name={name}\n onChange={handleChange}\n placeholder={placeholder}\n ref={textareaRef as MutableRefObject<HTMLTextAreaElement>}\n value={isControlled ? propsValue : value}\n rows={rows}\n />\n </div>\n {after ? (\n <Flexbox className={`${TextArea.className}-text-area-wrapper__toolbar`} gap=\"8px\">\n {typeof after === 'function'\n ? after(\n isControlled ? propsValue : value,\n isDisabled,\n isInvalid || (isRequired && !(isControlled ? propsValue : value)),\n isRequired\n )\n : after}\n </Flexbox>\n ) : null}\n </div>\n </StyledTextArea>\n );\n});\nTextArea.className = CLASSNAME;\nTextArea.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","TextArea","forwardRef","props","ref","ariaLabel","ariaLabelledby","after","autoFocus","className","color","propsColor","defaultValue","forceColor","isColored","isDisabled","isInvalid","isReadOnly","isRequired","label","leftIcon","minimumRows","name","onBlur","onBlurProps","onChange","onFocus","onFocusProps","placeholder","textareaProps","textareaRef","propsTextareaRef","theme","propsTheme","value","propsValue","variant","TextAreaVariant","default","width","forwardedProps","_objectWithoutProperties","_excluded","useTheme","Object","values","ButtonsColorPalette","includes","isGradient","radar","_textareaRef","React","useRef","isFocusVisible","isFocused","focusProps","useFocusRing","isFocusWithin","setFocusWithin","useState","Boolean","focusWithinProps","useFocusWithin","onFocusWithinChange","setValue","isControlled","undefined","labelId","useId","warnIfNoAccessibleLabelFound","handleChange","useCallback","event","target","rows","recomputeNumberOfRows","useComputeNumberOfRows","useEffect","current","createElement","StyledTextArea","_extends","$hasContent","$hasLeftIcon","$color","$isGradient","$isDisabled","$isFocusVisible","$isInvalid","$isRequired","$isFocused","$theme","$variant","classNames","id","Icon","disabled","Flexbox","gap","displayName"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAMA,cAAc,GAAG,UAAU,CAAA;AACjC,MAAMC,SAAS,GAAG,mBAAmB,CAAA;;AAErC;AACA;AACA;AACA;AACO,MAAMC,QAA6C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACtF,MAAM;AACJ,MAAA,YAAY,EAAEC,SAAS;AAC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A;AAAK,GAAA,EAC9E,OAAO3F,KAAK,KAAK,UAAU,GACxBA,KAAK,CACH0D,YAAY,GAAG9B,UAAU,GAAGD,KAAK,EACjCnB,UAAU,EACVC,SAAS,IAAKE,UAAU,IAAI,EAAE+C,YAAY,GAAG9B,UAAU,GAAGD,KAAK,CAAE,EACjEhB,UACF,CAAC,GACDX,KACG,CAAC,GACR,IACD,CACS,CAAC,CAAA;AAErB,CAAC,EAAC;AACFN,QAAQ,CAACQ,SAAS,GAAGT,SAAS,CAAA;AAC9BC,QAAQ,CAACkG,WAAW,GAAGpG,cAAc;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import React__default, { forwardRef, useState, useCallback } from 'react';
2
+ import React, { forwardRef, useState, useCallback } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { warnIfNoAccessibleLabelFound } from '../../utils/warnIfNoAccessibleLabelFound.js';
5
5
  import { TextFieldVariant } from './types.js';
@@ -108,7 +108,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
108
108
  }
109
109
  setValue('');
110
110
  }, [onChange]);
111
- return /*#__PURE__*/React__default.createElement(StyledTextField, _extends({}, focusWithinProps, forwardedProps, {
111
+ return /*#__PURE__*/React.createElement(StyledTextField, _extends({}, focusWithinProps, forwardedProps, {
112
112
  $hasContent: isFocusWithin || Boolean(isControlled ? propsValue : value) || Boolean(placeholder) || Boolean(pills && pills.length > 0),
113
113
  $hasLeftIcon: Boolean(leftIcon),
114
114
  $color: color,
@@ -122,24 +122,24 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
122
122
  $variant: variant,
123
123
  className: classNames(TextField.className, className),
124
124
  ref: ref
125
- }), /*#__PURE__*/React__default.createElement("fieldset", {
125
+ }), /*#__PURE__*/React.createElement("fieldset", {
126
126
  "aria-hidden": "true",
127
127
  className: `${TextField.className}-input-wrapper__fieldset`
128
- }, /*#__PURE__*/React__default.createElement("legend", {
128
+ }, /*#__PURE__*/React.createElement("legend", {
129
129
  id: labelId,
130
130
  className: `${TextField.className}-input-wrapper-fieldset__legend`
131
- }, label ? /*#__PURE__*/React__default.createElement("span", null, label) : null)), label ? /*#__PURE__*/React__default.createElement("label", {
131
+ }, label ? /*#__PURE__*/React.createElement("span", null, label) : null)), label ? /*#__PURE__*/React.createElement("label", {
132
132
  className: `${TextField.className}__label`
133
- }, /*#__PURE__*/React__default.createElement("span", null, label)) : null, /*#__PURE__*/React__default.createElement("div", {
133
+ }, /*#__PURE__*/React.createElement("span", null, label)) : null, /*#__PURE__*/React.createElement("div", {
134
134
  className: `${TextField.className}__input-wrapper`
135
- }, leftIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
135
+ }, leftIcon ? /*#__PURE__*/React.createElement(Icon, _extends({
136
136
  color: isDisabled ? 'question' : 'black'
137
137
  }, leftIcon, {
138
138
  "aria-hidden": "true",
139
139
  className: "left"
140
- })) : null, /*#__PURE__*/React__default.createElement("div", {
140
+ })) : null, /*#__PURE__*/React.createElement("div", {
141
141
  className: `${TextField.className}-input-wrapper__pills-and-input`
142
- }, /*#__PURE__*/React__default.createElement("input", _extends({}, inputProps, {
142
+ }, /*#__PURE__*/React.createElement("input", _extends({}, inputProps, {
143
143
  onBlur: event => {
144
144
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
145
145
  onBlurProps === null || onBlurProps === void 0 ? void 0 : onBlurProps(event);
@@ -163,15 +163,15 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
163
163
  ref: inputRef,
164
164
  type: type,
165
165
  value: isControlled ? propsValue : value
166
- })), /*#__PURE__*/React__default.createElement("div", null, pills === null || pills === void 0 ? void 0 : pills.map((pill, index) => /*#__PURE__*/React__default.createElement(Pill, _extends({
166
+ })), /*#__PURE__*/React.createElement("div", null, pills === null || pills === void 0 ? void 0 : pills.map((pill, index) => /*#__PURE__*/React.createElement(Pill, _extends({
167
167
  theme: theme,
168
168
  key: `${labelId}-pill-${index}`,
169
169
  color: "blue",
170
170
  size: "small"
171
- }, pill))))), hasClearButton || internal || after ? /*#__PURE__*/React__default.createElement(Flexbox, {
171
+ }, pill))))), hasClearButton || internal || after ? /*#__PURE__*/React.createElement(Flexbox, {
172
172
  className: `${TextField.className}-input-wrapper__toolbar`,
173
173
  gap: "8px"
174
- }, hasClearButton ? /*#__PURE__*/React__default.createElement(IconButton, _extends({
174
+ }, hasClearButton ? /*#__PURE__*/React.createElement(IconButton, _extends({
175
175
  theme: theme,
176
176
  "aria-label": label ? format('clear-field', {
177
177
  label
@@ -182,7 +182,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
182
182
  }, hasClearButton !== true && hasClearButton, {
183
183
  onClick: handleClear,
184
184
  className: "right clear"
185
- })) : null, typeof internal === 'function' ? internal(isControlled ? propsValue : value, isDisabled, isInvalid || isRequired && !(isControlled ? propsValue : value), isRequired) : internal, (hasClearButton || internal) && after ? /*#__PURE__*/React__default.createElement("span", {
185
+ })) : null, typeof internal === 'function' ? internal(isControlled ? propsValue : value, isDisabled, isInvalid || isRequired && !(isControlled ? propsValue : value), isRequired) : internal, (hasClearButton || internal) && after ? /*#__PURE__*/React.createElement("span", {
186
186
  style: {
187
187
  borderLeft: '1px solid var(--redsift-color-neutral-mid-grey)',
188
188
  position: 'relative',
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sources":["../../../src/components/text-field/TextField.tsx"],"sourcesContent":["import React, { MouseEvent, ComponentProps, forwardRef, MutableRefObject, useCallback, useState } from 'react';\nimport classNames from 'classnames';\nimport { useFocusRing } from '../../react-aria/react-aria/focus';\nimport { useFocusWithin } from '../../react-aria/react-aria/interactions';\nimport { ButtonsColorPalette, Comp } from '../../types';\nimport { warnIfNoAccessibleLabelFound } from '../../utils/warnIfNoAccessibleLabelFound';\nimport { TextFieldProps, TextFieldVariant } from './types';\nimport { StyledTextField } from './styles';\nimport { Icon } from '../../components/icon';\nimport { mdiClose } from '@redsift/icons';\nimport { Flexbox } from '../flexbox';\nimport { IconButton } from '../icon-button';\nimport { Pill } from '../pill';\nimport { useTheme } from '../theme';\nimport { useMessageFormatter } from '@redsift/design-system/react-aria/react-aria/i18n';\nimport { useId } from '../../utils';\n\nimport intlMessages from './intl';\n\nconst COMPONENT_NAME = 'TextField';\nconst CLASSNAME = 'redsift-text-field';\n\n/**\n * The TextField component.\n * Can be used as controlled or uncontrolled.\n */\nexport const TextField: Comp<TextFieldProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n after,\n autoFocus,\n className,\n color: propsColor,\n defaultValue = '',\n forceColor,\n hasClearButton,\n inputProps,\n inputRef,\n internal,\n isColored = true,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n label,\n leftIcon,\n name,\n onBlur: onBlurProps,\n onChange,\n onClear,\n onFocus: onFocusProps,\n pills,\n placeholder,\n theme: propsTheme,\n type,\n value: propsValue,\n variant = TextFieldVariant.default,\n ...forwardedProps\n } = props;\n\n const theme = useTheme(propsTheme);\n const color = Object.values(ButtonsColorPalette).includes(propsColor!) ? propsColor : isColored ? 'primary' : 'grey';\n const isGradient = color === ButtonsColorPalette.radar;\n\n const format = useMessageFormatter(intlMessages);\n\n const {\n isFocusVisible,\n isFocused,\n focusProps: { onFocus, onBlur },\n } = useFocusRing({\n autoFocus,\n });\n const [isFocusWithin, setFocusWithin] = useState(Boolean(autoFocus));\n const { focusWithinProps } = useFocusWithin({\n onFocusWithinChange: (isFocusWithin) => setFocusWithin(isFocusWithin),\n });\n\n const [value, setValue] = useState(defaultValue);\n const isControlled = propsValue !== null && propsValue !== undefined;\n\n const [labelId] = useId();\n\n warnIfNoAccessibleLabelFound(props as ComponentProps<'label'>, [label], 'TextField');\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(event.target.value, name, event);\n } else {\n setValue(event.target.value);\n }\n },\n [onChange]\n );\n\n const handleClear = useCallback(() => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange('');\n }\n if (onClear) {\n onClear();\n }\n if (hasClearButton && hasClearButton !== true && hasClearButton.onClick) {\n hasClearButton.onClick({} as MouseEvent<HTMLButtonElement>);\n }\n setValue('');\n }, [onChange]);\n\n return (\n <StyledTextField\n {...focusWithinProps}\n {...forwardedProps}\n $hasContent={\n isFocusWithin ||\n Boolean(isControlled ? propsValue : value) ||\n Boolean(placeholder) ||\n Boolean(pills && pills.length > 0)\n }\n $hasLeftIcon={Boolean(leftIcon)}\n $color={color}\n $isGradient={isGradient}\n $isDisabled={isDisabled}\n $isFocusVisible={isFocusVisible}\n $isInvalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n $isRequired={isRequired}\n $isFocused={Boolean(isFocused || forceColor)}\n $theme={theme}\n $variant={variant}\n className={classNames(TextField.className, className)}\n ref={ref as MutableRefObject<HTMLDivElement>}\n >\n <fieldset aria-hidden=\"true\" className={`${TextField.className}-input-wrapper__fieldset`}>\n <legend id={labelId} className={`${TextField.className}-input-wrapper-fieldset__legend`}>\n {label ? <span>{label}</span> : null}\n </legend>\n </fieldset>\n {label ? (\n <label className={`${TextField.className}__label`}>\n <span>{label}</span>\n </label>\n ) : null}\n <div className={`${TextField.className}__input-wrapper`}>\n {leftIcon ? (\n <Icon color={isDisabled ? 'question' : 'black'} {...leftIcon} aria-hidden=\"true\" className=\"left\" />\n ) : null}\n <div className={`${TextField.className}-input-wrapper__pills-and-input`}>\n <input\n {...inputProps}\n onBlur={(event) => {\n onBlur?.(event);\n onBlurProps?.(event);\n }}\n onFocus={(event) => {\n onFocus?.(event);\n onFocusProps?.(event);\n }}\n aria-disabled={isDisabled}\n aria-invalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby || (label ? labelId : undefined)}\n aria-readonly={isReadOnly}\n aria-required={isRequired}\n autoFocus={autoFocus}\n className={`${TextField.className}-input-wrapper-pills-and-input__input`}\n disabled={isDisabled}\n name={name}\n onChange={handleChange}\n placeholder={placeholder}\n ref={inputRef as MutableRefObject<HTMLInputElement>}\n type={type}\n value={isControlled ? propsValue : value}\n />\n <div>\n {pills?.map((pill, index) => (\n <Pill theme={theme} key={`${labelId}-pill-${index}`} color=\"blue\" size=\"small\" {...pill} />\n ))}\n </div>\n </div>\n {hasClearButton || internal || after ? (\n <Flexbox className={`${TextField.className}-input-wrapper__toolbar`} gap=\"8px\">\n {hasClearButton ? (\n <IconButton\n theme={theme}\n aria-label={label ? format('clear-field', { label }) : format('clear')}\n color=\"grey\"\n isDisabled={isDisabled}\n icon={mdiClose}\n {...(hasClearButton !== true && hasClearButton)}\n onClick={handleClear}\n className=\"right clear\"\n />\n ) : null}\n {typeof internal === 'function'\n ? internal(\n isControlled ? propsValue : value,\n isDisabled,\n isInvalid || (isRequired && !(isControlled ? propsValue : value)),\n isRequired\n )\n : internal}\n {(hasClearButton || internal) && after ? (\n <span\n style={{\n borderLeft: '1px solid var(--redsift-color-neutral-mid-grey)',\n position: 'relative',\n top: '-2px',\n }}\n />\n ) : null}\n {typeof after === 'function'\n ? after(\n isControlled ? propsValue : value,\n isDisabled,\n isInvalid || (isRequired && !(isControlled ? propsValue : value)),\n isRequired\n )\n : after}\n </Flexbox>\n ) : null}\n </div>\n </StyledTextField>\n );\n});\nTextField.className = CLASSNAME;\nTextField.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","TextField","forwardRef","props","ref","ariaLabel","ariaLabelledby","after","autoFocus","className","color","propsColor","defaultValue","forceColor","hasClearButton","inputProps","inputRef","internal","isColored","isDisabled","isInvalid","isReadOnly","isRequired","label","leftIcon","name","onBlur","onBlurProps","onChange","onClear","onFocus","onFocusProps","pills","placeholder","theme","propsTheme","type","value","propsValue","variant","TextFieldVariant","default","forwardedProps","_objectWithoutProperties","_excluded","useTheme","Object","values","ButtonsColorPalette","includes","isGradient","radar","format","useMessageFormatter","intlMessages","isFocusVisible","isFocused","focusProps","useFocusRing","isFocusWithin","setFocusWithin","useState","Boolean","focusWithinProps","useFocusWithin","onFocusWithinChange","setValue","isControlled","undefined","labelId","useId","warnIfNoAccessibleLabelFound","handleChange","useCallback","event","target","handleClear","onClick","React","createElement","StyledTextField","_extends","$hasContent","length","$hasLeftIcon","$color","$isGradient","$isDisabled","$isFocusVisible","$isInvalid","$isRequired","$isFocused","$theme","$variant","classNames","id","Icon","disabled","map","pill","index","Pill","key","size","Flexbox","gap","IconButton","icon","mdiClose","style","borderLeft","position","top","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,cAAc,GAAG,WAAW,CAAA;AAClC,MAAMC,SAAS,GAAG,oBAAoB,CAAA;;AAEtC;AACA;AACA;AACA;AACO,MAAMC,SAA+C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACxF,MAAM;AACJ,MAAA,YAAY,EAAEC,SAAS;AACvB,MAAA,iBAAiB,EAAEC,cAAc;MACjCC,KAAK;MACLC,SAAS;MACTC,SAAS;AACTC,MAAAA,KAAK,EAAEC,UAAU;AACjBC,MAAAA,YAAY,GAAG,EAAE;MACjBC,UAAU;MACVC,cAAc;MACdC,UAAU;MACVC,QAAQ;MACRC,QAAQ;AACRC,MAAAA,SAAS,GAAG,IAAI;MAChBC,UAAU;MACVC,SAAS;MACTC,UAAU;MACVC,UAAU;MACVC,KAAK;MACLC,QAAQ;MACRC,IAAI;AACJC,MAAAA,MAAM,EAAEC,WAAW;MACnBC,QAAQ;MACRC,OAAO;AACPC,MAAAA,OAAO,EAAEC,YAAY;MACrBC,KAAK;MACLC,WAAW;AACXC,MAAAA,KAAK,EAAEC,UAAU;MACjBC,IAAI;AACJC,MAAAA,KAAK,EAAEC,UAAU;MACjBC,OAAO,GAAGC,gBAAgB,CAACC,OAAAA;AAE7B,KAAC,GAAGtC,K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,CAAC,EAAC;AACFN,SAAS,CAACQ,SAAS,GAAGT,SAAS,CAAA;AAC/BC,SAAS,CAACgH,WAAW,GAAGlH,cAAc;;;;"}
1
+ {"version":3,"file":"TextField.js","sources":["../../../src/components/text-field/TextField.tsx"],"sourcesContent":["import React, { MouseEvent, ComponentProps, forwardRef, MutableRefObject, useCallback, useState } from 'react';\nimport classNames from 'classnames';\nimport { useFocusRing } from '../../react-aria/react-aria/focus';\nimport { useFocusWithin } from '../../react-aria/react-aria/interactions';\nimport { ButtonsColorPalette, Comp } from '../../types';\nimport { warnIfNoAccessibleLabelFound } from '../../utils/warnIfNoAccessibleLabelFound';\nimport { TextFieldProps, TextFieldVariant } from './types';\nimport { StyledTextField } from './styles';\nimport { Icon } from '../../components/icon';\nimport { mdiClose } from '@redsift/icons';\nimport { Flexbox } from '../flexbox';\nimport { IconButton } from '../icon-button';\nimport { Pill } from '../pill';\nimport { useTheme } from '../theme';\nimport { useMessageFormatter } from '@redsift/design-system/react-aria/react-aria/i18n';\nimport { useId } from '../../utils';\n\nimport intlMessages from './intl';\n\nconst COMPONENT_NAME = 'TextField';\nconst CLASSNAME = 'redsift-text-field';\n\n/**\n * The TextField component.\n * Can be used as controlled or uncontrolled.\n */\nexport const TextField: Comp<TextFieldProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n after,\n autoFocus,\n className,\n color: propsColor,\n defaultValue = '',\n forceColor,\n hasClearButton,\n inputProps,\n inputRef,\n internal,\n isColored = true,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n label,\n leftIcon,\n name,\n onBlur: onBlurProps,\n onChange,\n onClear,\n onFocus: onFocusProps,\n pills,\n placeholder,\n theme: propsTheme,\n type,\n value: propsValue,\n variant = TextFieldVariant.default,\n ...forwardedProps\n } = props;\n\n const theme = useTheme(propsTheme);\n const color = Object.values(ButtonsColorPalette).includes(propsColor!) ? propsColor : isColored ? 'primary' : 'grey';\n const isGradient = color === ButtonsColorPalette.radar;\n\n const format = useMessageFormatter(intlMessages);\n\n const {\n isFocusVisible,\n isFocused,\n focusProps: { onFocus, onBlur },\n } = useFocusRing({\n autoFocus,\n });\n const [isFocusWithin, setFocusWithin] = useState(Boolean(autoFocus));\n const { focusWithinProps } = useFocusWithin({\n onFocusWithinChange: (isFocusWithin) => setFocusWithin(isFocusWithin),\n });\n\n const [value, setValue] = useState(defaultValue);\n const isControlled = propsValue !== null && propsValue !== undefined;\n\n const [labelId] = useId();\n\n warnIfNoAccessibleLabelFound(props as ComponentProps<'label'>, [label], 'TextField');\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(event.target.value, name, event);\n } else {\n setValue(event.target.value);\n }\n },\n [onChange]\n );\n\n const handleClear = useCallback(() => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange('');\n }\n if (onClear) {\n onClear();\n }\n if (hasClearButton && hasClearButton !== true && hasClearButton.onClick) {\n hasClearButton.onClick({} as MouseEvent<HTMLButtonElement>);\n }\n setValue('');\n }, [onChange]);\n\n return (\n <StyledTextField\n {...focusWithinProps}\n {...forwardedProps}\n $hasContent={\n isFocusWithin ||\n Boolean(isControlled ? propsValue : value) ||\n Boolean(placeholder) ||\n Boolean(pills && pills.length > 0)\n }\n $hasLeftIcon={Boolean(leftIcon)}\n $color={color}\n $isGradient={isGradient}\n $isDisabled={isDisabled}\n $isFocusVisible={isFocusVisible}\n $isInvalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n $isRequired={isRequired}\n $isFocused={Boolean(isFocused || forceColor)}\n $theme={theme}\n $variant={variant}\n className={classNames(TextField.className, className)}\n ref={ref as MutableRefObject<HTMLDivElement>}\n >\n <fieldset aria-hidden=\"true\" className={`${TextField.className}-input-wrapper__fieldset`}>\n <legend id={labelId} className={`${TextField.className}-input-wrapper-fieldset__legend`}>\n {label ? <span>{label}</span> : null}\n </legend>\n </fieldset>\n {label ? (\n <label className={`${TextField.className}__label`}>\n <span>{label}</span>\n </label>\n ) : null}\n <div className={`${TextField.className}__input-wrapper`}>\n {leftIcon ? (\n <Icon color={isDisabled ? 'question' : 'black'} {...leftIcon} aria-hidden=\"true\" className=\"left\" />\n ) : null}\n <div className={`${TextField.className}-input-wrapper__pills-and-input`}>\n <input\n {...inputProps}\n onBlur={(event) => {\n onBlur?.(event);\n onBlurProps?.(event);\n }}\n onFocus={(event) => {\n onFocus?.(event);\n onFocusProps?.(event);\n }}\n aria-disabled={isDisabled}\n aria-invalid={isInvalid || (isRequired && !(isControlled ? propsValue : value))}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby || (label ? labelId : undefined)}\n aria-readonly={isReadOnly}\n aria-required={isRequired}\n autoFocus={autoFocus}\n className={`${TextField.className}-input-wrapper-pills-and-input__input`}\n disabled={isDisabled}\n name={name}\n onChange={handleChange}\n placeholder={placeholder}\n ref={inputRef as MutableRefObject<HTMLInputElement>}\n type={type}\n value={isControlled ? propsValue : value}\n />\n <div>\n {pills?.map((pill, index) => (\n <Pill theme={theme} key={`${labelId}-pill-${index}`} color=\"blue\" size=\"small\" {...pill} />\n ))}\n </div>\n </div>\n {hasClearButton || internal || after ? (\n <Flexbox className={`${TextField.className}-input-wrapper__toolbar`} gap=\"8px\">\n {hasClearButton ? (\n <IconButton\n theme={theme}\n aria-label={label ? format('clear-field', { label }) : format('clear')}\n color=\"grey\"\n isDisabled={isDisabled}\n icon={mdiClose}\n {...(hasClearButton !== true && hasClearButton)}\n onClick={handleClear}\n className=\"right clear\"\n />\n ) : null}\n {typeof internal === 'function'\n ? internal(\n isControlled ? propsValue : value,\n isDisabled,\n isInvalid || (isRequired && !(isControlled ? propsValue : value)),\n isRequired\n )\n : internal}\n {(hasClearButton || internal) && after ? (\n <span\n style={{\n borderLeft: '1px solid var(--redsift-color-neutral-mid-grey)',\n position: 'relative',\n top: '-2px',\n }}\n />\n ) : null}\n {typeof after === 'function'\n ? after(\n isControlled ? propsValue : value,\n isDisabled,\n isInvalid || (isRequired && !(isControlled ? propsValue : value)),\n isRequired\n )\n : after}\n </Flexbox>\n ) : null}\n </div>\n </StyledTextField>\n );\n});\nTextField.className = CLASSNAME;\nTextField.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","TextField","forwardRef","props","ref","ariaLabel","ariaLabelledby","after","autoFocus","className","color","propsColor","defaultValue","forceColor","hasClearButton","inputProps","inputRef","internal","isColored","isDisabled","isInvalid","isReadOnly","isRequired","label","leftIcon","name","onBlur","onBlurProps","onChange","onClear","onFocus","onFocusProps","pills","placeholder","theme","propsTheme","type","value","propsValue","variant","TextFieldVariant","default","forwardedProps","_objectWithoutProperties","_excluded","useTheme","Object","values","ButtonsColorPalette","includes","isGradient","radar","format","useMessageFormatter","intlMessages","isFocusVisible","isFocused","focusProps","useFocusRing","isFocusWithin","setFocusWithin","useState","Boolean","focusWithinProps","useFocusWithin","onFocusWithinChange","setValue","isControlled","undefined","labelId","useId","warnIfNoAccessibleLabelFound","handleChange","useCallback","event","target","handleClear","onClick","React","createElement","StyledTextField","_extends","$hasContent","length","$hasLeftIcon","$color","$isGradient","$isDisabled","$isFocusVisible","$isInvalid","$isRequired","$isFocused","$theme","$variant","classNames","id","Icon","disabled","map","pill","index","Pill","key","size","Flexbox","gap","IconButton","icon","mdiClose","style","borderLeft","position","top","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,cAAc,GAAG,WAAW,CAAA;AAClC,MAAMC,SAAS,GAAG,oBAAoB,CAAA;;AAEtC;AACA;AACA;AACA;AACO,MAAMC,SAA+C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACxF,MAAM;AACJ,MAAA,YAAY,EAAEC,SAAS;AACvB,MAAA,iBAAiB,EAAEC,cAAc;MACjCC,KAAK;MACLC,SAAS;MACTC,SAAS;AACTC,MAAAA,KAA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Ac,IAAIG,QAAQ,KAAKV,KAAK,gBACpCuE,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACE8B,IAAAA,KAAK,EAAE;AACLC,MAAAA,UAAU,EAAE,iDAAiD;AAC7DC,MAAAA,QAAQ,EAAE,UAAU;AACpBC,MAAAA,GAAG,EAAE,MAAA;AACP,KAAA;AAAE,GACH,CAAC,GACA,IAAI,EACP,OAAOzG,KAAK,KAAK,UAAU,GACxBA,KAAK,CACH4D,YAAY,GAAG7B,UAAU,GAAGD,KAAK,EACjClB,UAAU,EACVC,SAAS,IAAKE,UAAU,IAAI,EAAE6C,YAAY,GAAG7B,UAAU,GAAGD,KAAK,CAAE,EACjEf,UACF,CAAC,GACDf,KACG,CAAC,GACR,IACD,CACU,CAAC,CAAA;AAEtB,CAAC,EAAC;AACFN,SAAS,CAACQ,SAAS,GAAGT,SAAS,CAAA;AAC/BC,SAAS,CAACgH,WAAW,GAAGlH,cAAc;;;;"}
@@ -1,6 +1,6 @@
1
- import React__default from 'react';
1
+ import React from 'react';
2
2
 
3
- const ThemeContext = /*#__PURE__*/React__default.createContext(null);
3
+ const ThemeContext = /*#__PURE__*/React.createContext(null);
4
4
  const ThemeProvider = ThemeContext.Provider;
5
5
 
6
6
  export { ThemeContext, ThemeProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../src/components/theme/context.ts"],"sourcesContent":["import React from 'react';\nimport { Theme } from '../../types';\n\nexport const ThemeContext = React.createContext<{ theme?: Theme } | null>(null);\n\nexport const ThemeProvider = ThemeContext.Provider;\n"],"names":["ThemeContext","React","createContext","ThemeProvider","Provider"],"mappings":";;AAGO,MAAMA,YAAY,gBAAGC,cAAK,CAACC,aAAa,CAA2B,IAAI,EAAC;AAElEC,MAAAA,aAAa,GAAGH,YAAY,CAACI;;;;"}
1
+ {"version":3,"file":"context.js","sources":["../../../src/components/theme/context.ts"],"sourcesContent":["import React from 'react';\nimport { Theme } from '../../types';\n\nexport const ThemeContext = React.createContext<{ theme?: Theme } | null>(null);\n\nexport const ThemeProvider = ThemeContext.Provider;\n"],"names":["ThemeContext","React","createContext","ThemeProvider","Provider"],"mappings":";;AAGO,MAAMA,YAAY,gBAAGC,KAAK,CAACC,aAAa,CAA2B,IAAI,EAAC;AAElEC,MAAAA,aAAa,GAAGH,YAAY,CAACI;;;;"}
package/package.json CHANGED
@@ -20,6 +20,10 @@
20
20
  "url": "git+https://github.com/redsift/design-system"
21
21
  },
22
22
  "sideEffects": false,
23
+ "exports": {
24
+ ".": "./index.js",
25
+ "./components/*": "./components/*/index.js"
26
+ },
23
27
  "scripts": {
24
28
  "build:dictionary": "rm -rf ./style/redsift-design-tokens.css && style-dictionary build --config ./style-dictionary/config.json",
25
29
  "build": "rollup -c",
@@ -34,7 +38,7 @@
34
38
  "version": "version-changelog ../../CHANGELOG.md && changelog-verify ../../CHANGELOG.md && git add ../../CHANGELOG.md"
35
39
  },
36
40
  "types": "index.d.ts",
37
- "version": "11.6.0-muiv5-alpha.2",
41
+ "version": "11.6.0-muiv5-alpha.4",
38
42
  "dependencies": {
39
43
  "@react-spring/web": "^9.7.1",
40
44
  "classnames": "^2.3.1",
@@ -101,5 +105,5 @@
101
105
  "react-dom": ">=17",
102
106
  "styled-components": "^5.3.5"
103
107
  },
104
- "gitHead": "3bd6360e790051b7a9e685290d647f81f31e925f"
108
+ "gitHead": "2b1f551b817cdaaddcc7dabb1b1fbaa10e6467e5"
105
109
  }
@@ -1,5 +1,5 @@
1
1
  import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import React__default, { useRef, useEffect, useContext } from 'react';
2
+ import React, { useRef, useEffect, useContext } from 'react';
3
3
  import { useFocus } from '../interactions/useFocus.js';
4
4
  import { useKeyboard } from '../interactions/useKeyboard.js';
5
5
  import { mergeProps } from '../utils/mergeProps.js';
@@ -7,7 +7,7 @@ import { focusSafely } from './focusSafely.js';
7
7
  import { useSyncRef } from '../utils/useSyncRef.js';
8
8
 
9
9
  const _excluded = ["ref"];
10
- let FocusableContext = /*#__PURE__*/React__default.createContext(null);
10
+ let FocusableContext = /*#__PURE__*/React.createContext(null);
11
11
  function useFocusableContext(ref) {
12
12
  let context = useContext(FocusableContext) || {};
13
13
  useSyncRef(context, ref);
@@ -1 +1 @@
1
- {"version":3,"file":"useFocusable.js","sources":["../../../../src/react-aria/react-aria/focus/useFocusable.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { DOMAttributes, FocusableDOMProps, FocusableElement, FocusableProps } from '../../react-types/shared';\nimport { focusSafely } from './';\nimport { mergeProps, useObjectRef, useSyncRef } from '../utils';\nimport React, { ForwardedRef, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef } from 'react';\nimport { useFocus, useKeyboard } from '../interactions';\n\nexport interface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode;\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement | null>;\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue | null>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let { ref: _, ...otherProps } = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: ForwardedRef<FocusableElement>) {\n let { children, ...otherProps } = props;\n let objRef = useObjectRef(ref);\n let context = {\n ...otherProps,\n ref: objRef,\n };\n\n return <FocusableContext.Provider value={context}>{children}</FocusableContext.Provider>;\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport { _FocusableProvider as FocusableProvider };\n\nexport interface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: DOMAttributes;\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement>): FocusableAria {\n let { focusProps } = useFocus(props);\n let { keyboardProps } = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined,\n },\n interactionProps\n ),\n };\n}\n"],"names":["FocusableContext","React","createContext","useFocusableContext","ref","context","useContext","useSyncRef","otherProps","_objectWithoutProperties","_excluded","useFocusable","props","domRef","focusProps","useFocus","keyboardProps","useKeyboard","interactions","mergeProps","domProps","interactionProps","isDisabled","autoFocusRef","useRef","autoFocus","useEffect","current","focusSafely","focusableProps","_objectSpread","tabIndex","excludeFromTabOrder","undefined"],"mappings":";;;;;;;;;AAkCA,IAAIA,gBAAgB,gBAAGC,cAAK,CAACC,aAAa,CAA+B,IAAI,CAAC,CAAA;AAE9E,SAASC,mBAAmBA,CAACC,GAAgC,EAAyB;EACpF,IAAIC,OAAO,GAAGC,UAAU,CAACN,gBAAgB,CAAC,IAAI,EAAE,CAAA;AAChDO,EAAAA,UAAU,CAACF,OAAO,EAAED,GAAG,CA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":"useFocusable.js","sources":["../../../../src/react-aria/react-aria/focus/useFocusable.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { DOMAttributes, FocusableDOMProps, FocusableElement, FocusableProps } from '../../react-types/shared';\nimport { focusSafely } from './';\nimport { mergeProps, useObjectRef, useSyncRef } from '../utils';\nimport React, { ForwardedRef, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef } from 'react';\nimport { useFocus, useKeyboard } from '../interactions';\n\nexport interface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode;\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement | null>;\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue | null>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let { ref: _, ...otherProps } = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: ForwardedRef<FocusableElement>) {\n let { children, ...otherProps } = props;\n let objRef = useObjectRef(ref);\n let context = {\n ...otherProps,\n ref: objRef,\n };\n\n return <FocusableContext.Provider value={context}>{children}</FocusableContext.Provider>;\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport { _FocusableProvider as FocusableProvider };\n\nexport interface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: DOMAttributes;\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement>): FocusableAria {\n let { focusProps } = useFocus(props);\n let { keyboardProps } = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined,\n },\n interactionProps\n ),\n };\n}\n"],"names":["FocusableContext","React","createContext","useFocusableContext","ref","context","useContext","useSyncRef","otherProps","_objectWithoutProperties","_excluded","useFocusable","props","domRef","focusProps","useFocus","keyboardProps","useKeyboard","interactions","mergeProps","domProps","interactionProps","isDisabled","autoFocusRef","useRef","autoFocus","useEffect","current","focusSafely","focusableProps","_objectSpread","tabIndex","excludeFromTabOrder","undefined"],"mappings":";;;;;;;;;AAkCA,IAAIA,gBAAgB,gBAAGC,KAAK,CAACC,aAAa,CAA+B,IAAI,CAAC,CAAA;AAE9E,SAASC,mBAAmBA,CAACC,GAAgC,EAAyB;EACpF,IAAIC,OAAO,GAAGC,UAAU,CAACN,gBAAgB,CAAC,IAAI,EAAE,CAAA;AAChDO,EAAAA,UAAU,CAACF,OAAO,EAAED,GAAG,CAAC,CAAA;;AAExB;EACI,IAAaI,UAAU,GAAAC,wBAAA,CAAKJ,OAAO,EAAAK,SAAA,EAAA;AACvC,EAAA,OAAOF,UAAU,CAAA;AACnB,CAAA;AAwBA;AACA;AACA;AACO,SAASG,YAAYA,CAACC,KAAuB,EAAEC,MAAmC,EAAiB;EACxG,IAAI;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAGC,QAAQ,CAACH,KAAK,CAAC,CAAA;EACpC,IAAI;AAAEI,IAAAA,aAAAA;AAAc,GAAC,GAAGC,WAAW,CAACL,KAAK,CAAC,CAAA;AAC1C,EAAA,IAAIM,YAAY,GAAGC,UAAU,CAACL,UAAU,EAAEE,aAAa,CAAC,CAAA;AACxD,EAAA,IAAII,QAAQ,GAAGjB,mBAAmB,CAACU,MAAM,CAAC,CAAA;EAC1C,IAAIQ,gBAAgB,GAAGT,KAAK,CAACU,UAAU,GAAG,EAAE,GAAGF,QAAQ,CAAA;AACvD,EAAA,IAAIG,YAAY,GAAGC,MAAM,CAACZ,KAAK,CAACa,SAAS,CAAC,CAAA;AAE1CC,EAAAA,SAAS,CAAC,MAAM;AACd,IAAA,IAAIH,YAAY,CAACI,OAAO,IAAId,MAAM,CAACc,OAAO,EAAE;AAC1CC,MAAAA,WAAW,CAACf,MAAM,CAACc,OAAO,CAAC,CAAA;AAC7B,KAAA;IACAJ,YAAY,CAACI,OAAO,GAAG,KAAK,CAAA;AAC9B,GAAC,EAAE,CAACd,MAAM,CAAC,CAAC,CAAA;EAEZ,OAAO;AACLgB,IAAAA,cAAc,EAAEV,UAAU,CAAAW,cAAA,CAAAA,cAAA,KAEnBZ,YAAY,CAAA,EAAA,EAAA,EAAA;AACfa,MAAAA,QAAQ,EAAEnB,KAAK,CAACoB,mBAAmB,IAAI,CAACpB,KAAK,CAACU,UAAU,GAAG,CAAC,CAAC,GAAGW,SAAAA;AAAS,KAAA,CAAA,EAE3EZ,gBACF,CAAA;GACD,CAAA;AACH;;;;"}
@@ -1,9 +1,9 @@
1
1
  import { isRTL } from './utils.js';
2
2
  import { useDefaultLocale } from './useDefaultLocale.js';
3
- import React__default, { useContext } from 'react';
3
+ import React, { useContext } from 'react';
4
4
 
5
5
  /* eslint-disable prefer-const */
6
- const I18nContext = /*#__PURE__*/React__default.createContext(null);
6
+ const I18nContext = /*#__PURE__*/React.createContext(null);
7
7
 
8
8
  /**
9
9
  * Provides the locale for the application to all child components.
@@ -14,7 +14,7 @@ function I18nProvider(props) {
14
14
  children
15
15
  } = props;
16
16
  let defaultLocale = useDefaultLocale();
17
- let value = React__default.useMemo(() => {
17
+ let value = React.useMemo(() => {
18
18
  if (!locale) {
19
19
  return defaultLocale;
20
20
  }
@@ -23,7 +23,7 @@ function I18nProvider(props) {
23
23
  direction: isRTL(locale) ? 'rtl' : 'ltr'
24
24
  };
25
25
  }, [defaultLocale, locale]);
26
- return /*#__PURE__*/React__default.createElement(I18nContext.Provider, {
26
+ return /*#__PURE__*/React.createElement(I18nContext.Provider, {
27
27
  value: value
28
28
  }, children);
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../../src/react-aria/react-aria/i18n/context.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { isRTL } from './utils';\nimport { Locale, useDefaultLocale } from './useDefaultLocale';\nimport React, { ReactNode, useContext } from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode;\n /** The locale to apply to the children. */\n locale?: string;\n}\n\nconst I18nContext = React.createContext<Locale | null>(null);\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps) {\n let { locale, children } = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = React.useMemo(() => {\n if (!locale) {\n return defaultLocale;\n }\n\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr',\n };\n }, [defaultLocale, locale]);\n\n return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n"],"names":["I18nContext","React","createContext","I18nProvider","props","locale","children","defaultLocale","useDefaultLocale","value","useMemo","direction","isRTL","createElement","Provider","useLocale","context","useContext"],"mappings":";;;;AAAA;AAyBA,MAAMA,WAAW,gBAAGC,cAAK,CAACC,aAAa,CAAgB,IAAI,CAAC,CAAA;;AAE5D;AACA;AACA;AACO,SAASC,YAAYA,CAACC,KAAwB,EAAE;EACrD,IAAI;IAAEC,MAAM;AAAEC,IAAAA,QAAAA;AAAS,GAAC,GAAGF,KAAK,CAAA;AAChC,EAAA,IAAIG,aAAa,GAAGC,gBAAgB,EAAE,CAAA;AAEtC,EAAA,IAAIC,KAAa,GAAGR,cAAK,CAACS,OAAO,CAAC,MAAM;IACtC,IAAI,CAACL,MAAM,EAAE;AACX,MAAA,OAAOE,aAAa,CAAA;AACtB,KAAA;IAEA,OAAO;MACLF,MAAM;AACNM,MAAAA,SAAS,EAAEC,KAAK,CAACP,MAAM,CAAC,GAAG,KAAK,GAAG,KAAA;KACpC,CAAA;AACH,GAAC,EAAE,CAACE,aAAa,EAAEF,MAAM,CAAC,CAAC,CAAA;AAE3B,EAAA,oBAAOJ,cAAA,CAAAY,aAAA,CAACb,WAAW,CAACc,QAAQ,EAAA;AAACL,IAAAA,KAAK,EAAEA,KAAAA;AAAM,GAAA,EAAEH,QAA+B,CAAC,CAAA;AAC9E,CAAA;;AAEA;AACA;AACA;AACO,SAASS,SAASA,GAAW;AAClC,EAAA,IAAIR,aAAa,GAAGC,gBAAgB,EAAE,CAAA;AACtC,EAAA,IAAIQ,OAAO,GAAGC,UAAU,CAACjB,WAAW,CAAC,CAAA;EACrC,OAAOgB,OAAO,IAAIT,aAAa,CAAA;AACjC;;;;"}
1
+ {"version":3,"file":"context.js","sources":["../../../../src/react-aria/react-aria/i18n/context.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { isRTL } from './utils';\nimport { Locale, useDefaultLocale } from './useDefaultLocale';\nimport React, { ReactNode, useContext } from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode;\n /** The locale to apply to the children. */\n locale?: string;\n}\n\nconst I18nContext = React.createContext<Locale | null>(null);\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps) {\n let { locale, children } = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = React.useMemo(() => {\n if (!locale) {\n return defaultLocale;\n }\n\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr',\n };\n }, [defaultLocale, locale]);\n\n return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n"],"names":["I18nContext","React","createContext","I18nProvider","props","locale","children","defaultLocale","useDefaultLocale","value","useMemo","direction","isRTL","createElement","Provider","useLocale","context","useContext"],"mappings":";;;;AAAA;AAyBA,MAAMA,WAAW,gBAAGC,KAAK,CAACC,aAAa,CAAgB,IAAI,CAAC,CAAA;;AAE5D;AACA;AACA;AACO,SAASC,YAAYA,CAACC,KAAwB,EAAE;EACrD,IAAI;IAAEC,MAAM;AAAEC,IAAAA,QAAAA;AAAS,GAAC,GAAGF,KAAK,CAAA;AAChC,EAAA,IAAIG,aAAa,GAAGC,gBAAgB,EAAE,CAAA;AAEtC,EAAA,IAAIC,KAAa,GAAGR,KAAK,CAACS,OAAO,CAAC,MAAM;IACtC,IAAI,CAACL,MAAM,EAAE;AACX,MAAA,OAAOE,aAAa,CAAA;AACtB,KAAA;IAEA,OAAO;MACLF,MAAM;AACNM,MAAAA,SAAS,EAAEC,KAAK,CAACP,MAAM,CAAC,GAAG,KAAK,GAAG,KAAA;KACpC,CAAA;AACH,GAAC,EAAE,CAACE,aAAa,EAAEF,MAAM,CAAC,CAAC,CAAA;AAE3B,EAAA,oBAAOJ,KAAA,CAAAY,aAAA,CAACb,WAAW,CAACc,QAAQ,EAAA;AAACL,IAAAA,KAAK,EAAEA,KAAAA;AAAM,GAAA,EAAEH,QAA+B,CAAC,CAAA;AAC9E,CAAA;;AAEA;AACA;AACA;AACO,SAASS,SAASA,GAAW;AAClC,EAAA,IAAIR,aAAa,GAAGC,gBAAgB,EAAE,CAAA;AACtC,EAAA,IAAIQ,OAAO,GAAGC,UAAU,CAACjB,WAAW,CAAC,CAAA;EACrC,OAAOgB,OAAO,IAAIT,aAAa,CAAA;AACjC;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import React from 'react';
2
2
 
3
3
  /*
4
4
  * Copyright 2020 Adobe. All rights reserved.
@@ -11,7 +11,7 @@ import React__default from 'react';
11
11
  * OF ANY KIND, either express or implied. See the License for the specific language
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
- const PressResponderContext = /*#__PURE__*/React__default.createContext({
14
+ const PressResponderContext = /*#__PURE__*/React.createContext({
15
15
  register: () => {}
16
16
  });
17
17
  PressResponderContext.displayName = 'PressResponderContext';
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../../src/react-aria/react-aria/interactions/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { FocusableElement } from '../../react-types/shared';\nimport { PressProps } from './usePress';\nimport React, { MutableRefObject } from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void;\n ref?: MutableRefObject<FocusableElement>;\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>({ register: () => {} });\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":["PressResponderContext","React","createContext","register","displayName"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAWaA,qBAAqB,gBAAGC,cAAK,CAACC,aAAa,CAAyB;EAAEC,QAAQ,EAAEA,MAAM,EAAC;AAAE,CAAC,EAAC;AACxGH,qBAAqB,CAACI,WAAW,GAAG,uBAAuB;;;;"}
1
+ {"version":3,"file":"context.js","sources":["../../../../src/react-aria/react-aria/interactions/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { FocusableElement } from '../../react-types/shared';\nimport { PressProps } from './usePress';\nimport React, { MutableRefObject } from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void;\n ref?: MutableRefObject<FocusableElement>;\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>({ register: () => {} });\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":["PressResponderContext","React","createContext","register","displayName"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAWaA,qBAAqB,gBAAGC,KAAK,CAACC,aAAa,CAAyB;EAAEC,QAAQ,EAAEA,MAAM,EAAC;AAAE,CAAC,EAAC;AACxGH,qBAAqB,CAACI,WAAW,GAAG,uBAAuB;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default, { useContext, useState, useMemo, useLayoutEffect, useRef } from 'react';
1
+ import React, { useContext, useState, useMemo, useLayoutEffect, useRef } from 'react';
2
2
 
3
3
  /* eslint-disable prefer-const */
4
4
 
@@ -17,8 +17,8 @@ const defaultContext = {
17
17
  prefix: String(Math.round(Math.random() * 10000000000)),
18
18
  current: 0
19
19
  };
20
- const SSRContext = /*#__PURE__*/React__default.createContext(defaultContext);
21
- const IsSSRContext = /*#__PURE__*/React__default.createContext(false);
20
+ const SSRContext = /*#__PURE__*/React.createContext(defaultContext);
21
+ const IsSSRContext = /*#__PURE__*/React.createContext(false);
22
22
  // This is only used in React < 18.
23
23
  function LegacySSRProvider(props) {
24
24
  let cur = useContext(SSRContext);
@@ -41,9 +41,9 @@ function LegacySSRProvider(props) {
41
41
  setIsSSR(false);
42
42
  }, []);
43
43
  }
44
- return /*#__PURE__*/React__default.createElement(SSRContext.Provider, {
44
+ return /*#__PURE__*/React.createElement(SSRContext.Provider, {
45
45
  value: value
46
- }, /*#__PURE__*/React__default.createElement(IsSSRContext.Provider, {
46
+ }, /*#__PURE__*/React.createElement(IsSSRContext.Provider, {
47
47
  value: isSSR
48
48
  }, props.children));
49
49
  }
@@ -54,14 +54,14 @@ let warnedAboutSSRProvider = false;
54
54
  * This ensures that auto generated ids are consistent between the client and server.
55
55
  */
56
56
  function SSRProvider(props) {
57
- if (typeof React__default['useId'] === 'function') {
57
+ if (typeof React['useId'] === 'function') {
58
58
  if (process.env.NODE_ENV !== 'test' && !warnedAboutSSRProvider) {
59
59
  console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
60
60
  warnedAboutSSRProvider = true;
61
61
  }
62
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, props.children);
62
+ return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
63
63
  }
64
- return /*#__PURE__*/React__default.createElement(LegacySSRProvider, props);
64
+ return /*#__PURE__*/React.createElement(LegacySSRProvider, props);
65
65
  }
66
66
  let canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
67
67
  let componentIds = new WeakMap();
@@ -81,7 +81,7 @@ function useCounter() {
81
81
  // a weak map associated with the Fiber. On the second render, we reset the global counter to this value.
82
82
  // Since React runs the second render immediately after the first, this is safe.
83
83
  // @ts-ignore
84
- let currentOwner = (_React$__SECRET_INTER = React__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React$__SECRET_INTER === void 0 ? void 0 : (_React$__SECRET_INTER2 = _React$__SECRET_INTER.ReactCurrentOwner) === null || _React$__SECRET_INTER2 === void 0 ? void 0 : _React$__SECRET_INTER2.current;
84
+ let currentOwner = (_React$__SECRET_INTER = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React$__SECRET_INTER === void 0 ? void 0 : (_React$__SECRET_INTER2 = _React$__SECRET_INTER.ReactCurrentOwner) === null || _React$__SECRET_INTER2 === void 0 ? void 0 : _React$__SECRET_INTER2.current;
85
85
  if (currentOwner) {
86
86
  let prevComponentValue = componentIds.get(currentOwner);
87
87
  if (prevComponentValue == null) {
@@ -116,7 +116,7 @@ function useLegacySSRSafeId(defaultId) {
116
116
  }
117
117
  function useModernSSRSafeId(defaultId) {
118
118
  // @ts-ignore
119
- let id = React__default.useId();
119
+ let id = React.useId();
120
120
  let [didSSR] = useState(useIsSSR());
121
121
  let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${defaultContext.prefix}`;
122
122
  return defaultId || `${prefix}-${id}`;
@@ -124,7 +124,7 @@ function useModernSSRSafeId(defaultId) {
124
124
 
125
125
  // Use React.useId in React 18 if available, otherwise fall back to our old implementation.
126
126
  /** @private */
127
- const useSSRSafeId = typeof React__default['useId'] === 'function' ? useModernSSRSafeId : useLegacySSRSafeId;
127
+ const useSSRSafeId = typeof React['useId'] === 'function' ? useModernSSRSafeId : useLegacySSRSafeId;
128
128
  function getSnapshot() {
129
129
  return false;
130
130
  }
@@ -145,8 +145,8 @@ function subscribe(onStoreChange) {
145
145
  */
146
146
  function useIsSSR() {
147
147
  // In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
148
- if (typeof React__default['useSyncExternalStore'] === 'function') {
149
- return React__default['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot);
148
+ if (typeof React['useSyncExternalStore'] === 'function') {
149
+ return React['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot);
150
150
  }
151
151
 
152
152
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -1 +1 @@
1
- {"version":3,"file":"SSRProvider.js","sources":["../../../../src/react-aria/react-aria/ssr/SSRProvider.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is\n// guarded by a check that it only runs on the client side.\nimport React, { ReactNode, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\n// To support SSR, the auto incrementing id counter is stored in a context. This allows\n// it to be reset on every request to ensure the client and server are consistent.\n// There is also a prefix string that is used to support async loading components\n// Each async boundary must be wrapped in an SSR provider, which appends to the prefix\n// and resets the current id counter. This ensures that async loaded components have\n// consistent ids regardless of the loading order.\ninterface SSRContextValue {\n prefix: string;\n current: number;\n}\n\n// Default context value to use in case there is no SSRProvider. This is fine for\n// client-only apps. In order to support multiple copies of React Aria potentially\n// being on the page at once, the prefix is set to a random number. SSRProvider\n// will reset this to zero for consistency between server and client, so in the\n// SSR case multiple copies of React Aria is not supported.\nconst defaultContext: SSRContextValue = {\n prefix: String(Math.round(Math.random() * 10000000000)),\n current: 0,\n};\n\nconst SSRContext = React.createContext<SSRContextValue>(defaultContext);\nconst IsSSRContext = React.createContext(false);\n\nexport interface SSRProviderProps {\n /** Your application here. */\n children: ReactNode;\n}\n\n// This is only used in React < 18.\nfunction LegacySSRProvider(props: SSRProviderProps): JSX.Element {\n let cur = useContext(SSRContext);\n let counter = useCounter(cur === defaultContext);\n let [isSSR, setIsSSR] = useState(true);\n let value: SSRContextValue = useMemo(\n () => ({\n // If this is the first SSRProvider, start with an empty string prefix, otherwise\n // append and increment the counter.\n prefix: cur === defaultContext ? '' : `${cur.prefix}-${counter}`,\n current: 0,\n }),\n [cur, counter]\n );\n\n // If on the client, and the component was initially server rendered,\n // then schedule a layout effect to update the component after hydration.\n if (typeof document !== 'undefined') {\n // This if statement technically breaks the rules of hooks, but is safe\n // because the condition never changes after mounting.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return (\n <SSRContext.Provider value={value}>\n <IsSSRContext.Provider value={isSSR}>{props.children}</IsSSRContext.Provider>\n </SSRContext.Provider>\n );\n}\n\nlet warnedAboutSSRProvider = false;\n\n/**\n * When using SSR with React Aria in React 16 or 17, applications must be wrapped in an SSRProvider.\n * This ensures that auto generated ids are consistent between the client and server.\n */\nexport function SSRProvider(props: SSRProviderProps): JSX.Element {\n if (typeof React['useId'] === 'function') {\n if (process.env.NODE_ENV !== 'test' && !warnedAboutSSRProvider) {\n console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');\n warnedAboutSSRProvider = true;\n }\n return <>{props.children}</>;\n }\n return <LegacySSRProvider {...props} />;\n}\n\nlet canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);\n\nlet componentIds = new WeakMap();\n\nfunction useCounter(isDisabled = false) {\n let ctx = useContext(SSRContext);\n let ref = useRef<number | null>(null);\n if (ref.current === null && !isDisabled) {\n // In strict mode, React renders components twice, and the ref will be reset to null on the second render.\n // This means our id counter will be incremented twice instead of once. This is a problem because on the\n // server, components are only rendered once and so ids generated on the server won't match the client.\n // In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this\n // we need to use some React internals to access the underlying Fiber instance, which is stable between renders.\n // This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.\n // To ensure that we only increment the global counter once, we store the starting id for this component in\n // a weak map associated with the Fiber. On the second render, we reset the global counter to this value.\n // Since React runs the second render immediately after the first, this is safe.\n // @ts-ignore\n let currentOwner = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;\n if (currentOwner) {\n let prevComponentValue = componentIds.get(currentOwner);\n if (prevComponentValue == null) {\n // On the first render, and first call to useId, store the id and state in our weak map.\n componentIds.set(currentOwner, {\n id: ctx.current,\n state: currentOwner.memoizedState,\n });\n } else if (currentOwner.memoizedState !== prevComponentValue.state) {\n // On the second render, the memoizedState gets reset by React.\n // Reset the counter, and remove from the weak map so we don't\n // do this for subsequent useId calls.\n ctx.current = prevComponentValue.id;\n componentIds.delete(currentOwner);\n }\n }\n\n ref.current = ++ctx.current;\n }\n\n return ref.current;\n}\n\nfunction useLegacySSRSafeId(defaultId?: string): string {\n let ctx = useContext(SSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider,\n // provide a warning to hint to the developer to add one.\n if (ctx === defaultContext && !canUseDOM) {\n console.warn(\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.'\n );\n }\n\n let counter = useCounter(!!defaultId);\n let prefix = ctx === defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;\n return defaultId || `${prefix}-${counter}`;\n}\n\nfunction useModernSSRSafeId(defaultId?: string): string {\n // @ts-ignore\n let id = React.useId();\n let [didSSR] = useState(useIsSSR());\n let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${defaultContext.prefix}`;\n return defaultId || `${prefix}-${id}`;\n}\n\n// Use React.useId in React 18 if available, otherwise fall back to our old implementation.\n/** @private */\nexport const useSSRSafeId = typeof React['useId'] === 'function' ? useModernSSRSafeId : useLegacySSRSafeId;\n\nfunction getSnapshot() {\n return false;\n}\n\nfunction getServerSnapshot() {\n return true;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction subscribe(onStoreChange: () => void): () => void {\n // noop\n return () => {};\n}\n\n/**\n * Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nexport function useIsSSR(): boolean {\n // In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.\n if (typeof React['useSyncExternalStore'] === 'function') {\n return React['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot);\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useContext(IsSSRContext);\n}\n"],"names":["defaultContext","prefix","String","Math","round","random","current","SSRContext","React","createContext","IsSSRContext","LegacySSRProvider","props","cur","useContext","counter","useCounter","isSSR","setIsSSR","useState","value","useMemo","document","useLayoutEffect","createElement","Provider","children","warnedAboutSSRProvider","SSRProvider","process","env","NODE_ENV","console","warn","Fragment","canUseDOM","Boolean","window","componentIds","WeakMap","isDisabled","arguments","length","undefined","ctx","ref","useRef","_React$__SECRET_INTER","_React$__SECRET_INTER2","currentOwner","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentOwner","prevComponentValue","get","set","id","state","memoizedState","delete","useLegacySSRSafeId","defaultId","useModernSSRSafeId","useId","didSSR","useIsSSR","useSSRSafeId","getSnapshot","getServerSnapshot","subscribe","onStoreChange"],"mappings":";;AAAA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAA+B,GAAG;AACtCC,EAAAA,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC;AACvDC,EAAAA,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,MAAMC,UAAU,gBAAGC,cAAK,CAACC,aAAa,CAAkBT,cAAc,CAAC,CAAA;AACvE,MAAMU,YAAY,gBAAGF,cAAK,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;AAO/C;AACA,SAASE,iBAAiBA,CAACC,KAAuB,EAAe;AAC/D,EAAA,IAAIC,GAAG,GAAGC,UAAU,CAACP,UAAU,CAAC,CAAA;AAChC,EAAA,IAAIQ,OAAO,GAAGC,UAAU,CAACH,GAAG,KAAKb,cAAc,CAAC,CAAA;EAChD,IAAI,CAACiB,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACtC,EAAA,IAAIC,KAAsB,GAAGC,OAAO,CAClC,OAAO;AACL;AACA;AACApB,IAAAA,MAAM,EAAEY,GAAG,KAAKb,cAAc,GAAG,EAAE,GAAI,CAAA,EAAEa,GAAG,CAACZ,MAAO,CAAA,CAAA,EAAGc,OAAQ,CAAC,CAAA;AAChET,IAAAA,OAAO,EAAE,CAAA;AACX,GAAC,CAAC,EACF,CAACO,GAAG,EAAEE,OAAO,CACf,CAAC,CAAA;;AAED;AACA;AACA,EAAA,IAAI,OAAOO,QAAQ,KAAK,WAAW,EAAE;AACnC;AACA;AACA;AACAC,IAAAA,eAAe,CAAC,MAAM;MACpBL,QAAQ,CAAC,KAAK,CAAC,CAAA;KAChB,EAAE,EAAE,CAAC,CA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AkB;AAE1G,SAASO,WAAWA,GAAG;AACrB,EAAA,OAAO,KAAK,CAAA;AACd,CAAA;AAEA,SAASC,iBAAiBA,GAAG;AAC3B,EAAA,OAAO,IAAI,CAAA;AACb,CAAA;;AAEA;AACA,SAASC,SAASA,CAACC,aAAyB,EAAc;AACxD;EACA,OAAO,MAAM,EAAE,CAAA;AACjB,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASL,QAAQA,GAAY;AAClC;AACA,EAAA,IAAI,OAAOxD,cAAK,CAAC,sBAAsB,CAAC,KAAK,UAAU,EAAE;IACvD,OAAOA,cAAK,CAAC,sBAAsB,CAAC,CAAC4D,SAAS,EAAEF,WAAW,EAAEC,iBAAiB,CAAC,CAAA;AACjF,GAAA;;AAEA;EACA,OAAOrD,UAAU,CAACJ,YAAY,CAAC,CAAA;AACjC;;;;"}
1
+ {"version":3,"file":"SSRProvider.js","sources":["../../../../src/react-aria/react-aria/ssr/SSRProvider.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is\n// guarded by a check that it only runs on the client side.\nimport React, { ReactNode, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\n// To support SSR, the auto incrementing id counter is stored in a context. This allows\n// it to be reset on every request to ensure the client and server are consistent.\n// There is also a prefix string that is used to support async loading components\n// Each async boundary must be wrapped in an SSR provider, which appends to the prefix\n// and resets the current id counter. This ensures that async loaded components have\n// consistent ids regardless of the loading order.\ninterface SSRContextValue {\n prefix: string;\n current: number;\n}\n\n// Default context value to use in case there is no SSRProvider. This is fine for\n// client-only apps. In order to support multiple copies of React Aria potentially\n// being on the page at once, the prefix is set to a random number. SSRProvider\n// will reset this to zero for consistency between server and client, so in the\n// SSR case multiple copies of React Aria is not supported.\nconst defaultContext: SSRContextValue = {\n prefix: String(Math.round(Math.random() * 10000000000)),\n current: 0,\n};\n\nconst SSRContext = React.createContext<SSRContextValue>(defaultContext);\nconst IsSSRContext = React.createContext(false);\n\nexport interface SSRProviderProps {\n /** Your application here. */\n children: ReactNode;\n}\n\n// This is only used in React < 18.\nfunction LegacySSRProvider(props: SSRProviderProps): JSX.Element {\n let cur = useContext(SSRContext);\n let counter = useCounter(cur === defaultContext);\n let [isSSR, setIsSSR] = useState(true);\n let value: SSRContextValue = useMemo(\n () => ({\n // If this is the first SSRProvider, start with an empty string prefix, otherwise\n // append and increment the counter.\n prefix: cur === defaultContext ? '' : `${cur.prefix}-${counter}`,\n current: 0,\n }),\n [cur, counter]\n );\n\n // If on the client, and the component was initially server rendered,\n // then schedule a layout effect to update the component after hydration.\n if (typeof document !== 'undefined') {\n // This if statement technically breaks the rules of hooks, but is safe\n // because the condition never changes after mounting.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return (\n <SSRContext.Provider value={value}>\n <IsSSRContext.Provider value={isSSR}>{props.children}</IsSSRContext.Provider>\n </SSRContext.Provider>\n );\n}\n\nlet warnedAboutSSRProvider = false;\n\n/**\n * When using SSR with React Aria in React 16 or 17, applications must be wrapped in an SSRProvider.\n * This ensures that auto generated ids are consistent between the client and server.\n */\nexport function SSRProvider(props: SSRProviderProps): JSX.Element {\n if (typeof React['useId'] === 'function') {\n if (process.env.NODE_ENV !== 'test' && !warnedAboutSSRProvider) {\n console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');\n warnedAboutSSRProvider = true;\n }\n return <>{props.children}</>;\n }\n return <LegacySSRProvider {...props} />;\n}\n\nlet canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);\n\nlet componentIds = new WeakMap();\n\nfunction useCounter(isDisabled = false) {\n let ctx = useContext(SSRContext);\n let ref = useRef<number | null>(null);\n if (ref.current === null && !isDisabled) {\n // In strict mode, React renders components twice, and the ref will be reset to null on the second render.\n // This means our id counter will be incremented twice instead of once. This is a problem because on the\n // server, components are only rendered once and so ids generated on the server won't match the client.\n // In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this\n // we need to use some React internals to access the underlying Fiber instance, which is stable between renders.\n // This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.\n // To ensure that we only increment the global counter once, we store the starting id for this component in\n // a weak map associated with the Fiber. On the second render, we reset the global counter to this value.\n // Since React runs the second render immediately after the first, this is safe.\n // @ts-ignore\n let currentOwner = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;\n if (currentOwner) {\n let prevComponentValue = componentIds.get(currentOwner);\n if (prevComponentValue == null) {\n // On the first render, and first call to useId, store the id and state in our weak map.\n componentIds.set(currentOwner, {\n id: ctx.current,\n state: currentOwner.memoizedState,\n });\n } else if (currentOwner.memoizedState !== prevComponentValue.state) {\n // On the second render, the memoizedState gets reset by React.\n // Reset the counter, and remove from the weak map so we don't\n // do this for subsequent useId calls.\n ctx.current = prevComponentValue.id;\n componentIds.delete(currentOwner);\n }\n }\n\n ref.current = ++ctx.current;\n }\n\n return ref.current;\n}\n\nfunction useLegacySSRSafeId(defaultId?: string): string {\n let ctx = useContext(SSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider,\n // provide a warning to hint to the developer to add one.\n if (ctx === defaultContext && !canUseDOM) {\n console.warn(\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.'\n );\n }\n\n let counter = useCounter(!!defaultId);\n let prefix = ctx === defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;\n return defaultId || `${prefix}-${counter}`;\n}\n\nfunction useModernSSRSafeId(defaultId?: string): string {\n // @ts-ignore\n let id = React.useId();\n let [didSSR] = useState(useIsSSR());\n let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${defaultContext.prefix}`;\n return defaultId || `${prefix}-${id}`;\n}\n\n// Use React.useId in React 18 if available, otherwise fall back to our old implementation.\n/** @private */\nexport const useSSRSafeId = typeof React['useId'] === 'function' ? useModernSSRSafeId : useLegacySSRSafeId;\n\nfunction getSnapshot() {\n return false;\n}\n\nfunction getServerSnapshot() {\n return true;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction subscribe(onStoreChange: () => void): () => void {\n // noop\n return () => {};\n}\n\n/**\n * Returns whether the component is currently being server side rendered or\n * hydrated on the client. Can be used to delay browser-specific rendering\n * until after hydration.\n */\nexport function useIsSSR(): boolean {\n // In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.\n if (typeof React['useSyncExternalStore'] === 'function') {\n return React['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot);\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useContext(IsSSRContext);\n}\n"],"names":["defaultContext","prefix","String","Math","round","random","current","SSRContext","React","createContext","IsSSRContext","LegacySSRProvider","props","cur","useContext","counter","useCounter","isSSR","setIsSSR","useState","value","useMemo","document","useLayoutEffect","createElement","Provider","children","warnedAboutSSRProvider","SSRProvider","process","env","NODE_ENV","console","warn","Fragment","canUseDOM","Boolean","window","componentIds","WeakMap","isDisabled","arguments","length","undefined","ctx","ref","useRef","_React$__SECRET_INTER","_React$__SECRET_INTER2","currentOwner","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentOwner","prevComponentValue","get","set","id","state","memoizedState","delete","useLegacySSRSafeId","defaultId","useModernSSRSafeId","useId","didSSR","useIsSSR","useSSRSafeId","getSnapshot","getServerSnapshot","subscribe","onStoreCh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GAAG;AAC3B,EAAA,OAAO,IAAI,CAAA;AACb,CAAA;;AAEA;AACA,SAASC,SAASA,CAACC,aAAyB,EAAc;AACxD;EACA,OAAO,MAAM,EAAE,CAAA;AACjB,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASL,QAAQA,GAAY;AAClC;AACA,EAAA,IAAI,OAAOxD,KAAK,CAAC,sBAAsB,CAAC,KAAK,UAAU,EAAE;IACvD,OAAOA,KAAK,CAAC,sBAAsB,CAAC,CAAC4D,SAAS,EAAEF,WAAW,EAAEC,iBAAiB,CAAC,CAAA;AACjF,GAAA;;AAEA;EACA,OAAOrD,UAAU,CAACJ,YAAY,CAAC,CAAA;AACjC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { chain } from './chain.js';
3
- import c from 'clsx';
3
+ import clsx from 'clsx';
4
4
  import { mergeIds } from './useId.js';
5
5
 
6
6
  // taken from: https://stackoverflow.com/questions/51603250/typescript-3-parameter-list-intersection-type/51604379#51604379
@@ -32,7 +32,7 @@ function mergeProps() {
32
32
 
33
33
  // Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check
34
34
  } else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') {
35
- result[key] = c(a, b);
35
+ result[key] = clsx(a, b);
36
36
  } else if (key === 'id' && a && b) {
37
37
  result.id = mergeIds(a, b);
38
38
  // Override others