@tamagui/select 3.0.0-beta.924.1 → 3.0.1
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 +67 -63
- 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 +9 -25
- 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 +29 -32
- 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 +68 -64
- 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 +10 -26
- 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 +30 -33
- 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 +68 -64
- 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 +10 -26
- 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 +30 -33
- 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 +107 -95
- package/src/SelectItem.tsx +66 -91
- package/src/SelectScrollButton.tsx +14 -32
- package/src/SelectTrigger.tsx +19 -2
- package/src/SelectViewport.native.tsx +4 -4
- package/src/SelectViewport.tsx +34 -30
- package/src/selectionController.ts +20 -5
- package/src/types.tsx +26 -22
- 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 -22
- package/types/types.d.ts.map +1 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { View, createStyledHOC, styled } from "@tamagui/core";
|
|
2
|
-
import { autoUpdate,
|
|
2
|
+
import { autoUpdate, useFloatingRaw } from "@tamagui/floating";
|
|
3
3
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
4
4
|
import { composeEventHandlers } from "@tamagui/helpers";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import { flushSync } from "react-dom";
|
|
7
6
|
import { useSelectContext } from "./context.mjs";
|
|
8
7
|
import { jsx } from "react/jsx-runtime";
|
|
9
8
|
|
|
@@ -31,53 +30,39 @@ SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
|
31
30
|
const SelectScrollButtonImpl = React.memo(createStyledHOC(SelectScrollButtonFrame, (props, forwardedRef) => {
|
|
32
31
|
const { scope, dir, partClassName, ...scrollIndicatorProps } = props;
|
|
33
32
|
const { className, onPointerEnter, onPointerLeave, ...frameProps } = scrollIndicatorProps;
|
|
34
|
-
const { open,
|
|
33
|
+
const { open, ...context } = useSelectContext(scope);
|
|
35
34
|
const floatingRef = context.floatingContext?.refs.floating;
|
|
36
|
-
const statusRef = React.useRef("idle");
|
|
37
35
|
const isVisible = context[dir === "down" ? "canScrollDown" : "canScrollUp"];
|
|
38
36
|
const frameRef = React.useRef(null);
|
|
37
|
+
const arrowRef = dir === "up" ? context.upArrowRef : context.downArrowRef;
|
|
39
38
|
const { x, y, refs, strategy } = useFloatingRaw({
|
|
40
39
|
open: open && isVisible,
|
|
41
40
|
strategy: "fixed",
|
|
42
41
|
elements: { reference: floatingRef?.current },
|
|
43
42
|
placement: dir === "up" ? "top" : "bottom",
|
|
44
|
-
|
|
45
|
-
whileElementsMounted: (...args) => autoUpdate(...args, { animationFrame: true })
|
|
43
|
+
whileElementsMounted: autoUpdate
|
|
46
44
|
});
|
|
47
45
|
const setFloatingRef = React.useCallback((node) => {
|
|
48
46
|
refs.setFloating(node);
|
|
49
|
-
|
|
47
|
+
if (arrowRef) arrowRef.current = node;
|
|
48
|
+
}, [refs.setFloating, arrowRef]);
|
|
50
49
|
const composedRef = useComposedRefs(forwardedRef, setFloatingRef);
|
|
51
50
|
React.useEffect(() => {
|
|
52
51
|
return () => cancelAnimationFrame(frameRef.current);
|
|
53
|
-
}, []);
|
|
54
|
-
if (!isVisible) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
const onScroll = (amount) => {
|
|
58
|
-
const floating = floatingRef;
|
|
59
|
-
if (!floating) return;
|
|
60
|
-
if (fallback) {
|
|
61
|
-
if (floating.current) {
|
|
62
|
-
floating.current.scrollTop -= amount;
|
|
63
|
-
flushSync(() => setScrollTop(floating.current?.scrollTop ?? 0));
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
flushSync(() => setInnerOffset((value) => value - amount));
|
|
67
|
-
}
|
|
68
|
-
};
|
|
52
|
+
}, [isVisible]);
|
|
69
53
|
return /* @__PURE__ */ jsx(SelectScrollButtonFrame, {
|
|
70
54
|
ref: composedRef,
|
|
71
55
|
className: `${partClassName} ${className || ""}`.trim(),
|
|
72
56
|
"aria-hidden": true,
|
|
73
57
|
...frameProps,
|
|
58
|
+
visibility: isVisible ? "visible" : "hidden",
|
|
59
|
+
pointerEvents: isVisible ? "auto" : "none",
|
|
74
60
|
zIndex: 1e3,
|
|
75
61
|
position: strategy,
|
|
76
62
|
left: x || 0,
|
|
77
63
|
top: y || 0,
|
|
78
64
|
width: `calc(${(floatingRef?.current?.offsetWidth ?? 0) - 2}px)`,
|
|
79
65
|
onPointerEnter: composeEventHandlers(onPointerEnter, () => {
|
|
80
|
-
statusRef.current = "active";
|
|
81
66
|
let prevNow = Date.now();
|
|
82
67
|
function frame() {
|
|
83
68
|
const element = floatingRef?.current;
|
|
@@ -88,7 +73,7 @@ const SelectScrollButtonImpl = React.memo(createStyledHOC(SelectScrollButtonFram
|
|
|
88
73
|
const pixelsToScroll = msElapsed / 2;
|
|
89
74
|
const remainingPixels = dir === "up" ? element.scrollTop : element.scrollHeight - element.clientHeight - element.scrollTop;
|
|
90
75
|
const scrollRemaining = dir === "up" ? element.scrollTop - pixelsToScroll > 0 : element.scrollTop + pixelsToScroll < element.scrollHeight - element.clientHeight;
|
|
91
|
-
|
|
76
|
+
element.scrollTop += dir === "up" ? -Math.min(pixelsToScroll, remainingPixels) : Math.min(pixelsToScroll, remainingPixels);
|
|
92
77
|
if (scrollRemaining) {
|
|
93
78
|
frameRef.current = requestAnimationFrame(frame);
|
|
94
79
|
}
|
|
@@ -98,7 +83,6 @@ const SelectScrollButtonImpl = React.memo(createStyledHOC(SelectScrollButtonFram
|
|
|
98
83
|
frameRef.current = requestAnimationFrame(frame);
|
|
99
84
|
}),
|
|
100
85
|
onPointerLeave: composeEventHandlers(onPointerLeave, () => {
|
|
101
|
-
statusRef.current = "idle";
|
|
102
86
|
cancelAnimationFrame(frameRef.current);
|
|
103
87
|
})
|
|
104
88
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectScrollButton.js","names":["useFloating"],"sources":["esm/SelectScrollButton.js"],"sourcesContent":["import { createStyledHOC, styled, View } from \"@tamagui/core\";\nimport { autoUpdate,
|
|
1
|
+
{"version":3,"file":"SelectScrollButton.js","names":["useFloating"],"sources":["esm/SelectScrollButton.js"],"sourcesContent":["import { createStyledHOC, styled, View } from \"@tamagui/core\";\nimport { autoUpdate, useFloatingRaw as useFloating } from \"@tamagui/floating\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport * as React from \"react\";\nimport { useSelectContext } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\nconst SCROLL_UP_BUTTON_NAME = \"SelectScrollUpButton\";\nconst SelectScrollButtonFrame = styled(View, {\n displayName: \"SelectScrollButton\"\n});\nconst SelectScrollUpButton = createStyledHOC(\n SelectScrollButtonFrame,\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(\n SelectScrollButtonImpl,\n {\n partClassName: `is_${SCROLL_UP_BUTTON_NAME}`,\n ...props,\n dir: \"up\",\n ref: forwardedRef\n }\n );\n }\n);\nSelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;\nconst SCROLL_DOWN_BUTTON_NAME = \"SelectScrollDownButton\";\nconst SelectScrollDownButton = createStyledHOC(\n SelectScrollButtonFrame,\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(\n SelectScrollButtonImpl,\n {\n partClassName: `is_${SCROLL_DOWN_BUTTON_NAME}`,\n ...props,\n dir: \"down\",\n ref: forwardedRef\n }\n );\n }\n);\nSelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;\nconst SelectScrollButtonImpl = React.memo(\n createStyledHOC(\n SelectScrollButtonFrame,\n (props, forwardedRef) => {\n const { scope, dir, partClassName, ...scrollIndicatorProps } = props;\n const { className, onPointerEnter, onPointerLeave, ...frameProps } = scrollIndicatorProps;\n const { open, ...context } = useSelectContext(scope);\n const floatingRef = context.floatingContext?.refs.floating;\n const isVisible = context[dir === \"down\" ? \"canScrollDown\" : \"canScrollUp\"];\n const frameRef = React.useRef(null);\n const arrowRef = dir === \"up\" ? context.upArrowRef : context.downArrowRef;\n const { x, y, refs, strategy } = useFloating({\n open: open && isVisible,\n strategy: \"fixed\",\n elements: {\n reference: floatingRef?.current\n },\n placement: dir === \"up\" ? \"top\" : \"bottom\",\n whileElementsMounted: autoUpdate\n });\n const setFloatingRef = React.useCallback(\n (node) => {\n refs.setFloating(node);\n if (arrowRef) arrowRef.current = node;\n },\n [refs.setFloating, arrowRef]\n );\n const composedRef = useComposedRefs(forwardedRef, setFloatingRef);\n React.useEffect(() => {\n return () => cancelAnimationFrame(frameRef.current);\n }, [isVisible]);\n return /* @__PURE__ */ jsx(\n SelectScrollButtonFrame,\n {\n ref: composedRef,\n className: `${partClassName} ${className || \"\"}`.trim(),\n \"aria-hidden\": true,\n ...frameProps,\n visibility: isVisible ? \"visible\" : \"hidden\",\n pointerEvents: isVisible ? \"auto\" : \"none\",\n zIndex: 1e3,\n position: strategy,\n left: x || 0,\n top: y || 0,\n width: `calc(${(floatingRef?.current?.offsetWidth ?? 0) - 2}px)`,\n onPointerEnter: composeEventHandlers(onPointerEnter, () => {\n let prevNow = Date.now();\n function frame() {\n const element = floatingRef?.current;\n if (element) {\n const currentNow = Date.now();\n const msElapsed = currentNow - prevNow;\n prevNow = currentNow;\n const pixelsToScroll = msElapsed / 2;\n const remainingPixels = dir === \"up\" ? element.scrollTop : element.scrollHeight - element.clientHeight - element.scrollTop;\n const scrollRemaining = dir === \"up\" ? element.scrollTop - pixelsToScroll > 0 : element.scrollTop + pixelsToScroll < element.scrollHeight - element.clientHeight;\n element.scrollTop += dir === \"up\" ? -Math.min(pixelsToScroll, remainingPixels) : Math.min(pixelsToScroll, remainingPixels);\n if (scrollRemaining) {\n frameRef.current = requestAnimationFrame(frame);\n }\n }\n }\n cancelAnimationFrame(frameRef.current);\n frameRef.current = requestAnimationFrame(frame);\n }),\n onPointerLeave: composeEventHandlers(onPointerLeave, () => {\n cancelAnimationFrame(frameRef.current);\n })\n }\n );\n }\n )\n);\nexport {\n SelectScrollButtonFrame,\n SelectScrollDownButton,\n SelectScrollUpButton\n};\n//# sourceMappingURL=SelectScrollButton.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,wBAAwB;AAC9B,MAAM,0BAA0B,OAAO,MAAM,EAC3C,aAAa,qBACf,CAAC;AACD,MAAM,uBAAuB,gBAC3B,0BACC,OAAO,iBAAiB;CACvB,OAAuB,oBACrB,wBACA;EACE,eAAe,MAAM;EACrB,GAAG;EACH,KAAK;EACL,KAAK;CACP,CACF;AACF,CACF;AACA,qBAAqB,cAAc;AACnC,MAAM,0BAA0B;AAChC,MAAM,yBAAyB,gBAC7B,0BACC,OAAO,iBAAiB;CACvB,OAAuB,oBACrB,wBACA;EACE,eAAe,MAAM;EACrB,GAAG;EACH,KAAK;EACL,KAAK;CACP,CACF;AACF,CACF;AACA,uBAAuB,cAAc;AACrC,MAAM,yBAAyB,MAAM,KACnC,gBACE,0BACC,OAAO,iBAAiB;CACvB,MAAM,EAAE,OAAO,KAAK,eAAe,GAAG,yBAAyB;CAC/D,MAAM,EAAE,WAAW,gBAAgB,gBAAgB,GAAG,eAAe;CACrE,MAAM,EAAE,MAAM,GAAG,YAAY,iBAAiB,KAAK;CACnD,MAAM,cAAc,QAAQ,iBAAiB,KAAK;CAClD,MAAM,YAAY,QAAQ,QAAQ,SAAS,kBAAkB;CAC7D,MAAM,WAAW,MAAM,OAAO,IAAI;CAClC,MAAM,WAAW,QAAQ,OAAO,QAAQ,aAAa,QAAQ;CAC7D,MAAM,EAAE,GAAG,GAAG,MAAM,aAAaA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AAO;GACrC,SAAS,UAAU,sBAAsB,KAAK;EAChD,CAAC;EACD,gBAAgB,qBAAqB,sBAAsB;GACzD,qBAAqB,SAAS,OAAO;EACvC,CAAC;CACH,CACF;AACF,CACF,CACF"}
|
|
@@ -2,6 +2,7 @@ import { useComposedRefs } from "@tamagui/compose-refs";
|
|
|
2
2
|
import { isWeb } from "@tamagui/constants";
|
|
3
3
|
import { View, createChangeEventDetails, createStyledHOC, styled } from "@tamagui/core";
|
|
4
4
|
import { composeEventHandlers } from "@tamagui/helpers";
|
|
5
|
+
import * as React from "react";
|
|
5
6
|
import { useSelectContext, useSelectItemParentContext } from "./context.mjs";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
|
|
@@ -16,19 +17,29 @@ const SelectTrigger = createStyledHOC(SelectTriggerFrame, function SelectTrigger
|
|
|
16
17
|
const context = useSelectContext(scope);
|
|
17
18
|
const itemParentContext = useSelectItemParentContext(scope);
|
|
18
19
|
const composedRefs = useComposedRefs(forwardedRef, context.floatingContext?.refs.setReference);
|
|
20
|
+
const pressIsTouch = React.useRef(false);
|
|
19
21
|
if (itemParentContext.shouldRenderWebNative) return null;
|
|
20
22
|
const toggleOpen = (event, reason = "trigger-press") => {
|
|
21
23
|
if (!disabled) itemParentContext.requestOpenChange(!context.open, createChangeEventDetails(reason, event?.nativeEvent || event, event?.currentTarget));
|
|
22
24
|
};
|
|
23
|
-
const interactionProps =
|
|
25
|
+
const interactionProps = context.interactions ? context.interactions.getReferenceProps({
|
|
24
26
|
...triggerProps,
|
|
25
27
|
onMouseDown: composeEventHandlers(triggerProps.onMouseDown, () => context.floatingContext?.update?.())
|
|
26
28
|
}) : {
|
|
27
29
|
...triggerProps,
|
|
28
|
-
...isWeb ? {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
...isWeb ? {
|
|
31
|
+
onMouseDown: composeEventHandlers(triggerProps.onMouseDown, (event) => {
|
|
32
|
+
pressIsTouch.current = event.type === "touchstart";
|
|
33
|
+
if (pressIsTouch.current) return;
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
toggleOpen(event);
|
|
36
|
+
}),
|
|
37
|
+
onPress: composeEventHandlers(triggerProps.onPress, (event) => {
|
|
38
|
+
if (!pressIsTouch.current) return;
|
|
39
|
+
pressIsTouch.current = false;
|
|
40
|
+
toggleOpen(event);
|
|
41
|
+
})
|
|
42
|
+
} : { onPress: composeEventHandlers(triggerProps.onPress, toggleOpen) },
|
|
32
43
|
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
33
44
|
if (event.key === "Enter" || event.key === " ") {
|
|
34
45
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTrigger.js","names":[],"sources":["esm/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 { 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(props, forwardedRef) {\n\tconst { scope, disabled = false, ...triggerProps } = props;\n\tconst context = useSelectContext(scope);\n\tconst itemParentContext = useSelectItemParentContext(scope);\n\tconst composedRefs = useComposedRefs(forwardedRef, context.floatingContext?.refs.setReference);\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 =
|
|
1
|
+
{"version":3,"file":"SelectTrigger.js","names":[],"sources":["esm/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(props, forwardedRef) {\n\tconst { scope, disabled = false, ...triggerProps } = props;\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,OAAO,cAAc;CACtG,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,UAAU,kBAAkB,kBAAkB,CAAC,QAAQ,MAAM,yBAAyB,QAAQ,OAAO,eAAe,OAAO,OAAO,aAAa,CAAC;CACtJ;CACA,MAAM,mBAAmB,QAAQ,eAAe,QAAQ,aAAa,kBAAkB;EACtF,GAAG;EACH,aAAa,qBAAqB,aAAa,mBAAmB,QAAQ,iBAAiB,SAAS,CAAC;CACtG,CAAC,IAAI;EACJ,GAAG;EACH,GAAG,QAAQ;GACV,aAAa,qBAAqB,aAAa,cAAc,UAAU;IACtE,aAAa,UAAU,MAAM,SAAS;IACtC,IAAI,aAAa,SAAS;IAC1B,MAAM,eAAe;IACrB,WAAW,KAAK;GACjB,CAAC;GACD,SAAS,qBAAqB,aAAa,UAAU,UAAU;IAC9D,IAAI,CAAC,aAAa,SAAS;IAC3B,aAAa,UAAU;IACvB,WAAW,KAAK;GACjB,CAAC;EACF,IAAI,EAAE,SAAS,qBAAqB,aAAa,SAAS,UAAU,EAAE;EACtE,WAAW,qBAAqB,aAAa,YAAY,UAAU;GAClE,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;IAC/C,MAAM,eAAe;IACrB,WAAW,OAAO,UAAU;GAC7B;EACD,CAAC;CACF;CACA,OAAuB,oBAAI,oBAAoB;EAC9C,MAAM;EACN,IAAI,kBAAkB;EACtB,MAAM;EACN,iBAAiB;EACjB,iBAAiB,QAAQ;EACzB,cAAc,QAAQ,OAAO,SAAS;EACtC,qBAAqB;EACrB,mBAAmB,QAAQ,KAAK,IAAI;EACpC,oBAAoB,QAAQ,KAAK,IAAI;GACpC,UAAU,QAAQ;GAClB;EACD;EACA,KAAK,QAAQ;EACb;EACA,iBAAiB,WAAW,KAAK,KAAK;EACtC,GAAG;EACH,KAAK;CACN,CAAC;AACF,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useComposedRefs } from "@tamagui/compose-refs";
|
|
|
3
3
|
import { isWeb } from "@tamagui/constants";
|
|
4
4
|
import { View, createChangeEventDetails, createStyledHOC, styled } from "@tamagui/core";
|
|
5
5
|
import { composeEventHandlers } from "@tamagui/helpers";
|
|
6
|
+
import * as React from "react";
|
|
6
7
|
import { useSelectContext, useSelectItemParentContext } from "./context.native.js";
|
|
7
8
|
|
|
8
9
|
var SelectTriggerFrame = styled(View, {
|
|
@@ -17,6 +18,7 @@ var SelectTrigger = createStyledHOC(SelectTriggerFrame, function SelectTrigger2(
|
|
|
17
18
|
var context = useSelectContext(scope);
|
|
18
19
|
var itemParentContext = useSelectItemParentContext(scope);
|
|
19
20
|
var composedRefs = useComposedRefs(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);
|
|
21
|
+
var pressIsTouch = React.useRef(false);
|
|
20
22
|
if (itemParentContext.shouldRenderWebNative) return null;
|
|
21
23
|
var toggleOpen = function(event) {
|
|
22
24
|
var reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "trigger-press";
|
|
@@ -24,10 +26,19 @@ var SelectTrigger = createStyledHOC(SelectTriggerFrame, function SelectTrigger2(
|
|
|
24
26
|
};
|
|
25
27
|
var interactionProps = {
|
|
26
28
|
...triggerProps,
|
|
27
|
-
...isWeb ? {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
...isWeb ? {
|
|
30
|
+
onMouseDown: composeEventHandlers(triggerProps.onMouseDown, function(event) {
|
|
31
|
+
pressIsTouch.current = event.type === "touchstart";
|
|
32
|
+
if (pressIsTouch.current) return;
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
toggleOpen(event);
|
|
35
|
+
}),
|
|
36
|
+
onPress: composeEventHandlers(triggerProps.onPress, function(event) {
|
|
37
|
+
if (!pressIsTouch.current) return;
|
|
38
|
+
pressIsTouch.current = false;
|
|
39
|
+
toggleOpen(event);
|
|
40
|
+
})
|
|
41
|
+
} : { onPress: composeEventHandlers(triggerProps.onPress, toggleOpen) },
|
|
31
42
|
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, function(event) {
|
|
32
43
|
if (event.key === "Enter" || event.key === " ") {
|
|
33
44
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTrigger.native.js","names":[],"sources":["esm/SelectTrigger.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { View, createChangeEventDetails, createStyledHOC, styled } from \"@tamagui/core\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\
|
|
1
|
+
{"version":3,"file":"SelectTrigger.native.js","names":[],"sources":["esm/SelectTrigger.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { 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\";\n\nvar SelectTriggerFrame = styled(View, {\n\tdisplayName: \"SelectTrigger\",\n\talignItems: \"center\",\n\tflexDirection: \"row\",\n\trender: /* @__PURE__ */ jsx(\"button\", { type: \"button\" })\n});\nvar SelectTrigger = createStyledHOC(SelectTriggerFrame, function SelectTrigger2(props, forwardedRef) {\n\tvar _context_floatingContext;\n\tvar { scope, disabled = false, ...triggerProps } = props;\n\tvar context = useSelectContext(scope);\n\tvar itemParentContext = useSelectItemParentContext(scope);\n\tvar composedRefs = useComposedRefs(forwardedRef, (_context_floatingContext = context.floatingContext) === null || _context_floatingContext === void 0 ? void 0 : _context_floatingContext.refs.setReference);\n\tvar pressIsTouch = React.useRef(false);\n\tif (itemParentContext.shouldRenderWebNative) return null;\n\tvar toggleOpen = function(event) {\n\t\tvar reason = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"trigger-press\";\n\t\tif (!disabled) itemParentContext.requestOpenChange(!context.open, createChangeEventDetails(reason, (event === null || event === void 0 ? void 0 : event.nativeEvent) || event, event === null || event === void 0 ? void 0 : event.currentTarget));\n\t};\n\tvar interactionProps = {\n\t\t...triggerProps,\n\t\t...isWeb ? {\n\t\t\tonMouseDown: composeEventHandlers(triggerProps.onMouseDown, function(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, function(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, function(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\"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,IAAI,qBAAqB,OAAO,MAAM;CACrC,aAAa;CACb,YAAY;CACZ,eAAe;CACf,QAAwB,oBAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,CAAC;AACD,IAAI,gBAAgB,gBAAgB,oB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AM;EACN,IAAI,kBAAkB;EACtB,MAAM;EACN,iBAAiB;EACjB,iBAAiB,QAAQ;EACzB,qBAAqB;EACrB,mBAAmB,QAAQ,KAAK,IAAI;EACpC,oBAAoB,QAAQ,KAAK,IAAI;GACpC,UAAU,QAAQ;GAClB;EACD;EACA,KAAK,QAAQ;EACb;EACA,iBAAiB,WAAW,KAAK,KAAK;EACtC,GAAG;EACH,KAAK;CACN,CAAC;AACF,CAAC"}
|
|
@@ -2,10 +2,9 @@ import { AdaptPortalContents, useAdaptIsActive } from "@tamagui/adapt";
|
|
|
2
2
|
import { AnimatePresence } from "@tamagui/animate-presence";
|
|
3
3
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
4
4
|
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
5
|
-
import { View, createStyledHOC, styled } from "@tamagui/core";
|
|
5
|
+
import { View, createStyledHOC, splitStyleProps, styled } from "@tamagui/core";
|
|
6
6
|
import { needsPortalRepropagation } from "@tamagui/portal";
|
|
7
7
|
import { YStack } from "@tamagui/stacks";
|
|
8
|
-
import { startTransition } from "@tamagui/start-transition";
|
|
9
8
|
import * as React from "react";
|
|
10
9
|
import { VIEWPORT_NAME } from "./constants.mjs";
|
|
11
10
|
import { ForwardSelectContext, useSelectContext, useSelectItemParentContext } from "./context.mjs";
|
|
@@ -17,6 +16,10 @@ const SelectViewportFrame = styled(View, {
|
|
|
17
16
|
position: "relative"
|
|
18
17
|
});
|
|
19
18
|
const needsRepropagation = needsPortalRepropagation();
|
|
19
|
+
const getSheetFrameProps = (props) => {
|
|
20
|
+
const { className, style, "data-tamagui-hoc-class": _hocClassNames, ...rest } = props;
|
|
21
|
+
return splitStyleProps(rest)[1];
|
|
22
|
+
};
|
|
20
23
|
const SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {
|
|
21
24
|
const { scope, children, disableScroll, ...viewportProps } = props;
|
|
22
25
|
const context = useSelectContext(scope);
|
|
@@ -24,19 +27,9 @@ const SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewp
|
|
|
24
27
|
const isAdapted = useAdaptIsActive(context.adaptScope);
|
|
25
28
|
const viewportRef = React.useRef(null);
|
|
26
29
|
const registeredItemCount = itemContext.registry.getItems().length;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!context.open) return;
|
|
31
|
-
if (lazyMounted) return;
|
|
32
|
-
startTransition(() => {
|
|
33
|
-
setLazyMounted(true);
|
|
34
|
-
});
|
|
35
|
-
}, [
|
|
36
|
-
context.lazyMount,
|
|
37
|
-
context.open,
|
|
38
|
-
lazyMounted
|
|
39
|
-
]);
|
|
30
|
+
const hasOpenedRef = React.useRef(!context.lazyMount);
|
|
31
|
+
if (context.open) hasOpenedRef.current = true;
|
|
32
|
+
const lazyMounted = hasOpenedRef.current;
|
|
40
33
|
React.useEffect(() => {
|
|
41
34
|
if (!isWeb || !isAdapted || !context.open) return;
|
|
42
35
|
const frame = requestAnimationFrame(() => {
|
|
@@ -46,7 +39,6 @@ const SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewp
|
|
|
46
39
|
});
|
|
47
40
|
return () => cancelAnimationFrame(frame);
|
|
48
41
|
}, [
|
|
49
|
-
context.activeIndex,
|
|
50
42
|
context.open,
|
|
51
43
|
isAdapted,
|
|
52
44
|
registeredItemCount
|
|
@@ -58,11 +50,11 @@ const SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewp
|
|
|
58
50
|
}
|
|
59
51
|
}, [isAdapted]);
|
|
60
52
|
React.useEffect(() => {
|
|
61
|
-
if (context.lazyMount &&
|
|
53
|
+
if (context.lazyMount && context.open && context.update) {
|
|
62
54
|
const frame = requestAnimationFrame(context.update);
|
|
63
55
|
return () => cancelAnimationFrame(frame);
|
|
64
56
|
}
|
|
65
|
-
}, [
|
|
57
|
+
}, [context.open, registeredItemCount]);
|
|
66
58
|
if (itemContext.shouldRenderWebNative) {
|
|
67
59
|
return /* @__PURE__ */ jsx(YStack, {
|
|
68
60
|
position: "relative",
|
|
@@ -70,8 +62,9 @@ const SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewp
|
|
|
70
62
|
});
|
|
71
63
|
}
|
|
72
64
|
if (isAdapted || !isWeb) {
|
|
65
|
+
const frameProps = isAdapted ? getSheetFrameProps(viewportProps) : viewportProps;
|
|
73
66
|
let content = /* @__PURE__ */ jsx(SelectViewportFrame, {
|
|
74
|
-
...
|
|
67
|
+
...frameProps,
|
|
75
68
|
...isWeb ? getSelectListboxProps(itemContext.mode) : {},
|
|
76
69
|
"data-select-viewport": "",
|
|
77
70
|
ref: composedRefs,
|
|
@@ -89,23 +82,27 @@ const SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewp
|
|
|
89
82
|
children: content
|
|
90
83
|
});
|
|
91
84
|
}
|
|
92
|
-
if (!
|
|
85
|
+
if (!context.interactions) {
|
|
93
86
|
return null;
|
|
94
87
|
}
|
|
95
|
-
const
|
|
88
|
+
const floatingProps = context.interactions.getFloatingProps();
|
|
96
89
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
90
|
!disableScroll && /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: selectViewportCSS } }),
|
|
98
|
-
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
92
|
+
presenceAffectsLayout: false,
|
|
93
|
+
children: context.open ? /* @__PURE__ */ jsx(SelectViewportFrame, {
|
|
94
|
+
"data-select-viewport": "",
|
|
95
|
+
...isWeb && { "data-state": context.open ? "open" : "closed" },
|
|
96
|
+
...viewportProps,
|
|
97
|
+
...context.floatingPosition,
|
|
98
|
+
outlineWidth: 0,
|
|
99
|
+
...floatingProps,
|
|
100
|
+
...getSelectListboxProps(itemContext.mode),
|
|
101
|
+
overflowY: disableScroll ? void 0 : "auto",
|
|
102
|
+
ref: composedRefs,
|
|
103
|
+
children: lazyMounted ? children : null
|
|
104
|
+
}, "select-viewport") : null
|
|
105
|
+
}),
|
|
109
106
|
!context.open && !(context.lazyMount && context.renderValue) && lazyMounted && /* @__PURE__ */ jsx("div", {
|
|
110
107
|
style: { display: "none" },
|
|
111
108
|
children
|
|
@@ -116,7 +113,7 @@ const selectViewportCSS = `
|
|
|
116
113
|
[data-select-viewport] {
|
|
117
114
|
scrollbar-width: none;
|
|
118
115
|
-webkit-overflow-scrolling: touch;
|
|
119
|
-
overscroll-behavior:
|
|
116
|
+
overscroll-behavior: none;
|
|
120
117
|
}
|
|
121
118
|
|
|
122
119
|
[data-select-viewport]::-webkit-scrollbar{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectViewport.js","names":[],"sources":["esm/SelectViewport.js"],"sourcesContent":["import { AdaptPortalContents, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { AnimatePresence } from \"@tamagui/animate-presence\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createStyledHOC, styled, View } from \"@tamagui/core\";\nimport { needsPortalRepropagation } from \"@tamagui/portal\";\nimport { YStack } from \"@tamagui/stacks\";\nimport
|
|
1
|
+
{"version":3,"file":"SelectViewport.js","names":[],"sources":["esm/SelectViewport.js"],"sourcesContent":["import { AdaptPortalContents, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { AnimatePresence } from \"@tamagui/animate-presence\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createStyledHOC, splitStyleProps, styled, View } from \"@tamagui/core\";\nimport { needsPortalRepropagation } from \"@tamagui/portal\";\nimport { YStack } from \"@tamagui/stacks\";\nimport * as React from \"react\";\nimport { VIEWPORT_NAME } from \"./constants\";\nimport {\n ForwardSelectContext,\n useSelectContext,\n useSelectItemParentContext\n} from \"./context\";\nimport { getSelectListboxProps } from \"./selectionController\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst SelectViewportFrame = styled(View, {\n displayName: VIEWPORT_NAME,\n position: \"relative\"\n});\nconst needsRepropagation = needsPortalRepropagation();\nconst getSheetFrameProps = (props) => {\n const { className, style, \"data-tamagui-hoc-class\": _hocClassNames, ...rest } = props;\n return splitStyleProps(rest)[1];\n};\nconst SelectViewport = createStyledHOC(\n SelectViewportFrame,\n function SelectViewport2(props, forwardedRef) {\n const { scope, children, disableScroll, ...viewportProps } = props;\n const context = useSelectContext(scope);\n const itemContext = useSelectItemParentContext(scope);\n const isAdapted = useAdaptIsActive(context.adaptScope);\n const viewportRef = React.useRef(null);\n const registeredItemCount = itemContext.registry.getItems().length;\n const hasOpenedRef = React.useRef(!context.lazyMount);\n if (context.open) hasOpenedRef.current = true;\n const lazyMounted = hasOpenedRef.current;\n React.useEffect(() => {\n if (!isWeb || !isAdapted || !context.open) return;\n const frame = requestAnimationFrame(() => {\n const index = context.activeIndexRef.current ?? itemContext.registry.firstEnabledIndex();\n const activeItem = viewportRef.current?.querySelector(\n '[role=\"option\"][tabindex=\"0\"]'\n ) ?? (index >= 0 ? itemContext.listRef?.current[index] : null);\n activeItem?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, [context.open, isAdapted, registeredItemCount]);\n const composedRefs = useComposedRefs(\n // @ts-ignore react 19 ref type mismatch\n forwardedRef,\n viewportRef,\n context.floatingContext?.refs.setFloating\n );\n useIsomorphicLayoutEffect(() => {\n if (context.update) {\n context.update();\n }\n }, [isAdapted]);\n React.useEffect(() => {\n if (context.lazyMount && context.open && context.update) {\n const frame = requestAnimationFrame(context.update);\n return () => cancelAnimationFrame(frame);\n }\n }, [context.open, registeredItemCount]);\n if (itemContext.shouldRenderWebNative) {\n return /* @__PURE__ */ jsx(YStack, { position: \"relative\", children });\n }\n if (isAdapted || !isWeb) {\n const frameProps = isAdapted ? getSheetFrameProps(viewportProps) : viewportProps;\n let content = /* @__PURE__ */ jsx(\n SelectViewportFrame,\n {\n ...frameProps,\n ...isWeb ? getSelectListboxProps(itemContext.mode) : {},\n \"data-select-viewport\": \"\",\n ref: composedRefs,\n children: lazyMounted ? children : null\n }\n );\n if (needsRepropagation) {\n content = /* @__PURE__ */ jsx(ForwardSelectContext, { itemContext, context, children: content });\n }\n return /* @__PURE__ */ jsx(AdaptPortalContents, { scope: context.adaptScope, children: content });\n }\n if (!context.interactions) {\n return null;\n }\n const floatingProps = context.interactions.getFloatingProps();\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n !disableScroll && /* @__PURE__ */ jsx(\n \"style\",\n {\n dangerouslySetInnerHTML: {\n __html: selectViewportCSS\n }\n }\n ),\n /* @__PURE__ */ jsx(AnimatePresence, { presenceAffectsLayout: false, children: context.open ? /* @__PURE__ */ jsx(\n SelectViewportFrame,\n {\n \"data-select-viewport\": \"\",\n ...isWeb && {\n \"data-state\": context.open ? \"open\" : \"closed\"\n },\n ...viewportProps,\n ...context.floatingPosition,\n outlineWidth: 0,\n ...floatingProps,\n ...getSelectListboxProps(itemContext.mode),\n overflowY: disableScroll ? void 0 : \"auto\",\n ref: composedRefs,\n children: lazyMounted ? children : null\n },\n \"select-viewport\"\n ) : null }),\n !context.open && !(context.lazyMount && context.renderValue) && lazyMounted && /* @__PURE__ */ jsx(\"div\", { style: { display: \"none\" }, children })\n ] });\n }\n);\nconst selectViewportCSS = `\n[data-select-viewport] {\n scrollbar-width: none;\n -webkit-overflow-scrolling: touch;\n overscroll-behavior: none;\n}\n\n[data-select-viewport]::-webkit-scrollbar{\n display:none\n}\n`;\nexport {\n SelectViewport,\n SelectViewportFrame\n};\n//# sourceMappingURL=SelectViewport.js.map\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,sBAAsB,OAAO,MAAM;CACvC,aAAa;CACb,UAAU;AACZ,CAAC;AACD,M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AoB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { AdaptPortalContents, ProvideAdaptContext, useAdaptContext, useAdaptIsActive } from "@tamagui/adapt";
|
|
3
3
|
import { Theme, View, createStyledHOC, styled, useThemeName } from "@tamagui/core";
|
|
4
4
|
import { VIEWPORT_NAME } from "./constants.native.js";
|
|
5
5
|
import { ForwardSelectContext, useSelectContext, useSelectItemParentContext } from "./context.native.js";
|
|
@@ -13,14 +13,14 @@ var SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewpor
|
|
|
13
13
|
var context = useSelectContext(scope);
|
|
14
14
|
var itemParentContext = useSelectItemParentContext(scope);
|
|
15
15
|
var themeName = useThemeName();
|
|
16
|
-
var adaptContext = useAdaptContext();
|
|
16
|
+
var adaptContext = useAdaptContext(context.adaptScope);
|
|
17
17
|
var isAdapted = useAdaptIsActive(context.adaptScope);
|
|
18
18
|
var contents = /* @__PURE__ */ jsx(Theme, {
|
|
19
19
|
name: themeName,
|
|
20
20
|
children: /* @__PURE__ */ jsx(ForwardSelectContext, {
|
|
21
21
|
itemContext: itemParentContext,
|
|
22
22
|
context,
|
|
23
|
-
children: /* @__PURE__ */ jsx(
|
|
23
|
+
children: /* @__PURE__ */ jsx(ProvideAdaptContext, {
|
|
24
24
|
...adaptContext,
|
|
25
25
|
children: /* @__PURE__ */ jsx(SelectViewportFrame, {
|
|
26
26
|
...viewportProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectViewport.native.js","names":[],"sources":["esm/SelectViewport.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport {
|
|
1
|
+
{"version":3,"file":"SelectViewport.native.js","names":[],"sources":["esm/SelectViewport.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { AdaptPortalContents, ProvideAdaptContext, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { createStyledHOC, styled, Theme, useThemeName, View } from \"@tamagui/core\";\nimport { VIEWPORT_NAME } from \"./constants\";\nimport { ForwardSelectContext, useSelectContext, useSelectItemParentContext } from \"./context\";\nvar SelectViewportFrame = styled(View, {\n displayName: VIEWPORT_NAME,\n position: \"relative\"\n});\nvar SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {\n var { scope, children, disableScroll: _disableScroll, ...viewportProps } = props;\n var context = useSelectContext(scope);\n var itemParentContext = useSelectItemParentContext(scope);\n var themeName = useThemeName();\n var adaptContext = useAdaptContext(context.adaptScope);\n var isAdapted = useAdaptIsActive(context.adaptScope);\n var contents = /* @__PURE__ */ _jsx(Theme, {\n name: themeName,\n children: /* @__PURE__ */ _jsx(ForwardSelectContext, {\n itemContext: itemParentContext,\n context,\n children: /* @__PURE__ */ _jsx(ProvideAdaptContext, {\n ...adaptContext,\n children: /* @__PURE__ */ _jsx(SelectViewportFrame, {\n ...viewportProps,\n ref: forwardedRef,\n children\n })\n })\n })\n });\n if (!context.open) {\n if (context.lazyMount && context.renderValue) return null;\n return /* @__PURE__ */ _jsx(SelectViewportFrame, {\n display: \"none\",\n children: contents\n });\n }\n return isAdapted ? /* @__PURE__ */ _jsx(AdaptPortalContents, {\n scope: context.adaptScope,\n children: contents\n }) : contents;\n});\nSelectViewport.displayName = VIEWPORT_NAME;\nexport {\n SelectViewport,\n SelectViewportFrame\n};\n//# sourceMappingURL=SelectViewport.native.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,sBAAsB,OAAO,MAAM;CACrC,aAAa;CACb,UAAU;AACZ,CAAC;AACD,IAAI,iBAAiB,gBAAgB,qBAAqB,SAAS,gBAAgB,OAAO,cAAc;CACtG,IAAI,EAAE,OAAO,UAAU,eAAe,gBAAgB,GAAG,kBAAkB;CAC3E,IAAI,UAAU,iBAAiB,KAAK;CACpC,IAAI,oBAAoB,2BAA2B,KAAK;CACxD,IAAI,YAAY,aAAa;CAC7B,IAAI,eAAe,gBAAgB,QAAQ,UAAU;CACrD,IAAI,YAAY,iBAAiB,QAAQ,UAAU;CACnD,IAAI,WAA2B,oBAAK,OAAO;EACzC,MAAM;EACN,UAA0B,oBAAK,sBAAsB;GACnD,aAAa;GACb;GACA,UAA0B,oBAAK,qBAAqB;IAClD,GAAG;IACH,UAA0B,oBAAK,qBAAqB;KAClD,GAAG;KACH,KAAK;KACL;IACF,CAAC;GACH,CAAC;EACH,CAAC;CACH,CAAC;CACD,IAAI,CAAC,QAAQ,MAAM;EACjB,IAAI,QAAQ,aAAa,QAAQ,aAAa,OAAO;EACrD,OAAuB,oBAAK,qBAAqB;GAC/C,SAAS;GACT,UAAU;EACZ,CAAC;CACH;CACA,OAAO,YAA4B,oBAAK,qBAAqB;EAC3D,OAAO,QAAQ;EACf,UAAU;CACZ,CAAC,IAAI;AACP,CAAC;AACD,eAAe,cAAc"}
|
|
@@ -16,13 +16,24 @@ function createSelectItemRegistry(onChange) {
|
|
|
16
16
|
const explicitTextValues = /* @__PURE__ */ new Map();
|
|
17
17
|
const itemNodes = /* @__PURE__ */ new Map();
|
|
18
18
|
const listeners = /* @__PURE__ */ new Set();
|
|
19
|
+
let indexByValue = null;
|
|
19
20
|
const notify = () => {
|
|
21
|
+
indexByValue = null;
|
|
20
22
|
onChange?.();
|
|
21
23
|
listeners.forEach((listener) => listener());
|
|
22
24
|
};
|
|
23
25
|
const getItems = () => items;
|
|
24
26
|
const getItem = (value) => items.find((item) => item.value === value);
|
|
25
|
-
const getIndex = (value) =>
|
|
27
|
+
const getIndex = (value) => {
|
|
28
|
+
if (!indexByValue) {
|
|
29
|
+
indexByValue = /* @__PURE__ */ new Map();
|
|
30
|
+
items.forEach((item, index) => {
|
|
31
|
+
if (!indexByValue.has(item.value)) indexByValue.set(item.value, index);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return indexByValue.get(value) ?? -1;
|
|
35
|
+
};
|
|
36
|
+
const getNodes = () => items.map((item) => itemNodes.get(item.id) ?? null);
|
|
26
37
|
const getRegisteredLabel = (value) => {
|
|
27
38
|
const registrations = labelRegistrations.get(value);
|
|
28
39
|
if (!registrations?.size) return void 0;
|
|
@@ -45,7 +56,6 @@ function createSelectItemRegistry(onChange) {
|
|
|
45
56
|
if (changed) notify();
|
|
46
57
|
};
|
|
47
58
|
const syncNodeOrder = () => {
|
|
48
|
-
const previousOrder = items.map((item) => item.id);
|
|
49
59
|
items.sort((a, b) => {
|
|
50
60
|
const aNode = itemNodes.get(a.id);
|
|
51
61
|
const bNode = itemNodes.get(b.id);
|
|
@@ -57,9 +67,6 @@ function createSelectItemRegistry(onChange) {
|
|
|
57
67
|
if (position & 2) return 1;
|
|
58
68
|
return 0;
|
|
59
69
|
});
|
|
60
|
-
if (items.some((item, index) => item.id !== previousOrder[index])) {
|
|
61
|
-
notify();
|
|
62
|
-
}
|
|
63
70
|
};
|
|
64
71
|
const registerItem = (item) => {
|
|
65
72
|
const id = Symbol(item.value);
|
|
@@ -99,12 +106,14 @@ function createSelectItemRegistry(onChange) {
|
|
|
99
106
|
notify();
|
|
100
107
|
},
|
|
101
108
|
setNode(node) {
|
|
109
|
+
if ((itemNodes.get(id) ?? null) === (node ?? null)) return;
|
|
102
110
|
if (node) {
|
|
103
111
|
itemNodes.set(id, node);
|
|
104
112
|
syncNodeOrder();
|
|
105
113
|
} else {
|
|
106
114
|
itemNodes.delete(id);
|
|
107
115
|
}
|
|
116
|
+
notify();
|
|
108
117
|
},
|
|
109
118
|
unregister() {
|
|
110
119
|
const index = items.findIndex((current) => current.id === id);
|
|
@@ -179,6 +188,7 @@ function createSelectItemRegistry(onChange) {
|
|
|
179
188
|
getItems,
|
|
180
189
|
getItem,
|
|
181
190
|
getIndex,
|
|
191
|
+
getNodes,
|
|
182
192
|
firstEnabledIndex,
|
|
183
193
|
nextEnabledIndex,
|
|
184
194
|
findTypeaheadIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionController.js","names":[],"sources":["esm/selectionController.js"],"sourcesContent":["function getSelectLabelText(label) {\n if (typeof label === \"string\" || typeof label === \"number\") {\n return String(label);\n }\n if (Array.isArray(label)) {\n return label.map(getSelectLabelText).join(\"\");\n }\n if (label && typeof label === \"object\" && \"props\" in label) {\n return getSelectLabelText(label.props?.children);\n }\n return \"\";\n}\nfunction createSelectItemRegistry(onChange) {\n const items = [];\n const labelRegistrations = /* @__PURE__ */ new Map();\n const explicitTextValues = /* @__PURE__ */ new Map();\n const itemNodes = /* @__PURE__ */ new Map();\n const listeners = /* @__PURE__ */ new Set();\n const notify = () => {\n onChange?.();\n listeners.forEach((listener) => listener());\n };\n const getItems = () => items;\n const getItem = (value) => items.find((item) => item.value === value);\n const getIndex = (value) => items.findIndex((item) => item.value === value);\n const getRegisteredLabel = (value) => {\n const registrations = labelRegistrations.get(value);\n if (!registrations?.size) return void 0;\n const values = Array.from(registrations.values());\n return values[values.length - 1];\n };\n const applyRegisteredLabel = (value) => {\n const registeredLabel = getRegisteredLabel(value);\n let changed = false;\n for (const item of items) {\n if (item.value !== value) continue;\n const nextLabel = registeredLabel?.label;\n const nextTextValue = explicitTextValues.get(item.id) || registeredLabel?.textValue;\n if (item.label !== nextLabel || item.textValue !== nextTextValue) {\n item.label = nextLabel;\n item.textValue = nextTextValue;\n changed = true;\n }\n }\n if (changed) notify();\n };\n const syncNodeOrder = () => {\n const previousOrder = items.map((item) => item.id);\n items.sort((a, b) => {\n const aNode = itemNodes.get(a.id);\n const bNode = itemNodes.get(b.id);\n if (!aNode || !bNode || typeof aNode.compareDocumentPosition !== \"function\") {\n return 0;\n }\n const position = aNode.compareDocumentPosition(bNode);\n if (position & 4) return -1;\n if (position & 2) return 1;\n return 0;\n });\n if (items.some((item, index) => item.id !== previousOrder[index])) {\n notify();\n }\n };\n const registerItem = (item) => {\n const id = Symbol(item.value);\n const registeredLabel = getRegisteredLabel(item.value);\n const registeredItem = {\n ...item,\n ...registeredLabel,\n textValue: item.textValue ?? registeredLabel?.textValue,\n id\n };\n explicitTextValues.set(id, item.textValue);\n items.push(registeredItem);\n notify();\n return {\n id,\n update(next) {\n const index = items.findIndex((current2) => current2.id === id);\n if (index < 0) return;\n const current = items[index];\n if (\"textValue\" in next) {\n explicitTextValues.set(id, next.textValue);\n }\n const nextItem = { ...current, ...next };\n if (next.value !== void 0 && next.value !== current.value) {\n const nextLabel = getRegisteredLabel(next.value);\n nextItem.label = nextLabel?.label;\n }\n const explicitTextValue = explicitTextValues.get(id);\n nextItem.textValue = explicitTextValue || getSelectLabelText(nextItem.label) || (nextItem.label ? nextItem.value : void 0);\n const changed = Object.entries(next).some(\n ([key, value]) => current[key] !== value\n );\n const textValueChanged = current.textValue !== nextItem.textValue;\n if (!changed && !textValueChanged) return;\n items[index] = nextItem;\n notify();\n },\n setNode(node) {\n if (node) {\n itemNodes.set(id, node);\n syncNodeOrder();\n } else {\n itemNodes.delete(id);\n }\n },\n unregister() {\n const index = items.findIndex((current) => current.id === id);\n if (index < 0) return;\n items.splice(index, 1);\n explicitTextValues.delete(id);\n itemNodes.delete(id);\n notify();\n }\n };\n };\n const registerLabel = (value, label, textValue) => {\n const id = Symbol(value);\n const normalizedTextValue = textValue || getSelectLabelText(label) || value;\n const registrations = labelRegistrations.get(value) ?? (() => {\n const next = /* @__PURE__ */ new Map();\n labelRegistrations.set(value, next);\n return next;\n })();\n registrations.set(id, { label, textValue: normalizedTextValue });\n applyRegisteredLabel(value);\n return () => {\n registrations.delete(id);\n if (!registrations.size) {\n labelRegistrations.delete(value);\n }\n applyRegisteredLabel(value);\n };\n };\n const firstEnabledIndex = () => items.findIndex((item) => !item.disabled);\n const nextEnabledIndex = (fromIndex, direction) => {\n if (!items.length) return -1;\n if (fromIndex == null || fromIndex < 0 || fromIndex >= items.length) {\n if (direction === 1) return firstEnabledIndex();\n for (let index = items.length - 1; index >= 0; index--) {\n if (!items[index].disabled) return index;\n }\n return -1;\n }\n for (let offset = 1; offset <= items.length; offset++) {\n const index = (fromIndex + direction * offset + items.length) % items.length;\n if (!items[index]?.disabled) return index;\n }\n return -1;\n };\n const findTypeaheadIndex = (search, fromIndex) => {\n const normalizedSearch = search.trim().toLocaleLowerCase();\n if (!normalizedSearch) return -1;\n const start = fromIndex == null || fromIndex < 0 ? -1 : fromIndex;\n for (let offset = 1; offset <= items.length; offset++) {\n const index = (start + offset) % items.length;\n const item = items[index];\n const label = item.textValue || getSelectLabelText(item.label) || item.value;\n if (!item.disabled && label.toLocaleLowerCase().startsWith(normalizedSearch)) {\n return index;\n }\n }\n return -1;\n };\n return {\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n registerItem,\n registerLabel,\n getItems,\n getItem,\n getIndex,\n firstEnabledIndex,\n nextEnabledIndex,\n findTypeaheadIndex,\n getDisabledIndices: () => items.flatMap((item, index) => item.disabled ? [index] : []),\n getTypeaheadLabels: () => items.map((item) => item.textValue || getSelectLabelText(item.label) || item.value)\n };\n}\nfunction normalizeSelectSelection(mode, value) {\n if (mode === \"single\") {\n return typeof value === \"string\" ? value : \"\";\n }\n const values = Array.isArray(value) ? value : [];\n return [...new Set(values)];\n}\nfunction selectedValuesFromSelection(mode, value) {\n const normalized = normalizeSelectSelection(mode, value);\n return mode === \"multiple\" ? normalized : normalized ? [normalized] : [];\n}\nfunction createSelectSelectionController({\n mode: initialMode,\n value: initialValue,\n registry\n}) {\n let mode = initialMode;\n let value = normalizeSelectSelection(mode, initialValue);\n let activeIndex = null;\n const selectedValues = () => selectedValuesFromSelection(mode, value);\n const setMode = (nextMode) => {\n if (mode === nextMode) return value;\n mode = nextMode;\n value = normalizeSelectSelection(mode, value);\n return value;\n };\n const setValue = (nextValue) => {\n value = normalizeSelectSelection(mode, nextValue);\n return value;\n };\n const isSelected = (itemValue) => selectedValues().includes(itemValue);\n const toggle = (itemValue) => {\n const item = registry.getItem(itemValue);\n if (!item || item.disabled) return value;\n if (mode === \"single\") {\n value = itemValue;\n return value;\n }\n const current = selectedValues();\n value = current.includes(itemValue) ? current.filter((currentValue) => currentValue !== itemValue) : [...current, itemValue];\n return value;\n };\n const selectionAnchor = () => {\n const values = selectedValues();\n for (let index = values.length - 1; index >= 0; index--) {\n const item = registry.getItem(values[index]);\n if (item) return item;\n }\n const firstEnabledIndex = registry.firstEnabledIndex();\n return firstEnabledIndex < 0 ? void 0 : registry.getItems()[firstEnabledIndex];\n };\n const selectionAnchorIndex = () => {\n const anchor = selectionAnchor();\n return anchor ? registry.getIndex(anchor.value) : -1;\n };\n const initialActiveIndex = () => {\n const anchorIndex = selectionAnchorIndex();\n const anchor = anchorIndex < 0 ? void 0 : registry.getItems()[anchorIndex];\n return anchor && !anchor.disabled ? anchorIndex : registry.firstEnabledIndex();\n };\n const moveActive = (direction) => {\n const nextIndex = registry.nextEnabledIndex(activeIndex, direction);\n activeIndex = nextIndex < 0 ? null : nextIndex;\n return activeIndex == null ? void 0 : registry.getItems()[activeIndex];\n };\n return {\n registry,\n get mode() {\n return mode;\n },\n get value() {\n return value;\n },\n get activeIndex() {\n return activeIndex;\n },\n get activeItem() {\n return activeIndex == null ? void 0 : registry.getItems()[activeIndex];\n },\n get shouldCloseOnSelect() {\n return mode === \"single\";\n },\n setMode,\n setValue,\n isSelected,\n toggle,\n selectionAnchor,\n selectionAnchorIndex,\n initialActiveIndex,\n setActiveIndex(index) {\n activeIndex = index;\n },\n moveActive\n };\n}\nfunction getSelectListboxProps(mode) {\n return {\n role: \"listbox\",\n \"aria-multiselectable\": mode === \"multiple\" ? true : void 0\n };\n}\nfunction getSelectOptionProps(mode, selected, disabled, platform) {\n if (platform === \"native\") {\n return {\n accessibilityRole: mode === \"multiple\" ? \"checkbox\" : \"button\",\n accessibilityState: {\n selected: mode === \"single\" ? selected : void 0,\n checked: mode === \"multiple\" ? selected : void 0,\n disabled\n }\n };\n }\n return {\n role: \"option\",\n \"aria-selected\": selected,\n \"aria-disabled\": disabled || void 0\n };\n}\nexport {\n createSelectItemRegistry,\n createSelectSelectionController,\n getSelectLabelText,\n getSelectListboxProps,\n getSelectOptionProps,\n normalizeSelectSelection,\n selectedValuesFromSelection\n};\n//# sourceMappingURL=selectionController.js.map\n"],"mappings":";AAAA,SAAS,mBAAmB,OAAO;CACjC,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU;EAC1D,OAAO,OAAO,KAAK;CACrB;CACA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,OAAO,MAAM,IAAI,kBAAkB,CAAC,CAAC,KAAK,EAAE;CAC9C;CACA,IAAI,SAAS,OAAO,UAAU,YAAY,WAAW,OAAO;EAC1D,OAAO,mBAAmB,MAAM,OAAO,QAAQ;CACjD;CACA,OAAO;AACT;AACA,SAAS,yBAAyB,UAAU;CAC1C,MAAM,QAAQ,CAAC;CACf,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,4BAA4B,IAAI,IAAI;CAC1C,MAAM,4BAA4B,IAAI,IAAI;CAC1C,MAAM,eAAe;EACnB,WAAW;EACX,UAAU,SAAS,aAAa,SAAS,CAAC;CAC5C;CACA,MAAM,iBAAiB;CACvB,MAAM,WAAW,UAAU,MAAM,MAAM,SAAS,KAAK,UAAU,KAAK;CACpE,MAAM,YAAY,UAAU,MAAM,WAAW,SAAS,KAAK,UAAU,KAAK;CAC1E,MAAM,sBAAsB,UAAU;EACpC,MAAM,gBAAgB,mBAAmB,IAAI,KAAK;EAClD,IAAI,CAAC,eAAe,MAAM,OAAO,KAAK;EACtC,MAAM,SAAS,MAAM,KAAK,cAAc,OAAO,CAAC;EAChD,OAAO,OAAO,OAAO,SAAS;CAChC;CACA,MAAM,wBAAwB,UAAU;EACtC,MAAM,kBAAkB,mBAAmB,KAAK;EAChD,IAAI,UAAU;EACd,KAAK,MAAM,QAAQ,OAAO;GACxB,IAAI,KAAK,UAAU,OAAO;GAC1B,MAAM,YAAY,iBAAiB;GACnC,MAAM,gBAAgB,mBAAmB,IAAI,KAAK,EAAE,KAAK,iBAAiB;G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C;GACF;EACF;CACF;CACA,OAAO;EACL,MAAM;EACN,iBAAiB;EACjB,iBAAiB,YAAY,KAAK;CACpC;AACF"}
|
|
1
|
+
{"version":3,"file":"selectionController.js","names":[],"sources":["esm/selectionController.js"],"sourcesContent":["function getSelectLabelText(label) {\n if (typeof label === \"string\" || typeof label === \"number\") {\n return String(label);\n }\n if (Array.isArray(label)) {\n return label.map(getSelectLabelText).join(\"\");\n }\n if (label && typeof label === \"object\" && \"props\" in label) {\n return getSelectLabelText(label.props?.children);\n }\n return \"\";\n}\nfunction createSelectItemRegistry(onChange) {\n const items = [];\n const labelRegistrations = /* @__PURE__ */ new Map();\n const explicitTextValues = /* @__PURE__ */ new Map();\n const itemNodes = /* @__PURE__ */ new Map();\n const listeners = /* @__PURE__ */ new Set();\n let indexByValue = null;\n const notify = () => {\n indexByValue = null;\n onChange?.();\n listeners.forEach((listener) => listener());\n };\n const getItems = () => items;\n const getItem = (value) => items.find((item) => item.value === value);\n const getIndex = (value) => {\n if (!indexByValue) {\n indexByValue = /* @__PURE__ */ new Map();\n items.forEach((item, index) => {\n if (!indexByValue.has(item.value)) indexByValue.set(item.value, index);\n });\n }\n return indexByValue.get(value) ?? -1;\n };\n const getNodes = () => items.map((item) => itemNodes.get(item.id) ?? null);\n const getRegisteredLabel = (value) => {\n const registrations = labelRegistrations.get(value);\n if (!registrations?.size) return void 0;\n const values = Array.from(registrations.values());\n return values[values.length - 1];\n };\n const applyRegisteredLabel = (value) => {\n const registeredLabel = getRegisteredLabel(value);\n let changed = false;\n for (const item of items) {\n if (item.value !== value) continue;\n const nextLabel = registeredLabel?.label;\n const nextTextValue = explicitTextValues.get(item.id) || registeredLabel?.textValue;\n if (item.label !== nextLabel || item.textValue !== nextTextValue) {\n item.label = nextLabel;\n item.textValue = nextTextValue;\n changed = true;\n }\n }\n if (changed) notify();\n };\n const syncNodeOrder = () => {\n items.sort((a, b) => {\n const aNode = itemNodes.get(a.id);\n const bNode = itemNodes.get(b.id);\n if (!aNode || !bNode || typeof aNode.compareDocumentPosition !== \"function\") {\n return 0;\n }\n const position = aNode.compareDocumentPosition(bNode);\n if (position & 4) return -1;\n if (position & 2) return 1;\n return 0;\n });\n };\n const registerItem = (item) => {\n const id = Symbol(item.value);\n const registeredLabel = getRegisteredLabel(item.value);\n const registeredItem = {\n ...item,\n ...registeredLabel,\n textValue: item.textValue ?? registeredLabel?.textValue,\n id\n };\n explicitTextValues.set(id, item.textValue);\n items.push(registeredItem);\n notify();\n return {\n id,\n update(next) {\n const index = items.findIndex((current2) => current2.id === id);\n if (index < 0) return;\n const current = items[index];\n if (\"textValue\" in next) {\n explicitTextValues.set(id, next.textValue);\n }\n const nextItem = { ...current, ...next };\n if (next.value !== void 0 && next.value !== current.value) {\n const nextLabel = getRegisteredLabel(next.value);\n nextItem.label = nextLabel?.label;\n }\n const explicitTextValue = explicitTextValues.get(id);\n nextItem.textValue = explicitTextValue || getSelectLabelText(nextItem.label) || (nextItem.label ? nextItem.value : void 0);\n const changed = Object.entries(next).some(\n ([key, value]) => current[key] !== value\n );\n const textValueChanged = current.textValue !== nextItem.textValue;\n if (!changed && !textValueChanged) return;\n items[index] = nextItem;\n notify();\n },\n setNode(node) {\n if ((itemNodes.get(id) ?? null) === (node ?? null)) return;\n if (node) {\n itemNodes.set(id, node);\n syncNodeOrder();\n } else {\n itemNodes.delete(id);\n }\n notify();\n },\n unregister() {\n const index = items.findIndex((current) => current.id === id);\n if (index < 0) return;\n items.splice(index, 1);\n explicitTextValues.delete(id);\n itemNodes.delete(id);\n notify();\n }\n };\n };\n const registerLabel = (value, label, textValue) => {\n const id = Symbol(value);\n const normalizedTextValue = textValue || getSelectLabelText(label) || value;\n const registrations = labelRegistrations.get(value) ?? (() => {\n const next = /* @__PURE__ */ new Map();\n labelRegistrations.set(value, next);\n return next;\n })();\n registrations.set(id, { label, textValue: normalizedTextValue });\n applyRegisteredLabel(value);\n return () => {\n registrations.delete(id);\n if (!registrations.size) {\n labelRegistrations.delete(value);\n }\n applyRegisteredLabel(value);\n };\n };\n const firstEnabledIndex = () => items.findIndex((item) => !item.disabled);\n const nextEnabledIndex = (fromIndex, direction) => {\n if (!items.length) return -1;\n if (fromIndex == null || fromIndex < 0 || fromIndex >= items.length) {\n if (direction === 1) return firstEnabledIndex();\n for (let index = items.length - 1; index >= 0; index--) {\n if (!items[index].disabled) return index;\n }\n return -1;\n }\n for (let offset = 1; offset <= items.length; offset++) {\n const index = (fromIndex + direction * offset + items.length) % items.length;\n if (!items[index]?.disabled) return index;\n }\n return -1;\n };\n const findTypeaheadIndex = (search, fromIndex) => {\n const normalizedSearch = search.trim().toLocaleLowerCase();\n if (!normalizedSearch) return -1;\n const start = fromIndex == null || fromIndex < 0 ? -1 : fromIndex;\n for (let offset = 1; offset <= items.length; offset++) {\n const index = (start + offset) % items.length;\n const item = items[index];\n const label = item.textValue || getSelectLabelText(item.label) || item.value;\n if (!item.disabled && label.toLocaleLowerCase().startsWith(normalizedSearch)) {\n return index;\n }\n }\n return -1;\n };\n return {\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n registerItem,\n registerLabel,\n getItems,\n getItem,\n getIndex,\n getNodes,\n firstEnabledIndex,\n nextEnabledIndex,\n findTypeaheadIndex,\n getDisabledIndices: () => items.flatMap((item, index) => item.disabled ? [index] : []),\n getTypeaheadLabels: () => items.map((item) => item.textValue || getSelectLabelText(item.label) || item.value)\n };\n}\nfunction normalizeSelectSelection(mode, value) {\n if (mode === \"single\") {\n return typeof value === \"string\" ? value : \"\";\n }\n const values = Array.isArray(value) ? value : [];\n return [...new Set(values)];\n}\nfunction selectedValuesFromSelection(mode, value) {\n const normalized = normalizeSelectSelection(mode, value);\n return mode === \"multiple\" ? normalized : normalized ? [normalized] : [];\n}\nfunction createSelectSelectionController({\n mode: initialMode,\n value: initialValue,\n registry\n}) {\n let mode = initialMode;\n let value = normalizeSelectSelection(mode, initialValue);\n let activeIndex = null;\n const selectedValues = () => selectedValuesFromSelection(mode, value);\n const setMode = (nextMode) => {\n if (mode === nextMode) return value;\n mode = nextMode;\n value = normalizeSelectSelection(mode, value);\n return value;\n };\n const setValue = (nextValue) => {\n value = normalizeSelectSelection(mode, nextValue);\n return value;\n };\n const isSelected = (itemValue) => selectedValues().includes(itemValue);\n const toggle = (itemValue) => {\n const item = registry.getItem(itemValue);\n if (!item || item.disabled) return value;\n if (mode === \"single\") {\n value = itemValue;\n return value;\n }\n const current = selectedValues();\n value = current.includes(itemValue) ? current.filter((currentValue) => currentValue !== itemValue) : [...current, itemValue];\n return value;\n };\n const selectionAnchor = () => {\n const values = selectedValues();\n for (let index = values.length - 1; index >= 0; index--) {\n const item = registry.getItem(values[index]);\n if (item) return item;\n }\n const firstEnabledIndex = registry.firstEnabledIndex();\n return firstEnabledIndex < 0 ? void 0 : registry.getItems()[firstEnabledIndex];\n };\n const selectionAnchorIndex = () => {\n const anchor = selectionAnchor();\n return anchor ? registry.getIndex(anchor.value) : -1;\n };\n const initialActiveIndex = () => {\n const anchorIndex = selectionAnchorIndex();\n const anchor = anchorIndex < 0 ? void 0 : registry.getItems()[anchorIndex];\n return anchor && !anchor.disabled ? anchorIndex : registry.firstEnabledIndex();\n };\n const moveActive = (direction) => {\n const nextIndex = registry.nextEnabledIndex(activeIndex, direction);\n activeIndex = nextIndex < 0 ? null : nextIndex;\n return activeIndex == null ? void 0 : registry.getItems()[activeIndex];\n };\n return {\n registry,\n get mode() {\n return mode;\n },\n get value() {\n return value;\n },\n get activeIndex() {\n return activeIndex;\n },\n get activeItem() {\n return activeIndex == null ? void 0 : registry.getItems()[activeIndex];\n },\n get shouldCloseOnSelect() {\n return mode === \"single\";\n },\n setMode,\n setValue,\n isSelected,\n toggle,\n selectionAnchor,\n selectionAnchorIndex,\n initialActiveIndex,\n setActiveIndex(index) {\n activeIndex = index;\n },\n moveActive\n };\n}\nfunction getSelectListboxProps(mode) {\n return {\n role: \"listbox\",\n \"aria-multiselectable\": mode === \"multiple\" ? true : void 0\n };\n}\nfunction getSelectOptionProps(mode, selected, disabled, platform) {\n if (platform === \"native\") {\n return {\n accessibilityRole: mode === \"multiple\" ? \"checkbox\" : \"button\",\n accessibilityState: {\n selected: mode === \"single\" ? selected : void 0,\n checked: mode === \"multiple\" ? selected : void 0,\n disabled\n }\n };\n }\n return {\n role: \"option\",\n \"aria-selected\": selected,\n \"aria-disabled\": disabled || void 0\n };\n}\nexport {\n createSelectItemRegistry,\n createSelectSelectionController,\n getSelectLabelText,\n getSelectListboxProps,\n getSelectOptionProps,\n normalizeSelectSelection,\n selectedValuesFromSelection\n};\n//# sourceMappingURL=selectionController.js.map\n"],"mappings":";AAAA,SAAS,mBAAmB,OAAO;CACjC,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU;EAC1D,OAAO,OAAO,KAAK;CACrB;CACA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,OAAO,MAAM,IAAI,kBAAkB,CAAC,CAAC,KAAK,EAAE;CAC9C;CACA,IAAI,SAAS,OAAO,UAAU,YAAY,WAAW,OAAO;EAC1D,OAAO,mBAAmB,MAAM,OAAO,QAAQ;CACjD;CACA,OAAO;AACT;AACA,SAAS,yBAAyB,UAAU;CAC1C,MAAM,QAAQ,CAAC;CACf,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,4BAA4B,IAAI,IAAI;CAC1C,MAAM,4BAA4B,IAAI,IAAI;CAC1C,IAAI,eAAe;CACnB,MAAM,eAAe;EACnB,eAAe;EACf,WAAW;EACX,UAAU,SAAS,aAAa,SAAS,CAAC;CAC5C;CACA,MAAM,iBAAiB;CACvB,MAAM,WAAW,UAAU,MAAM,MAAM,SAAS,KAAK,UAAU,KAAK;CACpE,MAAM,YAAY,UAAU;EAC1B,IAAI,CAAC,cAAc;GACjB,+BAA+B,IAAI,IAAI;GACvC,MAAM,SAAS,MAAM,UAAU;IAC7B,IAAI,CAAC,aAAa,IAAI,KAAK,KAAK,GAAG,aA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