@tamagui/select 2.7.7 → 3.0.0-beta.1093.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 +406 -467
- package/dist/cjs/Select.native.cjs +495 -0
- package/dist/cjs/Select.native.js +445 -492
- package/dist/cjs/Select.native.js.map +1 -1
- package/dist/cjs/SelectContent.cjs +79 -79
- package/dist/cjs/SelectContent.native.cjs +29 -0
- package/dist/cjs/SelectContent.native.js +17 -22
- package/dist/cjs/SelectContent.native.js.map +1 -1
- package/dist/cjs/SelectImpl.cjs +305 -320
- package/dist/cjs/SelectImpl.native.cjs +29 -0
- package/dist/cjs/SelectImpl.native.js +16 -24
- package/dist/cjs/SelectImpl.native.js.map +1 -1
- package/dist/cjs/SelectItem.cjs +256 -205
- package/dist/cjs/SelectItem.native.cjs +288 -0
- package/dist/cjs/SelectItem.native.js +264 -213
- package/dist/cjs/SelectItem.native.js.map +1 -1
- package/dist/cjs/SelectItemText.cjs +48 -79
- package/dist/cjs/SelectItemText.native.cjs +73 -0
- package/dist/cjs/SelectItemText.native.js +49 -79
- package/dist/cjs/SelectItemText.native.js.map +1 -1
- package/dist/cjs/SelectScrollButton.cjs +110 -130
- package/dist/cjs/SelectScrollButton.native.cjs +37 -0
- package/dist/cjs/SelectScrollButton.native.js +24 -22
- package/dist/cjs/SelectScrollButton.native.js.map +1 -1
- package/dist/cjs/SelectTrigger.cjs +68 -84
- package/dist/cjs/SelectTrigger.native.cjs +90 -0
- package/dist/cjs/SelectTrigger.native.js +70 -66
- package/dist/cjs/SelectTrigger.native.js.map +1 -1
- package/dist/cjs/SelectViewport.cjs +121 -142
- package/dist/cjs/SelectViewport.native.cjs +72 -0
- package/dist/cjs/SelectViewport.native.js +53 -50
- package/dist/cjs/SelectViewport.native.js.map +1 -1
- package/dist/cjs/constants.cjs +20 -22
- package/dist/cjs/constants.native.cjs +40 -0
- package/dist/cjs/constants.native.js +20 -21
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/context.cjs +37 -48
- package/dist/cjs/context.native.cjs +57 -0
- package/dist/cjs/context.native.js +39 -49
- package/dist/cjs/context.native.js.map +1 -1
- package/dist/cjs/index.cjs +14 -11
- package/dist/cjs/index.native.cjs +26 -0
- package/dist/cjs/index.native.js +14 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/selectionController.cjs +343 -0
- package/dist/cjs/selectionController.native.cjs +407 -0
- package/dist/cjs/selectionController.native.js +409 -0
- package/dist/cjs/selectionController.native.js.map +1 -0
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/types.native.js +9 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/Select.mjs +381 -443
- package/dist/esm/Select.mjs.map +1 -1
- package/dist/esm/Select.native.js +420 -469
- package/dist/esm/Select.native.js.map +1 -1
- package/dist/esm/SelectContent.mjs +67 -61
- package/dist/esm/SelectContent.mjs.map +1 -1
- package/dist/esm/SelectContent.native.js +4 -5
- package/dist/esm/SelectContent.native.js.map +1 -1
- package/dist/esm/SelectImpl.mjs +291 -295
- package/dist/esm/SelectImpl.mjs.map +1 -1
- package/dist/esm/SelectImpl.native.js +5 -8
- package/dist/esm/SelectImpl.native.js.map +1 -1
- package/dist/esm/SelectItem.mjs +240 -181
- package/dist/esm/SelectItem.mjs.map +1 -1
- package/dist/esm/SelectItem.native.js +249 -191
- package/dist/esm/SelectItem.native.js.map +1 -1
- package/dist/esm/SelectItemText.mjs +33 -55
- package/dist/esm/SelectItemText.mjs.map +1 -1
- package/dist/esm/SelectItemText.native.js +34 -56
- package/dist/esm/SelectItemText.native.js.map +1 -1
- package/dist/esm/SelectScrollButton.mjs +95 -107
- package/dist/esm/SelectScrollButton.mjs.map +1 -1
- package/dist/esm/SelectScrollButton.native.js +11 -7
- package/dist/esm/SelectScrollButton.native.js.map +1 -1
- package/dist/esm/SelectTrigger.mjs +56 -58
- package/dist/esm/SelectTrigger.mjs.map +1 -1
- package/dist/esm/SelectTrigger.native.js +54 -44
- package/dist/esm/SelectTrigger.native.js.map +1 -1
- package/dist/esm/SelectViewport.mjs +107 -119
- package/dist/esm/SelectViewport.mjs.map +1 -1
- package/dist/esm/SelectViewport.native.js +44 -39
- package/dist/esm/SelectViewport.native.js.map +1 -1
- package/dist/esm/constants.mjs +1 -0
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +1 -0
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/context.mjs +20 -28
- package/dist/esm/context.mjs.map +1 -1
- package/dist/esm/context.native.js +23 -31
- package/dist/esm/context.native.js.map +1 -1
- package/dist/esm/index.js +13 -3
- package/dist/esm/index.mjs +13 -3
- package/dist/esm/index.native.js +13 -3
- package/dist/esm/selectionController.mjs +315 -0
- package/dist/esm/selectionController.mjs.map +1 -0
- package/dist/esm/selectionController.native.js +377 -0
- package/dist/esm/selectionController.native.js.map +1 -0
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/jsx/Select.mjs +381 -443
- package/dist/jsx/Select.mjs.map +1 -1
- package/dist/jsx/Select.native.cjs +495 -0
- package/dist/jsx/Select.native.js +445 -492
- package/dist/jsx/Select.native.js.map +1 -1
- package/dist/jsx/SelectContent.mjs +67 -61
- package/dist/jsx/SelectContent.mjs.map +1 -1
- package/dist/jsx/SelectContent.native.cjs +29 -0
- package/dist/jsx/SelectContent.native.js +17 -22
- package/dist/jsx/SelectContent.native.js.map +1 -1
- package/dist/jsx/SelectImpl.mjs +291 -295
- package/dist/jsx/SelectImpl.mjs.map +1 -1
- package/dist/jsx/SelectImpl.native.cjs +29 -0
- package/dist/jsx/SelectImpl.native.js +16 -24
- package/dist/jsx/SelectImpl.native.js.map +1 -1
- package/dist/jsx/SelectItem.mjs +240 -181
- package/dist/jsx/SelectItem.mjs.map +1 -1
- package/dist/jsx/SelectItem.native.cjs +288 -0
- package/dist/jsx/SelectItem.native.js +264 -213
- package/dist/jsx/SelectItem.native.js.map +1 -1
- package/dist/jsx/SelectItemText.mjs +33 -55
- package/dist/jsx/SelectItemText.mjs.map +1 -1
- package/dist/jsx/SelectItemText.native.cjs +73 -0
- package/dist/jsx/SelectItemText.native.js +49 -79
- package/dist/jsx/SelectItemText.native.js.map +1 -1
- package/dist/jsx/SelectScrollButton.mjs +95 -107
- package/dist/jsx/SelectScrollButton.mjs.map +1 -1
- package/dist/jsx/SelectScrollButton.native.cjs +37 -0
- package/dist/jsx/SelectScrollButton.native.js +24 -22
- package/dist/jsx/SelectScrollButton.native.js.map +1 -1
- package/dist/jsx/SelectTrigger.mjs +56 -58
- package/dist/jsx/SelectTrigger.mjs.map +1 -1
- package/dist/jsx/SelectTrigger.native.cjs +90 -0
- package/dist/jsx/SelectTrigger.native.js +70 -66
- package/dist/jsx/SelectTrigger.native.js.map +1 -1
- package/dist/jsx/SelectViewport.mjs +107 -119
- package/dist/jsx/SelectViewport.mjs.map +1 -1
- package/dist/jsx/SelectViewport.native.cjs +72 -0
- package/dist/jsx/SelectViewport.native.js +53 -50
- package/dist/jsx/SelectViewport.native.js.map +1 -1
- package/dist/jsx/constants.mjs +1 -0
- package/dist/jsx/constants.mjs.map +1 -1
- package/dist/jsx/constants.native.cjs +40 -0
- package/dist/jsx/constants.native.js +20 -21
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/context.mjs +20 -28
- package/dist/jsx/context.mjs.map +1 -1
- package/dist/jsx/context.native.cjs +57 -0
- package/dist/jsx/context.native.js +39 -49
- package/dist/jsx/context.native.js.map +1 -1
- package/dist/jsx/index.js +13 -3
- package/dist/jsx/index.mjs +13 -3
- package/dist/jsx/index.native.cjs +26 -0
- package/dist/jsx/index.native.js +14 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/selectionController.mjs +315 -0
- package/dist/jsx/selectionController.mjs.map +1 -0
- package/dist/jsx/selectionController.native.cjs +407 -0
- package/dist/jsx/selectionController.native.js +409 -0
- package/dist/jsx/selectionController.native.js.map +1 -0
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +18 -0
- package/dist/jsx/types.native.js +9 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/package.json +31 -30
- package/src/Select.tsx +478 -378
- package/src/SelectContent.tsx +46 -16
- package/src/SelectImpl.native.tsx +0 -8
- package/src/SelectImpl.tsx +149 -160
- package/src/SelectItem.tsx +280 -159
- package/src/SelectItemText.tsx +16 -33
- package/src/SelectScrollButton.native.tsx +13 -4
- package/src/SelectScrollButton.tsx +57 -42
- package/src/SelectTrigger.tsx +77 -53
- package/src/SelectViewport.native.tsx +42 -25
- package/src/SelectViewport.tsx +60 -60
- package/src/context.tsx +6 -2
- package/src/index.tsx +5 -2
- package/src/selectionController.ts +404 -0
- package/src/types.tsx +105 -59
- package/types/Select.d.ts +139 -201
- package/types/Select.d.ts.map +1 -1
- package/types/SelectContent.d.ts +1 -1
- package/types/SelectContent.d.ts.map +1 -1
- package/types/SelectContent.native.d.ts.map +1 -1
- package/types/SelectImpl.d.ts +2 -1
- package/types/SelectImpl.d.ts.map +1 -1
- package/types/SelectImpl.native.d.ts +1 -5
- package/types/SelectImpl.native.d.ts.map +1 -1
- package/types/SelectItem.d.ts +13 -16
- package/types/SelectItem.d.ts.map +1 -1
- package/types/SelectItemText.d.ts +9 -13
- package/types/SelectItemText.d.ts.map +1 -1
- package/types/SelectScrollButton.d.ts +15 -2
- package/types/SelectScrollButton.d.ts.map +1 -1
- package/types/SelectScrollButton.native.d.ts +16 -3
- package/types/SelectScrollButton.native.d.ts.map +1 -1
- package/types/SelectTrigger.d.ts +11 -23
- package/types/SelectTrigger.d.ts.map +1 -1
- package/types/SelectViewport.d.ts +11 -38
- package/types/SelectViewport.d.ts.map +1 -1
- package/types/SelectViewport.native.d.ts +15 -4
- package/types/SelectViewport.native.d.ts.map +1 -1
- package/types/context.d.ts +2 -0
- package/types/context.d.ts.map +1 -1
- package/types/index.d.ts +5 -2
- package/types/index.d.ts.map +1 -1
- package/types/selectionController.d.ts +90 -0
- package/types/selectionController.d.ts.map +1 -0
- package/types/types.d.ts +66 -50
- package/types/types.d.ts.map +1 -1
- package/dist/cjs/BubbleSelect.cjs +0 -50
- package/dist/cjs/BubbleSelect.native.js +0 -30
- package/dist/cjs/BubbleSelect.native.js.map +0 -1
- package/dist/cjs/useSelectBreakpointActive.cjs +0 -32
- package/dist/cjs/useSelectBreakpointActive.native.js +0 -35
- package/dist/cjs/useSelectBreakpointActive.native.js.map +0 -1
- package/dist/esm/BubbleSelect.mjs +0 -27
- package/dist/esm/BubbleSelect.mjs.map +0 -1
- package/dist/esm/BubbleSelect.native.js +0 -4
- package/dist/esm/BubbleSelect.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/useSelectBreakpointActive.mjs +0 -7
- package/dist/esm/useSelectBreakpointActive.mjs.map +0 -1
- package/dist/esm/useSelectBreakpointActive.native.js +0 -7
- package/dist/esm/useSelectBreakpointActive.native.js.map +0 -1
- package/dist/jsx/BubbleSelect.mjs +0 -27
- package/dist/jsx/BubbleSelect.mjs.map +0 -1
- package/dist/jsx/BubbleSelect.native.js +0 -30
- package/dist/jsx/BubbleSelect.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/useSelectBreakpointActive.mjs +0 -7
- package/dist/jsx/useSelectBreakpointActive.mjs.map +0 -1
- package/dist/jsx/useSelectBreakpointActive.native.js +0 -35
- package/dist/jsx/useSelectBreakpointActive.native.js.map +0 -1
- package/src/BubbleSelect.tsx +0 -50
- package/src/useSelectBreakpointActive.tsx +0 -7
- package/types/BubbleSelect.d.ts +0 -2
- package/types/BubbleSelect.d.ts.map +0 -1
- package/types/useSelectBreakpointActive.d.ts +0 -3
- package/types/useSelectBreakpointActive.d.ts.map +0 -1
|
@@ -2,142 +2,130 @@ 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 { styled } from "@tamagui/core";
|
|
5
|
+
import { View, createStyledHOC, styled } from "@tamagui/core";
|
|
6
6
|
import { needsPortalRepropagation } from "@tamagui/portal";
|
|
7
|
-
import {
|
|
7
|
+
import { YStack } from "@tamagui/stacks";
|
|
8
8
|
import { startTransition } from "@tamagui/start-transition";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { VIEWPORT_NAME } from "./constants.mjs";
|
|
11
11
|
import { ForwardSelectContext, useSelectContext, useSelectItemParentContext } from "./context.mjs";
|
|
12
|
+
import { getSelectListboxProps } from "./selectionController.mjs";
|
|
12
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
false: {
|
|
18
|
-
size: "$2",
|
|
19
|
-
backgroundColor: "$background",
|
|
20
|
-
elevate: true,
|
|
21
|
-
bordered: true,
|
|
22
|
-
userSelect: "none",
|
|
23
|
-
outlineWidth: 0
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
"...size": (val, {
|
|
28
|
-
tokens
|
|
29
|
-
}) => {
|
|
30
|
-
return {
|
|
31
|
-
borderRadius: tokens.radius[val] ?? val
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
defaultVariants: {
|
|
37
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
38
|
-
}
|
|
14
|
+
|
|
15
|
+
const SelectViewportFrame = styled(View, {
|
|
16
|
+
displayName: VIEWPORT_NAME,
|
|
17
|
+
position: "relative"
|
|
39
18
|
});
|
|
40
19
|
const needsRepropagation = needsPortalRepropagation();
|
|
41
|
-
const SelectViewport = SelectViewportFrame
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
20
|
+
const SelectViewport = createStyledHOC(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {
|
|
21
|
+
const { scope, children, disableScroll, ...viewportProps } = props;
|
|
22
|
+
const context = useSelectContext(scope);
|
|
23
|
+
const itemContext = useSelectItemParentContext(scope);
|
|
24
|
+
const isAdapted = useAdaptIsActive(context.adaptScope);
|
|
25
|
+
const viewportRef = React.useRef(null);
|
|
26
|
+
const registeredItemCount = itemContext.registry.getItems().length;
|
|
27
|
+
const [lazyMounted, setLazyMounted] = React.useState(context.lazyMount ? false : true);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (!context.lazyMount) return;
|
|
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
|
+
]);
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (!isWeb || !isAdapted || !context.open) return;
|
|
42
|
+
const frame = requestAnimationFrame(() => {
|
|
43
|
+
const index = context.activeIndexRef.current ?? itemContext.registry.firstEnabledIndex();
|
|
44
|
+
const activeItem = viewportRef.current?.querySelector("[role=\"option\"][tabindex=\"0\"]") ?? (index >= 0 ? itemContext.listRef?.current[index] : null);
|
|
45
|
+
activeItem?.focus();
|
|
46
|
+
});
|
|
47
|
+
return () => cancelAnimationFrame(frame);
|
|
48
|
+
}, [
|
|
49
|
+
context.open,
|
|
50
|
+
isAdapted,
|
|
51
|
+
registeredItemCount
|
|
52
|
+
]);
|
|
53
|
+
const composedRefs = useComposedRefs(forwardedRef, viewportRef, context.floatingContext?.refs.setFloating);
|
|
54
|
+
useIsomorphicLayoutEffect(() => {
|
|
55
|
+
if (context.update) {
|
|
56
|
+
context.update();
|
|
57
|
+
}
|
|
58
|
+
}, [isAdapted]);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
if (context.lazyMount && lazyMounted && context.open && context.update) {
|
|
61
|
+
const frame = requestAnimationFrame(context.update);
|
|
62
|
+
return () => cancelAnimationFrame(frame);
|
|
63
|
+
}
|
|
64
|
+
}, [lazyMounted, registeredItemCount]);
|
|
65
|
+
if (itemContext.shouldRenderWebNative) {
|
|
66
|
+
return /* @__PURE__ */ jsx(YStack, {
|
|
67
|
+
position: "relative",
|
|
68
|
+
children
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (isAdapted || !isWeb) {
|
|
72
|
+
let content = /* @__PURE__ */ jsx(SelectViewportFrame, {
|
|
73
|
+
...viewportProps,
|
|
74
|
+
...isWeb ? getSelectListboxProps(itemContext.mode) : {},
|
|
75
|
+
"data-select-viewport": "",
|
|
76
|
+
ref: composedRefs,
|
|
77
|
+
children: lazyMounted ? children : null
|
|
78
|
+
});
|
|
79
|
+
if (needsRepropagation) {
|
|
80
|
+
content = /* @__PURE__ */ jsx(ForwardSelectContext, {
|
|
81
|
+
itemContext,
|
|
82
|
+
context,
|
|
83
|
+
children: content
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ jsx(AdaptPortalContents, {
|
|
87
|
+
scope: context.adaptScope,
|
|
88
|
+
children: content
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (!context.interactions) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const floatingProps = context.interactions.getFloatingProps();
|
|
95
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
96
|
+
!disableScroll && /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: selectViewportCSS } }),
|
|
97
|
+
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
98
|
+
presenceAffectsLayout: false,
|
|
99
|
+
children: context.open ? /* @__PURE__ */ jsx(SelectViewportFrame, {
|
|
100
|
+
"data-select-viewport": "",
|
|
101
|
+
...isWeb && { "data-state": context.open ? "open" : "closed" },
|
|
102
|
+
...viewportProps,
|
|
103
|
+
...context.floatingPosition,
|
|
104
|
+
outlineWidth: 0,
|
|
105
|
+
...floatingProps,
|
|
106
|
+
...getSelectListboxProps(itemContext.mode),
|
|
107
|
+
overflowY: disableScroll ? void 0 : "auto",
|
|
108
|
+
ref: composedRefs,
|
|
109
|
+
children: lazyMounted ? children : null
|
|
110
|
+
}, "select-viewport") : null
|
|
111
|
+
}),
|
|
112
|
+
!context.open && !(context.lazyMount && context.renderValue) && lazyMounted && /* @__PURE__ */ jsx("div", {
|
|
113
|
+
style: { display: "none" },
|
|
114
|
+
children
|
|
115
|
+
})
|
|
116
|
+
] });
|
|
130
117
|
});
|
|
131
118
|
const selectViewportCSS = `
|
|
132
|
-
|
|
119
|
+
[data-select-viewport] {
|
|
133
120
|
scrollbar-width: none;
|
|
134
121
|
-webkit-overflow-scrolling: touch;
|
|
135
122
|
overscroll-behavior: contain;
|
|
136
123
|
}
|
|
137
124
|
|
|
138
|
-
|
|
125
|
+
[data-select-viewport]::-webkit-scrollbar{
|
|
139
126
|
display:none
|
|
140
127
|
}
|
|
141
128
|
`;
|
|
129
|
+
|
|
142
130
|
export { SelectViewport, SelectViewportFrame };
|
|
143
131
|
//# sourceMappingURL=SelectViewport.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"SelectViewport.js","names":[],"sources":["jsx/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 { startTransition } from \"@tamagui/start-transition\";\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 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 [lazyMounted, setLazyMounted] = React.useState(context.lazyMount ? false : true);\n React.useEffect(() => {\n if (!context.lazyMount) return;\n if (!context.open) return;\n if (lazyMounted) return;\n startTransition(() => {\n setLazyMounted(true);\n });\n }, [context.lazyMount, context.open, lazyMounted]);\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 && lazyMounted && context.open && context.update) {\n const frame = requestAnimationFrame(context.update);\n return () => cancelAnimationFrame(frame);\n }\n }, [lazyMounted, registeredItemCount]);\n if (itemContext.shouldRenderWebNative) {\n return /* @__PURE__ */ jsx(YStack, { position: \"relative\", children });\n }\n if (isAdapted || !isWeb) {\n let content = /* @__PURE__ */ jsx(\n SelectViewportFrame,\n {\n ...viewportProps,\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: contain;\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":";;;;;;;;;;;;;;;AAiBA,MAAM,sBAAsB,OAAO,MAAM;CACvC,aAAa;CACb,UAAU;AACZ,CAAC;AACD,MAAM,qBAAqB,yBAAyB;AACpD,MAAM,iBAAiB,gBACrB,qBACA,SAAS,gBAAgB,OAAO,cAAc;CAC5C,MAA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
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var SelectViewport_native_exports = {};
|
|
24
|
+
__export(SelectViewport_native_exports, {
|
|
25
|
+
SelectViewport: () => SelectViewport,
|
|
26
|
+
SelectViewportFrame: () => SelectViewportFrame
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(SelectViewport_native_exports);
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var import_adapt = require("@tamagui/adapt");
|
|
31
|
+
var import_core = require("@tamagui/core");
|
|
32
|
+
var import_constants = require("./constants.native.js");
|
|
33
|
+
var import_context = require("./context.native.js");
|
|
34
|
+
var SelectViewportFrame = (0, import_core.styled)(import_core.View, {
|
|
35
|
+
displayName: import_constants.VIEWPORT_NAME,
|
|
36
|
+
position: "relative"
|
|
37
|
+
});
|
|
38
|
+
var SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {
|
|
39
|
+
var { scope, children, disableScroll: _disableScroll, ...viewportProps } = props;
|
|
40
|
+
var context = (0, import_context.useSelectContext)(scope);
|
|
41
|
+
var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
|
|
42
|
+
var themeName = (0, import_core.useThemeName)();
|
|
43
|
+
var adaptContext = (0, import_adapt.useAdaptContext)(context.adaptScope);
|
|
44
|
+
var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
|
|
45
|
+
var contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
|
|
46
|
+
name: themeName,
|
|
47
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {
|
|
48
|
+
itemContext: itemParentContext,
|
|
49
|
+
context,
|
|
50
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.ProvideAdaptContext, {
|
|
51
|
+
...adaptContext,
|
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
|
|
53
|
+
...viewportProps,
|
|
54
|
+
ref: forwardedRef,
|
|
55
|
+
children
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
if (!context.open) {
|
|
61
|
+
if (context.lazyMount && context.renderValue) return null;
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
|
|
63
|
+
display: "none",
|
|
64
|
+
children: contents
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return isAdapted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptPortalContents, {
|
|
68
|
+
scope: context.adaptScope,
|
|
69
|
+
children: contents
|
|
70
|
+
}) : contents;
|
|
71
|
+
});
|
|
72
|
+
SelectViewport.displayName = import_constants.VIEWPORT_NAME;
|
|
@@ -5,67 +5,70 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
23
|
var SelectViewport_native_exports = {};
|
|
26
24
|
__export(SelectViewport_native_exports, {
|
|
27
|
-
|
|
25
|
+
SelectViewport: () => SelectViewport,
|
|
26
|
+
SelectViewportFrame: () => SelectViewportFrame
|
|
28
27
|
});
|
|
29
28
|
module.exports = __toCommonJS(SelectViewport_native_exports);
|
|
30
29
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
30
|
var import_adapt = require("@tamagui/adapt");
|
|
32
31
|
var import_core = require("@tamagui/core");
|
|
33
|
-
var import_stacks = require("@tamagui/stacks");
|
|
34
32
|
var import_constants = require("./constants.native.js");
|
|
35
33
|
var import_context = require("./context.native.js");
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
34
|
+
var SelectViewportFrame = (0, import_core.styled)(import_core.View, {
|
|
35
|
+
displayName: import_constants.VIEWPORT_NAME,
|
|
36
|
+
position: "relative"
|
|
37
|
+
});
|
|
38
|
+
var SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {
|
|
39
|
+
var { scope, children, disableScroll: _disableScroll, ...viewportProps } = props;
|
|
40
|
+
var context = (0, import_context.useSelectContext)(scope);
|
|
41
|
+
var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);
|
|
42
|
+
var themeName = (0, import_core.useThemeName)();
|
|
43
|
+
var adaptContext = (0, import_adapt.useAdaptContext)(context.adaptScope);
|
|
44
|
+
var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
|
|
45
|
+
var contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
|
|
46
|
+
name: themeName,
|
|
47
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {
|
|
48
|
+
itemContext: itemParentContext,
|
|
49
|
+
context,
|
|
50
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.ProvideAdaptContext, {
|
|
51
|
+
...adaptContext,
|
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
|
|
53
|
+
...viewportProps,
|
|
54
|
+
ref: forwardedRef,
|
|
55
|
+
children
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
if (!context.open) {
|
|
61
|
+
if (context.lazyMount && context.renderValue) return null;
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {
|
|
63
|
+
display: "none",
|
|
64
|
+
children: contents
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return isAdapted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptPortalContents, {
|
|
68
|
+
scope: context.adaptScope,
|
|
69
|
+
children: contents
|
|
70
|
+
}) : contents;
|
|
71
|
+
});
|
|
70
72
|
SelectViewport.displayName = import_constants.VIEWPORT_NAME;
|
|
73
|
+
|
|
71
74
|
//# sourceMappingURL=SelectViewport.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"SelectViewport.native.js","names":[],"sources":["jsx/SelectViewport.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SelectViewport_native_exports = {};\n__export(SelectViewport_native_exports, {\n SelectViewport: () => SelectViewport,\n SelectViewportFrame: () => SelectViewportFrame\n});\nmodule.exports = __toCommonJS(SelectViewport_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_adapt = require(\"@tamagui/adapt\");\nvar import_core = require(\"@tamagui/core\");\nvar import_constants = require(\"./constants\");\nvar import_context = require(\"./context\");\nvar SelectViewportFrame = (0, import_core.styled)(import_core.View, {\n displayName: import_constants.VIEWPORT_NAME,\n position: \"relative\"\n});\nvar SelectViewport = (0, import_core.createStyledHOC)(SelectViewportFrame, function SelectViewport2(props, forwardedRef) {\n var { scope, children, disableScroll: _disableScroll, ...viewportProps } = props;\n var context = (0, import_context.useSelectContext)(scope);\n var itemParentContext = (0, import_context.useSelectItemParentContext)(scope);\n var themeName = (0, import_core.useThemeName)();\n var adaptContext = (0, import_adapt.useAdaptContext)(context.adaptScope);\n var isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);\n var contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {\n name: themeName,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {\n itemContext: itemParentContext,\n context,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.ProvideAdaptContext, {\n ...adaptContext,\n children: /* @__PURE__ */ (0, import_jsx_runtime.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__ */ (0, import_jsx_runtime.jsx)(SelectViewportFrame, {\n display: \"none\",\n children: contents\n });\n }\n return isAdapted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptPortalContents, {\n scope: context.adaptScope,\n children: contents\n }) : contents;\n});\nSelectViewport.displayName = import_constants.VIEWPORT_NAME;\n//# sourceMappingURL=SelectViewport.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,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,GAAG,aAAa,iBAAgB,CAAE,QAAQ,UAAU;CACrE,IAAI,WAA2B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,YAAY,OAAO;EAC5E,MAAM;EACN,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe,sBAAsB;GACzF,aAAa;GACb;GACA,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa,qBAAqB;IACtF,GAAG;IACH,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB;KACzE,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,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB;GACtE,SAAS;GACT,UAAU;EACZ,CAAC;CACH;CACA,OAAO,YAA4B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa,qBAAqB;EAC/F,OAAO,QAAQ;EACf,UAAU;CACZ,CAAC,IAAI;AACP,CAAC;AACD,eAAe,cAAc,iBAAiB"}
|
package/dist/jsx/constants.mjs
CHANGED
|
@@ -5,5 +5,6 @@ const SCROLL_ARROW_THRESHOLD = 8;
|
|
|
5
5
|
const MIN_HEIGHT = 80;
|
|
6
6
|
const FALLBACK_THRESHOLD = 16;
|
|
7
7
|
const VIEWPORT_NAME = "SelectViewport";
|
|
8
|
+
|
|
8
9
|
export { FALLBACK_THRESHOLD, MIN_HEIGHT, SCROLL_ARROW_THRESHOLD, SCROLL_ARROW_VELOCITY, SELECT_NAME, VIEWPORT_NAME, WINDOW_PADDING };
|
|
9
10
|
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["jsx/constants.js"],"sourcesContent":["const SELECT_NAME = \"Select\";\nconst WINDOW_PADDING = 8;\nconst SCROLL_ARROW_VELOCITY = 8;\nconst SCROLL_ARROW_THRESHOLD = 8;\nconst MIN_HEIGHT = 80;\nconst FALLBACK_THRESHOLD = 16;\nconst VIEWPORT_NAME = \"SelectViewport\";\nexport {\n FALLBACK_THRESHOLD,\n MIN_HEIGHT,\n SCROLL_ARROW_THRESHOLD,\n SCROLL_ARROW_VELOCITY,\n SELECT_NAME,\n VIEWPORT_NAME,\n WINDOW_PADDING\n};\n//# sourceMappingURL=constants.js.map\n"],"mappings":";AAAA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,wBAAwB;AAC9B,MAAM,yBAAyB;AAC/B,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var constants_exports = {};
|
|
24
|
+
__export(constants_exports, {
|
|
25
|
+
FALLBACK_THRESHOLD: () => FALLBACK_THRESHOLD,
|
|
26
|
+
MIN_HEIGHT: () => MIN_HEIGHT,
|
|
27
|
+
SCROLL_ARROW_THRESHOLD: () => SCROLL_ARROW_THRESHOLD,
|
|
28
|
+
SCROLL_ARROW_VELOCITY: () => SCROLL_ARROW_VELOCITY,
|
|
29
|
+
SELECT_NAME: () => SELECT_NAME,
|
|
30
|
+
VIEWPORT_NAME: () => VIEWPORT_NAME,
|
|
31
|
+
WINDOW_PADDING: () => WINDOW_PADDING
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(constants_exports);
|
|
34
|
+
var SELECT_NAME = "Select";
|
|
35
|
+
var WINDOW_PADDING = 8;
|
|
36
|
+
var SCROLL_ARROW_VELOCITY = 8;
|
|
37
|
+
var SCROLL_ARROW_THRESHOLD = 8;
|
|
38
|
+
var MIN_HEIGHT = 80;
|
|
39
|
+
var FALLBACK_THRESHOLD = 16;
|
|
40
|
+
var VIEWPORT_NAME = "SelectViewport";
|