@sanity/ui 4.0.0-next.5 → 4.0.0-next.7
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/{arrow-BG0EMNiC.js → arrow-BaxgKzOL.js} +8 -6
- package/dist/{arrow-BG0EMNiC.js.map → arrow-BaxgKzOL.js.map} +1 -1
- package/dist/autocomplete.d.ts +4 -4
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/autocomplete.js +18 -11
- package/dist/autocomplete.js.map +1 -1
- package/dist/breadcrumbs.d.ts +1 -1
- package/dist/breadcrumbs.d.ts.map +1 -1
- package/dist/breadcrumbs.js +8 -4
- package/dist/breadcrumbs.js.map +1 -1
- package/dist/{button-DZkAQOL2.js → button-BDLRd1Rr.js} +3 -3
- package/dist/button-BDLRd1Rr.js.map +1 -0
- package/dist/{button-BzoZs3Sl.d.ts → button-dnqMFkWg.d.ts} +2 -2
- package/dist/{button-BzoZs3Sl.d.ts.map → button-dnqMFkWg.d.ts.map} +1 -1
- package/dist/{hotkeys-B08HIKNu.js → hotkeys-aHdaZFAl.js} +11 -5
- package/dist/{hotkeys-B08HIKNu.js.map → hotkeys-aHdaZFAl.js.map} +1 -1
- package/dist/index.d.ts +28 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +172 -73
- package/dist/index.js.map +1 -1
- package/dist/{layer-BQfdK7rt.d.ts → layer-ChlP9Ik6.d.ts} +2 -2
- package/dist/{layer-BQfdK7rt.d.ts.map → layer-ChlP9Ik6.d.ts.map} +1 -1
- package/dist/{layer-BdkSGATt.js → layer-DeCVQfUb.js} +10 -5
- package/dist/layer-DeCVQfUb.js.map +1 -0
- package/dist/menu.d.ts +4 -4
- package/dist/menu.d.ts.map +1 -1
- package/dist/menu.js +18 -6
- package/dist/menu.js.map +1 -1
- package/dist/{popover-DmmmSNzL.d.ts → popover-CMlQeKn0.d.ts} +3 -3
- package/dist/{popover-DmmmSNzL.d.ts.map → popover-CMlQeKn0.d.ts.map} +1 -1
- package/dist/{popover-Iy6EZEmv.js → popover-DfXz9lUl.js} +19 -8
- package/dist/popover-DfXz9lUl.js.map +1 -0
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/styles.css +28 -1
- package/dist/styles.d.ts +3 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +4 -0
- package/dist/styles.js.map +1 -0
- package/dist/{textInput-IbiDH7Jc.js → textInput-DhCo-b3N.js} +24 -18
- package/dist/{textInput-IbiDH7Jc.js.map → textInput-DhCo-b3N.js.map} +1 -1
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +2 -2
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +22 -8
- package/dist/tooltip.js.map +1 -1
- package/package.json +5 -2
- package/dist/button-DZkAQOL2.js.map +0 -1
- package/dist/layer-BdkSGATt.js.map +0 -1
- package/dist/popover-Iy6EZEmv.js.map +0 -1
|
@@ -80,14 +80,16 @@ function compileCommands(cmds) {
|
|
|
80
80
|
}
|
|
81
81
|
const StyledArrow = /* @__PURE__ */ styled.div.withConfig({
|
|
82
82
|
displayName: "StyledArrow",
|
|
83
|
-
componentId: "sc-
|
|
83
|
+
componentId: "sc-e0ij84-0"
|
|
84
84
|
})(({ $w: w }) => css`position:absolute;width:${w}px;height:${w}px;:empty + &{display:none;}& > svg{display:block;line-height:0;transform-origin:${w / 2}px ${w / 2}px;}[data-placement^='top'] > &{bottom:-${w}px;& > svg{transform:rotate(0);}}[data-placement^='right'] > &{left:-${w}px;& > svg{transform:rotate(90deg);}}[data-placement^='left'] > &{right:-${w}px;& > svg{transform:rotate(-90deg);}}[data-placement^='bottom'] > &{top:-${w}px;& > svg{transform:rotate(180deg);}}`), StrokePath = styled.path.withConfig({
|
|
85
85
|
displayName: "StrokePath",
|
|
86
|
-
componentId: "sc-
|
|
86
|
+
componentId: "sc-e0ij84-1"
|
|
87
87
|
})`stroke:var(--card-shadow-outline-color);`, ShapePath = styled.path.withConfig({
|
|
88
88
|
displayName: "ShapePath",
|
|
89
|
-
componentId: "sc-
|
|
90
|
-
})`fill:var(--card-bg-color)
|
|
89
|
+
componentId: "sc-e0ij84-2"
|
|
90
|
+
})`fill:var(--card-bg-color);`;
|
|
91
|
+
/** @internal */
|
|
92
|
+
function Arrow(props) {
|
|
91
93
|
let $ = c(30), h, ref, restProps, t0, w;
|
|
92
94
|
$[0] === props ? (h = $[1], ref = $[2], restProps = $[3], t0 = $[4], w = $[5]) : ({width: w, height: h, radius: t0, ref, ...restProps} = props, $[0] = props, $[1] = h, $[2] = ref, $[3] = restProps, $[4] = t0, $[5] = w);
|
|
93
95
|
let radius = t0 === void 0 ? 0 : t0, { card } = useTheme_v2(), strokeWidth = card.shadow.outline, center = w / 2, t1;
|
|
@@ -153,7 +155,7 @@ const StyledArrow = /* @__PURE__ */ styled.div.withConfig({
|
|
|
153
155
|
ref,
|
|
154
156
|
children: t7
|
|
155
157
|
}), $[25] = ref, $[26] = restProps, $[27] = t7, $[28] = w, $[29] = t8) : t8 = $[29], t8;
|
|
156
|
-
}
|
|
158
|
+
}
|
|
157
159
|
export { useBoundaryElement as a, PortalContext as i, Portal as n, BoundaryElementContext as o, usePortal as r, Arrow as t };
|
|
158
160
|
|
|
159
|
-
//# sourceMappingURL=arrow-
|
|
161
|
+
//# sourceMappingURL=arrow-BaxgKzOL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-BG0EMNiC.js","names":["createGlobalScopedContext","BoundaryElementContextValue","BoundaryElementContext","useContext","isRecord","BoundaryElementContext","BoundaryElementContextValue","DEFAULT_VALUE","version","element","useBoundaryElement","value","Error","createGlobalScopedContext","globalScope","PortalContextValue","key","elementKey","Symbol","for","defaultContextValue","version","boundaryElement","element","document","createElement","setAttribute","body","appendChild","PortalContext","useContext","isRecord","PortalContext","PortalContextValue","usePortal","value","Error","version","createPortal","usePortal","PortalProps","children","React","ReactNode","__unstable_name","Portal","props","$","_c","name","portal","portalElement","elements","element","default","t0","PointCmd","type","x","y","radius","CurveCmd","startControl","Point","endControl","curveEnd","Cmd","moveTowardsLength","movingPoint","targetPoint","amount","width","height","distance","Math","sqrt","moveTowardsFractional","min","fraction","getRoundedCommands","points","len","length","cmds","i","point","prevPoint","nextPoint","curveStart","push","compileCommands","map","n","idx","join","HTMLProps","css","styled","useTheme_v2","compileCommands","getRoundedCommands","Point","StyledArrow","div","$w","w","StrokePath","path","ShapePath","Arrow","props","$","_c","h","ref","restProps","t0","width","height","radius","undefined","card","strokeWidth","shadow","outline","center","t1","points","x","y","cmds","strokePath","fillPath","t2","t3","t4","t5","t6","t7","t8"],"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.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 {HTMLProps} from 'react'\nimport {css, styled} from 'styled-components'\n\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {compileCommands, getRoundedCommands, Point} from './cmds'\n\nconst StyledArrow = styled.div<{$w: number}>(\n ({$w: w}) => css`\n position: absolute;\n width: ${w}px;\n height: ${w}px;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n line-height: 0;\n transform-origin: ${w / 2}px ${w / 2}px;\n }\n\n [data-placement^='top'] > & {\n bottom: -${w}px;\n\n & > svg {\n transform: rotate(0);\n }\n }\n\n [data-placement^='right'] > & {\n left: -${w}px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -${w}px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -${w}px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n `,\n)\n\nconst StrokePath = styled.path`\n stroke: var(--card-shadow-outline-color);\n`\n\nconst ShapePath = styled.path`\n fill: var(--card-bg-color);\n`\n\n/** @internal */\nexport const Arrow = function Arrow(\n props: {width: number; height: number; radius?: number} & Omit<\n HTMLProps<HTMLDivElement>,\n 'width' | 'height'\n >,\n): React.JSX.Element {\n const {width: w, height: h, radius = 0, ref, ...restProps} = props\n const {card} = useTheme_v2()\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 <StyledArrow {...restProps} $w={w} ref={ref}>\n <svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id=\"stroke-mask\">\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <StrokePath d={strokePath} mask=\"url(#stroke-mask)\" strokeWidth={strokeWidth * 2} />\n <ShapePath d={fillPath} />\n </svg>\n </StyledArrow>\n )\n}\n"],"mappings":";;;;;;AAGA,MA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,IAAA0B;CAAA,AAAA1B,EAAA,QAAAqB,WAC1DK,KAAA1B,EAAA,OAA1B0B,KAAA,oBAAC,WAAD,EAAcL,GAAAA,SAAQ,CAAA,GAAIrB,EAAA,MAAAqB,UAAArB,EAAA,MAAA0B;CAAA,IAAAC;CAAA,AAAA3B,EAAA,QAAAsB,MAAAtB,EAAA,QAAAuB,MAAAvB,EAAA,QAAAyB,MAAAzB,EAAA,QAAA0B,MAAA1B,EAAA,QAAAN,KAL5BiC,KAAA,qBAAA,OAAA;EAAYjC,OAAAA;EAAWA,QAAAA;EAAY,SAAA4B;EAAnC,UAAA;GACEC;GAGAE;GACAC;EACI;KAAA1B,EAAA,MAAAsB,IAAAtB,EAAA,MAAAuB,IAAAvB,EAAA,MAAAyB,IAAAzB,EAAA,MAAA0B,IAAA1B,EAAA,MAAAN,GAAAM,EAAA,MAAA2B,MAAAA,KAAA3B,EAAA;CAAA,IAAA4B;CACM,OADN5B,EAAA,QAAAG,OAAAH,EAAA,QAAAI,aAAAJ,EAAA,QAAA2B,MAAA3B,EAAA,QAAAN,KAPRkC,KAAA,oBAAC,aAAD;EAAY,GAAKxB;EAAeV,IAAAA;EAAQS;EACtCwB,UAAAA;CADU,CAAA,GAQE3B,EAAA,MAAAG,KAAAH,EAAA,MAAAI,WAAAJ,EAAA,MAAA2B,IAAA3B,EAAA,MAAAN,GAAAM,EAAA,MAAA4B,MAAAA,KAAA5B,EAAA,KARd4B;AAQc"}
|
|
1
|
+
{"version":3,"file":"arrow-BaxgKzOL.js","names":["createGlobalScopedContext","BoundaryElementContextValue","BoundaryElementContext","useContext","isRecord","BoundaryElementContext","BoundaryElementContextValue","DEFAULT_VALUE","version","element","useBoundaryElement","value","Error","createGlobalScopedContext","globalScope","PortalContextValue","key","elementKey","Symbol","for","defaultContextValue","version","boundaryElement","element","document","createElement","setAttribute","body","appendChild","PortalContext","useContext","isRecord","PortalContext","PortalContextValue","usePortal","value","Error","version","createPortal","usePortal","PortalProps","children","React","ReactNode","__unstable_name","Portal","props","$","_c","name","portal","portalElement","elements","element","default","t0","PointCmd","type","x","y","radius","CurveCmd","startControl","Point","endControl","curveEnd","Cmd","moveTowardsLength","movingPoint","targetPoint","amount","width","height","distance","Math","sqrt","moveTowardsFractional","min","fraction","getRoundedCommands","points","len","length","cmds","i","point","prevPoint","nextPoint","curveStart","push","compileCommands","map","n","idx","join","HTMLProps","css","styled","useTheme_v2","compileCommands","getRoundedCommands","Point","StyledArrow","div","$w","w","StrokePath","path","ShapePath","Arrow","props","$","_c","h","ref","restProps","t0","width","height","radius","undefined","card","strokeWidth","shadow","outline","center","t1","points","x","y","cmds","strokePath","fillPath","t2","t3","t4","t5","t6","t7","t8"],"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.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 {HTMLProps} from 'react'\nimport {css, styled} from 'styled-components'\n\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {compileCommands, getRoundedCommands, Point} from './cmds'\n\nconst StyledArrow = styled.div<{$w: number}>(\n ({$w: w}) => css`\n position: absolute;\n width: ${w}px;\n height: ${w}px;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n line-height: 0;\n transform-origin: ${w / 2}px ${w / 2}px;\n }\n\n [data-placement^='top'] > & {\n bottom: -${w}px;\n\n & > svg {\n transform: rotate(0);\n }\n }\n\n [data-placement^='right'] > & {\n left: -${w}px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -${w}px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -${w}px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n `,\n)\n\nconst StrokePath = styled.path`\n stroke: var(--card-shadow-outline-color);\n`\n\nconst ShapePath = styled.path`\n fill: var(--card-bg-color);\n`\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 {width: w, height: h, radius = 0, ref, ...restProps} = props\n const {card} = useTheme_v2()\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 <StyledArrow {...restProps} $w={w} ref={ref}>\n <svg width={w} height={w} viewBox={`0 0 ${w} ${w}`}>\n <mask id=\"stroke-mask\">\n <rect x={0} y={strokeWidth} width={w} height={w} fill=\"white\" />\n </mask>\n <StrokePath d={strokePath} mask=\"url(#stroke-mask)\" strokeWidth={strokeWidth * 2} />\n <ShapePath d={fillPath} />\n </svg>\n </StyledArrow>\n )\n}\n"],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B,EAAA;CAAA,IAAA0B;CAAA,AAAA1B,EAAA,QAAAqB,WAC1DK,KAAA1B,EAAA,OAA1B0B,KAAA,oBAAC,WAAD,EAAcL,GAAAA,SAAQ,CAAA,GAAIrB,EAAA,MAAAqB,UAAArB,EAAA,MAAA0B;CAAA,IAAAC;CAAA,AAAA3B,EAAA,QAAAsB,MAAAtB,EAAA,QAAAuB,MAAAvB,EAAA,QAAAyB,MAAAzB,EAAA,QAAA0B,MAAA1B,EAAA,QAAAN,KAL5BiC,KAAA,qBAAA,OAAA;EAAYjC,OAAAA;EAAWA,QAAAA;EAAY,SAAA4B;EAAnC,UAAA;GACEC;GAGAE;GACAC;EACI;KAAA1B,EAAA,MAAAsB,IAAAtB,EAAA,MAAAuB,IAAAvB,EAAA,MAAAyB,IAAAzB,EAAA,MAAA0B,IAAA1B,EAAA,MAAAN,GAAAM,EAAA,MAAA2B,MAAAA,KAAA3B,EAAA;CAAA,IAAA4B;CACM,OADN5B,EAAA,QAAAG,OAAAH,EAAA,QAAAI,aAAAJ,EAAA,QAAA2B,MAAA3B,EAAA,QAAAN,KAPRkC,KAAA,oBAAC,aAAD;EAAY,GAAKxB;EAAeV,IAAAA;EAAQS;EACtCwB,UAAAA;CADU,CAAA,GAQE3B,EAAA,MAAAG,KAAAH,EAAA,MAAAI,WAAAJ,EAAA,MAAA2B,IAAA3B,EAAA,MAAAN,GAAAM,EAAA,MAAA4B,MAAAA,KAAA5B,EAAA,KARd4B;AAQc"}
|
package/dist/autocomplete.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as Radius } from "./layer-
|
|
2
|
-
import { n as ButtonOwnProps, u as BoxProps } from "./button-
|
|
3
|
-
import { n as PopoverProps } from "./popover-
|
|
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-CMlQeKn0.js";
|
|
4
4
|
import { ElementType, HTMLProps, ReactNode, Ref } from "react";
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
@@ -135,6 +135,6 @@ interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseAutocomp
|
|
|
135
135
|
*
|
|
136
136
|
* @public
|
|
137
137
|
*/
|
|
138
|
-
declare
|
|
138
|
+
declare function Autocomplete<Option extends BaseAutocompleteOption>(props: AutocompleteProps<Option> & Omit<HTMLProps<HTMLInputElement>, 'aria-activedescendant' | 'aria-autocomplete' | 'aria-expanded' | 'aria-owns' | 'as' | 'autoCapitalize' | 'autoComplete' | 'autoCorrect' | 'id' | 'inputMode' | 'onChange' | 'onSelect' | 'popover' | 'prefix' | 'role' | 'spellCheck' | 'type' | 'value'>): import("react").JSX.Element;
|
|
139
139
|
export { Autocomplete, type AutocompleteInputChangeMsg, type AutocompleteInputFoocusMsg, type AutocompleteMsg, type AutocompleteOpenButtonProps, type AutocompleteProps, type AutocompleteRootBlurMsg, type AutocompleteRootClearMsg, type AutocompleteRootEscapeMsg, type AutocompleteRootOpenMsg, type AutocompleteRootSetActiveValueMsg, type AutocompleteRootSetListFocusedMsg, type AutocompleteState, type AutocompleteValueChangeMsg, type BaseAutocompleteOption };
|
|
140
140
|
//# sourceMappingURL=autocomplete.d.ts.map
|
|
@@ -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;;;;UC7Da,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;;;;;;;;
|
|
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;;;;UC7Da,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;;;;;;;;iBAec,aAAa,eAAe,wBAC1C,OAAO,kBAAkB,UACvB,KACE,UAAU,gSAmBX,IAAA"}
|
package/dist/autocomplete.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { n as _getArrayProp, o as EMPTY_ARRAY, s as EMPTY_RECORD } from "./helpers-bwfx1e-Y.js";
|
|
3
|
-
import { d as focusFirstDescendant, l as _hasFocus, m as _raf, t as TextInput } from "./textInput-
|
|
3
|
+
import { d as focusFirstDescendant, l as _hasFocus, m as _raf, t as TextInput } from "./textInput-DhCo-b3N.js";
|
|
4
4
|
import { t as _isEnterToClickElement } from "./element-BYgCE_iK.js";
|
|
5
5
|
import { s as Card, y as Box } from "./useLayer-9Pz-GG0r.js";
|
|
6
6
|
import { n as Text, t as Stack } from "./stack-C5WV-BRh.js";
|
|
7
|
-
import { t as Button } from "./button-
|
|
8
|
-
import { t as Popover } from "./popover-
|
|
7
|
+
import { t as Button } from "./button-BDLRd1Rr.js";
|
|
8
|
+
import { t as Popover } from "./popover-DfXz9lUl.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
10
|
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
11
11
|
import { cloneElement, startTransition, useEffect, useImperativeHandle, useReducer, useRef, useState } from "react";
|
|
@@ -104,7 +104,14 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
104
104
|
"Meta",
|
|
105
105
|
"Tab",
|
|
106
106
|
"CapsLock"
|
|
107
|
-
], AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1
|
|
107
|
+
], AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
108
|
+
/**
|
|
109
|
+
* The Autocomplete component is typically used for search components.
|
|
110
|
+
* It consists of a text input for writing a query, and properties for rendering suggestions.
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
function Autocomplete(props) {
|
|
108
115
|
let $ = c(182), 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;
|
|
109
116
|
$[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);
|
|
110
117
|
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;
|
|
@@ -447,7 +454,13 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
447
454
|
ref: rootElementRef,
|
|
448
455
|
children: [t44, results]
|
|
449
456
|
}), $[176] = handleRootBlur, $[177] = handleRootFocus, $[178] = handleRootKeyDown, $[179] = results, $[180] = t44, $[181] = t45) : t45 = $[181], t45;
|
|
450
|
-
}
|
|
457
|
+
}
|
|
458
|
+
function _temp2(v_1) {
|
|
459
|
+
return Math.max(v_1 - 1, 0);
|
|
460
|
+
}
|
|
461
|
+
function _temp(v_0) {
|
|
462
|
+
return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
|
|
463
|
+
}
|
|
451
464
|
function RenderPopover({ renderPopover, content, hidden, inputElement, onMouseEnter, onMouseLeave, resultsPopoverElementRef }) {
|
|
452
465
|
return renderPopover({
|
|
453
466
|
content,
|
|
@@ -457,12 +470,6 @@ function RenderPopover({ renderPopover, content, hidden, inputElement, onMouseEn
|
|
|
457
470
|
onMouseLeave
|
|
458
471
|
}, resultsPopoverElementRef);
|
|
459
472
|
}
|
|
460
|
-
function _temp(v_0) {
|
|
461
|
-
return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
|
|
462
|
-
}
|
|
463
|
-
function _temp2(v_1) {
|
|
464
|
-
return Math.max(v_1 - 1, 0);
|
|
465
|
-
}
|
|
466
473
|
export { Autocomplete };
|
|
467
474
|
|
|
468
475
|
//# sourceMappingURL=autocomplete.js.map
|
package/dist/autocomplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","names":["SpinnerIcon","keyframes","styled","Box","StyledAutocomplete","div","ListBox","rotate","AnimatedSpinnerIcon","useCallback","_isEnterToClickElement","AutocompleteOptionProps","children","React","ReactNode","id","onSelect","v","selected","value","AutocompleteOption","props","$","_c","t0","setTimeout","handleClick","t1","event","key","currentTarget","handleKeyDown","t2","AutocompleteMsg","AutocompleteState","autocompleteReducer","state","msg","type","activeValue","focused","query","value","listFocused","Placement","AUTOCOMPLETE_LISTBOX_IGNORE_KEYS","AUTOCOMPLETE_POPOVER_PLACEMENT","AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS","ChevronDownIcon","ChangeEvent","cloneElement","ElementType","FocusEvent","HTMLProps","KeyboardEvent","MouseEvent","ReactNode","Ref","startTransition","useCallback","useEffect","useImperativeHandle","useMemo","useReducer","useRef","useState","EMPTY_ARRAY","EMPTY_RECORD","_raf","_hasFocus","focusFirstDescendant","Box","BoxProps","Button","Card","Popover","PopoverProps","Stack","Text","TextInput","_getArrayProp","Radius","AnimatedSpinnerIcon","ListBox","StyledAutocomplete","AutocompleteOption","autocompleteReducer","AUTOCOMPLETE_LISTBOX_IGNORE_KEYS","AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS","AUTOCOMPLETE_POPOVER_PLACEMENT","AutocompleteOpenButtonProps","BaseAutocompleteOption","AutocompleteProps","border","customValidity","filterOption","query","option","Option","fontSize","icon","id","listBox","loading","onChange","value","onQueryChange","onSelect","openButton","openOnFocus","options","padding","popover","Omit","HTMLDivElement","prefix","radius","relatedElements","HTMLElement","renderOption","React","JSX","Element","renderPopover","props","content","hidden","inputElement","HTMLInputElement","onMouseEnter","onMouseLeave","ref","renderValue","suffix","DEFAULT_RENDER_VALUE","DEFAULT_FILTER_OPTION","toLowerCase","indexOf","Autocomplete","$","_c","disabled","filterOptionProp","forwardedRef","onBlur","onFocus","optionsProp","readOnly","renderOptionProp","restProps","t0","t1","t2","t3","t4","t5","t6","valueProp","undefined","paddingProp","t7","t8","t9","activeValue","focused","listFocused","state","dispatch","t10","t11","value_0","defaultRenderOption","rootElementRef","resultsPopoverElementRef","inputElementRef","listBoxElementRef","_setInputElement","Symbol","for","node","setInputElement","listFocusedRef","valueRef","valuePropRef","popoverMouseWithinRef","t12","t13","t14","t15","listBoxId","Array","isArray","t16","find","o","currentOption","t17","t18","filter","filteredOptions","filteredOptionsLen","length","activeItemId","expanded","event","setTimeout","current","elements","concat","focusInside","document","activeElement","e","contains","type","handleRootBlur","t19","event_0","listBoxElement","focusedElement","target","listFocused_0","handleRootFocus","t20","v","focus","handleOptionSelect","t21","event_1","key","preventDefault","activeOption","o_0","activeIndex","nextActiveOption","activeOption_0","o_1","activeIndex_0","nextActiveOption_0","Node","listEl","includes","handleRootKeyDown","t22","event_2","nextQuery","currentTarget","handleInputChange","t23","dispatchOpen","t24","event_3","handleInputFocus","t25","handlePopoverMouseEnter","t26","handlePopoverMouseLeave","t27","handleClearButtonClick","t28","handleClearButtonFocus","t29","t30","t31","t32","t33","t34","listElement","activeOption_1","o_2","activeIndex_1","activeItemElement","childNodes","HTMLLIElement","t35","bb0","t36","clearButton","openButtonBoxPadding","map","_temp","openButtonPadding","_temp2","openButtonProps","event_4","onClick","handleOpenClick","t37","openButtonNode","t38","bb1","t39","inputValue","event_5","handleListBoxKeyDown","t40","bb2","t41","t42","option_0","active","selected","tabIndex","t43","bb3","results","t44","t45","RenderPopover","Exclude","Parameters","v_0","v_1","Math","max"],"sources":["../src/core/components/autocomplete/autocomplete.styles.tsx","../src/core/components/autocomplete/autocompleteOption.tsx","../src/core/components/autocomplete/autocompleteReducer.ts","../src/core/components/autocomplete/constants.ts","../src/core/components/autocomplete/autocomplete.tsx"],"sourcesContent":["import {SpinnerIcon} from '@sanity/icons/Spinner'\nimport {keyframes, styled} from 'styled-components'\n\nimport {Box} from '../../primitives/box/box'\n\n/**\n * @internal\n */\nexport const StyledAutocomplete = styled.div`\n line-height: 0;\n`\n\n/**\n * @internal\n */\nexport const ListBox = styled(Box)`\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n`\n\nconst rotate = keyframes`\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n`\n\n/**\n * @internal\n */\nexport const AnimatedSpinnerIcon = styled(SpinnerIcon)`\n animation: ${rotate} 500ms linear infinite;\n`\n","import {useCallback} from 'react'\n\nimport {_isEnterToClickElement} from '../../helpers/element'\n\nexport interface AutocompleteOptionProps {\n children: React.ReactNode\n id: string\n onSelect: (v: string) => void\n selected: boolean\n value: string\n}\n\nexport function AutocompleteOption(props: AutocompleteOptionProps): React.JSX.Element {\n const {children, id, onSelect, selected, value} = props\n\n const handleClick = useCallback(() => {\n // Calling the `onSelect` in a timeout is a fix to\n // allow the `click` event to propagate in some cases\n setTimeout(() => {\n onSelect(value)\n }, 0)\n }, [onSelect, value])\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLLIElement>) => {\n if (event.key === 'Enter' && !_isEnterToClickElement(event.currentTarget)) {\n handleClick()\n }\n },\n [handleClick],\n )\n\n return (\n <li\n aria-selected={selected}\n data-ui=\"AutocompleteOption\"\n id={id}\n // oxlint-disable-next-line no-noninteractive-element-to-interactive-role, prefer-tag-over-role\n role=\"option\"\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n {children}\n </li>\n )\n}\n","import {AutocompleteMsg, AutocompleteState} from './types'\n\n/**\n * @internal\n */\nexport function autocompleteReducer(\n state: AutocompleteState,\n msg: AutocompleteMsg,\n): AutocompleteState {\n if (msg.type === 'input/change') {\n return {...state, activeValue: null, focused: true, query: msg.query}\n }\n\n if (msg.type === 'input/focus') {\n return {...state, focused: true}\n }\n\n if (msg.type === 'root/blur') {\n return {...state, focused: false, query: null}\n }\n\n if (msg.type === 'root/clear') {\n return {...state, activeValue: null, query: null, value: null}\n }\n\n if (msg.type === 'root/escape') {\n return {...state, focused: false, query: null}\n }\n\n if (msg.type === 'root/open') {\n return {...state, query: state.query || msg.query}\n }\n\n if (msg.type === 'root/setActiveValue') {\n return {...state, activeValue: msg.value, listFocused: msg.listFocused || state.listFocused}\n }\n\n if (msg.type === 'root/setListFocused') {\n return {...state, listFocused: msg.listFocused}\n }\n\n if (msg.type === 'value/change') {\n return {...state, activeValue: msg.value, query: null, value: msg.value}\n }\n\n return state\n}\n","import {Placement} from '../../types/placement'\n\n/**\n * @internal\n */\nexport const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [\n 'Control',\n 'Shift',\n 'Alt',\n 'Enter',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n 'Meta',\n 'Tab',\n 'CapsLock',\n]\n\n/**\n * @internal\n */\nexport const AUTOCOMPLETE_POPOVER_PLACEMENT: Placement = 'bottom-start'\n\n/**\n * @internal\n */\nexport const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS: Placement[] = ['bottom-start', 'top-start']\n","import {ChevronDownIcon} from '@sanity/icons/ChevronDown'\nimport {\n ChangeEvent,\n cloneElement,\n ElementType,\n FocusEvent,\n HTMLProps,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n Ref,\n startTransition,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useReducer,\n useRef,\n useState,\n} from 'react'\n\nimport {EMPTY_ARRAY, EMPTY_RECORD} from '../../constants'\nimport {_raf} from '../../helpers/animation'\nimport {_hasFocus, focusFirstDescendant} from '../../helpers/focus'\nimport {Box, BoxProps} from '../../primitives/box/box'\nimport {Button} from '../../primitives/button/button'\nimport {Card} from '../../primitives/card/card'\nimport {Popover, PopoverProps} from '../../primitives/popover/popover'\nimport {Stack} from '../../primitives/stack/stack'\nimport {Text} from '../../primitives/text/text'\nimport {TextInput} from '../../primitives/textInput/textInput'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {Radius} from '../../types/radius'\nimport {AnimatedSpinnerIcon, ListBox, StyledAutocomplete} from './autocomplete.styles'\nimport {AutocompleteOption} from './autocompleteOption'\nimport {autocompleteReducer} from './autocompleteReducer'\nimport {\n AUTOCOMPLETE_LISTBOX_IGNORE_KEYS,\n AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,\n AUTOCOMPLETE_POPOVER_PLACEMENT,\n} from './constants'\nimport {AutocompleteOpenButtonProps, BaseAutocompleteOption} from './types'\n\n/**\n * @public\n */\nexport interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseAutocompleteOption> {\n border?: boolean\n customValidity?: string\n filterOption?: (query: string, option: Option) => boolean\n fontSize?: number | number[]\n // oxlint-disable-next-line no-redundant-type-constituents\n icon?: ElementType | ReactNode\n id: string\n /** @beta */\n listBox?: BoxProps\n loading?: boolean\n onChange?: (value: string) => void\n onQueryChange?: (query: string | null) => void\n onSelect?: (value: string) => void\n /** @beta */\n openButton?: boolean | AutocompleteOpenButtonProps\n /** @beta */\n openOnFocus?: boolean\n /** The options to render. */\n options?: Option[]\n padding?: number | number[]\n popover?: Omit<PopoverProps, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'> &\n Omit<HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'ref' | 'width'>\n prefix?: ReactNode\n radius?: Radius | Radius[]\n /** @beta */\n relatedElements?: HTMLElement[]\n /** The callback function for rendering each option. */\n renderOption?: (option: Option) => React.JSX.Element\n /** @beta */\n renderPopover?: (\n props: {\n content: React.JSX.Element | null\n hidden: boolean\n inputElement: HTMLInputElement | null\n onMouseEnter: () => void\n onMouseLeave: () => void\n },\n ref: Ref<HTMLDivElement>,\n ) => ReactNode\n renderValue?: (value: string, option?: Option) => string\n suffix?: ReactNode\n /** The current value. */\n value?: string\n}\n\nconst DEFAULT_RENDER_VALUE = (value: string, option?: BaseAutocompleteOption) =>\n option ? option.value : value\n\nconst DEFAULT_FILTER_OPTION = (query: string, option: BaseAutocompleteOption) =>\n option.value.toLowerCase().indexOf(query.toLowerCase()) > -1\n\n/**\n * The Autocomplete component is typically used for search components.\n * It consists of a text input for writing a query, and properties for rendering suggestions.\n *\n * @public\n */\nexport const Autocomplete = function Autocomplete<Option extends BaseAutocompleteOption>(\n props: AutocompleteProps<Option> &\n Omit<\n HTMLProps<HTMLInputElement>,\n | 'aria-activedescendant'\n | 'aria-autocomplete'\n | 'aria-expanded'\n | 'aria-owns'\n | 'as'\n | 'autoCapitalize'\n | 'autoComplete'\n | 'autoCorrect'\n | 'id'\n | 'inputMode'\n | 'onChange'\n | 'onSelect'\n | 'popover'\n | 'prefix'\n | 'role'\n | 'spellCheck'\n | 'type'\n | 'value'\n >,\n) {\n const {\n border = true,\n customValidity,\n disabled,\n filterOption: filterOptionProp,\n fontSize = 2,\n icon,\n id,\n listBox = EMPTY_RECORD,\n loading,\n onBlur,\n onChange,\n onFocus,\n onQueryChange,\n onSelect,\n openButton,\n openOnFocus,\n options: optionsProp,\n padding: paddingProp = 3,\n popover = EMPTY_RECORD,\n prefix,\n radius = 2,\n readOnly,\n ref: forwardedRef,\n relatedElements,\n renderOption: renderOptionProp,\n renderPopover,\n renderValue = DEFAULT_RENDER_VALUE,\n suffix,\n value: valueProp,\n ...restProps\n } = props\n\n const [state, dispatch] = useReducer(autocompleteReducer, {\n activeValue: valueProp || null,\n focused: false,\n listFocused: false,\n query: null,\n value: valueProp || null,\n })\n\n const {activeValue, focused, listFocused, query, value} = state\n\n const defaultRenderOption = useCallback(\n ({value}: BaseAutocompleteOption) => (\n <Card data-as=\"button\" padding={paddingProp} radius={2} tone=\"inherit\">\n <Text size={fontSize} textOverflow=\"ellipsis\">\n {value}\n </Text>\n </Card>\n ),\n [fontSize, paddingProp],\n )\n\n const renderOption =\n typeof renderOptionProp === 'function' ? renderOptionProp : defaultRenderOption\n\n const filterOption =\n typeof filterOptionProp === 'function' ? filterOptionProp : DEFAULT_FILTER_OPTION\n\n // Element refs\n const rootElementRef = useRef<HTMLDivElement | null>(null)\n const resultsPopoverElementRef = useRef<HTMLDivElement | null>(null)\n const inputElementRef = useRef<HTMLInputElement | null>(null)\n const listBoxElementRef = useRef<HTMLUListElement | null>(null)\n // Element refs that need to be accessed during render\n const [inputElement, _setInputElement] = useState<HTMLInputElement | null>(null)\n /**\n * The startTransition wrapper here is to avoid an issue when on React 18 where this error can happen:\n * >Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.\n * This doesn't happen on React 19 due to automatic batching of all state updates, the startTransition wrapper here gives a type of batching for 18 users in a way that still works with 19.\n * NOTE: The startTransition wrapper is not needed in UI v4, since the baseline there is React 19.\n */\n const setInputElement = useCallback((node: HTMLInputElement | null) => {\n startTransition(() => _setInputElement(node))\n }, [])\n\n // Value refs\n const listFocusedRef = useRef(false)\n const valueRef = useRef(value)\n const valuePropRef = useRef(valueProp)\n const popoverMouseWithinRef = useRef(false)\n\n // Forward inputElement state to inputElementRef\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(\n inputElementRef,\n () => inputElement,\n [inputElement],\n )\n // Forward inputElement to parent\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(\n forwardedRef,\n () => inputElement,\n [inputElement],\n )\n\n const listBoxId = `${id}-listbox`\n const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY\n const padding = _getArrayProp(paddingProp)\n const currentOption = useMemo(\n () => (value !== null ? options.find((o) => o.value === value) : undefined),\n [options, value],\n )\n const filteredOptions = useMemo(\n () => options.filter((option) => (query ? filterOption(query, option) : true)),\n [filterOption, options, query],\n )\n const filteredOptionsLen = filteredOptions.length\n const activeItemId = activeValue ? `${id}-option-${activeValue}` : undefined\n const expanded = (query !== null && loading) || (focused && query !== null)\n\n const handleRootBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setTimeout(() => {\n // NOTE: This is a workaround for a bug that may happen in Chrome (clicking the scrollbar\n // closes the results in certain situations):\n // - Do not handle blur if the mouse is within the popover\n if (popoverMouseWithinRef.current) {\n return\n }\n\n const elements: HTMLElement[] = (relatedElements || []).concat(\n rootElementRef.current ? [rootElementRef.current] : [],\n resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : [],\n )\n\n let focusInside = false\n\n if (document.activeElement) {\n for (const e of elements) {\n if (e === document.activeElement || e.contains(document.activeElement)) {\n focusInside = true\n break\n }\n }\n }\n\n // oxlint-disable-next-line no-unnecessary-boolean-literal-compare\n if (focusInside === false) {\n dispatch({type: 'root/blur'})\n popoverMouseWithinRef.current = false\n if (onQueryChange) onQueryChange(null)\n if (onBlur) onBlur(event)\n }\n }, 0)\n },\n [onBlur, onQueryChange, relatedElements],\n )\n\n const handleRootFocus = useCallback((event: FocusEvent<HTMLDivElement>) => {\n const listBoxElement = listBoxElementRef.current\n const focusedElement = event.target instanceof HTMLElement ? event.target : null\n const listFocused = listBoxElement?.contains(focusedElement) || false\n\n if (listFocused !== listFocusedRef.current) {\n listFocusedRef.current = listFocused\n\n dispatch({type: 'root/setListFocused', listFocused})\n }\n }, [])\n\n const handleOptionSelect = useCallback(\n (v: string) => {\n dispatch({type: 'value/change', value: v})\n\n popoverMouseWithinRef.current = false\n\n if (onSelect) onSelect(v)\n\n valueRef.current = v\n\n if (onChange) onChange(v)\n if (onQueryChange) onQueryChange(null)\n\n inputElementRef.current?.focus()\n },\n [onChange, onSelect, onQueryChange],\n )\n\n const handleRootKeyDown = useCallback(\n (event: KeyboardEvent<HTMLElement>) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n\n if (!filteredOptionsLen) return\n\n const activeOption = filteredOptions.find((o) => o.value === activeValue)\n const activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1\n const nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen]\n\n if (nextActiveOption) {\n dispatch({type: 'root/setActiveValue', value: nextActiveOption.value, listFocused: true})\n }\n\n return\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n\n if (!filteredOptionsLen) return\n\n const activeOption = filteredOptions.find((o) => o.value === activeValue)\n const activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1\n const nextActiveOption =\n filteredOptions[\n activeIndex === -1\n ? filteredOptionsLen - 1\n : (filteredOptionsLen + activeIndex - 1) % filteredOptionsLen\n ]\n\n if (nextActiveOption) {\n dispatch({type: 'root/setActiveValue', value: nextActiveOption.value, listFocused: true})\n }\n\n return\n }\n\n if (event.key === 'Escape') {\n dispatch({type: 'root/escape'})\n popoverMouseWithinRef.current = false\n if (onQueryChange) onQueryChange(null)\n inputElementRef.current?.focus()\n\n return\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion\n const target = event.target as Node\n const listEl = listBoxElementRef.current\n\n if (\n (listEl === target || listEl?.contains(target)) &&\n !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event.key)\n ) {\n inputElementRef.current?.focus()\n\n return\n }\n },\n [activeValue, filteredOptions, filteredOptionsLen, onQueryChange],\n )\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const nextQuery = event.currentTarget.value\n\n dispatch({type: 'input/change', query: nextQuery})\n\n if (onQueryChange) onQueryChange(nextQuery)\n },\n [onQueryChange],\n )\n\n const dispatchOpen = useCallback(() => {\n dispatch({\n type: 'root/open',\n query: value ? renderValue(value, currentOption) : '',\n })\n }, [currentOption, renderValue, value])\n\n const handleInputFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n if (!focused) {\n dispatch({type: 'input/focus'})\n\n if (onFocus) onFocus(event)\n if (openOnFocus) dispatchOpen()\n }\n },\n [focused, onFocus, openOnFocus, dispatchOpen],\n )\n\n const handlePopoverMouseEnter = useCallback(() => {\n popoverMouseWithinRef.current = true\n }, [])\n\n const handlePopoverMouseLeave = useCallback(() => {\n popoverMouseWithinRef.current = false\n }, [])\n\n const handleClearButtonClick = useCallback(() => {\n dispatch({type: 'root/clear'})\n valueRef.current = ''\n if (onChange) onChange('')\n if (onQueryChange) onQueryChange(null)\n inputElementRef.current?.focus()\n }, [onChange, onQueryChange])\n\n const handleClearButtonFocus = useCallback(() => {\n dispatch({type: 'input/focus'})\n }, [])\n\n // Change the value when `value` prop changes\n useEffect(() => {\n // If `valueProp` changed\n if (valueProp !== valuePropRef.current) {\n valuePropRef.current = valueProp\n\n if (valueProp !== undefined) {\n dispatch({type: 'value/change', value: valueProp})\n valueRef.current = valueProp\n }\n\n return\n }\n\n // If `valueProp` is not equal to `value`\n if (valueProp !== valueRef.current) {\n valueRef.current = valueProp || null\n\n dispatch({type: 'value/change', value: valueProp || null})\n }\n }, [valueProp])\n\n // Reset active item when closing\n useEffect(() => {\n if (!focused && valueRef.current) {\n dispatch({type: 'root/setActiveValue', value: valueRef.current})\n }\n }, [focused])\n\n // Focus the selected item\n useEffect(() => {\n const listElement = listBoxElementRef.current\n\n if (!listElement) return\n\n const activeOption = filteredOptions.find((o) => o.value === activeValue)\n\n if (activeOption) {\n const activeIndex = filteredOptions.indexOf(activeOption)\n // oxlint-disable-next-line no-unsafe-type-assertion\n const activeItemElement = listElement.childNodes[activeIndex] as HTMLLIElement | undefined\n\n if (activeItemElement) {\n if (_hasFocus(activeItemElement)) {\n // already focused\n return\n }\n\n focusFirstDescendant(activeItemElement)\n }\n }\n }, [activeValue, filteredOptions])\n\n const clearButton = useMemo(() => {\n if (!loading && !disabled && value) {\n return {\n 'aria-label': 'Clear',\n 'onFocus': handleClearButtonFocus,\n }\n }\n\n return undefined\n }, [disabled, handleClearButtonFocus, loading, value])\n\n const openButtonBoxPadding = padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 1\n if (v === 2) return 1\n\n return v - 2\n })\n const openButtonPadding = padding.map((v) => Math.max(v - 1, 0))\n const openButtonProps: AutocompleteOpenButtonProps = useMemo(\n () => (typeof openButton === 'object' ? openButton : EMPTY_RECORD),\n [openButton],\n )\n\n const handleOpenClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n dispatchOpen()\n\n if (openButtonProps.onClick) openButtonProps.onClick(event)\n\n _raf(() => inputElementRef.current?.focus())\n },\n [openButtonProps, dispatchOpen],\n )\n\n const openButtonNode = useMemo(\n () =>\n !disabled && !readOnly && openButton ? (\n <Box aria-hidden={expanded} padding={openButtonBoxPadding}>\n <Button\n aria-label=\"Open\"\n disabled={expanded}\n fontSize={fontSize}\n icon={ChevronDownIcon}\n mode=\"bleed\"\n padding={openButtonPadding}\n {...openButtonProps}\n onClick={handleOpenClick}\n />\n </Box>\n ) : undefined,\n [\n disabled,\n expanded,\n fontSize,\n handleOpenClick,\n openButton,\n openButtonBoxPadding,\n openButtonPadding,\n openButtonProps,\n readOnly,\n ],\n )\n\n const inputValue = useMemo(() => {\n if (query === null) {\n if (value !== null) {\n return renderValue(value, currentOption)\n }\n\n return ''\n }\n\n return query\n }, [currentOption, query, renderValue, value])\n\n const handleListBoxKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n // If the focus is currently in the list, move focus to the input element\n if (event.key === 'Tab') {\n if (listFocused) inputElementRef.current?.focus()\n }\n },\n [listFocused],\n )\n\n const content = useMemo(() => {\n if (filteredOptions.length === 0) return null\n\n return (\n <ListBox\n data-ui=\"AutoComplete__results\"\n onKeyDown={handleListBoxKeyDown}\n padding={1}\n {...listBox}\n tabIndex={-1}\n >\n <Stack\n as=\"ul\"\n aria-multiselectable={false}\n data-ui=\"AutoComplete__resultsList\"\n id={listBoxId}\n ref={listBoxElementRef}\n // oxlint-disable-next-line prefer-tag-over-role\n role=\"listbox\"\n gap={1}\n >\n {filteredOptions.map((option) => {\n const active =\n activeValue !== null ? option.value === activeValue : currentOption === option\n\n return (\n <AutocompleteOption\n id={`${id}-option-${option.value}`}\n key={option.value}\n onSelect={handleOptionSelect}\n selected={active}\n value={option.value}\n >\n {cloneElement(renderOption(option), {\n disabled: loading,\n selected: active,\n tabIndex: listFocused && active ? 0 : -1,\n })}\n </AutocompleteOption>\n )\n })}\n </Stack>\n </ListBox>\n )\n }, [\n activeValue,\n currentOption,\n filteredOptions,\n handleOptionSelect,\n handleListBoxKeyDown,\n id,\n listBox,\n listBoxId,\n listFocused,\n loading,\n renderOption,\n ])\n\n const results = useMemo(() => {\n if (renderPopover) {\n return (\n <RenderPopover\n content={content}\n hidden={!expanded}\n inputElement={inputElement}\n onMouseEnter={handlePopoverMouseEnter}\n onMouseLeave={handlePopoverMouseLeave}\n resultsPopoverElementRef={resultsPopoverElementRef}\n renderPopover={renderPopover}\n />\n )\n }\n\n if (filteredOptionsLen === 0) {\n return null\n }\n\n return (\n <Popover\n arrow={false}\n constrainSize\n content={content}\n fallbackPlacements={AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS}\n matchReferenceWidth\n onMouseEnter={handlePopoverMouseEnter}\n onMouseLeave={handlePopoverMouseLeave}\n open={expanded}\n overflow=\"auto\"\n placement={AUTOCOMPLETE_POPOVER_PLACEMENT}\n portal\n radius={radius}\n ref={resultsPopoverElementRef}\n referenceElement={inputElement}\n {...popover}\n />\n )\n }, [\n content,\n expanded,\n filteredOptionsLen,\n handlePopoverMouseEnter,\n handlePopoverMouseLeave,\n inputElement,\n popover,\n radius,\n renderPopover,\n ])\n\n return (\n <StyledAutocomplete\n data-ui=\"Autocomplete\"\n onBlur={handleRootBlur}\n onFocus={handleRootFocus}\n onKeyDown={handleRootKeyDown}\n ref={rootElementRef}\n >\n <TextInput\n {...restProps}\n aria-activedescendant={activeItemId}\n aria-autocomplete=\"list\"\n aria-expanded={expanded}\n aria-owns={listBoxId}\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n border={border}\n clearButton={clearButton}\n customValidity={customValidity}\n disabled={disabled}\n fontSize={fontSize}\n icon={icon}\n iconRight={loading && AnimatedSpinnerIcon}\n id={id}\n inputMode=\"search\"\n onChange={handleInputChange}\n onClear={handleClearButtonClick}\n onFocus={handleInputFocus}\n padding={padding}\n prefix={prefix}\n radius={radius}\n readOnly={readOnly}\n ref={setInputElement}\n // oxlint-disable-next-line prefer-tag-over-role, role-has-required-aria-props\n role=\"combobox\"\n spellCheck={false}\n suffix={suffix || openButtonNode}\n value={inputValue}\n />\n {results}\n </StyledAutocomplete>\n )\n}\n\nfunction RenderPopover({\n renderPopover,\n content,\n hidden,\n inputElement,\n onMouseEnter,\n onMouseLeave,\n resultsPopoverElementRef,\n}: {\n renderPopover: Exclude<AutocompleteProps['renderPopover'], undefined>\n resultsPopoverElementRef: Parameters<Exclude<AutocompleteProps['renderPopover'], undefined>>[1]\n} & Parameters<Exclude<AutocompleteProps['renderPopover'], undefined>>[0]) {\n return renderPopover(\n {\n content,\n hidden,\n inputElement,\n onMouseEnter,\n onMouseLeave,\n },\n resultsPopoverElementRef,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAaI,qBAAqBF,OAAOG,IAAAA,WAAAA;;;AAAG,CAAA,CAAA,kBAO/BC,UAAUJ,OAAOC,GAAG,CAAC,CAAA,WAAA;;;iDAQ5BI,SAASN,SAAS,8DAaXO,sBAAsBN,OAAOF,WAAW,CAAC,CAAA,WAAA;;;AACvCO,CAAAA,CAAAA,aAAAA,OAAM;ACzBrB,SAAOa,mBAAAC,OAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GACL,EAAAX,UAAAG,IAAAC,UAAAE,UAAAC,UAAkDE,OAAKG;CAAA,AAAAF,EAAA,OAAAN,YAAAM,EAAA,OAAAH,SAEvBK,WAAA;EAG9BC,iBAAW;GACTT,SAASG,KAAK;EAAC,GACd,CAAC;CAAC,GACNG,EAAA,KAAAN,UAAAM,EAAA,KAAAH,OAAAG,EAAA,KAAAE,MAAAA,KAAAF,EAAA;CAND,IAAAI,cAAoBF,IAMCG;CAAA,AAAAL,EAAA,OAAA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2C,4BAIyE;CACzE,OAAOlD,cACL;EACEE;EACAC;EACAC;EACAE;EACAC;CACF,GACA2C,wBACF;AACF;AAvnB4B,SAAA2G,MAAA+B,KAAA;CAgYH,OAFjBvF,QAAM,IAAU,IAChBA,QAAM,KACNA,QAAM,IAAU,IAEbA,MAAI;AAAC;AAlYY,SAAA0D,OAAA8B,KAAA;CAAA,OAoYmBC,KAAIC,IAAK1F,MAAI,GAAG,CAAC;AAAC"}
|
|
1
|
+
{"version":3,"file":"autocomplete.js","names":["SpinnerIcon","keyframes","styled","Box","StyledAutocomplete","div","ListBox","rotate","AnimatedSpinnerIcon","useCallback","_isEnterToClickElement","AutocompleteOptionProps","children","React","ReactNode","id","onSelect","v","selected","value","AutocompleteOption","props","$","_c","t0","setTimeout","handleClick","t1","event","key","currentTarget","handleKeyDown","t2","AutocompleteMsg","AutocompleteState","autocompleteReducer","state","msg","type","activeValue","focused","query","value","listFocused","Placement","AUTOCOMPLETE_LISTBOX_IGNORE_KEYS","AUTOCOMPLETE_POPOVER_PLACEMENT","AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS","ChevronDownIcon","ChangeEvent","cloneElement","ElementType","FocusEvent","HTMLProps","KeyboardEvent","MouseEvent","ReactNode","Ref","startTransition","useCallback","useEffect","useImperativeHandle","useMemo","useReducer","useRef","useState","EMPTY_ARRAY","EMPTY_RECORD","_raf","_hasFocus","focusFirstDescendant","Box","BoxProps","Button","Card","Popover","PopoverProps","Stack","Text","TextInput","_getArrayProp","Radius","AnimatedSpinnerIcon","ListBox","StyledAutocomplete","AutocompleteOption","autocompleteReducer","AUTOCOMPLETE_LISTBOX_IGNORE_KEYS","AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS","AUTOCOMPLETE_POPOVER_PLACEMENT","AutocompleteOpenButtonProps","BaseAutocompleteOption","AutocompleteProps","border","customValidity","filterOption","query","option","Option","fontSize","icon","id","listBox","loading","onChange","value","onQueryChange","onSelect","openButton","openOnFocus","options","padding","popover","Omit","HTMLDivElement","prefix","radius","relatedElements","HTMLElement","renderOption","React","JSX","Element","renderPopover","props","content","hidden","inputElement","HTMLInputElement","onMouseEnter","onMouseLeave","ref","renderValue","suffix","DEFAULT_RENDER_VALUE","DEFAULT_FILTER_OPTION","toLowerCase","indexOf","Autocomplete","$","_c","disabled","filterOptionProp","forwardedRef","onBlur","onFocus","optionsProp","readOnly","renderOptionProp","restProps","t0","t1","t2","t3","t4","t5","t6","valueProp","undefined","paddingProp","t7","t8","t9","activeValue","focused","listFocused","state","dispatch","t10","t11","value_0","defaultRenderOption","rootElementRef","resultsPopoverElementRef","inputElementRef","listBoxElementRef","_setInputElement","Symbol","for","node","setInputElement","listFocusedRef","valueRef","valuePropRef","popoverMouseWithinRef","t12","t13","t14","t15","listBoxId","Array","isArray","t16","find","o","currentOption","t17","t18","filter","filteredOptions","filteredOptionsLen","length","activeItemId","expanded","event","setTimeout","current","elements","concat","focusInside","document","activeElement","e","contains","type","handleRootBlur","t19","event_0","listBoxElement","focusedElement","target","listFocused_0","handleRootFocus","t20","v","focus","handleOptionSelect","t21","event_1","key","preventDefault","activeOption","o_0","activeIndex","nextActiveOption","activeOption_0","o_1","activeIndex_0","nextActiveOption_0","Node","listEl","includes","handleRootKeyDown","t22","event_2","nextQuery","currentTarget","handleInputChange","t23","dispatchOpen","t24","event_3","handleInputFocus","t25","handlePopoverMouseEnter","t26","handlePopoverMouseLeave","t27","handleClearButtonClick","t28","handleClearButtonFocus","t29","t30","t31","t32","t33","t34","listElement","activeOption_1","o_2","activeIndex_1","activeItemElement","childNodes","HTMLLIElement","t35","bb0","t36","clearButton","openButtonBoxPadding","map","_temp","openButtonPadding","_temp2","openButtonProps","event_4","onClick","handleOpenClick","t37","openButtonNode","t38","bb1","t39","inputValue","event_5","handleListBoxKeyDown","t40","bb2","t41","t42","option_0","active","selected","tabIndex","t43","bb3","results","t44","t45","v_1","Math","max","v_0","RenderPopover","Exclude","Parameters"],"sources":["../src/core/components/autocomplete/autocomplete.styles.tsx","../src/core/components/autocomplete/autocompleteOption.tsx","../src/core/components/autocomplete/autocompleteReducer.ts","../src/core/components/autocomplete/constants.ts","../src/core/components/autocomplete/autocomplete.tsx"],"sourcesContent":["import {SpinnerIcon} from '@sanity/icons/Spinner'\nimport {keyframes, styled} from 'styled-components'\n\nimport {Box} from '../../primitives/box/box'\n\n/**\n * @internal\n */\nexport const StyledAutocomplete = styled.div`\n line-height: 0;\n`\n\n/**\n * @internal\n */\nexport const ListBox = styled(Box)`\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n`\n\nconst rotate = keyframes`\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n`\n\n/**\n * @internal\n */\nexport const AnimatedSpinnerIcon = styled(SpinnerIcon)`\n animation: ${rotate} 500ms linear infinite;\n`\n","import {useCallback} from 'react'\n\nimport {_isEnterToClickElement} from '../../helpers/element'\n\nexport interface AutocompleteOptionProps {\n children: React.ReactNode\n id: string\n onSelect: (v: string) => void\n selected: boolean\n value: string\n}\n\nexport function AutocompleteOption(props: AutocompleteOptionProps): React.JSX.Element {\n const {children, id, onSelect, selected, value} = props\n\n const handleClick = useCallback(() => {\n // Calling the `onSelect` in a timeout is a fix to\n // allow the `click` event to propagate in some cases\n setTimeout(() => {\n onSelect(value)\n }, 0)\n }, [onSelect, value])\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLLIElement>) => {\n if (event.key === 'Enter' && !_isEnterToClickElement(event.currentTarget)) {\n handleClick()\n }\n },\n [handleClick],\n )\n\n return (\n <li\n aria-selected={selected}\n data-ui=\"AutocompleteOption\"\n id={id}\n // oxlint-disable-next-line no-noninteractive-element-to-interactive-role, prefer-tag-over-role\n role=\"option\"\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n {children}\n </li>\n )\n}\n","import {AutocompleteMsg, AutocompleteState} from './types'\n\n/**\n * @internal\n */\nexport function autocompleteReducer(\n state: AutocompleteState,\n msg: AutocompleteMsg,\n): AutocompleteState {\n if (msg.type === 'input/change') {\n return {...state, activeValue: null, focused: true, query: msg.query}\n }\n\n if (msg.type === 'input/focus') {\n return {...state, focused: true}\n }\n\n if (msg.type === 'root/blur') {\n return {...state, focused: false, query: null}\n }\n\n if (msg.type === 'root/clear') {\n return {...state, activeValue: null, query: null, value: null}\n }\n\n if (msg.type === 'root/escape') {\n return {...state, focused: false, query: null}\n }\n\n if (msg.type === 'root/open') {\n return {...state, query: state.query || msg.query}\n }\n\n if (msg.type === 'root/setActiveValue') {\n return {...state, activeValue: msg.value, listFocused: msg.listFocused || state.listFocused}\n }\n\n if (msg.type === 'root/setListFocused') {\n return {...state, listFocused: msg.listFocused}\n }\n\n if (msg.type === 'value/change') {\n return {...state, activeValue: msg.value, query: null, value: msg.value}\n }\n\n return state\n}\n","import {Placement} from '../../types/placement'\n\n/**\n * @internal\n */\nexport const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [\n 'Control',\n 'Shift',\n 'Alt',\n 'Enter',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n 'Meta',\n 'Tab',\n 'CapsLock',\n]\n\n/**\n * @internal\n */\nexport const AUTOCOMPLETE_POPOVER_PLACEMENT: Placement = 'bottom-start'\n\n/**\n * @internal\n */\nexport const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS: Placement[] = ['bottom-start', 'top-start']\n","import {ChevronDownIcon} from '@sanity/icons/ChevronDown'\nimport {\n ChangeEvent,\n cloneElement,\n ElementType,\n FocusEvent,\n HTMLProps,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n Ref,\n startTransition,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useReducer,\n useRef,\n useState,\n} from 'react'\n\nimport {EMPTY_ARRAY, EMPTY_RECORD} from '../../constants'\nimport {_raf} from '../../helpers/animation'\nimport {_hasFocus, focusFirstDescendant} from '../../helpers/focus'\nimport {Box, BoxProps} from '../../primitives/box/box'\nimport {Button} from '../../primitives/button/button'\nimport {Card} from '../../primitives/card/card'\nimport {Popover, PopoverProps} from '../../primitives/popover/popover'\nimport {Stack} from '../../primitives/stack/stack'\nimport {Text} from '../../primitives/text/text'\nimport {TextInput} from '../../primitives/textInput/textInput'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {Radius} from '../../types/radius'\nimport {AnimatedSpinnerIcon, ListBox, StyledAutocomplete} from './autocomplete.styles'\nimport {AutocompleteOption} from './autocompleteOption'\nimport {autocompleteReducer} from './autocompleteReducer'\nimport {\n AUTOCOMPLETE_LISTBOX_IGNORE_KEYS,\n AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,\n AUTOCOMPLETE_POPOVER_PLACEMENT,\n} from './constants'\nimport {AutocompleteOpenButtonProps, BaseAutocompleteOption} from './types'\n\n/**\n * @public\n */\nexport interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseAutocompleteOption> {\n border?: boolean\n customValidity?: string\n filterOption?: (query: string, option: Option) => boolean\n fontSize?: number | number[]\n // oxlint-disable-next-line no-redundant-type-constituents\n icon?: ElementType | ReactNode\n id: string\n /** @beta */\n listBox?: BoxProps\n loading?: boolean\n onChange?: (value: string) => void\n onQueryChange?: (query: string | null) => void\n onSelect?: (value: string) => void\n /** @beta */\n openButton?: boolean | AutocompleteOpenButtonProps\n /** @beta */\n openOnFocus?: boolean\n /** The options to render. */\n options?: Option[]\n padding?: number | number[]\n popover?: Omit<PopoverProps, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'> &\n Omit<HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'ref' | 'width'>\n prefix?: ReactNode\n radius?: Radius | Radius[]\n /** @beta */\n relatedElements?: HTMLElement[]\n /** The callback function for rendering each option. */\n renderOption?: (option: Option) => React.JSX.Element\n /** @beta */\n renderPopover?: (\n props: {\n content: React.JSX.Element | null\n hidden: boolean\n inputElement: HTMLInputElement | null\n onMouseEnter: () => void\n onMouseLeave: () => void\n },\n ref: Ref<HTMLDivElement>,\n ) => ReactNode\n renderValue?: (value: string, option?: Option) => string\n suffix?: ReactNode\n /** The current value. */\n value?: string\n}\n\nconst DEFAULT_RENDER_VALUE = (value: string, option?: BaseAutocompleteOption) =>\n option ? option.value : value\n\nconst DEFAULT_FILTER_OPTION = (query: string, option: BaseAutocompleteOption) =>\n option.value.toLowerCase().indexOf(query.toLowerCase()) > -1\n\n/**\n * The Autocomplete component is typically used for search components.\n * It consists of a text input for writing a query, and properties for rendering suggestions.\n *\n * @public\n */\nexport function Autocomplete<Option extends BaseAutocompleteOption>(\n props: AutocompleteProps<Option> &\n Omit<\n HTMLProps<HTMLInputElement>,\n | 'aria-activedescendant'\n | 'aria-autocomplete'\n | 'aria-expanded'\n | 'aria-owns'\n | 'as'\n | 'autoCapitalize'\n | 'autoComplete'\n | 'autoCorrect'\n | 'id'\n | 'inputMode'\n | 'onChange'\n | 'onSelect'\n | 'popover'\n | 'prefix'\n | 'role'\n | 'spellCheck'\n | 'type'\n | 'value'\n >,\n) {\n const {\n border = true,\n customValidity,\n disabled,\n filterOption: filterOptionProp,\n fontSize = 2,\n icon,\n id,\n listBox = EMPTY_RECORD,\n loading,\n onBlur,\n onChange,\n onFocus,\n onQueryChange,\n onSelect,\n openButton,\n openOnFocus,\n options: optionsProp,\n padding: paddingProp = 3,\n popover = EMPTY_RECORD,\n prefix,\n radius = 2,\n readOnly,\n ref: forwardedRef,\n relatedElements,\n renderOption: renderOptionProp,\n renderPopover,\n renderValue = DEFAULT_RENDER_VALUE,\n suffix,\n value: valueProp,\n ...restProps\n } = props\n\n const [state, dispatch] = useReducer(autocompleteReducer, {\n activeValue: valueProp || null,\n focused: false,\n listFocused: false,\n query: null,\n value: valueProp || null,\n })\n\n const {activeValue, focused, listFocused, query, value} = state\n\n const defaultRenderOption = useCallback(\n ({value}: BaseAutocompleteOption) => (\n <Card data-as=\"button\" padding={paddingProp} radius={2} tone=\"inherit\">\n <Text size={fontSize} textOverflow=\"ellipsis\">\n {value}\n </Text>\n </Card>\n ),\n [fontSize, paddingProp],\n )\n\n const renderOption =\n typeof renderOptionProp === 'function' ? renderOptionProp : defaultRenderOption\n\n const filterOption =\n typeof filterOptionProp === 'function' ? filterOptionProp : DEFAULT_FILTER_OPTION\n\n // Element refs\n const rootElementRef = useRef<HTMLDivElement | null>(null)\n const resultsPopoverElementRef = useRef<HTMLDivElement | null>(null)\n const inputElementRef = useRef<HTMLInputElement | null>(null)\n const listBoxElementRef = useRef<HTMLUListElement | null>(null)\n // Element refs that need to be accessed during render\n const [inputElement, _setInputElement] = useState<HTMLInputElement | null>(null)\n /**\n * The startTransition wrapper here is to avoid an issue when on React 18 where this error can happen:\n * >Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.\n * This doesn't happen on React 19 due to automatic batching of all state updates, the startTransition wrapper here gives a type of batching for 18 users in a way that still works with 19.\n * NOTE: The startTransition wrapper is not needed in UI v4, since the baseline there is React 19.\n */\n const setInputElement = useCallback((node: HTMLInputElement | null) => {\n startTransition(() => _setInputElement(node))\n }, [])\n\n // Value refs\n const listFocusedRef = useRef(false)\n const valueRef = useRef(value)\n const valuePropRef = useRef(valueProp)\n const popoverMouseWithinRef = useRef(false)\n\n // Forward inputElement state to inputElementRef\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(\n inputElementRef,\n () => inputElement,\n [inputElement],\n )\n // Forward inputElement to parent\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(\n forwardedRef,\n () => inputElement,\n [inputElement],\n )\n\n const listBoxId = `${id}-listbox`\n const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY\n const padding = _getArrayProp(paddingProp)\n const currentOption = useMemo(\n () => (value !== null ? options.find((o) => o.value === value) : undefined),\n [options, value],\n )\n const filteredOptions = useMemo(\n () => options.filter((option) => (query ? filterOption(query, option) : true)),\n [filterOption, options, query],\n )\n const filteredOptionsLen = filteredOptions.length\n const activeItemId = activeValue ? `${id}-option-${activeValue}` : undefined\n const expanded = (query !== null && loading) || (focused && query !== null)\n\n const handleRootBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setTimeout(() => {\n // NOTE: This is a workaround for a bug that may happen in Chrome (clicking the scrollbar\n // closes the results in certain situations):\n // - Do not handle blur if the mouse is within the popover\n if (popoverMouseWithinRef.current) {\n return\n }\n\n const elements: HTMLElement[] = (relatedElements || []).concat(\n rootElementRef.current ? [rootElementRef.current] : [],\n resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : [],\n )\n\n let focusInside = false\n\n if (document.activeElement) {\n for (const e of elements) {\n if (e === document.activeElement || e.contains(document.activeElement)) {\n focusInside = true\n break\n }\n }\n }\n\n // oxlint-disable-next-line no-unnecessary-boolean-literal-compare\n if (focusInside === false) {\n dispatch({type: 'root/blur'})\n popoverMouseWithinRef.current = false\n if (onQueryChange) onQueryChange(null)\n if (onBlur) onBlur(event)\n }\n }, 0)\n },\n [onBlur, onQueryChange, relatedElements],\n )\n\n const handleRootFocus = useCallback((event: FocusEvent<HTMLDivElement>) => {\n const listBoxElement = listBoxElementRef.current\n const focusedElement = event.target instanceof HTMLElement ? event.target : null\n const listFocused = listBoxElement?.contains(focusedElement) || false\n\n if (listFocused !== listFocusedRef.current) {\n listFocusedRef.current = listFocused\n\n dispatch({type: 'root/setListFocused', listFocused})\n }\n }, [])\n\n const handleOptionSelect = useCallback(\n (v: string) => {\n dispatch({type: 'value/change', value: v})\n\n popoverMouseWithinRef.current = false\n\n if (onSelect) onSelect(v)\n\n valueRef.current = v\n\n if (onChange) onChange(v)\n if (onQueryChange) onQueryChange(null)\n\n inputElementRef.current?.focus()\n },\n [onChange, onSelect, onQueryChange],\n )\n\n const handleRootKeyDown = useCallback(\n (event: KeyboardEvent<HTMLElement>) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n\n if (!filteredOptionsLen) return\n\n const activeOption = filteredOptions.find((o) => o.value === activeValue)\n const activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1\n const nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen]\n\n if (nextActiveOption) {\n dispatch({type: 'root/setActiveValue', value: nextActiveOption.value, listFocused: true})\n }\n\n return\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n\n if (!filteredOptionsLen) return\n\n const activeOption = filteredOptions.find((o) => o.value === activeValue)\n const activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1\n const nextActiveOption =\n filteredOptions[\n activeIndex === -1\n ? filteredOptionsLen - 1\n : (filteredOptionsLen + activeIndex - 1) % filteredOptionsLen\n ]\n\n if (nextActiveOption) {\n dispatch({type: 'root/setActiveValue', value: nextActiveOption.value, listFocused: true})\n }\n\n return\n }\n\n if (event.key === 'Escape') {\n dispatch({type: 'root/escape'})\n popoverMouseWithinRef.current = false\n if (onQueryChange) onQueryChange(null)\n inputElementRef.current?.focus()\n\n return\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion\n const target = event.target as Node\n const listEl = listBoxElementRef.current\n\n if (\n (listEl === target || listEl?.contains(target)) &&\n !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event.key)\n ) {\n inputElementRef.current?.focus()\n\n return\n }\n },\n [activeValue, filteredOptions, filteredOptionsLen, onQueryChange],\n )\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const nextQuery = event.currentTarget.value\n\n dispatch({type: 'input/change', query: nextQuery})\n\n if (onQueryChange) onQueryChange(nextQuery)\n },\n [onQueryChange],\n )\n\n const dispatchOpen = useCallback(() => {\n dispatch({\n type: 'root/open',\n query: value ? renderValue(value, currentOption) : '',\n })\n }, [currentOption, renderValue, value])\n\n const handleInputFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n if (!focused) {\n dispatch({type: 'input/focus'})\n\n if (onFocus) onFocus(event)\n if (openOnFocus) dispatchOpen()\n }\n },\n [focused, onFocus, openOnFocus, dispatchOpen],\n )\n\n const handlePopoverMouseEnter = useCallback(() => {\n popoverMouseWithinRef.current = true\n }, [])\n\n const handlePopoverMouseLeave = useCallback(() => {\n popoverMouseWithinRef.current = false\n }, [])\n\n const handleClearButtonClick = useCallback(() => {\n dispatch({type: 'root/clear'})\n valueRef.current = ''\n if (onChange) onChange('')\n if (onQueryChange) onQueryChange(null)\n inputElementRef.current?.focus()\n }, [onChange, onQueryChange])\n\n const handleClearButtonFocus = useCallback(() => {\n dispatch({type: 'input/focus'})\n }, [])\n\n // Change the value when `value` prop changes\n useEffect(() => {\n // If `valueProp` changed\n if (valueProp !== valuePropRef.current) {\n valuePropRef.current = valueProp\n\n if (valueProp !== undefined) {\n dispatch({type: 'value/change', value: valueProp})\n valueRef.current = valueProp\n }\n\n return\n }\n\n // If `valueProp` is not equal to `value`\n if (valueProp !== valueRef.current) {\n valueRef.current = valueProp || null\n\n dispatch({type: 'value/change', value: valueProp || null})\n }\n }, [valueProp])\n\n // Reset active item when closing\n useEffect(() => {\n if (!focused && valueRef.current) {\n dispatch({type: 'root/setActiveValue', value: valueRef.current})\n }\n }, [focused])\n\n // Focus the selected item\n useEffect(() => {\n const listElement = listBoxElementRef.current\n\n if (!listElement) return\n\n const activeOption = filteredOptions.find((o) => o.value === activeValue)\n\n if (activeOption) {\n const activeIndex = filteredOptions.indexOf(activeOption)\n // oxlint-disable-next-line no-unsafe-type-assertion\n const activeItemElement = listElement.childNodes[activeIndex] as HTMLLIElement | undefined\n\n if (activeItemElement) {\n if (_hasFocus(activeItemElement)) {\n // already focused\n return\n }\n\n focusFirstDescendant(activeItemElement)\n }\n }\n }, [activeValue, filteredOptions])\n\n const clearButton = useMemo(() => {\n if (!loading && !disabled && value) {\n return {\n 'aria-label': 'Clear',\n 'onFocus': handleClearButtonFocus,\n }\n }\n\n return undefined\n }, [disabled, handleClearButtonFocus, loading, value])\n\n const openButtonBoxPadding = padding.map((v) => {\n if (v === 0) return 0\n if (v === 1) return 1\n if (v === 2) return 1\n\n return v - 2\n })\n const openButtonPadding = padding.map((v) => Math.max(v - 1, 0))\n const openButtonProps: AutocompleteOpenButtonProps = useMemo(\n () => (typeof openButton === 'object' ? openButton : EMPTY_RECORD),\n [openButton],\n )\n\n const handleOpenClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n dispatchOpen()\n\n if (openButtonProps.onClick) openButtonProps.onClick(event)\n\n _raf(() => inputElementRef.current?.focus())\n },\n [openButtonProps, dispatchOpen],\n )\n\n const openButtonNode = useMemo(\n () =>\n !disabled && !readOnly && openButton ? (\n <Box aria-hidden={expanded} padding={openButtonBoxPadding}>\n <Button\n aria-label=\"Open\"\n disabled={expanded}\n fontSize={fontSize}\n icon={ChevronDownIcon}\n mode=\"bleed\"\n padding={openButtonPadding}\n {...openButtonProps}\n onClick={handleOpenClick}\n />\n </Box>\n ) : undefined,\n [\n disabled,\n expanded,\n fontSize,\n handleOpenClick,\n openButton,\n openButtonBoxPadding,\n openButtonPadding,\n openButtonProps,\n readOnly,\n ],\n )\n\n const inputValue = useMemo(() => {\n if (query === null) {\n if (value !== null) {\n return renderValue(value, currentOption)\n }\n\n return ''\n }\n\n return query\n }, [currentOption, query, renderValue, value])\n\n const handleListBoxKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n // If the focus is currently in the list, move focus to the input element\n if (event.key === 'Tab') {\n if (listFocused) inputElementRef.current?.focus()\n }\n },\n [listFocused],\n )\n\n const content = useMemo(() => {\n if (filteredOptions.length === 0) return null\n\n return (\n <ListBox\n data-ui=\"AutoComplete__results\"\n onKeyDown={handleListBoxKeyDown}\n padding={1}\n {...listBox}\n tabIndex={-1}\n >\n <Stack\n as=\"ul\"\n aria-multiselectable={false}\n data-ui=\"AutoComplete__resultsList\"\n id={listBoxId}\n ref={listBoxElementRef}\n // oxlint-disable-next-line prefer-tag-over-role\n role=\"listbox\"\n gap={1}\n >\n {filteredOptions.map((option) => {\n const active =\n activeValue !== null ? option.value === activeValue : currentOption === option\n\n return (\n <AutocompleteOption\n id={`${id}-option-${option.value}`}\n key={option.value}\n onSelect={handleOptionSelect}\n selected={active}\n value={option.value}\n >\n {cloneElement(renderOption(option), {\n disabled: loading,\n selected: active,\n tabIndex: listFocused && active ? 0 : -1,\n })}\n </AutocompleteOption>\n )\n })}\n </Stack>\n </ListBox>\n )\n }, [\n activeValue,\n currentOption,\n filteredOptions,\n handleOptionSelect,\n handleListBoxKeyDown,\n id,\n listBox,\n listBoxId,\n listFocused,\n loading,\n renderOption,\n ])\n\n const results = useMemo(() => {\n if (renderPopover) {\n return (\n <RenderPopover\n content={content}\n hidden={!expanded}\n inputElement={inputElement}\n onMouseEnter={handlePopoverMouseEnter}\n onMouseLeave={handlePopoverMouseLeave}\n resultsPopoverElementRef={resultsPopoverElementRef}\n renderPopover={renderPopover}\n />\n )\n }\n\n if (filteredOptionsLen === 0) {\n return null\n }\n\n return (\n <Popover\n arrow={false}\n constrainSize\n content={content}\n fallbackPlacements={AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS}\n matchReferenceWidth\n onMouseEnter={handlePopoverMouseEnter}\n onMouseLeave={handlePopoverMouseLeave}\n open={expanded}\n overflow=\"auto\"\n placement={AUTOCOMPLETE_POPOVER_PLACEMENT}\n portal\n radius={radius}\n ref={resultsPopoverElementRef}\n referenceElement={inputElement}\n {...popover}\n />\n )\n }, [\n content,\n expanded,\n filteredOptionsLen,\n handlePopoverMouseEnter,\n handlePopoverMouseLeave,\n inputElement,\n popover,\n radius,\n renderPopover,\n ])\n\n return (\n <StyledAutocomplete\n data-ui=\"Autocomplete\"\n onBlur={handleRootBlur}\n onFocus={handleRootFocus}\n onKeyDown={handleRootKeyDown}\n ref={rootElementRef}\n >\n <TextInput\n {...restProps}\n aria-activedescendant={activeItemId}\n aria-autocomplete=\"list\"\n aria-expanded={expanded}\n aria-owns={listBoxId}\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n border={border}\n clearButton={clearButton}\n customValidity={customValidity}\n disabled={disabled}\n fontSize={fontSize}\n icon={icon}\n iconRight={loading && AnimatedSpinnerIcon}\n id={id}\n inputMode=\"search\"\n onChange={handleInputChange}\n onClear={handleClearButtonClick}\n onFocus={handleInputFocus}\n padding={padding}\n prefix={prefix}\n radius={radius}\n readOnly={readOnly}\n ref={setInputElement}\n // oxlint-disable-next-line prefer-tag-over-role, role-has-required-aria-props\n role=\"combobox\"\n spellCheck={false}\n suffix={suffix || openButtonNode}\n value={inputValue}\n />\n {results}\n </StyledAutocomplete>\n )\n}\n\nfunction RenderPopover({\n renderPopover,\n content,\n hidden,\n inputElement,\n onMouseEnter,\n onMouseLeave,\n resultsPopoverElementRef,\n}: {\n renderPopover: Exclude<AutocompleteProps['renderPopover'], undefined>\n resultsPopoverElementRef: Parameters<Exclude<AutocompleteProps['renderPopover'], undefined>>[1]\n} & Parameters<Exclude<AutocompleteProps['renderPopover'], undefined>>[0]) {\n return renderPopover(\n {\n content,\n hidden,\n inputElement,\n onMouseEnter,\n onMouseLeave,\n },\n resultsPopoverElementRef,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAaI,qBAAqBF,OAAOG,IAAAA,WAAAA;;;AAAG,CAAA,CAAA,kBAO/BC,UAAUJ,OAAOC,GAAG,CAAC,CAAA,WAAA;;;iDAQ5BI,SAASN,SAAS,8DAaXO,sBAAsBN,OAAOF,WAAW,CAAC,CAAA,WAAA;;;AACvCO,CAAAA,CAAAA,aAAAA,OAAM;ACzBrB,SAAOa,mBAAAC,OAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GACL,EAAAX,UAAAG,IAAAC,UAAAE,UAAAC,UAAkDE,OAAKG;CAAA,AAAAF,EAAA,OAAAN,YAAAM,EAAA,OAAAH,SAEvBK,WAAA;EAG9BC,iBAAW;GACTT,SAASG,KAAK;EAAC,GACd,CAAC;CAAC,GACNG,EAAA,KAAAN,UAAAM,EAAA,KAAAH,OAAAG,EAAA,KAAAE,MAAAA,KAAAF,EAAA;CAND,IAAAI,cAAoBF,IAMCG;CA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oYwCC,KAAIC,IAAKtF,MAAI,GAAG,CAAC;AAAC;AApY1D,SAAAwD,MAAA+B,KAAA;CAgYkB,OAFjBvF,QAAM,IAAU,IAChBA,QAAM,KACNA,QAAM,IAAU,IAEbA,MAAI;AAAC;AA+NhB,SAASwF,cAAc,EACrB7L,eACAE,SACAC,QACAC,cACAE,cACAC,cACA2C,4BAIyE;CACzE,OAAOlD,cACL;EACEE;EACAC;EACAC;EACAE;EACAC;CACF,GACA2C,wBACF;AACF"}
|
package/dist/breadcrumbs.d.ts
CHANGED
|
@@ -13,6 +13,6 @@ interface BreadcrumbsProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* @beta
|
|
15
15
|
*/
|
|
16
|
-
declare
|
|
16
|
+
declare function Breadcrumbs(props: BreadcrumbsProps & Omit<React.HTMLProps<HTMLOListElement>, 'as' | 'type'>): import("react").JSX.Element;
|
|
17
17
|
export { Breadcrumbs, type BreadcrumbsProps };
|
|
18
18
|
//# sourceMappingURL=breadcrumbs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.d.ts","names":[],"sources":["../src/core/components/breadcrumbs/breadcrumbs.tsx"],"mappings":"AAaA;;;UAAiB;EACf;EACA,YAAY,MAAM;EAClB;;;;EAIA;;;;;
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","names":[],"sources":["../src/core/components/breadcrumbs/breadcrumbs.tsx"],"mappings":"AAaA;;;UAAiB;EACf;EACA,YAAY,MAAM;EAClB;;;;EAIA;;;;;iBAMc,YACd,OAAO,mBAAmB,KAAK,MAAM,UAAU,oDAAiC,IAAA"}
|
package/dist/breadcrumbs.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { n as _getArrayProp } from "./helpers-bwfx1e-Y.js";
|
|
3
3
|
import { y as Box } from "./useLayer-9Pz-GG0r.js";
|
|
4
4
|
import { n as Text, t as Stack } from "./stack-C5WV-BRh.js";
|
|
5
|
-
import { t as Button } from "./button-
|
|
6
|
-
import { t as Popover } from "./popover-
|
|
5
|
+
import { t as Button } from "./button-BDLRd1Rr.js";
|
|
6
|
+
import { t as Popover } from "./popover-DfXz9lUl.js";
|
|
7
7
|
import { t as useClickOutsideEvent } from "./useClickOutsideEvent-lEVhDFCQ.js";
|
|
8
8
|
import { c } from "react/compiler-runtime";
|
|
9
9
|
import { Children, Fragment, isValidElement, useRef, useState } from "react";
|
|
@@ -15,7 +15,11 @@ const StyledBreadcrumbs = styled.ol.withConfig({
|
|
|
15
15
|
})`margin:0;padding:0;display:flex;list-style:none;align-items:center;white-space:nowrap;line-height:0;`, ExpandButton = styled(Button).withConfig({
|
|
16
16
|
displayName: "ExpandButton",
|
|
17
17
|
componentId: "sc-s3y9xo-1"
|
|
18
|
-
})`appearance:none;margin:-4px
|
|
18
|
+
})`appearance:none;margin:-4px;`;
|
|
19
|
+
/**
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
function Breadcrumbs(props) {
|
|
19
23
|
let $ = c(30), children, maxLength, ref, restProps, separator, t0;
|
|
20
24
|
$[0] === props ? (children = $[1], maxLength = $[2], ref = $[3], restProps = $[4], separator = $[5], t0 = $[6]) : ({children, gap: t0, maxLength, ref, separator, ...restProps} = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = ref, $[4] = restProps, $[5] = separator, $[6] = t0);
|
|
21
25
|
let gap = t0 === void 0 ? 2 : t0, t1;
|
|
@@ -62,7 +66,7 @@ const StyledBreadcrumbs = styled.ol.withConfig({
|
|
|
62
66
|
ref,
|
|
63
67
|
children: t7
|
|
64
68
|
}), $[26] = ref, $[27] = restProps, $[28] = t7, $[29] = t8) : t8 = $[29], t8;
|
|
65
|
-
}
|
|
69
|
+
}
|
|
66
70
|
function useItems(t0) {
|
|
67
71
|
let $ = c(28), { collapse, expand, expandElementRef, maxLength, open, popoverElementRef, rawItems, space } = t0, len = rawItems.length;
|
|
68
72
|
if (maxLength && len > maxLength) {
|
package/dist/breadcrumbs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","names":["styled","Button","StyledBreadcrumbs","ol","ExpandButton","Children","Fragment","isValidElement","useCallback","useMemo","useRef","useState","useClickOutsideEvent","Box","Popover","Stack","Text","_getArrayProp","ExpandButton","StyledBreadcrumbs","BreadcrumbsProps","maxLength","separator","React","ReactNode","gap","space","Breadcrumbs","props","$","_c","children","ref","restProps","t0","undefined","t1","open","setOpen","expandElementRef","popoverElementRef","t2","Symbol","for","collapse","t3","expand","t4","current","t5","toArray","filter","rawItems","t6","items","useItems","t7","t8","item","itemIndex","map","len","length","beforeLength","Math","ceil","afterLength","floor","slice"],"sources":["../src/core/components/breadcrumbs/breadcrumbs.styles.ts","../src/core/components/breadcrumbs/breadcrumbs.tsx"],"sourcesContent":["import {styled} from 'styled-components'\n\nimport {Button} from '../../primitives/button/button'\n\nexport const StyledBreadcrumbs = styled.ol`\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n`\n\nexport const ExpandButton = styled(Button)`\n appearance: none;\n margin: -4px;\n`\n","import {Children, Fragment, isValidElement, useCallback, useMemo, useRef, useState} from 'react'\n\nimport {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'\nimport {Box} from '../../primitives/box/box'\nimport {Popover} from '../../primitives/popover/popover'\nimport {Stack} from '../../primitives/stack/stack'\nimport {Text} from '../../primitives/text/text'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {ExpandButton, StyledBreadcrumbs} from './breadcrumbs.styles'\n\n/**\n * @beta\n */\nexport interface BreadcrumbsProps {\n maxLength?: number\n separator?: React.ReactNode\n gap?: number | number[]\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n}\n\n/**\n * @beta\n */\nexport
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","names":["styled","Button","StyledBreadcrumbs","ol","ExpandButton","Children","Fragment","isValidElement","useCallback","useMemo","useRef","useState","useClickOutsideEvent","Box","Popover","Stack","Text","_getArrayProp","ExpandButton","StyledBreadcrumbs","BreadcrumbsProps","maxLength","separator","React","ReactNode","gap","space","Breadcrumbs","props","$","_c","children","ref","restProps","t0","undefined","t1","open","setOpen","expandElementRef","popoverElementRef","t2","Symbol","for","collapse","t3","expand","t4","current","t5","toArray","filter","rawItems","t6","items","useItems","t7","t8","item","itemIndex","map","len","length","beforeLength","Math","ceil","afterLength","floor","slice"],"sources":["../src/core/components/breadcrumbs/breadcrumbs.styles.ts","../src/core/components/breadcrumbs/breadcrumbs.tsx"],"sourcesContent":["import {styled} from 'styled-components'\n\nimport {Button} from '../../primitives/button/button'\n\nexport const StyledBreadcrumbs = styled.ol`\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n`\n\nexport const ExpandButton = styled(Button)`\n appearance: none;\n margin: -4px;\n`\n","import {Children, Fragment, isValidElement, useCallback, useMemo, useRef, useState} from 'react'\n\nimport {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'\nimport {Box} from '../../primitives/box/box'\nimport {Popover} from '../../primitives/popover/popover'\nimport {Stack} from '../../primitives/stack/stack'\nimport {Text} from '../../primitives/text/text'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {ExpandButton, StyledBreadcrumbs} from './breadcrumbs.styles'\n\n/**\n * @beta\n */\nexport interface BreadcrumbsProps {\n maxLength?: number\n separator?: React.ReactNode\n gap?: number | number[]\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n}\n\n/**\n * @beta\n */\nexport function Breadcrumbs(\n props: BreadcrumbsProps & Omit<React.HTMLProps<HTMLOListElement>, 'as' | 'type'>,\n) {\n const {children, gap = 2, maxLength, ref, separator, ...restProps} = props\n const space = _getArrayProp(gap)\n const [open, setOpen] = useState(false)\n const expandElementRef = useRef<HTMLButtonElement | null>(null)\n const popoverElementRef = useRef<HTMLDivElement | null>(null)\n\n const collapse = useCallback(() => setOpen(false), [])\n const expand = useCallback(() => setOpen(true), [])\n\n useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current])\n\n const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children])\n\n const items = useItems({\n collapse,\n expand,\n expandElementRef,\n maxLength,\n open,\n popoverElementRef,\n rawItems,\n space,\n })\n\n return (\n <StyledBreadcrumbs data-ui=\"Breadcrumbs\" {...restProps} ref={ref}>\n {items.map((item, itemIndex) => (\n // oxlint-disable-next-line no-array-index-key\n <Fragment key={itemIndex}>\n {itemIndex > 0 && (\n <Box aria-hidden as=\"li\" paddingX={space}>\n {separator || <Text muted>/</Text>}\n </Box>\n )}\n <Box as=\"li\">{item}</Box>\n </Fragment>\n ))}\n </StyledBreadcrumbs>\n )\n}\n\nfunction useItems({\n collapse,\n expand,\n expandElementRef,\n maxLength,\n open,\n popoverElementRef,\n rawItems,\n space,\n}: {\n collapse: () => void\n expand: () => void\n expandElementRef: React.RefObject<HTMLButtonElement | null>\n maxLength: number | undefined\n open: boolean\n popoverElementRef: React.RefObject<HTMLDivElement | null>\n // oxlint-disable-next-line no-unnecessary-type-arguments\n rawItems: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[]\n space: number[]\n}) {\n const len = rawItems.length\n\n if (maxLength && len > maxLength) {\n const beforeLength = Math.ceil(maxLength / 2)\n const afterLength = Math.floor(maxLength / 2)\n\n return [\n ...rawItems.slice(0, beforeLength - 1),\n <Popover\n constrainSize\n content={\n <Stack as=\"ol\" overflow=\"auto\" padding={space} gap={space}>\n {rawItems.slice(beforeLength - 1, len - afterLength)}\n </Stack>\n }\n key=\"button\"\n open={open}\n placement=\"top\"\n portal\n ref={popoverElementRef}\n >\n <ExpandButton\n fontSize={1}\n mode=\"bleed\"\n onClick={open ? collapse : expand}\n padding={1}\n ref={expandElementRef}\n selected={open}\n text=\"…\"\n />\n </Popover>,\n ...rawItems.slice(len - afterLength),\n ]\n }\n\n return rawItems\n}\n"],"mappings":";;;;;;;;;;;AAIA,MAAaE,o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,QAAAjB,EAAA,KAAAU,kBAAAV,EAAA,KAAAgC,KAAAhC,EAAA,KAAAQ,MAAAR,EAAA,KAAAW,mBAAAX,EAAA,KAAAuB,UAAAvB,EAAA,KAAAH,OAAAG,EAAA,MAAAO;EAAA,OAAAA,KAAAP,EAAA;EAAA,OA1BMO;CA0BN;CACF,OAEMgB;AAAQ"}
|
|
@@ -15,7 +15,7 @@ var spinnerIcon = "_1b6o2se1";
|
|
|
15
15
|
*
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
function Spinner(props) {
|
|
19
19
|
let $ = c(3), t0;
|
|
20
20
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(SpinnerIcon, { className: spinnerIcon }), $[0] = t0) : t0 = $[0];
|
|
21
21
|
let t1;
|
|
@@ -24,7 +24,7 @@ const Spinner = function Spinner(props) {
|
|
|
24
24
|
...props,
|
|
25
25
|
children: t0
|
|
26
26
|
}), $[1] = props, $[2] = t1), t1;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
/**
|
|
29
29
|
* @internal
|
|
30
30
|
*/
|
|
@@ -171,4 +171,4 @@ const StyledButton = /* @__PURE__ */ styled.button.withConfig({
|
|
|
171
171
|
};
|
|
172
172
|
export { Spinner as n, Button as t };
|
|
173
173
|
|
|
174
|
-
//# sourceMappingURL=button-
|
|
174
|
+
//# sourceMappingURL=button-BDLRd1Rr.js.map
|