@tamagui/select 3.0.0-beta.924.1 → 3.0.0
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/cjs/Select.cjs +23 -25
- package/dist/cjs/Select.native.cjs +27 -26
- package/dist/cjs/Select.native.js +27 -26
- package/dist/cjs/Select.native.js.map +1 -1
- package/dist/cjs/SelectImpl.cjs +56 -50
- package/dist/cjs/SelectItem.cjs +49 -60
- package/dist/cjs/SelectItem.native.cjs +51 -79
- package/dist/cjs/SelectItem.native.js +51 -79
- package/dist/cjs/SelectItem.native.js.map +1 -1
- package/dist/cjs/SelectScrollButton.cjs +2 -2
- package/dist/cjs/SelectTrigger.cjs +22 -5
- package/dist/cjs/SelectTrigger.native.cjs +15 -5
- package/dist/cjs/SelectTrigger.native.js +15 -5
- package/dist/cjs/SelectTrigger.native.js.map +1 -1
- package/dist/cjs/SelectViewport.cjs +22 -30
- package/dist/cjs/SelectViewport.native.cjs +2 -2
- package/dist/cjs/SelectViewport.native.js +2 -2
- package/dist/cjs/SelectViewport.native.js.map +1 -1
- package/dist/cjs/selectionController.cjs +15 -5
- package/dist/cjs/selectionController.native.cjs +20 -15
- package/dist/cjs/selectionController.native.js +20 -15
- package/dist/cjs/selectionController.native.js.map +1 -1
- package/dist/esm/Select.mjs +27 -28
- package/dist/esm/Select.mjs.map +1 -1
- package/dist/esm/Select.native.js +31 -29
- package/dist/esm/Select.native.js.map +1 -1
- package/dist/esm/SelectImpl.mjs +56 -50
- package/dist/esm/SelectImpl.mjs.map +1 -1
- package/dist/esm/SelectItem.mjs +50 -61
- package/dist/esm/SelectItem.mjs.map +1 -1
- package/dist/esm/SelectItem.native.js +52 -80
- package/dist/esm/SelectItem.native.js.map +1 -1
- package/dist/esm/SelectScrollButton.mjs +2 -2
- package/dist/esm/SelectScrollButton.mjs.map +1 -1
- package/dist/esm/SelectTrigger.mjs +16 -5
- package/dist/esm/SelectTrigger.mjs.map +1 -1
- package/dist/esm/SelectTrigger.native.js +15 -4
- package/dist/esm/SelectTrigger.native.js.map +1 -1
- package/dist/esm/SelectViewport.mjs +22 -30
- package/dist/esm/SelectViewport.mjs.map +1 -1
- package/dist/esm/SelectViewport.native.js +3 -3
- package/dist/esm/SelectViewport.native.js.map +1 -1
- package/dist/esm/selectionController.mjs +15 -5
- package/dist/esm/selectionController.mjs.map +1 -1
- package/dist/esm/selectionController.native.js +20 -15
- package/dist/esm/selectionController.native.js.map +1 -1
- package/dist/jsx/Select.mjs +27 -28
- package/dist/jsx/Select.mjs.map +1 -1
- package/dist/jsx/Select.native.cjs +27 -26
- package/dist/jsx/Select.native.js +27 -26
- package/dist/jsx/Select.native.js.map +1 -1
- package/dist/jsx/SelectImpl.mjs +56 -50
- package/dist/jsx/SelectImpl.mjs.map +1 -1
- package/dist/jsx/SelectItem.mjs +50 -61
- package/dist/jsx/SelectItem.mjs.map +1 -1
- package/dist/jsx/SelectItem.native.cjs +51 -79
- package/dist/jsx/SelectItem.native.js +51 -79
- package/dist/jsx/SelectItem.native.js.map +1 -1
- package/dist/jsx/SelectScrollButton.mjs +2 -2
- package/dist/jsx/SelectScrollButton.mjs.map +1 -1
- package/dist/jsx/SelectTrigger.mjs +16 -5
- package/dist/jsx/SelectTrigger.mjs.map +1 -1
- package/dist/jsx/SelectTrigger.native.cjs +15 -5
- package/dist/jsx/SelectTrigger.native.js +15 -5
- package/dist/jsx/SelectTrigger.native.js.map +1 -1
- package/dist/jsx/SelectViewport.mjs +22 -30
- package/dist/jsx/SelectViewport.mjs.map +1 -1
- package/dist/jsx/SelectViewport.native.cjs +2 -2
- package/dist/jsx/SelectViewport.native.js +2 -2
- package/dist/jsx/SelectViewport.native.js.map +1 -1
- package/dist/jsx/selectionController.mjs +15 -5
- package/dist/jsx/selectionController.mjs.map +1 -1
- package/dist/jsx/selectionController.native.cjs +20 -15
- package/dist/jsx/selectionController.native.js +20 -15
- package/dist/jsx/selectionController.native.js.map +1 -1
- package/package.json +30 -29
- package/src/Select.tsx +41 -41
- package/src/SelectImpl.tsx +83 -81
- package/src/SelectItem.tsx +66 -91
- package/src/SelectScrollButton.tsx +2 -2
- package/src/SelectTrigger.tsx +19 -2
- package/src/SelectViewport.native.tsx +4 -4
- package/src/SelectViewport.tsx +21 -27
- package/src/selectionController.ts +20 -5
- package/src/types.tsx +26 -21
- package/types/Select.d.ts +42 -81
- package/types/Select.d.ts.map +1 -1
- package/types/SelectImpl.d.ts.map +1 -1
- package/types/SelectItem.d.ts +3 -5
- package/types/SelectItem.d.ts.map +1 -1
- package/types/SelectItemText.d.ts +3 -5
- package/types/SelectItemText.d.ts.map +1 -1
- package/types/SelectScrollButton.d.ts +5 -9
- package/types/SelectScrollButton.d.ts.map +1 -1
- package/types/SelectScrollButton.native.d.ts +5 -9
- package/types/SelectScrollButton.native.d.ts.map +1 -1
- package/types/SelectTrigger.d.ts +3 -5
- package/types/SelectTrigger.d.ts.map +1 -1
- package/types/SelectViewport.d.ts +4 -9
- package/types/SelectViewport.d.ts.map +1 -1
- package/types/SelectViewport.native.d.ts +4 -9
- package/types/SelectViewport.native.d.ts.map +1 -1
- package/types/selectionController.d.ts +2 -0
- package/types/selectionController.d.ts.map +1 -1
- package/types/types.d.ts +30 -21
- package/types/types.d.ts.map +1 -1
package/dist/esm/Select.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":[],"sources":["esm/Select.js"],"sourcesContent":["import { Adapt, AdaptParent, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { Text, View, createChangeEventDetails, createStyledContext, createStyledHOC, styled } from \"@tamagui/core\";\nimport { FocusScopeController } from \"@tamagui/focus-scope\";\nimport { withStaticProperties } from \"@tamagui/helpers\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SelectItemParentProvider, SelectNativeComponentContext, SelectProvider, SelectZIndexContext, useSelectContext, useSelectItemParentContext } from \"./context\";\nimport { SelectContent } from \"./SelectContent\";\nimport { SelectInlineImpl } from \"./SelectImpl\";\nimport { SelectItem, useSelectItemContext } from \"./SelectItem\";\nimport { SelectItemText } from \"./SelectItemText\";\nimport { SelectScrollDownButton, SelectScrollUpButton } from \"./SelectScrollButton\";\nimport { SelectTrigger } from \"./SelectTrigger\";\nimport { SelectViewport } from \"./SelectViewport\";\nimport { createSelectItemRegistry, createSelectSelectionController, selectedValuesFromSelection } from \"./selectionController\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\n\nconst SelectValueFrame = styled(Text, { displayName: \"SelectValue\" });\nconst SelectValue = createStyledHOC(SelectValueFrame, function SelectValue2({ scope, children: childrenProp, placeholder, ...props }, forwardedRef) {\n\tconst context = useSelectContext(scope);\n\tconst itemParentContext = useSelectItemParentContext(scope);\n\tconst composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n\tconst isEmptyValue = context.selectedValues.length === 0;\n\tconst registeredValue = context.mode === \"multiple\" ? context.selectedValues.map((value, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 ? \", \" : null, itemParentContext.registry.getItem(value)?.label ?? value] }, value)) : itemParentContext.registry.getItem(context.selectedValues[0])?.label ?? context.value;\n\tconst children = childrenProp !== void 0 ? childrenProp : context.renderValue ? context.renderValue(context.value) : registeredValue;\n\tconst selectValueChildren = isEmptyValue ? placeholder ?? children : children;\n\treturn /* @__PURE__ */ jsx(SelectValueFrame, {\n\t\tpointerEvents: \"none\",\n\t\tref: composedRefs,\n\t\t...props,\n\t\tchildren: selectValueChildren\n\t});\n});\nconst SelectIcon = styled(View, {\n\tdisplayName: \"SelectIcon\",\n\t\"aria-hidden\": true\n});\nconst SelectItemIndicatorFrame = styled(View, { displayName: \"SelectItemIndicator\" });\nconst SelectItemIndicator = createStyledHOC(SelectItemIndicatorFrame, function SelectItemIndicator2(props, forwardedRef) {\n\tconst { scope, ...itemIndicatorProps } = props;\n\tconst context = useSelectItemParentContext(scope);\n\tconst itemContext = useSelectItemContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn itemContext.isSelected ? /* @__PURE__ */ jsx(SelectItemIndicatorFrame, {\n\t\t\"aria-hidden\": true,\n\t\t...itemIndicatorProps,\n\t\tref: forwardedRef\n\t}) : null;\n});\nconst SelectIndicatorFrame = styled(View, {\n\tdisplayName: \"SelectIndicator\",\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tpointerEvents: \"none\",\n\tzIndex: 10\n});\nconst SelectIndicator = createStyledHOC(SelectIndicatorFrame, function SelectIndicator2({ scope, ...props }, forwardedRef) {\n\tconst itemContext = useSelectItemParentContext(scope);\n\tconst context = useSelectContext(scope);\n\tconst [layout, setLayout] = React.useState(null);\n\tconst rafRef = React.useRef(0);\n\tReact.useLayoutEffect(() => {\n\t\tconst update = (index) => {\n\t\t\tif (typeof index !== \"number\") return;\n\t\t\tcancelAnimationFrame(rafRef.current);\n\t\t\trafRef.current = requestAnimationFrame(() => {\n\t\t\t\tconst node = itemContext.listRef?.current?.[index];\n\t\t\t\tif (node) setLayout({\n\t\t\t\t\twidth: Math.round(node.offsetWidth),\n\t\t\t\t\theight: Math.round(node.offsetHeight),\n\t\t\t\t\tx: Math.round(node.offsetLeft),\n\t\t\t\t\ty: Math.round(node.offsetTop)\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\tif (context.open && context.activeIndexRef.current !== null) update(context.activeIndexRef.current);\n\t\treturn itemContext.activeIndexSubscribe(update);\n\t}, [context.open, itemContext.listRef]);\n\tif (!layout) return null;\n\treturn /* @__PURE__ */ jsx(SelectIndicatorFrame, {\n\t\tref: forwardedRef,\n\t\t...props,\n\t\twidth: layout.width,\n\t\theight: layout.height,\n\t\tx: layout.x,\n\t\ty: layout.y\n\t});\n});\nconst GROUP_NAME = \"SelectGroup\";\nconst { Provider: SelectGroupContextProvider, useStyledContext: useSelectGroupContext } = createStyledContext({ id: \"\" }, \"SelectGroup\");\nconst SelectGroupFrame = styled(View, { displayName: GROUP_NAME });\nconst NativeSelect = styled(Text, {\n\tdisplayName: \"NativeSelect\",\n\trender: \"select\"\n});\nconst SelectGroup = createStyledHOC(SelectGroupFrame, (props, forwardedRef) => {\n\tconst { scope, ...groupProps } = props;\n\tconst groupId = React.useId();\n\tconst context = useSelectContext(scope);\n\tconst itemParentContext = useSelectItemParentContext(scope);\n\tconst StyledNativeSelect = React.useContext(SelectNativeComponentContext);\n\tconst nativeSelectRef = React.useRef(null);\n\tconst content = (() => {\n\t\tif (itemParentContext.shouldRenderWebNative) return /* @__PURE__ */ jsx(NativeSelect, {\n\t\t\t...StyledNativeSelect && {\n\t\t\t\trender: StyledNativeSelect,\n\t\t\t\tsize: itemParentContext.size,\n\t\t\t\tstyle: { appearance: \"none\" }\n\t\t\t},\n\t\t\t...groupProps,\n\t\t\tvalue: context.value,\n\t\t\tmultiple: context.mode === \"multiple\",\n\t\t\tname: itemParentContext.name,\n\t\t\tform: itemParentContext.form,\n\t\t\tid: itemParentContext.id,\n\t\t\tonChange: ((event) => {\n\t\t\t\tconst value = context.mode === \"multiple\" ? Array.from(event.currentTarget.selectedOptions, (option) => option.value) : event.currentTarget.value;\n\t\t\t\titemParentContext.changeNativeValue(value, event.nativeEvent);\n\t\t\t}),\n\t\t\tref: nativeSelectRef,\n\t\t\tchildren: props.children\n\t\t});\n\t\treturn /* @__PURE__ */ jsx(SelectGroupFrame, {\n\t\t\trole: \"group\",\n\t\t\t\"aria-labelledby\": groupId,\n\t\t\t...groupProps,\n\t\t\tref: forwardedRef\n\t\t});\n\t})();\n\treturn /* @__PURE__ */ jsx(SelectGroupContextProvider, {\n\t\tscope,\n\t\tid: groupId || \"\",\n\t\tchildren: content\n\t});\n});\nSelectGroup.displayName = GROUP_NAME;\nconst SelectLabelFrame = styled(Text, { displayName: \"SelectLabel\" });\nconst SelectLabel = createStyledHOC(SelectLabelFrame, (props, forwardedRef) => {\n\tconst { scope, ...labelProps } = props;\n\tconst context = useSelectItemParentContext(scope);\n\tconst groupContext = useSelectGroupContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn /* @__PURE__ */ jsx(SelectLabelFrame, {\n\t\trender: \"div\",\n\t\tid: groupContext.id,\n\t\t...labelProps,\n\t\tref: forwardedRef\n\t});\n});\nconst SelectSeparator = styled(View, { displayName: \"SelectSeparator\" });\nconst SelectSheetImpl = (props) => {\n\treturn /* @__PURE__ */ jsx(Fragment, { children: props.children });\n};\nfunction SelectRoot(props) {\n\tconst adaptScope = `AdaptSelect${props.scope || \"\"}`;\n\tconst [open, requestOpenChange] = useControllableState({\n\t\tprop: props.open,\n\t\tdefaultProp: props.defaultOpen || false,\n\t\tonChange: props.onOpenChange\n\t});\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\topen,\n\t\tonOpenChange: React.useCallback((nextOpen) => {\n\t\t\trequestOpenChange(nextOpen, createChangeEventDetails(nextOpen ? \"trigger-press\" : \"outside-press\"));\n\t\t}, [requestOpenChange]),\n\t\tchildren: /* @__PURE__ */ jsx(SelectInner, {\n\t\t\t...props,\n\t\t\tscope: props.scope,\n\t\t\tadaptScope,\n\t\t\topen,\n\t\t\trequestOpenChange\n\t\t})\n\t});\n}\nconst Select = withStaticProperties(SelectRoot, {\n\tRoot: SelectRoot,\n\tAdapt,\n\tContent: SelectContent,\n\tGroup: SelectGroup,\n\tIcon: SelectIcon,\n\tItem: SelectItem,\n\tItemIndicator: SelectItemIndicator,\n\tItemText: SelectItemText,\n\tLabel: SelectLabel,\n\tScrollDownButton: SelectScrollDownButton,\n\tScrollUpButton: SelectScrollUpButton,\n\tSeparator: SelectSeparator,\n\tTrigger: SelectTrigger,\n\tValue: SelectValue,\n\tViewport: SelectViewport,\n\tIndicator: SelectIndicator,\n\tFocusScope: FocusScopeController\n});\nfunction useEmitter() {\n\tconst listenersRef = React.useRef(/* @__PURE__ */ new Set());\n\treturn [React.useCallback((value) => {\n\t\tlistenersRef.current.forEach((l) => l(value));\n\t}, []), React.useCallback((listener) => {\n\t\tlistenersRef.current.add(listener);\n\t\treturn () => {\n\t\t\tlistenersRef.current.delete(listener);\n\t\t};\n\t}, [])];\n}\nfunction SelectInner(props) {\n\tconst { scope = \"\", adaptScope, native, children, open, requestOpenChange, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, value: valueProp, defaultValue, onValueChange, multiple = false, name, form, disablePreventBodyScroll, size: sizeProp = true, onActiveChange, dir, id, renderValue, lazyMount, zIndex } = props;\n\tconst SelectImpl = useAdaptIsActive(adaptScope) ? SelectSheetImpl : SelectInlineImpl;\n\tconst mode = multiple ? \"multiple\" : \"single\";\n\tconst [valueState, requestValueChange] = useControllableState({\n\t\tprop: valueProp,\n\t\tdefaultProp: defaultValue ?? (mode === \"multiple\" ? [] : \"\"),\n\t\tonChange: onValueChange,\n\t\ttransition: true\n\t});\n\tconst value = React.useMemo(() => mode === \"multiple\" ? selectedValuesFromSelection(mode, valueState) : typeof valueState === \"string\" ? valueState : \"\", [mode, valueState]);\n\tconst selectedValues = React.useMemo(() => selectedValuesFromSelection(mode, value), [mode, value]);\n\tconst [, rerenderRegistry] = React.useReducer((version) => version + 1, 0);\n\tconst registryRef = React.useRef(null);\n\tif (!registryRef.current) registryRef.current = createSelectItemRegistry(rerenderRegistry);\n\tconst registry = registryRef.current;\n\tconst controllerRef = React.useRef(null);\n\tif (!controllerRef.current) controllerRef.current = createSelectSelectionController({\n\t\tmode,\n\t\tvalue,\n\t\tregistry\n\t});\n\tconst controller = controllerRef.current;\n\tcontroller.setMode(mode);\n\tcontroller.setValue(value);\n\tReact.useEffect(() => {}, [props.id, requestOpenChange]);\n\tconst activeIndexRef = React.useRef(null);\n\tconst [activeIndex, setActiveIndexState] = React.useState(null);\n\tconst [emitActiveIndex, activeIndexSubscribe] = useEmitter();\n\tconst selectedIndexRef = React.useRef(null);\n\tconst listContentRef = React.useRef([]);\n\tconst listRef = React.useRef([]);\n\tconst [valueNode, setValueNode] = React.useState(null);\n\tconst selectedIndex = Math.max(0, controller.selectionAnchorIndex());\n\tlistContentRef.current = registry.getTypeaheadLabels();\n\tlistRef.current.length = registry.getItems().length;\n\tuseIsomorphicLayoutEffect(() => {\n\t\tselectedIndexRef.current = selectedIndex;\n\t});\n\tconst shouldRenderWebNative = isWeb && (native === true || native === \"web\" || Array.isArray(native) && native.includes(\"web\"));\n\tconst setActiveIndexFast = React.useCallback((index, details) => {\n\t\tif (activeIndexRef.current !== index) {\n\t\t\tactiveIndexRef.current = index;\n\t\t\tcontroller.setActiveIndex(index);\n\t\t\tif (typeof index === \"number\") {\n\t\t\t\temitActiveIndex(index);\n\t\t\t\tconst item = registry.getItems()[index];\n\t\t\t\tif (item && details) onActiveChange?.(item.value, details);\n\t\t\t}\n\t\t}\n\t}, [\n\t\tcontroller,\n\t\temitActiveIndex,\n\t\tonActiveChange,\n\t\tregistry\n\t]);\n\tconst setActiveIndex = React.useCallback((index, details) => {\n\t\tsetActiveIndexFast(index, details);\n\t\tsetActiveIndexState(index);\n\t}, [setActiveIndexFast]);\n\tconst activeDetails = React.useCallback((reason, index, event) => ({\n\t\treason,\n\t\tevent,\n\t\ttrigger: void 0,\n\t\tindex\n\t}), []);\n\tconst moveActive = React.useCallback((direction, event) => {\n\t\tconst nextIndex = registry.nextEnabledIndex(activeIndexRef.current, direction);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tconst typeaheadRef = React.useRef({\n\t\ttext: \"\",\n\t\ttimeout: null\n\t});\n\tconst search = React.useCallback((text, event) => {\n\t\tclearTimeout(typeaheadRef.current.timeout);\n\t\ttypeaheadRef.current.text += text;\n\t\tlet nextIndex = registry.findTypeaheadIndex(typeaheadRef.current.text, activeIndexRef.current);\n\t\tif (nextIndex < 0 && typeaheadRef.current.text.length > 1) {\n\t\t\ttypeaheadRef.current.text = text;\n\t\t\tnextIndex = registry.findTypeaheadIndex(text, activeIndexRef.current);\n\t\t}\n\t\ttypeaheadRef.current.timeout = setTimeout(() => {\n\t\t\ttypeaheadRef.current.text = \"\";\n\t\t}, 750);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tReact.useEffect(() => {\n\t\treturn () => clearTimeout(typeaheadRef.current.timeout);\n\t}, []);\n\tReact.useEffect(() => {\n\t\tif (open) {\n\t\t\tconst nextIndex = controller.initialActiveIndex();\n\t\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"list-navigation\", nextIndex));\n\t\t} else {\n\t\t\tsetActiveIndexFast(null);\n\t\t\tsetActiveIndexState(null);\n\t\t}\n\t}, [\n\t\topen,\n\t\tselectedIndex,\n\t\tregistry.getItems().length\n\t]);\n\tconst content = /* @__PURE__ */ jsxs(SelectItemParentProvider, {\n\t\tscopeName: scope,\n\t\tscope,\n\t\tadaptScope,\n\t\tmode,\n\t\tselectedValues,\n\t\tregistry,\n\t\tsize: sizeProp,\n\t\tactiveIndexSubscribe,\n\t\tactiveIndexRef,\n\t\trequestOpenChange,\n\t\tid,\n\t\tname,\n\t\tform,\n\t\tselectValue: React.useCallback((nextItemValue, details) => {\n\t\t\tconst item = registry.getItem(nextItemValue);\n\t\t\tif (!item || item.disabled) return;\n\t\t\tcontroller.setMode(mode);\n\t\t\tcontroller.setValue(value);\n\t\t\tconst previousValue = controller.value;\n\t\t\trequestValueChange(controller.toggle(nextItemValue), details);\n\t\t\tif (details.isCanceled) {\n\t\t\t\tcontroller.setValue(previousValue);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (controller.shouldCloseOnSelect) requestOpenChange(false, createChangeEventDetails(details.reason === \"keyboard\" ? \"keyboard\" : \"item-press\", details.event, details.trigger));\n\t\t}, [\n\t\t\tcontroller,\n\t\t\tmode,\n\t\t\tregistry,\n\t\t\trequestOpenChange,\n\t\t\trequestValueChange,\n\t\t\tvalue\n\t\t]),\n\t\tchangeNativeValue: React.useCallback((nextValue, event) => {\n\t\t\tconst details = createChangeEventDetails(\"native-change\", event);\n\t\t\trequestValueChange(nextValue, details);\n\t\t\tif (!details.isCanceled) controller.setValue(nextValue);\n\t\t}, [controller, requestValueChange]),\n\t\tshouldRenderWebNative,\n\t\tsetActiveIndexFast,\n\t\tlistRef,\n\t\tmoveActive,\n\t\tsearch,\n\t\tchildren: [/* @__PURE__ */ jsx(SelectProvider, {\n\t\t\tscope,\n\t\t\tscopeName: scope,\n\t\t\tadaptScope,\n\t\t\tdisablePreventBodyScroll,\n\t\t\tdir,\n\t\t\tblockSelection: false,\n\t\t\tfallback: false,\n\t\t\tvalueNode,\n\t\t\tonValueNodeChange: setValueNode,\n\t\t\tactiveIndex,\n\t\t\tactiveIndexRef,\n\t\t\tselectedIndex,\n\t\t\tsetActiveIndex,\n\t\t\tvalue,\n\t\t\tmode,\n\t\t\tselectedValues,\n\t\t\tactiveItem: activeIndex == null ? void 0 : registry.getItems()[activeIndex]?.value,\n\t\t\tselectionAnchor: controller.selectionAnchor()?.value,\n\t\t\topen,\n\t\t\tnative,\n\t\t\trenderValue,\n\t\t\tlazyMount,\n\t\t\tchildren: shouldRenderWebNative ? children : /* @__PURE__ */ jsx(SelectImpl, {\n\t\t\t\tactiveIndexRef,\n\t\t\t\tlistContentRef,\n\t\t\t\tselectedIndexRef,\n\t\t\t\tsetActiveIndexFast,\n\t\t\t\t...props,\n\t\t\t\topen,\n\t\t\t\tvalue,\n\t\t\t\tchildren\n\t\t\t})\n\t\t}), isWeb && !shouldRenderWebNative && name ? (mode === \"multiple\" ? selectedValues : [value]).map((inputValue) => /* @__PURE__ */ jsx(\"input\", {\n\t\t\ttype: \"hidden\",\n\t\t\tname,\n\t\t\tform,\n\t\t\tvalue: inputValue\n\t\t}, inputValue)) : null]\n\t});\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(SelectZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: content\n\t});\n\treturn content;\n}\n\nexport { Select, SelectGroup, SelectGroupFrame, SelectIcon, SelectIndicator, SelectIndicatorFrame, SelectItemIndicator, SelectItemIndicatorFrame, SelectLabel, SelectLabelFrame, SelectRoot, SelectSeparator, SelectValue, SelectValueFrame };"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,mBAAmB,OAAO,MAAM,EAAE,aAAa,cAAc,CAAC;AACpE,MAAM,cAAc,gBAAgB,kBAAkB,SAAS,aAAa,EAAE,OAAO,UAAU,cAAc,aAAa,GAAG,SAAS,cAAc;CACnJ,MAAM,UAAU,iBAAiB,KAAK;CACtC,MAAM,oBAAoB,2BAA2B,KAAK;CAC1D,MAAM,eAAe,gBAAgB,cAAc,QAAQ,iBAAiB;CAC5E,MAAM,eAAe,QAAQ,eAAe,WAAW;CACvD,MAAM,kBAAkB,QAAQ,SAAS,aAAa,QAAQ,eAAe,KAAK,OAAO,UAA0B,qBAAK,MAAM,UAAU,EAAE,UAAU,CAAC,QAAQ,IAAI,OAAO,MAAM,kBAAkB,SAAS,QAAQ,KAAK,CAAC,EAAE,SAAS,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,kBAAkB,SAAS,QAAQ,QAAQ,eAAe,EAAE,CAAC,EAAE,SAAS,QAAQ;CACtU,MAAM,WAAW,iBAAiB,KAAK,IAAI,eAAe,QAAQ,cAAc,QAAQ,YAAY,QAAQ,KAAK,IAAI;CACrH,MAAM,sBAAsB,eAAe,eAAe,WAAW;CACrE,OAAuB,oBAAI,kBAAkB;EAC5C,eAAe;EACf,KAAK;EACL,GAAG;EACH,UAAU;CACX,CAAC;AACF,CAAC;AACD,MAAM,aAAa,OAAO,MAAM;CAC/B,aAAa;CACb,eAAe;AAChB,CAAC;AACD,MAAM,2BAA2B,OAAO,MAAM,EAAE,aAAa,sBAAsB,C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OAAO;EACR,GAAG,UAAU,CAAC,IAAI,IAAI;CACvB,CAAC;CACD,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,oBAAoB,UAAU;EAC/E,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"Select.js","names":[],"sources":["esm/Select.js"],"sourcesContent":["import { Adapt, AdaptParent, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { Text, View, createChangeEventDetails, createStyledContext, createStyledHOC, styled } from \"@tamagui/core\";\nimport { FocusScopeController } from \"@tamagui/focus-scope\";\nimport { withStaticProperties } from \"@tamagui/helpers\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SelectItemParentProvider, SelectNativeComponentContext, SelectProvider, SelectZIndexContext, useSelectContext, useSelectItemParentContext } from \"./context\";\nimport { SelectContent } from \"./SelectContent\";\nimport { SelectInlineImpl } from \"./SelectImpl\";\nimport { SelectItem, useSelectItemContext } from \"./SelectItem\";\nimport { SelectItemText } from \"./SelectItemText\";\nimport { SelectScrollDownButton, SelectScrollUpButton } from \"./SelectScrollButton\";\nimport { SelectTrigger } from \"./SelectTrigger\";\nimport { SelectViewport } from \"./SelectViewport\";\nimport { createSelectItemRegistry, createSelectSelectionController, selectedValuesFromSelection } from \"./selectionController\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\n\nconst SelectValueFrame = styled(Text, { displayName: \"SelectValue\" });\nconst SelectValue = createStyledHOC(SelectValueFrame, function SelectValue2({ scope, children: childrenProp, placeholder, ...props }, forwardedRef) {\n\tconst context = useSelectContext(scope);\n\tconst itemParentContext = useSelectItemParentContext(scope);\n\tconst composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n\tconst isEmptyValue = context.selectedValues.length === 0;\n\tconst [, rerender] = React.useReducer((version) => version + 1, 0);\n\tuseIsomorphicLayoutEffect(() => itemParentContext.registry.subscribe(rerender), [itemParentContext.registry]);\n\tconst registeredValue = context.mode === \"multiple\" ? context.selectedValues.map((value, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 ? \", \" : null, itemParentContext.registry.getItem(value)?.label ?? value] }, value)) : itemParentContext.registry.getItem(context.selectedValues[0])?.label ?? context.value;\n\tconst children = childrenProp !== void 0 ? childrenProp : context.renderValue ? context.renderValue(context.value) : registeredValue;\n\tconst selectValueChildren = isEmptyValue ? placeholder ?? children : children;\n\treturn /* @__PURE__ */ jsx(SelectValueFrame, {\n\t\tpointerEvents: \"none\",\n\t\tref: composedRefs,\n\t\t...props,\n\t\tchildren: selectValueChildren\n\t});\n});\nconst SelectIcon = styled(View, {\n\tdisplayName: \"SelectIcon\",\n\t\"aria-hidden\": true\n});\nconst SelectItemIndicatorFrame = styled(View, { displayName: \"SelectItemIndicator\" });\nconst SelectItemIndicator = createStyledHOC(SelectItemIndicatorFrame, function SelectItemIndicator2(props, forwardedRef) {\n\tconst { scope, ...itemIndicatorProps } = props;\n\tconst context = useSelectItemParentContext(scope);\n\tconst itemContext = useSelectItemContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn itemContext.isSelected ? /* @__PURE__ */ jsx(SelectItemIndicatorFrame, {\n\t\t\"aria-hidden\": true,\n\t\t...itemIndicatorProps,\n\t\tref: forwardedRef\n\t}) : null;\n});\nconst SelectIndicatorFrame = styled(View, {\n\tdisplayName: \"SelectIndicator\",\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tpointerEvents: \"none\",\n\tzIndex: 10\n});\nconst SelectIndicator = createStyledHOC(SelectIndicatorFrame, function SelectIndicator2({ scope, ...props }, forwardedRef) {\n\tconst itemContext = useSelectItemParentContext(scope);\n\tconst context = useSelectContext(scope);\n\tconst [layout, setLayout] = React.useState(null);\n\tconst rafRef = React.useRef(0);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tconst update = (index) => {\n\t\t\tif (typeof index !== \"number\") return;\n\t\t\tcancelAnimationFrame(rafRef.current);\n\t\t\trafRef.current = requestAnimationFrame(() => {\n\t\t\t\tconst node = itemContext.listRef?.current?.[index];\n\t\t\t\tif (node) setLayout({\n\t\t\t\t\twidth: Math.round(node.offsetWidth),\n\t\t\t\t\theight: Math.round(node.offsetHeight),\n\t\t\t\t\tx: Math.round(node.offsetLeft),\n\t\t\t\t\ty: Math.round(node.offsetTop)\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\tif (context.open && context.activeIndexRef.current !== null) update(context.activeIndexRef.current);\n\t\treturn itemContext.activeIndexSubscribe(update);\n\t}, [context.open, itemContext.listRef]);\n\tif (!layout) return null;\n\treturn /* @__PURE__ */ jsx(SelectIndicatorFrame, {\n\t\tref: forwardedRef,\n\t\t...props,\n\t\twidth: layout.width,\n\t\theight: layout.height,\n\t\tx: layout.x,\n\t\ty: layout.y\n\t});\n});\nconst GROUP_NAME = \"SelectGroup\";\nconst { Provider: SelectGroupContextProvider, useStyledContext: useSelectGroupContext } = createStyledContext({ id: \"\" }, \"SelectGroup\");\nconst SelectGroupFrame = styled(View, { displayName: GROUP_NAME });\nconst NativeSelect = styled(Text, {\n\tdisplayName: \"NativeSelect\",\n\trender: \"select\"\n});\nconst SelectGroup = createStyledHOC(SelectGroupFrame, (props, forwardedRef) => {\n\tconst { scope, ...groupProps } = props;\n\tconst groupId = React.useId();\n\tconst context = useSelectContext(scope);\n\tconst itemParentContext = useSelectItemParentContext(scope);\n\tconst StyledNativeSelect = React.useContext(SelectNativeComponentContext);\n\tconst nativeSelectRef = React.useRef(null);\n\tconst content = (() => {\n\t\tif (itemParentContext.shouldRenderWebNative) return /* @__PURE__ */ jsx(NativeSelect, {\n\t\t\t...StyledNativeSelect && {\n\t\t\t\trender: StyledNativeSelect,\n\t\t\t\tsize: itemParentContext.size,\n\t\t\t\tstyle: { appearance: \"none\" }\n\t\t\t},\n\t\t\t...groupProps,\n\t\t\tvalue: context.value,\n\t\t\tmultiple: context.mode === \"multiple\",\n\t\t\tname: itemParentContext.name,\n\t\t\tform: itemParentContext.form,\n\t\t\tid: itemParentContext.id,\n\t\t\tonChange: ((event) => {\n\t\t\t\tconst value = context.mode === \"multiple\" ? Array.from(event.currentTarget.selectedOptions, (option) => option.value) : event.currentTarget.value;\n\t\t\t\titemParentContext.changeNativeValue(value, event.nativeEvent);\n\t\t\t}),\n\t\t\tref: nativeSelectRef,\n\t\t\tchildren: props.children\n\t\t});\n\t\treturn /* @__PURE__ */ jsx(SelectGroupFrame, {\n\t\t\trole: \"group\",\n\t\t\t\"aria-labelledby\": groupId,\n\t\t\t...groupProps,\n\t\t\tref: forwardedRef\n\t\t});\n\t})();\n\treturn /* @__PURE__ */ jsx(SelectGroupContextProvider, {\n\t\tscope,\n\t\tid: groupId || \"\",\n\t\tchildren: content\n\t});\n});\nSelectGroup.displayName = GROUP_NAME;\nconst SelectLabelFrame = styled(Text, { displayName: \"SelectLabel\" });\nconst SelectLabel = createStyledHOC(SelectLabelFrame, (props, forwardedRef) => {\n\tconst { scope, ...labelProps } = props;\n\tconst context = useSelectItemParentContext(scope);\n\tconst groupContext = useSelectGroupContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn /* @__PURE__ */ jsx(SelectLabelFrame, {\n\t\trender: \"div\",\n\t\tid: groupContext.id,\n\t\t...labelProps,\n\t\tref: forwardedRef\n\t});\n});\nconst SelectSeparator = styled(View, { displayName: \"SelectSeparator\" });\nconst SelectSheetImpl = (props) => {\n\treturn /* @__PURE__ */ jsx(Fragment, { children: props.children });\n};\nfunction SelectRoot(props) {\n\tconst adaptScope = `AdaptSelect${props.scope || \"\"}`;\n\tconst [open, requestOpenChange] = useControllableState({\n\t\tprop: props.open,\n\t\tdefaultProp: props.defaultOpen || false,\n\t\tonChange: props.onOpenChange\n\t});\n\tconst handleAdaptOpenChange = React.useCallback((nextOpen) => {\n\t\trequestOpenChange(nextOpen, createChangeEventDetails(nextOpen ? \"trigger-press\" : \"outside-press\"));\n\t}, [requestOpenChange]);\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\tadaptChildren: props.children,\n\t\topen,\n\t\tonOpenChange: handleAdaptOpenChange,\n\t\tchildren: /* @__PURE__ */ jsx(SelectInner, {\n\t\t\t...props,\n\t\t\tscope: props.scope,\n\t\t\tadaptScope,\n\t\t\topen,\n\t\t\trequestOpenChange\n\t\t})\n\t});\n}\nconst Select = withStaticProperties(SelectRoot, {\n\tRoot: SelectRoot,\n\tAdapt,\n\tContent: SelectContent,\n\tGroup: SelectGroup,\n\tIcon: SelectIcon,\n\tItem: SelectItem,\n\tItemIndicator: SelectItemIndicator,\n\tItemText: SelectItemText,\n\tLabel: SelectLabel,\n\tScrollDownButton: SelectScrollDownButton,\n\tScrollUpButton: SelectScrollUpButton,\n\tSeparator: SelectSeparator,\n\tTrigger: SelectTrigger,\n\tValue: SelectValue,\n\tViewport: SelectViewport,\n\tIndicator: SelectIndicator,\n\tFocusScope: FocusScopeController\n});\nfunction useEmitter() {\n\tconst listenersRef = React.useRef(/* @__PURE__ */ new Set());\n\treturn [React.useCallback((value) => {\n\t\tlistenersRef.current.forEach((l) => l(value));\n\t}, []), React.useCallback((listener) => {\n\t\tlistenersRef.current.add(listener);\n\t\treturn () => {\n\t\t\tlistenersRef.current.delete(listener);\n\t\t};\n\t}, [])];\n}\nfunction SelectInner(props) {\n\tconst { scope = \"\", adaptScope, native, children, open, requestOpenChange, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, value: valueProp, defaultValue, onValueChange, multiple = false, name, form, disablePreventBodyScroll, size: sizeProp = true, onActiveChange, dir, id, renderValue, lazyMount, zIndex } = props;\n\tconst SelectImpl = useAdaptIsActive(adaptScope) ? SelectSheetImpl : SelectInlineImpl;\n\tconst mode = multiple ? \"multiple\" : \"single\";\n\tconst [valueState, requestValueChange] = useControllableState({\n\t\tprop: valueProp,\n\t\tdefaultProp: defaultValue ?? (mode === \"multiple\" ? [] : \"\"),\n\t\tonChange: onValueChange,\n\t\ttransition: true\n\t});\n\tconst value = React.useMemo(() => mode === \"multiple\" ? selectedValuesFromSelection(mode, valueState) : typeof valueState === \"string\" ? valueState : \"\", [mode, valueState]);\n\tconst selectedValues = React.useMemo(() => selectedValuesFromSelection(mode, value), [mode, value]);\n\tconst [, rerenderRegistry] = React.useReducer((version) => version + 1, 0);\n\tconst registryRef = React.useRef(null);\n\tif (!registryRef.current) registryRef.current = createSelectItemRegistry(rerenderRegistry);\n\tconst registry = registryRef.current;\n\tconst controllerRef = React.useRef(null);\n\tif (!controllerRef.current) controllerRef.current = createSelectSelectionController({\n\t\tmode,\n\t\tvalue,\n\t\tregistry\n\t});\n\tconst controller = controllerRef.current;\n\tcontroller.setMode(mode);\n\tcontroller.setValue(value);\n\tReact.useEffect(() => {}, [props.id, requestOpenChange]);\n\tconst activeIndexRef = React.useRef(null);\n\tconst [emitActiveIndex, activeIndexSubscribe] = useEmitter();\n\tconst selectedIndexRef = React.useRef(null);\n\tconst lastPointerRef = React.useRef({\n\t\tx: -1,\n\t\ty: -1\n\t});\n\tconst listContentRef = React.useRef([]);\n\tconst listRef = React.useRef([]);\n\tconst [valueNode, setValueNode] = React.useState(null);\n\tconst selectedIndex = Math.max(0, controller.selectionAnchorIndex());\n\tlistContentRef.current = registry.getTypeaheadLabels();\n\tconst itemNodes = registry.getNodes();\n\tlistRef.current.length = itemNodes.length;\n\tfor (let i = 0; i < itemNodes.length; i++) listRef.current[i] = itemNodes[i];\n\tuseIsomorphicLayoutEffect(() => {\n\t\tselectedIndexRef.current = selectedIndex;\n\t});\n\tconst shouldRenderWebNative = isWeb && (native === true || native === \"web\" || Array.isArray(native) && native.includes(\"web\"));\n\tconst setActiveIndex = React.useCallback((index, details) => {\n\t\tif (activeIndexRef.current === index) return;\n\t\tactiveIndexRef.current = index;\n\t\tcontroller.setActiveIndex(index);\n\t\temitActiveIndex(index);\n\t\tif (typeof index === \"number\") {\n\t\t\tconst item = registry.getItems()[index];\n\t\t\tif (item && details) onActiveChange?.(item.value, details);\n\t\t}\n\t}, [\n\t\tcontroller,\n\t\temitActiveIndex,\n\t\tonActiveChange,\n\t\tregistry\n\t]);\n\tconst activeDetails = React.useCallback((reason, index, event) => ({\n\t\treason,\n\t\tevent,\n\t\ttrigger: void 0,\n\t\tindex\n\t}), []);\n\tconst moveActive = React.useCallback((direction, event) => {\n\t\tconst nextIndex = registry.nextEnabledIndex(activeIndexRef.current, direction);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tconst typeaheadRef = React.useRef({\n\t\ttext: \"\",\n\t\ttimeout: null\n\t});\n\tconst search = React.useCallback((text, event) => {\n\t\tclearTimeout(typeaheadRef.current.timeout);\n\t\ttypeaheadRef.current.text += text;\n\t\tlet nextIndex = registry.findTypeaheadIndex(typeaheadRef.current.text, activeIndexRef.current);\n\t\tif (nextIndex < 0 && typeaheadRef.current.text.length > 1) {\n\t\t\ttypeaheadRef.current.text = text;\n\t\t\tnextIndex = registry.findTypeaheadIndex(text, activeIndexRef.current);\n\t\t}\n\t\ttypeaheadRef.current.timeout = setTimeout(() => {\n\t\t\ttypeaheadRef.current.text = \"\";\n\t\t}, 750);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tReact.useEffect(() => {\n\t\treturn () => clearTimeout(typeaheadRef.current.timeout);\n\t}, []);\n\tReact.useEffect(() => {\n\t\tif (open) {\n\t\t\tconst nextIndex = controller.initialActiveIndex();\n\t\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"list-navigation\", nextIndex));\n\t\t} else setActiveIndex(null);\n\t}, [\n\t\topen,\n\t\tselectedIndex,\n\t\tregistry.getItems().length\n\t]);\n\tconst content = /* @__PURE__ */ jsxs(SelectItemParentProvider, {\n\t\tscopeName: scope,\n\t\tscope,\n\t\tadaptScope,\n\t\tmode,\n\t\tselectedValues,\n\t\tregistry,\n\t\tsize: sizeProp,\n\t\tactiveIndexSubscribe,\n\t\tactiveIndexRef,\n\t\trequestOpenChange,\n\t\tid,\n\t\tname,\n\t\tform,\n\t\tselectValue: React.useCallback((nextItemValue, details) => {\n\t\t\tconst item = registry.getItem(nextItemValue);\n\t\t\tif (!item || item.disabled) return;\n\t\t\tcontroller.setMode(mode);\n\t\t\tcontroller.setValue(value);\n\t\t\tconst previousValue = controller.value;\n\t\t\trequestValueChange(controller.toggle(nextItemValue), details);\n\t\t\tif (details.isCanceled) {\n\t\t\t\tcontroller.setValue(previousValue);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (controller.shouldCloseOnSelect) requestOpenChange(false, createChangeEventDetails(details.reason === \"keyboard\" ? \"keyboard\" : \"item-press\", details.event, details.trigger));\n\t\t}, [\n\t\t\tcontroller,\n\t\t\tmode,\n\t\t\tregistry,\n\t\t\trequestOpenChange,\n\t\t\trequestValueChange,\n\t\t\tvalue\n\t\t]),\n\t\tchangeNativeValue: React.useCallback((nextValue, event) => {\n\t\t\tconst details = createChangeEventDetails(\"native-change\", event);\n\t\t\trequestValueChange(nextValue, details);\n\t\t\tif (!details.isCanceled) controller.setValue(nextValue);\n\t\t}, [controller, requestValueChange]),\n\t\tshouldRenderWebNative,\n\t\tsetActiveIndex,\n\t\tselectedIndex,\n\t\tlastPointerRef,\n\t\tlistRef,\n\t\tmoveActive,\n\t\tsearch,\n\t\tchildren: [/* @__PURE__ */ jsx(SelectProvider, {\n\t\t\tscope,\n\t\t\tscopeName: scope,\n\t\t\tadaptScope,\n\t\t\tdisablePreventBodyScroll,\n\t\t\tdir,\n\t\t\tblockSelection: false,\n\t\t\tfallback: false,\n\t\t\tvalueNode,\n\t\t\tonValueNodeChange: setValueNode,\n\t\t\tactiveIndexRef,\n\t\t\tselectedIndex,\n\t\t\tsetActiveIndex,\n\t\t\tvalue,\n\t\t\tmode,\n\t\t\tselectedValues,\n\t\t\topen,\n\t\t\tnative,\n\t\t\trenderValue,\n\t\t\tlazyMount,\n\t\t\tchildren: shouldRenderWebNative ? children : /* @__PURE__ */ jsx(SelectImpl, {\n\t\t\t\tactiveIndexRef,\n\t\t\t\tlistContentRef,\n\t\t\t\tselectedIndexRef,\n\t\t\t\t...props,\n\t\t\t\topen,\n\t\t\t\tvalue,\n\t\t\t\tchildren\n\t\t\t})\n\t\t}), isWeb && !shouldRenderWebNative && name ? (mode === \"multiple\" ? selectedValues : [value]).map((inputValue) => /* @__PURE__ */ jsx(\"input\", {\n\t\t\ttype: \"hidden\",\n\t\t\tname,\n\t\t\tform,\n\t\t\tvalue: inputValue\n\t\t}, inputValue)) : null]\n\t});\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(SelectZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: content\n\t});\n\treturn content;\n}\n\nexport { Select, SelectGroup, SelectGroupFrame, SelectIcon, SelectIndicator, SelectIndicatorFrame, SelectItemIndicator, SelectItemIndicatorFrame, SelectLabel, SelectLabelFrame, SelectRoot, SelectSeparator, SelectValue, SelectValueFrame };"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,mBAAmB,OAAO,MAAM,EAAE,aAAa,cAAc,CAAC;AACpE,MAAM,cAAc,gBAAgB,kBAAkB,SAAS,aAAa,EAAE,OAAO,UAAU,cAAc,aAAa,GAAG,SAAS,cAAc;CACnJ,MAAM,UAAU,iBAAiB,KAAK;CACtC,MAAM,oBAAoB,2BAA2B,KAAK;CAC1D,MAAM,eAAe,gBAAgB,cAAc,QAAQ,iBAAiB;CAC5E,MAAM,eAAe,QAAQ,eAAe,WAAW;CACvD,MAAM,GAAG,YAAY,MAAM,YAAY,YAAY,UAAU,GAAG,CAAC;CACjE,gCAAgC,kBAAkB,SAAS,UAAU,QAAQ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mBAAmB,WAAW,OAAO;GACrC,IAAI,CAAC,QAAQ,YAAY,WAAW,SAAS,SAAS;EACvD,GAAG,CAAC,YAAY,kBAAkB,CAAC;EACnC;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU,CAAiB,oBAAI,gBAAgB;GAC9C;GACA,WAAW;GACX;GACA;GACA;GACA,gBAAgB;GAChB,UAAU;GACV;GACA,mBAAmB;GACnB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,UAAU,wBAAwB,WAA2B,oBAAI,YAAY;IAC5E;IACA;IACA;IACA,GAAG;IACH;IACA;IACA;GACD,CAAC;EACF,CAAC,GAAG,SAAS,CAAC,yBAAyB,QAAQ,SAAS,aAAa,iBAAiB,CAAC,KAAK,EAAC,CAAE,KAAK,eAA+B,oBAAI,SAAS;GAC/I,MAAM;GACN;GACA;GACA,OAAO;EACR,GAAG,UAAU,CAAC,IAAI,IAAI;CACvB,CAAC;CACD,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,oBAAoB,UAAU;EAC/E,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR"}
|
|
@@ -26,6 +26,12 @@ var SelectValue = createStyledHOC(SelectValueFrame, function SelectValue2(param,
|
|
|
26
26
|
var itemParentContext = useSelectItemParentContext(scope);
|
|
27
27
|
var composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
28
28
|
var isEmptyValue = context.selectedValues.length === 0;
|
|
29
|
+
var [, rerender] = React.useReducer(function(version) {
|
|
30
|
+
return version + 1;
|
|
31
|
+
}, 0);
|
|
32
|
+
useIsomorphicLayoutEffect(function() {
|
|
33
|
+
return itemParentContext.registry.subscribe(rerender);
|
|
34
|
+
}, [itemParentContext.registry]);
|
|
29
35
|
var _itemParentContext_registry_getItem_label;
|
|
30
36
|
var registeredValue = context.mode === "multiple" ? context.selectedValues.map(function(value, index) {
|
|
31
37
|
var _itemParentContext_registry_getItem2;
|
|
@@ -71,7 +77,7 @@ var SelectIndicator = createStyledHOC(SelectIndicatorFrame, function SelectIndic
|
|
|
71
77
|
var context = useSelectContext(scope);
|
|
72
78
|
var [layout, setLayout] = React.useState(null);
|
|
73
79
|
var rafRef = React.useRef(0);
|
|
74
|
-
|
|
80
|
+
useIsomorphicLayoutEffect(function() {
|
|
75
81
|
var update = function(index) {
|
|
76
82
|
if (typeof index !== "number") return;
|
|
77
83
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -173,12 +179,14 @@ function SelectRoot(props) {
|
|
|
173
179
|
defaultProp: props.defaultOpen || false,
|
|
174
180
|
onChange: props.onOpenChange
|
|
175
181
|
});
|
|
182
|
+
var handleAdaptOpenChange = React.useCallback(function(nextOpen) {
|
|
183
|
+
requestOpenChange(nextOpen, createChangeEventDetails(nextOpen ? "trigger-press" : "outside-press"));
|
|
184
|
+
}, [requestOpenChange]);
|
|
176
185
|
return /* @__PURE__ */ jsx(AdaptParent, {
|
|
177
186
|
scope: adaptScope,
|
|
187
|
+
adaptChildren: props.children,
|
|
178
188
|
open,
|
|
179
|
-
onOpenChange:
|
|
180
|
-
requestOpenChange(nextOpen, createChangeEventDetails(nextOpen ? "trigger-press" : "outside-press"));
|
|
181
|
-
}, [requestOpenChange]),
|
|
189
|
+
onOpenChange: handleAdaptOpenChange,
|
|
182
190
|
children: /* @__PURE__ */ jsx(SelectInner, {
|
|
183
191
|
...props,
|
|
184
192
|
scope: props.scope,
|
|
@@ -221,7 +229,6 @@ function useEmitter() {
|
|
|
221
229
|
}, [])];
|
|
222
230
|
}
|
|
223
231
|
function SelectInner(props) {
|
|
224
|
-
var _registry_getItems_activeIndex, _controller_selectionAnchor;
|
|
225
232
|
var { scope = "", adaptScope, native, children, open, requestOpenChange, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, value: valueProp, defaultValue, onValueChange, multiple = false, name, form, disablePreventBodyScroll, size: sizeProp = true, onActiveChange, dir, id, renderValue, lazyMount, zIndex } = props;
|
|
226
233
|
var SelectImpl = useAdaptIsActive(adaptScope) ? SelectSheetImpl : SelectInlineImpl;
|
|
227
234
|
var mode = multiple ? "multiple" : "single";
|
|
@@ -264,28 +271,32 @@ function SelectInner(props) {
|
|
|
264
271
|
});
|
|
265
272
|
}, [props.id, requestOpenChange]);
|
|
266
273
|
var activeIndexRef = React.useRef(null);
|
|
267
|
-
var [activeIndex, setActiveIndexState] = React.useState(null);
|
|
268
274
|
var [emitActiveIndex, activeIndexSubscribe] = useEmitter();
|
|
269
275
|
var selectedIndexRef = React.useRef(null);
|
|
276
|
+
var lastPointerRef = React.useRef({
|
|
277
|
+
x: -1,
|
|
278
|
+
y: -1
|
|
279
|
+
});
|
|
270
280
|
var listContentRef = React.useRef([]);
|
|
271
281
|
var listRef = React.useRef([]);
|
|
272
282
|
var [valueNode, setValueNode] = React.useState(null);
|
|
273
283
|
var selectedIndex = Math.max(0, controller.selectionAnchorIndex());
|
|
274
284
|
listContentRef.current = registry.getTypeaheadLabels();
|
|
275
|
-
|
|
285
|
+
var itemNodes = registry.getNodes();
|
|
286
|
+
listRef.current.length = itemNodes.length;
|
|
287
|
+
for (var i = 0; i < itemNodes.length; i++) listRef.current[i] = itemNodes[i];
|
|
276
288
|
useIsomorphicLayoutEffect(function() {
|
|
277
289
|
selectedIndexRef.current = selectedIndex;
|
|
278
290
|
});
|
|
279
291
|
var shouldRenderWebNative = isWeb && (native === true || native === "web" || Array.isArray(native) && native.includes("web"));
|
|
280
|
-
var
|
|
281
|
-
if (activeIndexRef.current
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
292
|
+
var setActiveIndex = React.useCallback(function(index, details) {
|
|
293
|
+
if (activeIndexRef.current === index) return;
|
|
294
|
+
activeIndexRef.current = index;
|
|
295
|
+
controller.setActiveIndex(index);
|
|
296
|
+
emitActiveIndex(index);
|
|
297
|
+
if (typeof index === "number") {
|
|
298
|
+
var item = registry.getItems()[index];
|
|
299
|
+
if (item && details) onActiveChange === null || onActiveChange === void 0 || onActiveChange(item.value, details);
|
|
289
300
|
}
|
|
290
301
|
}, [
|
|
291
302
|
controller,
|
|
@@ -293,10 +304,6 @@ function SelectInner(props) {
|
|
|
293
304
|
onActiveChange,
|
|
294
305
|
registry
|
|
295
306
|
]);
|
|
296
|
-
var setActiveIndex = React.useCallback(function(index, details) {
|
|
297
|
-
setActiveIndexFast(index, details);
|
|
298
|
-
setActiveIndexState(index);
|
|
299
|
-
}, [setActiveIndexFast]);
|
|
300
307
|
var activeDetails = React.useCallback(function(reason, index, event) {
|
|
301
308
|
return {
|
|
302
309
|
reason,
|
|
@@ -343,10 +350,7 @@ function SelectInner(props) {
|
|
|
343
350
|
if (open) {
|
|
344
351
|
var nextIndex = controller.initialActiveIndex();
|
|
345
352
|
if (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails("list-navigation", nextIndex));
|
|
346
|
-
} else
|
|
347
|
-
setActiveIndexFast(null);
|
|
348
|
-
setActiveIndexState(null);
|
|
349
|
-
}
|
|
353
|
+
} else setActiveIndex(null);
|
|
350
354
|
}, [
|
|
351
355
|
open,
|
|
352
356
|
selectedIndex,
|
|
@@ -392,7 +396,9 @@ function SelectInner(props) {
|
|
|
392
396
|
if (!details.isCanceled) controller.setValue(nextValue);
|
|
393
397
|
}, [controller, requestValueChange]),
|
|
394
398
|
shouldRenderWebNative,
|
|
395
|
-
|
|
399
|
+
setActiveIndex,
|
|
400
|
+
selectedIndex,
|
|
401
|
+
lastPointerRef,
|
|
396
402
|
listRef,
|
|
397
403
|
moveActive,
|
|
398
404
|
search,
|
|
@@ -406,15 +412,12 @@ function SelectInner(props) {
|
|
|
406
412
|
fallback: false,
|
|
407
413
|
valueNode,
|
|
408
414
|
onValueNodeChange: setValueNode,
|
|
409
|
-
activeIndex,
|
|
410
415
|
activeIndexRef,
|
|
411
416
|
selectedIndex,
|
|
412
417
|
setActiveIndex,
|
|
413
418
|
value,
|
|
414
419
|
mode,
|
|
415
420
|
selectedValues,
|
|
416
|
-
activeItem: activeIndex == null ? void 0 : (_registry_getItems_activeIndex = registry.getItems()[activeIndex]) === null || _registry_getItems_activeIndex === void 0 ? void 0 : _registry_getItems_activeIndex.value,
|
|
417
|
-
selectionAnchor: (_controller_selectionAnchor = controller.selectionAnchor()) === null || _controller_selectionAnchor === void 0 ? void 0 : _controller_selectionAnchor.value,
|
|
418
421
|
open,
|
|
419
422
|
native,
|
|
420
423
|
renderValue,
|
|
@@ -423,7 +426,6 @@ function SelectInner(props) {
|
|
|
423
426
|
activeIndexRef,
|
|
424
427
|
listContentRef,
|
|
425
428
|
selectedIndexRef,
|
|
426
|
-
setActiveIndexFast,
|
|
427
429
|
...props,
|
|
428
430
|
open,
|
|
429
431
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.native.js","names":[],"sources":["esm/Select.native.js"],"sourcesContent":["import { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { Adapt, AdaptParent, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { Text, View, createChangeEventDetails, createStyledContext, createStyledHOC, styled } from \"@tamagui/core\";\nimport { FocusScopeController } from \"@tamagui/focus-scope\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { withStaticProperties } from \"@tamagui/helpers\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SelectItemParentProvider, SelectNativeComponentContext, SelectProvider, SelectZIndexContext, useSelectContext, useSelectItemParentContext } from \"./context\";\nimport { SelectContent } from \"./SelectContent\";\nimport { SelectInlineImpl } from \"./SelectImpl\";\nimport { SelectItem, useSelectItemContext } from \"./SelectItem\";\nimport { SelectItemText } from \"./SelectItemText\";\nimport { SelectScrollDownButton, SelectScrollUpButton } from \"./SelectScrollButton\";\nimport { SelectTrigger } from \"./SelectTrigger\";\nimport { SelectViewport } from \"./SelectViewport\";\nimport { createSelectItemRegistry, createSelectSelectionController, selectedValuesFromSelection } from \"./selectionController\";\n\nvar SelectValueFrame = styled(Text, { displayName: \"SelectValue\" });\nvar SelectValue = createStyledHOC(SelectValueFrame, function SelectValue2(param, forwardedRef) {\n\tvar { scope, children: childrenProp, placeholder, ...props } = param;\n\tvar _itemParentContext_registry_getItem;\n\tvar context = useSelectContext(scope);\n\tvar itemParentContext = useSelectItemParentContext(scope);\n\tvar composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n\tvar isEmptyValue = context.selectedValues.length === 0;\n\tvar _itemParentContext_registry_getItem_label;\n\tvar registeredValue = context.mode === \"multiple\" ? context.selectedValues.map(function(value, index) {\n\t\tvar _itemParentContext_registry_getItem2;\n\t\tvar _itemParentContext_registry_getItem_label2;\n\t\treturn /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 ? \", \" : null, (_itemParentContext_registry_getItem_label2 = (_itemParentContext_registry_getItem2 = itemParentContext.registry.getItem(value)) === null || _itemParentContext_registry_getItem2 === void 0 ? void 0 : _itemParentContext_registry_getItem2.label) !== null && _itemParentContext_registry_getItem_label2 !== void 0 ? _itemParentContext_registry_getItem_label2 : value] }, value);\n\t}) : (_itemParentContext_registry_getItem_label = (_itemParentContext_registry_getItem = itemParentContext.registry.getItem(context.selectedValues[0])) === null || _itemParentContext_registry_getItem === void 0 ? void 0 : _itemParentContext_registry_getItem.label) !== null && _itemParentContext_registry_getItem_label !== void 0 ? _itemParentContext_registry_getItem_label : context.value;\n\tvar children = childrenProp !== void 0 ? childrenProp : context.renderValue ? context.renderValue(context.value) : registeredValue;\n\tvar selectValueChildren = isEmptyValue ? placeholder !== null && placeholder !== void 0 ? placeholder : children : children;\n\treturn /* @__PURE__ */ jsx(SelectValueFrame, {\n\t\tpointerEvents: \"none\",\n\t\tref: composedRefs,\n\t\t...props,\n\t\tchildren: selectValueChildren\n\t});\n});\nvar SelectIcon = styled(View, {\n\tdisplayName: \"SelectIcon\",\n\t\"aria-hidden\": true\n});\nvar SelectItemIndicatorFrame = styled(View, { displayName: \"SelectItemIndicator\" });\nvar SelectItemIndicator = createStyledHOC(SelectItemIndicatorFrame, function SelectItemIndicator2(props, forwardedRef) {\n\tvar { scope, ...itemIndicatorProps } = props;\n\tvar context = useSelectItemParentContext(scope);\n\tvar itemContext = useSelectItemContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn itemContext.isSelected ? /* @__PURE__ */ jsx(SelectItemIndicatorFrame, {\n\t\t\"aria-hidden\": true,\n\t\t...itemIndicatorProps,\n\t\tref: forwardedRef\n\t}) : null;\n});\nvar SelectIndicatorFrame = styled(View, {\n\tdisplayName: \"SelectIndicator\",\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tpointerEvents: \"none\",\n\tzIndex: 10\n});\nvar SelectIndicator = createStyledHOC(SelectIndicatorFrame, function SelectIndicator2(param, forwardedRef) {\n\tvar { scope, ...props } = param;\n\tvar itemContext = useSelectItemParentContext(scope);\n\tvar context = useSelectContext(scope);\n\tvar [layout, setLayout] = React.useState(null);\n\tvar rafRef = React.useRef(0);\n\tReact.useLayoutEffect(function() {\n\t\tvar update = function(index) {\n\t\t\tif (typeof index !== \"number\") return;\n\t\t\tcancelAnimationFrame(rafRef.current);\n\t\t\trafRef.current = requestAnimationFrame(function() {\n\t\t\t\tvar _itemContext_listRef_current, _itemContext_listRef;\n\t\t\t\tvar node = (_itemContext_listRef = itemContext.listRef) === null || _itemContext_listRef === void 0 ? void 0 : (_itemContext_listRef_current = _itemContext_listRef.current) === null || _itemContext_listRef_current === void 0 ? void 0 : _itemContext_listRef_current[index];\n\t\t\t\tif (node) setLayout({\n\t\t\t\t\twidth: Math.round(node.offsetWidth),\n\t\t\t\t\theight: Math.round(node.offsetHeight),\n\t\t\t\t\tx: Math.round(node.offsetLeft),\n\t\t\t\t\ty: Math.round(node.offsetTop)\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\tif (context.open && context.activeIndexRef.current !== null) update(context.activeIndexRef.current);\n\t\treturn itemContext.activeIndexSubscribe(update);\n\t}, [context.open, itemContext.listRef]);\n\tif (!layout) return null;\n\treturn /* @__PURE__ */ jsx(SelectIndicatorFrame, {\n\t\tref: forwardedRef,\n\t\t...props,\n\t\twidth: layout.width,\n\t\theight: layout.height,\n\t\tx: layout.x,\n\t\ty: layout.y\n\t});\n});\nvar GROUP_NAME = \"SelectGroup\";\nvar { Provider: SelectGroupContextProvider, useStyledContext: useSelectGroupContext } = createStyledContext({ id: \"\" }, \"SelectGroup\");\nvar SelectGroupFrame = styled(View, { displayName: GROUP_NAME });\nvar NativeSelect = styled(Text, {\n\tdisplayName: \"NativeSelect\",\n\trender: \"select\"\n});\nvar SelectGroup = createStyledHOC(SelectGroupFrame, function(props, forwardedRef) {\n\tvar { scope, ...groupProps } = props;\n\tvar groupId = React.useId();\n\tvar context = useSelectContext(scope);\n\tvar itemParentContext = useSelectItemParentContext(scope);\n\tvar StyledNativeSelect = React.useContext(SelectNativeComponentContext);\n\tvar nativeSelectRef = React.useRef(null);\n\tvar content = (function() {\n\t\tif (itemParentContext.shouldRenderWebNative) return /* @__PURE__ */ jsx(NativeSelect, {\n\t\t\t...StyledNativeSelect && {\n\t\t\t\trender: StyledNativeSelect,\n\t\t\t\tsize: itemParentContext.size,\n\t\t\t\tstyle: { appearance: \"none\" }\n\t\t\t},\n\t\t\t...groupProps,\n\t\t\tvalue: context.value,\n\t\t\tmultiple: context.mode === \"multiple\",\n\t\t\tname: itemParentContext.name,\n\t\t\tform: itemParentContext.form,\n\t\t\tid: itemParentContext.id,\n\t\t\tonChange: function(event) {\n\t\t\t\tvar value = context.mode === \"multiple\" ? Array.from(event.currentTarget.selectedOptions, function(option) {\n\t\t\t\t\treturn option.value;\n\t\t\t\t}) : event.currentTarget.value;\n\t\t\t\titemParentContext.changeNativeValue(value, event.nativeEvent);\n\t\t\t},\n\t\t\tref: nativeSelectRef,\n\t\t\tchildren: props.children\n\t\t});\n\t\treturn /* @__PURE__ */ jsx(SelectGroupFrame, {\n\t\t\trole: \"group\",\n\t\t\t\"aria-labelledby\": groupId,\n\t\t\t...groupProps,\n\t\t\tref: forwardedRef\n\t\t});\n\t})();\n\treturn /* @__PURE__ */ jsx(SelectGroupContextProvider, {\n\t\tscope,\n\t\tid: groupId || \"\",\n\t\tchildren: content\n\t});\n});\nSelectGroup.displayName = GROUP_NAME;\nvar SelectLabelFrame = styled(Text, { displayName: \"SelectLabel\" });\nvar SelectLabel = createStyledHOC(SelectLabelFrame, function(props, forwardedRef) {\n\tvar { scope, ...labelProps } = props;\n\tvar context = useSelectItemParentContext(scope);\n\tvar groupContext = useSelectGroupContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn /* @__PURE__ */ jsx(SelectLabelFrame, {\n\t\trender: \"div\",\n\t\tid: groupContext.id,\n\t\t...labelProps,\n\t\tref: forwardedRef\n\t});\n});\nvar SelectSeparator = styled(View, { displayName: \"SelectSeparator\" });\nvar SelectSheetImpl = function(props) {\n\treturn /* @__PURE__ */ jsx(Fragment, { children: props.children });\n};\nfunction SelectRoot(props) {\n\tvar adaptScope = `AdaptSelect${props.scope || \"\"}`;\n\tvar [open, requestOpenChange] = useControllableState({\n\t\tprop: props.open,\n\t\tdefaultProp: props.defaultOpen || false,\n\t\tonChange: props.onOpenChange\n\t});\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\topen,\n\t\tonOpenChange: React.useCallback(function(nextOpen) {\n\t\t\trequestOpenChange(nextOpen, createChangeEventDetails(nextOpen ? \"trigger-press\" : \"outside-press\"));\n\t\t}, [requestOpenChange]),\n\t\tchildren: /* @__PURE__ */ jsx(SelectInner, {\n\t\t\t...props,\n\t\t\tscope: props.scope,\n\t\t\tadaptScope,\n\t\t\topen,\n\t\t\trequestOpenChange\n\t\t})\n\t});\n}\nvar Select = withStaticProperties(SelectRoot, {\n\tRoot: SelectRoot,\n\tAdapt,\n\tContent: SelectContent,\n\tGroup: SelectGroup,\n\tIcon: SelectIcon,\n\tItem: SelectItem,\n\tItemIndicator: SelectItemIndicator,\n\tItemText: SelectItemText,\n\tLabel: SelectLabel,\n\tScrollDownButton: SelectScrollDownButton,\n\tScrollUpButton: SelectScrollUpButton,\n\tSeparator: SelectSeparator,\n\tTrigger: SelectTrigger,\n\tValue: SelectValue,\n\tViewport: SelectViewport,\n\tIndicator: SelectIndicator,\n\tFocusScope: FocusScopeController\n});\nfunction useEmitter() {\n\tvar listenersRef = React.useRef(/* @__PURE__ */ new Set());\n\treturn [React.useCallback(function(value) {\n\t\tlistenersRef.current.forEach(function(l) {\n\t\t\treturn l(value);\n\t\t});\n\t}, []), React.useCallback(function(listener) {\n\t\tlistenersRef.current.add(listener);\n\t\treturn function() {\n\t\t\tlistenersRef.current.delete(listener);\n\t\t};\n\t}, [])];\n}\nfunction SelectInner(props) {\n\tvar _registry_getItems_activeIndex, _controller_selectionAnchor;\n\tvar { scope = \"\", adaptScope, native, children, open, requestOpenChange, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, value: valueProp, defaultValue, onValueChange, multiple = false, name, form, disablePreventBodyScroll, size: sizeProp = true, onActiveChange, dir, id, renderValue, lazyMount, zIndex } = props;\n\tvar SelectImpl = useAdaptIsActive(adaptScope) ? SelectSheetImpl : SelectInlineImpl;\n\tvar mode = multiple ? \"multiple\" : \"single\";\n\tvar [valueState, requestValueChange] = useControllableState({\n\t\tprop: valueProp,\n\t\tdefaultProp: defaultValue !== null && defaultValue !== void 0 ? defaultValue : mode === \"multiple\" ? [] : \"\",\n\t\tonChange: onValueChange,\n\t\ttransition: true\n\t});\n\tvar value = React.useMemo(function() {\n\t\treturn mode === \"multiple\" ? selectedValuesFromSelection(mode, valueState) : typeof valueState === \"string\" ? valueState : \"\";\n\t}, [mode, valueState]);\n\tvar selectedValues = React.useMemo(function() {\n\t\treturn selectedValuesFromSelection(mode, value);\n\t}, [mode, value]);\n\tvar [, rerenderRegistry] = React.useReducer(function(version) {\n\t\treturn version + 1;\n\t}, 0);\n\tvar registryRef = React.useRef(null);\n\tif (!registryRef.current) registryRef.current = createSelectItemRegistry(rerenderRegistry);\n\tvar registry = registryRef.current;\n\tvar controllerRef = React.useRef(null);\n\tif (!controllerRef.current) controllerRef.current = createSelectSelectionController({\n\t\tmode,\n\t\tvalue,\n\t\tregistry\n\t});\n\tvar controller = controllerRef.current;\n\tcontroller.setMode(mode);\n\tcontroller.setValue(value);\n\tReact.useEffect(function() {\n\t\tif (!props.id) return;\n\t\treturn registerFocusable(props.id, {\n\t\t\tfocusAndSelect: function() {\n\t\t\t\trequestOpenChange(function(current) {\n\t\t\t\t\treturn !current;\n\t\t\t\t}, createChangeEventDetails(\"trigger-press\"));\n\t\t\t},\n\t\t\tfocus: function() {}\n\t\t});\n\t}, [props.id, requestOpenChange]);\n\tvar activeIndexRef = React.useRef(null);\n\tvar [activeIndex, setActiveIndexState] = React.useState(null);\n\tvar [emitActiveIndex, activeIndexSubscribe] = useEmitter();\n\tvar selectedIndexRef = React.useRef(null);\n\tvar listContentRef = React.useRef([]);\n\tvar listRef = React.useRef([]);\n\tvar [valueNode, setValueNode] = React.useState(null);\n\tvar selectedIndex = Math.max(0, controller.selectionAnchorIndex());\n\tlistContentRef.current = registry.getTypeaheadLabels();\n\tlistRef.current.length = registry.getItems().length;\n\tuseIsomorphicLayoutEffect(function() {\n\t\tselectedIndexRef.current = selectedIndex;\n\t});\n\tvar shouldRenderWebNative = isWeb && (native === true || native === \"web\" || Array.isArray(native) && native.includes(\"web\"));\n\tvar setActiveIndexFast = React.useCallback(function(index, details) {\n\t\tif (activeIndexRef.current !== index) {\n\t\t\tactiveIndexRef.current = index;\n\t\t\tcontroller.setActiveIndex(index);\n\t\t\tif (typeof index === \"number\") {\n\t\t\t\temitActiveIndex(index);\n\t\t\t\tvar item = registry.getItems()[index];\n\t\t\t\tif (item && details) onActiveChange === null || onActiveChange === void 0 || onActiveChange(item.value, details);\n\t\t\t}\n\t\t}\n\t}, [\n\t\tcontroller,\n\t\temitActiveIndex,\n\t\tonActiveChange,\n\t\tregistry\n\t]);\n\tvar setActiveIndex = React.useCallback(function(index, details) {\n\t\tsetActiveIndexFast(index, details);\n\t\tsetActiveIndexState(index);\n\t}, [setActiveIndexFast]);\n\tvar activeDetails = React.useCallback(function(reason, index, event) {\n\t\treturn {\n\t\t\treason,\n\t\t\tevent,\n\t\t\ttrigger: void 0,\n\t\t\tindex\n\t\t};\n\t}, []);\n\tvar moveActive = React.useCallback(function(direction, event) {\n\t\tvar nextIndex = registry.nextEnabledIndex(activeIndexRef.current, direction);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tvar typeaheadRef = React.useRef({\n\t\ttext: \"\",\n\t\ttimeout: null\n\t});\n\tvar search = React.useCallback(function(text, event) {\n\t\tclearTimeout(typeaheadRef.current.timeout);\n\t\ttypeaheadRef.current.text += text;\n\t\tvar nextIndex = registry.findTypeaheadIndex(typeaheadRef.current.text, activeIndexRef.current);\n\t\tif (nextIndex < 0 && typeaheadRef.current.text.length > 1) {\n\t\t\ttypeaheadRef.current.text = text;\n\t\t\tnextIndex = registry.findTypeaheadIndex(text, activeIndexRef.current);\n\t\t}\n\t\ttypeaheadRef.current.timeout = setTimeout(function() {\n\t\t\ttypeaheadRef.current.text = \"\";\n\t\t}, 750);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tReact.useEffect(function() {\n\t\treturn function() {\n\t\t\treturn clearTimeout(typeaheadRef.current.timeout);\n\t\t};\n\t}, []);\n\tReact.useEffect(function() {\n\t\tif (open) {\n\t\t\tvar nextIndex = controller.initialActiveIndex();\n\t\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"list-navigation\", nextIndex));\n\t\t} else {\n\t\t\tsetActiveIndexFast(null);\n\t\t\tsetActiveIndexState(null);\n\t\t}\n\t}, [\n\t\topen,\n\t\tselectedIndex,\n\t\tregistry.getItems().length\n\t]);\n\tvar content = /* @__PURE__ */ jsxs(SelectItemParentProvider, {\n\t\tscopeName: scope,\n\t\tscope,\n\t\tadaptScope,\n\t\tmode,\n\t\tselectedValues,\n\t\tregistry,\n\t\tsize: sizeProp,\n\t\tactiveIndexSubscribe,\n\t\tactiveIndexRef,\n\t\trequestOpenChange,\n\t\tid,\n\t\tname,\n\t\tform,\n\t\tselectValue: React.useCallback(function(nextItemValue, details) {\n\t\t\tvar item = registry.getItem(nextItemValue);\n\t\t\tif (!item || item.disabled) return;\n\t\t\tcontroller.setMode(mode);\n\t\t\tcontroller.setValue(value);\n\t\t\tvar previousValue = controller.value;\n\t\t\trequestValueChange(controller.toggle(nextItemValue), details);\n\t\t\tif (details.isCanceled) {\n\t\t\t\tcontroller.setValue(previousValue);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (controller.shouldCloseOnSelect) requestOpenChange(false, createChangeEventDetails(details.reason === \"keyboard\" ? \"keyboard\" : \"item-press\", details.event, details.trigger));\n\t\t}, [\n\t\t\tcontroller,\n\t\t\tmode,\n\t\t\tregistry,\n\t\t\trequestOpenChange,\n\t\t\trequestValueChange,\n\t\t\tvalue\n\t\t]),\n\t\tchangeNativeValue: React.useCallback(function(nextValue, event) {\n\t\t\tvar details = createChangeEventDetails(\"native-change\", event);\n\t\t\trequestValueChange(nextValue, details);\n\t\t\tif (!details.isCanceled) controller.setValue(nextValue);\n\t\t}, [controller, requestValueChange]),\n\t\tshouldRenderWebNative,\n\t\tsetActiveIndexFast,\n\t\tlistRef,\n\t\tmoveActive,\n\t\tsearch,\n\t\tchildren: [/* @__PURE__ */ jsx(SelectProvider, {\n\t\t\tscope,\n\t\t\tscopeName: scope,\n\t\t\tadaptScope,\n\t\t\tdisablePreventBodyScroll,\n\t\t\tdir,\n\t\t\tblockSelection: false,\n\t\t\tfallback: false,\n\t\t\tvalueNode,\n\t\t\tonValueNodeChange: setValueNode,\n\t\t\tactiveIndex,\n\t\t\tactiveIndexRef,\n\t\t\tselectedIndex,\n\t\t\tsetActiveIndex,\n\t\t\tvalue,\n\t\t\tmode,\n\t\t\tselectedValues,\n\t\t\tactiveItem: activeIndex == null ? void 0 : (_registry_getItems_activeIndex = registry.getItems()[activeIndex]) === null || _registry_getItems_activeIndex === void 0 ? void 0 : _registry_getItems_activeIndex.value,\n\t\t\tselectionAnchor: (_controller_selectionAnchor = controller.selectionAnchor()) === null || _controller_selectionAnchor === void 0 ? void 0 : _controller_selectionAnchor.value,\n\t\t\topen,\n\t\t\tnative,\n\t\t\trenderValue,\n\t\t\tlazyMount,\n\t\t\tchildren: shouldRenderWebNative ? children : /* @__PURE__ */ jsx(SelectImpl, {\n\t\t\t\tactiveIndexRef,\n\t\t\t\tlistContentRef,\n\t\t\t\tselectedIndexRef,\n\t\t\t\tsetActiveIndexFast,\n\t\t\t\t...props,\n\t\t\t\topen,\n\t\t\t\tvalue,\n\t\t\t\tchildren\n\t\t\t})\n\t\t}), isWeb && !shouldRenderWebNative && name ? (mode === \"multiple\" ? selectedValues : [value]).map(function(inputValue) {\n\t\t\treturn /* @__PURE__ */ jsx(\"input\", {\n\t\t\t\ttype: \"hidden\",\n\t\t\t\tname,\n\t\t\t\tform,\n\t\t\t\tvalue: inputValue\n\t\t\t}, inputValue);\n\t\t}) : null]\n\t});\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(SelectZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: content\n\t});\n\treturn content;\n}\n\nexport { Select, SelectGroup, SelectGroupFrame, SelectIcon, SelectIndicator, SelectIndicatorFrame, SelectItemIndicator, SelectItemIndicatorFrame, SelectLabel, SelectLabelFrame, SelectRoot, SelectSeparator, SelectValue, SelectValueFrame };"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,IA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C;EACD,mBAAmB,MAAM,YAAY,SAAS,WAAW,OAAO;GAC/D,IAAI,UAAU,yBAAyB,iBAAiB,KAAK;GAC7D,mBAAmB,WAAW,OAAO;GACrC,IAAI,CAAC,QAAQ,YAAY,WAAW,SAAS,SAAS;EACvD,GAAG,CAAC,YAAY,kBAAkB,CAAC;EACnC;EACA;EACA;EACA;EACA;EACA,UAAU,CAAiB,oBAAI,gBAAgB;GAC9C;GACA,WAAW;GACX;GACA;GACA;GACA,gBAAgB;GAChB,UAAU;GACV;GACA,mBAAmB;GACnB;GACA;GACA;GACA;GACA;GACA;GACA;GACA,YAAY,eAAe,OAAO,KAAK,KAAK,iCAAiC,SAAS,SAAS,CAAC,CAAC,kBAAkB,QAAQ,mCAAmC,KAAK,IAAI,KAAK,IAAI,+BAA+B;GAC/M,kBAAkB,8BAA8B,WAAW,gBAAgB,OAAO,QAAQ,gCAAgC,KAAK,IAAI,KAAK,IAAI,4BAA4B;GACxK;GACA;GACA;GACA;GACA,UAAU,wBAAwB,WAA2B,oBAAI,YAAY;IAC5E;IACA;IACA;IACA;IACA,GAAG;IACH;IACA;IACA;GACD,CAAC;EACF,CAAC,GAAG,SAAS,CAAC,yBAAyB,QAAQ,SAAS,aAAa,iBAAiB,CAAC,KAAK,EAAC,CAAE,IAAI,SAAS,YAAY;GACvH,OAAuB,oBAAI,SAAS;IACnC,MAAM;IACN;IACA;IACA,OAAO;GACR,GAAG,UAAU;EACd,CAAC,IAAI,IAAI;CACV,CAAC;CACD,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,oBAAoB,UAAU;EAC/E,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"Select.native.js","names":[],"sources":["esm/Select.native.js"],"sourcesContent":["import { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { Adapt, AdaptParent, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { Text, View, createChangeEventDetails, createStyledContext, createStyledHOC, styled } from \"@tamagui/core\";\nimport { FocusScopeController } from \"@tamagui/focus-scope\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { withStaticProperties } from \"@tamagui/helpers\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SelectItemParentProvider, SelectNativeComponentContext, SelectProvider, SelectZIndexContext, useSelectContext, useSelectItemParentContext } from \"./context\";\nimport { SelectContent } from \"./SelectContent\";\nimport { SelectInlineImpl } from \"./SelectImpl\";\nimport { SelectItem, useSelectItemContext } from \"./SelectItem\";\nimport { SelectItemText } from \"./SelectItemText\";\nimport { SelectScrollDownButton, SelectScrollUpButton } from \"./SelectScrollButton\";\nimport { SelectTrigger } from \"./SelectTrigger\";\nimport { SelectViewport } from \"./SelectViewport\";\nimport { createSelectItemRegistry, createSelectSelectionController, selectedValuesFromSelection } from \"./selectionController\";\n\nvar SelectValueFrame = styled(Text, { displayName: \"SelectValue\" });\nvar SelectValue = createStyledHOC(SelectValueFrame, function SelectValue2(param, forwardedRef) {\n\tvar { scope, children: childrenProp, placeholder, ...props } = param;\n\tvar _itemParentContext_registry_getItem;\n\tvar context = useSelectContext(scope);\n\tvar itemParentContext = useSelectItemParentContext(scope);\n\tvar composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n\tvar isEmptyValue = context.selectedValues.length === 0;\n\tvar [, rerender] = React.useReducer(function(version) {\n\t\treturn version + 1;\n\t}, 0);\n\tuseIsomorphicLayoutEffect(function() {\n\t\treturn itemParentContext.registry.subscribe(rerender);\n\t}, [itemParentContext.registry]);\n\tvar _itemParentContext_registry_getItem_label;\n\tvar registeredValue = context.mode === \"multiple\" ? context.selectedValues.map(function(value, index) {\n\t\tvar _itemParentContext_registry_getItem2;\n\t\tvar _itemParentContext_registry_getItem_label2;\n\t\treturn /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 ? \", \" : null, (_itemParentContext_registry_getItem_label2 = (_itemParentContext_registry_getItem2 = itemParentContext.registry.getItem(value)) === null || _itemParentContext_registry_getItem2 === void 0 ? void 0 : _itemParentContext_registry_getItem2.label) !== null && _itemParentContext_registry_getItem_label2 !== void 0 ? _itemParentContext_registry_getItem_label2 : value] }, value);\n\t}) : (_itemParentContext_registry_getItem_label = (_itemParentContext_registry_getItem = itemParentContext.registry.getItem(context.selectedValues[0])) === null || _itemParentContext_registry_getItem === void 0 ? void 0 : _itemParentContext_registry_getItem.label) !== null && _itemParentContext_registry_getItem_label !== void 0 ? _itemParentContext_registry_getItem_label : context.value;\n\tvar children = childrenProp !== void 0 ? childrenProp : context.renderValue ? context.renderValue(context.value) : registeredValue;\n\tvar selectValueChildren = isEmptyValue ? placeholder !== null && placeholder !== void 0 ? placeholder : children : children;\n\treturn /* @__PURE__ */ jsx(SelectValueFrame, {\n\t\tpointerEvents: \"none\",\n\t\tref: composedRefs,\n\t\t...props,\n\t\tchildren: selectValueChildren\n\t});\n});\nvar SelectIcon = styled(View, {\n\tdisplayName: \"SelectIcon\",\n\t\"aria-hidden\": true\n});\nvar SelectItemIndicatorFrame = styled(View, { displayName: \"SelectItemIndicator\" });\nvar SelectItemIndicator = createStyledHOC(SelectItemIndicatorFrame, function SelectItemIndicator2(props, forwardedRef) {\n\tvar { scope, ...itemIndicatorProps } = props;\n\tvar context = useSelectItemParentContext(scope);\n\tvar itemContext = useSelectItemContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn itemContext.isSelected ? /* @__PURE__ */ jsx(SelectItemIndicatorFrame, {\n\t\t\"aria-hidden\": true,\n\t\t...itemIndicatorProps,\n\t\tref: forwardedRef\n\t}) : null;\n});\nvar SelectIndicatorFrame = styled(View, {\n\tdisplayName: \"SelectIndicator\",\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tpointerEvents: \"none\",\n\tzIndex: 10\n});\nvar SelectIndicator = createStyledHOC(SelectIndicatorFrame, function SelectIndicator2(param, forwardedRef) {\n\tvar { scope, ...props } = param;\n\tvar itemContext = useSelectItemParentContext(scope);\n\tvar context = useSelectContext(scope);\n\tvar [layout, setLayout] = React.useState(null);\n\tvar rafRef = React.useRef(0);\n\tuseIsomorphicLayoutEffect(function() {\n\t\tvar update = function(index) {\n\t\t\tif (typeof index !== \"number\") return;\n\t\t\tcancelAnimationFrame(rafRef.current);\n\t\t\trafRef.current = requestAnimationFrame(function() {\n\t\t\t\tvar _itemContext_listRef_current, _itemContext_listRef;\n\t\t\t\tvar node = (_itemContext_listRef = itemContext.listRef) === null || _itemContext_listRef === void 0 ? void 0 : (_itemContext_listRef_current = _itemContext_listRef.current) === null || _itemContext_listRef_current === void 0 ? void 0 : _itemContext_listRef_current[index];\n\t\t\t\tif (node) setLayout({\n\t\t\t\t\twidth: Math.round(node.offsetWidth),\n\t\t\t\t\theight: Math.round(node.offsetHeight),\n\t\t\t\t\tx: Math.round(node.offsetLeft),\n\t\t\t\t\ty: Math.round(node.offsetTop)\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\tif (context.open && context.activeIndexRef.current !== null) update(context.activeIndexRef.current);\n\t\treturn itemContext.activeIndexSubscribe(update);\n\t}, [context.open, itemContext.listRef]);\n\tif (!layout) return null;\n\treturn /* @__PURE__ */ jsx(SelectIndicatorFrame, {\n\t\tref: forwardedRef,\n\t\t...props,\n\t\twidth: layout.width,\n\t\theight: layout.height,\n\t\tx: layout.x,\n\t\ty: layout.y\n\t});\n});\nvar GROUP_NAME = \"SelectGroup\";\nvar { Provider: SelectGroupContextProvider, useStyledContext: useSelectGroupContext } = createStyledContext({ id: \"\" }, \"SelectGroup\");\nvar SelectGroupFrame = styled(View, { displayName: GROUP_NAME });\nvar NativeSelect = styled(Text, {\n\tdisplayName: \"NativeSelect\",\n\trender: \"select\"\n});\nvar SelectGroup = createStyledHOC(SelectGroupFrame, function(props, forwardedRef) {\n\tvar { scope, ...groupProps } = props;\n\tvar groupId = React.useId();\n\tvar context = useSelectContext(scope);\n\tvar itemParentContext = useSelectItemParentContext(scope);\n\tvar StyledNativeSelect = React.useContext(SelectNativeComponentContext);\n\tvar nativeSelectRef = React.useRef(null);\n\tvar content = (function() {\n\t\tif (itemParentContext.shouldRenderWebNative) return /* @__PURE__ */ jsx(NativeSelect, {\n\t\t\t...StyledNativeSelect && {\n\t\t\t\trender: StyledNativeSelect,\n\t\t\t\tsize: itemParentContext.size,\n\t\t\t\tstyle: { appearance: \"none\" }\n\t\t\t},\n\t\t\t...groupProps,\n\t\t\tvalue: context.value,\n\t\t\tmultiple: context.mode === \"multiple\",\n\t\t\tname: itemParentContext.name,\n\t\t\tform: itemParentContext.form,\n\t\t\tid: itemParentContext.id,\n\t\t\tonChange: function(event) {\n\t\t\t\tvar value = context.mode === \"multiple\" ? Array.from(event.currentTarget.selectedOptions, function(option) {\n\t\t\t\t\treturn option.value;\n\t\t\t\t}) : event.currentTarget.value;\n\t\t\t\titemParentContext.changeNativeValue(value, event.nativeEvent);\n\t\t\t},\n\t\t\tref: nativeSelectRef,\n\t\t\tchildren: props.children\n\t\t});\n\t\treturn /* @__PURE__ */ jsx(SelectGroupFrame, {\n\t\t\trole: \"group\",\n\t\t\t\"aria-labelledby\": groupId,\n\t\t\t...groupProps,\n\t\t\tref: forwardedRef\n\t\t});\n\t})();\n\treturn /* @__PURE__ */ jsx(SelectGroupContextProvider, {\n\t\tscope,\n\t\tid: groupId || \"\",\n\t\tchildren: content\n\t});\n});\nSelectGroup.displayName = GROUP_NAME;\nvar SelectLabelFrame = styled(Text, { displayName: \"SelectLabel\" });\nvar SelectLabel = createStyledHOC(SelectLabelFrame, function(props, forwardedRef) {\n\tvar { scope, ...labelProps } = props;\n\tvar context = useSelectItemParentContext(scope);\n\tvar groupContext = useSelectGroupContext(scope);\n\tif (context.shouldRenderWebNative) return null;\n\treturn /* @__PURE__ */ jsx(SelectLabelFrame, {\n\t\trender: \"div\",\n\t\tid: groupContext.id,\n\t\t...labelProps,\n\t\tref: forwardedRef\n\t});\n});\nvar SelectSeparator = styled(View, { displayName: \"SelectSeparator\" });\nvar SelectSheetImpl = function(props) {\n\treturn /* @__PURE__ */ jsx(Fragment, { children: props.children });\n};\nfunction SelectRoot(props) {\n\tvar adaptScope = `AdaptSelect${props.scope || \"\"}`;\n\tvar [open, requestOpenChange] = useControllableState({\n\t\tprop: props.open,\n\t\tdefaultProp: props.defaultOpen || false,\n\t\tonChange: props.onOpenChange\n\t});\n\tvar handleAdaptOpenChange = React.useCallback(function(nextOpen) {\n\t\trequestOpenChange(nextOpen, createChangeEventDetails(nextOpen ? \"trigger-press\" : \"outside-press\"));\n\t}, [requestOpenChange]);\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\tadaptChildren: props.children,\n\t\topen,\n\t\tonOpenChange: handleAdaptOpenChange,\n\t\tchildren: /* @__PURE__ */ jsx(SelectInner, {\n\t\t\t...props,\n\t\t\tscope: props.scope,\n\t\t\tadaptScope,\n\t\t\topen,\n\t\t\trequestOpenChange\n\t\t})\n\t});\n}\nvar Select = withStaticProperties(SelectRoot, {\n\tRoot: SelectRoot,\n\tAdapt,\n\tContent: SelectContent,\n\tGroup: SelectGroup,\n\tIcon: SelectIcon,\n\tItem: SelectItem,\n\tItemIndicator: SelectItemIndicator,\n\tItemText: SelectItemText,\n\tLabel: SelectLabel,\n\tScrollDownButton: SelectScrollDownButton,\n\tScrollUpButton: SelectScrollUpButton,\n\tSeparator: SelectSeparator,\n\tTrigger: SelectTrigger,\n\tValue: SelectValue,\n\tViewport: SelectViewport,\n\tIndicator: SelectIndicator,\n\tFocusScope: FocusScopeController\n});\nfunction useEmitter() {\n\tvar listenersRef = React.useRef(/* @__PURE__ */ new Set());\n\treturn [React.useCallback(function(value) {\n\t\tlistenersRef.current.forEach(function(l) {\n\t\t\treturn l(value);\n\t\t});\n\t}, []), React.useCallback(function(listener) {\n\t\tlistenersRef.current.add(listener);\n\t\treturn function() {\n\t\t\tlistenersRef.current.delete(listener);\n\t\t};\n\t}, [])];\n}\nfunction SelectInner(props) {\n\tvar { scope = \"\", adaptScope, native, children, open, requestOpenChange, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, value: valueProp, defaultValue, onValueChange, multiple = false, name, form, disablePreventBodyScroll, size: sizeProp = true, onActiveChange, dir, id, renderValue, lazyMount, zIndex } = props;\n\tvar SelectImpl = useAdaptIsActive(adaptScope) ? SelectSheetImpl : SelectInlineImpl;\n\tvar mode = multiple ? \"multiple\" : \"single\";\n\tvar [valueState, requestValueChange] = useControllableState({\n\t\tprop: valueProp,\n\t\tdefaultProp: defaultValue !== null && defaultValue !== void 0 ? defaultValue : mode === \"multiple\" ? [] : \"\",\n\t\tonChange: onValueChange,\n\t\ttransition: true\n\t});\n\tvar value = React.useMemo(function() {\n\t\treturn mode === \"multiple\" ? selectedValuesFromSelection(mode, valueState) : typeof valueState === \"string\" ? valueState : \"\";\n\t}, [mode, valueState]);\n\tvar selectedValues = React.useMemo(function() {\n\t\treturn selectedValuesFromSelection(mode, value);\n\t}, [mode, value]);\n\tvar [, rerenderRegistry] = React.useReducer(function(version) {\n\t\treturn version + 1;\n\t}, 0);\n\tvar registryRef = React.useRef(null);\n\tif (!registryRef.current) registryRef.current = createSelectItemRegistry(rerenderRegistry);\n\tvar registry = registryRef.current;\n\tvar controllerRef = React.useRef(null);\n\tif (!controllerRef.current) controllerRef.current = createSelectSelectionController({\n\t\tmode,\n\t\tvalue,\n\t\tregistry\n\t});\n\tvar controller = controllerRef.current;\n\tcontroller.setMode(mode);\n\tcontroller.setValue(value);\n\tReact.useEffect(function() {\n\t\tif (!props.id) return;\n\t\treturn registerFocusable(props.id, {\n\t\t\tfocusAndSelect: function() {\n\t\t\t\trequestOpenChange(function(current) {\n\t\t\t\t\treturn !current;\n\t\t\t\t}, createChangeEventDetails(\"trigger-press\"));\n\t\t\t},\n\t\t\tfocus: function() {}\n\t\t});\n\t}, [props.id, requestOpenChange]);\n\tvar activeIndexRef = React.useRef(null);\n\tvar [emitActiveIndex, activeIndexSubscribe] = useEmitter();\n\tvar selectedIndexRef = React.useRef(null);\n\tvar lastPointerRef = React.useRef({\n\t\tx: -1,\n\t\ty: -1\n\t});\n\tvar listContentRef = React.useRef([]);\n\tvar listRef = React.useRef([]);\n\tvar [valueNode, setValueNode] = React.useState(null);\n\tvar selectedIndex = Math.max(0, controller.selectionAnchorIndex());\n\tlistContentRef.current = registry.getTypeaheadLabels();\n\tvar itemNodes = registry.getNodes();\n\tlistRef.current.length = itemNodes.length;\n\tfor (var i = 0; i < itemNodes.length; i++) listRef.current[i] = itemNodes[i];\n\tuseIsomorphicLayoutEffect(function() {\n\t\tselectedIndexRef.current = selectedIndex;\n\t});\n\tvar shouldRenderWebNative = isWeb && (native === true || native === \"web\" || Array.isArray(native) && native.includes(\"web\"));\n\tvar setActiveIndex = React.useCallback(function(index, details) {\n\t\tif (activeIndexRef.current === index) return;\n\t\tactiveIndexRef.current = index;\n\t\tcontroller.setActiveIndex(index);\n\t\temitActiveIndex(index);\n\t\tif (typeof index === \"number\") {\n\t\t\tvar item = registry.getItems()[index];\n\t\t\tif (item && details) onActiveChange === null || onActiveChange === void 0 || onActiveChange(item.value, details);\n\t\t}\n\t}, [\n\t\tcontroller,\n\t\temitActiveIndex,\n\t\tonActiveChange,\n\t\tregistry\n\t]);\n\tvar activeDetails = React.useCallback(function(reason, index, event) {\n\t\treturn {\n\t\t\treason,\n\t\t\tevent,\n\t\t\ttrigger: void 0,\n\t\t\tindex\n\t\t};\n\t}, []);\n\tvar moveActive = React.useCallback(function(direction, event) {\n\t\tvar nextIndex = registry.nextEnabledIndex(activeIndexRef.current, direction);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tvar typeaheadRef = React.useRef({\n\t\ttext: \"\",\n\t\ttimeout: null\n\t});\n\tvar search = React.useCallback(function(text, event) {\n\t\tclearTimeout(typeaheadRef.current.timeout);\n\t\ttypeaheadRef.current.text += text;\n\t\tvar nextIndex = registry.findTypeaheadIndex(typeaheadRef.current.text, activeIndexRef.current);\n\t\tif (nextIndex < 0 && typeaheadRef.current.text.length > 1) {\n\t\t\ttypeaheadRef.current.text = text;\n\t\t\tnextIndex = registry.findTypeaheadIndex(text, activeIndexRef.current);\n\t\t}\n\t\ttypeaheadRef.current.timeout = setTimeout(function() {\n\t\t\ttypeaheadRef.current.text = \"\";\n\t\t}, 750);\n\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"keyboard\", nextIndex, event));\n\t}, [\n\t\tactiveDetails,\n\t\tregistry,\n\t\tsetActiveIndex\n\t]);\n\tReact.useEffect(function() {\n\t\treturn function() {\n\t\t\treturn clearTimeout(typeaheadRef.current.timeout);\n\t\t};\n\t}, []);\n\tReact.useEffect(function() {\n\t\tif (open) {\n\t\t\tvar nextIndex = controller.initialActiveIndex();\n\t\t\tif (nextIndex >= 0) setActiveIndex(nextIndex, activeDetails(\"list-navigation\", nextIndex));\n\t\t} else setActiveIndex(null);\n\t}, [\n\t\topen,\n\t\tselectedIndex,\n\t\tregistry.getItems().length\n\t]);\n\tvar content = /* @__PURE__ */ jsxs(SelectItemParentProvider, {\n\t\tscopeName: scope,\n\t\tscope,\n\t\tadaptScope,\n\t\tmode,\n\t\tselectedValues,\n\t\tregistry,\n\t\tsize: sizeProp,\n\t\tactiveIndexSubscribe,\n\t\tactiveIndexRef,\n\t\trequestOpenChange,\n\t\tid,\n\t\tname,\n\t\tform,\n\t\tselectValue: React.useCallback(function(nextItemValue, details) {\n\t\t\tvar item = registry.getItem(nextItemValue);\n\t\t\tif (!item || item.disabled) return;\n\t\t\tcontroller.setMode(mode);\n\t\t\tcontroller.setValue(value);\n\t\t\tvar previousValue = controller.value;\n\t\t\trequestValueChange(controller.toggle(nextItemValue), details);\n\t\t\tif (details.isCanceled) {\n\t\t\t\tcontroller.setValue(previousValue);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (controller.shouldCloseOnSelect) requestOpenChange(false, createChangeEventDetails(details.reason === \"keyboard\" ? \"keyboard\" : \"item-press\", details.event, details.trigger));\n\t\t}, [\n\t\t\tcontroller,\n\t\t\tmode,\n\t\t\tregistry,\n\t\t\trequestOpenChange,\n\t\t\trequestValueChange,\n\t\t\tvalue\n\t\t]),\n\t\tchangeNativeValue: React.useCallback(function(nextValue, event) {\n\t\t\tvar details = createChangeEventDetails(\"native-change\", event);\n\t\t\trequestValueChange(nextValue, details);\n\t\t\tif (!details.isCanceled) controller.setValue(nextValue);\n\t\t}, [controller, requestValueChange]),\n\t\tshouldRenderWebNative,\n\t\tsetActiveIndex,\n\t\tselectedIndex,\n\t\tlastPointerRef,\n\t\tlistRef,\n\t\tmoveActive,\n\t\tsearch,\n\t\tchildren: [/* @__PURE__ */ jsx(SelectProvider, {\n\t\t\tscope,\n\t\t\tscopeName: scope,\n\t\t\tadaptScope,\n\t\t\tdisablePreventBodyScroll,\n\t\t\tdir,\n\t\t\tblockSelection: false,\n\t\t\tfallback: false,\n\t\t\tvalueNode,\n\t\t\tonValueNodeChange: setValueNode,\n\t\t\tactiveIndexRef,\n\t\t\tselectedIndex,\n\t\t\tsetActiveIndex,\n\t\t\tvalue,\n\t\t\tmode,\n\t\t\tselectedValues,\n\t\t\topen,\n\t\t\tnative,\n\t\t\trenderValue,\n\t\t\tlazyMount,\n\t\t\tchildren: shouldRenderWebNative ? children : /* @__PURE__ */ jsx(SelectImpl, {\n\t\t\t\tactiveIndexRef,\n\t\t\t\tlistContentRef,\n\t\t\t\tselectedIndexRef,\n\t\t\t\t...props,\n\t\t\t\topen,\n\t\t\t\tvalue,\n\t\t\t\tchildren\n\t\t\t})\n\t\t}), isWeb && !shouldRenderWebNative && name ? (mode === \"multiple\" ? selectedValues : [value]).map(function(inputValue) {\n\t\t\treturn /* @__PURE__ */ jsx(\"input\", {\n\t\t\t\ttype: \"hidden\",\n\t\t\t\tname,\n\t\t\t\tform,\n\t\t\t\tvalue: inputValue\n\t\t\t}, inputValue);\n\t\t}) : null]\n\t});\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(SelectZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: content\n\t});\n\treturn content;\n}\n\nexport { Select, SelectGroup, SelectGroupFrame, SelectIcon, SelectIndicator, SelectIndicatorFrame, SelectItemIndicator, SelectItemIndicatorFrame, SelectLabel, SelectLabelFrame, SelectRoot, SelectSeparator, SelectValue, SelectValueFrame };"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,IAAI,mBAAmB,OAAO,MAAM,EAAE,aAAa,cAAc,CAAC;AAClE,IAAI,cAAc,gBAAgB,kBAAkB,SAAS,aAAa,OAAO,cAAc;CAC9F,IAAI,EAAE,OAAO,UAAU,cAAc,aAAa,GAAG,UAAU;CAC/D,IAAI;CACJ,IAAI,UAAU,iBAAiB,KAAK;CACpC,IAAI,oBAAoB,2BAA2B,KAAK;CACxD,IAAI,eAAe,gBAAgB,cAAc,QAAQ,iBAAiB;CAC1E,IAAI,eAAe,QAAQ,eAAe,WAAW;CACrD,IAAI,GAAG,YAAY,MAAM,WAAW,SAAS,SAAS;EACrD,OAAO,UAAU;CAClB,GAAG,CAAC;CACJ,0BAA0B,WAAW;EACpC,OAAO,kBAAkB,SAAS,UAAU,QAAQ;CACrD,GAAG,CAAC,kBAAkB,QAAQ,CAAC;CAC/B,IAAI;CACJ,IAAI,kBAAkB,QAAQ,SAAS,aAAa,QAAQ,eAAe,IAAI,SAAS,OAAO,OAAO;EACrG,IAAI;EACJ,IAAI;EACJ,OAAuB,qBAAK,MAAM,UAAU,EAAE,UAAU,CAAC,QAAQ,IAAI,OAAO,OAAO,8CAA8C,uCAAuC,kBAAkB,SAAS,QAAQ,KAAK,OAAO,QAAQ,yCAAyC,KAAK,IAAI,KAAK,IAAI,qCAAqC,WAAW,QAAQ,+CAA+C,KAAK,IAAI,6CAA6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I;CACV,CAAC;CACD,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,oBAAoB,UAAU;EAC/E,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR"}
|
package/dist/esm/SelectImpl.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
|
3
3
|
import { createChangeEventDetails, useEvent, useIsTouchDevice } from "@tamagui/core";
|
|
4
4
|
import { composeEventHandlers } from "@tamagui/helpers";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import { flushSync } from "react-dom";
|
|
7
6
|
import { SCROLL_ARROW_THRESHOLD } from "./constants.mjs";
|
|
8
7
|
import { SelectItemParentProvider, SelectProvider, useSelectContext, useSelectItemParentContext } from "./context.mjs";
|
|
9
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -14,7 +13,6 @@ const SelectInlineImpl = (props) => {
|
|
|
14
13
|
const selectItemParentContext = useSelectItemParentContext(scope);
|
|
15
14
|
const { setActiveIndex, selectedIndex, activeIndexRef } = selectContext;
|
|
16
15
|
const { requestOpenChange, registry } = selectItemParentContext;
|
|
17
|
-
const [scrollTop, setScrollTop] = React.useState(0);
|
|
18
16
|
const touch = useIsTouchDevice();
|
|
19
17
|
const listItemsRef = selectItemParentContext.listRef;
|
|
20
18
|
const overflowRef = React.useRef(null);
|
|
@@ -32,10 +30,10 @@ const SelectInlineImpl = (props) => {
|
|
|
32
30
|
const [fallback, setFallback] = React.useState(false);
|
|
33
31
|
const [innerOffset, setInnerOffset] = React.useState(0);
|
|
34
32
|
const [blockSelection, setBlockSelection] = React.useState(false);
|
|
35
|
-
const floatingStyle = React.useRef({});
|
|
36
33
|
React.useEffect(() => {
|
|
37
34
|
if (!open) {
|
|
38
|
-
|
|
35
|
+
setCanScrollUp(false);
|
|
36
|
+
setCanScrollDown(false);
|
|
39
37
|
setFallback(false);
|
|
40
38
|
setControlledScrolling(false);
|
|
41
39
|
}
|
|
@@ -55,9 +53,8 @@ const SelectInlineImpl = (props) => {
|
|
|
55
53
|
placement: "bottom-start",
|
|
56
54
|
whileElementsMounted: autoUpdate,
|
|
57
55
|
middleware: [
|
|
58
|
-
size({ apply({ rects
|
|
59
|
-
|
|
60
|
-
if (refs.floating.current) Object.assign(refs.floating.current.style, floatingStyle.current);
|
|
56
|
+
size({ apply({ rects, elements }) {
|
|
57
|
+
elements.floating.style.minWidth = `${rects.reference.width + 8}px`;
|
|
61
58
|
} }),
|
|
62
59
|
inner({
|
|
63
60
|
listRef: listItemsRef,
|
|
@@ -69,18 +66,22 @@ const SelectInlineImpl = (props) => {
|
|
|
69
66
|
minItemsVisible: touch ? 10 : 4,
|
|
70
67
|
referenceOverflowThreshold: 20
|
|
71
68
|
}),
|
|
72
|
-
offset({ crossAxis: -
|
|
69
|
+
offset({ crossAxis: -4 })
|
|
73
70
|
]
|
|
74
71
|
});
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
72
|
+
const [canScrollUp, setCanScrollUp] = React.useState(false);
|
|
73
|
+
const [canScrollDown, setCanScrollDown] = React.useState(false);
|
|
74
|
+
const updateScrollArrows = React.useCallback(() => {
|
|
75
|
+
const el = refs.floating.current;
|
|
76
|
+
if (!el) return;
|
|
77
|
+
setCanScrollUp(el.scrollTop > SCROLL_ARROW_THRESHOLD);
|
|
78
|
+
setCanScrollDown(el.scrollTop < el.scrollHeight - el.clientHeight - SCROLL_ARROW_THRESHOLD);
|
|
79
|
+
}, [refs]);
|
|
80
|
+
const showUpArrow = open && canScrollUp;
|
|
81
|
+
const showDownArrow = open && canScrollDown;
|
|
78
82
|
const isScrollable = showDownArrow || showUpArrow;
|
|
79
83
|
useIsomorphicLayoutEffect(() => {
|
|
80
|
-
if (typeof window === "undefined") return;
|
|
81
|
-
window.addEventListener("resize", update);
|
|
82
84
|
if (open) update();
|
|
83
|
-
return () => window.removeEventListener("resize", update);
|
|
84
85
|
}, [update, open]);
|
|
85
86
|
const onMatch = useEvent((index) => {
|
|
86
87
|
if (!open) return;
|
|
@@ -93,23 +94,32 @@ const SelectInlineImpl = (props) => {
|
|
|
93
94
|
});
|
|
94
95
|
const dataRef = React.useRef({});
|
|
95
96
|
dataRef.current.placement = computedPlacement;
|
|
96
|
-
const
|
|
97
|
+
const onOpenChange = useEvent((nextOpen, event, reason) => {
|
|
98
|
+
requestOpenChange(nextOpen, createChangeEventDetails(reason === "list-navigation" ? "keyboard" : "trigger-press", event, refs.reference.current));
|
|
99
|
+
});
|
|
100
|
+
const referenceElement = refs.reference.current || null;
|
|
101
|
+
const floatingElement = refs.floating.current || null;
|
|
102
|
+
const interactionContext = React.useMemo(() => ({
|
|
97
103
|
open,
|
|
98
|
-
onOpenChange
|
|
99
|
-
requestOpenChange(nextOpen, createChangeEventDetails(reason === "list-navigation" ? "keyboard" : "trigger-press", event, refs.reference.current));
|
|
100
|
-
},
|
|
104
|
+
onOpenChange,
|
|
101
105
|
refs: {
|
|
102
106
|
reference: refs.reference,
|
|
103
107
|
floating: refs.floating,
|
|
104
108
|
domReference: refs.reference
|
|
105
109
|
},
|
|
106
110
|
elements: {
|
|
107
|
-
reference:
|
|
108
|
-
floating:
|
|
109
|
-
domReference:
|
|
111
|
+
reference: referenceElement,
|
|
112
|
+
floating: floatingElement,
|
|
113
|
+
domReference: referenceElement
|
|
110
114
|
},
|
|
111
115
|
dataRef
|
|
112
|
-
}
|
|
116
|
+
}), [
|
|
117
|
+
open,
|
|
118
|
+
onOpenChange,
|
|
119
|
+
refs,
|
|
120
|
+
referenceElement,
|
|
121
|
+
floatingElement
|
|
122
|
+
]);
|
|
113
123
|
const interactionsProps = [
|
|
114
124
|
useClick(interactionContext, {
|
|
115
125
|
event: "mousedown",
|
|
@@ -124,7 +134,7 @@ const SelectInlineImpl = (props) => {
|
|
|
124
134
|
}),
|
|
125
135
|
useListNavigation(interactionContext, {
|
|
126
136
|
listRef: listItemsRef,
|
|
127
|
-
activeIndex:
|
|
137
|
+
activeIndex: null,
|
|
128
138
|
selectedIndex,
|
|
129
139
|
onNavigate: (index) => {
|
|
130
140
|
if (index !== null) setActiveIndex(index, {
|
|
@@ -135,13 +145,14 @@ const SelectInlineImpl = (props) => {
|
|
|
135
145
|
});
|
|
136
146
|
},
|
|
137
147
|
disabledIndices: registry.getDisabledIndices(),
|
|
138
|
-
scrollItemIntoView: false
|
|
148
|
+
scrollItemIntoView: false,
|
|
149
|
+
focusItemOnHover: false
|
|
139
150
|
}),
|
|
140
151
|
useTypeahead(interactionContext, {
|
|
141
152
|
listRef: listContentRef,
|
|
142
153
|
onMatch,
|
|
143
154
|
selectedIndex,
|
|
144
|
-
activeIndex:
|
|
155
|
+
activeIndex: null,
|
|
145
156
|
onTypingChange: (e) => {
|
|
146
157
|
state.current.isTyping = e;
|
|
147
158
|
}
|
|
@@ -152,7 +163,6 @@ const SelectInlineImpl = (props) => {
|
|
|
152
163
|
}, interactionsProps));
|
|
153
164
|
const interactionsContext = React.useMemo(() => {
|
|
154
165
|
return {
|
|
155
|
-
...interactions,
|
|
156
166
|
getReferenceProps(props2 = {}) {
|
|
157
167
|
return interactions.getReferenceProps({
|
|
158
168
|
...props2,
|
|
@@ -168,17 +178,7 @@ const SelectInlineImpl = (props) => {
|
|
|
168
178
|
getFloatingProps(props2) {
|
|
169
179
|
return interactions.getFloatingProps({
|
|
170
180
|
ref: refs.floating,
|
|
171
|
-
className: "Select",
|
|
172
181
|
...props2,
|
|
173
|
-
style: {
|
|
174
|
-
position: strategy,
|
|
175
|
-
top: y ?? "",
|
|
176
|
-
left: x ?? "",
|
|
177
|
-
outline: 0,
|
|
178
|
-
scrollbarWidth: "none",
|
|
179
|
-
...floatingStyle.current,
|
|
180
|
-
...props2?.style
|
|
181
|
-
},
|
|
182
182
|
onPointerEnter() {
|
|
183
183
|
setControlledScrolling(false);
|
|
184
184
|
state.current.isMouseOutside = false;
|
|
@@ -197,20 +197,24 @@ const SelectInlineImpl = (props) => {
|
|
|
197
197
|
onContextMenu(e) {
|
|
198
198
|
e.preventDefault();
|
|
199
199
|
},
|
|
200
|
-
onScroll
|
|
201
|
-
flushSync(() => {
|
|
202
|
-
setScrollTop(event.currentTarget.scrollTop);
|
|
203
|
-
});
|
|
204
|
-
}
|
|
200
|
+
onScroll: updateScrollArrows
|
|
205
201
|
});
|
|
206
202
|
}
|
|
207
203
|
};
|
|
208
204
|
}, [
|
|
209
|
-
refs
|
|
205
|
+
refs,
|
|
206
|
+
interactions,
|
|
207
|
+
requestOpenChange,
|
|
208
|
+
updateScrollArrows
|
|
209
|
+
]);
|
|
210
|
+
const floatingPosition = React.useMemo(() => ({
|
|
211
|
+
position: strategy,
|
|
212
|
+
top: y ?? "",
|
|
213
|
+
left: x ?? ""
|
|
214
|
+
}), [
|
|
215
|
+
strategy,
|
|
210
216
|
x,
|
|
211
|
-
y
|
|
212
|
-
refs.floating.current,
|
|
213
|
-
interactions
|
|
217
|
+
y
|
|
214
218
|
]);
|
|
215
219
|
useIsomorphicLayoutEffect(() => {
|
|
216
220
|
if (open) {
|
|
@@ -236,15 +240,15 @@ const SelectInlineImpl = (props) => {
|
|
|
236
240
|
if (!open) return;
|
|
237
241
|
const scrollActiveIntoView = (index) => {
|
|
238
242
|
if (controlledScrolling && index != null) listItemsRef.current[index]?.scrollIntoView({ block: "nearest" });
|
|
239
|
-
|
|
243
|
+
updateScrollArrows();
|
|
240
244
|
};
|
|
241
245
|
scrollActiveIntoView(activeIndexRef.current);
|
|
242
246
|
return selectItemParentContext.activeIndexSubscribe(scrollActiveIntoView);
|
|
243
247
|
}, [
|
|
244
248
|
open,
|
|
245
|
-
refs,
|
|
246
249
|
controlledScrolling,
|
|
247
|
-
selectItemParentContext.activeIndexSubscribe
|
|
250
|
+
selectItemParentContext.activeIndexSubscribe,
|
|
251
|
+
updateScrollArrows
|
|
248
252
|
]);
|
|
249
253
|
React.useEffect(() => {
|
|
250
254
|
if (open && fallback) {
|
|
@@ -265,10 +269,12 @@ const SelectInlineImpl = (props) => {
|
|
|
265
269
|
return /* @__PURE__ */ jsx(SelectProvider, {
|
|
266
270
|
scope,
|
|
267
271
|
...selectContext,
|
|
268
|
-
|
|
272
|
+
updateScrollArrows,
|
|
269
273
|
setInnerOffset,
|
|
270
274
|
fallback,
|
|
271
275
|
floatingContext,
|
|
276
|
+
interactions: interactionsContext,
|
|
277
|
+
floatingPosition,
|
|
272
278
|
canScrollDown: !!showDownArrow,
|
|
273
279
|
canScrollUp: !!showUpArrow,
|
|
274
280
|
controlledScrolling,
|
|
@@ -282,7 +288,7 @@ const SelectInlineImpl = (props) => {
|
|
|
282
288
|
allowMouseUpRef,
|
|
283
289
|
allowSelectRef,
|
|
284
290
|
dataRef,
|
|
285
|
-
|
|
291
|
+
getItemProps: interactions.getItemProps,
|
|
286
292
|
listRef: listItemsRef,
|
|
287
293
|
selectTimeoutRef,
|
|
288
294
|
children
|