{"version":3,"file":"SelectTrigger.js","names":[],"sources":["jsx/SelectTrigger.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { View, createChangeEventDetails, createStyledHOC, styled } from \"@tamagui/core\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport * as React from \"react\";\nimport { useSelectContext, useSelectItemParentContext } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst SelectTriggerFrame = styled(View, {\n\tdisplayName: \"SelectTrigger\",\n\talignItems: \"center\",\n\tflexDirection: \"row\",\n\trender: /* @__PURE__ */ jsx(\"button\", { type: \"button\" })\n});\nconst SelectTrigger = createStyledHOC(SelectTriggerFrame, function SelectTrigger2(propsIn, forwardedRef) {\n\tconst { scope, disabled = false, ...triggerProps } = propsIn;\n\tconst context = useSelectContext(scope);\n\tconst itemParentContext = useSelectItemParentContext(scope);\n\tconst composedRefs = useComposedRefs(forwardedRef, context.floatingContext?.refs.setReference);\n\tconst pressIsTouch = React.useRef(false);\n\tif (itemParentContext.shouldRenderWebNative) return null;\n\tconst toggleOpen = (event, reason = \"trigger-press\") => {\n\t\tif (!disabled) itemParentContext.requestOpenChange(!context.open, createChangeEventDetails(reason, event?.nativeEvent || event, event?.currentTarget));\n\t};\n\tconst interactionProps = context.interactions ? context.interactions.getReferenceProps({\n\t\t...triggerProps,\n\t\tonMouseDown: composeEventHandlers(triggerProps.onMouseDown, () => context.floatingContext?.update?.())\n\t}) : {\n\t\t...triggerProps,\n\t\t...isWeb ? {\n\t\t\tonMouseDown: composeEventHandlers(triggerProps.onMouseDown, (event) => {\n\t\t\t\tpressIsTouch.current = event.type === \"touchstart\";\n\t\t\t\tif (pressIsTouch.current) return;\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event);\n\t\t\t}),\n\t\t\tonPress: composeEventHandlers(triggerProps.onPress, (event) => {\n\t\t\t\tif (!pressIsTouch.current) return;\n\t\t\t\tpressIsTouch.current = false;\n\t\t\t\ttoggleOpen(event);\n\t\t\t})\n\t\t} : { onPress: composeEventHandlers(triggerProps.onPress, toggleOpen) },\n\t\tonKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {\n\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleOpen(event, \"keyboard\");\n\t\t\t}\n\t\t})\n\t};\n\treturn /* @__PURE__ */ jsx(SelectTriggerFrame, {\n\t\ttype: \"button\",\n\t\tid: itemParentContext.id,\n\t\trole: \"combobox\",\n\t\t\"aria-haspopup\": \"listbox\",\n\t\t\"aria-expanded\": context.open,\n\t\t\"data-state\": context.open ? \"open\" : \"closed\",\n\t\t\"aria-autocomplete\": \"none\",\n\t\taccessibilityRole: isWeb ? void 0 : \"button\",\n\t\taccessibilityState: isWeb ? void 0 : {\n\t\t\texpanded: context.open,\n\t\t\tdisabled\n\t\t},\n\t\tdir: context.dir,\n\t\tdisabled,\n\t\t\"data-disabled\": disabled ? \"\" : void 0,\n\t\t...interactionProps,\n\t\tref: composedRefs\n\t});\n});\n\nexport { SelectTrigger, SelectTriggerFrame };"],"mappings":";;;;;;;;;AAQA,MAAM,qBAAqB,OAAO,MAAM;CACvC,aAAa;CACb,YAAY;CACZ,eAAe;CACf,QAAwB,oBAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,CAAC;AACD,MAAM,gBAAgB,gBAAgB,oBAAoB,SAAS,eAAe,SAAS,cAAc;CACxG,MAAM,EAAE,OAAO,WAAW,OAAO,GAAG,iBAAiB;CACrD,MAAM,UAAU,iBAAiB,KAAK;CACtC,MAAM,oBAAoB,2BAA2B,KAAK;CAC1D,MAAM,eAAe,gBAAgB,cAAc,QAAQ,iBAAiB,KAAK,YAAY;CAC7F,MAAM,eAAe,MAAM,OAAO,KAAK;CACvC,IAAI,kBAAkB,uBAAuB,OAAO;CACpD,MAAM,cAAc,OAAO,SAAS,oBAAoB;EACvD,IAAI,CAAC,U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