@sanity/ui 4.2.0 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{arrow-BmX6qbAS.js → arrow-CZ-Lw1QO.js} +2 -2
  2. package/dist/{arrow-BmX6qbAS.js.map → arrow-CZ-Lw1QO.js.map} +1 -1
  3. package/dist/autocomplete.d.ts.map +1 -1
  4. package/dist/autocomplete.js +119 -123
  5. package/dist/autocomplete.js.map +1 -1
  6. package/dist/breadcrumbs.js +4 -4
  7. package/dist/{button-BNyKSDyA.js → button-Wii-24Xu.js} +6 -6
  8. package/dist/button-Wii-24Xu.js.map +1 -0
  9. package/dist/button-dnqMFkWg.d.ts.map +1 -1
  10. package/dist/code.d.ts.map +1 -1
  11. package/dist/code.js +1 -1
  12. package/dist/code.js.map +1 -1
  13. package/dist/{flex-DmbDG2ks.js → flex-CpiAc-4D.js} +2 -2
  14. package/dist/{flex-DmbDG2ks.js.map → flex-CpiAc-4D.js.map} +1 -1
  15. package/dist/getScopedTheme-C-sZsyAz.js.map +1 -1
  16. package/dist/{grid-6JSgMj1O.js → grid-BVZEj_Xe.js} +3 -3
  17. package/dist/{grid-6JSgMj1O.js.map → grid-BVZEj_Xe.js.map} +1 -1
  18. package/dist/{hotkeys-CaHsQlsO.js → hotkeys-DEMStMQ5.js} +4 -4
  19. package/dist/hotkeys-DEMStMQ5.js.map +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +109 -115
  22. package/dist/index.js.map +1 -1
  23. package/dist/{layer-Bl5R3uNR.js → layer-B0tlPeLT.js} +2 -2
  24. package/dist/{layer-Bl5R3uNR.js.map → layer-B0tlPeLT.js.map} +1 -1
  25. package/dist/menu.d.ts.map +1 -1
  26. package/dist/menu.js +5 -5
  27. package/dist/menu.js.map +1 -1
  28. package/dist/{popover-B7-28L8y.js → popover-DR6UQQvq.js} +4 -4
  29. package/dist/{popover-B7-28L8y.js.map → popover-DR6UQQvq.js.map} +1 -1
  30. package/dist/popover.js +1 -1
  31. package/dist/{stack-rsNFPq2-.js → stack-SbGBZ0x3.js} +3 -3
  32. package/dist/{stack-rsNFPq2-.js.map → stack-SbGBZ0x3.js.map} +1 -1
  33. package/dist/styles.css +21 -12
  34. package/dist/{textInput-pSfQjkmx.js → textInput-fGZVEKGs.js} +4 -4
  35. package/dist/{textInput-pSfQjkmx.js.map → textInput-fGZVEKGs.js.map} +1 -1
  36. package/dist/toast.js +37 -43
  37. package/dist/toast.js.map +1 -1
  38. package/dist/tooltip.js +53 -49
  39. package/dist/tooltip.js.map +1 -1
  40. package/dist/useClickOutsideEvent-wGLGWBZN.js.map +1 -1
  41. package/dist/{useLayer-D1usxIE0.js → useLayer-CUKYjJYq.js} +56 -35
  42. package/dist/useLayer-CUKYjJYq.js.map +1 -0
  43. package/package.json +18 -17
  44. package/dist/button-BNyKSDyA.js.map +0 -1
  45. package/dist/hotkeys-CaHsQlsO.js.map +0 -1
  46. package/dist/useLayer-D1usxIE0.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { _ as useTheme_v2, d as createGlobalScopedContext, f as globalScope, r as isRecord } from "./useLayer-D1usxIE0.js";
1
+ import { _ as useTheme_v2, d as createGlobalScopedContext, f as globalScope, r as isRecord } from "./useLayer-CUKYjJYq.js";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { clsx } from "clsx/lite";
4
4
  import { useContext, useId } from "react";
@@ -167,4 +167,4 @@ function Arrow(props) {
167
167
  }
168
168
  export { useBoundaryElement as a, PortalContext as i, Portal as n, BoundaryElementContext as o, usePortal as r, Arrow as t };
169
169
 
