@sanity/ui 4.0.3 → 4.0.5

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 (66) hide show
  1. package/dist/{arrow-CHE8-_G7.js → arrow-BaqZdFUX.js} +5 -5
  2. package/dist/arrow-BaqZdFUX.js.map +1 -0
  3. package/dist/autocomplete.js +8 -8
  4. package/dist/autocomplete.js.map +1 -1
  5. package/dist/breadcrumbs.js +8 -8
  6. package/dist/breadcrumbs.js.map +1 -1
  7. package/dist/{button-D6Z-yLlP.js → button-DpAiERt1.js} +7 -7
  8. package/dist/button-DpAiERt1.js.map +1 -0
  9. package/dist/code.js +3 -3
  10. package/dist/code.js.map +1 -1
  11. package/dist/{codeFontStyle-DYUujk7K.js → codeFontStyle-aWvllgWi.js} +2 -2
  12. package/dist/codeFontStyle-aWvllgWi.js.map +1 -0
  13. package/dist/element-BYgCE_iK.js.map +1 -1
  14. package/dist/factory-BA3gEfyI.js.map +1 -1
  15. package/dist/{flex-C-5JHi1C.js → flex-C6SsHFy8.js} +4 -4
  16. package/dist/flex-C6SsHFy8.js.map +1 -0
  17. package/dist/getElementRef-5HZQ-Owu.js.map +1 -1
  18. package/dist/getScopedTheme-C-sZsyAz.js.map +1 -1
  19. package/dist/getTheme_v2-y09KqtEb.js.map +1 -1
  20. package/dist/{grid-BXHFJhf_.js → grid-3kBnMOwF.js} +4 -4
  21. package/dist/grid-3kBnMOwF.js.map +1 -0
  22. package/dist/{helpers-bwfx1e-Y.js → helpers-JV5y3U_M.js} +21 -7
  23. package/dist/helpers-JV5y3U_M.js.map +1 -0
  24. package/dist/{hotkeys-Bvex-n5O.js → hotkeys-BYRfM-HW.js} +11 -11
  25. package/dist/hotkeys-BYRfM-HW.js.map +1 -0
  26. package/dist/index.js +61 -61
  27. package/dist/index.js.map +1 -1
  28. package/dist/{layer-B98ynOf2.js → layer-DsScTlqC.js} +4 -4
  29. package/dist/layer-DsScTlqC.js.map +1 -0
  30. package/dist/menu.js +10 -10
  31. package/dist/menu.js.map +1 -1
  32. package/dist/{popover-PorX5Jv9.js → popover-C2DFbwZu.js} +43 -41
  33. package/dist/popover-C2DFbwZu.js.map +1 -0
  34. package/dist/popover.js +1 -1
  35. package/dist/refractor-CC48DwHi.js.map +1 -1
  36. package/dist/{responsiveFont-hN1mZFjm.js → responsiveFont-BwYElGq4.js} +2 -2
  37. package/dist/responsiveFont-BwYElGq4.js.map +1 -0
  38. package/dist/{stack-C2HKTF-l.js → stack-wyPeapSx.js} +6 -6
  39. package/dist/stack-wyPeapSx.js.map +1 -0
  40. package/dist/{textInput-VH0sQqrm.js → textInput-DW447nYT.js} +15 -15
  41. package/dist/textInput-DW447nYT.js.map +1 -0
  42. package/dist/theme.js.map +1 -1
  43. package/dist/toast.js +11 -11
  44. package/dist/toast.js.map +1 -1
  45. package/dist/tooltip.js +6 -6
  46. package/dist/tooltip.js.map +1 -1
  47. package/dist/{useClickOutsideEvent-lEVhDFCQ.js → useClickOutsideEvent-DbLUuPQ6.js} +2 -2
  48. package/dist/useClickOutsideEvent-DbLUuPQ6.js.map +1 -0
  49. package/dist/useElementSize-BJvbGHq8.js.map +1 -1
  50. package/dist/{useLayer-BAVfmbNN.js → useLayer-Dhme0dcp.js} +12 -12
  51. package/dist/useLayer-Dhme0dcp.js.map +1 -0
  52. package/package.json +6 -6
  53. package/dist/arrow-CHE8-_G7.js.map +0 -1
  54. package/dist/button-D6Z-yLlP.js.map +0 -1
  55. package/dist/codeFontStyle-DYUujk7K.js.map +0 -1
  56. package/dist/flex-C-5JHi1C.js.map +0 -1
  57. package/dist/grid-BXHFJhf_.js.map +0 -1
  58. package/dist/helpers-bwfx1e-Y.js.map +0 -1
  59. package/dist/hotkeys-Bvex-n5O.js.map +0 -1
  60. package/dist/layer-B98ynOf2.js.map +0 -1
  61. package/dist/popover-PorX5Jv9.js.map +0 -1
  62. package/dist/responsiveFont-hN1mZFjm.js.map +0 -1
  63. package/dist/stack-C2HKTF-l.js.map +0 -1
  64. package/dist/textInput-VH0sQqrm.js.map +0 -1
  65. package/dist/useClickOutsideEvent-lEVhDFCQ.js.map +0 -1
  66. package/dist/useLayer-BAVfmbNN.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textInput-DW447nYT.js","names":["() => {\n ref.current?.setCustomValidity(customValidity || '')\n }","[customValidity, ref]","ref.current?.setCustomValidity","border = true","disabled = false","fontSizeProp = 2","gap = 3","paddingProp = 3","radiusProp = 2","type = 'text'","_getArrayProp(fontSizeProp)","_getArrayProp(paddingProp)","_getArrayProp(radiusProp)","_getArrayProp(gap)","() => ref.current","useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n event.stopPropagation()\n }, [])","(event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (onClear) onClear()\n\n // Focus the input, in case focus has been lost when clicking the clear button\n ref.current?.focus()\n }","useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (onClear) onClear()\n\n // Focus the input, in case focus has been lost when clicking the clear button\n ref.current?.focus()\n },\n [onClear, ref],\n )","prefix && (\n <Prefix borderTop borderLeft borderBottom radius={radius} sizing=\"border\" tone=\"inherit\">\n <span>{prefix}</span>\n </Prefix>\n )","useMemo(\n () =>\n prefix && (\n <Prefix borderTop borderLeft borderBottom radius={radius} sizing=\"border\" tone=\"inherit\">\n <span>{prefix}</span>\n </Prefix>\n ),\n [prefix, radius],\n )","IconComponent && (\n <LeftBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </LeftBox>\n )","!$hasClearButton && IconRightComponent && (\n <RightBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </RightBox>\n )","<Presentation\n $hasPrefix={$hasPrefix}\n $unstableDisableFocusRing={__unstable_disableFocusRing}\n $hasSuffix={$hasSuffix}\n $radius={radius}\n $scheme={rootTheme.scheme}\n $tone={rootTheme.tone}\n data-border={border ? '' : undefined}\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n >\n {IconComponent && (\n <LeftBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </LeftBox>\n )}\n\n {!$hasClearButton && IconRightComponent && (\n <RightBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </RightBox>\n )}\n </Presentation>","scheme","tone","border ? '' : undefined","useMemo(\n () => (\n <Presentation\n $hasPrefix={$hasPrefix}\n $unstableDisableFocusRing={__unstable_disableFocusRing}\n $hasSuffix={$hasSuffix}\n $radius={radius}\n $scheme={rootTheme.scheme}\n $tone={rootTheme.tone}\n data-border={border ? '' : undefined}\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n >\n {IconComponent && (\n <LeftBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </LeftBox>\n )}\n\n {!$hasClearButton && IconRightComponent && (\n <RightBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </RightBox>\n )}\n </Presentation>\n ),\n [\n __unstable_disableFocusRing,\n border,\n fontSize,\n IconComponent,\n IconRightComponent,\n padding,\n radius,\n rootTheme,\n $hasClearButton,\n $hasPrefix,\n $hasSuffix,\n ],\n )","padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 1\n if (v === 2) return 1\n\n return v - 2\n })","(v) => {\n if (v === 0) return 0\n if (v === 1) return 1\n if (v === 2) return 1\n\n return v - 2\n }","useMemo(\n () =>\n padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 1\n if (v === 2) return 1\n\n return v - 2\n }),\n [padding],\n )","padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 0\n if (v === 2) return 1\n\n return v - 1\n })","(v) => {\n if (v === 0) return 0\n if (v === 1) return 0\n if (v === 2) return 1\n\n return v - 1\n }","useMemo(\n () =>\n padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 0\n if (v === 2) return 1\n\n return v - 1\n }),\n [padding],\n )","!disabled &&\n !readOnly &&\n clearButton && (\n <RightCard\n forwardedAs=\"span\"\n padding={clearButtonBoxPadding}\n style={CLEAR_BUTTON_BOX_STYLE}\n tone={customValidity ? 'critical' : 'inherit'}\n >\n <TextInputClearButton\n aria-label=\"Clear\"\n data-qa=\"clear-button\"\n fontSize={fontSize}\n icon={CloseIcon}\n mode=\"bleed\"\n padding={clearButtonPadding}\n radius={radius}\n {...clearButtonProps}\n onClick={handleClearClick}\n onMouseDown={handleClearMouseDown}\n />\n </RightCard>\n )","useMemo(\n () =>\n !disabled &&\n !readOnly &&\n clearButton && (\n <RightCard\n forwardedAs=\"span\"\n padding={clearButtonBoxPadding}\n style={CLEAR_BUTTON_BOX_STYLE}\n tone={customValidity ? 'critical' : 'inherit'}\n >\n <TextInputClearButton\n aria-label=\"Clear\"\n data-qa=\"clear-button\"\n fontSize={fontSize}\n icon={CloseIcon}\n mode=\"bleed\"\n padding={clearButtonPadding}\n radius={radius}\n {...clearButtonProps}\n onClick={handleClearClick}\n onMouseDown={handleClearMouseDown}\n />\n </RightCard>\n ),\n [\n clearButton,\n clearButtonBoxPadding,\n clearButtonPadding,\n clearButtonProps,\n customValidity,\n disabled,\n fontSize,\n handleClearClick,\n handleClearMouseDown,\n radius,\n readOnly,\n ],\n )","suffix && (\n <Suffix borderTop borderRight borderBottom radius={radius} sizing=\"border\" tone=\"inherit\">\n <span>{suffix}</span>\n </Suffix>\n )","useMemo(\n () =>\n suffix && (\n <Suffix borderTop borderRight borderBottom radius={radius} sizing=\"border\" tone=\"inherit\">\n <span>{suffix}</span>\n </Suffix>\n ),\n [radius, suffix],\n )","<Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n {...restProps}\n $fontSize={fontSize}\n $iconLeft={$hasIcon}\n $iconRight={$hasIconRight || $hasClearButton}\n $padding={padding}\n $scheme={rootTheme.scheme}\n $space={space}\n $tone={rootTheme.tone}\n $weight={weight}\n disabled={disabled}\n readOnly={readOnly}\n ref={ref}\n type={type}\n />","$hasIconRight || $hasClearButton","<InputRoot>\n <Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n {...restProps}\n $fontSize={fontSize}\n $iconLeft={$hasIcon}\n $iconRight={$hasIconRight || $hasClearButton}\n $padding={padding}\n $scheme={rootTheme.scheme}\n $space={space}\n $tone={rootTheme.tone}\n $weight={weight}\n disabled={disabled}\n readOnly={readOnly}\n ref={ref}\n type={type}\n />\n\n {presentationNode}\n {clearButtonNode}\n </InputRoot>","<StyledTextInput data-ui=\"TextInput\" tone={rootTheme.tone}>\n {prefixNode}\n\n <InputRoot>\n <Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n {...restProps}\n $fontSize={fontSize}\n $iconLeft={$hasIcon}\n $iconRight={$hasIconRight || $hasClearButton}\n $padding={padding}\n $scheme={rootTheme.scheme}\n $space={space}\n $tone={rootTheme.tone}\n $weight={weight}\n disabled={disabled}\n readOnly={readOnly}\n ref={ref}\n type={type}\n />\n\n {presentationNode}\n {clearButtonNode}\n </InputRoot>\n\n {suffixNode}\n </StyledTextInput>","v"],"sources":["../src/core/helpers/animation.ts","../src/core/helpers/focus.ts","../src/core/hooks/useCustomValidity.ts","../src/core/styles/input/responsiveInputPaddingStyle.ts","../src/core/styles/input/textInputStyle.ts","../src/core/primitives/textInput/textInput.tsx"],"sourcesContent":["/**\n * @internal\n */\nexport function _raf(fn: () => void): () => void {\n const frameId = requestAnimationFrame(fn)\n\n return () => {\n cancelAnimationFrame(frameId)\n }\n}\n\n/**\n * @internal\n */\nexport function _raf2(fn: () => void): () => void {\n let innerDispose: (() => void) | null = null\n\n const outerDispose = _raf(() => {\n innerDispose = _raf(fn)\n })\n\n return () => {\n if (innerDispose) innerDispose()\n\n outerDispose()\n }\n}\n","import {\n isHTMLAnchorElement,\n isHTMLButtonElement,\n isHTMLElement,\n isHTMLInputElement,\n isHTMLSelectElement,\n isHTMLTextAreaElement,\n} from './element'\n\n// export const globalFocusState = {\n// IgnoreUtilFocusChanges: false,\n// }\n\n/**\n * @internal\n */\nexport function _hasFocus(element: HTMLElement): boolean {\n return Boolean(document.activeElement) && element.contains(document.activeElement)\n}\n\n/**\n * @internal\n */\nexport function isFocusable(element: HTMLElement): boolean {\n if (\n element.tabIndex > 0 ||\n (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)\n ) {\n return true\n }\n\n if (isHTMLAnchorElement(element)) {\n return Boolean(element.href) && element.rel !== 'ignore'\n }\n\n if (isHTMLInputElement(element)) {\n return element.type !== 'hidden' && element.type !== 'file' && !element.disabled\n }\n\n if (\n isHTMLButtonElement(element) ||\n isHTMLSelectElement(element) ||\n isHTMLTextAreaElement(element)\n ) {\n return !element.disabled\n }\n\n return false\n}\n\n/**\n * @internal\n */\nexport function attemptFocus(element: HTMLElement): boolean {\n if (!isFocusable(element)) {\n return false\n }\n\n // globalFocusState.IgnoreUtilFocusChanges = true\n\n try {\n element.focus()\n } catch {\n // ignore\n }\n\n // globalFocusState.IgnoreUtilFocusChanges = false\n\n return document.activeElement === element\n}\n\n/**\n * @internal\n */\nexport function focusFirstDescendant(element: HTMLElement): boolean {\n for (let i = 0; i < element.childNodes.length; i++) {\n const child = element.childNodes[i]\n\n if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child))) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * @internal\n */\nexport function focusLastDescendant(element: HTMLElement): boolean {\n for (let i = element.childNodes.length - 1; i >= 0; i--) {\n const child = element.childNodes[i]\n\n if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child))) {\n return true\n }\n }\n\n return false\n}\n","import {useEffect} from 'react'\n\n/**\n * @beta\n */\nexport function useCustomValidity(\n ref: {current: null | {setCustomValidity: (validity: string) => void}},\n customValidity: string | undefined,\n): void {\n useEffect(() => {\n ref.current?.setCustomValidity(customValidity || '')\n }, [customValidity, ref])\n}\n","import {CSSObject} from '../../../theme/system/css'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {_responsive, rem} from '../helpers'\nimport {ThemeProps} from '../types'\n\nexport interface TextInputResponsivePaddingStyleProps {\n $fontSize: number[]\n $iconLeft?: boolean\n $iconRight?: boolean\n $padding: number[]\n $space: number[]\n}\n\nexport function responsiveInputPaddingStyle(\n props: TextInputResponsivePaddingStyleProps & ThemeProps,\n): CSSObject[] {\n const {$fontSize, $iconLeft, $iconRight, $padding, $space} = props\n const {font, media, space} = getTheme_v2(props.theme)\n const len = Math.max($padding.length, $space.length, $fontSize.length)\n const _padding: number[] = []\n const _space: number[] = []\n const _fontSize: number[] = []\n\n for (let i = 0; i < len; i += 1) {\n _fontSize[i] = $fontSize[i] === undefined ? _fontSize[i - 1] : $fontSize[i]\n _padding[i] = $padding[i] === undefined ? _padding[i - 1] : $padding[i]\n _space[i] = $space[i] === undefined ? _space[i - 1] : $space[i]\n }\n\n return _responsive(media, _padding, (_, i) => {\n const size = font.text.sizes[_fontSize[i]] || font.text.sizes[2]\n const emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight\n const p = space[_padding[i]]\n const s = space[_space[i]]\n\n const styles = {\n paddingTop: rem(p - size.ascenderHeight),\n paddingRight: rem(p),\n paddingBottom: rem(p - size.descenderHeight),\n paddingLeft: rem(p),\n }\n\n if ($iconRight) styles.paddingRight = rem(p + emSize + s)\n if ($iconLeft) styles.paddingLeft = rem(p + emSize + s)\n\n return styles\n })\n}\n\nexport function responsiveInputPaddingIconRightStyle(\n props: {\n $fontSize: number[]\n $padding: number[]\n $space: number[]\n } & ThemeProps,\n): CSSObject[] {\n return responsiveInputPaddingStyle({...props, $iconRight: true})\n}\n","import {css} from 'styled-components'\n\nimport {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {CSSObject} from '../../../theme/system/css'\nimport {ThemeFontWeightKey} from '../../../theme/system/font'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {CardTone} from '../../types/card'\nimport {focusRingBorderStyle, focusRingStyle} from '../focusRing'\nimport {_responsive, rem} from '../helpers'\nimport {ThemeProps} from '../types'\n\n/**\n * @internal\n */\nexport interface TextInputInputStyleProps {\n $fontSize: number[]\n $scheme: ThemeColorSchemeKey\n $tone: CardTone\n $weight?: ThemeFontWeightKey\n}\n\n/**\n * @internal\n */\nexport interface TextInputRepresentationStyleProps {\n $hasPrefix?: boolean\n $hasSuffix?: boolean\n $scheme: ThemeColorSchemeKey\n $tone: CardTone\n $unstableDisableFocusRing?: boolean\n}\n\nconst ROOT_STYLE = css`\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n`\n\nexport function textInputRootStyle(): ReturnType<typeof css> {\n return ROOT_STYLE\n}\n\nexport function textInputBaseStyle(\n props: TextInputInputStyleProps & ThemeProps,\n): ReturnType<typeof css> {\n const {$scheme, $tone, $weight} = props\n const {color, font} = getTheme_v2(props.theme)\n\n return css`\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ${font.text.family};\n font-weight: ${($weight && font.text.weights[$weight]) || font.text.weights.regular};\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome’s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='${$scheme}'][data-tone='${$tone}'] {\n --input-fg-color: ${color.input.default.enabled.fg};\n --input-placeholder-color: ${color.input.default.enabled.placeholder};\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ${color.input.default.enabled.fg};\n --input-placeholder-color: ${color.input.default.enabled.placeholder};\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ${color.input.default.disabled.fg};\n --input-placeholder-color: ${color.input.default.disabled.placeholder};\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ${color.input.invalid.enabled.fg};\n --input-placeholder-color: ${color.input.invalid.enabled.placeholder};\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ${color.input.default.readOnly.fg};\n --input-placeholder-color: ${color.input.default.readOnly.placeholder};\n }\n }\n `\n}\n\nexport function textInputFontSizeStyle(props: TextInputInputStyleProps & ThemeProps): CSSObject[] {\n const {font, media} = getTheme_v2(props.theme)\n\n return _responsive(media, props.$fontSize, (sizeIndex) => {\n const size = font.text.sizes[sizeIndex] || font.text.sizes[2]\n\n return {\n fontSize: rem(size.fontSize),\n lineHeight: `${size.lineHeight / size.fontSize}`,\n }\n })\n}\n\nexport function textInputRepresentationStyle(\n props: TextInputRepresentationStyleProps & ThemeProps,\n): ReturnType<typeof css> {\n const {$hasPrefix, $hasSuffix, $scheme, $tone, $unstableDisableFocusRing} = props\n const {color, input} = getTheme_v2(props.theme)\n\n return css`\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ${$hasPrefix ? 0 : undefined};\n border-bottom-left-radius: ${$hasPrefix ? 0 : undefined};\n border-top-right-radius: ${$hasSuffix ? 0 : undefined};\n border-bottom-right-radius: ${$hasSuffix ? 0 : undefined};\n\n &[data-scheme='${$scheme}'][data-tone='${$tone}'] {\n --card-bg-color: ${color.input.default.enabled.bg};\n --card-fg-color: ${color.input.default.enabled.fg};\n\n /* enabled */\n *:not(:disabled) + &[data-border] {\n --input-box-shadow: ${focusRingBorderStyle({\n color: color.input.default.enabled.border,\n width: input.border.width,\n })};\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ${color.input.invalid.enabled.bg};\n --card-fg-color: ${color.input.invalid.enabled.fg};\n\n &[data-border] {\n --input-box-shadow: ${focusRingBorderStyle({\n color: color.input.invalid.enabled.border,\n width: input.border.width,\n })};\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ${\n $unstableDisableFocusRing\n ? undefined\n : focusRingStyle({\n border: {color: color.input.default.enabled.border, width: input.border.width},\n focusRing: input.text.focusRing,\n })\n };\n }\n\n &:not([data-border]) {\n --input-box-shadow: ${\n $unstableDisableFocusRing\n ? undefined\n : focusRingStyle({focusRing: input.text.focusRing})\n };\n }\n }\n\n /* disabled */\n *:not(:invalid):disabled + & {\n --card-bg-color: ${color.input.default.disabled.bg} !important;\n --card-fg-color: ${color.input.default.disabled.fg} !important;\n --card-icon-color: ${color.input.default.disabled.fg} !important;\n\n &[data-border] {\n --input-box-shadow: ${focusRingBorderStyle({\n color: color.input.default.disabled.border,\n width: input.border.width,\n })};\n }\n }\n\n *:invalid:disabled + & {\n --card-bg-color: ${color.input.invalid.disabled.bg} !important;\n --card-fg-color: ${color.input.invalid.disabled.fg} !important;\n --card-icon-color: ${color.input.invalid.disabled.fg} !important;\n\n &[data-border] {\n --input-box-shadow: ${focusRingBorderStyle({\n color: color.input.invalid.disabled.border,\n width: input.border.width,\n })};\n }\n }\n\n /* readOnly */\n *:not(:invalid):read-only + & {\n --card-bg-color: ${color.input.default.readOnly.bg} !important;\n --card-fg-color: ${color.input.default.readOnly.fg} !important;\n }\n\n *:invalid:read-only + & {\n --card-bg-color: ${color.input.invalid.readOnly.bg} !important;\n --card-fg-color: ${color.input.invalid.readOnly.fg} !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ${color.input.default.hovered.bg};\n --card-fg-color: ${color.input.default.hovered.fg};\n }\n\n *:invalid:not(:disabled):not(:read-only):hover + & {\n --card-bg-color: ${color.input.invalid.hovered.bg};\n --card-fg-color: ${color.input.invalid.hovered.fg};\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ${focusRingBorderStyle({\n color: color.input.default.hovered.border,\n width: input.border.width,\n })};\n }\n\n *:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border] {\n --input-box-shadow: ${focusRingBorderStyle({\n color: color.input.invalid.hovered.border,\n width: input.border.width,\n })};\n }\n }\n }\n `\n}\n","import {CloseIcon} from '@sanity/icons/Close'\nimport {isValidElement, useCallback, useImperativeHandle, useMemo, useRef} from 'react'\nimport {isValidElementType} from 'react-is'\nimport {styled} from 'styled-components'\n\nimport {ThemeFontWeightKey} from '../../../theme/system/font'\nimport {EMPTY_RECORD} from '../../constants'\nimport {useCustomValidity} from '../../hooks/useCustomValidity'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {\n responsiveInputPaddingStyle,\n TextInputResponsivePaddingStyleProps,\n} from '../../styles/input/responsiveInputPaddingStyle'\nimport {\n textInputBaseStyle,\n textInputFontSizeStyle,\n TextInputInputStyleProps,\n textInputRepresentationStyle,\n TextInputRepresentationStyleProps,\n textInputRootStyle,\n} from '../../styles/input/textInputStyle'\nimport {responsiveRadiusStyle} from '../../styles/radius/radiusStyle'\nimport {ResponsiveRadiusStyleProps} from '../../styles/radius/types'\nimport {useRootTheme} from '../../theme/useRootTheme'\nimport {Radius} from '../../types/radius'\nimport {Box} from '../box/box'\nimport {Button, ButtonOwnProps} from '../button/button'\nimport {Card} from '../card/card'\nimport {Text} from '../text/text'\n\n/**\n * @public\n */\nexport type TextInputClearButtonProps = ButtonOwnProps &\n Omit<React.HTMLProps<HTMLButtonElement>, 'as' | 'onClick' | 'onMouseDown' | 'ref'>\n\n/**\n * @public\n */\nexport type TextInputType =\n | 'search'\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'url'\n | 'month'\n | 'number'\n | 'password'\n | 'tel'\n | 'time'\n | 'text'\n | 'week'\n | 'color'\n\n/**\n * @public\n */\nexport interface TextInputProps {\n /**\n * @beta\n */\n __unstable_disableFocusRing?: boolean\n border?: boolean\n /**\n * @beta\n */\n clearButton?: boolean | TextInputClearButtonProps\n customValidity?: string\n fontSize?: number | number[]\n // oxlint-disable-next-line no-redundant-type-constituents\n icon?: React.ElementType | React.ReactNode\n // oxlint-disable-next-line no-redundant-type-constituents\n iconRight?: React.ElementType | React.ReactNode\n /**\n * @beta\n */\n onClear?: () => void\n padding?: number | number[]\n prefix?: React.ReactNode\n radius?: Radius | Radius[]\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n gap?: number | number[]\n suffix?: React.ReactNode\n type?: TextInputType\n weight?: ThemeFontWeightKey\n}\n\nconst CLEAR_BUTTON_BOX_STYLE: React.CSSProperties = {zIndex: 2}\n\nconst StyledTextInput = styled(Card).attrs({forwardedAs: 'span'})(textInputRootStyle)\n\nconst InputRoot = styled.span`\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n`\n\nconst Prefix = styled(Card).attrs({forwardedAs: 'span'})`\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n`\n\nconst Suffix = styled(Card).attrs({forwardedAs: 'span'})`\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n`\n\nconst Input = styled.input<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>(\n responsiveInputPaddingStyle,\n textInputBaseStyle,\n textInputFontSizeStyle,\n)\n\nconst Presentation = styled.span<ResponsiveRadiusStyleProps & TextInputRepresentationStyleProps>(\n responsiveRadiusStyle,\n textInputRepresentationStyle,\n)\n\nconst LeftBox = styled(Box)`\n position: absolute;\n top: 0;\n left: 0;\n`\n\nconst RightBox = styled(Box)`\n position: absolute;\n top: 0;\n right: 0;\n`\n\nconst RightCard = styled(Card)`\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n`\n\nconst TextInputClearButton = styled(Button)({\n '&:not([hidden])': {\n display: 'block',\n },\n})\n\n/**\n * Single line text input.\n *\n * @public\n */\nexport function TextInput(\n props: TextInputProps & Omit<React.HTMLProps<HTMLInputElement>, 'as' | 'prefix' | 'type'>,\n) {\n const {\n __unstable_disableFocusRing,\n border = true,\n clearButton,\n disabled = false,\n fontSize: fontSizeProp = 2,\n gap = 3,\n icon: IconComponent,\n iconRight: IconRightComponent,\n onClear,\n padding: paddingProp = 3,\n prefix,\n radius: radiusProp = 2,\n readOnly,\n ref: forwardedRef,\n suffix,\n customValidity,\n type = 'text',\n weight,\n ...restProps\n } = props\n const ref = useRef<HTMLInputElement | null>(null)\n\n const rootTheme = useRootTheme()\n\n const fontSize = _getArrayProp(fontSizeProp)\n const padding = _getArrayProp(paddingProp)\n const radius = _getArrayProp(radiusProp)\n const space = _getArrayProp(gap)\n\n // Transient properties\n const $hasClearButton = Boolean(clearButton)\n const $hasIcon = Boolean(IconComponent)\n const $hasIconRight = Boolean(IconRightComponent)\n const $hasSuffix = Boolean(suffix)\n const $hasPrefix = Boolean(prefix)\n\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(\n forwardedRef,\n () => ref.current,\n )\n\n useCustomValidity(ref, customValidity)\n\n // Prevent the clear button from taking the focus away from the input\n const handleClearMouseDown = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n event.stopPropagation()\n }, [])\n\n const handleClearClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (onClear) onClear()\n\n // Focus the input, in case focus has been lost when clicking the clear button\n ref.current?.focus()\n },\n [onClear, ref],\n )\n\n // Render prefix (memoized)\n const prefixNode = useMemo(\n () =>\n prefix && (\n <Prefix borderTop borderLeft borderBottom radius={radius} sizing=\"border\" tone=\"inherit\">\n <span>{prefix}</span>\n </Prefix>\n ),\n [prefix, radius],\n )\n\n // Render presentation (memoized)\n const presentationNode = useMemo(\n () => (\n <Presentation\n $hasPrefix={$hasPrefix}\n $unstableDisableFocusRing={__unstable_disableFocusRing}\n $hasSuffix={$hasSuffix}\n $radius={radius}\n $scheme={rootTheme.scheme}\n $tone={rootTheme.tone}\n data-border={border ? '' : undefined}\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n >\n {IconComponent && (\n <LeftBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </LeftBox>\n )}\n\n {!$hasClearButton && IconRightComponent && (\n <RightBox padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </RightBox>\n )}\n </Presentation>\n ),\n [\n __unstable_disableFocusRing,\n border,\n fontSize,\n IconComponent,\n IconRightComponent,\n padding,\n radius,\n rootTheme,\n $hasClearButton,\n $hasPrefix,\n $hasSuffix,\n ],\n )\n\n // Render clear button (memoized)\n const clearButtonBoxPadding = useMemo(\n () =>\n padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 1\n if (v === 2) return 1\n\n return v - 2\n }),\n [padding],\n )\n const clearButtonPadding = useMemo(\n () =>\n padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 0\n if (v === 2) return 1\n\n return v - 1\n }),\n [padding],\n )\n const clearButtonProps: TextInputClearButtonProps = useMemo(\n () => (typeof clearButton === 'object' ? clearButton : EMPTY_RECORD),\n [clearButton],\n )\n const clearButtonNode = useMemo(\n () =>\n !disabled &&\n !readOnly &&\n clearButton && (\n <RightCard\n forwardedAs=\"span\"\n padding={clearButtonBoxPadding}\n style={CLEAR_BUTTON_BOX_STYLE}\n tone={customValidity ? 'critical' : 'inherit'}\n >\n <TextInputClearButton\n aria-label=\"Clear\"\n data-qa=\"clear-button\"\n fontSize={fontSize}\n icon={CloseIcon}\n mode=\"bleed\"\n padding={clearButtonPadding}\n radius={radius}\n {...clearButtonProps}\n onClick={handleClearClick}\n onMouseDown={handleClearMouseDown}\n />\n </RightCard>\n ),\n [\n clearButton,\n clearButtonBoxPadding,\n clearButtonPadding,\n clearButtonProps,\n customValidity,\n disabled,\n fontSize,\n handleClearClick,\n handleClearMouseDown,\n radius,\n readOnly,\n ],\n )\n\n // Render suffix (memoized)\n const suffixNode = useMemo(\n () =>\n suffix && (\n <Suffix borderTop borderRight borderBottom radius={radius} sizing=\"border\" tone=\"inherit\">\n <span>{suffix}</span>\n </Suffix>\n ),\n [radius, suffix],\n )\n\n return (\n <StyledTextInput data-ui=\"TextInput\" tone={rootTheme.tone}>\n {prefixNode}\n\n <InputRoot>\n <Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n {...restProps}\n $fontSize={fontSize}\n $iconLeft={$hasIcon}\n $iconRight={$hasIconRight || $hasClearButton}\n $padding={padding}\n $scheme={rootTheme.scheme}\n $space={space}\n $tone={rootTheme.tone}\n $weight={weight}\n disabled={disabled}\n readOnly={readOnly}\n ref={ref}\n type={type}\n />\n\n {presentationNode}\n {clearButtonNode}\n </InputRoot>\n\n {suffixNode}\n </StyledTextInput>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,SAAgB,KAAK,IAA4B;CAC/C,IAAM,UAAU,sBAAsB,EAAE;CAExC,aAAa;EACX,qBAAqB,OAAO;CAC9B;AACF;;;;AAKA,SAAgB,MAAM,IAA4B;CAChD,IAAI,eAAoC,MAElC,eAAe,WAAW;EAC9B,eAAe,KAAK,EA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AA,CAAA,GADR,EAAA,MAAA,iBADA,EAAA,MAAA,kBAnBDA,EAAAA,MAAAA;CAJJG,IAAAA;CADF,OAEK,EAAA,QAAA,cAAA,EAAA,QADkDhB,UAAAA,QAAAA,EAAAA,QA2BlD,cAAA,EAAA,QAxBDe,OAHF,MAAA,qBAAC,iBAAD;EAAiB,WAAQ;EAAY,MAAM,UAAU;EAArD,UAAA;GACG;GAEDA;GAwBC;EACc;KA3Bd,EAAA,MAAA,YADkDf,EAAAA,MAAAA,UAAAA,MA2BlD,EAAA,MAAA,YAxBDe,EAAAA,MAAAA,iCAHFC;AA8BJ;AA/FkB,SAAA,OAAC,KAAM;CAKjB,OAJIC,QAAM,KACNA,QAAM,IAAU,IAChBA,QAAM,IAAU,IAEbA,MAAI;AACb;AAjBY,SAAA,OAAC,GAAM;CAKjB,OAJI,MAAM,IAAU,IAChB,MAAM,KACN,MAAM,IAAU,IAEb,IAAI;AACb;AAtFqC,SAAA,MAAC,OAA+C;CAEvF,AADA,MAAM,eAAe,GACrB,MAAM,gBAAgB;AACxB"}
package/dist/theme.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","names":["parseColor","RGB","RGBA","getContrastRatio","bg","fg","rgb1","rgb2","c1","rgb_lrgb","c2","l1","lrgb_luminance","l2","Math","max","min","r","g","b","rgb_lrgb1","v","isColorButtonMode","isColorConfigBaseKey","isColorConfigBaseTone","isColorConfigBlendKey","isColorConfigStateKey","isColorConfigStateTone","TokenKeyNode","parseTokenKey","str","segments","split","segment0","shift","key","join","type","tone","segment1","segment2","mode","undefined","RootTheme","RootTheme_v2","is_v0","themeProp","_version"],"sources":["../src/theme/build/lib/color-fns/contrastRatio.ts","../src/theme/config/tokens/parseTokenKey.ts","../src/theme/versioning/is_v0.ts"],"sourcesContent":["import {parseColor} from './parse'\nimport {RGB, RGBA} from './types'\n\n/** @internal */\nexport function getContrastRatio(bg: string, fg: string): number {\n const rgb1 = parseColor(bg) // bg: RGB | RGBA, fg: RGB | RGBA\n const rgb2 = parseColor(fg)\n\n // convert the two colors from sRGB to linear-light RGB\n const c1 = rgb_lrgb(rgb1)\n const c2 = rgb_lrgb(rgb2)\n\n // compute the relative luminances\n const l1 = lrgb_luminance(c1)\n const l2 = lrgb_luminance(c2)\n\n // compute the contrast ratio\n return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05)\n}\n\nfunction rgb_lrgb({r, g, b}: RGB | RGBA): [number, number, number] {\n return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)]\n}\n\nfunction rgb_lrgb1(v: number) {\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4\n}\n\nfunction lrgb_luminance([r, g, b]: [number, number, number]) {\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n","import {isColorButtonMode} from '../../system/color/_helpers'\nimport {\n isColorConfigBaseKey,\n isColorConfigBaseTone,\n isColorConfigBlendKey,\n isColorConfigStateKey,\n isColorConfigStateTone,\n} from '../helpers'\nimport {TokenKeyNode} from './types'\n\n/** @internal */\nexport function parseTokenKey(str: string): TokenKeyNode | undefined {\n const segments = str.split('/')\n const segment0 = segments.shift() || ''\n\n if (isColorConfigBaseTone(segment0)) {\n const key = segments.join('/')\n\n if (isColorConfigBaseKey(key)) {\n return {\n type: 'base',\n tone: segment0,\n key,\n }\n }\n\n if (isColorConfigBlendKey(key)) {\n return {\n type: 'base',\n tone: segment0,\n key,\n }\n }\n }\n\n if (segment0 === 'button') {\n const segment1 = segments.shift() || ''\n\n if (isColorConfigStateTone(segment1)) {\n const segment2 = segments.shift() || ''\n\n if (isColorButtonMode(segment2)) {\n const key = segments.join('/')\n\n if (isColorConfigStateKey(key)) {\n return {\n type: 'button',\n tone: segment1,\n mode: segment2,\n key,\n }\n }\n\n if (isColorConfigBlendKey(key)) {\n return {\n type: 'button',\n tone: segment1,\n mode: segment2,\n key,\n }\n }\n }\n }\n }\n\n return undefined\n}\n","import {RootTheme, RootTheme_v2} from '../system/theme'\n\n/** @internal */\nexport function is_v0(themeProp: RootTheme | RootTheme_v2): themeProp is RootTheme {\n return themeProp._version === 0\n}\n"],"mappings":";;;;AAIA,SAAgBG,iBAAiBC,IAAYC,IAAoB;CAC/D,IAAMC,OAAON,WAAWI,EAAE,GACpBG,OAAOP,WAAWK,EAAE,GAGpBG,KAAKC,SAASH,IAAI,GAClBI,KAAKD,SAASF,IAAI,GAGlBI,KAAKC,eAAeJ,EAAE,GACtBK,KAAKD,eAAeF,EAAE;CAG5B,QAAQI,KAAKC,IAAIJ,IAAIE,EAAE,IAAI,QAASC,KAAKE,IAAIL,IAAIE,EAAE,IAAI;AACzD;AAEA,SAASJ,SAAS,EAACQ,GAAGC,GAAGC,KAA0C;CACjE,OAAO;EAACC,UAAUH,IAAI,GAAG;EAAGG,UAAUF,IAAI,GAAG;EAAGE,UAAUD,IAAI,GAAG;CAAC;AACpE;AAEA,SAASC,UAAUC,GAAW;CAC5B,OAAOA,KAAK,SAAUA,IAAI,UAAUA,IAAI,QAAS,UAAU;AAC7D;AAEA,SAAST,eAAe,CAACK,GAAGC,GAAGC,IAA8B;CAC3D,OAAO,QAASF,IAAI,QAASC,IAAI,QAASC;AAC5C;;ACnBA,SAAgBU,cAAcC,KAAuC;CACnE,IAAMC,WAAWD,IAAIE,MAAM,GAAG,GACxBC,WAAWF,SAASG,MAAM,KAAK;CAErC,IAAIV,sBAAsBS,QAAQ,GAAG;EACnC,IAAME,MAAMJ,SAASK,KAAK,GAAG;EAU7B,IARIb,qBAAqBY,GAAG,KAQxBV,sBAAsBU,GAAG,GAC3B,OAAO;GACLE,MAAM;GACNC,MAAML;GACNE;EACF;CAEJ;CAEA,IAAIF,aAAa,UAAU;EACzB,IAAMM,WAAWR,SAASG,MAAM,KAAK;EAErC,IAAIP,uBAAuBY,QAAQ,GAAG;GACpC,IAAMC,WAAWT,SAASG,MAAM,KAAK;GAErC,IAAIZ,kBAAkBkB,QAAQ,GAAG;IAC/B,IAAML,MAAMJ,SAASK,KAAK,GAAG;IAW7B,IATIV,sBAAsBS,GAAG,KASzBV,sBAAsBU,GAAG,GAC3B,OAAO;KACLE,MAAM;KACNC,MAAMC;KACNE,MAAMD;KACNL;IACF;GAEJ;EACF;CACF;AAGF;;AC/DA,SAAgBU,MAAMC,WAA6D;CACjF,OAAOA,UAAUC,aAAa;AAChC"}
1
+ {"version":3,"file":"theme.js","names":[],"sources":["../src/theme/build/lib/color-fns/contrastRatio.ts","../src/theme/config/tokens/parseTokenKey.ts","../src/theme/versioning/is_v0.ts"],"sourcesContent":["import {parseColor} from './parse'\nimport {RGB, RGBA} from './types'\n\n/** @internal */\nexport function getContrastRatio(bg: string, fg: string): number {\n const rgb1 = parseColor(bg) // bg: RGB | RGBA, fg: RGB | RGBA\n const rgb2 = parseColor(fg)\n\n // convert the two colors from sRGB to linear-light RGB\n const c1 = rgb_lrgb(rgb1)\n const c2 = rgb_lrgb(rgb2)\n\n // compute the relative luminances\n const l1 = lrgb_luminance(c1)\n const l2 = lrgb_luminance(c2)\n\n // compute the contrast ratio\n return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05)\n}\n\nfunction rgb_lrgb({r, g, b}: RGB | RGBA): [number, number, number] {\n return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)]\n}\n\nfunction rgb_lrgb1(v: number) {\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4\n}\n\nfunction lrgb_luminance([r, g, b]: [number, number, number]) {\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n","import {isColorButtonMode} from '../../system/color/_helpers'\nimport {\n isColorConfigBaseKey,\n isColorConfigBaseTone,\n isColorConfigBlendKey,\n isColorConfigStateKey,\n isColorConfigStateTone,\n} from '../helpers'\nimport {TokenKeyNode} from './types'\n\n/** @internal */\nexport function parseTokenKey(str: string): TokenKeyNode | undefined {\n const segments = str.split('/')\n const segment0 = segments.shift() || ''\n\n if (isColorConfigBaseTone(segment0)) {\n const key = segments.join('/')\n\n if (isColorConfigBaseKey(key)) {\n return {\n type: 'base',\n tone: segment0,\n key,\n }\n }\n\n if (isColorConfigBlendKey(key)) {\n return {\n type: 'base',\n tone: segment0,\n key,\n }\n }\n }\n\n if (segment0 === 'button') {\n const segment1 = segments.shift() || ''\n\n if (isColorConfigStateTone(segment1)) {\n const segment2 = segments.shift() || ''\n\n if (isColorButtonMode(segment2)) {\n const key = segments.join('/')\n\n if (isColorConfigStateKey(key)) {\n return {\n type: 'button',\n tone: segment1,\n mode: segment2,\n key,\n }\n }\n\n if (isColorConfigBlendKey(key)) {\n return {\n type: 'button',\n tone: segment1,\n mode: segment2,\n key,\n }\n }\n }\n }\n }\n\n return undefined\n}\n","import {RootTheme, RootTheme_v2} from '../system/theme'\n\n/** @internal */\nexport function is_v0(themeProp: RootTheme | RootTheme_v2): themeProp is RootTheme {\n return themeProp._version === 0\n}\n"],"mappings":";;;;AAIA,SAAgB,iBAAiB,IAAY,IAAoB;CAC/D,IAAM,OAAO,WAAW,EAAE,GACpB,OAAO,WAAW,EAAE,GAGpB,KAAK,SAAS,IAAI,GAClB,KAAK,SAAS,IAAI,GAGlB,KAAK,eAAe,EAAE,GACtB,KAAK,eAAe,EAAE;CAG5B,QAAQ,KAAK,IAAI,IAAI,EAAE,IAAI,QAAS,KAAK,IAAI,IAAI,EAAE,IAAI;AACzD;AAEA,SAAS,SAAS,EAAC,GAAG,GAAG,KAA0C;CACjE,OAAO;EAAC,UAAU,IAAI,GAAG;EAAG,UAAU,IAAI,GAAG;EAAG,UAAU,IAAI,GAAG;CAAC;AACpE;AAEA,SAAS,UAAU,GAAW;CAC5B,OAAO,KAAK,SAAU,IAAI,UAAU,IAAI,QAAS,UAAU;AAC7D;AAEA,SAAS,eAAe,CAAC,GAAG,GAAG,IAA8B;CAC3D,OAAO,QAAS,IAAI,QAAS,IAAI,QAAS;AAC5C;;ACnBA,SAAgB,cAAc,KAAuC;CACnE,IAAM,WAAW,IAAI,MAAM,GAAG,GACxB,WAAW,SAAS,MAAM,KAAK;CAErC,IAAI,sBAAsB,QAAQ,GAAG;EACnC,IAAM,MAAM,SAAS,KAAK,GAAG;EAU7B,IARI,qBAAqB,GAAG,KAQxB,sBAAsB,GAAG,GAC3B,OAAO;GACL,MAAM;GACN,MAAM;GACN;EACF;CAEJ;CAEA,IAAI,aAAa,UAAU;EACzB,IAAM,WAAW,SAAS,MAAM,KAAK;EAErC,IAAI,uBAAuB,QAAQ,GAAG;GACpC,IAAM,WAAW,SAAS,MAAM,KAAK;GAErC,IAAI,kBAAkB,QAAQ,GAAG;IAC/B,IAAM,MAAM,SAAS,KAAK,GAAG;IAW7B,IATI,sBAAsB,GAAG,KASzB,sBAAsB,GAAG,GAC3B,OAAO;KACL,MAAM;KACN,MAAM;KACN,MAAM;KACN;IACF;GAEJ;EACF;CACF;AAGF;;AC/DA,SAAgB,MAAM,WAA6D;CACjF,OAAO,UAAU,aAAa;AAChC"}
package/dist/toast.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { t as getTheme_v2 } from "./getTheme_v2-y09KqtEb.js";
3
- import { d as createGlobalScopedContext, i as usePrefersReducedMotion, n as LayerProvider, r as isRecord, s as Card, t as useLayer, y as Box } from "./useLayer-BAVfmbNN.js";
4
- import { t as Flex } from "./flex-C-5JHi1C.js";
5
- import { n as Text, t as Stack } from "./stack-C2HKTF-l.js";
6
- import { t as Button } from "./button-D6Z-yLlP.js";
7
- import { t as Grid } from "./grid-BXHFJhf_.js";
3
+ import { d as createGlobalScopedContext, i as usePrefersReducedMotion, n as LayerProvider, r as isRecord, s as Card, t as useLayer, y as Box } from "./useLayer-Dhme0dcp.js";
4
+ import { t as Flex } from "./flex-C6SsHFy8.js";
5
+ import { n as Text, t as Stack } from "./stack-wyPeapSx.js";
6
+ import { t as Button } from "./button-DpAiERt1.js";
7
+ import { t as Grid } from "./grid-3kBnMOwF.js";
8
8
  import { c } from "react/compiler-runtime";
9
9
  import { startTransition, useContext, useState, useSyncExternalStore } from "react";
10
10
  import { styled } from "styled-components";
@@ -23,19 +23,19 @@ const STATUS_CARD_TONE = {
23
23
  info: "neutral"
24
24
  }, TextBox = styled(Flex).withConfig({
25
25
  displayName: "TextBox",
26
- componentId: "sc-xd2ehd-0"
26
+ componentId: "sc-iyk5nq-0"
27
27
  })`overflow-x:auto;`, StyledToast = styled(Card).withConfig({
28
28
  displayName: "StyledToast",
29
- componentId: "sc-xd2ehd-1"
29
+ componentId: "sc-iyk5nq-1"
30
30
  })`pointer-events:all;width:100%;position:relative;overflow:hidden;overflow:clip;&[data-has-duration]{padding-bottom:calc(${2}px / 2);}`, LoadingBar = styled.div.withConfig({
31
31
  displayName: "LoadingBar",
32
- componentId: "sc-xd2ehd-2"
32
+ componentId: "sc-iyk5nq-2"
33
33
  })`display:flex;position:absolute;bottom:0px;top:0px;left:0px;right:0px;pointer-events:none;z-index:-1;overflow:hidden;overflow:clip;background:transparent;align-items:flex-end;will-change:opacity;`, LoadingBarMask = styled(Card).withConfig({
34
34
  displayName: "LoadingBarMask",
35
- componentId: "sc-xd2ehd-3"
35
+ componentId: "sc-iyk5nq-3"
36
36
  })`position:absolute;top:0;left:-${2}px;right:-${2}px;bottom:${2}px;z-index:1;`, LoadingBarProgress = styled(Card).withConfig({
37
37
  displayName: "LoadingBarProgress",
38
- componentId: "sc-xd2ehd-4"
38
+ componentId: "sc-iyk5nq-4"
39
39
  })`display:block;height:100%;width:100%;transform-origin:0% 50%;background-color:${(props) => {
40
40
  let { color } = getTheme_v2(props.theme);
41
41
  return color.button.default[props.tone].enabled.bg;
@@ -212,7 +212,7 @@ function ToastLayer(props) {
212
212
  }
213
213
  const StyledLayer = styled(Grid).withConfig({
214
214
  displayName: "StyledLayer",
215
- componentId: "sc-kxgg1x-0"
215
+ componentId: "sc-7muzlg-0"
216
216
  })`box-sizing:border-box;position:fixed;right:0;bottom:0;list-style:none;pointer-events:none;max-width:420px;width:100%;`;
217
217
  let toastId = 0;
218
218
  /** @internal */
package/dist/toast.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","names":["styled","ThemeColorStateToneKey","getTheme_v2","Card","CardProps","Flex","ButtonTone","LOADING_BAR_HEIGHT","STATUS_CARD_TONE","error","warning","success","info","key","BUTTON_TONE","TextBox","StyledToast","LoadingBar","div","LoadingBarMask","LoadingBarProgressProps","Omit","tone","LoadingBarProgress","React","ComponentType","props","color","theme","button","default","enabled","bg","CloseIcon","motion","stagger","Variant","Variants","usePrefersReducedMotion","Box","Button","Flex","Stack","Text","BUTTON_TONE","LoadingBar","LoadingBarMask","LoadingBarProgress","STATUS_CARD_TONE","StyledToast","TextBox","ToastProps","closable","description","React","ReactNode","onClose","radius","title","status","duration","updatedAt","ROLES","error","warning","success","info","const","LONG_ENOUGH_BUT_NOT_TOO_LONG","Toast","props","$","_c","restProps","t0","undefined","cardTone","buttonTone","role","prefersReducedMotion","visualDuration","t1","type","bounce","transition","hasDuration","isFinite","t2","Symbol","for","initial","t3","animate","t4","exit","t5","t6","t7","content","t8","t9","verticalAlign","t10","t11","scaleX","delay","ease","t12","container","y","scale","zIndex","hidden","opacity","visible","when","delayChildren","slideIn","slideOut","ContainerVariants","willChange","Partial","Record","MotionToast","create","MotionFlex","MotionText","MotionLoadingBar","MotionLoadingBarProgress","useSyncExternalStore","useMounted","subscribe","_temp","_temp2","createGlobalScopedContext","ToastContextValue","ToastContext","styled","Grid","useLayer","ToastLayerProps","children","React","ReactNode","padding","paddingX","paddingY","gap","ToastLayer","props","$","_c","t0","t1","undefined","zIndex","t2","t3","StyledLayer","toastId","generateToastId","String","AnimatePresence","startTransition","useMemo","useState","useMounted","LayerProvider","Toast","ToastContext","ToastLayer","ToastLayerProps","generateToastId","ToastContextValue","ToastParams","ToastState","dismiss","id","updatedAt","params","ToastProviderProps","Omit","children","React","ReactNode","zOffset","ToastProvider","props","$","_c","padding","paddingX","paddingY","gap","t0","undefined","t1","Symbol","for","state","setState","mounted","t2","push","duration","prevState","filter","toast","currentState","toast_0","toast_1","Date","now","version","value","t3","map","_temp","t4","dismiss_0","id_0","params_0","closable","description","status","title","useContext","isRecord","ToastContext","ToastContextValue","useToast","value","Error","version"],"sources":["../src/core/components/toast/styles.ts","../src/core/components/toast/toast.tsx","../src/core/hooks/useMounted.ts","../src/core/components/toast/toastContext.ts","../src/core/components/toast/toastLayer.tsx","../src/core/components/toast/toastState.ts","../src/core/components/toast/toastProvider.tsx","../src/core/components/toast/useToast.ts"],"sourcesContent":["import {styled} from 'styled-components'\n\nimport {ThemeColorStateToneKey} from '../../../theme/system/color/_system'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {Card, type CardProps} from '../../primitives/card/card'\nimport {Flex} from '../../primitives/flex/flex'\nimport type {ButtonTone} from '../../types/button'\n\nconst LOADING_BAR_HEIGHT = 2\n\nexport const STATUS_CARD_TONE = {\n error: 'critical',\n warning: 'caution',\n success: 'positive',\n info: 'neutral',\n} satisfies {[key: string]: ThemeColorStateToneKey}\n\nexport const BUTTON_TONE = {\n error: 'critical',\n warning: 'caution',\n success: 'positive',\n info: 'neutral',\n} satisfies {[key: string]: ButtonTone}\n\nexport const TextBox = styled(Flex)`\n overflow-x: auto;\n`\n\nexport const StyledToast = styled(Card)`\n pointer-events: all;\n width: 100%;\n position: relative;\n overflow: hidden;\n overflow: clip;\n\n &[data-has-duration] {\n padding-bottom: calc(${LOADING_BAR_HEIGHT}px / 2);\n }\n`\n\nexport const LoadingBar = styled.div`\n display: flex;\n position: absolute;\n bottom: 0px;\n top: 0px;\n left: 0px;\n right: 0px;\n pointer-events: none;\n z-index: -1;\n overflow: hidden;\n overflow: clip;\n background: transparent;\n align-items: flex-end;\n will-change: opacity;\n`\n\nexport const LoadingBarMask = styled(Card)`\n position: absolute;\n top: 0;\n left: -${LOADING_BAR_HEIGHT}px;\n right: -${LOADING_BAR_HEIGHT}px;\n bottom: ${LOADING_BAR_HEIGHT}px;\n z-index: 1;\n`\n\ntype LoadingBarProgressProps = Omit<CardProps, 'tone'> & {\n tone: ThemeColorStateToneKey\n}\nexport const LoadingBarProgress = styled<React.ComponentType<LoadingBarProgressProps>>(Card)`\n display: block;\n height: 100%;\n width: 100%;\n transform-origin: 0% 50%;\n background-color: ${(props) => {\n const {color} = getTheme_v2(props.theme)\n\n return color.button.default[props.tone].enabled.bg\n }};\n`\n","import {CloseIcon} from '@sanity/icons/Close'\nimport {motion, stagger, type Variant, type Variants} from 'motion/react'\n\nimport {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'\nimport {Box} from '../../primitives/box/box'\nimport {Button} from '../../primitives/button/button'\nimport {Flex} from '../../primitives/flex/flex'\nimport {Stack} from '../../primitives/stack/stack'\nimport {Text} from '../../primitives/text/text'\nimport {\n BUTTON_TONE,\n LoadingBar,\n LoadingBarMask,\n LoadingBarProgress,\n STATUS_CARD_TONE,\n StyledToast,\n TextBox,\n} from './styles'\n\n/**\n * @public\n */\nexport interface ToastProps {\n closable?: boolean\n description?: React.ReactNode\n onClose: () => void\n radius?: number | number[]\n title?: React.ReactNode\n status?: 'error' | 'warning' | 'success' | 'info'\n duration?: number\n updatedAt?: number\n}\n\nconst ROLES = {\n error: 'alert',\n warning: 'alert',\n success: 'alert',\n info: 'alert',\n} as const\n\n// Support pattern used by Sanity Studio, that works around the lack of `duration: Infinity` support in older @sanity/ui versions\n// https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value\nconst LONG_ENOUGH_BUT_NOT_TOO_LONG = 1000 * 60 * 60 * 24 * 24\n\n/**\n * The `Toast` component gives feedback to users when an action has taken place.\n *\n * Toasts can be closed with a close button, or auto-dismiss after a certain timeout.\n *\n * @public\n */\nexport function Toast(\n props: ToastProps &\n Omit<\n React.HTMLProps<HTMLDivElement>,\n | 'as'\n | 'height'\n | 'ref'\n | 'title'\n | 'onAnimationStart'\n | 'onDragStart'\n | 'onDragEnd'\n | 'onDrag'\n >,\n): React.JSX.Element {\n const {\n closable,\n description,\n duration,\n onClose,\n radius = 3,\n title,\n status,\n updatedAt,\n ...restProps\n } = props\n const cardTone = status ? STATUS_CARD_TONE[status] : 'default'\n const buttonTone = status ? BUTTON_TONE[status] : 'default'\n const role = status ? ROLES[status] : 'status'\n\n const prefersReducedMotion = usePrefersReducedMotion()\n\n const visualDuration: number = prefersReducedMotion ? 0 : 0.26\n const transition = visualDuration\n ? {type: 'spring' as const, visualDuration, bounce: 0.25}\n : {duration: 0}\n\n const hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG\n const initial: ContainerVariants[] = ['hidden', 'initial']\n const animate: ContainerVariants[] = ['visible', 'slideIn']\n const exit: ContainerVariants[] = ['hidden', 'slideOut']\n\n return (\n <MotionToast\n data-ui=\"Toast\"\n role={role}\n {...restProps}\n data-has-duration={hasDuration ? '' : undefined}\n custom={visualDuration}\n radius={radius}\n shadow={2}\n tone={cardTone}\n forwardedAs=\"li\"\n layout=\"position\"\n variants={container}\n initial={initial}\n animate={animate}\n exit={exit}\n transition={transition}\n >\n <MotionFlex align=\"flex-start\" variants={content} transition={transition}>\n <TextBox flex={1} padding={3}>\n <Stack gap={3}>\n {title && (\n <Text size={1} weight=\"medium\">\n {title}\n </Text>\n )}\n {description && (\n <MotionText muted size={1} variants={content} transition={transition}>\n {description}\n </MotionText>\n )}\n </Stack>\n </TextBox>\n\n {closable && (\n <Box padding={1}>\n <Button\n as=\"button\"\n icon={CloseIcon}\n mode=\"bleed\"\n padding={2}\n tone={buttonTone}\n onClick={onClose}\n style={{verticalAlign: 'top'}}\n />\n </Box>\n )}\n </MotionFlex>\n {hasDuration && (\n <MotionLoadingBar variants={content} transition={transition}>\n <LoadingBarMask tone={cardTone} radius={radius} />\n <MotionLoadingBarProgress\n key={`progress-${updatedAt}`}\n tone={cardTone}\n initial={{scaleX: 0}}\n animate={{scaleX: 1}}\n transition={{delay: visualDuration, duration: duration / 1_000, ease: 'linear'}}\n onAnimationComplete={onClose}\n />\n </MotionLoadingBar>\n )}\n </MotionToast>\n )\n}\n\nconst container = {\n initial: {y: 32, scale: 0.5, zIndex: 1},\n hidden: {opacity: 0},\n visible: (visualDuration: number) => {\n if (!visualDuration) return {opacity: 1}\n\n return {\n opacity: 1,\n transition: {\n when: 'beforeChildren',\n delayChildren: stagger(visualDuration / 3),\n duration: visualDuration / 3,\n },\n }\n },\n slideIn: {\n y: 0,\n scale: 1,\n },\n slideOut: {\n zIndex: 0,\n scale: 0.75,\n },\n} satisfies Variants\ntype ContainerVariants = keyof typeof container\n\nconst content = {\n initial: {\n willChange: 'transform',\n },\n hidden: {\n opacity: 0,\n },\n visible: {\n opacity: 1,\n },\n} satisfies Partial<Record<ContainerVariants, Variant>>\n\nconst MotionToast = motion.create(StyledToast)\nconst MotionFlex = motion.create(Flex)\nconst MotionText = motion.create(Text)\nconst MotionLoadingBar = motion.create(LoadingBar)\nconst MotionLoadingBarProgress = motion.create(LoadingBarProgress)\n","import {useSyncExternalStore} from 'react'\n\n/**\n * Some components should only render after mounting to the DOM, and not be rendered at all during SSR renderToString or equivalent.\n * @public\n */\nexport function useMounted(): boolean {\n return useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n )\n}\n\nconst subscribe = () => () => {}\n","import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'\nimport {ToastContextValue} from './types'\n\nexport const ToastContext = createGlobalScopedContext<ToastContextValue | null>(\n '@sanity/ui/context/toast',\n null,\n)\n","import {styled} from 'styled-components'\n\nimport {Grid} from '../../primitives/grid/grid'\nimport {useLayer} from '../../utils/layer/useLayer'\n\n/**\n * @public\n */\nexport interface ToastLayerProps {\n children: React.ReactNode\n padding?: number | number[]\n paddingX?: number | number[]\n paddingY?: number | number[]\n gap?: number | number[]\n}\n\n/**\n * @internal\n */\nexport function ToastLayer(props: ToastLayerProps): React.JSX.Element {\n const {children, padding = 4, paddingX, paddingY, gap = 3} = props\n const {zIndex} = useLayer()\n\n return (\n <StyledLayer\n forwardedAs=\"ul\"\n data-ui=\"ToastProvider\"\n padding={padding}\n paddingX={paddingX}\n paddingY={paddingY}\n gap={gap}\n gridTemplateColumns={1}\n style={{zIndex}}\n >\n {children}\n </StyledLayer>\n )\n}\n\nconst StyledLayer = styled(Grid)`\n box-sizing: border-box;\n position: fixed;\n right: 0;\n bottom: 0;\n list-style: none;\n pointer-events: none;\n max-width: 420px;\n width: 100%;\n`\n","let toastId = 0\n\n/** @internal */\nexport function generateToastId(): string {\n return String(toastId++)\n}\n","import {AnimatePresence} from 'motion/react'\nimport {startTransition, useMemo, useState} from 'react'\n\nimport {useMounted} from '../../hooks/useMounted'\nimport {LayerProvider} from '../../utils/layer/layerProvider'\nimport {Toast} from './toast'\nimport {ToastContext} from './toastContext'\nimport {ToastLayer, type ToastLayerProps} from './toastLayer'\nimport {generateToastId} from './toastState'\nimport {ToastContextValue, ToastParams} from './types'\n\ntype ToastState = {\n dismiss: () => void\n id: string\n updatedAt: number\n params: ToastParams\n}[]\n\n/**\n * @public\n */\nexport interface ToastProviderProps extends Omit<ToastLayerProps, 'children'> {\n children?: React.ReactNode\n zOffset?: number | number[]\n}\n\n/**\n * @public\n */\nexport function ToastProvider(props: ToastProviderProps): React.JSX.Element {\n const {children, padding, paddingX, paddingY, gap, zOffset = 1} = props\n const [state, setState] = useState<ToastState>([])\n const mounted = useMounted()\n\n const value: ToastContextValue = useMemo(() => {\n const push = (params: ToastParams) => {\n const id = params.id || generateToastId()\n const duration = params.duration || 5000\n\n startTransition(() => {\n setState((prevState): ToastState => {\n /**\n * Backwards compatibility for `sanity` patterns workaround a lack of programatically dismissible toasts.\n * It uses a super short duration that closes the toast immediately in previous versions of `@sanity/ui`.\n * We interpret this as a request to dismiss the toast immediately, and remove it from the state right away.\n * Even once we support programatic dismissal we'll need to keep this for backwards compatibility with v2 and v1.\n */\n if (duration === 0.01) {\n return prevState.filter((toast) => toast.id !== id)\n }\n\n /**\n * Creates a function to dismiss this specific toast.\n * This function will be passed to the Toast component\n * and called either on close button click or after duration.\n */\n const dismiss = () =>\n startTransition(() =>\n setState((currentState) => currentState.filter((toast) => toast.id !== id)),\n )\n\n /**\n * Create updated state by:\n * 1. Removing any existing toast with the same ID (prevents duplicates)\n * 2. Adding the new toast with its dismiss handler\n * 3. Updates the `updatedAt` timestamp, which resets progress bar count downs.\n */\n return [\n ...prevState.filter((toast) => toast.id !== id),\n {\n dismiss,\n id,\n updatedAt: Date.now(),\n params: {...params, duration},\n },\n ]\n })\n })\n\n return id\n }\n\n return {version: 0.0, push}\n }, [])\n\n return (\n <ToastContext.Provider value={value}>\n {children}\n {mounted && (\n <LayerProvider zOffset={zOffset}>\n <ToastLayer padding={padding} paddingX={paddingX} paddingY={paddingY} gap={gap}>\n <AnimatePresence initial={false} mode=\"popLayout\">\n {state.map(({dismiss, id, params, updatedAt}) => (\n <Toast\n key={id}\n closable={params.closable}\n description={params.description}\n onClose={dismiss}\n status={params.status}\n title={params.title}\n duration={params.duration}\n updatedAt={updatedAt}\n />\n ))}\n </AnimatePresence>\n </ToastLayer>\n </LayerProvider>\n )}\n </ToastContext.Provider>\n )\n}\n","import {useContext} from 'react'\n\nimport {isRecord} from '../../lib/isRecord'\nimport {ToastContext} from './toastContext'\nimport {ToastContextValue} from './types'\n\n/**\n * @public\n */\nexport function useToast(): ToastContextValue {\n const value = useContext(ToastContext)\n\n if (!value) {\n throw new Error('useToast(): missing context value')\n }\n\n // NOTE: This check is for future-compatiblity\n // - If the value is not an object, it’s not compatible with the current version\n // - If the value is an object, but doesn’t have `version: 0.0`, it’s not compatible with the current version\n if (!isRecord(value) || value.version !== 0.0) {\n throw new Error('useToast(): the context value is not compatible')\n }\n\n return value\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,MAEaQ,mBAAmB;CAC9BC,OAAO;CACPC,SAAS;CACTC,SAAS;CACTC,MAAM;AACR,GAEaE,cAAc;CACzBL,OAAO;CACPC,SAAS;CACTC,SAAS;CACTC,MAAM;AACR,GAEaG,UAAUf,OAAOK,IAAI,CAAC,CA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UAAA;EAA8BJ;EAA9B,UAAA,CACGhC,UACAiC,EAoBH;KAAwB3B,EAAA,MAAAN,UAAAM,EAAA,MAAA2B,IAAA3B,EAAA,MAAA8B,MAAAA,KAAA9B,EAAA,KAtBxB8B;AAsBwB;AA/ErB,SAAAD,MAAAvB,IAAA;CA+DmB,IAAA,EAAAlB,SAAA2C,WAAA1C,IAAA2C,MAAAzC,QAAA0C,UAAA3C,cAAAgB;CAAgC,OAC1C,oBAAC,OAAD;EAEY,UAAAf,SAAM2C;EACH,aAAA3C,SAAM4C;EACV/C,SAAAA;EACD,QAAAG,SAAM6C;EACP,OAAA7C,SAAM8C;EACH,UAAA9C,SAAMyB;EACL1B;CAAS,GAPfD,IAOe;AACpB;;;;AC7FlB,SAAOqD,WAAA;CACL,IAAAC,QAAcL,WAAWE,YAAY;CAErC,IAAI,CAACG,OACH,MAAUC,MAAM,mCAAmC;CAMrD,IAAI,CAACL,SAASI,KAAK,KAAKA,MAAKE,YAAa,GACxC,MAAUD,MAAM,iDAAiD;CAClE,OAEMD;AAAK"}
1
+ {"version":3,"file":"toast.js","names":["radius = 3","visualDuration\n ? {type: 'spring' as const, visualDuration, bounce: 0.25}\n : {duration: 0}","['hidden', 'initial']","['visible', 'slideIn']","['hidden', 'slideOut']","title && (\n <Text size={1} weight=\"medium\">\n {title}\n </Text>\n )","description && (\n <MotionText muted size={1} variants={content} transition={transition}>\n {description}\n </MotionText>\n )","<TextBox flex={1} padding={3}>\n <Stack gap={3}>\n {title && (\n <Text size={1} weight=\"medium\">\n {title}\n </Text>\n )}\n {description && (\n <MotionText muted size={1} variants={content} transition={transition}>\n {description}\n </MotionText>\n )}\n </Stack>\n </TextBox>","closable && (\n <Box padding={1}>\n <Button\n as=\"button\"\n icon={CloseIcon}\n mode=\"bleed\"\n padding={2}\n tone={buttonTone}\n onClick={onClose}\n style={{verticalAlign: 'top'}}\n />\n </Box>\n )","<MotionFlex align=\"flex-start\" variants={content} transition={transition}>\n <TextBox flex={1} padding={3}>\n <Stack gap={3}>\n {title && (\n <Text size={1} weight=\"medium\">\n {title}\n </Text>\n )}\n {description && (\n <MotionText muted size={1} variants={content} transition={transition}>\n {description}\n </MotionText>\n )}\n </Stack>\n </TextBox>\n\n {closable && (\n <Box padding={1}>\n <Button\n as=\"button\"\n icon={CloseIcon}\n mode=\"bleed\"\n padding={2}\n tone={buttonTone}\n onClick={onClose}\n style={{verticalAlign: 'top'}}\n />\n </Box>\n )}\n </MotionFlex>","hasDuration && (\n <MotionLoadingBar variants={content} transition={transition}>\n <LoadingBarMask tone={cardTone} radius={radius} />\n <MotionLoadingBarProgress\n key={`progress-${updatedAt}`}\n tone={cardTone}\n initial={{scaleX: 0}}\n animate={{scaleX: 1}}\n transition={{delay: visualDuration, duration: duration / 1_000, ease: 'linear'}}\n onAnimationComplete={onClose}\n />\n </MotionLoadingBar>\n )","<MotionToast\n data-ui=\"Toast\"\n role={role}\n {...restProps}\n data-has-duration={hasDuration ? '' : undefined}\n custom={visualDuration}\n radius={radius}\n shadow={2}\n tone={cardTone}\n forwardedAs=\"li\"\n layout=\"position\"\n variants={container}\n initial={initial}\n animate={animate}\n exit={exit}\n transition={transition}\n >\n <MotionFlex align=\"flex-start\" variants={content} transition={transition}>\n <TextBox flex={1} padding={3}>\n <Stack gap={3}>\n {title && (\n <Text size={1} weight=\"medium\">\n {title}\n </Text>\n )}\n {description && (\n <MotionText muted size={1} variants={content} transition={transition}>\n {description}\n </MotionText>\n )}\n </Stack>\n </TextBox>\n\n {closable && (\n <Box padding={1}>\n <Button\n as=\"button\"\n icon={CloseIcon}\n mode=\"bleed\"\n padding={2}\n tone={buttonTone}\n onClick={onClose}\n style={{verticalAlign: 'top'}}\n />\n </Box>\n )}\n </MotionFlex>\n {hasDuration && (\n <MotionLoadingBar variants={content} transition={transition}>\n <LoadingBarMask tone={cardTone} radius={radius} />\n <MotionLoadingBarProgress\n key={`progress-${updatedAt}`}\n tone={cardTone}\n initial={{scaleX: 0}}\n animate={{scaleX: 1}}\n transition={{delay: visualDuration, duration: duration / 1_000, ease: 'linear'}}\n onAnimationComplete={onClose}\n />\n </MotionLoadingBar>\n )}\n </MotionToast>","hasDuration ? '' : undefined","() => true","() => false","padding = 4","gap = 3","{zIndex}","<StyledLayer\n forwardedAs=\"ul\"\n data-ui=\"ToastProvider\"\n padding={padding}\n paddingX={paddingX}\n paddingY={paddingY}\n gap={gap}\n gridTemplateColumns={1}\n style={{zIndex}}\n >\n {children}\n </StyledLayer>","zOffset = 1","[]","{version: 0.0, push}","toast","useMemo(() => {\n const push = (params: ToastParams) => {\n const id = params.id || generateToastId()\n const duration = params.duration || 5000\n\n startTransition(() => {\n setState((prevState): ToastState => {\n /**\n * Backwards compatibility for `sanity` patterns workaround a lack of programatically dismissible toasts.\n * It uses a super short duration that closes the toast immediately in previous versions of `@sanity/ui`.\n * We interpret this as a request to dismiss the toast immediately, and remove it from the state right away.\n * Even once we support programatic dismissal we'll need to keep this for backwards compatibility with v2 and v1.\n */\n if (duration === 0.01) {\n return prevState.filter((toast) => toast.id !== id)\n }\n\n /**\n * Creates a function to dismiss this specific toast.\n * This function will be passed to the Toast component\n * and called either on close button click or after duration.\n */\n const dismiss = () =>\n startTransition(() =>\n setState((currentState) => currentState.filter((toast) => toast.id !== id)),\n )\n\n /**\n * Create updated state by:\n * 1. Removing any existing toast with the same ID (prevents duplicates)\n * 2. Adding the new toast with its dismiss handler\n * 3. Updates the `updatedAt` timestamp, which resets progress bar count downs.\n */\n return [\n ...prevState.filter((toast) => toast.id !== id),\n {\n dismiss,\n id,\n updatedAt: Date.now(),\n params: {...params, duration},\n },\n ]\n })\n })\n\n return id\n }\n\n return {version: 0.0, push}\n }, [])","mounted && (\n <LayerProvider zOffset={zOffset}>\n <ToastLayer padding={padding} paddingX={paddingX} paddingY={paddingY} gap={gap}>\n <AnimatePresence initial={false} mode=\"popLayout\">\n {state.map(({dismiss, id, params, updatedAt}) => (\n <Toast\n key={id}\n closable={params.closable}\n description={params.description}\n onClose={dismiss}\n status={params.status}\n title={params.title}\n duration={params.duration}\n updatedAt={updatedAt}\n />\n ))}\n </AnimatePresence>\n </ToastLayer>\n </LayerProvider>\n )","({dismiss, id, params, updatedAt}) => (\n <Toast\n key={id}\n closable={params.closable}\n description={params.description}\n onClose={dismiss}\n status={params.status}\n title={params.title}\n duration={params.duration}\n updatedAt={updatedAt}\n />\n )","<ToastContext.Provider value={value}>\n {children}\n {mounted && (\n <LayerProvider zOffset={zOffset}>\n <ToastLayer padding={padding} paddingX={paddingX} paddingY={paddingY} gap={gap}>\n <AnimatePresence initial={false} mode=\"popLayout\">\n {state.map(({dismiss, id, params, updatedAt}) => (\n <Toast\n key={id}\n closable={params.closable}\n description={params.description}\n onClose={dismiss}\n status={params.status}\n title={params.title}\n duration={params.duration}\n updatedAt={updatedAt}\n />\n ))}\n </AnimatePresence>\n </ToastLayer>\n </LayerProvider>\n )}\n </ToastContext.Provider>","ToastContext.Provider","{dismiss, id, params, updatedAt}","params","dismiss","id"],"sources":["../src/core/components/toast/styles.ts","../src/core/components/toast/toast.tsx","../src/core/hooks/useMounted.ts","../src/core/components/toast/toastContext.ts","../src/core/components/toast/toastLayer.tsx","../src/core/components/toast/toastState.ts","../src/core/components/toast/toastProvider.tsx","../src/core/components/toast/useToast.ts"],"sourcesContent":["import {styled} from 'styled-components'\n\nimport {ThemeColorStateToneKey} from '../../../theme/system/color/_system'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {Card, type CardProps} from '../../primitives/card/card'\nimport {Flex} from '../../primitives/flex/flex'\nimport type {ButtonTone} from '../../types/button'\n\nconst LOADING_BAR_HEIGHT = 2\n\nexport const STATUS_CARD_TONE = {\n error: 'critical',\n warning: 'caution',\n success: 'positive',\n info: 'neutral',\n} satisfies {[key: string]: ThemeColorStateToneKey}\n\nexport const BUTTON_TONE = {\n error: 'critical',\n warning: 'caution',\n success: 'positive',\n info: 'neutral',\n} satisfies {[key: string]: ButtonTone}\n\nexport const TextBox = styled(Flex)`\n overflow-x: auto;\n`\n\nexport const StyledToast = styled(Card)`\n pointer-events: all;\n width: 100%;\n position: relative;\n overflow: hidden;\n overflow: clip;\n\n &[data-has-duration] {\n padding-bottom: calc(${LOADING_BAR_HEIGHT}px / 2);\n }\n`\n\nexport const LoadingBar = styled.div`\n display: flex;\n position: absolute;\n bottom: 0px;\n top: 0px;\n left: 0px;\n right: 0px;\n pointer-events: none;\n z-index: -1;\n overflow: hidden;\n overflow: clip;\n background: transparent;\n align-items: flex-end;\n will-change: opacity;\n`\n\nexport const LoadingBarMask = styled(Card)`\n position: absolute;\n top: 0;\n left: -${LOADING_BAR_HEIGHT}px;\n right: -${LOADING_BAR_HEIGHT}px;\n bottom: ${LOADING_BAR_HEIGHT}px;\n z-index: 1;\n`\n\ntype LoadingBarProgressProps = Omit<CardProps, 'tone'> & {\n tone: ThemeColorStateToneKey\n}\nexport const LoadingBarProgress = styled<React.ComponentType<LoadingBarProgressProps>>(Card)`\n display: block;\n height: 100%;\n width: 100%;\n transform-origin: 0% 50%;\n background-color: ${(props) => {\n const {color} = getTheme_v2(props.theme)\n\n return color.button.default[props.tone].enabled.bg\n }};\n`\n","import {CloseIcon} from '@sanity/icons/Close'\nimport {motion, stagger, type Variant, type Variants} from 'motion/react'\n\nimport {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'\nimport {Box} from '../../primitives/box/box'\nimport {Button} from '../../primitives/button/button'\nimport {Flex} from '../../primitives/flex/flex'\nimport {Stack} from '../../primitives/stack/stack'\nimport {Text} from '../../primitives/text/text'\nimport {\n BUTTON_TONE,\n LoadingBar,\n LoadingBarMask,\n LoadingBarProgress,\n STATUS_CARD_TONE,\n StyledToast,\n TextBox,\n} from './styles'\n\n/**\n * @public\n */\nexport interface ToastProps {\n closable?: boolean\n description?: React.ReactNode\n onClose: () => void\n radius?: number | number[]\n title?: React.ReactNode\n status?: 'error' | 'warning' | 'success' | 'info'\n duration?: number\n updatedAt?: number\n}\n\nconst ROLES = {\n error: 'alert',\n warning: 'alert',\n success: 'alert',\n info: 'alert',\n} as const\n\n// Support pattern used by Sanity Studio, that works around the lack of `duration: Infinity` support in older @sanity/ui versions\n// https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value\nconst LONG_ENOUGH_BUT_NOT_TOO_LONG = 1000 * 60 * 60 * 24 * 24\n\n/**\n * The `Toast` component gives feedback to users when an action has taken place.\n *\n * Toasts can be closed with a close button, or auto-dismiss after a certain timeout.\n *\n * @public\n */\nexport function Toast(\n props: ToastProps &\n Omit<\n React.HTMLProps<HTMLDivElement>,\n | 'as'\n | 'height'\n | 'ref'\n | 'title'\n | 'onAnimationStart'\n | 'onDragStart'\n | 'onDragEnd'\n | 'onDrag'\n >,\n): React.JSX.Element {\n const {\n closable,\n description,\n duration,\n onClose,\n radius = 3,\n title,\n status,\n updatedAt,\n ...restProps\n } = props\n const cardTone = status ? STATUS_CARD_TONE[status] : 'default'\n const buttonTone = status ? BUTTON_TONE[status] : 'default'\n const role = status ? ROLES[status] : 'status'\n\n const prefersReducedMotion = usePrefersReducedMotion()\n\n const visualDuration: number = prefersReducedMotion ? 0 : 0.26\n const transition = visualDuration\n ? {type: 'spring' as const, visualDuration, bounce: 0.25}\n : {duration: 0}\n\n const hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG\n const initial: ContainerVariants[] = ['hidden', 'initial']\n const animate: ContainerVariants[] = ['visible', 'slideIn']\n const exit: ContainerVariants[] = ['hidden', 'slideOut']\n\n return (\n <MotionToast\n data-ui=\"Toast\"\n role={role}\n {...restProps}\n data-has-duration={hasDuration ? '' : undefined}\n custom={visualDuration}\n radius={radius}\n shadow={2}\n tone={cardTone}\n forwardedAs=\"li\"\n layout=\"position\"\n variants={container}\n initial={initial}\n animate={animate}\n exit={exit}\n transition={transition}\n >\n <MotionFlex align=\"flex-start\" variants={content} transition={transition}>\n <TextBox flex={1} padding={3}>\n <Stack gap={3}>\n {title && (\n <Text size={1} weight=\"medium\">\n {title}\n </Text>\n )}\n {description && (\n <MotionText muted size={1} variants={content} transition={transition}>\n {description}\n </MotionText>\n )}\n </Stack>\n </TextBox>\n\n {closable && (\n <Box padding={1}>\n <Button\n as=\"button\"\n icon={CloseIcon}\n mode=\"bleed\"\n padding={2}\n tone={buttonTone}\n onClick={onClose}\n style={{verticalAlign: 'top'}}\n />\n </Box>\n )}\n </MotionFlex>\n {hasDuration && (\n <MotionLoadingBar variants={content} transition={transition}>\n <LoadingBarMask tone={cardTone} radius={radius} />\n <MotionLoadingBarProgress\n key={`progress-${updatedAt}`}\n tone={cardTone}\n initial={{scaleX: 0}}\n animate={{scaleX: 1}}\n transition={{delay: visualDuration, duration: duration / 1_000, ease: 'linear'}}\n onAnimationComplete={onClose}\n />\n </MotionLoadingBar>\n )}\n </MotionToast>\n )\n}\n\nconst container = {\n initial: {y: 32, scale: 0.5, zIndex: 1},\n hidden: {opacity: 0},\n visible: (visualDuration: number) => {\n if (!visualDuration) return {opacity: 1}\n\n return {\n opacity: 1,\n transition: {\n when: 'beforeChildren',\n delayChildren: stagger(visualDuration / 3),\n duration: visualDuration / 3,\n },\n }\n },\n slideIn: {\n y: 0,\n scale: 1,\n },\n slideOut: {\n zIndex: 0,\n scale: 0.75,\n },\n} satisfies Variants\ntype ContainerVariants = keyof typeof container\n\nconst content = {\n initial: {\n willChange: 'transform',\n },\n hidden: {\n opacity: 0,\n },\n visible: {\n opacity: 1,\n },\n} satisfies Partial<Record<ContainerVariants, Variant>>\n\nconst MotionToast = motion.create(StyledToast)\nconst MotionFlex = motion.create(Flex)\nconst MotionText = motion.create(Text)\nconst MotionLoadingBar = motion.create(LoadingBar)\nconst MotionLoadingBarProgress = motion.create(LoadingBarProgress)\n","import {useSyncExternalStore} from 'react'\n\n/**\n * Some components should only render after mounting to the DOM, and not be rendered at all during SSR renderToString or equivalent.\n * @public\n */\nexport function useMounted(): boolean {\n return useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n )\n}\n\nconst subscribe = () => () => {}\n","import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'\nimport {ToastContextValue} from './types'\n\nexport const ToastContext = createGlobalScopedContext<ToastContextValue | null>(\n '@sanity/ui/context/toast',\n null,\n)\n","import {styled} from 'styled-components'\n\nimport {Grid} from '../../primitives/grid/grid'\nimport {useLayer} from '../../utils/layer/useLayer'\n\n/**\n * @public\n */\nexport interface ToastLayerProps {\n children: React.ReactNode\n padding?: number | number[]\n paddingX?: number | number[]\n paddingY?: number | number[]\n gap?: number | number[]\n}\n\n/**\n * @internal\n */\nexport function ToastLayer(props: ToastLayerProps): React.JSX.Element {\n const {children, padding = 4, paddingX, paddingY, gap = 3} = props\n const {zIndex} = useLayer()\n\n return (\n <StyledLayer\n forwardedAs=\"ul\"\n data-ui=\"ToastProvider\"\n padding={padding}\n paddingX={paddingX}\n paddingY={paddingY}\n gap={gap}\n gridTemplateColumns={1}\n style={{zIndex}}\n >\n {children}\n </StyledLayer>\n )\n}\n\nconst StyledLayer = styled(Grid)`\n box-sizing: border-box;\n position: fixed;\n right: 0;\n bottom: 0;\n list-style: none;\n pointer-events: none;\n max-width: 420px;\n width: 100%;\n`\n","let toastId = 0\n\n/** @internal */\nexport function generateToastId(): string {\n return String(toastId++)\n}\n","import {AnimatePresence} from 'motion/react'\nimport {startTransition, useMemo, useState} from 'react'\n\nimport {useMounted} from '../../hooks/useMounted'\nimport {LayerProvider} from '../../utils/layer/layerProvider'\nimport {Toast} from './toast'\nimport {ToastContext} from './toastContext'\nimport {ToastLayer, type ToastLayerProps} from './toastLayer'\nimport {generateToastId} from './toastState'\nimport {ToastContextValue, ToastParams} from './types'\n\ntype ToastState = {\n dismiss: () => void\n id: string\n updatedAt: number\n params: ToastParams\n}[]\n\n/**\n * @public\n */\nexport interface ToastProviderProps extends Omit<ToastLayerProps, 'children'> {\n children?: React.ReactNode\n zOffset?: number | number[]\n}\n\n/**\n * @public\n */\nexport function ToastProvider(props: ToastProviderProps): React.JSX.Element {\n const {children, padding, paddingX, paddingY, gap, zOffset = 1} = props\n const [state, setState] = useState<ToastState>([])\n const mounted = useMounted()\n\n const value: ToastContextValue = useMemo(() => {\n const push = (params: ToastParams) => {\n const id = params.id || generateToastId()\n const duration = params.duration || 5000\n\n startTransition(() => {\n setState((prevState): ToastState => {\n /**\n * Backwards compatibility for `sanity` patterns workaround a lack of programatically dismissible toasts.\n * It uses a super short duration that closes the toast immediately in previous versions of `@sanity/ui`.\n * We interpret this as a request to dismiss the toast immediately, and remove it from the state right away.\n * Even once we support programatic dismissal we'll need to keep this for backwards compatibility with v2 and v1.\n */\n if (duration === 0.01) {\n return prevState.filter((toast) => toast.id !== id)\n }\n\n /**\n * Creates a function to dismiss this specific toast.\n * This function will be passed to the Toast component\n * and called either on close button click or after duration.\n */\n const dismiss = () =>\n startTransition(() =>\n setState((currentState) => currentState.filter((toast) => toast.id !== id)),\n )\n\n /**\n * Create updated state by:\n * 1. Removing any existing toast with the same ID (prevents duplicates)\n * 2. Adding the new toast with its dismiss handler\n * 3. Updates the `updatedAt` timestamp, which resets progress bar count downs.\n */\n return [\n ...prevState.filter((toast) => toast.id !== id),\n {\n dismiss,\n id,\n updatedAt: Date.now(),\n params: {...params, duration},\n },\n ]\n })\n })\n\n return id\n }\n\n return {version: 0.0, push}\n }, [])\n\n return (\n <ToastContext.Provider value={value}>\n {children}\n {mounted && (\n <LayerProvider zOffset={zOffset}>\n <ToastLayer padding={padding} paddingX={paddingX} paddingY={paddingY} gap={gap}>\n <AnimatePresence initial={false} mode=\"popLayout\">\n {state.map(({dismiss, id, params, updatedAt}) => (\n <Toast\n key={id}\n closable={params.closable}\n description={params.description}\n onClose={dismiss}\n status={params.status}\n title={params.title}\n duration={params.duration}\n updatedAt={updatedAt}\n />\n ))}\n </AnimatePresence>\n </ToastLayer>\n </LayerProvider>\n )}\n </ToastContext.Provider>\n )\n}\n","import {useContext} from 'react'\n\nimport {isRecord} from '../../lib/isRecord'\nimport {ToastContext} from './toastContext'\nimport {ToastContextValue} from './types'\n\n/**\n * @public\n */\nexport function useToast(): ToastContextValue {\n const value = useContext(ToastContext)\n\n if (!value) {\n throw new Error('useToast(): missing context value')\n }\n\n // NOTE: This check is for future-compatiblity\n // - If the value is not an object, it’s not compatible with the current version\n // - If the value is an object, but doesn’t have `version: 0.0`, it’s not compatible with the current version\n if (!isRecord(value) || value.version !== 0.0) {\n throw new Error('useToast(): the context value is not compatible')\n }\n\n return value\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,MAEa,mBAAmB;CAC9B,OAAO;CACP,SAAS;CACT,SAAS;CACT,MAAM;AACR,GAEa,cAAc;CACzB,OAAO;CACP,SAAS;CACT,SAAS;CACT,MAAM;AACR,GAEa,UAAU,OAAO,IAAI,CAAC,CAAA,WAAA;;;sBAItB,cAAc,OAAO,IAAI,CAAC,CAAA,WAAA;;;AAQZ,CAAA,CAAA,0HAAA,EAAmB,YAIjC,aAAa,OAAO,IAAA,WAAA;;;AAAG,CAAA,CAAA,sMAgBvB,iBAAiB,OAAO,IAAI,CAAC,CAAA,WAAA;;;AAG/B,CAAA,CAAA,iCAAA,EAAmB,YAClB,EAAmB,YACnB,EAAmB,gBAOlB,qBAAqB,OAAqD,IAAI,CAAC,CAAA,WAAA;;;AAKrE,CAAA,CAAA,kFAAA,UAAU;CAC7B,IAAM,EAAC,UAAS,YAAY,MAAM,KAAK;CAEvC,OAAO,MAAM,OAAO,QAAQ,MAAM,KAAK,CAAC,QAAQ;AAClD,EAAE,IC5CE,QAAQ;CACZ,OAAO;CACP,SAAS;CACT,SAAS;CACT,MAAM;AACR;;;;;;;;AAaA,SAAgB,MACd,OAYmB;gBAEjB,UACA,aACA,UACA,SAKG,WAFH,QAFAA,IACA,OAEA;CAEE,AAAA,EAAA,OAAA,8JAVE,CACJ,UACA,aACA,UACA,SACA,QAAA,IACA,OACA,QACA,cACA,aACE;CALF,IAAA,SAAA,OAAA,KAAA,IAAS,IAATA,IAMI,WAAW,SAAS,iBAAiB,UAAU,WAC/C,aAA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AAU,MAAM,iDAAiD;CAGnE,OAAO;AACT"}
package/dist/tooltip.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { c as POPOVER_MOTION_PROPS, n as _getArrayProp } from "./helpers-bwfx1e-Y.js";
3
- import { _ as useTheme_v2, d as createGlobalScopedContext, i as usePrefersReducedMotion, s as Card } from "./useLayer-BAVfmbNN.js";
2
+ import { c as POPOVER_MOTION_PROPS, n as _getArrayProp } from "./helpers-JV5y3U_M.js";
3
+ import { _ as useTheme_v2, d as createGlobalScopedContext, i as usePrefersReducedMotion, s as Card } from "./useLayer-Dhme0dcp.js";
4
4
  import { n as AnimateActivity, r as origin, t as getElementRef } from "./getElementRef-5HZQ-Owu.js";
5
- import { a as useBoundaryElement, n as Portal, r as usePortal, t as Arrow } from "./arrow-CHE8-_G7.js";
6
- import { t as Layer } from "./layer-B98ynOf2.js";
5
+ import { a as useBoundaryElement, n as Portal, r as usePortal, t as Arrow } from "./arrow-BaqZdFUX.js";
6
+ import { t as Layer } from "./layer-DsScTlqC.js";
7
7
  import { c } from "react/compiler-runtime";
8
8
  import { Activity, cloneElement, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
9
9
  import { styled } from "styled-components";
@@ -117,7 +117,7 @@ const DEFAULT_FALLBACK_PLACEMENTS = {
117
117
  ]
118
118
  }, MotionCard = styled(motion.create(Card)).withConfig({
119
119
  displayName: "MotionCard",
120
- componentId: "sc-njeaip-0"
120
+ componentId: "sc-49dg4z-0"
121
121
  })`will-change:transform;`;
122
122
  /**
123
123
  * @internal
@@ -184,7 +184,7 @@ function useTooltipDelayGroup() {
184
184
  }
185
185
  const StyledTooltip = styled(Layer).withConfig({
186
186
  displayName: "StyledTooltip",
187
- componentId: "sc-8cbl5k-0"
187
+ componentId: "sc-nx2p4f-0"
188
188
  })`pointer-events:none;`;
189
189
  /**
190
190
  * Tooltips display information when hovering, focusing or tapping.