@tamagui/select 1.46.2 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +19 -19
- package/types/Select.d.ts +2 -2
- package/types/SelectViewport.d.ts +1 -1
- package/dist/jsx/BubbleSelect.mjs +0 -25
- package/dist/jsx/BubbleSelect.mjs.map +0 -6
- package/dist/jsx/Select.mjs +0 -379
- package/dist/jsx/Select.mjs.map +0 -6
- package/dist/jsx/SelectContent.mjs +0 -35
- package/dist/jsx/SelectContent.mjs.map +0 -6
- package/dist/jsx/SelectContent.native.mjs +0 -7
- package/dist/jsx/SelectContent.native.mjs.map +0 -6
- package/dist/jsx/SelectImpl.mjs +0 -311
- package/dist/jsx/SelectImpl.mjs.map +0 -6
- package/dist/jsx/SelectImpl.native.mjs +0 -10
- package/dist/jsx/SelectImpl.native.mjs.map +0 -6
- package/dist/jsx/SelectItem.mjs +0 -140
- package/dist/jsx/SelectItem.mjs.map +0 -6
- package/dist/jsx/SelectScrollButton.mjs +0 -108
- package/dist/jsx/SelectScrollButton.mjs.map +0 -6
- package/dist/jsx/SelectScrollButton.native.mjs +0 -7
- package/dist/jsx/SelectScrollButton.native.mjs.map +0 -6
- package/dist/jsx/SelectTrigger.mjs +0 -58
- package/dist/jsx/SelectTrigger.mjs.map +0 -6
- package/dist/jsx/SelectViewport.mjs +0 -109
- package/dist/jsx/SelectViewport.mjs.map +0 -6
- package/dist/jsx/SelectViewport.native.mjs +0 -18
- package/dist/jsx/SelectViewport.native.mjs.map +0 -6
- package/dist/jsx/constants.mjs +0 -17
- package/dist/jsx/constants.mjs.map +0 -6
- package/dist/jsx/context.mjs +0 -15
- package/dist/jsx/context.mjs.map +0 -6
- package/dist/jsx/index.mjs +0 -3
- package/dist/jsx/index.mjs.map +0 -6
- package/dist/jsx/types.mjs +0 -1
- package/dist/jsx/types.mjs.map +0 -6
- package/dist/jsx/useSelectBreakpointActive.mjs +0 -18
- package/dist/jsx/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AC,QAAQ,IAAI;AAAA,QAC/B;AAAA,MACF;AAAA,IACN;AAAA,EAEJ;AACF;",
|
|
5
|
-
"names": ["SelectTrigger"]
|
|
6
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { FloatingFocusManager } from "@floating-ui/react";
|
|
2
|
-
import { AnimatePresence } from "@tamagui/animate-presence";
|
|
3
|
-
import {
|
|
4
|
-
composeRefs,
|
|
5
|
-
isWeb,
|
|
6
|
-
useIsomorphicLayoutEffect
|
|
7
|
-
} from "@tamagui/core";
|
|
8
|
-
import { styled } from "@tamagui/core";
|
|
9
|
-
import { PortalItem } from "@tamagui/portal";
|
|
10
|
-
import { ThemeableStack } from "@tamagui/stacks";
|
|
11
|
-
import { VIEWPORT_NAME } from "./constants";
|
|
12
|
-
import { ForwardSelectContext, useSelectContext } from "./context";
|
|
13
|
-
import { useSelectBreakpointActive } from "./useSelectBreakpointActive";
|
|
14
|
-
const SelectViewportFrame = styled(ThemeableStack, {
|
|
15
|
-
name: VIEWPORT_NAME,
|
|
16
|
-
variants: {
|
|
17
|
-
unstyled: {
|
|
18
|
-
false: {
|
|
19
|
-
size: "$2",
|
|
20
|
-
backgroundColor: "$background",
|
|
21
|
-
elevate: true,
|
|
22
|
-
bordered: true,
|
|
23
|
-
userSelect: "none",
|
|
24
|
-
outlineWidth: 0
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
size: {
|
|
28
|
-
"...size": (val, { tokens }) => {
|
|
29
|
-
return {
|
|
30
|
-
borderRadius: tokens.radius[val] ?? val
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
defaultVariants: {
|
|
36
|
-
unstyled: false
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
const SelectViewport = SelectViewportFrame.styleable(
|
|
40
|
-
function SelectViewport2(props, forwardedRef) {
|
|
41
|
-
const { __scopeSelect, children, disableScroll, ...viewportProps } = props;
|
|
42
|
-
const context = useSelectContext(VIEWPORT_NAME, __scopeSelect);
|
|
43
|
-
const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
|
|
44
|
-
useIsomorphicLayoutEffect(() => {
|
|
45
|
-
if (context.update) {
|
|
46
|
-
context.update();
|
|
47
|
-
}
|
|
48
|
-
}, [breakpointActive]);
|
|
49
|
-
const composedRefs = composeRefs(
|
|
50
|
-
forwardedRef,
|
|
51
|
-
context.floatingContext?.refs.setFloating
|
|
52
|
-
);
|
|
53
|
-
if (context.shouldRenderWebNative) {
|
|
54
|
-
return <>{children}</>;
|
|
55
|
-
}
|
|
56
|
-
if (breakpointActive || !isWeb) {
|
|
57
|
-
return <PortalItem hostName={`${context.scopeKey}SheetContents`}><ForwardSelectContext context={context}>{children}</ForwardSelectContext></PortalItem>;
|
|
58
|
-
}
|
|
59
|
-
if (!context.interactions) {
|
|
60
|
-
if (process.env.NODE_ENV === "development") {
|
|
61
|
-
console.warn(`No interactions provided to Select, potentially missing Adapt`);
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
const {
|
|
66
|
-
style: { scrollbarWidth, listStyleType, overflow, ...restStyle },
|
|
67
|
-
...floatingProps
|
|
68
|
-
} = context.interactions.getFloatingProps();
|
|
69
|
-
return <>
|
|
70
|
-
{!disableScroll && !props.unstyled && <style
|
|
71
|
-
dangerouslySetInnerHTML={{
|
|
72
|
-
__html: selectViewportCSS
|
|
73
|
-
}}
|
|
74
|
-
/>}
|
|
75
|
-
<FloatingFocusManager context={context.floatingContext}><AnimatePresence>{context.open ? <SelectViewportFrame
|
|
76
|
-
key="select-viewport"
|
|
77
|
-
size={context.size}
|
|
78
|
-
role="presentation"
|
|
79
|
-
{...viewportProps}
|
|
80
|
-
ref={composedRefs}
|
|
81
|
-
{...floatingProps}
|
|
82
|
-
{...restStyle}
|
|
83
|
-
{...!props.unstyled && {
|
|
84
|
-
overflow: disableScroll ? void 0 : overflow ?? "scroll"
|
|
85
|
-
}}
|
|
86
|
-
>{children}</SelectViewportFrame> : null}</AnimatePresence></FloatingFocusManager>
|
|
87
|
-
{
|
|
88
|
-
/* keep in dom to allow for portal to the trigger... very hacky! we should fix */
|
|
89
|
-
}
|
|
90
|
-
{!context.open && <div style={{ display: "none" }}>{props.children}</div>}
|
|
91
|
-
</>;
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
const selectViewportCSS = `
|
|
95
|
-
.is_SelectViewport {
|
|
96
|
-
scrollbar-width: none;
|
|
97
|
-
-webkit-overflow-scrolling: touch;
|
|
98
|
-
overscroll-behavior: contain;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.is_SelectViewport::-webkit-scrollbar{
|
|
102
|
-
display:none
|
|
103
|
-
}
|
|
104
|
-
`;
|
|
105
|
-
export {
|
|
106
|
-
SelectViewport,
|
|
107
|
-
SelectViewportFrame
|
|
108
|
-
};
|
|
109
|
-
//# sourceMappingURL=SelectViewport.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectViewport.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAG/B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB,wBAAwB;AAEvD,SAAS,iCAAiC;AAMnC,MAAM,sBAAsB,OAAO,gBAAgB;AAAA,EACxD,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,iBAAiB;AAAA,QACjB,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,cAAc;AAAA,MAChB;AAAA,IACF;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,OAAO,MA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AAAA,QACC,IAAI;AAAA,QACJ,MAAM,QAAQ;AAAA,QAEd,KAAK;AAAA,YACD;AAAA,QACJ,KAAK;AAAA,YACD;AAAA,YACA;AAAA,YACC,CAAC,MAAM,YAAY;AAAA,UACtB,UAAU,gBAAgB,SAAY,YAAY;AAAA,QACpD;AAAA,QAEC,SACH,EAdC,uBAeC,KACN,EAlBC,gBAmBH,EApBC;AAAA;AAAA;AAAA;AAAA,OAuBA,CAAC,QAAQ,QAAQ,CAAC,IAAI,OAAO,EAAE,SAAS,OAAO,IAAI,MAAM,SAAS,EAAhD;AAAA,IACrB;AAAA,EAEJ;AACF;AAEA,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
5
|
-
"names": ["SelectViewport"]
|
|
6
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AdaptParentContext } from "@tamagui/adapt";
|
|
2
|
-
import { Theme, useThemeName } from "@tamagui/core";
|
|
3
|
-
import { PortalItem } from "@tamagui/portal";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import { VIEWPORT_NAME } from "./constants";
|
|
6
|
-
import { SelectProvider, useSelectContext } from "./context";
|
|
7
|
-
const SelectViewport = (props) => {
|
|
8
|
-
const { __scopeSelect, children } = props;
|
|
9
|
-
const context = useSelectContext(VIEWPORT_NAME, __scopeSelect);
|
|
10
|
-
const themeName = useThemeName();
|
|
11
|
-
const adaptContext = React.useContext(AdaptParentContext);
|
|
12
|
-
return <PortalItem hostName={`${context.scopeKey}SheetContents`}><Theme name={themeName}><SelectProvider scope={__scopeSelect} {...context}><AdaptParentContext.Provider value={adaptContext}>{children}</AdaptParentContext.Provider></SelectProvider></Theme></PortalItem>;
|
|
13
|
-
};
|
|
14
|
-
SelectViewport.displayName = VIEWPORT_NAME;
|
|
15
|
-
export {
|
|
16
|
-
SelectViewport
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=SelectViewport.native.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectViewport.native.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,0BAA0B;AACnC,SAAgB,OAAO,oBAAoB;AAC3C,SAAS,kBAAkB;AAC3B,YAAY,WAAW;AAEvB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,wBAAwB;AAG1C,MAAM,iBAAiB,CAAC,UAA4C;AACzE,QAAM,EAAE,eAAe,SAAS,IAAI;AACpC,QAAM,UAAU,iBAAiB,eAAe,aAAa;AAC7D,QAAM,YAAY,aAAa;AAC/B,QAAM,eAAe,MAAM,WAAW,kBAAkB;AAGxD,SACE,CAAC,WAAW,UAAU,GAAG,QAAQ,yBAC/B,CAAC,MAAM,MAAM,WACX,CAAC,eAAe,OAAO,mBAAmB,SACxC,CAAC,mBAAmB,SAAS,OAAO,eACjC,SACH,EAFC,mBAAmB,SAGtB,EAJC,eAKH,EANC,MAOH,EARC;AAUL;AAEA,eAAe,cAAc;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/jsx/constants.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const SELECT_NAME = "Select";
|
|
2
|
-
const WINDOW_PADDING = 8;
|
|
3
|
-
const SCROLL_ARROW_VELOCITY = 8;
|
|
4
|
-
const SCROLL_ARROW_THRESHOLD = 8;
|
|
5
|
-
const MIN_HEIGHT = 80;
|
|
6
|
-
const FALLBACK_THRESHOLD = 16;
|
|
7
|
-
const VIEWPORT_NAME = "SelectViewport";
|
|
8
|
-
export {
|
|
9
|
-
FALLBACK_THRESHOLD,
|
|
10
|
-
MIN_HEIGHT,
|
|
11
|
-
SCROLL_ARROW_THRESHOLD,
|
|
12
|
-
SCROLL_ARROW_VELOCITY,
|
|
13
|
-
SELECT_NAME,
|
|
14
|
-
VIEWPORT_NAME,
|
|
15
|
-
WINDOW_PADDING
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=constants.mjs.map
|
package/dist/jsx/context.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createContextScope } from "@tamagui/create-context";
|
|
2
|
-
import { SELECT_NAME } from "./constants";
|
|
3
|
-
const [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME);
|
|
4
|
-
const [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
5
|
-
const ForwardSelectContext = (props) => {
|
|
6
|
-
return <SelectProvider isInSheet scope={props.__scopeSelect} {...props.context}>{props.children}</SelectProvider>;
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
ForwardSelectContext,
|
|
10
|
-
SelectProvider,
|
|
11
|
-
createSelectContext,
|
|
12
|
-
createSelectScope,
|
|
13
|
-
useSelectContext
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=context.mjs.map
|
package/dist/jsx/context.mjs.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/context.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB;AAGrB,MAAM,CAAC,qBAAqB,iBAAiB,IAClD,mBAAmB,WAAW;AAEzB,MAAM,CAAC,gBAAgB,gBAAgB,IAC5C,oBAAwC,WAAW;AAE9C,MAAM,uBAAuB,CAClC,UACG;AACH,SACE,CAAC,eAAe,UAAU,OAAO,MAAM,mBAAmB,MAAM,UAC7D,MAAM,SACT,EAFC;AAIL;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/jsx/index.mjs
DELETED
package/dist/jsx/index.mjs.map
DELETED
package/dist/jsx/types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.mjs.map
|
package/dist/jsx/types.mjs.map
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useMedia } from "@tamagui/core";
|
|
2
|
-
const useSelectBreakpointActive = (sheetBreakpoint) => {
|
|
3
|
-
const media = useMedia();
|
|
4
|
-
if (!sheetBreakpoint)
|
|
5
|
-
return false;
|
|
6
|
-
if (sheetBreakpoint === true)
|
|
7
|
-
return true;
|
|
8
|
-
return sheetBreakpoint ? media[sheetBreakpoint] : false;
|
|
9
|
-
};
|
|
10
|
-
const useShowSelectSheet = (context) => {
|
|
11
|
-
const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
|
|
12
|
-
return context.open === false ? false : breakpointActive;
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
useSelectBreakpointActive,
|
|
16
|
-
useShowSelectSheet
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=useSelectBreakpointActive.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useSelectBreakpointActive.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,gBAAgB;AAIlB,MAAM,4BAA4B,CACvC,oBACG;AACH,QAAM,QAAQ,SAAS;AACvB,MAAI,CAAC;AAAiB,WAAO;AAC7B,MAAI,oBAAoB;AAAM,WAAO;AACrC,SAAO,kBAAkB,MAAM,eAAe,IAAI;AACpD;AAEO,MAAM,qBAAqB,CAAC,YAAgC;AACjE,QAAM,mBAAmB,0BAA0B,QAAQ,eAAe;AAC1E,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|