170
- //# sourceMappingURL=arrow-BmX6qbAS.js.map
170
+ //# sourceMappingURL=arrow-CZ-Lw1QO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-BmX6qbAS.js","names":["createPortal(children, portalElement)","radius = 0","compileCommands(cmds)","clsx(arrow, className)","assignInlineVars({[arrowSize]: `${w}px`})","`${w}px`","{...style, ...assignInlineVars({[arrowSize]: `${w}px`})}","<rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />","<mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>","<path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />","strokeWidth * 2","`url(#${strokeMaskId})`","<path className={arrowShape} d={fillPath} />","<svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />\n <path className={arrowShape} d={fillPath} />\n </svg>","`0 0 ${w} ${w}`","<div\n data-ui=\"Arrow\"\n {...restProps}\n className={clsx(arrow, className)}\n ref={ref}\n style={{...style, ...assignInlineVars({[arrowSize]: `${w}px`})}}\n >\n <svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />\n <path className={arrowShape} d={fillPath} />\n </svg>\n </div>"],"sources":["../src/core/utils/boundaryElement/boundaryElementContext.ts","../src/core/utils/boundaryElement/useBoundaryElement.ts","../src/core/utils/portal/portalContext.ts","../src/core/utils/portal/usePortal.ts","../src/core/utils/portal/portal.ts","../src/core/utils/arrow/cmds.ts","../src/core/utils/arrow/arrow.css.ts","../src/core/utils/arrow/arrow.tsx"],"sourcesContent":["import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'\nimport {BoundaryElementContextValue} from './types'\n\nexport const BoundaryElementContext = createGlobalScopedContext<BoundaryElementContextValue | null>(\n '@sanity/ui/context/boundaryElement',\n null,\n)\n","import {useContext} from 'react'\n\nimport {isRecord} from '../../lib/isRecord'\nimport {BoundaryElementContext} from './boundaryElementContext'\nimport {BoundaryElementContextValue} from './types'\n\nconst DEFAULT_VALUE: BoundaryElementContextValue = {\n version: 0.0,\n element: null,\n}\n\n/**\n * @public\n */\nexport function useBoundaryElement(): BoundaryElementContextValue {\n const value = useContext(BoundaryElementContext)\n\n // NOTE: This check is for future-compatiblity\n // - If the value is not an object, it’s not compatible with the current version\n // - If the value is an object, but doesn’t have `version: 0.0`, it’s not compatible with the current version\n if (value && (!isRecord(value) || value.version !== 0.0)) {\n throw new Error('useBoundaryElement(): the context value is not compatible')\n }\n\n return value || DEFAULT_VALUE\n}\n","import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'\nimport {globalScope} from '../../lib/globalScope'\nimport {PortalContextValue} from './types'\n\nconst key = '@sanity/ui/context/portal'\nconst elementKey = Symbol.for(`${key}/element`)\n\nglobalScope[elementKey] = null\n\nconst defaultContextValue: PortalContextValue = {\n version: 0.0,\n boundaryElement: null,\n get element() {\n if (typeof document === 'undefined') {\n return null\n }\n\n if (globalScope[elementKey]) {\n return globalScope[elementKey]\n }\n\n globalScope[elementKey] = document.createElement('div')\n globalScope[elementKey].setAttribute('data-portal', '')\n\n document.body.appendChild(globalScope[elementKey])\n\n return globalScope[elementKey]\n },\n}\n\nexport const PortalContext = createGlobalScopedContext<PortalContextValue>(key, defaultContextValue)\n","import {useContext} from 'react'\n\nimport {isRecord} from '../../lib/isRecord'\nimport {PortalContext} from './portalContext'\nimport {PortalContextValue} from './types'\n\n/**\n * @public\n */\nexport function usePortal(): PortalContextValue {\n const value = useContext(PortalContext)\n\n if (!value) {\n throw new Error('usePortal(): missing context value')\n }\n\n // NOTE: This check is for future-compatiblity\n // - If the value is not an object, it’s not compatible with the current version\n // - If the value is an object, but doesn’t have `version: 0.0`, it’s not compatible with the current version\n if (!isRecord(value) || value.version !== 0.0) {\n throw new Error('usePortal(): the context value is not compatible')\n }\n\n return value\n}\n","import {createPortal} from 'react-dom'\n\nimport {usePortal} from './usePortal'\n\n/**\n * @public\n */\nexport interface PortalProps {\n children: React.ReactNode\n /**\n * @beta This API might change. DO NOT USE IN PRODUCTION.\n */\n __unstable_name?: string\n}\n\n/**\n * @public\n */\nexport function Portal(props: PortalProps): React.ReactPortal | null {\n const {children, __unstable_name: name} = props\n const portal = usePortal()\n const portalElement =\n (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default\n\n if (!portalElement) {\n return null\n }\n\n return createPortal(children, portalElement)\n}\n","interface PointCmd {\n type: 'point'\n x: number\n y: number\n radius?: number\n}\n\ninterface CurveCmd {\n type: 'curve'\n startControl: Point\n endControl: Point\n curveEnd: Point\n}\n\nexport type Cmd = PointCmd | CurveCmd\n\nexport interface Point {\n x: number\n y: number\n radius?: number\n}\n\nfunction moveTowardsLength(movingPoint: Point, targetPoint: Point, amount: number) {\n const width = targetPoint.x - movingPoint.x\n const height = targetPoint.y - movingPoint.y\n\n const distance = Math.sqrt(width * width + height * height)\n\n return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance))\n}\n\nfunction moveTowardsFractional(movingPoint: Point, targetPoint: Point, fraction: number): Point {\n return {\n x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,\n y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction,\n }\n}\n\nexport function getRoundedCommands(points: Point[]): Cmd[] {\n const len = points.length\n\n const cmds: Cmd[] = []\n\n for (let i = 0; i < len; i += 1) {\n const point = points[i]\n const prevPoint = points[i - 1]\n const nextPoint = points[i + 1]\n\n if (prevPoint && point.radius) {\n const curveStart = moveTowardsLength(point, prevPoint, point.radius)\n const curveEnd = moveTowardsLength(point, nextPoint, point.radius)\n const startControl = moveTowardsFractional(curveStart, point, 0.5)\n const endControl = moveTowardsFractional(point, curveEnd, 0.5)\n\n cmds.push({\n type: 'point',\n ...curveStart,\n })\n\n cmds.push({\n type: 'curve',\n curveEnd,\n startControl,\n endControl,\n })\n } else {\n cmds.push({\n type: 'point',\n ...point,\n })\n }\n }\n\n return cmds\n}\n\nexport function compileCommands(cmds: Cmd[]): string {\n return cmds\n .map((n, idx) => {\n if (n.type === 'point') {\n return `${idx === 0 ? 'M' : 'L'} ${n.x} ${n.y}`\n }\n\n if (n.type === 'curve') {\n return `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}`\n }\n\n return ``\n })\n .join(' ')\n}\n","import {createVar, globalStyle, style} from '@vanilla-extract/css'\n\nexport const arrowSize = createVar()\n\nexport const arrow = style({\n position: 'absolute',\n width: arrowSize,\n height: arrowSize,\n selectors: {\n ':empty + &': {display: 'none'},\n \"[data-placement^='top'] > &\": {bottom: `calc(-1 * ${arrowSize})`},\n \"[data-placement^='right'] > &\": {left: `calc(-1 * ${arrowSize})`},\n \"[data-placement^='left'] > &\": {right: `calc(-1 * ${arrowSize})`},\n \"[data-placement^='bottom'] > &\": {top: `calc(-1 * ${arrowSize})`},\n },\n})\n\nglobalStyle(`${arrow} > svg`, {\n display: 'block',\n lineHeight: 0,\n transformOrigin: `calc(${arrowSize} / 2) calc(${arrowSize} / 2)`,\n})\n\nglobalStyle(`[data-placement^='top'] > ${arrow} > svg`, {transform: 'rotate(0)'})\nglobalStyle(`[data-placement^='right'] > ${arrow} > svg`, {transform: 'rotate(90deg)'})\nglobalStyle(`[data-placement^='left'] > ${arrow} > svg`, {transform: 'rotate(-90deg)'})\nglobalStyle(`[data-placement^='bottom'] > ${arrow} > svg`, {transform: 'rotate(180deg)'})\n\nexport const arrowStroke = style({\n stroke: 'var(--card-shadow-outline-color)',\n})\n\nexport const arrowShape = style({\n fill: 'var(--card-bg-color)',\n})\n","import {assignInlineVars} from '@vanilla-extract/dynamic'\nimport {clsx} from 'clsx/lite'\nimport {HTMLProps, useId} from 'react'\n\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {compileCommands, getRoundedCommands, Point} from './cmds'\n\nimport {arrow, arrowShape, arrowSize, arrowStroke} from './arrow.css'\n\n/** @internal */\nexport function Arrow(\n props: {width: number; height: number; radius?: number} & Omit<\n HTMLProps<HTMLDivElement>,\n 'width' | 'height'\n >,\n): React.JSX.Element {\n const {className, width: w, height: h, radius = 0, ref, style, ...restProps} = props\n const {card} = useTheme_v2()\n const strokeMaskId = `stroke-mask-${useId()}`\n const strokeWidth = card.shadow.outline\n\n const center = w / 2\n\n const points: Point[] = [\n {\n x: 0,\n y: 0,\n },\n {\n x: radius,\n y: 0,\n radius,\n },\n {\n x: center,\n y: h - 1,\n radius,\n },\n {\n x: w - radius,\n y: 0,\n radius,\n },\n {\n x: w,\n y: 0,\n },\n ]\n\n const cmds = getRoundedCommands(points)\n const path = compileCommands(cmds)\n\n // oxlint-disable-next-line no-unnecessary-template-expression\n const strokePath = `${path}`\n const fillPath = `${path} M ${w} -1 M 0 -1 Z`\n\n return (\n <div\n data-ui=\"Arrow\"\n {...restProps}\n className={clsx(arrow, className)}\n ref={ref}\n style={{...style, ...assignInlineVars({[arrowSize]: `${w}px`})}}\n >\n <svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />\n <path className={arrowShape} d={fillPath} />\n </svg>\n </div>\n )\n}\n"],"mappings":";;;;;;;AAGA,MAAa,yBAAyB,0BACpC,sCACA,IACF,GCAM,gBAA6C;CACjD,SAAS;CACT,SAAS;AACX;;;;AAKA,SAAgB,qBAAkD;CAChE,IAAM,QAAQ,WAAW,sBAAsB;CAK/C,IAAI,UAAU,CAAC,SAAS,KAAK,KAAK,MAAM,YAAY,IAClD,MAAU,MAAM,2DAA2D;CAG7E,OAAO,SAAS;AAClB;ACrBA,MAAM,MAAM,6BACN,aAAa,OAAO,IAAI,GAAG,IAAI,SAAS;AAE9C,YAAY,cAAc;AAuB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,aAAa,IACd,MAAA,cAAc,GAJ7BE;CAEK,AAAA,EAAA,QAAA,cAAA,EAAA,QAEUC,OAAAA,EAAAA,QADPC,MAHR,MAAA,oBAAC,QAAD;EACE,WAAW;EACX,GAAG;EACH,MAAMA;EACN,aAAaD;CACd,CAAA,GAHI,EAAA,MAAA,YAEUA,EAAAA,MAAAA,KADPC,EAAAA,MAAAA;CAGRC,IAAAA;CAAgC,AAAA,EAAA,QAAA,0BAAhC,MAAA,oBAAC,QAAD;EAAM,WAAW;EAAY,GAAG;CAAW,CAAA,GAAX,EAAA,MAAA;CAVlCC,IAAAA;CAIEJ,AAAAA,EAAAA,QAAAA,OAAAA,EAAAA,QAMAG,OAAAA,EAAAA,QAViCE,MAAAA,EAAAA,QACjCN,MAAAA,EAAAA,QADU,KAAZ,MAAA,qBAAC,OAAD;EAAK,OAAO;EAAG,QAAQ;EAAG,SAASM;EAAnC,UAAA;GACEN;GAGAC;GAMAG;EACG;KAPHH,EAAAA,MAAAA,KAMAG,EAAAA,MAAAA,KAViCE,EAAAA,MAAAA,IACjCN,EAAAA,MAAAA,IADU,EAAA,MAAA;CAPdO,IAAAA;CADF,OAKS,EAAA,QAAA,OAAA,EAAA,QAFD,aAAA,EAAA,QAKJF,OAAAA,EAAAA,QAJWV,MAAAA,EAAAA,QAEJG,MALT,MAAA,oBAAC,OAAD;EACE,WAAQ;EACR,GAAI;EACJ,WAAWH;EACN;EACL,OAAOG;EAEPO,UAAAA;CAYG,CAAA,GAfE,EAAA,MAAA,KAFD,EAAA,MAAA,WAKJA,EAAAA,MAAAA,KAJWV,EAAAA,MAAAA,IAEJG,EAAAA,MAAAA,gCALTS;AAqBJ"}
1
+ {"version":3,"file":"arrow-CZ-Lw1QO.js","names":["createPortal(children, portalElement)","radius = 0","compileCommands(cmds)","clsx(arrow, className)","assignInlineVars({[arrowSize]: `${w}px`})","`${w}px`","{...style, ...assignInlineVars({[arrowSize]: `${w}px`})}","<rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />","<mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>","<path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />","strokeWidth * 2","`url(#${strokeMaskId})`","<path className={arrowShape} d={fillPath} />","<svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />\n <path className={arrowShape} d={fillPath} />\n </svg>","`0 0 ${w} ${w}`","<div\n data-ui=\"Arrow\"\n {...restProps}\n className={clsx(arrow, className)}\n ref={ref}\n style={{...style, ...assignInlineVars({[arrowSize]: `${w}px`})}}\n >\n <svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />\n <path className={arrowShape} d={fillPath} />\n </svg>\n </div>"],"sources":["../src/core/utils/boundaryElement/boundaryElementContext.ts","../src/core/utils/boundaryElement/useBoundaryElement.ts","../src/core/utils/portal/portalContext.ts","../src/core/utils/portal/usePortal.ts","../src/core/utils/portal/portal.ts","../src/core/utils/arrow/cmds.ts","../src/core/utils/arrow/arrow.css.ts","../src/core/utils/arrow/arrow.tsx"],"sourcesContent":["import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'\nimport {BoundaryElementContextValue} from './types'\n\nexport const BoundaryElementContext = createGlobalScopedContext<BoundaryElementContextValue | null>(\n '@sanity/ui/context/boundaryElement',\n null,\n)\n","import {useContext} from 'react'\n\nimport {isRecord} from '../../lib/isRecord'\nimport {BoundaryElementContext} from './boundaryElementContext'\nimport {BoundaryElementContextValue} from './types'\n\nconst DEFAULT_VALUE: BoundaryElementContextValue = {\n version: 0.0,\n element: null,\n}\n\n/**\n * @public\n */\nexport function useBoundaryElement(): BoundaryElementContextValue {\n const value = useContext(BoundaryElementContext)\n\n // NOTE: This check is for future-compatiblity\n // - If the value is not an object, it’s not compatible with the current version\n // - If the value is an object, but doesn’t have `version: 0.0`, it’s not compatible with the current version\n if (value && (!isRecord(value) || value.version !== 0.0)) {\n throw new Error('useBoundaryElement(): the context value is not compatible')\n }\n\n return value || DEFAULT_VALUE\n}\n","import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'\nimport {globalScope} from '../../lib/globalScope'\nimport {PortalContextValue} from './types'\n\nconst key = '@sanity/ui/context/portal'\nconst elementKey = Symbol.for(`${key}/element`)\n\nglobalScope[elementKey] = null\n\nconst defaultContextValue: PortalContextValue = {\n version: 0.0,\n boundaryElement: null,\n get element() {\n if (typeof document === 'undefined') {\n return null\n }\n\n if (globalScope[elementKey]) {\n return globalScope[elementKey]\n }\n\n globalScope[elementKey] = document.createElement('div')\n globalScope[elementKey].setAttribute('data-portal', '')\n\n document.body.appendChild(globalScope[elementKey])\n\n return globalScope[elementKey]\n },\n}\n\nexport const PortalContext = createGlobalScopedContext<PortalContextValue>(key, defaultContextValue)\n","import {useContext} from 'react'\n\nimport {isRecord} from '../../lib/isRecord'\nimport {PortalContext} from './portalContext'\nimport {PortalContextValue} from './types'\n\n/**\n * @public\n */\nexport function usePortal(): PortalContextValue {\n const value = useContext(PortalContext)\n\n if (!value) {\n throw new Error('usePortal(): missing context value')\n }\n\n // NOTE: This check is for future-compatiblity\n // - If the value is not an object, it’s not compatible with the current version\n // - If the value is an object, but doesn’t have `version: 0.0`, it’s not compatible with the current version\n if (!isRecord(value) || value.version !== 0.0) {\n throw new Error('usePortal(): the context value is not compatible')\n }\n\n return value\n}\n","import {createPortal} from 'react-dom'\n\nimport {usePortal} from './usePortal'\n\n/**\n * @public\n */\nexport interface PortalProps {\n children: React.ReactNode\n /**\n * @beta This API might change. DO NOT USE IN PRODUCTION.\n */\n __unstable_name?: string\n}\n\n/**\n * @public\n */\nexport function Portal(props: PortalProps): React.ReactPortal | null {\n const {children, __unstable_name: name} = props\n const portal = usePortal()\n const portalElement =\n (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default\n\n if (!portalElement) {\n return null\n }\n\n return createPortal(children, portalElement)\n}\n","interface PointCmd {\n type: 'point'\n x: number\n y: number\n radius?: number\n}\n\ninterface CurveCmd {\n type: 'curve'\n startControl: Point\n endControl: Point\n curveEnd: Point\n}\n\nexport type Cmd = PointCmd | CurveCmd\n\nexport interface Point {\n x: number\n y: number\n radius?: number\n}\n\nfunction moveTowardsLength(movingPoint: Point, targetPoint: Point, amount: number) {\n const width = targetPoint.x - movingPoint.x\n const height = targetPoint.y - movingPoint.y\n\n const distance = Math.sqrt(width * width + height * height)\n\n return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance))\n}\n\nfunction moveTowardsFractional(movingPoint: Point, targetPoint: Point, fraction: number): Point {\n return {\n x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,\n y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction,\n }\n}\n\nexport function getRoundedCommands(points: Point[]): Cmd[] {\n const len = points.length\n\n const cmds: Cmd[] = []\n\n for (let i = 0; i < len; i += 1) {\n const point = points[i]\n const prevPoint = points[i - 1]\n const nextPoint = points[i + 1]\n\n if (prevPoint && point.radius) {\n const curveStart = moveTowardsLength(point, prevPoint, point.radius)\n const curveEnd = moveTowardsLength(point, nextPoint, point.radius)\n const startControl = moveTowardsFractional(curveStart, point, 0.5)\n const endControl = moveTowardsFractional(point, curveEnd, 0.5)\n\n cmds.push({\n type: 'point',\n ...curveStart,\n })\n\n cmds.push({\n type: 'curve',\n curveEnd,\n startControl,\n endControl,\n })\n } else {\n cmds.push({\n type: 'point',\n ...point,\n })\n }\n }\n\n return cmds\n}\n\nexport function compileCommands(cmds: Cmd[]): string {\n return cmds\n .map((n, idx) => {\n if (n.type === 'point') {\n return `${idx === 0 ? 'M' : 'L'} ${n.x} ${n.y}`\n }\n\n if (n.type === 'curve') {\n return `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}`\n }\n\n return ``\n })\n .join(' ')\n}\n","import {createVar, globalStyle, style} from '@vanilla-extract/css'\n\nexport const arrowSize = createVar()\n\nexport const arrow = style({\n position: 'absolute',\n width: arrowSize,\n height: arrowSize,\n selectors: {\n ':empty + &': {display: 'none'},\n \"[data-placement^='top'] > &\": {bottom: `calc(-1 * ${arrowSize})`},\n \"[data-placement^='right'] > &\": {left: `calc(-1 * ${arrowSize})`},\n \"[data-placement^='left'] > &\": {right: `calc(-1 * ${arrowSize})`},\n \"[data-placement^='bottom'] > &\": {top: `calc(-1 * ${arrowSize})`},\n },\n})\n\nglobalStyle(`${arrow} > svg`, {\n display: 'block',\n lineHeight: 0,\n transformOrigin: `calc(${arrowSize} / 2) calc(${arrowSize} / 2)`,\n})\n\nglobalStyle(`[data-placement^='top'] > ${arrow} > svg`, {transform: 'rotate(0)'})\nglobalStyle(`[data-placement^='right'] > ${arrow} > svg`, {transform: 'rotate(90deg)'})\nglobalStyle(`[data-placement^='left'] > ${arrow} > svg`, {transform: 'rotate(-90deg)'})\nglobalStyle(`[data-placement^='bottom'] > ${arrow} > svg`, {transform: 'rotate(180deg)'})\n\nexport const arrowStroke = style({\n stroke: 'var(--card-shadow-outline-color)',\n})\n\nexport const arrowShape = style({\n fill: 'var(--card-bg-color)',\n})\n","import {assignInlineVars} from '@vanilla-extract/dynamic'\nimport {clsx} from 'clsx/lite'\nimport {HTMLProps, useId} from 'react'\n\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {compileCommands, getRoundedCommands, Point} from './cmds'\n\nimport {arrow, arrowShape, arrowSize, arrowStroke} from './arrow.css'\n\n/** @internal */\nexport function Arrow(\n props: {width: number; height: number; radius?: number} & Omit<\n HTMLProps<HTMLDivElement>,\n 'width' | 'height'\n >,\n): React.JSX.Element {\n const {className, width: w, height: h, radius = 0, ref, style, ...restProps} = props\n const {card} = useTheme_v2()\n const strokeMaskId = `stroke-mask-${useId()}`\n const strokeWidth = card.shadow.outline\n\n const center = w / 2\n\n const points: Point[] = [\n {\n x: 0,\n y: 0,\n },\n {\n x: radius,\n y: 0,\n radius,\n },\n {\n x: center,\n y: h - 1,\n radius,\n },\n {\n x: w - radius,\n y: 0,\n radius,\n },\n {\n x: w,\n y: 0,\n },\n ]\n\n const cmds = getRoundedCommands(points)\n const path = compileCommands(cmds)\n\n // oxlint-disable-next-line no-unnecessary-template-expression\n const strokePath = `${path}`\n const fillPath = `${path} M ${w} -1 M 0 -1 Z`\n\n return (\n <div\n data-ui=\"Arrow\"\n {...restProps}\n className={clsx(arrow, className)}\n ref={ref}\n style={{...style, ...assignInlineVars({[arrowSize]: `${w}px`})}}\n >\n <svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id={strokeMaskId}>\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />\n <path className={arrowShape} d={fillPath} />\n </svg>\n </div>\n )\n}\n"],"mappings":";;;;;;;AAGA,MAAa,yBAAyB,0BACpC,sCACA,IACF,GCAM,gBAA6C;CACjD,SAAS;CACT,SAAS;AACX;;;;AAKA,SAAgB,qBAAkD;CAChE,IAAM,QAAQ,WAAW,sBAAsB;CAK/C,IAAI,UAAU,CAAC,SAAS,KAAK,KAAK,MAAM,YAAY,IAClD,MAAU,MAAM,2DAA2D;CAG7E,OAAO,SAAS;AAClB;ACrBA,MAAM,MAAM,6BACN,aAAa,OAAO,IAAI,GAAG,IAAI,SAAS;AAE9C,YAAY,cAAc;AAuB1B,MAAa,gBAAgB,0BAA8C,KAAK;CApB9E,SAAS;CACT,iBAAiB;CACjB,IAA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,QAEUC,OAAAA,EAAAA,QADPC,MAHR,MAAA,oBAAC,QAAD;EACE,WAAW;EACX,GAAG;EACH,MAAMA;EACN,aAAaD;CACd,CAAA,GAHI,EAAA,MAAA,YAEUA,EAAAA,MAAAA,KADPC,EAAAA,MAAAA;CAGRC,IAAAA;CAAgC,AAAA,EAAA,QAAA,0BAAhC,MAAA,oBAAC,QAAD;EAAM,WAAW;EAAY,GAAG;CAAW,CAAA,GAAX,EAAA,MAAA;CAVlCC,IAAAA;CAIEJ,AAAAA,EAAAA,QAAAA,OAAAA,EAAAA,QAMAG,OAAAA,EAAAA,QAViCE,MAAAA,EAAAA,QACjCN,MAAAA,EAAAA,QADU,KAAZ,MAAA,qBAAC,OAAD;EAAK,OAAO;EAAG,QAAQ;EAAG,SAASM;EAAnC,UAAA;GACEN;GAGAC;GAMAG;EACG;KAPHH,EAAAA,MAAAA,KAMAG,EAAAA,MAAAA,KAViCE,EAAAA,MAAAA,IACjCN,EAAAA,MAAAA,IADU,EAAA,MAAA;CAPdO,IAAAA;CADF,OAKS,EAAA,QAAA,OAAA,EAAA,QAFD,aAAA,EAAA,QAKJF,OAAAA,EAAAA,QAJWV,MAAAA,EAAAA,QAEJG,MALT,MAAA,oBAAC,OAAD;EACE,WAAQ;EACR,GAAI;EACJ,WAAWH;EACN;EACL,OAAOG;EAEPO,UAAAA;CAYG,CAAA,GAfE,EAAA,MAAA,KAFD,EAAA,MAAA,WAKJA,EAAAA,MAAAA,KAJWV,EAAAA,MAAAA,IAEJG,EAAAA,MAAAA,gCALTS;AAqBJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../src/core/components/autocomplete/types.ts","../src/core/components/autocomplete/autocomplete.tsx"],"mappings":";;;;;;;KAKY,8BAA8B,iBACxC,KAAK,MAAM,UAAU;;;;UAKN;EACf;;;;;UAMe;EACf;EACA;EACA;EACA;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;KAMU,kBACR,0BACA,2BACA,4BACA,0BACA,oCACA,oCACA,6BACA,6BACA;;;;UCzDa,kBAAkB,eAAe,yBAAyB;EACzE;EACA;EACA,gBAAgB,eAAe,QAAQ;EACvC;EAEA,OAAO,cAAc;EACrB;;EAEA,UAAU;EACV;EACA,YAAY;EACZ,iBAAiB;EACjB,YAAY;;EAEZ,uBAAuB;;EAEvB;;EAEA,UAAU;EACV;EACA,UAAU,KAAK,sEACb,KAAK,UAAU;EACjB,SAAS;EACT,SAAS,SAAS;;EAElB,kBAAkB;;EAElB,gBAAgB,QAAQ,WAAW,MAAM,IAAI;;EAE7C,iBACE;IACE,SAAS,MAAM,IAAI;IACnB;IACA,cAAc;IACd;IACA;KAEF,KAAK,IAAI,oBACN;EACL,eAAe,eAAe,SAAS;EACvC,SAAS;;EAET;;;;;;;;wBAec,aAAa,eAAe,wBAC1C,OAAO,kBAAkB,UACvB,KACE,UAAU,gSAmBX,IAAA"}
1
+ {"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../src/core/components/autocomplete/types.ts","../src/core/components/autocomplete/autocomplete.tsx"],"mappings":";;;;;;;KAKY,8BAA8B,iBACxC,KAAK,MAAM,UAAU;;;;UAKN;EACf;;;;;UAMe;EACf;EACA;EACA;EACA;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;KAMU,kBACR,0BACA,2BACA,4BACA,0BACA,oCACA,oCACA,6BACA,6BACA;;;;UC1Da,kBAAkB,eAAe,yBAAyB;EACzE;EACA;EACA,gBAAgB,eAAe,QAAQ;EACvC;EAEA,OAAO,cAAc;EACrB;;EAEA,UAAU;EACV;EACA,YAAY;EACZ,iBAAiB;EACjB,YAAY;;EAEZ,uBAAuB;;EAEvB;;EAEA,UAAU;EACV;EACA,UAAU,KAAK,sEACb,KAAK,UAAU;EACjB,SAAS;EACT,SAAS,SAAS;;EAElB,kBAAkB;;EAElB,gBAAgB,QAAQ,WAAW,MAAM,IAAI;;EAE7C,iBACE;IACE,SAAS,MAAM,IAAI;IACnB;IACA,cAAc;IACd;IACA;KAEF,KAAK,IAAI,oBACN;EACL,eAAe,eAAe,SAAS;EACvC,SAAS;;EAET;;;;;;;;wBAec,aAAa,eAAe,wBAC1C,OAAO,kBAAkB,UACvB,KACE,UAAU,gSAmBX,IAAA"}
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { n as _getArrayProp, o as EMPTY_ARRAY, s as EMPTY_RECORD } from "./helpers-C8xxXAQC.js";
3
- import { f as focusFirstDescendant, h as _raf, t as TextInput, u as _hasFocus } from "./textInput-pSfQjkmx.js";
3
+ import { f as focusFirstDescendant, h as _raf, t as TextInput, u as _hasFocus } from "./textInput-fGZVEKGs.js";
4
4
  import { t as _isEnterToClickElement } from "./element-BYgCE_iK.js";
