@sanity/ui 4.4.11 → 4.4.13
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.
- package/dist/{_system-CTe2lb5l.d.ts → _system-DjnSx8gA.d.ts} +1 -1
- package/dist/{_system-CTe2lb5l.d.ts.map → _system-DjnSx8gA.d.ts.map} +1 -1
- package/dist/{arrow-CleOpGKV.js → arrow-BhooatHA.js} +2 -2
- package/dist/arrow-BhooatHA.js.map +1 -0
- package/dist/autocomplete.d.ts +3 -3
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/autocomplete.js +64 -63
- package/dist/autocomplete.js.map +1 -1
- package/dist/breadcrumbs.js +6 -6
- package/dist/breadcrumbs.js.map +1 -1
- package/dist/{button-dnqMFkWg.d.ts → button-DJ_N-Z82.d.ts} +5 -5
- package/dist/{button-dnqMFkWg.d.ts.map → button-DJ_N-Z82.d.ts.map} +1 -1
- package/dist/{button-DnJrhWml.js → button-GFefHUiY.js} +8 -8
- package/dist/button-GFefHUiY.js.map +1 -0
- package/dist/card-CEB9JLru.d.ts +7 -0
- package/dist/card-CEB9JLru.d.ts.map +1 -0
- package/dist/code.d.ts +1 -1
- package/dist/code.js +4 -4
- package/dist/code.js.map +1 -1
- package/dist/{component-DVlwaWB-.d.ts → component-CWyWF8Ut.d.ts} +1 -1
- package/dist/{component-DVlwaWB-.d.ts.map → component-CWyWF8Ut.d.ts.map} +1 -1
- package/dist/{element-BYgCE_iK.js → element-DIcKo4Jp.js} +1 -1
- package/dist/{element-BYgCE_iK.js.map → element-DIcKo4Jp.js.map} +1 -1
- package/dist/{elementSizeObserver-pevZfdGa.js → elementSizeObserver-CSI5StGC.js} +1 -1
- package/dist/{elementSizeObserver-pevZfdGa.js.map → elementSizeObserver-CSI5StGC.js.map} +1 -1
- package/dist/{factory-BzXTX8_Q.js → factory-D1M0GqJn.js} +3 -3
- package/dist/factory-D1M0GqJn.js.map +1 -0
- package/dist/{flex-ohP2jG9d.js → flex-DeU6k2uN.js} +4 -4
- package/dist/flex-DeU6k2uN.js.map +1 -0
- package/dist/{font-EtfxKPUz.d.ts → font-DI_tc5s8.d.ts} +1 -1
- package/dist/{font-EtfxKPUz.d.ts.map → font-DI_tc5s8.d.ts.map} +1 -1
- package/dist/{getElementRef-BLVMlHTn.js → getElementRef-5HypX0AT.js} +1 -1
- package/dist/getElementRef-5HypX0AT.js.map +1 -0
- package/dist/{getScopedTheme-C-sZsyAz.js → getScopedTheme-BJoqtbrb.js} +2 -2
- package/dist/{getScopedTheme-C-sZsyAz.js.map → getScopedTheme-BJoqtbrb.js.map} +1 -1
- package/dist/{getTheme_v2-y09KqtEb.js → getTheme_v2-CP5x_AcH.js} +1 -1
- package/dist/{getTheme_v2-y09KqtEb.js.map → getTheme_v2-CP5x_AcH.js.map} +1 -1
- package/dist/{grid-D-gOpN8z.js → grid-Bz_gKSjw.js} +4 -4
- package/dist/grid-Bz_gKSjw.js.map +1 -0
- package/dist/{helpers-XThPpWje.js → helpers-jp2T-bdR.js} +2 -2
- package/dist/{helpers-XThPpWje.js.map → helpers-jp2T-bdR.js.map} +1 -1
- package/dist/{hotkeys-Bd5rZOMO.js → hotkeys-B9h8uliL.js} +5 -5
- package/dist/hotkeys-B9h8uliL.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/{layer-umnlcWXZ.js → layer-Bl7rtdZ_.js} +4 -4
- package/dist/layer-Bl7rtdZ_.js.map +1 -0
- package/dist/{layer-ChlP9Ik6.d.ts → layer-CAyooswI.d.ts} +1 -1
- package/dist/{layer-ChlP9Ik6.d.ts.map → layer-CAyooswI.d.ts.map} +1 -1
- package/dist/menu.d.ts +4 -4
- package/dist/menu.js +12 -12
- package/dist/menu.js.map +1 -1
- package/dist/{popover-qhIrQ_4V.js → popover-C-YWzo_l.js} +20 -15
- package/dist/popover-C-YWzo_l.js.map +1 -0
- package/dist/{popover-HDVgZg5e.d.ts → popover-DpHuX7yr.d.ts} +4 -4
- package/dist/{popover-HDVgZg5e.d.ts.map → popover-DpHuX7yr.d.ts.map} +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/{refractor-CC48DwHi.js → refractor-DeAFUFLp.js} +2 -2
- package/dist/refractor-DeAFUFLp.js.map +1 -0
- package/dist/{responsiveFont-Cyvxxz-G.js → responsiveFont-CfFXLc7o.js} +3 -3
- package/dist/{responsiveFont-Cyvxxz-G.js.map → responsiveFont-CfFXLc7o.js.map} +1 -1
- package/dist/{rgba-BSYaEUW6.d.ts → rgba-Hlu7P1jF.d.ts} +3 -3
- package/dist/{rgba-BSYaEUW6.d.ts.map → rgba-Hlu7P1jF.d.ts.map} +1 -1
- package/dist/selectable-2IHh9SLq.d.ts +7 -0
- package/dist/selectable-2IHh9SLq.d.ts.map +1 -0
- package/dist/{stack-DyrC2YfU.js → stack-DFRXALVU.js} +5 -5
- package/dist/stack-DFRXALVU.js.map +1 -0
- package/dist/{textInput-DhYi5cPT.js → textInput-cMQvSl5n.js} +7 -7
- package/dist/textInput-cMQvSl5n.js.map +1 -0
- package/dist/theme.d.ts +3 -3
- package/dist/theme.js +3 -3
- package/dist/toast.js +8 -8
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.d.ts +2 -2
- package/dist/tooltip.js +9 -9
- package/dist/tooltip.js.map +1 -1
- package/dist/{useClickOutsideEvent-CC1zgOmv.js → useClickOutsideEvent-C-9cvlOu.js} +2 -2
- package/dist/useClickOutsideEvent-C-9cvlOu.js.map +1 -0
- package/dist/{useLayer-D_TnC6On.js → useLayer-DiYnwQ5T.js} +12 -12
- package/dist/useLayer-DiYnwQ5T.js.map +1 -0
- package/package.json +21 -21
- package/dist/arrow-CleOpGKV.js.map +0 -1
- package/dist/button-DnJrhWml.js.map +0 -1
- package/dist/card-C0a0wQTc.d.ts +0 -7
- package/dist/card-C0a0wQTc.d.ts.map +0 -1
- package/dist/factory-BzXTX8_Q.js.map +0 -1
- package/dist/flex-ohP2jG9d.js.map +0 -1
- package/dist/getElementRef-BLVMlHTn.js.map +0 -1
- package/dist/grid-D-gOpN8z.js.map +0 -1
- package/dist/hotkeys-Bd5rZOMO.js.map +0 -1
- package/dist/layer-umnlcWXZ.js.map +0 -1
- package/dist/popover-qhIrQ_4V.js.map +0 -1
- package/dist/refractor-CC48DwHi.js.map +0 -1
- package/dist/selectable-B0GUIL74.d.ts +0 -7
- package/dist/selectable-B0GUIL74.d.ts.map +0 -1
- package/dist/stack-DyrC2YfU.js.map +0 -1
- package/dist/textInput-DhYi5cPT.js.map +0 -1
- package/dist/useClickOutsideEvent-CC1zgOmv.js.map +0 -1
- package/dist/useLayer-D_TnC6On.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover-C-YWzo_l.js","names":["...restProps","getTransformOrigin(originX, originY)","animate ? 'transform' : undefined","constrainSize ? undefined : (style?.maxHeight ?? '')","constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? '')","matchReferenceWidth ? undefined : (width ?? style?.width ?? '')","{\n left: x,\n position: strategy,\n top: y,\n transformOrigin: getTransformOrigin(originX, originY),\n zIndex,\n willChange: animate ? 'transform' : undefined,\n ...style,\n // The `size` middleware writes these to the element while it owns them (React leaves a style\n // it keeps rendering as `undefined` alone), and `''` clears its write once React owns them\n maxHeight: constrainSize ? undefined : (style?.maxHeight ?? ''),\n maxWidth: constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? ''),\n width: matchReferenceWidth ? undefined : (width ?? style?.width ?? ''),\n }","useMemo(\n () => ({\n left: x,\n position: strategy,\n top: y,\n transformOrigin: getTransformOrigin(originX, originY),\n zIndex,\n willChange: animate ? 'transform' : undefined,\n ...style,\n // The `size` middleware writes these to the element while it owns them (React leaves a style\n // it keeps rendering as `undefined` alone), and `''` clears its write once React owns them\n maxHeight: constrainSize ? undefined : (style?.maxHeight ?? ''),\n maxWidth: constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? ''),\n width: matchReferenceWidth ? undefined : (width ?? style?.width ?? ''),\n }),\n [\n animate,\n constrainSize,\n matchReferenceWidth,\n maxWidth,\n originX,\n originY,\n strategy,\n style,\n width,\n x,\n y,\n zIndex,\n ],\n )","arrowX !== null ? arrowX : undefined","arrowY !== null ? arrowY : undefined","{\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }","useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )","animate ? POPOVER_MOTION_PROPS : undefined","<Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>","<Flex data-ui=\"Popover__wrapper\" direction=\"column\" flex={1} overflow={overflow}>\n <Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>\n </Flex>","arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_POPOVER_ARROW_WIDTH}\n height={DEFAULT_POPOVER_ARROW_HEIGHT}\n radius={DEFAULT_POPOVER_ARROW_RADIUS}\n />\n )","<MotionCard\n data-ui=\"Popover\"\n {...restProps}\n data-placement={placement}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n sizing=\"border\"\n style={rootStyle}\n tone={tone}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n <Flex data-ui=\"Popover__wrapper\" direction=\"column\" flex={1} overflow={overflow}>\n <Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>\n </Flex>\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_POPOVER_ARROW_WIDTH}\n height={DEFAULT_POPOVER_ARROW_HEIGHT}\n radius={DEFAULT_POPOVER_ARROW_RADIUS}\n />\n )}\n </MotionCard>","_jsx","() => {\n if (shouldRender) stopListening(stopRef)\n }","[shouldRender]","(node: HTMLElement | null) => {\n stopListening(stopRef)\n\n if (node && !shouldRenderRef.current) stopRef.current = listenForIntent(node, handleIntent)\n\n return () => stopListening(stopRef)\n }","shouldRenderRef.current","useCallback(\n (node: HTMLElement | null) => {\n stopListening(stopRef)\n\n if (node && !shouldRenderRef.current) stopRef.current = listenForIntent(node, handleIntent)\n\n return () => stopListening(stopRef)\n },\n [handleIntent, shouldRenderRef],\n )","<div\n data-ui=\"PopoverOverlay\"\n style={{height: '100vh', inset: 0, position: 'fixed', width: '100vw', zIndex}}\n />","margins = DEFAULT_POPOVER_MARGINS","_animate = false","tone = 'inherit'","widthProp = 'auto'","arrowProp = false","constrainSize = false","overflow = 'hidden'","placementProp = 'bottom'","placementStrategy = 'flip'","preventOverflow = true","radiusProp = 3","shadowProp = 3","childProp","content","disabled","_fallbackPlacements","matchReferenceWidth","_floatingBoundary","modal","open","paddingProp","portal","forwardedRef","_referenceBoundary","referenceElement","scheme","_zOffsetProp","updateRef","...restProps","_getArrayProp(paddingProp)","_getArrayProp(radiusProp)","_getArrayProp(shadowProp)","_getArrayProp(zOffsetProp)","() => ref.current","{\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n }","referenceElement\n ? {\n reference: referenceElement,\n }\n : undefined","{\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: referenceElement\n ? {\n reference: referenceElement,\n }\n : undefined,\n }","() => startTransition(() => setHasRendered(true))","useCallback(() => startTransition(() => setHasRendered(true)), [])","() => {\n if (!intentReference) return undefined\n\n return listenForIntent(intentReference, handleIntent)\n }","[handleIntent, intentReference]","(arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n }","useCallback((arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n }, [])","childProp && !referenceElement ? getElementRef<HTMLElement>(childProp) : undefined","(node: HTMLDivElement | null) => {\n ref.current = node\n if (node) handOverReference()\n refs.setFloating(node)\n }","useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n if (node) handOverReference()\n refs.setFloating(node)\n },\n [handOverReference, refs],\n )","useMemo(() => {\n // If a reference element is defined, we don't need to clone the child\n if (referenceElement) return childProp\n\n if (!childProp) return null\n\n return cloneElement(childProp, {ref: setReference})\n }, [childProp, referenceElement, setReference])","cloneElement(childProp, {ref: setReference})","() => update","[update]","childProp || <></>","modal && <ViewportOverlay />","<PopoverCard\n {...restProps}\n __unstable_margins={margins}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n constrainSize={constrainSize}\n hidden={referenceHidden}\n matchReferenceWidth={matchReferenceWidth}\n maxWidth={maxWidth}\n overflow={overflow}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n originX={originX}\n originY={originY}\n strategy={strategy}\n tone={tone}\n width={width}\n x={x}\n y={y}\n >\n {content}\n </PopoverCard>","<LayerProvider zOffset={zOffset}>\n {/* Optional transparent blocking overlay at the top-most z-index layer. Must be positioned before the below popover card. */}\n {modal && <ViewportOverlay />}\n\n <PopoverCard\n {...restProps}\n __unstable_margins={margins}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n constrainSize={constrainSize}\n hidden={referenceHidden}\n matchReferenceWidth={matchReferenceWidth}\n maxWidth={maxWidth}\n overflow={overflow}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n originX={originX}\n originY={originY}\n strategy={strategy}\n tone={tone}\n width={width}\n x={x}\n y={y}\n >\n {content}\n </PopoverCard>\n </LayerProvider>","portal ? (\n <Portal __unstable_name={typeof portal === 'string' ? portal : undefined}>{popover}</Portal>\n ) : (\n popover\n )","animate ? (\n <AnimateActivity layoutMode=\"default\" mode={open ? 'visible' : 'hidden'}>\n {shouldRender ? popoverNode : null}\n </AnimateActivity>\n ) : (\n <Activity mode={open ? 'visible' : 'hidden'}>{shouldRender ? popoverNode : null}</Activity>\n )","<>\n {/* the popover (not rendered until it opens or is about to, see `hasRendered`) */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={open ? 'visible' : 'hidden'}>\n {shouldRender ? popoverNode : null}\n </AnimateActivity>\n ) : (\n <Activity mode={open ? 'visible' : 'hidden'}>{shouldRender ? popoverNode : null}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>","() => {\n if (!open || !element) return undefined\n\n // Measuring the boundary is what this effect is for: the DOM is only measurable after the\n // commit, and the result has to be in the next paint\n // oxlint-disable-next-line react/set-state-in-effect\n setSize((prev) => sameSize(prev, measureBorderBox(element)))\n\n return _elementSizeObserver.subscribe(element, ({border}) =>\n setSize((prev) =>\n sameSize(prev, {width: Math.round(border.width), height: Math.round(border.height)}),\n ),\n )\n }","[element, open]","{border}","prev","{\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n constrainSize: boolean\n fallbackPlacements: Placement[]\n floatingBoundary: HTMLElement | null\n margins: PopoverMargins\n matchReferenceWidth: boolean | undefined\n maxWidth: number | undefined\n placementProp: Placement\n placementStrategy: 'flip' | 'autoPlacement'\n preventOverflow: boolean\n referenceBoundary: HTMLElement | null\n rootBoundary: RootBoundary\n}","const ret: Middleware[] = []","autoPlacement({\n allowedPlacements: [placementProp].concat(fallbackPlacements),\n })","floatingBoundary || undefined","flip({\n boundary: floatingBoundary || undefined,\n fallbackPlacements,\n padding: DEFAULT_POPOVER_PADDING,\n rootBoundary,\n })","offset({mainAxis: DEFAULT_POPOVER_DISTANCE})","constrainSize ? maxWidth : undefined","size({\n boundaryElement: floatingBoundary || undefined,\n constrainSize,\n margins,\n matchReferenceWidth,\n // The card renders the cap unless `constrainSize`: no reason to change the middleware then\n maxWidth: constrainSize ? maxWidth : undefined,\n padding: DEFAULT_POPOVER_PADDING,\n })","shift({\n boundary: floatingBoundary || undefined,\n rootBoundary,\n padding: DEFAULT_POPOVER_PADDING,\n })","arrow({\n element: arrowRef,\n padding: DEFAULT_POPOVER_PADDING,\n })","referenceBoundary || undefined","hide({\n boundary: referenceBoundary || undefined,\n padding: DEFAULT_POPOVER_PADDING,\n strategy: 'referenceHidden',\n })","useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n if (constrainSize || preventOverflow) {\n if (placementStrategy === 'autoPlacement') {\n ret.push(\n autoPlacement({\n allowedPlacements: [placementProp].concat(fallbackPlacements),\n }),\n )\n } else {\n ret.push(\n flip({\n boundary: floatingBoundary || undefined,\n fallbackPlacements,\n padding: DEFAULT_POPOVER_PADDING,\n rootBoundary,\n }),\n )\n }\n }\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_POPOVER_DISTANCE}))\n\n // Track sizes\n if (constrainSize || matchReferenceWidth) {\n ret.push(\n size({\n boundaryElement: floatingBoundary || undefined,\n constrainSize,\n margins,\n matchReferenceWidth,\n // The card renders the cap unless `constrainSize`: no reason to change the middleware then\n maxWidth: constrainSize ? maxWidth : undefined,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Shift the popover so its sits within the boundary element\n if (preventOverflow) {\n ret.push(\n shift({\n boundary: floatingBoundary || undefined,\n rootBoundary,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Place arrow\n if (arrowProp) {\n ret.push(\n arrow({\n element: arrowRef,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n ret.push(\n hide({\n boundary: referenceBoundary || undefined,\n padding: DEFAULT_POPOVER_PADDING,\n strategy: 'referenceHidden',\n }),\n )\n\n return ret\n }, [\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n ])","_jsx","childRef","_Fragment","\"top\"","\"bottom\"","\"left\"","\"right\""],"sources":["../src/core/primitives/popover/constants.ts","../src/core/primitives/popover/floating-ui/size.ts","../src/core/primitives/popover/helpers.ts","../src/core/primitives/popover/popoverCard.tsx","../src/core/primitives/popover/popover.tsx"],"sourcesContent":["import {Placement} from '../../types/placement'\nimport {PopoverMargins} from '../../types/popover'\n\nexport const DEFAULT_POPOVER_DISTANCE = 4\nexport const DEFAULT_POPOVER_PADDING = 4\nexport const DEFAULT_POPOVER_ARROW_WIDTH = 19\nexport const DEFAULT_POPOVER_ARROW_HEIGHT = 8\nexport const DEFAULT_POPOVER_ARROW_RADIUS = 2\nexport const DEFAULT_POPOVER_MARGINS: PopoverMargins = [0, 0, 0, 0]\nexport const DEFAULT_FALLBACK_PLACEMENTS: Record<Placement, Placement[]> = {\n 'top': ['bottom', 'left', 'right'],\n 'top-start': ['bottom-start', 'left-start', 'right-start'],\n 'top-end': ['bottom-end', 'left-end', 'right-end'],\n 'bottom': ['top', 'left', 'right'],\n 'bottom-start': ['top-start', 'left-start', 'right-start'],\n 'bottom-end': ['top-end', 'left-end', 'right-end'],\n 'left': ['right', 'top', 'bottom'],\n 'left-start': ['right-start', 'top-start', 'bottom-start'],\n 'left-end': ['right-end', 'top-end', 'bottom-end'],\n 'right': ['left', 'top', 'bottom'],\n 'right-start': ['left-start', 'top-start', 'bottom-start'],\n 'right-end': ['left-end', 'top-end', 'bottom-end'],\n}\n","import {detectOverflow, Middleware} from '@floating-ui/react-dom'\n\nimport {PopoverMargins} from '../../../types/popover'\n\nexport function size(options: {\n boundaryElement?: HTMLElement | null\n constrainSize: boolean\n margins: PopoverMargins\n matchReferenceWidth?: boolean\n maxWidth: number | undefined\n padding?: number\n}): Middleware {\n const {constrainSize, margins, matchReferenceWidth, padding = 0} = options\n\n return {\n name: '@sanity/ui/size',\n // `useFloating` compares middleware deeply and functions by their source text, so without its\n // `options` it would keep running this middleware with outdated ones\n options,\n async fn(args) {\n const {elements, placement, platform, rects} = args\n const {floating, reference} = rects\n\n const overflow = await detectOverflow(args, {\n altBoundary: true,\n boundary: options.boundaryElement || undefined,\n elementContext: 'floating',\n padding,\n rootBoundary: 'viewport',\n })\n\n let maxWidth = Infinity\n let maxHeight = Infinity\n\n const floatingW = floating.width\n const floatingH = floating.height\n\n if (placement.includes('top')) {\n maxWidth = floatingW - (overflow.left + overflow.right)\n maxHeight = floatingH - overflow.top\n }\n\n if (placement.includes('right')) {\n maxWidth = floatingW - overflow.right\n maxHeight = floatingH - (overflow.top + overflow.bottom)\n }\n\n if (placement.includes('bottom')) {\n maxWidth = floatingW - (overflow.left + overflow.right)\n maxHeight = floatingH - overflow.bottom\n }\n\n if (placement.includes('left')) {\n maxWidth = floatingW - overflow.left\n maxHeight = floatingH - (overflow.top + overflow.bottom)\n }\n\n // IMPORTANT – APPLY ELEMENT STYLES HERE\n // Elements need to be resized BEFORE the `platform.getDimensions` call below, and never to a\n // negative size: CSS ignores a negative length, keeping the previous one\n const availableWidth = maxWidth - margins[1] - margins[3]\n const availableHeight = maxHeight - margins[0] - margins[2]\n const referenceWidth = Math.max(0, reference.width - margins[1] - margins[3])\n\n if (matchReferenceWidth) {\n elements.floating.style.width = `${referenceWidth}px`\n }\n\n if (constrainSize) {\n // No room at all means the popover lies outside the area it is measured in, like a submenu\n // beside the scrolling menu its reference is in: a max size of zero would collapse it\n const constrainedWidth = Math.min(\n availableWidth > 0 ? availableWidth : Infinity,\n options.maxWidth ?? Infinity,\n )\n\n elements.floating.style.maxWidth = Number.isFinite(constrainedWidth)\n ? `${constrainedWidth}px`\n : ''\n\n elements.floating.style.maxHeight = availableHeight > 0 ? `${availableHeight}px` : ''\n }\n\n const nextDimensions = await platform.getDimensions(elements.floating)\n\n const targetH = nextDimensions.height\n const targetW = nextDimensions.width\n\n if (floatingW !== targetW || floatingH !== targetH) {\n return {reset: {rects: true}}\n }\n\n return {}\n },\n }\n}\n","import {DEFAULT_POPOVER_PADDING} from './constants'\nimport {PopoverWidth} from './types'\n\nexport function calcCurrentWidth(params: {\n mediaIndex: number\n container: number[]\n width: PopoverWidth[]\n}): number | undefined {\n const {container, mediaIndex, width} = params\n\n const w = width[mediaIndex]\n const currentWidth: PopoverWidth | undefined = w === undefined ? width[width.length - 1] : w\n\n return typeof currentWidth === 'number' ? container[currentWidth] : undefined\n}\n\nexport function calcMaxWidth(params: {\n boundaryWidth: number | undefined\n currentWidth: number | undefined\n}): number | undefined {\n const {boundaryWidth, currentWidth} = params\n\n const maxWidth = Math.min(\n currentWidth ?? Infinity,\n (boundaryWidth || Infinity) - DEFAULT_POPOVER_PADDING * 2,\n )\n\n // Also uncapped for a boundary of width `0` (collapsed, or `display: none`), and never negative\n // for one narrower than the padding: CSS ignores a negative length, keeping the previous cap\n return Number.isFinite(maxWidth) ? Math.max(0, maxWidth) : undefined\n}\n","import {Strategy} from '@floating-ui/react-dom'\nimport {motion} from 'motion/react'\nimport React, {CSSProperties, useMemo} from 'react'\nimport {styled} from 'styled-components'\n\nimport {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {POPOVER_MOTION_PROPS} from '../../constants'\nimport {getTransformOrigin} from '../../middleware/origin'\nimport {BoxOverflow} from '../../types/box'\nimport {CardTone} from '../../types/card'\nimport {Placement} from '../../types/placement'\nimport {PopoverMargins} from '../../types/popover'\nimport {Radius} from '../../types/radius'\nimport {Arrow} from '../../utils/arrow/arrow'\nimport {useLayer} from '../../utils/layer/useLayer'\nimport {Card} from '../card/card'\nimport {Flex} from '../flex/flex'\nimport {\n DEFAULT_POPOVER_ARROW_HEIGHT,\n DEFAULT_POPOVER_ARROW_RADIUS,\n DEFAULT_POPOVER_ARROW_WIDTH,\n DEFAULT_POPOVER_MARGINS,\n} from './constants'\n\nconst MotionCard = styled(motion.create(Card))`\n &:not([hidden]) {\n display: flex;\n }\n flex-direction: column;\n width: max-content;\n min-width: min-content;\n will-change: transform;\n`\n\n/**\n * @internal\n */\nexport function PopoverCard(\n props: {\n /** @beta*/\n __unstable_margins?: PopoverMargins\n animate?: boolean\n arrow: boolean\n arrowRef: React.Ref<HTMLDivElement>\n arrowX?: number\n arrowY?: number\n constrainSize?: boolean\n matchReferenceWidth?: boolean\n maxWidth: number | undefined\n originX?: number\n originY?: number\n overflow?: BoxOverflow\n padding?: number | number[]\n placement: Placement\n radius?: Radius | Radius[]\n scheme?: ThemeColorSchemeKey\n shadow?: number | number[]\n strategy: Strategy\n tone: CardTone\n width: number | undefined\n x: number | null\n y: number | null\n } & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,\n) {\n const {\n __unstable_margins: marginsProp,\n animate,\n arrow,\n arrowRef,\n arrowX,\n arrowY,\n children,\n constrainSize,\n matchReferenceWidth,\n maxWidth,\n padding,\n placement,\n originX,\n originY,\n overflow,\n radius,\n ref,\n scheme,\n shadow,\n strategy,\n style,\n tone,\n width,\n x: xProp,\n y: yProp,\n ...restProps\n } = props\n\n const {zIndex} = useLayer()\n\n // Get margins: [top, right, bottom, left]\n const margins: PopoverMargins = useMemo(\n () => marginsProp || DEFAULT_POPOVER_MARGINS,\n [marginsProp],\n )\n\n // Translate according to margins\n const x = (xProp ?? 0) + margins[3]\n const y = (yProp ?? 0) + margins[0]\n\n const rootStyle: CSSProperties = useMemo(\n () => ({\n left: x,\n position: strategy,\n top: y,\n transformOrigin: getTransformOrigin(originX, originY),\n zIndex,\n willChange: animate ? 'transform' : undefined,\n ...style,\n // The `size` middleware writes these to the element while it owns them (React leaves a style\n // it keeps rendering as `undefined` alone), and `''` clears its write once React owns them\n maxHeight: constrainSize ? undefined : (style?.maxHeight ?? ''),\n maxWidth: constrainSize ? undefined : (maxWidth ?? style?.maxWidth ?? ''),\n width: matchReferenceWidth ? undefined : (width ?? style?.width ?? ''),\n }),\n [\n animate,\n constrainSize,\n matchReferenceWidth,\n maxWidth,\n originX,\n originY,\n strategy,\n style,\n width,\n x,\n y,\n zIndex,\n ],\n )\n\n const arrowStyle: CSSProperties = useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )\n\n return (\n <MotionCard\n data-ui=\"Popover\"\n {...restProps}\n data-placement={placement}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n sizing=\"border\"\n style={rootStyle}\n tone={tone}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n <Flex data-ui=\"Popover__wrapper\" direction=\"column\" flex={1} overflow={overflow}>\n <Flex direction=\"column\" flex={1} padding={padding}>\n {children}\n </Flex>\n </Flex>\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_POPOVER_ARROW_WIDTH}\n height={DEFAULT_POPOVER_ARROW_HEIGHT}\n radius={DEFAULT_POPOVER_ARROW_RADIUS}\n />\n )}\n </MotionCard>\n )\n}\n","import {\n arrow,\n autoPlacement,\n autoUpdate,\n flip,\n hide,\n Middleware,\n offset,\n RootBoundary,\n shift,\n useFloating,\n} from '@floating-ui/react-dom'\nimport {\n Activity,\n cloneElement,\n type Ref,\n startTransition,\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {useLatestRef} from '../../hooks/useLatestRef'\nimport {useMediaIndex} from '../../hooks/useMediaIndex/useMediaIndex'\nimport {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'\nimport {useReferenceElement} from '../../hooks/useReferenceElement'\nimport {origin} from '../../middleware/origin'\nimport {_elementSizeObserver, ElementRectValue} from '../../observers/elementSizeObserver'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {BoxOverflow} from '../../types/box'\nimport {CardTone} from '../../types/card'\nimport {Placement} from '../../types/placement'\nimport {PopoverMargins} from '../../types/popover'\nimport {AnimateActivity} from '../../utils/animateActivity'\nimport {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'\nimport {getElementRef} from '../../utils/getElementRef'\nimport {LayerProps} from '../../utils/layer/layer'\nimport {LayerProvider} from '../../utils/layer/layerProvider'\nimport {useLayer} from '../../utils/layer/useLayer'\nimport {Portal} from '../../utils/portal/portal'\nimport {ResponsiveRadiusProps, ResponsiveShadowProps} from '../types'\nimport {\n DEFAULT_FALLBACK_PLACEMENTS,\n DEFAULT_POPOVER_DISTANCE,\n DEFAULT_POPOVER_MARGINS,\n DEFAULT_POPOVER_PADDING,\n} from './constants'\nimport {size} from './floating-ui/size'\nimport {calcCurrentWidth, calcMaxWidth} from './helpers'\nimport {PopoverCard} from './popoverCard'\nimport {PopoverUpdateCallback, PopoverWidth} from './types'\n\n/** @public */\nexport interface PopoverProps\n extends Omit<LayerProps, 'as'>, ResponsiveRadiusProps, ResponsiveShadowProps {\n /** @beta */\n __unstable_margins?: PopoverMargins\n /**\n * Whether the popover should animate in and out.\n *\n * @beta\n * @defaultValue false\n */\n animate?: boolean\n arrow?: boolean\n /** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */\n boundaryElement?: never\n children?: React.JSX.Element\n /**\n * When `true`, prevent overflow within the current boundary:\n * - by flipping on its side axis\n * - by resizing\n /*\n * Note that:\n * - setting `preventOverflow` to `true` also prevents overflow on its side axis\n * - setting `matchReferenceWidth` to `true` also causes the popover to resize\n *\n * @defaultValue false\n */\n constrainSize?: boolean\n content?: React.ReactNode\n disabled?: boolean\n fallbackPlacements?: Placement[]\n floatingBoundary?: HTMLElement | null\n /**\n * When `true`, set the maximum width to match the reference element, and also prevent overflow within\n * the current boundary by resizing.\n *\n * Note that setting `constrainSize` to `true` also causes the popover to resize\n *\n * @defaultValue false\n */\n matchReferenceWidth?: boolean\n /**\n * When true, blocks all pointer interaction with elements beneath the popover until closed.\n *\n * @beta\n * @defaultValue false\n */\n modal?: boolean\n /**\n * Whether the popover is open.\n *\n * Set it inside `startTransition`. A closed popover pre-renders its content hidden, in a\n * transition, once the reference element shows intent to open it (focus, a pointer entering or\n * pressing it). Opening in a transition too lets React keep rendering that content in the\n * background when the open comes before it is done, instead of rendering it synchronously in the\n * click. Content that was pre-rendered already shows in the first frame after the click either\n * way.\n *\n * ```tsx\n * const [open, setOpen] = useState(false)\n *\n * <Popover content={content} open={open}>\n * <Button onClick={() => startTransition(() => setOpen((isOpen) => !isOpen))} text=\"Toggle\" />\n * </Popover>\n * ```\n *\n * Wrap the state update itself: a `startTransition` around code that schedules the update for\n * later (a timeout) does not reach it.\n */\n open?: boolean\n overflow?: BoxOverflow\n padding?: number | number[]\n placement?: Placement\n /**\n * When 'flip' (default), the placement is determined from the initial placement and the\n * fallback placements in order. Whichever fits in the viewport first.\n *\n * When 'autoPlacement', the initial placement and all fallback placements are evaluated\n * and the placement with the most viewport space available.\n *\n * Option is only relevant if either `constrainSize` or `preventOverflow` is `true`\n */\n placementStrategy?: 'flip' | 'autoPlacement'\n /** Whether or not to render the popover in a portal element. */\n portal?: boolean | string\n preventOverflow?: boolean\n referenceBoundary?: HTMLElement | null\n /**\n * When defined, the popover will be positioned relative to this element.\n * The children of the popover won't be rendered.\n */\n referenceElement?: HTMLElement | null\n scheme?: ThemeColorSchemeKey\n tone?: CardTone\n /** @beta */\n updateRef?: Ref<PopoverUpdateCallback | undefined>\n width?: PopoverWidth | PopoverWidth[]\n}\n\n/**\n * The events on the reference element that count as intent to open the popover. Each precedes the\n * interaction that usually opens a popover: focus before a key press, the pointer entering before\n * a click or a tap.\n */\nconst INTENT_EVENT_TYPES = ['focusin', 'pointerenter', 'pointerdown'] as const\n\n/** Calls `handleIntent` on intent to open the popover, until the returned function is called */\nfunction listenForIntent(element: HTMLElement | null, handleIntent: () => void): () => void {\n if (!element) return () => {}\n\n const controller = new AbortController()\n const {signal} = controller\n\n // `focusin` rather than `focus` so that focus landing inside the reference element counts too.\n // `pointerdown` is a fallback for a pointer that was already over the element when it\n // rendered, which fires no `pointerenter`.\n for (const type of INTENT_EVENT_TYPES) {\n element.addEventListener(type, handleIntent, {signal})\n }\n\n // Focus that landed before the listeners did (an `autoFocus` reference, a `referenceElement`\n // that was focused already) fired its `focusin` unheard, so count it now\n const {activeElement} = element.ownerDocument\n\n if (activeElement && element.contains(activeElement)) handleIntent()\n\n return () => controller.abort()\n}\n\n/**\n * Listens for intent on the cloned child's element from the moment it attaches, until it detaches\n * or the popover has rendered. Returns the callback for `useReferenceElement` to attach with.\n *\n * The node is null when the child forwards a ref with nothing mounted, and when that ref later\n * clears. Null and a swap onto another element both stop whatever was already listening. A child\n * may report the next node without running the previous cleanup. Null attaches nothing.\n */\nfunction useChildIntent(\n shouldRender: boolean,\n handleIntent: () => void,\n): (node: HTMLElement | null) => () => void {\n const shouldRenderRef = useLatestRef(shouldRender)\n const stopRef = useRef<(() => void) | null>(null)\n\n useEffect(() => {\n if (shouldRender) stopListening(stopRef)\n }, [shouldRender])\n\n return useCallback(\n (node: HTMLElement | null) => {\n stopListening(stopRef)\n\n if (node && !shouldRenderRef.current) stopRef.current = listenForIntent(node, handleIntent)\n\n return () => stopListening(stopRef)\n },\n [handleIntent, shouldRenderRef],\n )\n}\n\nfunction stopListening(stopRef: React.RefObject<(() => void) | null>) {\n stopRef.current?.()\n stopRef.current = null\n}\n\nconst ViewportOverlay = () => {\n const {zIndex} = useLayer()\n\n return (\n <div\n data-ui=\"PopoverOverlay\"\n style={{height: '100vh', inset: 0, position: 'fixed', width: '100vw', zIndex}}\n />\n )\n}\n\n/**\n * The `Popover` component is used to display some content on top of another.\n *\n * @public\n */\nexport function Popover(\n props: PopoverProps &\n Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width'>,\n): React.JSX.Element {\n const {container, layer} = useTheme_v2()\n const boundaryElementContext = useBoundaryElement()\n\n const {\n __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,\n animate: _animate = false,\n arrow: arrowProp = false,\n children: childProp,\n constrainSize = false,\n content,\n disabled,\n fallbackPlacements: _fallbackPlacements,\n matchReferenceWidth,\n floatingBoundary: _floatingBoundary,\n modal,\n // oxlint-disable-next-line no-unused-vars\n onActivate,\n open,\n overflow = 'hidden',\n padding: paddingProp,\n placement: placementProp = 'bottom',\n placementStrategy = 'flip',\n portal,\n preventOverflow = true,\n radius: radiusProp = 3,\n ref: forwardedRef,\n referenceBoundary: _referenceBoundary,\n referenceElement,\n scheme,\n shadow: shadowProp = 3,\n tone = 'inherit',\n width: widthProp = 'auto',\n zOffset: _zOffsetProp,\n updateRef,\n ...restProps\n } = props\n const fallbackPlacements =\n _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom']\n const floatingBoundary = _floatingBoundary ?? boundaryElementContext.element\n const referenceBoundary = _referenceBoundary ?? boundaryElementContext.element\n // Max-width uses BoundaryElementProvider when present; otherwise the floating\n // boundary (same element the old `boundaryElement` prop used for both).\n const boundaryElement = boundaryElementContext.element ?? floatingBoundary\n const zOffsetProp = _zOffsetProp ?? layer.popover.zOffset\n const prefersReducedMotion = usePrefersReducedMotion()\n const animate = prefersReducedMotion ? false : _animate\n\n // Opening renders the popover whether or not any intent preceded it. A `disabled` popover\n // renders only its child, so neither `open` nor intent counts while it is disabled: otherwise\n // enabling it later would render it hidden without it ever having opened or been about to.\n const isOpen = Boolean(open) && !disabled\n\n const boundarySize = useBoundarySize(boundaryElement, isOpen)\n const padding = _getArrayProp(paddingProp)\n const radius = _getArrayProp(radiusProp)\n const shadow = _getArrayProp(shadowProp)\n const widthArrayProp = _getArrayProp(widthProp)\n const zOffset = _getArrayProp(zOffsetProp)\n const ref = useRef<HTMLDivElement | null>(null)\n const arrowRef = useRef<HTMLDivElement | null>(null)\n const rootBoundary: RootBoundary = 'viewport'\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n const mediaIndex = useMediaIndex()\n const boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : undefined\n\n // Update width when\n // - media index changes\n // - `width` property changes\n const width = calcCurrentWidth({\n container,\n mediaIndex,\n width: widthArrayProp,\n })\n\n // Update max width when\n // - boundary width changes\n // - `width` property changes\n const maxWidth = calcMaxWidth({boundaryWidth, currentWidth: width})\n\n const middleware = useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n })\n\n const {x, y, middlewareData, placement, refs, strategy, update} = useFloating<HTMLElement>({\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: referenceElement\n ? {\n reference: referenceElement,\n }\n : undefined,\n })\n\n // Whether the popover (card, portal and `content`) has been rendered yet. Closed popovers\n // render inside a hidden `<Activity>`, so whatever is rendered while closed is pre-rendered DOM\n // that only pays off if the popover opens. Nothing is rendered until the popover opens or the\n // reference element shows intent to open it (see `INTENT_EVENT_TYPES`), and from then on it\n // stays rendered so the state of its `content` survives reopening. Consumers that do not want\n // a popover pre-rendered on intent can leave `content` empty until it opens.\n const [hasRendered, setHasRendered] = useState(false)\n\n if (isOpen && !hasRendered) setHasRendered(true)\n\n const shouldRender = isOpen || hasRendered\n // The element to listen to for intent to open the popover: none once the popover has rendered,\n // since there is nothing left to pre-render, and none while disabled, which also drops the\n // listeners of a popover that was enabled before. A cloned child is listened to from the moment\n // it attaches instead (see `useChildIntent`), and a disabled popover does not clone it.\n const intentReference = shouldRender || disabled ? null : referenceElement\n // In a transition, so that it never holds up an open that follows right away (a click), and so\n // that React pre-renders the hidden popover in the background\n const handleIntent = useCallback(() => startTransition(() => setHasRendered(true)), [])\n\n useEffect(() => {\n if (!intentReference) return undefined\n\n return listenForIntent(intentReference, handleIntent)\n }, [handleIntent, intentReference])\n\n const listenForChildIntent = useChildIntent(shouldRender, handleIntent)\n\n const referenceHidden = middlewareData.hide?.referenceHidden\n\n const arrowX = middlewareData.arrow?.x\n const arrowY = middlewareData.arrow?.y\n\n const originX = middlewareData['@sanity/ui/origin']?.originX\n const originY = middlewareData['@sanity/ui/origin']?.originY\n\n const setArrow = useCallback((arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n }, [])\n\n // With a `referenceElement` the child is not cloned and keeps its ref to itself\n const childRef =\n childProp && !referenceElement ? getElementRef<HTMLElement>(childProp) : undefined\n const {handOverReference, setReference} = useReferenceElement(\n refs,\n childRef,\n listenForChildIntent,\n )\n\n const setFloating = useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n if (node) handOverReference()\n refs.setFloating(node)\n },\n [handOverReference, refs],\n )\n\n const child = useMemo(() => {\n // If a reference element is defined, we don't need to clone the child\n if (referenceElement) return childProp\n\n if (!childProp) return null\n\n return cloneElement(childProp, {ref: setReference})\n }, [childProp, referenceElement, setReference])\n\n useImperativeHandle(updateRef, () => update, [update])\n\n if (disabled) {\n return childProp || <></>\n }\n\n const popover = (\n <LayerProvider zOffset={zOffset}>\n {/* Optional transparent blocking overlay at the top-most z-index layer. Must be positioned before the below popover card. */}\n {modal && <ViewportOverlay />}\n\n <PopoverCard\n {...restProps}\n __unstable_margins={margins}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n constrainSize={constrainSize}\n hidden={referenceHidden}\n matchReferenceWidth={matchReferenceWidth}\n maxWidth={maxWidth}\n overflow={overflow}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n originX={originX}\n originY={originY}\n strategy={strategy}\n tone={tone}\n width={width}\n x={x}\n y={y}\n >\n {content}\n </PopoverCard>\n </LayerProvider>\n )\n\n const popoverNode = portal ? (\n <Portal __unstable_name={typeof portal === 'string' ? portal : undefined}>{popover}</Portal>\n ) : (\n popover\n )\n\n return (\n <>\n {/* the popover (not rendered until it opens or is about to, see `hasRendered`) */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={open ? 'visible' : 'hidden'}>\n {shouldRender ? popoverNode : null}\n </AnimateActivity>\n ) : (\n <Activity mode={open ? 'visible' : 'hidden'}>{shouldRender ? popoverNode : null}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>\n )\n}\n\n/**\n * The border-box size of the boundary element in whole pixels, tracked only while the popover is\n * open.\n *\n * Closed popovers have nothing to size, so they hold no `ResizeObserver` subscription and do not\n * re-render when the boundary resizes (one subscription per popover, every closed popover\n * re-rendering on every boundary resize, is what this replaces). The boundary is measured\n * synchronously in a layout effect when the popover opens, so the max width is right in the first\n * painted frame instead of one `ResizeObserver` callback later; the shared observer takes over\n * from there. The last size is kept while closed.\n *\n * Both measurements are rounded to whole pixels so that they agree: the observer's first delivery\n * must not change the size the opening commit measured, or the max width would be corrected a\n * frame later after all. See `measureBorderBox`.\n */\nfunction useBoundarySize(element: HTMLElement | null, open: boolean): ElementRectValue | undefined {\n const [size, setSize] = useState<ElementRectValue | undefined>(undefined)\n\n useLayoutEffect(() => {\n if (!open || !element) return undefined\n\n // Measuring the boundary is what this effect is for: the DOM is only measurable after the\n // commit, and the result has to be in the next paint\n // oxlint-disable-next-line react/set-state-in-effect\n setSize((prev) => sameSize(prev, measureBorderBox(element)))\n\n return _elementSizeObserver.subscribe(element, ({border}) =>\n setSize((prev) =>\n sameSize(prev, {width: Math.round(border.width), height: Math.round(border.height)}),\n ),\n )\n }, [element, open])\n\n return size\n}\n\n/**\n * The border-box size of an element in whole pixels, the way `_elementSizeObserver` reports it:\n * from `ResizeObserverEntry.borderBoxSize`, which is the layout size with no CSS transform or\n * `zoom` applied, in the element's writing mode (`inlineSize` as `width`, `blockSize` as\n * `height`), rounded by `useBoundarySize`. `offsetWidth`/`offsetHeight` are that same untransformed\n * border box rounded to whole pixels. `getBoundingClientRect` would include transforms (a boundary\n * mid scale animation) and `zoom`, and `getComputedStyle` serializes lengths with limited\n * precision, so neither agrees with the observer for every element.\n *\n * Kept at module scope on purpose: reading the offset size forces a synchronous layout, and the\n * React Compiler (which the package build runs) lifts a member expression on an element captured\n * by a component callback into a memo dependency evaluated during render. A plain function call\n * on the element gives it nothing to lift.\n */\nfunction measureBorderBox(element: HTMLElement): ElementRectValue {\n const {offsetWidth, offsetHeight} = element\n\n if (getComputedStyle(element).writingMode.startsWith('horizontal')) {\n return {width: offsetWidth, height: offsetHeight}\n }\n\n // In a vertical writing mode the inline size is the physical height\n return {width: offsetHeight, height: offsetWidth}\n}\n\n/** Keeps the previous object when the size has not changed, so `setState` bails out */\nfunction sameSize(prev: ElementRectValue | undefined, next: ElementRectValue): ElementRectValue {\n return prev && prev.width === next.width && prev.height === next.height ? prev : next\n}\n\nfunction useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n constrainSize: boolean\n fallbackPlacements: Placement[]\n floatingBoundary: HTMLElement | null\n margins: PopoverMargins\n matchReferenceWidth: boolean | undefined\n maxWidth: number | undefined\n placementProp: Placement\n placementStrategy: 'flip' | 'autoPlacement'\n preventOverflow: boolean\n referenceBoundary: HTMLElement | null\n rootBoundary: RootBoundary\n}) {\n return useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n if (constrainSize || preventOverflow) {\n if (placementStrategy === 'autoPlacement') {\n ret.push(\n autoPlacement({\n allowedPlacements: [placementProp].concat(fallbackPlacements),\n }),\n )\n } else {\n ret.push(\n flip({\n boundary: floatingBoundary || undefined,\n fallbackPlacements,\n padding: DEFAULT_POPOVER_PADDING,\n rootBoundary,\n }),\n )\n }\n }\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_POPOVER_DISTANCE}))\n\n // Track sizes\n if (constrainSize || matchReferenceWidth) {\n ret.push(\n size({\n boundaryElement: floatingBoundary || undefined,\n constrainSize,\n margins,\n matchReferenceWidth,\n // The card renders the cap unless `constrainSize`: no reason to change the middleware then\n maxWidth: constrainSize ? maxWidth : undefined,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Shift the popover so its sits within the boundary element\n if (preventOverflow) {\n ret.push(\n shift({\n boundary: floatingBoundary || undefined,\n rootBoundary,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Place arrow\n if (arrowProp) {\n ret.push(\n arrow({\n element: arrowRef,\n padding: DEFAULT_POPOVER_PADDING,\n }),\n )\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n ret.push(\n hide({\n boundary: referenceBoundary || undefined,\n padding: DEFAULT_POPOVER_PADDING,\n strategy: 'referenceHidden',\n }),\n )\n\n return ret\n }, [\n animate,\n arrowProp,\n arrowRef,\n constrainSize,\n fallbackPlacements,\n floatingBoundary,\n margins,\n matchReferenceWidth,\n maxWidth,\n placementProp,\n placementStrategy,\n preventOverflow,\n referenceBoundary,\n rootBoundary,\n ])\n}\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,0BAA0C;CAAC;CAAG;CAAG;CAAG;AAAC,GACrD,8BAA8D;CACzEqG,KAAO;EAAC;EAAU;EAAQ;CAAO;CACjC,aAAa;EAAC;EAAgB;EAAc;CAAa;CACzD,WAAW;EAAC;EAAc;EAAY;CAAW;CACjDC,QAAU;EAAC;EAAO;EAAQ;CAAO;CACjC,gBAAgB;EAAC;EAAa;EAAc;CAAa;CACzD,cAAc;EAAC;EAAW;EAAY;CAAW;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;GACW,EAAA,QAAA,W,cADXA,KAAAA,MAAM;IACJ,SAAS;IACT,SAAA;GACF,CAAC,GAFU,EAAA,MAAA,U,aAFb,IAAI,KACFA,EAIF;EACF;EAII,WACF,IAAI,KAAK,MAAM;EAKHC,IAAAA,KAAAA,qBAAqB,KAAA,GADjCC;EACYD,EAAAA,QAAAA,K,cADZC,KAAAA,KAAK;GACH,UAAUD;GACV,SAAA;GACA,UAAU;EACZ,CAAC,GAHWA,EAAAA,MAAAA,I,aAFd,IAAI,KACFC,EAKF,GAVI,EAAA,KAAA,SAXA,EAAA,KAAA,WAGW,EAAA,KAAA,UApDX,EAAA,KAAA,eAI8C,EAAA,KAAA,oBAMhC,EAAA,KAAA,kBAkBZ,EAAA,KAAA,SALe,EAAA,KAAA,qBAQW,EAAA,KAAA,UA3BJ,EAAA,KAAA,eAHtB,EAAA,MAAA,mBADe,EAAA,MAAA,iBAkEP,EAAA,MAAA,mBArDN,EAAA,MAAA,c;;CAjBV,OAAOC;AA6FT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { N as BoxOverflow, m as ResponsiveShadowProps, n as LayerProps, p as ResponsiveRadiusProps, r as Placement } from "./layer-ChlP9Ik6.js";
|
|
2
|
-
import { s as ThemeColorSchemeKey } from "./_system-CTe2lb5l.js";
|
|
3
|
-
import { t as CardTone } from "./card-C0a0wQTc.js";
|
|
4
1
|
import { Ref } from "react";
|
|
2
|
+
import { s as ThemeColorSchemeKey } from "./_system-DjnSx8gA.js";
|
|
3
|
+
import { N as BoxOverflow, m as ResponsiveShadowProps, n as LayerProps, p as ResponsiveRadiusProps, r as Placement } from "./layer-CAyooswI.js";
|
|
4
|
+
import { t as CardTone } from "./card-CEB9JLru.js";
|
|
5
5
|
/**
|
|
6
6
|
* @beta
|
|
7
7
|
*/
|
|
@@ -114,4 +114,4 @@ interface PopoverProps extends Omit<LayerProps, 'as'>, ResponsiveRadiusProps, Re
|
|
|
114
114
|
*/
|
|
115
115
|
declare function Popover(props: PopoverProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width'>): React.JSX.Element;
|
|
116
116
|
export { PopoverMargins as a, PopoverWidth as i, PopoverProps as n, PopoverUpdateCallback as r, Popover as t };
|
|
117
|
-
//# sourceMappingURL=popover-
|
|
117
|
+
//# sourceMappingURL=popover-DpHuX7yr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-
|
|
1
|
+
{"version":3,"file":"popover-DpHuX7yr.d.ts","names":[],"sources":["../src/core/types/popover.ts","../src/core/primitives/popover/types.ts","../src/core/primitives/popover/popover.tsx"],"mappings":";;;;;;;KAGY;;KCFA;;KAIA;;UCsDK,qBACP,KAAK,mBAAmB,uBAAuB;;EAEvD,qBAAqB;;;;;;;EAOrB;EACA;;EAEA;EACA,WAAW,MAAM,IAAI;;;;;;;;;;;;EAYrB;EACA,UAAU,MAAM;EAChB;EACA,qBAAqB;EACrB,mBAAmB;;;;;;;;;EASnB;;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;EAsBA;EACA,WAAW;EACX;EACA,YAAY;;;;;;;;;;EAUZ;;EAEA;EACA;EACA,oBAAoB;;;;;EAKpB,mBAAmB;EACnB,SAAS;EACT,OAAO;;EAEP,YAAY,IAAI;EAChB,QAAQ,eAAe;;;;;;;iBAqFT,QACd,OAAO,eACL,KAAK,MAAM,UAAU,4DACtB,MAAM,IAAI"}
|
package/dist/popover.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PopoverMargins, i as PopoverWidth, n as PopoverProps, r as PopoverUpdateCallback, t as Popover } from "./popover-
|
|
1
|
+
import { a as PopoverMargins, i as PopoverWidth, n as PopoverProps, r as PopoverUpdateCallback, t as Popover } from "./popover-DpHuX7yr.js";
|
|
2
2
|
export { Popover, type PopoverMargins, type PopoverProps, type PopoverUpdateCallback, type PopoverWidth };
|
package/dist/popover.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { t as Popover } from "./popover-
|
|
2
|
+
export { t as Popover } from "./popover-C-YWzo_l.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from "react/compiler-runtime";
|
|
2
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Refractor, hasLanguage } from "react-refractor";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
function LazyRefractor(props) {
|
|
5
5
|
let $ = c(13), { language: languageProp, value } = props, language = typeof languageProp == "string" ? languageProp : void 0, t0;
|
|
6
6
|
$[0] === language ? t0 = $[1] : (t0 = language ? hasLanguage(language) : !1, $[0] = language, $[1] = t0);
|
|
@@ -17,4 +17,4 @@ function LazyRefractor(props) {
|
|
|
17
17
|
}
|
|
18
18
|
export { LazyRefractor as default };
|
|
19
19
|
|
|
20
|
-
//# sourceMappingURL=refractor-
|
|
20
|
+
//# sourceMappingURL=refractor-DeAFUFLp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refractor-DeAFUFLp.js","names":["language ? hasLanguage(language as any) : false","!(language && registered) && <code>{value}</code>","language && registered && <Refractor inline language={language} value={String(value)} />","<>\n {!(language && registered) && <code>{value}</code>}\n {/* oxlint-disable-next-line no-base-to-string */}\n {language && registered && <Refractor inline language={language} value={String(value)} />}\n </>","_jsx"],"sources":["../src/core/primitives/code/refractor.tsx"],"sourcesContent":["import {hasLanguage, Refractor} from 'react-refractor'\n\nexport default function LazyRefractor(\n props: Partial<Pick<React.ComponentProps<typeof Refractor>, 'language'>> & {\n value: React.ReactNode\n },\n) {\n const {language: languageProp, value} = props\n const language = typeof languageProp === 'string' ? languageProp : undefined\n // oxlint-disable-next-line no-unnecessary-type-assertion, no-unsafe-type-assertion\n const registered = language ? hasLanguage(language as any) : false\n\n return (\n <>\n {!(language && registered) && <code>{value}</code>}\n {/* oxlint-disable-next-line no-base-to-string */}\n {language && registered && <Refractor inline language={language} value={String(value)} />}\n </>\n )\n}\n"],"mappings":";;;AAEA,SAAwB,cACtB,OAGA;C,eACM,EAAC,UAAU,cAAc,UAAS,OAClC,WAAW,OAAO,gBAAiB,WAAW,eAAe,KAAA,GAEhDA;C,iCAAW,KAAA,WAAA,YAAY,QAAe,IAAI,IAA1C,EAAA,KAAA,U;CAAnB,IAAM,aAAaA,IAIdC;CAAE,EAAA,OAAA,YAAA,EAAA,OAAY,cAAA,EAAA,OAAsB,SAApCA,KAAAA,EAAE,YAAY,eAAeG,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA,GAA9C,EAAA,KAAA,UAAY,EAAA,KAAA,YAAsB,EAAA,KAAA,O;CAEpCF,IAAAA;CAAY,EAAA,OAAA,YAAA,EAAA,OAAA,cAAA,EAAA,OAAkE,SAA9EA,KAAAA,YAAY,cAAcE,oBAAC,WAAD;EAAW,QAAA;EAAiB;EAAU,OAAO,OAAO,KAAK;CAAI,CAAA,GAAvF,EAAA,KAAA,UAAY,EAAA,KAAA,YAAkE,EAAA,KAAA,O;CAHjFD,IAAAA;CADF,OAEKF,EAAAA,QAAAA,MAAAA,EAAAA,QAEAC,MAHHC,KAAAA,qBAAAA,UAAAA,EAAAA,UAAAA,CACGF,IAEAC,EACD,EAAA,CAAA,GAHCD,EAAAA,MAAAA,IAEAC,EAAAA,MAAAA,I,0BAHHC;AAMJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as getTheme_v2 } from "./getTheme_v2-CP5x_AcH.js";
|
|
2
|
+
import { a as _ruleSet, i as _responsive, o as rem } from "./helpers-jp2T-bdR.js";
|
|
3
3
|
const FONT_BOX_STYLE = {
|
|
4
4
|
padding: "1px 0",
|
|
5
5
|
margin: 0,
|
|
@@ -78,4 +78,4 @@ function fontSize(size) {
|
|
|
78
78
|
}
|
|
79
79
|
export { responsiveFont as i, _fontWeight as n, _responsiveFontSize as r, _fontBase as t };
|
|
80
80
|
|
|
81
|
-
//# sourceMappingURL=responsiveFont-
|
|
81
|
+
//# sourceMappingURL=responsiveFont-CfFXLc7o.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsiveFont-
|
|
1
|
+
{"version":3,"file":"responsiveFont-CfFXLc7o.js","names":["\"padding\"","\"margin\"","\"fontSize\"","\"lineHeight\"","\"letterSpacing\"","\"transform\""],"sources":["../src/core/styles/font/responsiveFont.ts"],"sourcesContent":["import {CSSObject} from '../../../theme/system/css'\nimport {ThemeFontKey, ThemeFontSize} from '../../../theme/system/font'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {_responsive, _ruleSet, rem} from '../helpers'\nimport {ThemeProps} from '../types'\nimport {FontWeightStyleProps, ResponsiveFontSizeStyleProps} from './types'\n\nconst FONT_BOX_STYLE: CSSObject = {\n 'padding': '1px 0',\n 'margin': 0,\n\n '&:before': {\n content: '\"\"',\n display: 'block',\n height: 0,\n },\n\n '&:after': {\n content: '\"\"',\n display: 'block',\n height: 0,\n },\n\n '& > code, & > span': {\n display: 'block',\n },\n\n '&:not([hidden])': {\n display: 'block',\n },\n}\n\n/**\n * A utility function getting responsive font styles.\n * @internal\n */\nexport function responsiveFont(\n fontKey: ThemeFontKey,\n props: FontWeightStyleProps & ResponsiveFontSizeStyleProps & ThemeProps,\n): CSSObject[] {\n const {$size} = props\n const base = {..._fontBase(fontKey, props), ..._fontWeight(fontKey, props)}\n\n // @TODO fix the real condition that is causing $size to be undefined sometimes\n if (!$size) {\n // @ts-expect-error: `warned` isn't typed, the underlying issue should be solved rather than typing it\n if (!responsiveFont.warned) {\n console.warn('No size specified for responsive font', {fontKey, $size, props, base})\n // @ts-expect-error: `warned` isn't typed, the underlying issue should be solved rather than typing it\n responsiveFont.warned = true\n }\n\n return _ruleSet(base)\n }\n\n return _ruleSet(base, _responsiveFontSize(fontKey, props))\n}\n\n/**\n * @internal\n */\nexport function _fontBase(fontKey: ThemeFontKey, props: ThemeProps): CSSObject {\n const {font} = getTheme_v2(props.theme)\n\n return {\n position: 'relative',\n fontFamily: font[fontKey].family,\n ...FONT_BOX_STYLE,\n }\n}\n\n/**\n * @internal\n */\nexport function _fontWeight(\n fontKey: ThemeFontKey,\n props: FontWeightStyleProps & ThemeProps,\n): CSSObject {\n const {weights} = getTheme_v2(props.theme).font[fontKey]\n\n return {fontWeight: `${(props.$weight && weights[props.$weight]) || weights.regular}`}\n}\n\n/**\n * @internal\n */\nexport function _responsiveFontSize(\n fontKey: ThemeFontKey,\n props: ResponsiveFontSizeStyleProps & ThemeProps,\n): CSSObject[] {\n const {font, media} = getTheme_v2(props.theme)\n const {sizes} = font[fontKey]\n\n return _responsive(media, props.$size, (sizeIndex) => fontSize(sizes[sizeIndex] || sizes[2]))\n}\n\nfunction fontSize(size: ThemeFontSize): CSSObject {\n const {ascenderHeight, descenderHeight, fontSize, iconSize, letterSpacing, lineHeight} = size\n const negHeight = ascenderHeight + descenderHeight\n const capHeight = lineHeight - negHeight\n const iconOffset = (capHeight - iconSize) / 2\n const customIconSize = Math.floor((fontSize * 1.125) / 2) * 2 + 1\n const customIconOffset = (capHeight - customIconSize) / 2\n\n return {\n 'fontSize': rem(fontSize),\n 'lineHeight': `calc(${lineHeight} / ${fontSize})`,\n 'letterSpacing': rem(letterSpacing),\n 'transform': `translateY(${rem(descenderHeight)})`,\n\n '&:before': {\n marginTop: `calc(${rem(0 - negHeight)} - 1px)`,\n },\n\n '&:after': {\n marginBottom: '-1px',\n },\n\n '& svg:not([data-sanity-icon])': {\n fontSize: `calc(${customIconSize} / 16 * 1rem)`,\n margin: rem(customIconOffset),\n },\n\n '& [data-sanity-icon]': {\n fontSize: `calc(${iconSize} / 16 * 1rem)`,\n margin: rem(iconOffset),\n },\n }\n}\n"],"mappings":";;AAOA,MAAM,iBAA4B;CAChCA,SAAW;CACXC,QAAU;CAEV,YAAY;EACV,SAAS;EACT,SAAS;EACT,QAAQ;CACV;CAEA,WAAW;EACT,SAA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C/CC,eAAiB,IAAI,aAAa;EAClCC,WAAa,cAAc,IAAI,eAAe,EAAE;EAEhD,YAAY,EACV,WAAW,QAAQ,IAAI,IAAI,SAAS,EAAE,SACxC;EAEA,WAAW,EACT,cAAc,OAChB;EAEA,iCAAiC;GAC/B,UAAU,QAAQ,eAAe;GACjC,QAAQ,IAAI,gBAAgB;EAC9B;EAEA,wBAAwB;GACtB,UAAU,QAAQ,SAAS;GAC3B,QAAQ,IAAI,UAAU;EACxB;CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ThemeColorInputModeKey, c as ThemeColorStateKey, i as ThemeColorCardToneKey, l as ThemeColorStateToneKey, n as ThemeColorBlendModeKey, o as ThemeColorInputStateKey, r as ThemeColorButtonModeKey, s as ThemeColorSchemeKey, t as ThemeColorAvatarColorKey } from "./_system-
|
|
2
|
-
import { a as ThemeFontWeightKey, o as ThemeFonts } from "./font-
|
|
1
|
+
import { a as ThemeColorInputModeKey, c as ThemeColorStateKey, i as ThemeColorCardToneKey, l as ThemeColorStateToneKey, n as ThemeColorBlendModeKey, o as ThemeColorInputStateKey, r as ThemeColorButtonModeKey, s as ThemeColorSchemeKey, t as ThemeColorAvatarColorKey } from "./_system-DjnSx8gA.js";
|
|
2
|
+
import { a as ThemeFontWeightKey, o as ThemeFonts } from "./font-DI_tc5s8.js";
|
|
3
3
|
import * as CSS from "csstype";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -843,4 +843,4 @@ declare function parseColor(color: unknown): RGB | RGBA;
|
|
|
843
843
|
*/
|
|
844
844
|
declare function rgba(color: unknown, a: number): string;
|
|
845
845
|
export { ThemeColorInputState_v2 as $, ThemeColorMutedTone as A, ThemeColorBase as B, ThemeColorSpotKey as C, ThemeColorSelectableState as D, ThemeColorSelectable as E, ThemeColorCardState as F, ThemeInput_v2 as G, ThemeColorToneKey as H, ThemeColorButton as I, ThemeColorSchemes_v2 as J, ThemeColorCard_v2 as K, ThemeColorButtonState as L, ThemeColorInputState as M, ThemeColorInputStates as N, ThemeColorSelectableStates as O, ThemeColorCard as P, ThemeColorInputMode_v2 as Q, ThemeColorButtonStates as R, ThemeColorSpot as S, ThemeColorSolidTone as T, ThemeColorGenericState as U, ThemeColorName as V, ThemeAvatar as W, ThemeColorSelectableTone_v2 as X, ThemeColorShadow as Y, ThemeColorSelectable_v2 as Z, Theme_v2 as _, ThemeColorSyntax as _t, rgbToHex as a, ThemeColorKBD as at, ThemeColorScheme as b, RGBA as bt, screen as c, ThemeColorAvatarHue_v2 as ct, ThemeColorBuilderOpts as d, ThemeFocusRing as dt, ThemeColorInput_v2 as et, createColorTheme as f, ThemeStyles as ft, Theme as g, ThemeLayer as gt, RootTheme_v2 as h, ThemeShadow as ht, hslToRgb as i, ThemeColorState_v2 as it, ThemeColorInput as j, ThemeColorMuted as k, multiply as l, ThemeColorAvatar_v2 as lt, RootTheme as m, ThemeBoxShadow as mt, parseColor as n, ThemeColorButtonTone_v2 as nt, rgbToHsl as o, ThemeColorBadgeTone_v2 as ot, BaseTheme as p, CSSObject as pt, ThemeColorScheme_v2 as q, hexToRgb as r, ThemeColorButton_v2 as rt, rgbaToRGBA as s, ThemeColorBadge_v2 as st, rgba as t, ThemeColorButtonMode_v2 as tt, PartialThemeColorBuilderOpts as u, ThemeAvatar_v2 as ut, ThemeInput as v, HSL as vt, ThemeColorSolid as w, ThemeColorSchemes as x, ThemeColor as y, RGB as yt, ThemeColorButtonTones as z };
|
|
846
|
-
//# sourceMappingURL=rgba-
|
|
846
|
+
//# sourceMappingURL=rgba-Hlu7P1jF.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rgba-
|
|
1
|
+
{"version":3,"file":"rgba-Hlu7P1jF.d.ts","names":[],"sources":["../src/theme/build/lib/color-fns/types.ts","../src/theme/system/color/syntax.ts","../src/theme/system/layer.ts","../src/theme/system/shadow.ts","../src/theme/system/css.ts","../src/theme/system/styles.ts","../src/theme/system/focusRing.ts","../src/theme/system/avatar.ts","../src/theme/system/color/avatar.ts","../src/theme/system/color/badge.ts","../src/theme/system/color/kbd.ts","../src/theme/system/color/state.ts","../src/theme/system/color/button.ts","../src/theme/system/color/input.ts","../src/theme/system/color/selectable.ts","../src/theme/system/color/shadow.ts","../src/theme/system/color/color.ts","../src/theme/system/input.ts","../src/theme/system/v0/avatar.ts","../src/theme/system/v0/color/_generic.ts","../src/theme/system/v0/color/_system.ts","../src/theme/system/v0/color/base.ts","../src/theme/system/v0/color/button.ts","../src/theme/system/v0/color/card.ts","../src/theme/system/v0/color/input.ts","../src/theme/system/v0/color/muted.ts","../src/theme/system/v0/color/selectable.ts","../src/theme/system/v0/color/solid.ts","../src/theme/system/v0/color/spot.ts","../src/theme/system/v0/color/color.ts","../src/theme/system/v0/input.ts","../src/theme/system/theme.ts","../src/theme/build/_deprecated/color/factory.ts","../src/theme/build/lib/color-fns/blend/multiply.ts","../src/theme/build/lib/color-fns/blend/screen.ts","../src/theme/build/lib/color-fns/convert.ts","../src/theme/build/lib/color-fns/parse.ts","../src/theme/build/lib/color-fns/rgba.ts"],"mappings":";;;;;;UAGiB;EACf;EACA;EACA;EACA;;;;;UAMe;EACf;EACA;EACA;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;UCvBe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;UCpCe;EACf;IAAS;;EACT;IAAU;;EACV;IAAU;;;;;;KCHA;;;;UAWK;EACf,OAAO;EACP,UAAU;EACV,SAAS;;;;;;;;;;;UCNM,kBAAkB,IAAI;GACpC,cAAc;;;;;UCPA;EACf;IACE,OAAO;;EAET;IACE,OAAO;;;;;;UCPM;EACf;EACA;;;;;UCAe;EACf;;IAEE;;IAEA;;EAEF,WAAW;;;;;UCPI;EAC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GAAG,MAAM,MAAM,GAAG,MAAM,OAAO;;;;iBCLtC,SAAS,cAAc;;;;iBAuBvB,WAAW,eAAe;;;;iBAc1B,SAAS,OAAO,MAAM;;;;;iBAgBtB,WAAU,GAAG,GAAG,KAAI,MAAM;;;;iBA8C1B,SAAS,KAAK,MAAM;;;;iBClEpB,WAAW,iBAAiB,MAAM;;;;iBClClC,KAAK,gBAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectable-2IHh9SLq.d.ts","names":[],"sources":["../src/core/types/selectable.ts"],"mappings":";;;;KAKY,iBAAiB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as _responsive, n as _getArrayProp, o as rem } from "./helpers-
|
|
2
|
-
import { t as getTheme_v2 } from "./getTheme_v2-
|
|
3
|
-
import { y as Box } from "./useLayer-
|
|
4
|
-
import { n as _fontWeight, r as _responsiveFontSize, t as _fontBase } from "./responsiveFont-
|
|
1
|
+
import { i as _responsive, n as _getArrayProp, o as rem } from "./helpers-jp2T-bdR.js";
|
|
2
|
+
import { t as getTheme_v2 } from "./getTheme_v2-CP5x_AcH.js";
|
|
3
|
+
import { y as Box } from "./useLayer-DiYnwQ5T.js";
|
|
4
|
+
import { n as _fontWeight, r as _responsiveFontSize, t as _fontBase } from "./responsiveFont-CfFXLc7o.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
6
|
import { css, styled } from "styled-components";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -114,4 +114,4 @@ function StackComponent(props) {
|
|
|
114
114
|
const Stack = StackComponent;
|
|
115
115
|
export { fontColorStyle as a, responsiveTextAlignStyle as i, Text as n, SpanWithTextOverflow as r, Stack as t };
|
|
116
116
|
|
|
117
|
-
//# sourceMappingURL=stack-
|
|
117
|
+
//# sourceMappingURL=stack-DFRXALVU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-DFRXALVU.js","names":["<span className={spanWithTextOverflow}>{props.children}</span>","children","accent = false","muted = false","size = 2","...restProps","<SpanWithTextOverflow>{children}</SpanWithTextOverflow>","_getArrayProp(align)","_getArrayProp(size)","<span>{children}</span>","<StyledText\n data-ui=\"Text\"\n {...restProps}\n $accent={accent}\n $align={_getArrayProp(align)}\n $muted={muted}\n ref={ref}\n $size={_getArrayProp(size)}\n $weight={weight}\n >\n <span>{children}</span>\n </StyledText>","...restProps","typeof as === 'string' ? as : undefined","_getArrayProp(gap)","<StyledStack\n data-as={typeof as === 'string' ? as : undefined}\n data-ui=\"Stack\"\n {...restProps}\n $space={_getArrayProp(gap)}\n forwardedAs={as}\n ref={ref}\n />","\"gridTemplateColumns\"","\"gridAutoRows\""],"sources":["../src/core/styles/font/fontColorStyle.ts","../src/core/styles/font/textAlignStyle.ts","../src/core/utils/spanWithTextOverflow.css.ts","../src/core/utils/spanWithTextOverflow.tsx","../src/core/primitives/text/styles.ts","../src/core/primitives/text/text.tsx","../src/core/primitives/stack/styles.ts","../src/core/primitives/stack/stack.tsx"],"sourcesContent":["import {CSSObject} from '../../../theme/system/css'\n\n/**\n * @internal\n */\nexport function fontColorStyle(props: {\n $accent?: boolean\n $muted?: boolean\n}): CSSObject | undefined {\n if (props.$muted) return {color: 'var(--card-muted-fg-color)'}\n if (props.$accent) return {color: 'var(--card-accent-fg-color)'}\n return undefined\n}\n","import {CSSObject} from '../../../theme/system/css'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {_responsive} from '../helpers'\nimport {ThemeProps} from '../types'\nimport {ResponsiveTextAlignStyleProps} from './types'\n\n/**\n * Get responsive text align styles.\n * @internal\n */\nexport function responsiveTextAlignStyle(\n props: ResponsiveTextAlignStyleProps & ThemeProps,\n): CSSObject[] {\n const {media} = getTheme_v2(props.theme)\n\n return _responsive(media, props.$align, (textAlign) => {\n return {textAlign}\n })\n}\n","import {css, firstThatWorks} from '#styled-system/css'\n\nexport const spanWithTextOverflow = css({\n display: 'block',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n overflow: firstThatWorks('clip', 'hidden'),\n})\n","import {spanWithTextOverflow} from './spanWithTextOverflow.css'\n\n/** @internal */\nexport function SpanWithTextOverflow(props: {children?: React.ReactNode}): React.JSX.Element {\n return <span className={spanWithTextOverflow}>{props.children}</span>\n}\n","import {css} from 'styled-components'\n\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {_fontBase} from '../../styles/font/responsiveFont'\nimport {ThemeProps} from '../../styles/types'\n\nexport function textBaseStyle(props: ThemeProps): ReturnType<typeof css> {\n const {font} = getTheme_v2(props.theme)\n\n return css`\n ${_fontBase('text', props)}\n\n color: var(--card-fg-color);\n\n & code {\n font-family: ${font.code.family};\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ${font.text.weights.bold};\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n /* ...and aren't squeezed by resets that set max-width: 100% */\n max-width: unset;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: var(--card-icon-color);\n\n & path {\n vector-effect: non-scaling-stroke !important;\n }\n }\n `\n}\n","import {styled} from 'styled-components'\n\nimport {ThemeFontWeightKey} from '../../../theme/system/font'\nimport {fontColorStyle} from '../../styles/font/fontColorStyle'\nimport {_fontWeight, _responsiveFontSize} from '../../styles/font/responsiveFont'\nimport {responsiveTextAlignStyle} from '../../styles/font/textAlignStyle'\nimport {ResponsiveFontSizeStyleProps, ResponsiveFontStyleProps} from '../../styles/font/types'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {ElementType, Props} from '../../types/component'\nimport {TextAlign} from '../../types/text'\nimport {SpanWithTextOverflow} from '../../utils/spanWithTextOverflow'\nimport {textBaseStyle} from './styles'\n\n/**\n * @public\n */\nexport interface TextOwnProps {\n accent?: boolean\n align?: TextAlign | TextAlign[]\n /** When `true` the text color will be muted. */\n muted?: boolean\n size?: number | number[]\n /**\n * Controls how overflowing text is treated.\n * Use `textOverflow=\"ellipsis\"` to render text as a single line which is concatenated with a `…` symbol.\n * @beta\n */\n textOverflow?: 'ellipsis'\n weight?: ThemeFontWeightKey\n}\n\n/**\n * @public\n */\nexport type TextProps<E extends ElementType = 'div'> = Props<TextOwnProps, E>\n\nconst TextBase = styled.div(textBaseStyle)\n\nconst TextSize = styled(TextBase)<ResponsiveFontSizeStyleProps>((props) =>\n _responsiveFontSize('text', props),\n)\n\nconst StyledText = styled(TextSize)<ResponsiveFontStyleProps>(\n (props) => _fontWeight('text', props),\n responsiveTextAlignStyle,\n fontColorStyle,\n)\n\nfunction TextComponent(\n props: TextOwnProps & {as?: ElementType} & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'size'>,\n) {\n const {\n accent = false,\n align,\n children: childrenProp,\n muted = false,\n ref,\n size = 2,\n textOverflow,\n weight,\n ...restProps\n } = props\n\n let children = childrenProp\n\n if (textOverflow === 'ellipsis') {\n children = <SpanWithTextOverflow>{children}</SpanWithTextOverflow>\n }\n\n return (\n <StyledText\n data-ui=\"Text\"\n {...restProps}\n $accent={accent}\n $align={_getArrayProp(align)}\n $muted={muted}\n ref={ref}\n $size={_getArrayProp(size)}\n $weight={weight}\n >\n <span>{children}</span>\n </StyledText>\n )\n}\n\n/**\n * The `Text` component is an agile, themed typographic element.\n *\n * @public\n */\nexport const Text: <E extends ElementType = 'div'>(props: TextProps<E>) => React.JSX.Element =\n TextComponent\n","import {CSSObject} from '../../../theme/system/css'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {_responsive, rem} from '../../styles/helpers'\nimport {ThemeProps} from '../../styles/types'\n\nexport interface ResponsiveStackSpaceStyleProps {\n $space: number[]\n}\n\nconst BASE_STYLE: CSSObject = {\n '&&:not([hidden])': {\n display: 'grid',\n },\n '&[data-as=\"ul\"],&[data-as=\"ol\"]': {\n listStyle: 'none',\n },\n 'gridTemplateColumns': 'minmax(0, 1fr)',\n 'gridAutoRows': 'min-content',\n}\n\nexport function stackBaseStyle(): CSSObject {\n return BASE_STYLE\n}\n\nexport function responsiveStackSpaceStyle(\n props: ResponsiveStackSpaceStyleProps & ThemeProps,\n): CSSObject[] {\n const {media, space} = getTheme_v2(props.theme)\n\n return _responsive(media, props.$space, (spaceIndex) => ({\n // oxlint-disable-next-line no-deprecated\n gridGap: rem(space[spaceIndex]),\n }))\n}\n","import {styled} from 'styled-components'\n\nimport {_getArrayProp} from '../../styles/helpers'\nimport {ElementType, Props} from '../../types/component'\nimport {Box, BoxOwnProps} from '../box/box'\nimport {responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProps, stackBaseStyle} from './styles'\n\n/**\n * @public\n */\nexport interface StackOwnProps extends BoxOwnProps {\n gap?: number | number[]\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n}\n\n/**\n * @public\n */\nexport type StackProps<E extends ElementType = 'div'> = Props<StackOwnProps, E>\n\nconst StyledStack = styled(Box)<ResponsiveStackSpaceStyleProps>(\n stackBaseStyle,\n responsiveStackSpaceStyle,\n)\n\nfunction StackComponent(\n props: StackOwnProps & {as?: ElementType} & Omit<React.HTMLProps<HTMLDivElement>, 'as'>,\n) {\n const {as, gap, ref, ...restProps} = props\n\n return (\n <StyledStack\n data-as={typeof as === 'string' ? as : undefined}\n data-ui=\"Stack\"\n {...restProps}\n $space={_getArrayProp(gap)}\n forwardedAs={as}\n ref={ref}\n />\n )\n}\n\n/**\n * The `Stack` component is used to place elements on top of each other.\n *\n * @public\n */\n// oxlint-disable-next-line no-unsafe-type-assertion\nexport const Stack = StackComponent as unknown as <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AE9C,OAAO,YAAY,OAAO,MAAM,SAAS,gBAAgB,EAEvD,SAAS,IAAI,MAAM,WAAW,EAChC,EAAE;AACJ;ACVA,MAAM,cAAc,uBAAO,GAAG,CAAC,CAAA,WAAA;;;AAC7B,CAAA,CAAA,CAAA,gBACA,yBACF;AAEA,SAAS,eACP,OACA;C,eACO,IAAI,KAAK,KAAQ;CAAa,EAAA,OAAA,S,wDAA/B,CAAC,IAAI,KAAK,KAAKL,GAAAA,aAAgB,O;CAIxBC,IAAAA,KAAAA,OAAO,MAAO,WAAW,KAAK,KAAA,GAG/BC;CAAc,EAAA,OAAA,M,aAAdA,KAAAA,cAAc,GAAG,GAAH,EAAA,KAAA,K;CAJxBC,IAAAA;CADF,OAMiB,EAAA,OAAA,MAAA,EAAA,OACR,OAAA,EAAA,OAHD,aAAA,EAAA,QAFKF,MAAAA,EAAAA,QAGDC,MAJVC,KAAAA,oBAAC,aAAD;EACE,WAASF;EACT,WAAQ;EACR,GAAI;EACJ,QAAQC;EACR,aAAa;EACR;CACN,CAAA,GAFc,EAAA,KAAA,IACR,EAAA,KAAA,KAHD,EAAA,KAAA,WAFKD,EAAAA,MAAAA,IAGDC,EAAAA,MAAAA,I,0BAJVC;AASJ;;;;;;AAQA,MAAa,QAAQ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as EMPTY_RECORD, i as _responsive, n as _getArrayProp, o as rem } from "./helpers-
|
|
2
|
-
import { a as isHTMLElement, c as isHTMLTextAreaElement, i as isHTMLButtonElement, o as isHTMLInputElement, r as isHTMLAnchorElement, s as isHTMLSelectElement } from "./element-
|
|
3
|
-
import { t as getTheme_v2 } from "./getTheme_v2-
|
|
4
|
-
import { l as useRootTheme, m as focusRingStyle, p as focusRingBorderStyle, s as Card, v as responsiveRadiusStyle, y as Box } from "./useLayer-
|
|
5
|
-
import { n as Text } from "./stack-
|
|
6
|
-
import { t as Button } from "./button-
|
|
1
|
+
import { c as EMPTY_RECORD, i as _responsive, n as _getArrayProp, o as rem } from "./helpers-jp2T-bdR.js";
|
|
2
|
+
import { a as isHTMLElement, c as isHTMLTextAreaElement, i as isHTMLButtonElement, o as isHTMLInputElement, r as isHTMLAnchorElement, s as isHTMLSelectElement } from "./element-DIcKo4Jp.js";
|
|
3
|
+
import { t as getTheme_v2 } from "./getTheme_v2-CP5x_AcH.js";
|
|
4
|
+
import { l as useRootTheme, m as focusRingStyle, p as focusRingBorderStyle, s as Card, v as responsiveRadiusStyle, y as Box } from "./useLayer-DiYnwQ5T.js";
|
|
5
|
+
import { n as Text } from "./stack-DFRXALVU.js";
|
|
6
|
+
import { t as Button } from "./button-GFefHUiY.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
8
|
import { clsx } from "clsx/lite";
|
|
9
9
|
import { isValidElement, useEffect, useImperativeHandle, useRef } from "react";
|
|
@@ -332,4 +332,4 @@ function _temp(event) {
|
|
|
332
332
|
}
|
|
333
333
|
export { isFocusable as _, textInputColorStyle as a, textInputRepresentationColorStyle as c, responsiveInputPaddingStyle as d, useCustomValidity as f, focusLastDescendant as g, focusFirstDescendant as h, textInputBaseStyle as i, textInputRepresentationStyle as l, attemptFocus as m, inputRoot as n, textInputFontSizeStyle as o, _hasFocus as p, textAreaRoot as r, textInputFontStyle as s, TextInput as t, responsiveInputPaddingIconRightStyle as u, _raf as v, _raf2 as y };
|
|
334
334
|
|
|
335
|
-
//# sourceMappingURL=textInput-
|
|
335
|
+
//# sourceMappingURL=textInput-cMQvSl5n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textInput-cMQvSl5n.js","names":["() => {\n ref.current?.setCustomValidity(customValidity || '')\n }","[customValidity, ref]","ref.current","border = true","disabled = false","fontSizeProp = 2","gap = 3","paddingProp = 3","radiusProp = 2","type = 'text'","...restProps","_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 }","event","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 )","border ? '' : undefined","IconComponent && (\n <Box className={textInputLeftBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </Box>\n )","!$hasClearButton && IconRightComponent && (\n <Box className={textInputRightBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </Box>\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 data-ui=\"TextInput__presentation\"\n >\n {IconComponent && (\n <Box className={textInputLeftBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </Box>\n )}\n\n {!$hasClearButton && IconRightComponent && (\n <Box className={textInputRightBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </Box>\n )}\n </Presentation>","scheme","tone","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 data-ui=\"TextInput__presentation\"\n >\n {IconComponent && (\n <Box className={textInputLeftBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </Box>\n )}\n\n {!$hasClearButton && IconRightComponent && (\n <Box className={textInputRightBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </Box>\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 <Button\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 className={clsx(textInputClearButton, clearButtonProps.className)}\n onClick={handleClearClick}\n onMouseDown={handleClearMouseDown}\n />\n </RightCard>\n )","clearButtonProps.className","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 <Button\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 className={clsx(textInputClearButton, clearButtonProps.className)}\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 )","$hasIconRight || $hasClearButton","<Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n data-ui=\"TextInput__input\"\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 />","<span className={inputRoot}>\n <Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n data-ui=\"TextInput__input\"\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 </span>","<Card\n as=\"span\"\n className={textInputRoot}\n data-ui=\"TextInput\"\n display=\"flex\"\n tone={rootTheme.tone}\n >\n {prefixNode}\n\n <span className={inputRoot}>\n <Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n data-ui=\"TextInput__input\"\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 </span>\n\n {suffixNode}\n </Card>","v","(event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n event.stopPropagation()\n }","_jsx","_jsxs"],"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/styles/input/textInput.css.ts","../src/core/primitives/textInput/textInput.css.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\nexport const textInputBaseStyle = 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 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\nexport function textInputColorStyle(\n props: Pick<TextInputInputStyleProps, '$scheme' | '$tone'> & ThemeProps,\n): ReturnType<typeof css> {\n const {$scheme, $tone} = props\n const {color} = getTheme_v2(props.theme)\n\n return css`\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 textInputFontStyle(\n props: Pick<TextInputInputStyleProps, '$weight'> & ThemeProps,\n): CSSObject {\n const {$weight} = props\n const {font} = getTheme_v2(props.theme)\n\n return {\n fontFamily: font.text.family,\n fontWeight: `${($weight && font.text.weights[$weight]) || font.text.weights.regular}`,\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: Pick<TextInputRepresentationStyleProps, '$hasPrefix' | '$hasSuffix'>,\n): ReturnType<typeof css> {\n const {$hasPrefix, $hasSuffix} = props\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}\n\nexport function textInputRepresentationColorStyle(\n props: Omit<TextInputRepresentationStyleProps, '$hasPrefix' | '$hasSuffix'> & ThemeProps,\n): ReturnType<typeof css> {\n const {$scheme, $tone, $unstableDisableFocusRing} = props\n const {color, input} = getTheme_v2(props.theme)\n\n return css`\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 {css} from '#styled-system/css'\n\n// TextInput renders its root as a Card, whose Box styles own `display`, so the\n// flex layout comes from the `display` prop there and only the alignment lives\n// here. TextArea's root is a plain span, so it reuses that class and adds display.\nexport const textInputRoot = css({\n alignItems: 'center',\n})\n\nexport const textAreaRoot = css({\n 'alignItems': 'center',\n '&:not([hidden])': {\n display: 'flex',\n },\n})\n\nexport const inputRoot = css({\n flex: 1,\n minWidth: 0,\n display: 'block',\n position: 'relative',\n})\n","import {css} from '#styled-system/css'\n\nexport const textInputLeftBox = css({\n position: 'absolute',\n top: 0,\n left: 0,\n})\n\nexport const textInputRightBox = css({\n position: 'absolute',\n top: 0,\n right: 0,\n})\n\nexport const textInputClearButton = css({\n '&:not([hidden])': {\n display: 'block',\n },\n})\n","import {CloseIcon} from '@sanity/icons/Close'\nimport {clsx} from 'clsx/lite'\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 textInputColorStyle,\n textInputFontSizeStyle,\n textInputFontStyle,\n TextInputInputStyleProps,\n textInputRepresentationColorStyle,\n textInputRepresentationStyle,\n TextInputRepresentationStyleProps,\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\nimport {inputRoot, textInputRoot} from '../../styles/input/textInput.css'\nimport {textInputClearButton, textInputLeftBox, textInputRightBox} from './textInput.css'\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\n// Prefix and Suffix stay on styled-components: their corner radius longhands\n// must beat Card's runtime `border-radius` shorthand at equal specificity,\n// which needs both rules in the runtime stylesheet.\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 InputBase = styled.input`\n ${textInputBaseStyle}\n`\n\nconst InputColor = styled(InputBase)<TextInputInputStyleProps>(textInputColorStyle)\n\nconst Input = styled(InputColor)<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>(\n responsiveInputPaddingStyle,\n textInputFontStyle,\n textInputFontSizeStyle,\n)\n\nconst PresentationColor = styled.span<TextInputRepresentationStyleProps>(\n textInputRepresentationColorStyle,\n)\n\nconst Presentation = styled(PresentationColor)<\n ResponsiveRadiusStyleProps & TextInputRepresentationStyleProps\n>(responsiveRadiusStyle, textInputRepresentationStyle)\n\n// Stays on styled-components: `background-color: transparent` must beat Card's\n// runtime `background-color: var(--card-bg-color)` at equal specificity, which\n// needs both rules in the runtime stylesheet.\nconst RightCard = styled(Card)`\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\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 data-ui=\"TextInput__presentation\"\n >\n {IconComponent && (\n <Box className={textInputLeftBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n </Box>\n )}\n\n {!$hasClearButton && IconRightComponent && (\n <Box className={textInputRightBox} padding={padding}>\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n </Box>\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 =\n typeof clearButton === 'object' ? clearButton : EMPTY_RECORD\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 <Button\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 className={clsx(textInputClearButton, clearButtonProps.className)}\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 <Card\n as=\"span\"\n className={textInputRoot}\n data-ui=\"TextInput\"\n display=\"flex\"\n tone={rootTheme.tone}\n >\n {prefixNode}\n\n <span className={inputRoot}>\n <Input\n data-as=\"input\"\n data-scheme={rootTheme.scheme}\n data-tone={rootTheme.tone}\n data-ui=\"TextInput__input\"\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 </span>\n\n {suffixNode}\n </Card>\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,EAAE;CACxB,CAAC;CAED,aAAa;EACP,gBAAc,aAAa,GAE/B,aAAa;CACf;AACF;;;;ACVA,SAAgB,UAAU,SAA+B;CACvD,OAAO,EAAQ,SAAS,iBAAkB,QAAQ,SAAS,SAAS,aAAa;AACnF;;;;AAKA,SAAgB,YAAY,SAA+B;CAwBzD,OAtBE,QAAQ,WAAW,KAClB,QAAQ,aAAa,KAAK,QAAQ,aAAa,UAAU,MAAM,OAEzD,KAGL,oBAAoB,OAAO,IACtB,EAAQ,QAAQ,Q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QA6Bf,cAAA,EAAA,QAzBDe,OATFC,MAAAA,qBAAC,MAAD;EACE,IAAG;EACH,WAAW;EACX,WAAQ;EACR,SAAQ;EACR,MAAM,UAAU;EALlB,UAAA;GAOG;GAEDD;GAyBC;EACG;C,IA5BH,EAAA,MAAA,YAFef,EAAAA,MAAAA,UAAAA,MA6Bf,EAAA,MAAA,YAzBDe,EAAAA,MAAAA,K,4BATFC;AAqCJ;AArGkBV,SAAAA,OAACW,KAAM;CAKjB,OAJIA,QAAM,KACNA,QAAM,IAAU,IAChBA,QAAM,IAAU,IAEbA,MAAI;AACb;AAjBYd,SAAAA,OAAC,GAAM;CAKjB,OAJI,MAAM,IAAU,IAChB,MAAM,KACN,MAAM,IAAU,IAEb,IAAI;AACb;AAvFqCe,SAAAA,MAAC,OAA+C;CACvF,MAAM,eAAe,GACrB,MAAM,gBAAgB;AACxB"}
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { a as ThemeFontWeightKey, i as ThemeFontWeight, n as ThemeFontKey, o as ThemeFonts, r as ThemeFontSize, t as ThemeFont } from "./font-EtfxKPUz.js";
|
|
3
|
-
import { $ as ThemeColorInputState_v2, A as ThemeColorMutedTone, B as ThemeColorBase, C as ThemeColorSpotKey, D as ThemeColorSelectableState, E as ThemeColorSelectable, F as ThemeColorCardState, G as ThemeInput_v2, H as ThemeColorToneKey, I as ThemeColorButton, J as ThemeColorSchemes_v2, K as ThemeColorCard_v2, L as ThemeColorButtonState, M as ThemeColorInputState, N as ThemeColorInputStates, O as ThemeColorSelectableStates, P as ThemeColorCard, Q as ThemeColorInputMode_v2, R as ThemeColorButtonStates, S as ThemeColorSpot, T as ThemeColorSolidTone, U as ThemeColorGenericState, V as ThemeColorName, W as ThemeAvatar, X as ThemeColorSelectableTone_v2, Y as ThemeColorShadow, Z as ThemeColorSelectable_v2, _ as Theme_v2, _t as ThemeColorSyntax, a as rgbToHex, at as ThemeColorKBD, b as ThemeColorScheme, bt as RGBA, c as screen, ct as ThemeColorAvatarHue_v2, d as ThemeColorBuilderOpts, dt as ThemeFocusRing, et as ThemeColorInput_v2, f as createColorTheme, ft as ThemeStyles, g as Theme, gt as ThemeLayer, h as RootTheme_v2, ht as ThemeShadow, i as hslToRgb, it as ThemeColorState_v2, j as ThemeColorInput, k as ThemeColorMuted, l as multiply, lt as ThemeColorAvatar_v2, m as RootTheme, mt as ThemeBoxShadow, n as parseColor, nt as ThemeColorButtonTone_v2, o as rgbToHsl, ot as ThemeColorBadgeTone_v2, p as BaseTheme, pt as CSSObject, q as ThemeColorScheme_v2, r as hexToRgb, rt as ThemeColorButton_v2, s as rgbaToRGBA, st as ThemeColorBadge_v2, t as rgba, tt as ThemeColorButtonMode_v2, u as PartialThemeColorBuilderOpts, ut as ThemeAvatar_v2, v as ThemeInput, vt as HSL, w as ThemeColorSolid, x as ThemeColorSchemes, y as ThemeColor, yt as RGB, z as ThemeColorButtonTones } from "./rgba-BSYaEUW6.js";
|
|
1
|
+
import { $ as ThemeColorInputState_v2, A as ThemeColorMutedTone, B as ThemeColorBase, C as ThemeColorSpotKey, D as ThemeColorSelectableState, E as ThemeColorSelectable, F as ThemeColorCardState, G as ThemeInput_v2, H as ThemeColorToneKey, I as ThemeColorButton, J as ThemeColorSchemes_v2, K as ThemeColorCard_v2, L as ThemeColorButtonState, M as ThemeColorInputState, N as ThemeColorInputStates, O as ThemeColorSelectableStates, P as ThemeColorCard, Q as ThemeColorInputMode_v2, R as ThemeColorButtonStates, S as ThemeColorSpot, T as ThemeColorSolidTone, U as ThemeColorGenericState, V as ThemeColorName, W as ThemeAvatar, X as ThemeColorSelectableTone_v2, Y as ThemeColorShadow, Z as ThemeColorSelectable_v2, _ as Theme_v2, _t as ThemeColorSyntax, a as rgbToHex, at as ThemeColorKBD, b as ThemeColorScheme, bt as RGBA, c as screen, ct as ThemeColorAvatarHue_v2, d as ThemeColorBuilderOpts, dt as ThemeFocusRing, et as ThemeColorInput_v2, f as createColorTheme, ft as ThemeStyles, g as Theme, gt as ThemeLayer, h as RootTheme_v2, ht as ThemeShadow, i as hslToRgb, it as ThemeColorState_v2, j as ThemeColorInput, k as ThemeColorMuted, l as multiply, lt as ThemeColorAvatar_v2, m as RootTheme, mt as ThemeBoxShadow, n as parseColor, nt as ThemeColorButtonTone_v2, o as rgbToHsl, ot as ThemeColorBadgeTone_v2, p as BaseTheme, pt as CSSObject, q as ThemeColorScheme_v2, r as hexToRgb, rt as ThemeColorButton_v2, s as rgbaToRGBA, st as ThemeColorBadge_v2, t as rgba, tt as ThemeColorButtonMode_v2, u as PartialThemeColorBuilderOpts, ut as ThemeAvatar_v2, v as ThemeInput, vt as HSL, w as ThemeColorSolid, x as ThemeColorSchemes, y as ThemeColor, yt as RGB, z as ThemeColorButtonTones } from "./rgba-Hlu7P1jF.js";
|
|
4
2
|
import { ColorHueKey, ColorTint, ColorTintKey } from "@sanity/color";
|
|
3
|
+
import { a as ThemeFontWeightKey, i as ThemeFontWeight, n as ThemeFontKey, o as ThemeFonts, r as ThemeFontSize, t as ThemeFont } from "./font-DI_tc5s8.js";
|
|
4
|
+
import { _ as THEME_COLOR_STATES, a as ThemeColorInputModeKey, c as ThemeColorStateKey, d as THEME_COLOR_BLEND_MODES, f as THEME_COLOR_BUTTON_MODES, g as THEME_COLOR_SCHEMES, h as THEME_COLOR_INPUT_STATES, i as ThemeColorCardToneKey, l as ThemeColorStateToneKey, m as THEME_COLOR_INPUT_MODES, n as ThemeColorBlendModeKey, o as ThemeColorInputStateKey, p as THEME_COLOR_CARD_TONES, r as ThemeColorButtonModeKey, s as ThemeColorSchemeKey, t as ThemeColorAvatarColorKey, u as THEME_COLOR_AVATAR_COLORS, v as THEME_COLOR_STATE_TONES } from "./_system-DjnSx8gA.js";
|
|
5
5
|
/** @public */
|
|
6
6
|
export declare const COLOR_CONFIG_STATE_KEYS: readonly ['_hue', 'bg', 'fg', 'border', 'focusRing', 'muted/fg', 'accent/fg', 'link/fg', 'code/bg', 'code/fg', 'skeleton/from', 'skeleton/to', 'status/dot', 'status/icon'];
|
|
7
7
|
/** @public */
|
package/dist/theme.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { i as is_v2, n as v2_v0, r as v0_v2, t as getScopedTheme } from "./getScopedTheme-
|
|
3
|
-
import {
|
|
1
|
+
import { A as COLOR_CONFIG_STATE_TONES, B as THEME_COLOR_INPUT_STATES, C as COLOR_CONFIG_BLEND_KEYS, D as COLOR_CONFIG_INPUT_STATES, E as COLOR_CONFIG_INPUT_MODES, F as THEME_COLOR_AVATAR_COLORS, H as THEME_COLOR_STATES, I as THEME_COLOR_BLEND_MODES, L as THEME_COLOR_BUTTON_MODES, M as isColorButtonMode, N as isColorHueKey, O as COLOR_CONFIG_STATES, P as isColorTintKey, R as THEME_COLOR_CARD_TONES, S as COLOR_CONFIG_AVATAR_COLORS, T as COLOR_CONFIG_CARD_TONES, U as THEME_COLOR_STATE_TONES, V as THEME_COLOR_SCHEMES, _ as isColorConfigStateKey, a as rgba, b as isColorTokenValue, c as hslToRgb, d as rgbaToRGBA, f as mix, g as isColorConfigBlendKey, h as isColorConfigBaseTone, i as multiply, j as isColorBlendModeValue, k as COLOR_CONFIG_STATE_KEYS, l as rgbToHex, m as isColorConfigBaseKey, n as buildTheme, o as parseColor, p as parseTokenValue, r as screen, s as hexToRgb, t as createColorTheme, u as rgbToHsl, v as isColorConfigStateTone, w as COLOR_CONFIG_CARD_KEYS, x as isColorValue, y as isColorOpacityValue, z as THEME_COLOR_INPUT_MODES } from "./factory-D1M0GqJn.js";
|
|
2
|
+
import { i as is_v2, n as v2_v0, r as v0_v2, t as getScopedTheme } from "./getScopedTheme-BJoqtbrb.js";
|
|
3
|
+
import { t as getTheme_v2 } from "./getTheme_v2-CP5x_AcH.js";
|
|
4
4
|
/** @internal */
|
|
5
5
|
function getContrastRatio(bg, fg) {
|
|
6
6
|
let rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|