@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
|
@@ -37,4 +37,4 @@ type ThemeColorInputStateKey = (typeof THEME_COLOR_INPUT_STATES)[number];
|
|
|
37
37
|
/** @public */
|
|
38
38
|
type ThemeColorAvatarColorKey = (typeof THEME_COLOR_AVATAR_COLORS)[number];
|
|
39
39
|
export { THEME_COLOR_STATES as _, ThemeColorInputModeKey as a, ThemeColorStateKey as c, THEME_COLOR_BLEND_MODES as d, THEME_COLOR_BUTTON_MODES as f, THEME_COLOR_SCHEMES as g, THEME_COLOR_INPUT_STATES as h, ThemeColorCardToneKey as i, ThemeColorStateToneKey as l, THEME_COLOR_INPUT_MODES as m, ThemeColorBlendModeKey as n, ThemeColorInputStateKey as o, THEME_COLOR_CARD_TONES as p, ThemeColorButtonModeKey as r, ThemeColorSchemeKey as s, ThemeColorAvatarColorKey as t, THEME_COLOR_AVATAR_COLORS as u, THEME_COLOR_STATE_TONES as v };
|
|
40
|
-
//# sourceMappingURL=_system-
|
|
40
|
+
//# sourceMappingURL=_system-DjnSx8gA.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_system-
|
|
1
|
+
{"version":3,"file":"_system-DjnSx8gA.d.ts","names":[],"sources":["../src/theme/system/color/_constants.ts","../src/theme/system/color/_system.ts"],"mappings":"AAGA;cAAa;;cAGA;;cAGA;;cAYA;;cAWA;;cAGA;;cAGA;;cAGA;;cAGA,mDAAyB;;;;KC7B1B,8BAA8B;;KAG9B,iCAAiC;;KAGjC,gCAAgC;;KAGhC,kCAAkC;;KAGlC,6BAA6B;;KAG7B,iCAAiC;;KAGjC,iCAAiC;;KAGjC,kCAAkC;;KAGlC,mCAAmC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as useTheme_v2, d as createGlobalScopedContext, f as globalScope, r as isRecord } from "./useLayer-
|
|
1
|
+
import { _ as useTheme_v2, d as createGlobalScopedContext, f as globalScope, r as isRecord } from "./useLayer-DiYnwQ5T.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { clsx } from "clsx/lite";
|
|
4
4
|
import { useContext, useId } from "react";
|
|
@@ -184,4 +184,4 @@ function Arrow(props) {
|
|
|
184
184
|
}
|
|
185
185
|
export { resolvePortalElement as a, PortalContext as i, Portal as n, useBoundaryElement as o, usePortal as r, BoundaryElementContext as s, Arrow as t };
|
|
186
186
|
|
|
187
|
-
//# sourceMappingURL=arrow-
|
|
187
|
+
//# sourceMappingURL=arrow-BhooatHA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow-BhooatHA.js","names":["createPortal(children, portalElement)","null","radius = 0","...restProps","compileCommands(cmds)","clsx(arrow, className)","`${w}px`","{...style, '--arrow-size': `${w}px`}","{...style, '--arrow-size': `${w}px`} as CSSProperties","`0 0 ${w} ${w}`","<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>","`url(#${strokeMaskId})`","strokeWidth * 2","<path\n className={arrowStroke}\n d={strokePath}\n mask={`url(#${strokeMaskId})`}\n strokeWidth={strokeWidth * 2}\n />","<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>","<div\n data-ui=\"Arrow\"\n {...restProps}\n className={clsx(arrow, className)}\n ref={ref}\n style={{...style, '--arrow-size': `${w}px`} as CSSProperties}\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/resolvePortalElement.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 type {PortalContextValue} from './types'\n\n/**\n * The element a `Portal` renders into: the named element when `name` is given, otherwise the\n * context's element, falling back to the `default` named element in both cases.\n *\n * Components that reason about the portal element (the tooltip caps its width to it, the dialog\n * scopes its click-outside and focus handling to it) resolve it through this function as well, so\n * they cannot disagree with where the portal content ends up.\n */\nexport function resolvePortalElement(\n portal: PortalContextValue,\n name?: string,\n): HTMLElement | null {\n return (name ? portal.elements?.[name] : portal.element) || portal.elements?.default || null\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 {resolvePortalElement} from './resolvePortalElement'\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 = resolvePortalElement(portal, name)\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 {css} from '#styled-system/css'\n\nconst arrowSize = 'var(--arrow-size)'\n\nexport const arrow = css({\n 'position': 'absolute',\n 'width': arrowSize,\n 'height': arrowSize,\n ':empty + &': {display: 'none'},\n \"[data-placement^='top'] > &\": {\n 'bottom': `calc(-1 * ${arrowSize})`,\n '& > svg': {transform: 'rotate(0)'},\n },\n \"[data-placement^='right'] > &\": {\n 'left': `calc(-1 * ${arrowSize})`,\n '& > svg': {transform: 'rotate(90deg)'},\n },\n \"[data-placement^='left'] > &\": {\n 'right': `calc(-1 * ${arrowSize})`,\n '& > svg': {transform: 'rotate(-90deg)'},\n },\n \"[data-placement^='bottom'] > &\": {\n 'top': `calc(-1 * ${arrowSize})`,\n '& > svg': {transform: 'rotate(180deg)'},\n },\n '& > svg': {\n display: 'block',\n lineHeight: 0,\n transformOrigin: `calc(${arrowSize} / 2) calc(${arrowSize} / 2)`,\n },\n})\n\nexport const arrowStroke = css({\n stroke: 'var(--card-shadow-outline-color)',\n})\n\nexport const arrowShape = css({\n fill: 'var(--card-bg-color)',\n})\n","import {clsx} from 'clsx/lite'\nimport {CSSProperties, HTMLProps, useId} from 'react'\n\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {compileCommands, getRoundedCommands, Point} from './cmds'\n\nimport {arrow, arrowShape, 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, '--arrow-size': `${w}px`} as CSSProperties}\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;;;;;;;;;ACfA,SAAgB,qBACd,QACA,MACoB;CACpB,QAAQ,OAAO,OAAO,WAAW,QAAQ,OAAO,YAAY,OAAO,UAAU,WAAW;AAC1F;ACXA,MAAM,MAAM,6BACN,aAAa,OAAO,IAAI,GAAG,IAAI,SAAS;AAE9C,YAAY,cAAc;AAuB1B,MAAa,gBAAgB,0BAA8C,KAAK;CApB9E,SAAS;CACT,iBAAiB;CACj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oBAAC,QAAD;EACE,WAAW;EACX,GAAG;EACH,MAAMF;EACN,aAAaC;CACd,CAAA,GAHI,EAAA,MAAA,YAEUA,EAAAA,MAAAA,KADPD,EAAAA,MAAAA,I;CAGRG,IAAAA;CAAgC,EAAA,QAAA,W,eAAhCA,MAAAA,oBAAC,QAAD;EAAM,WAAW;EAAY,GAAG;CAAW,CAAA,GAAX,EAAA,MAAA,U;CAVlCC,IAAAA;CAIEF,EAAAA,QAAAA,OAAAA,EAAAA,QAMAC,OAAAA,EAAAA,QAViCN,MAAAA,EAAAA,QACjCE,MAAAA,EAAAA,QADU,KAAZK,MAAAA,qBAAC,OAAD;EAAK,OAAO;EAAG,QAAQ;EAAG,SAASP;EAAnC,UAAA;GACEE;GAGAG;GAMAC;EACG;C,IAPHD,EAAAA,MAAAA,KAMAC,EAAAA,MAAAA,KAViCN,EAAAA,MAAAA,IACjCE,EAAAA,MAAAA,IADU,EAAA,MAAA,G;CAPdM,IAAAA;CADF,OAKS,EAAA,QAAA,OAAA,EAAA,QAFD,aAAA,EAAA,QAKJD,OAAAA,EAAAA,QAJWX,MAAAA,EAAAA,QAEJG,MALTS,MAAAA,oBAAC,OAAD;EACE,WAAQ;EACR,GAAI;EACJ,WAAWZ;EACN;EACL,OAAOG;EAEPQ,UAAAA;CAYG,CAAA,GAfE,EAAA,MAAA,KAFD,EAAA,MAAA,WAKJA,EAAAA,MAAAA,KAJWX,EAAAA,MAAAA,IAEJG,EAAAA,MAAAA,I,4BALTS;AAqBJ"}
|
package/dist/autocomplete.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as Radius } from "./layer-ChlP9Ik6.js";
|
|
2
|
-
import { n as ButtonOwnProps, u as BoxProps } from "./button-dnqMFkWg.js";
|
|
3
|
-
import { n as PopoverProps } from "./popover-HDVgZg5e.js";
|
|
4
1
|
import { ElementType, HTMLProps, ReactNode, Ref } from "react";
|
|
2
|
+
import { n as ButtonOwnProps, u as BoxProps } from "./button-DJ_N-Z82.js";
|
|
3
|
+
import { n as PopoverProps } from "./popover-DpHuX7yr.js";
|
|
4
|
+
import { g as Radius } from "./layer-CAyooswI.js";
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
@@ -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;;;;
|
|
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;;;;UCrDa,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;;;;;;EAMT;;;;;;;;wBAec,aAAa,eAAe,wBAC1C,OAAO,kBAAkB,UACvB,KACE,UAAU,gSAmBX,IAAA"}
|
package/dist/autocomplete.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { c as EMPTY_RECORD, n as _getArrayProp, s as EMPTY_ARRAY } from "./helpers-XThPpWje.js";
|
|
3
|
-
import { h as focusFirstDescendant, p as _hasFocus, t as TextInput, v as _raf } from "./textInput-DhYi5cPT.js";
|
|
4
|
-
import { t as _isEnterToClickElement } from "./element-BYgCE_iK.js";
|
|
5
|
-
import { s as Card, y as Box } from "./useLayer-D_TnC6On.js";
|
|
6
|
-
import { n as Text, t as Stack } from "./stack-DyrC2YfU.js";
|
|
7
|
-
import { t as Button } from "./button-DnJrhWml.js";
|
|
8
|
-
import { t as Popover } from "./popover-qhIrQ_4V.js";
|
|
9
2
|
import { c } from "react/compiler-runtime";
|
|
10
3
|
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
11
4
|
import { SpinnerIcon } from "@sanity/icons/Spinner";
|
|
12
5
|
import { clsx } from "clsx/lite";
|
|
13
6
|
import { cloneElement, useDeferredValue, useEffect, useImperativeHandle, useReducer, useRef, useState } from "react";
|
|
14
7
|
import { useEffectEvent } from "use-effect-event";
|
|
8
|
+
import { c as EMPTY_RECORD, n as _getArrayProp, s as EMPTY_ARRAY } from "./helpers-jp2T-bdR.js";
|
|
9
|
+
import { h as focusFirstDescendant, p as _hasFocus, t as TextInput, v as _raf } from "./textInput-cMQvSl5n.js";
|
|
10
|
+
import { s as useLatestRef } from "./getElementRef-5HypX0AT.js";
|
|
11
|
+
import { s as Card, y as Box } from "./useLayer-DiYnwQ5T.js";
|
|
12
|
+
import { t as Button } from "./button-GFefHUiY.js";
|
|
13
|
+
import { t as Popover } from "./popover-C-YWzo_l.js";
|
|
14
|
+
import { n as Text, t as Stack } from "./stack-DFRXALVU.js";
|
|
15
|
+
import { t as _isEnterToClickElement } from "./element-DIcKo4Jp.js";
|
|
15
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
17
|
function AutocompleteOption(props) {
|
|
17
18
|
let $ = c(11), { children, id, onSelect, selected, value } = props, t0;
|
|
@@ -98,7 +99,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
98
99
|
* @public
|
|
99
100
|
*/
|
|
100
101
|
function Autocomplete(props) {
|
|
101
|
-
let $ = c(
|
|
102
|
+
let $ = c(188), 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;
|
|
102
103
|
$[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);
|
|
103
104
|
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;
|
|
104
105
|
$[31] !== t7 || $[32] !== t8 ? (t9 = {
|
|
@@ -128,7 +129,7 @@ function Autocomplete(props) {
|
|
|
128
129
|
})
|
|
129
130
|
});
|
|
130
131
|
}, $[34] = fontSize, $[35] = paddingProp, $[36] = t10) : t10 = $[36];
|
|
131
|
-
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), popoverMouseWithinRef = useRef(!1), t11, t12;
|
|
132
|
+
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), disabledRef = useLatestRef(disabled), listFocusedRef = useRef(!1), popoverMouseWithinRef = useRef(!1), t11, t12;
|
|
132
133
|
$[37] === inputElement ? (t11 = $[38], t12 = $[39]) : (t11 = () => inputElement, t12 = [inputElement], $[37] = inputElement, $[38] = t11, $[39] = t12), useImperativeHandle(inputElementRef, t11, t12);
|
|
133
134
|
let t13, t14;
|
|
134
135
|
$[40] === inputElement ? (t13 = $[41], t14 = $[42]) : (t13 = () => inputElement, t14 = [inputElement], $[40] = inputElement, $[41] = t13, $[42] = t14), useImperativeHandle(forwardedRef, t13, t14);
|
|
@@ -139,7 +140,7 @@ function Autocomplete(props) {
|
|
|
139
140
|
let t17;
|
|
140
141
|
$[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;
|
|
141
142
|
} else t16 = $[49];
|
|
142
|
-
let filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, querying = query !== null && loading || focused
|
|
143
|
+
let filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, querying = !disabled && query !== null && (loading || focused), deferredQuerying = useDeferredValue(querying), expanded = querying && deferredQuerying, t17;
|
|
143
144
|
$[53] !== onBlur || $[54] !== onQueryChange || $[55] !== relatedElements ? (t17 = (event) => {
|
|
144
145
|
setTimeout(() => {
|
|
145
146
|
if (popoverMouseWithinRef.current) return;
|
|
@@ -162,14 +163,14 @@ function Autocomplete(props) {
|
|
|
162
163
|
}));
|
|
163
164
|
}, $[57] = t18) : t18 = $[57];
|
|
164
165
|
let handleRootFocus = t18, t19;
|
|
165
|
-
$[58] !==
|
|
166
|
-
dispatch({
|
|
166
|
+
$[58] !== disabledRef || $[59] !== onChange || $[60] !== onQueryChange || $[61] !== onSelect ? (t19 = (v) => {
|
|
167
|
+
disabledRef.current || (dispatch({
|
|
167
168
|
type: "value/change",
|
|
168
169
|
value: v
|
|
169
|
-
}), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
170
|
-
}, $[58] =
|
|
170
|
+
}), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus());
|
|
171
|
+
}, $[58] = disabledRef, $[59] = onChange, $[60] = onQueryChange, $[61] = onSelect, $[62] = t19) : t19 = $[62];
|
|
171
172
|
let handleOptionSelect = t19, t20;
|
|
172
|
-
$[
|
|
173
|
+
$[63] !== activeValue || $[64] !== filteredOptions || $[65] !== filteredOptionsLen || $[66] !== onQueryChange ? (t20 = (event_1) => {
|
|
173
174
|
if (event_1.key === "ArrowDown") {
|
|
174
175
|
if (event_1.preventDefault(), !filteredOptionsLen) return;
|
|
175
176
|
let activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
|
|
@@ -196,44 +197,44 @@ function Autocomplete(props) {
|
|
|
196
197
|
}
|
|
197
198
|
let target = event_1.target, listEl = listBoxElementRef.current;
|
|
198
199
|
(listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key) && inputElementRef.current?.focus();
|
|
199
|
-
}, $[
|
|
200
|
+
}, $[63] = activeValue, $[64] = filteredOptions, $[65] = filteredOptionsLen, $[66] = onQueryChange, $[67] = t20) : t20 = $[67];
|
|
200
201
|
let handleRootKeyDown = t20, t21;
|
|
201
|
-
$[
|
|
202
|
+
$[68] === onQueryChange ? t21 = $[69] : (t21 = (event_2) => {
|
|
202
203
|
let nextQuery = event_2.currentTarget.value;
|
|
203
204
|
dispatch({
|
|
204
205
|
type: "input/change",
|
|
205
206
|
query: nextQuery
|
|
206
207
|
}), onQueryChange && onQueryChange(nextQuery);
|
|
207
|
-
}, $[
|
|
208
|
+
}, $[68] = onQueryChange, $[69] = t21);
|
|
208
209
|
let handleInputChange = t21, t22;
|
|
209
|
-
$[
|
|
210
|
+
$[70] !== currentOption || $[71] !== renderValue || $[72] !== value ? (t22 = () => {
|
|
210
211
|
dispatch({
|
|
211
212
|
type: "root/open",
|
|
212
213
|
query: value ? renderValue(value, currentOption) : ""
|
|
213
214
|
});
|
|
214
|
-
}, $[
|
|
215
|
+
}, $[70] = currentOption, $[71] = renderValue, $[72] = value, $[73] = t22) : t22 = $[73];
|
|
215
216
|
let dispatchOpen = t22, t23;
|
|
216
|
-
$[
|
|
217
|
+
$[74] !== dispatchOpen || $[75] !== focused || $[76] !== onFocus || $[77] !== openOnFocus ? (t23 = (event_3) => {
|
|
217
218
|
focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
|
|
218
|
-
}, $[
|
|
219
|
+
}, $[74] = dispatchOpen, $[75] = focused, $[76] = onFocus, $[77] = openOnFocus, $[78] = t23) : t23 = $[78];
|
|
219
220
|
let handleInputFocus = t23, t24;
|
|
220
|
-
$[
|
|
221
|
+
$[79] === Symbol.for("react.memo_cache_sentinel") ? (t24 = () => {
|
|
221
222
|
popoverMouseWithinRef.current = !0;
|
|
222
|
-
}, $[
|
|
223
|
+
}, $[79] = t24) : t24 = $[79];
|
|
223
224
|
let handlePopoverMouseEnter = t24, t25;
|
|
224
|
-
$[
|
|
225
|
+
$[80] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
|
|
225
226
|
popoverMouseWithinRef.current = !1;
|
|
226
|
-
}, $[
|
|
227
|
+
}, $[80] = t25) : t25 = $[80];
|
|
227
228
|
let handlePopoverMouseLeave = t25, t26;
|
|
228
|
-
$[
|
|
229
|
+
$[81] !== onChange || $[82] !== onQueryChange ? (t26 = () => {
|
|
229
230
|
dispatch({ type: "root/clear" }), onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
230
|
-
}, $[
|
|
231
|
+
}, $[81] = onChange, $[82] = onQueryChange, $[83] = t26) : t26 = $[83];
|
|
231
232
|
let handleClearButtonClick = t26, t27;
|
|
232
|
-
$[
|
|
233
|
+
$[84] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
|
|
233
234
|
dispatch({ type: "input/focus" });
|
|
234
|
-
}, $[
|
|
235
|
+
}, $[84] = t27) : t27 = $[84];
|
|
235
236
|
let handleClearButtonFocus = t27, t28;
|
|
236
|
-
$[
|
|
237
|
+
$[85] !== activeValue || $[86] !== filteredOptions || $[87] !== listFocused ? (t28 = () => {
|
|
237
238
|
let listElement = listBoxElementRef.current;
|
|
238
239
|
if (!listFocused || !listElement) return;
|
|
239
240
|
let activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
|
|
@@ -244,35 +245,35 @@ function Autocomplete(props) {
|
|
|
244
245
|
focusFirstDescendant(activeItemElement);
|
|
245
246
|
}
|
|
246
247
|
}
|
|
247
|
-
}, $[
|
|
248
|
+
}, $[85] = activeValue, $[86] = filteredOptions, $[87] = listFocused, $[88] = t28) : t28 = $[88];
|
|
248
249
|
let focusActiveOption = useEffectEvent(t28), t29;
|
|
249
|
-
$[
|
|
250
|
+
$[89] !== expanded || $[90] !== focusActiveOption ? (t29 = () => {
|
|
250
251
|
expanded && focusActiveOption();
|
|
251
|
-
}, $[
|
|
252
|
+
}, $[89] = expanded, $[90] = focusActiveOption, $[91] = t29) : t29 = $[91];
|
|
252
253
|
let t30;
|
|
253
|
-
$[
|
|
254
|
+
$[92] !== activeValue || $[93] !== expanded || $[94] !== filteredOptions ? (t30 = [
|
|
254
255
|
activeValue,
|
|
255
256
|
expanded,
|
|
256
257
|
filteredOptions
|
|
257
|
-
], $[
|
|
258
|
+
], $[92] = activeValue, $[93] = expanded, $[94] = filteredOptions, $[95] = t30) : t30 = $[95], useEffect(t29, t30);
|
|
258
259
|
let t31;
|
|
259
260
|
bb0: {
|
|
260
261
|
if (!loading && !disabled && value) {
|
|
261
262
|
let t32;
|
|
262
|
-
$[
|
|
263
|
+
$[96] === Symbol.for("react.memo_cache_sentinel") ? (t32 = {
|
|
263
264
|
"aria-label": "Clear",
|
|
264
265
|
onFocus: handleClearButtonFocus
|
|
265
|
-
}, $[
|
|
266
|
+
}, $[96] = t32) : t32 = $[96], t31 = t32;
|
|
266
267
|
break bb0;
|
|
267
268
|
}
|
|
268
269
|
t31 = void 0;
|
|
269
270
|
}
|
|
270
271
|
let clearButton = t31, openButtonBoxPadding = padding.map(_temp), openButtonPadding = padding.map(_temp2), openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD, t32;
|
|
271
|
-
$[
|
|
272
|
+
$[97] !== dispatchOpen || $[98] !== openButtonProps ? (t32 = (event_4) => {
|
|
272
273
|
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
|
|
273
|
-
}, $[
|
|
274
|
+
}, $[97] = dispatchOpen, $[98] = openButtonProps, $[99] = t32) : t32 = $[99];
|
|
274
275
|
let handleOpenClick = t32, t33;
|
|
275
|
-
$[
|
|
276
|
+
$[100] !== disabled || $[101] !== fontSize || $[102] !== handleOpenClick || $[103] !== openButton || $[104] !== openButtonBoxPadding || $[105] !== openButtonPadding || $[106] !== openButtonProps || $[107] !== querying || $[108] !== readOnly ? (t33 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, {
|
|
276
277
|
"aria-hidden": querying,
|
|
277
278
|
padding: openButtonBoxPadding,
|
|
278
279
|
children: /* @__PURE__ */ jsx(Button, {
|
|
@@ -285,13 +286,13 @@ function Autocomplete(props) {
|
|
|
285
286
|
...openButtonProps,
|
|
286
287
|
onClick: handleOpenClick
|
|
287
288
|
})
|
|
288
|
-
}) : void 0, $[
|
|
289
|
+
}) : void 0, $[100] = disabled, $[101] = fontSize, $[102] = handleOpenClick, $[103] = openButton, $[104] = openButtonBoxPadding, $[105] = openButtonPadding, $[106] = openButtonProps, $[107] = querying, $[108] = readOnly, $[109] = t33) : t33 = $[109];
|
|
289
290
|
let openButtonNode = t33, t34;
|
|
290
291
|
bb1: {
|
|
291
292
|
if (query === null) {
|
|
292
293
|
if (value !== null) {
|
|
293
294
|
let t35;
|
|
294
|
-
$[
|
|
295
|
+
$[110] !== currentOption || $[111] !== renderValue || $[112] !== value ? (t35 = renderValue(value, currentOption), $[110] = currentOption, $[111] = renderValue, $[112] = value, $[113] = t35) : t35 = $[113], t34 = t35;
|
|
295
296
|
break bb1;
|
|
296
297
|
}
|
|
297
298
|
t34 = "";
|
|
@@ -300,9 +301,9 @@ function Autocomplete(props) {
|
|
|
300
301
|
t34 = query;
|
|
301
302
|
}
|
|
302
303
|
let inputValue = t34, t35;
|
|
303
|
-
$[
|
|
304
|
+
$[114] === listFocused ? t35 = $[115] : (t35 = (event_5) => {
|
|
304
305
|
event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
|
|
305
|
-
}, $[
|
|
306
|
+
}, $[114] = listFocused, $[115] = t35);
|
|
306
307
|
let handleListBoxKeyDown = t35, t36;
|
|
307
308
|
bb2: {
|
|
308
309
|
if (filteredOptions.length === 0) {
|
|
@@ -310,11 +311,11 @@ function Autocomplete(props) {
|
|
|
310
311
|
break bb2;
|
|
311
312
|
}
|
|
312
313
|
let t37 = listBox?.className, t38;
|
|
313
|
-
$[
|
|
314
|
+
$[116] === t37 ? t38 = $[117] : (t38 = clsx("u-hDvsDr u-cRpRRD u-juqQPY", t37), $[116] = t37, $[117] = t38);
|
|
314
315
|
let t39;
|
|
315
|
-
if ($[
|
|
316
|
+
if ($[118] !== activeValue || $[119] !== currentOption || $[120] !== filteredOptions || $[121] !== handleOptionSelect || $[122] !== id || $[123] !== listFocused || $[124] !== loading || $[125] !== renderOption) {
|
|
316
317
|
let t40;
|
|
317
|
-
$[
|
|
318
|
+
$[127] !== activeValue || $[128] !== currentOption || $[129] !== handleOptionSelect || $[130] !== id || $[131] !== listFocused || $[132] !== loading || $[133] !== renderOption ? (t40 = (option_0) => {
|
|
318
319
|
let active = activeValue === null ? currentOption === option_0 : option_0.value === activeValue;
|
|
319
320
|
return /* @__PURE__ */ jsx(AutocompleteOption, {
|
|
320
321
|
id: `${id}-option-${option_0.value}`,
|
|
@@ -327,10 +328,10 @@ function Autocomplete(props) {
|
|
|
327
328
|
tabIndex: listFocused && active ? 0 : -1
|
|
328
329
|
})
|
|
329
330
|
}, option_0.value);
|
|
330
|
-
}, $[
|
|
331
|
-
} else t39 = $[
|
|
331
|
+
}, $[127] = activeValue, $[128] = currentOption, $[129] = handleOptionSelect, $[130] = id, $[131] = listFocused, $[132] = loading, $[133] = renderOption, $[134] = t40) : t40 = $[134], t39 = filteredOptions.map(t40), $[118] = activeValue, $[119] = currentOption, $[120] = filteredOptions, $[121] = handleOptionSelect, $[122] = id, $[123] = listFocused, $[124] = loading, $[125] = renderOption, $[126] = t39;
|
|
332
|
+
} else t39 = $[126];
|
|
332
333
|
let t40;
|
|
333
|
-
$[
|
|
334
|
+
$[135] !== listBoxId || $[136] !== t39 ? (t40 = /* @__PURE__ */ jsx(Stack, {
|
|
334
335
|
as: "ul",
|
|
335
336
|
"aria-multiselectable": !1,
|
|
336
337
|
"data-ui": "AutoComplete__resultsList",
|
|
@@ -339,9 +340,9 @@ function Autocomplete(props) {
|
|
|
339
340
|
role: "listbox",
|
|
340
341
|
gap: 1,
|
|
341
342
|
children: t39
|
|
342
|
-
}), $[
|
|
343
|
+
}), $[135] = listBoxId, $[136] = t39, $[137] = t40) : t40 = $[137];
|
|
343
344
|
let t41;
|
|
344
|
-
$[
|
|
345
|
+
$[138] !== handleListBoxKeyDown || $[139] !== listBox || $[140] !== t38 || $[141] !== t40 ? (t41 = /* @__PURE__ */ jsx(Box, {
|
|
345
346
|
"data-ui": "AutoComplete__results",
|
|
346
347
|
onKeyDown: handleListBoxKeyDown,
|
|
347
348
|
padding: 1,
|
|
@@ -349,13 +350,13 @@ function Autocomplete(props) {
|
|
|
349
350
|
className: t38,
|
|
350
351
|
tabIndex: -1,
|
|
351
352
|
children: t40
|
|
352
|
-
}), $[
|
|
353
|
+
}), $[138] = handleListBoxKeyDown, $[139] = listBox, $[140] = t38, $[141] = t40, $[142] = t41) : t41 = $[142], t36 = t41;
|
|
353
354
|
}
|
|
354
355
|
let content = t36, t37;
|
|
355
356
|
bb3: {
|
|
356
357
|
if (renderPopover) {
|
|
357
358
|
let t38 = !expanded, t39;
|
|
358
|
-
$[
|
|
359
|
+
$[143] !== content || $[144] !== handlePopoverMouseEnter || $[145] !== handlePopoverMouseLeave || $[146] !== inputElement || $[147] !== renderPopover || $[148] !== t38 ? (t39 = /* @__PURE__ */ jsx(RenderPopover, {
|
|
359
360
|
content,
|
|
360
361
|
hidden: t38,
|
|
361
362
|
inputElement,
|
|
@@ -363,7 +364,7 @@ function Autocomplete(props) {
|
|
|
363
364
|
onMouseLeave: handlePopoverMouseLeave,
|
|
364
365
|
resultsPopoverElementRef,
|
|
365
366
|
renderPopover
|
|
366
|
-
}), $[
|
|
367
|
+
}), $[143] = content, $[144] = handlePopoverMouseEnter, $[145] = handlePopoverMouseLeave, $[146] = inputElement, $[147] = renderPopover, $[148] = t38, $[149] = t39) : t39 = $[149], t37 = t39;
|
|
367
368
|
break bb3;
|
|
368
369
|
}
|
|
369
370
|
if (filteredOptionsLen === 0) {
|
|
@@ -371,7 +372,7 @@ function Autocomplete(props) {
|
|
|
371
372
|
break bb3;
|
|
372
373
|
}
|
|
373
374
|
let t38;
|
|
374
|
-
$[
|
|
375
|
+
$[150] !== content || $[151] !== expanded || $[152] !== handlePopoverMouseEnter || $[153] !== handlePopoverMouseLeave || $[154] !== inputElement || $[155] !== popover || $[156] !== radius ? (t38 = /* @__PURE__ */ jsx(Popover, {
|
|
375
376
|
arrow: !1,
|
|
376
377
|
constrainSize: !0,
|
|
377
378
|
content,
|
|
@@ -387,12 +388,12 @@ function Autocomplete(props) {
|
|
|
387
388
|
ref: resultsPopoverElementRef,
|
|
388
389
|
referenceElement: inputElement,
|
|
389
390
|
...popover
|
|
390
|
-
}), $[
|
|
391
|
+
}), $[150] = content, $[151] = expanded, $[152] = handlePopoverMouseEnter, $[153] = handlePopoverMouseLeave, $[154] = inputElement, $[155] = popover, $[156] = radius, $[157] = t38) : t38 = $[157], t37 = t38;
|
|
391
392
|
}
|
|
392
393
|
let results = t37, t38 = expanded ? activeItemId : void 0, t39;
|
|
393
|
-
$[
|
|
394
|
+
$[158] === loading ? t39 = $[159] : (t39 = loading && /* @__PURE__ */ jsx(SpinnerIcon, { className: "u-fteRbN u-jmIqco u-iNjdVt" }), $[158] = loading, $[159] = t39);
|
|
394
395
|
let t40 = suffix || openButtonNode, t41;
|
|
395
|
-
$[
|
|
396
|
+
$[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] !== t38 || $[179] !== t39 || $[180] !== t40 ? (t41 = /* @__PURE__ */ jsx(TextInput, {
|
|
396
397
|
...restProps,
|
|
397
398
|
"aria-activedescendant": t38,
|
|
398
399
|
"aria-autocomplete": "list",
|
|
@@ -422,9 +423,9 @@ function Autocomplete(props) {
|
|
|
422
423
|
spellCheck: !1,
|
|
423
424
|
suffix: t40,
|
|
424
425
|
value: inputValue
|
|
425
|
-
}), $[
|
|
426
|
+
}), $[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] = t38, $[179] = t39, $[180] = t40, $[181] = t41) : t41 = $[181];
|
|
426
427
|
let t42;
|
|
427
|
-
return $[
|
|
428
|
+
return $[182] !== handleRootBlur || $[183] !== handleRootFocus || $[184] !== handleRootKeyDown || $[185] !== results || $[186] !== t41 ? (t42 = /* @__PURE__ */ jsxs("div", {
|
|
428
429
|
className: "u-eGjDnc",
|
|
429
430
|
"data-ui": "Autocomplete",
|
|
430
431
|
onBlur: handleRootBlur,
|
|
@@ -432,7 +433,7 @@ function Autocomplete(props) {
|
|
|
432
433
|
onKeyDown: handleRootKeyDown,
|
|
433
434
|
ref: rootElementRef,
|
|
434
435
|
children: [t41, results]
|
|
435
|
-
}), $[
|
|
436
|
+
}), $[182] = handleRootBlur, $[183] = handleRootFocus, $[184] = handleRootKeyDown, $[185] = results, $[186] = t41, $[187] = t42) : t42 = $[187], t42;
|
|
436
437
|
}
|
|
437
438
|
function _temp2(v_1) {
|
|
438
439
|
return Math.max(v_1 - 1, 0);
|