5
- import { s as Card, y as Box } from "./useLayer-D1usxIE0.js";
6
- import { n as Text, t as Stack } from "./stack-rsNFPq2-.js";
7
- import { t as Button } from "./button-BNyKSDyA.js";
8
- import { t as Popover } from "./popover-B7-28L8y.js";
5
+ import { s as Card, y as Box } from "./useLayer-CUKYjJYq.js";
6
+ import { n as Text, t as Stack } from "./stack-SbGBZ0x3.js";
7
+ import { t as Button } from "./button-Wii-24Xu.js";
8
+ import { t as Popover } from "./popover-DR6UQQvq.js";
9
9
  import { c } from "react/compiler-runtime";
10
10
  import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
11
11
  import { SpinnerIcon } from "@sanity/icons/Spinner";
12
12
  import { clsx } from "clsx/lite";
13
- import { cloneElement, startTransition, useEffect, useImperativeHandle, useReducer, useRef, useState } from "react";
13
+ import { cloneElement, useEffect, useImperativeHandle, useReducer, useRef, useState } from "react";
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
15
  function AutocompleteOption(props) {
16
16
  let $ = c(11), { children, id, onSelect, selected, value } = props, t0;
@@ -61,7 +61,7 @@ function autocompleteReducer(state, msg) {
61
61
  query: null
62
62
  } : msg.type === "root/open" ? {
63
63
  ...state,
64
- query: state.query || msg.query
64
+ query: state.query ?? msg.query
65
65
  } : msg.type === "root/setActiveValue" ? {
66
66
  ...state,
67
67
  activeValue: msg.value,
@@ -101,7 +101,7 @@ const DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, D
101
101
  * @public
102
102
  */
103
103
  function Autocomplete(props) {
104
- let $ = c(187), customValidity, disabled, filterOptionProp, forwardedRef, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, valueProp;
104
+ let $ = c(186), customValidity, disabled, filterOptionProp, forwardedRef, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, valueProp;
105
105
  $[0] === props ? (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], forwardedRef = $[4], icon = $[5], id = $[6], loading = $[7], onBlur = $[8], onChange = $[9], onFocus = $[10], onQueryChange = $[11], onSelect = $[12], openButton = $[13], openOnFocus = $[14], optionsProp = $[15], prefix = $[16], readOnly = $[17], relatedElements = $[18], renderOptionProp = $[19], renderPopover = $[20], restProps = $[21], suffix = $[22], t0 = $[23], t1 = $[24], t2 = $[25], t3 = $[26], t4 = $[27], t5 = $[28], t6 = $[29], valueProp = $[30]) : ({border: t0, customValidity, disabled, filterOption: filterOptionProp, fontSize: t1, icon, id, listBox: t2, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, options: optionsProp, padding: t3, popover: t4, prefix, radius: t5, readOnly, ref: forwardedRef, relatedElements, renderOption: renderOptionProp, renderPopover, renderValue: t6, suffix, value: valueProp, ...restProps} = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = forwardedRef, $[5] = icon, $[6] = id, $[7] = loading, $[8] = onBlur, $[9] = onChange, $[10] = onFocus, $[11] = onQueryChange, $[12] = onSelect, $[13] = openButton, $[14] = openOnFocus, $[15] = optionsProp, $[16] = prefix, $[17] = readOnly, $[18] = relatedElements, $[19] = renderOptionProp, $[20] = renderPopover, $[21] = restProps, $[22] = suffix, $[23] = t0, $[24] = t1, $[25] = t2, $[26] = t3, $[27] = t4, $[28] = t5, $[29] = t6, $[30] = valueProp);
106
106
  let border = t0 === void 0 || t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null, t9;
107
107
  $[31] !== t7 || $[32] !== t8 ? (t9 = {
@@ -126,23 +126,19 @@ function Autocomplete(props) {
126
126
  })
127
127
  });
128
128
  }, $[34] = fontSize, $[35] = paddingProp, $[36] = t10) : t10 = $[36];
129
- let renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, _setInputElement] = useState(null), t11;
130
- $[37] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (node) => {
131
- startTransition(() => _setInputElement(node));
132
- }, $[37] = t11) : t11 = $[37];
133
- let setInputElement = t11, listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1), t12, t13;
134
- $[38] === inputElement ? (t12 = $[39], t13 = $[40]) : (t12 = () => inputElement, t13 = [inputElement], $[38] = inputElement, $[39] = t12, $[40] = t13), useImperativeHandle(inputElementRef, t12, t13);
135
- let t14, t15;
136
- $[41] === inputElement ? (t14 = $[42], t15 = $[43]) : (t14 = () => inputElement, t15 = [inputElement], $[41] = inputElement, $[42] = t14, $[43] = t15), useImperativeHandle(forwardedRef, t14, t15);
137
- let listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = _getArrayProp(paddingProp), t16;
138
- $[44] !== options || $[45] !== value ? (t16 = value === null ? void 0 : options.find((o) => o.value === value), $[44] = options, $[45] = value, $[46] = t16) : t16 = $[46];
139
- let currentOption = t16, t17;
140
- if ($[47] !== filterOption || $[48] !== options || $[49] !== query) {
141
- let t18;
142
- $[51] !== filterOption || $[52] !== query ? (t18 = (option) => !query || filterOption(query, option), $[51] = filterOption, $[52] = query, $[53] = t18) : t18 = $[53], t17 = options.filter(t18), $[47] = filterOption, $[48] = options, $[49] = query, $[50] = t17;
143
- } else t17 = $[50];
144
- let filteredOptions = t17, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, t18;
145
- $[54] !== onBlur || $[55] !== onQueryChange || $[56] !== relatedElements ? (t18 = (event) => {
129
+ let renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, setInputElement] = useState(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1), t11, t12;
130
+ $[37] === inputElement ? (t11 = $[38], t12 = $[39]) : (t11 = () => inputElement, t12 = [inputElement], $[37] = inputElement, $[38] = t11, $[39] = t12), useImperativeHandle(inputElementRef, t11, t12);
131
+ let t13, t14;
132
+ $[40] === inputElement ? (t13 = $[41], t14 = $[42]) : (t13 = () => inputElement, t14 = [inputElement], $[40] = inputElement, $[41] = t13, $[42] = t14), useImperativeHandle(forwardedRef, t13, t14);
133
+ let listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = _getArrayProp(paddingProp), t15;
134
+ $[43] !== options || $[44] !== value ? (t15 = value === null ? void 0 : options.find((o) => o.value === value), $[43] = options, $[44] = value, $[45] = t15) : t15 = $[45];
135
+ let currentOption = t15, t16;
136
+ if ($[46] !== filterOption || $[47] !== options || $[48] !== query) {
137
+ let t17;
138
+ $[50] !== filterOption || $[51] !== query ? (t17 = (option) => !query || filterOption(query, option), $[50] = filterOption, $[51] = query, $[52] = t17) : t17 = $[52], t16 = options.filter(t17), $[46] = filterOption, $[47] = options, $[48] = query, $[49] = t16;
139
+ } else t16 = $[49];
140
+ let filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, t17;
141
+ $[53] !== onBlur || $[54] !== onQueryChange || $[55] !== relatedElements ? (t17 = (event) => {
146
142
  setTimeout(() => {
147
143
  if (popoverMouseWithinRef.current) return;
148
144
  let elements = (relatedElements || []).concat(rootElementRef.current ? [rootElementRef.current] : [], resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []), focusInside = !1;
@@ -154,24 +150,24 @@ function Autocomplete(props) {
154
150
  }
155
151
  focusInside === !1 && (dispatch({ type: "root/blur" }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
156
152
  }, 0);
157
- }, $[54] = onBlur, $[55] = onQueryChange, $[56] = relatedElements, $[57] = t18) : t18 = $[57];
158
- let handleRootBlur = t18, t19;
159
- $[58] === Symbol.for("react.memo_cache_sentinel") ? (t19 = (event_0) => {
153
+ }, $[53] = onBlur, $[54] = onQueryChange, $[55] = relatedElements, $[56] = t17) : t17 = $[56];
154
+ let handleRootBlur = t17, t18;
155
+ $[57] === Symbol.for("react.memo_cache_sentinel") ? (t18 = (event_0) => {
160
156
  let listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
161
157
  listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
162
158
  type: "root/setListFocused",
163
159
  listFocused: listFocused_0
164
160
  }));
165
- }, $[58] = t19) : t19 = $[58];
166
- let handleRootFocus = t19, t20;
167
- $[59] !== onChange || $[60] !== onQueryChange || $[61] !== onSelect ? (t20 = (v) => {
161
+ }, $[57] = t18) : t18 = $[57];
162
+ let handleRootFocus = t18, t19;
163
+ $[58] !== onChange || $[59] !== onQueryChange || $[60] !== onSelect ? (t19 = (v) => {
168
164
  dispatch({
169
165
  type: "value/change",
170
166
  value: v
171
167
  }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
172
- }, $[59] = onChange, $[60] = onQueryChange, $[61] = onSelect, $[62] = t20) : t20 = $[62];
173
- let handleOptionSelect = t20, t21;
174
- $[63] !== activeValue || $[64] !== filteredOptions || $[65] !== filteredOptionsLen || $[66] !== onQueryChange ? (t21 = (event_1) => {
168
+ }, $[58] = onChange, $[59] = onQueryChange, $[60] = onSelect, $[61] = t19) : t19 = $[61];
169
+ let handleOptionSelect = t19, t20;
170
+ $[62] !== activeValue || $[63] !== filteredOptions || $[64] !== filteredOptionsLen || $[65] !== onQueryChange ? (t20 = (event_1) => {
175
171
  if (event_1.key === "ArrowDown") {
176
172
  if (event_1.preventDefault(), !filteredOptionsLen) return;
177
173
  let activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
@@ -201,44 +197,44 @@ function Autocomplete(props) {
201
197
  inputElementRef.current?.focus();
202
198
  return;
203
199
  }
204
- }, $[63] = activeValue, $[64] = filteredOptions, $[65] = filteredOptionsLen, $[66] = onQueryChange, $[67] = t21) : t21 = $[67];
205
- let handleRootKeyDown = t21, t22;
206
- $[68] === onQueryChange ? t22 = $[69] : (t22 = (event_2) => {
200
+ }, $[62] = activeValue, $[63] = filteredOptions, $[64] = filteredOptionsLen, $[65] = onQueryChange, $[66] = t20) : t20 = $[66];
201
+ let handleRootKeyDown = t20, t21;
202
+ $[67] === onQueryChange ? t21 = $[68] : (t21 = (event_2) => {
207
203
  let nextQuery = event_2.currentTarget.value;
208
204
  dispatch({
209
205
  type: "input/change",
210
206
  query: nextQuery
211
207
  }), onQueryChange && onQueryChange(nextQuery);
212
- }, $[68] = onQueryChange, $[69] = t22);
213
- let handleInputChange = t22, t23;
214
- $[70] !== currentOption || $[71] !== renderValue || $[72] !== value ? (t23 = () => {
208
+ }, $[67] = onQueryChange, $[68] = t21);
209
+ let handleInputChange = t21, t22;
210
+ $[69] !== currentOption || $[70] !== renderValue || $[71] !== value ? (t22 = () => {
215
211
  dispatch({
216
212
  type: "root/open",
217
213
  query: value ? renderValue(value, currentOption) : ""
218
214
  });
219
- }, $[70] = currentOption, $[71] = renderValue, $[72] = value, $[73] = t23) : t23 = $[73];
220
- let dispatchOpen = t23, t24;
221
- $[74] !== dispatchOpen || $[75] !== focused || $[76] !== onFocus || $[77] !== openOnFocus ? (t24 = (event_3) => {
215
+ }, $[69] = currentOption, $[70] = renderValue, $[71] = value, $[72] = t22) : t22 = $[72];
216
+ let dispatchOpen = t22, t23;
217
+ $[73] !== dispatchOpen || $[74] !== focused || $[75] !== onFocus || $[76] !== openOnFocus ? (t23 = (event_3) => {
222
218
  focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
223
- }, $[74] = dispatchOpen, $[75] = focused, $[76] = onFocus, $[77] = openOnFocus, $[78] = t24) : t24 = $[78];
224
- let handleInputFocus = t24, t25;
225
- $[79] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
219
+ }, $[73] = dispatchOpen, $[74] = focused, $[75] = onFocus, $[76] = openOnFocus, $[77] = t23) : t23 = $[77];
220
+ let handleInputFocus = t23, t24;
221
+ $[78] === Symbol.for("react.memo_cache_sentinel") ? (t24 = () => {
226
222
  popoverMouseWithinRef.current = !0;
227
- }, $[79] = t25) : t25 = $[79];
228
- let handlePopoverMouseEnter = t25, t26;
229
- $[80] === Symbol.for("react.memo_cache_sentinel") ? (t26 = () => {
223
+ }, $[78] = t24) : t24 = $[78];
224
+ let handlePopoverMouseEnter = t24, t25;
225
+ $[79] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
230
226
  popoverMouseWithinRef.current = !1;
231
- }, $[80] = t26) : t26 = $[80];
232
- let handlePopoverMouseLeave = t26, t27;
233
- $[81] !== onChange || $[82] !== onQueryChange ? (t27 = () => {
227
+ }, $[79] = t25) : t25 = $[79];
228
+ let handlePopoverMouseLeave = t25, t26;
229
+ $[80] !== onChange || $[81] !== onQueryChange ? (t26 = () => {
234
230
  dispatch({ type: "root/clear" }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
235
- }, $[81] = onChange, $[82] = onQueryChange, $[83] = t27) : t27 = $[83];
236
- let handleClearButtonClick = t27, t28;
237
- $[84] === Symbol.for("react.memo_cache_sentinel") ? (t28 = () => {
231
+ }, $[80] = onChange, $[81] = onQueryChange, $[82] = t26) : t26 = $[82];
232
+ let handleClearButtonClick = t26, t27;
233
+ $[83] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
238
234
  dispatch({ type: "input/focus" });
239
- }, $[84] = t28) : t28 = $[84];
240
- let handleClearButtonFocus = t28, t29, t30;
241
- $[85] === valueProp ? (t29 = $[86], t30 = $[87]) : (t29 = () => {
235
+ }, $[83] = t27) : t27 = $[83];
236
+ let handleClearButtonFocus = t27, t28, t29;
237
+ $[84] === valueProp ? (t28 = $[85], t29 = $[86]) : (t28 = () => {
242
238
  if (valueProp !== valuePropRef.current) {
243
239
  valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
244
240
  type: "value/change",
@@ -250,16 +246,16 @@ function Autocomplete(props) {
250
246
  type: "value/change",
251
247
  value: valueProp || null
252
248
  }));
253
- }, t30 = [valueProp], $[85] = valueProp, $[86] = t29, $[87] = t30), useEffect(t29, t30);
254
- let t31, t32;
255
- $[88] === focused ? (t31 = $[89], t32 = $[90]) : (t31 = () => {
249
+ }, t29 = [valueProp], $[84] = valueProp, $[85] = t28, $[86] = t29), useEffect(t28, t29);
250
+ let t30, t31;
251
+ $[87] === focused ? (t30 = $[88], t31 = $[89]) : (t30 = () => {
256
252
  !focused && valueRef.current && dispatch({
257
253
  type: "root/setActiveValue",
258
254
  value: valueRef.current
259
255
  });
260
- }, t32 = [focused], $[88] = focused, $[89] = t31, $[90] = t32), useEffect(t31, t32);
261
- let t33, t34;
262
- $[91] !== activeValue || $[92] !== filteredOptions ? (t33 = () => {
256
+ }, t31 = [focused], $[87] = focused, $[88] = t30, $[89] = t31), useEffect(t30, t31);
257
+ let t32, t33;
258
+ $[90] !== activeValue || $[91] !== filteredOptions ? (t32 = () => {
263
259
  let listElement = listBoxElementRef.current;
264
260
  if (!listElement) return;
265
261
  let activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
@@ -270,25 +266,25 @@ function Autocomplete(props) {
270
266
  focusFirstDescendant(activeItemElement);
271
267
  }
272
268
  }
273
- }, t34 = [activeValue, filteredOptions], $[91] = activeValue, $[92] = filteredOptions, $[93] = t33, $[94] = t34) : (t33 = $[93], t34 = $[94]), useEffect(t33, t34);
274
- let t35;
269
+ }, t33 = [activeValue, filteredOptions], $[90] = activeValue, $[91] = filteredOptions, $[92] = t32, $[93] = t33) : (t32 = $[92], t33 = $[93]), useEffect(t32, t33);
270
+ let t34;
275
271
  bb0: {
276
272
  if (!loading && !disabled && value) {
277
- let t36;
278
- $[95] === Symbol.for("react.memo_cache_sentinel") ? (t36 = {
273
+ let t35;
274
+ $[94] === Symbol.for("react.memo_cache_sentinel") ? (t35 = {
279
275
  "aria-label": "Clear",
280
276
  onFocus: handleClearButtonFocus
281
- }, $[95] = t36) : t36 = $[95], t35 = t36;
277
+ }, $[94] = t35) : t35 = $[94], t34 = t35;
282
278
  break bb0;
283
279
  }
284
- t35 = void 0;
280
+ t34 = void 0;
285
281
  }
286
- let clearButton = t35, openButtonBoxPadding = padding.map(_temp), openButtonPadding = padding.map(_temp2), openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD, t36;
287
- $[96] !== dispatchOpen || $[97] !== openButtonProps ? (t36 = (event_4) => {
282
+ let clearButton = t34, openButtonBoxPadding = padding.map(_temp), openButtonPadding = padding.map(_temp2), openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD, t35;
283
+ $[95] !== dispatchOpen || $[96] !== openButtonProps ? (t35 = (event_4) => {
288
284
  dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
289
- }, $[96] = dispatchOpen, $[97] = openButtonProps, $[98] = t36) : t36 = $[98];
290
- let handleOpenClick = t36, t37;
291
- $[99] !== disabled || $[100] !== expanded || $[101] !== fontSize || $[102] !== handleOpenClick || $[103] !== openButton || $[104] !== openButtonBoxPadding || $[105] !== openButtonPadding || $[106] !== openButtonProps || $[107] !== readOnly ? (t37 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, {
285
+ }, $[95] = dispatchOpen, $[96] = openButtonProps, $[97] = t35) : t35 = $[97];
286
+ let handleOpenClick = t35, t36;
287
+ $[98] !== disabled || $[99] !== expanded || $[100] !== fontSize || $[101] !== handleOpenClick || $[102] !== openButton || $[103] !== openButtonBoxPadding || $[104] !== openButtonPadding || $[105] !== openButtonProps || $[106] !== readOnly ? (t36 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, {
292
288
  "aria-hidden": expanded,
293
289
  padding: openButtonBoxPadding,
294
290
  children: /* @__PURE__ */ jsx(Button, {
@@ -301,36 +297,36 @@ function Autocomplete(props) {
301
297
  ...openButtonProps,
302
298
  onClick: handleOpenClick
303
299
  })
304
- }) : void 0, $[99] = disabled, $[100] = expanded, $[101] = fontSize, $[102] = handleOpenClick, $[103] = openButton, $[104] = openButtonBoxPadding, $[105] = openButtonPadding, $[106] = openButtonProps, $[107] = readOnly, $[108] = t37) : t37 = $[108];
305
- let openButtonNode = t37, t38;
300
+ }) : void 0, $[98] = disabled, $[99] = expanded, $[100] = fontSize, $[101] = handleOpenClick, $[102] = openButton, $[103] = openButtonBoxPadding, $[104] = openButtonPadding, $[105] = openButtonProps, $[106] = readOnly, $[107] = t36) : t36 = $[107];
301
+ let openButtonNode = t36, t37;
306
302
  bb1: {
307
303
  if (query === null) {
308
304
  if (value !== null) {
309
- let t39;
310
- $[109] !== currentOption || $[110] !== renderValue || $[111] !== value ? (t39 = renderValue(value, currentOption), $[109] = currentOption, $[110] = renderValue, $[111] = value, $[112] = t39) : t39 = $[112], t38 = t39;
305
+ let t38;
306
+ $[108] !== currentOption || $[109] !== renderValue || $[110] !== value ? (t38 = renderValue(value, currentOption), $[108] = currentOption, $[109] = renderValue, $[110] = value, $[111] = t38) : t38 = $[111], t37 = t38;
311
307
  break bb1;
312
308
  }
313
- t38 = "";
309
+ t37 = "";
314
310
  break bb1;
315
311
  }
316
- t38 = query;
312
+ t37 = query;
317
313
  }
318
- let inputValue = t38, t39;
319
- $[113] === listFocused ? t39 = $[114] : (t39 = (event_5) => {
314
+ let inputValue = t37, t38;
315
+ $[112] === listFocused ? t38 = $[113] : (t38 = (event_5) => {
320
316
  event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
321
- }, $[113] = listFocused, $[114] = t39);
322
- let handleListBoxKeyDown = t39, t40;
317
+ }, $[112] = listFocused, $[113] = t38);
318
+ let handleListBoxKeyDown = t38, t39;
323
319
  bb2: {
324
320
  if (filteredOptions.length === 0) {
325
- t40 = null;
321
+ t39 = null;
326
322
  break bb2;
327
323
  }
328
- let t41 = listBox?.className, t42;
329
- $[115] === t41 ? t42 = $[116] : (t42 = clsx(autocompleteListBox, t41), $[115] = t41, $[116] = t42);
330
- let t43;
331
- if ($[117] !== activeValue || $[118] !== currentOption || $[119] !== filteredOptions || $[120] !== handleOptionSelect || $[121] !== id || $[122] !== listFocused || $[123] !== loading || $[124] !== renderOption) {
332
- let t44;
333
- $[126] !== activeValue || $[127] !== currentOption || $[128] !== handleOptionSelect || $[129] !== id || $[130] !== listFocused || $[131] !== loading || $[132] !== renderOption ? (t44 = (option_0) => {
324
+ let t40 = listBox?.className, t41;
325
+ $[114] === t40 ? t41 = $[115] : (t41 = clsx(autocompleteListBox, t40), $[114] = t40, $[115] = t41);
326
+ let t42;
327
+ if ($[116] !== activeValue || $[117] !== currentOption || $[118] !== filteredOptions || $[119] !== handleOptionSelect || $[120] !== id || $[121] !== listFocused || $[122] !== loading || $[123] !== renderOption) {
328
+ let t43;
329
+ $[125] !== activeValue || $[126] !== currentOption || $[127] !== handleOptionSelect || $[128] !== id || $[129] !== listFocused || $[130] !== loading || $[131] !== renderOption ? (t43 = (option_0) => {
334
330
  let active = activeValue === null ? currentOption === option_0 : option_0.value === activeValue;
335
331
  return /* @__PURE__ */ jsx(AutocompleteOption, {
336
332
  id: `${id}-option-${option_0.value}`,
@@ -343,10 +339,10 @@ function Autocomplete(props) {
343
339
  tabIndex: listFocused && active ? 0 : -1
344
340
  })
345
341
  }, option_0.value);
346
- }, $[126] = activeValue, $[127] = currentOption, $[128] = handleOptionSelect, $[129] = id, $[130] = listFocused, $[131] = loading, $[132] = renderOption, $[133] = t44) : t44 = $[133], t43 = filteredOptions.map(t44), $[117] = activeValue, $[118] = currentOption, $[119] = filteredOptions, $[120] = handleOptionSelect, $[121] = id, $[122] = listFocused, $[123] = loading, $[124] = renderOption, $[125] = t43;
347
- } else t43 = $[125];
348
- let t44;
349
- $[134] !== listBoxId || $[135] !== t43 ? (t44 = /* @__PURE__ */ jsx(Stack, {
342
+ }, $[125] = activeValue, $[126] = currentOption, $[127] = handleOptionSelect, $[128] = id, $[129] = listFocused, $[130] = loading, $[131] = renderOption, $[132] = t43) : t43 = $[132], t42 = filteredOptions.map(t43), $[116] = activeValue, $[117] = currentOption, $[118] = filteredOptions, $[119] = handleOptionSelect, $[120] = id, $[121] = listFocused, $[122] = loading, $[123] = renderOption, $[124] = t42;
343
+ } else t42 = $[124];
344
+ let t43;
345
+ $[133] !== listBoxId || $[134] !== t42 ? (t43 = /* @__PURE__ */ jsx(Stack, {
350
346
  as: "ul",
351
347
  "aria-multiselectable": !1,
352
348
  "data-ui": "AutoComplete__resultsList",
@@ -354,40 +350,40 @@ function Autocomplete(props) {
354
350
  ref: listBoxElementRef,
355
351
  role: "listbox",
356
352
  gap: 1,
357
- children: t43
358
- }), $[134] = listBoxId, $[135] = t43, $[136] = t44) : t44 = $[136];
359
- let t45;
360
- $[137] !== handleListBoxKeyDown || $[138] !== listBox || $[139] !== t42 || $[140] !== t44 ? (t45 = /* @__PURE__ */ jsx(Box, {
353
+ children: t42
354
+ }), $[133] = listBoxId, $[134] = t42, $[135] = t43) : t43 = $[135];
355
+ let t44;
356
+ $[136] !== handleListBoxKeyDown || $[137] !== listBox || $[138] !== t41 || $[139] !== t43 ? (t44 = /* @__PURE__ */ jsx(Box, {
361
357
  "data-ui": "AutoComplete__results",
362
358
  onKeyDown: handleListBoxKeyDown,
363
359
  padding: 1,
364
360
  ...listBox,
365
- className: t42,
361
+ className: t41,
366
362
  tabIndex: -1,
367
- children: t44
368
- }), $[137] = handleListBoxKeyDown, $[138] = listBox, $[139] = t42, $[140] = t44, $[141] = t45) : t45 = $[141], t40 = t45;
363
+ children: t43
364
+ }), $[136] = handleListBoxKeyDown, $[137] = listBox, $[138] = t41, $[139] = t43, $[140] = t44) : t44 = $[140], t39 = t44;
369
365
  }
370
- let content = t40, t41;
366
+ let content = t39, t40;
371
367
  bb3: {
372
368
  if (renderPopover) {
373
- let t42 = !expanded, t43;
374
- $[142] !== content || $[143] !== handlePopoverMouseEnter || $[144] !== handlePopoverMouseLeave || $[145] !== inputElement || $[146] !== renderPopover || $[147] !== t42 ? (t43 = /* @__PURE__ */ jsx(RenderPopover, {
369
+ let t41 = !expanded, t42;
370
+ $[141] !== content || $[142] !== handlePopoverMouseEnter || $[143] !== handlePopoverMouseLeave || $[144] !== inputElement || $[145] !== renderPopover || $[146] !== t41 ? (t42 = /* @__PURE__ */ jsx(RenderPopover, {
375
371
  content,
376
- hidden: t42,
372
+ hidden: t41,
377
373
  inputElement,
378
374
  onMouseEnter: handlePopoverMouseEnter,
379
375
  onMouseLeave: handlePopoverMouseLeave,
380
376
  resultsPopoverElementRef,
381
377
  renderPopover
382
- }), $[142] = content, $[143] = handlePopoverMouseEnter, $[144] = handlePopoverMouseLeave, $[145] = inputElement, $[146] = renderPopover, $[147] = t42, $[148] = t43) : t43 = $[148], t41 = t43;
378
+ }), $[141] = content, $[142] = handlePopoverMouseEnter, $[143] = handlePopoverMouseLeave, $[144] = inputElement, $[145] = renderPopover, $[146] = t41, $[147] = t42) : t42 = $[147], t40 = t42;
383
379
  break bb3;
384
380
  }
385
381
  if (filteredOptionsLen === 0) {
386
- t41 = null;
382
+ t40 = null;
387
383
  break bb3;
388
384
  }
389
- let t42;
390
- $[149] !== content || $[150] !== expanded || $[151] !== handlePopoverMouseEnter || $[152] !== handlePopoverMouseLeave || $[153] !== inputElement || $[154] !== popover || $[155] !== radius ? (t42 = /* @__PURE__ */ jsx(Popover, {
385
+ let t41;
386
+ $[148] !== content || $[149] !== expanded || $[150] !== handlePopoverMouseEnter || $[151] !== handlePopoverMouseLeave || $[152] !== inputElement || $[153] !== popover || $[154] !== radius ? (t41 = /* @__PURE__ */ jsx(Popover, {
391
387
  arrow: !1,
392
388
  constrainSize: !0,
393
389
  content,
@@ -403,12 +399,12 @@ function Autocomplete(props) {
403
399
  ref: resultsPopoverElementRef,
404
400
  referenceElement: inputElement,
405
401
  ...popover
406
- }), $[149] = content, $[150] = expanded, $[151] = handlePopoverMouseEnter, $[152] = handlePopoverMouseLeave, $[153] = inputElement, $[154] = popover, $[155] = radius, $[156] = t42) : t42 = $[156], t41 = t42;
402
+ }), $[148] = content, $[149] = expanded, $[150] = handlePopoverMouseEnter, $[151] = handlePopoverMouseLeave, $[152] = inputElement, $[153] = popover, $[154] = radius, $[155] = t41) : t41 = $[155], t40 = t41;
407
403
  }
408
- let results = t41, t42;
409
- $[157] === loading ? t42 = $[158] : (t42 = loading && /* @__PURE__ */ jsx(SpinnerIcon, { className: "_1b6o2se1" }), $[157] = loading, $[158] = t42);
410
- let t43 = suffix || openButtonNode, t44;
411
- $[159] !== activeItemId || $[160] !== border || $[161] !== clearButton || $[162] !== customValidity || $[163] !== disabled || $[164] !== expanded || $[165] !== fontSize || $[166] !== handleClearButtonClick || $[167] !== handleInputChange || $[168] !== handleInputFocus || $[169] !== icon || $[170] !== id || $[171] !== inputValue || $[172] !== listBoxId || $[173] !== padding || $[174] !== prefix || $[175] !== radius || $[176] !== readOnly || $[177] !== restProps || $[178] !== t42 || $[179] !== t43 ? (t44 = /* @__PURE__ */ jsx(TextInput, {
404
+ let results = t40, t41;
405
+ $[156] === loading ? t41 = $[157] : (t41 = loading && /* @__PURE__ */ jsx(SpinnerIcon, { className: "_1b6o2se1" }), $[156] = loading, $[157] = t41);
406
+ let t42 = suffix || openButtonNode, t43;
407
+ $[158] !== activeItemId || $[159] !== border || $[160] !== clearButton || $[161] !== customValidity || $[162] !== disabled || $[163] !== expanded || $[164] !== fontSize || $[165] !== handleClearButtonClick || $[166] !== handleInputChange || $[167] !== handleInputFocus || $[168] !== icon || $[169] !== id || $[170] !== inputValue || $[171] !== listBoxId || $[172] !== padding || $[173] !== prefix || $[174] !== radius || $[175] !== readOnly || $[176] !== restProps || $[177] !== t41 || $[178] !== t42 ? (t43 = /* @__PURE__ */ jsx(TextInput, {
412
408
  ...restProps,
413
409
  "aria-activedescendant": activeItemId,
414
410
  "aria-autocomplete": "list",
@@ -423,7 +419,7 @@ function Autocomplete(props) {
423
419
  disabled,
424
420
  fontSize,
425
421
  icon,
426
- iconRight: t42,
422
+ iconRight: t41,
427
423
  id,
428
424
  inputMode: "search",
429
425
  onChange: handleInputChange,
@@ -436,19 +432,19 @@ function Autocomplete(props) {
436
432
  ref: setInputElement,
437
433
  role: "combobox",
438
434
  spellCheck: !1,
439
- suffix: t43,
435
+ suffix: t42,
440
436
  value: inputValue
441
- }), $[159] = activeItemId, $[160] = border, $[161] = clearButton, $[162] = customValidity, $[163] = disabled, $[164] = expanded, $[165] = fontSize, $[166] = handleClearButtonClick, $[167] = handleInputChange, $[168] = handleInputFocus, $[169] = icon, $[170] = id, $[171] = inputValue, $[172] = listBoxId, $[173] = padding, $[174] = prefix, $[175] = radius, $[176] = readOnly, $[177] = restProps, $[178] = t42, $[179] = t43, $[180] = t44) : t44 = $[180];
442
- let t45;
443
- return $[181] !== handleRootBlur || $[182] !== handleRootFocus || $[183] !== handleRootKeyDown || $[184] !== results || $[185] !== t44 ? (t45 = /* @__PURE__ */ jsxs("div", {
437
+ }), $[158] = activeItemId, $[159] = border, $[160] = clearButton, $[161] = customValidity, $[162] = disabled, $[163] = expanded, $[164] = fontSize, $[165] = handleClearButtonClick, $[166] = handleInputChange, $[167] = handleInputFocus, $[168] = icon, $[169] = id, $[170] = inputValue, $[171] = listBoxId, $[172] = padding, $[173] = prefix, $[174] = radius, $[175] = readOnly, $[176] = restProps, $[177] = t41, $[178] = t42, $[179] = t43) : t43 = $[179];
438
+ let t44;
439
+ return $[180] !== handleRootBlur || $[181] !== handleRootFocus || $[182] !== handleRootKeyDown || $[183] !== results || $[184] !== t43 ? (t44 = /* @__PURE__ */ jsxs("div", {
444
440
  className: autocomplete,
445
441
  "data-ui": "Autocomplete",
446
442
  onBlur: handleRootBlur,
447
443
  onFocus: handleRootFocus,
448
444
  onKeyDown: handleRootKeyDown,
449
445
  ref: rootElementRef,
450
- children: [t44, results]
451
- }), $[181] = handleRootBlur, $[182] = handleRootFocus, $[183] = handleRootKeyDown, $[184] = results, $[185] = t44, $[186] = t45) : t45 = $[186], t45;
446
+ children: [t43, results]
447
+ }), $[180] = handleRootBlur, $[181] = handleRootFocus, $[182] = handleRootKeyDown, $[183] = results, $[184] = t43, $[185] = t44) : t44 = $[185], t44;
452
448
  }
453
449
  function _temp2(v_1) {
454
450
  return Math.max(v_1 - 1, 0);