@tamagui/select 1.2.8 → 1.2.10
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/esm/BubbleSelect.mjs +25 -0
- package/dist/esm/BubbleSelect.mjs.map +7 -0
- package/dist/esm/Select.mjs +463 -0
- package/dist/esm/Select.mjs.map +7 -0
- package/dist/esm/SelectContent.mjs +31 -0
- package/dist/esm/SelectContent.mjs.map +7 -0
- package/dist/esm/SelectContent.native.mjs +7 -0
- package/dist/esm/SelectContent.native.mjs.map +7 -0
- package/dist/esm/SelectImpl.mjs +295 -0
- package/dist/esm/SelectImpl.mjs.map +7 -0
- package/dist/esm/SelectImpl.native.mjs +11 -0
- package/dist/esm/SelectImpl.native.mjs.map +7 -0
- package/dist/esm/SelectScrollButton.mjs +140 -0
- package/dist/esm/SelectScrollButton.mjs.map +7 -0
- package/dist/esm/SelectScrollButton.native.mjs +7 -0
- package/dist/esm/SelectScrollButton.native.mjs.map +7 -0
- package/dist/esm/SelectViewport.mjs +91 -0
- package/dist/esm/SelectViewport.mjs.map +7 -0
- package/dist/esm/SelectViewport.native.mjs +19 -0
- package/dist/esm/SelectViewport.native.mjs.map +7 -0
- package/dist/esm/constants.mjs +17 -0
- package/dist/esm/constants.mjs.map +7 -0
- package/dist/esm/context.mjs +16 -0
- package/dist/esm/context.mjs.map +7 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +7 -0
- package/dist/esm/types.mjs +1 -0
- package/dist/esm/types.mjs.map +7 -0
- package/dist/esm/useSelectBreakpointActive.mjs +18 -0
- package/dist/esm/useSelectBreakpointActive.mjs.map +7 -0
- package/dist/jsx/BubbleSelect.mjs +25 -0
- package/dist/jsx/BubbleSelect.mjs.map +7 -0
- package/dist/jsx/Select.mjs +427 -0
- package/dist/jsx/Select.mjs.map +7 -0
- package/dist/jsx/SelectContent.mjs +30 -0
- package/dist/jsx/SelectContent.mjs.map +7 -0
- package/dist/jsx/SelectContent.native.mjs +7 -0
- package/dist/jsx/SelectContent.native.mjs.map +7 -0
- package/dist/jsx/SelectImpl.mjs +287 -0
- package/dist/jsx/SelectImpl.mjs.map +7 -0
- package/dist/jsx/SelectImpl.native.mjs +10 -0
- package/dist/jsx/SelectImpl.native.mjs.map +7 -0
- package/dist/jsx/SelectScrollButton.mjs +126 -0
- package/dist/jsx/SelectScrollButton.mjs.map +7 -0
- package/dist/jsx/SelectScrollButton.native.mjs +7 -0
- package/dist/jsx/SelectScrollButton.native.mjs.map +7 -0
- package/dist/jsx/SelectViewport.mjs +83 -0
- package/dist/jsx/SelectViewport.mjs.map +7 -0
- package/dist/jsx/SelectViewport.native.mjs +18 -0
- package/dist/jsx/SelectViewport.native.mjs.map +7 -0
- package/dist/jsx/constants.mjs +17 -0
- package/dist/jsx/constants.mjs.map +7 -0
- package/dist/jsx/context.mjs +15 -0
- package/dist/jsx/context.mjs.map +7 -0
- package/dist/jsx/index.mjs +3 -0
- package/dist/jsx/index.mjs.map +7 -0
- package/dist/jsx/types.mjs +1 -0
- package/dist/jsx/types.mjs.map +7 -0
- package/dist/jsx/useSelectBreakpointActive.mjs +18 -0
- package/dist/jsx/useSelectBreakpointActive.mjs.map +7 -0
- package/package.json +16 -16
- package/types/context.d.ts +8 -2
- package/types/context.d.ts.map +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/SelectViewport.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import { AdaptParentContext } from '@tamagui/adapt'\nimport { Stack, Theme, useThemeName } from '@tamagui/core'\nimport { PortalItem } from '@tamagui/portal'\nimport * as React from 'react'\n\nimport { VIEWPORT_NAME } from './constants'\nimport { SelectProvider, useSelectContext } from './context'\nimport { ScopedProps, SelectViewportProps } from './types'\n\nexport const SelectViewport = (props: ScopedProps<SelectViewportProps>) => {\n const { __scopeSelect, children } = props\n const context = useSelectContext(VIEWPORT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const adaptContext = React.useContext(AdaptParentContext)\n\n // need to forward context...\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n <Theme name={themeName}>\n <SelectProvider scope={__scopeSelect} {...context}>\n <AdaptParentContext.Provider value={adaptContext}>\n {children}\n </AdaptParentContext.Provider>\n </SelectProvider>\n </Theme>\n </PortalItem>\n )\n}\n\nSelectViewport.displayName = VIEWPORT_NAME\n"],
|
|
5
|
+
"mappings": "AAoBU;AApBV,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,oBAAC,cAAW,UAAU,GAAG,QAAQ,yBAC/B,8BAAC,SAAM,MAAM,WACX,8BAAC,kBAAe,OAAO,eAAgB,GAAG,SACxC,8BAAC,mBAAmB,UAAnB,EAA4B,OAAO,cACjC,UACH,GACF,GACF,GACF;AAEJ;AAEA,eAAe,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants.tsx"],
|
|
4
|
+
"sourcesContent": ["export const SELECT_NAME = 'Select'\nexport const WINDOW_PADDING = 8\nexport const SCROLL_ARROW_VELOCITY = 8\nexport const SCROLL_ARROW_THRESHOLD = 8\nexport const MIN_HEIGHT = 80\nexport const FALLBACK_THRESHOLD = 16\nexport const VIEWPORT_NAME = 'SelectViewport'\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,wBAAwB;AAC9B,MAAM,yBAAyB;AAC/B,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContextScope } from "@tamagui/create-context";
|
|
3
|
+
import { SELECT_NAME } from "./constants";
|
|
4
|
+
const [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME);
|
|
5
|
+
const [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
6
|
+
const ForwardSelectContext = (props) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(SelectProvider, { isInSheet: true, scope: props.__scopeSelect, ...props.context, children: props.children });
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
ForwardSelectContext,
|
|
11
|
+
SelectProvider,
|
|
12
|
+
createSelectContext,
|
|
13
|
+
createSelectScope,
|
|
14
|
+
useSelectContext
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/context.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContextScope } from '@tamagui/create-context'\n\nimport { SELECT_NAME } from './constants'\nimport { ScopedProps, SelectContextValue } from './types'\n\nexport const [createSelectContext, createSelectScope] =\n createContextScope(SELECT_NAME)\n\nexport const [SelectProvider, useSelectContext] =\n createSelectContext<SelectContextValue>(SELECT_NAME)\n\nexport const ForwardSelectContext = (\n props: ScopedProps<{ children?: any; context: SelectContextValue }>,\n) => {\n return (\n <SelectProvider isInSheet scope={props.__scopeSelect} {...props.context}>\n {props.children}\n </SelectProvider>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAeI;AAfJ,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,oBAAC,kBAAe,WAAS,MAAC,OAAO,MAAM,eAAgB,GAAG,MAAM,SAC7D,gBAAM,UACT;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["export * from './Select'\nexport type {\n SelectContentProps,\n SelectProps,\n SelectScrollButtonProps,\n SelectViewportProps,\n} from './types'\nexport * from './context'\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AAOd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useSelectBreakpointActive.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useMedia } from '@tamagui/core'\n\nimport { SelectContextValue } from './types'\n\nexport const useSelectBreakpointActive = (\n sheetBreakpoint: SelectContextValue['sheetBreakpoint']\n) => {\n const media = useMedia()\n if (!sheetBreakpoint) return false\n if (sheetBreakpoint === true) return true\n return sheetBreakpoint ? media[sheetBreakpoint] : false\n}\n\nexport const useShowSelectSheet = (context: SelectContextValue) => {\n const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint)\n return context.open === false ? false : breakpointActive\n}\n"],
|
|
5
|
+
"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;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { usePrevious } from "@radix-ui/react-use-previous";
|
|
2
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
5
|
+
const { value, ...selectProps } = props;
|
|
6
|
+
const ref = React.useRef(null);
|
|
7
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8
|
+
const prevValue = usePrevious(value);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
const select = ref.current;
|
|
11
|
+
const selectProto = window.HTMLSelectElement.prototype;
|
|
12
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
13
|
+
selectProto,
|
|
14
|
+
"value"
|
|
15
|
+
);
|
|
16
|
+
const setValue = descriptor.set;
|
|
17
|
+
if (prevValue !== value && setValue) {
|
|
18
|
+
const event = new Event("change", { bubbles: true });
|
|
19
|
+
setValue.call(select, value);
|
|
20
|
+
select.dispatchEvent(event);
|
|
21
|
+
}
|
|
22
|
+
}, [prevValue, value]);
|
|
23
|
+
return null;
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=BubbleSelect.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BubbleSelect.tsx"],
|
|
4
|
+
"sourcesContent": ["import { usePrevious } from '@radix-ui/react-use-previous'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -----------------------------------------------------------------------------------------------*/\nconst BubbleSelect = React.forwardRef<\n HTMLSelectElement,\n React.ComponentPropsWithoutRef<'select'>\n>((props, forwardedRef) => {\n const { value, ...selectProps } = props\n const ref = React.useRef<HTMLSelectElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const prevValue = usePrevious(value)\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!\n const selectProto = window.HTMLSelectElement.prototype\n const descriptor = Object.getOwnPropertyDescriptor(\n selectProto,\n 'value',\n ) as PropertyDescriptor\n const setValue = descriptor.set\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true })\n setValue.call(select, value)\n select.dispatchEvent(event)\n }\n }, [prevValue, value])\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n // TODO\n return null\n // return (\n // <VisuallyHidden asChild>\n // <select {...selectProps} ref={composedRefs} defaultValue={value} />\n // </VisuallyHidden>\n // )\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAGvB,MAAM,eAAe,MAAM,WAGzB,CAAC,OAAO,iBAAiB;AACzB,QAAM,EAAE,OAAO,GAAG,YAAY,IAAI;AAClC,QAAM,MAAM,MAAM,OAA0B,IAAI;AAChD,QAAM,eAAe,gBAAgB,cAAc,GAAG;AACtD,QAAM,YAAY,YAAY,KAAK;AAGnC,QAAM,UAAU,MAAM;AACpB,UAAM,SAAS,IAAI;AACnB,UAAM,cAAc,OAAO,kBAAkB;AAC7C,UAAM,aAAa,OAAO;AAAA,MACxB;AAAA,MACA;AAAA,IACF;AACA,UAAM,WAAW,WAAW;AAC5B,QAAI,cAAc,SAAS,UAAU;AACnC,YAAM,QAAQ,IAAI,MAAM,UAAU,EAAE,SAAS,KAAK,CAAC;AACnD,eAAS,KAAK,QAAQ,KAAK;AAC3B,aAAO,cAAc,KAAK;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC;AAerB,SAAO;AAMT,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { Adapt, useAdaptParent } from "@tamagui/adapt";
|
|
2
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
+
import { isWeb } from "@tamagui/core";
|
|
4
|
+
import {
|
|
5
|
+
styled,
|
|
6
|
+
useGet,
|
|
7
|
+
useIsomorphicLayoutEffect,
|
|
8
|
+
withStaticProperties
|
|
9
|
+
} from "@tamagui/core";
|
|
10
|
+
import { useId } from "@tamagui/core";
|
|
11
|
+
import { ListItem } from "@tamagui/list-item";
|
|
12
|
+
import { PortalHost } from "@tamagui/portal";
|
|
13
|
+
import { Separator } from "@tamagui/separator";
|
|
14
|
+
import { ControlledSheet, SheetController } from "@tamagui/sheet";
|
|
15
|
+
import { XStack, YStack } from "@tamagui/stacks";
|
|
16
|
+
import { Paragraph, SizableText } from "@tamagui/text";
|
|
17
|
+
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
18
|
+
import * as React from "react";
|
|
19
|
+
import { SELECT_NAME } from "./constants";
|
|
20
|
+
import { SelectProvider, createSelectContext, useSelectContext } from "./context";
|
|
21
|
+
import { SelectContent } from "./SelectContent";
|
|
22
|
+
import { SelectInlineImpl } from "./SelectImpl";
|
|
23
|
+
import { SelectScrollDownButton, SelectScrollUpButton } from "./SelectScrollButton";
|
|
24
|
+
import { SelectViewport } from "./SelectViewport";
|
|
25
|
+
import {
|
|
26
|
+
useSelectBreakpointActive,
|
|
27
|
+
useShowSelectSheet
|
|
28
|
+
} from "./useSelectBreakpointActive";
|
|
29
|
+
const TRIGGER_NAME = "SelectTrigger";
|
|
30
|
+
const SelectTrigger = React.forwardRef(
|
|
31
|
+
(props, forwardedRef) => {
|
|
32
|
+
const {
|
|
33
|
+
__scopeSelect,
|
|
34
|
+
disabled = false,
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
"aria-labelledby": ariaLabelledby,
|
|
37
|
+
...triggerProps
|
|
38
|
+
} = props;
|
|
39
|
+
const context = useSelectContext(TRIGGER_NAME, __scopeSelect);
|
|
40
|
+
const labelledBy = ariaLabelledby;
|
|
41
|
+
return <ListItem
|
|
42
|
+
componentName={TRIGGER_NAME}
|
|
43
|
+
backgrounded
|
|
44
|
+
radiused
|
|
45
|
+
hoverTheme
|
|
46
|
+
pressTheme
|
|
47
|
+
focusTheme
|
|
48
|
+
focusable
|
|
49
|
+
borderWidth={1}
|
|
50
|
+
size={context.size}
|
|
51
|
+
aria-expanded={context.open}
|
|
52
|
+
aria-autocomplete="none"
|
|
53
|
+
aria-labelledby={labelledBy}
|
|
54
|
+
dir={context.dir}
|
|
55
|
+
disabled={disabled}
|
|
56
|
+
data-disabled={disabled ? "" : void 0}
|
|
57
|
+
{...triggerProps}
|
|
58
|
+
ref={forwardedRef}
|
|
59
|
+
{...process.env.TAMAGUI_TARGET === "web" && context.interactions ? context.interactions.getReferenceProps() : {
|
|
60
|
+
onPress() {
|
|
61
|
+
context.setOpen(!context.open);
|
|
62
|
+
}
|
|
63
|
+
}}
|
|
64
|
+
/>;
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
SelectTrigger.displayName = TRIGGER_NAME;
|
|
68
|
+
const VALUE_NAME = "SelectValue";
|
|
69
|
+
const SelectValueFrame = styled(Paragraph, {
|
|
70
|
+
name: VALUE_NAME,
|
|
71
|
+
userSelect: "none"
|
|
72
|
+
});
|
|
73
|
+
const SelectValue = SelectValueFrame.extractable(
|
|
74
|
+
React.forwardRef(
|
|
75
|
+
({
|
|
76
|
+
__scopeSelect,
|
|
77
|
+
children: childrenProp,
|
|
78
|
+
placeholder
|
|
79
|
+
}, forwardedRef) => {
|
|
80
|
+
const context = useSelectContext(VALUE_NAME, __scopeSelect);
|
|
81
|
+
const { onValueNodeHasChildrenChange } = context;
|
|
82
|
+
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
83
|
+
const children = childrenProp ?? context.selectedItem;
|
|
84
|
+
const hasChildren = !!children;
|
|
85
|
+
const selectValueChildren = context.value === void 0 && placeholder !== void 0 ? placeholder : children;
|
|
86
|
+
useIsomorphicLayoutEffect(() => {
|
|
87
|
+
onValueNodeHasChildrenChange(hasChildren);
|
|
88
|
+
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
89
|
+
return <SelectValueFrame
|
|
90
|
+
size={context.size}
|
|
91
|
+
ref={composedRefs}
|
|
92
|
+
pointerEvents="none"
|
|
93
|
+
>{selectValueChildren}</SelectValueFrame>;
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
SelectValue.displayName = VALUE_NAME;
|
|
98
|
+
const SelectIcon = styled(XStack, {
|
|
99
|
+
name: "SelectIcon",
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
"aria-hidden": true,
|
|
102
|
+
children: <Paragraph>{"\u25BC"}</Paragraph>
|
|
103
|
+
});
|
|
104
|
+
const ITEM_NAME = "SelectItem";
|
|
105
|
+
const [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);
|
|
106
|
+
const SelectItem = React.forwardRef(
|
|
107
|
+
(props, forwardedRef) => {
|
|
108
|
+
const {
|
|
109
|
+
__scopeSelect,
|
|
110
|
+
value,
|
|
111
|
+
disabled = false,
|
|
112
|
+
textValue: textValueProp,
|
|
113
|
+
index,
|
|
114
|
+
...itemProps
|
|
115
|
+
} = props;
|
|
116
|
+
const context = useSelectContext(ITEM_NAME, __scopeSelect);
|
|
117
|
+
const isSelected = context.value === value;
|
|
118
|
+
const textId = useId();
|
|
119
|
+
const {
|
|
120
|
+
selectedIndex,
|
|
121
|
+
setSelectedIndex,
|
|
122
|
+
listRef,
|
|
123
|
+
open,
|
|
124
|
+
setOpen,
|
|
125
|
+
onChange,
|
|
126
|
+
setActiveIndex,
|
|
127
|
+
allowMouseUpRef,
|
|
128
|
+
allowSelectRef,
|
|
129
|
+
setValueAtIndex,
|
|
130
|
+
selectTimeoutRef,
|
|
131
|
+
dataRef
|
|
132
|
+
} = context;
|
|
133
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => {
|
|
134
|
+
if (!isWeb)
|
|
135
|
+
return;
|
|
136
|
+
if (node instanceof HTMLElement) {
|
|
137
|
+
if (listRef) {
|
|
138
|
+
listRef.current[index] = node;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
React.useEffect(() => {
|
|
143
|
+
setValueAtIndex(index, value);
|
|
144
|
+
}, [index, setValueAtIndex, value]);
|
|
145
|
+
function handleSelect() {
|
|
146
|
+
setSelectedIndex(index);
|
|
147
|
+
onChange(value);
|
|
148
|
+
setOpen(false);
|
|
149
|
+
}
|
|
150
|
+
const selectItemProps = context.interactions ? context.interactions.getItemProps({
|
|
151
|
+
onTouchStart() {
|
|
152
|
+
allowSelectRef.current = true;
|
|
153
|
+
allowMouseUpRef.current = false;
|
|
154
|
+
},
|
|
155
|
+
onKeyDown(event) {
|
|
156
|
+
if (event.key === "Enter" || event.key === " " && !dataRef?.current.typing) {
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
handleSelect();
|
|
159
|
+
} else {
|
|
160
|
+
allowSelectRef.current = true;
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
onClick() {
|
|
164
|
+
if (allowSelectRef.current) {
|
|
165
|
+
setSelectedIndex(index);
|
|
166
|
+
setOpen(false);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
onMouseUp() {
|
|
170
|
+
if (!allowMouseUpRef.current) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (allowSelectRef.current) {
|
|
174
|
+
handleSelect();
|
|
175
|
+
}
|
|
176
|
+
clearTimeout(selectTimeoutRef.current);
|
|
177
|
+
selectTimeoutRef.current = setTimeout(() => {
|
|
178
|
+
allowSelectRef.current = true;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}) : {
|
|
182
|
+
onPress: handleSelect
|
|
183
|
+
};
|
|
184
|
+
return <SelectItemContextProvider
|
|
185
|
+
scope={__scopeSelect}
|
|
186
|
+
value={value}
|
|
187
|
+
textId={textId || ""}
|
|
188
|
+
isSelected={isSelected}
|
|
189
|
+
><ListItem
|
|
190
|
+
tag="div"
|
|
191
|
+
backgrounded
|
|
192
|
+
pressTheme
|
|
193
|
+
cursor=""
|
|
194
|
+
focusTheme
|
|
195
|
+
outlineWidth={0}
|
|
196
|
+
componentName={ITEM_NAME}
|
|
197
|
+
ref={composedRefs}
|
|
198
|
+
aria-labelledby={textId}
|
|
199
|
+
aria-selected={isSelected}
|
|
200
|
+
data-state={isSelected ? "active" : "inactive"}
|
|
201
|
+
aria-disabled={disabled || void 0}
|
|
202
|
+
data-disabled={disabled ? "" : void 0}
|
|
203
|
+
tabIndex={disabled ? void 0 : -1}
|
|
204
|
+
size={context.size}
|
|
205
|
+
{...itemProps}
|
|
206
|
+
{...selectItemProps}
|
|
207
|
+
/></SelectItemContextProvider>;
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
SelectItem.displayName = ITEM_NAME;
|
|
211
|
+
const ITEM_TEXT_NAME = "SelectItemText";
|
|
212
|
+
const SelectItemTextFrame = styled(SizableText, {
|
|
213
|
+
name: ITEM_TEXT_NAME,
|
|
214
|
+
userSelect: "none"
|
|
215
|
+
});
|
|
216
|
+
const SelectItemText = React.forwardRef(
|
|
217
|
+
(props, forwardedRef) => {
|
|
218
|
+
const { __scopeSelect, className, ...itemTextProps } = props;
|
|
219
|
+
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
220
|
+
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
221
|
+
const ref = React.useRef(null);
|
|
222
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
223
|
+
const isSelected = Boolean(itemContext.isSelected && context.valueNode);
|
|
224
|
+
const contents = React.useMemo(
|
|
225
|
+
() => <SelectItemTextFrame
|
|
226
|
+
className={className}
|
|
227
|
+
size={context.size}
|
|
228
|
+
id={itemContext.textId}
|
|
229
|
+
{...itemTextProps}
|
|
230
|
+
ref={composedRefs}
|
|
231
|
+
/>,
|
|
232
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
233
|
+
[props, context.size, className, itemContext.textId]
|
|
234
|
+
);
|
|
235
|
+
useIsomorphicLayoutEffect(() => {
|
|
236
|
+
if (isSelected) {
|
|
237
|
+
context.setSelectedItem(contents);
|
|
238
|
+
}
|
|
239
|
+
}, [isSelected, contents]);
|
|
240
|
+
return <>{contents}</>;
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
244
|
+
const ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
245
|
+
const SelectItemIndicatorFrame = styled(XStack, {
|
|
246
|
+
name: ITEM_TEXT_NAME
|
|
247
|
+
});
|
|
248
|
+
const SelectItemIndicator = React.forwardRef(
|
|
249
|
+
(props, forwardedRef) => {
|
|
250
|
+
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
251
|
+
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
252
|
+
return itemContext.isSelected ? <SelectItemIndicatorFrame aria-hidden {...itemIndicatorProps} ref={forwardedRef} /> : null;
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
256
|
+
const GROUP_NAME = "SelectGroup";
|
|
257
|
+
const [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);
|
|
258
|
+
const SelectGroupFrame = styled(YStack, {
|
|
259
|
+
name: GROUP_NAME,
|
|
260
|
+
width: "100%"
|
|
261
|
+
});
|
|
262
|
+
const SelectGroup = React.forwardRef(
|
|
263
|
+
(props, forwardedRef) => {
|
|
264
|
+
const { __scopeSelect, ...groupProps } = props;
|
|
265
|
+
const groupId = useId();
|
|
266
|
+
return <SelectGroupContextProvider scope={__scopeSelect} id={groupId || ""}><SelectGroupFrame
|
|
267
|
+
role="group"
|
|
268
|
+
aria-labelledby={groupId}
|
|
269
|
+
{...groupProps}
|
|
270
|
+
ref={forwardedRef}
|
|
271
|
+
/></SelectGroupContextProvider>;
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
SelectGroup.displayName = GROUP_NAME;
|
|
275
|
+
const LABEL_NAME = "SelectLabel";
|
|
276
|
+
const SelectLabel = React.forwardRef(
|
|
277
|
+
(props, forwardedRef) => {
|
|
278
|
+
const { __scopeSelect, ...labelProps } = props;
|
|
279
|
+
const context = useSelectContext(LABEL_NAME, __scopeSelect);
|
|
280
|
+
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
281
|
+
return <ListItem
|
|
282
|
+
tag="div"
|
|
283
|
+
componentName={LABEL_NAME}
|
|
284
|
+
fontWeight="800"
|
|
285
|
+
id={groupContext.id}
|
|
286
|
+
size={context.size}
|
|
287
|
+
{...labelProps}
|
|
288
|
+
ref={forwardedRef}
|
|
289
|
+
/>;
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
SelectLabel.displayName = LABEL_NAME;
|
|
293
|
+
const SelectSeparator = styled(Separator, {
|
|
294
|
+
name: "SelectSeparator"
|
|
295
|
+
});
|
|
296
|
+
const SelectSheetController = (props) => {
|
|
297
|
+
const context = useSelectContext("SelectSheetController", props.__scopeSelect);
|
|
298
|
+
const showSheet = useShowSelectSheet(context);
|
|
299
|
+
const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
|
|
300
|
+
const getShowSheet = useGet(showSheet);
|
|
301
|
+
return <SheetController
|
|
302
|
+
onOpenChange={(val) => {
|
|
303
|
+
if (getShowSheet()) {
|
|
304
|
+
props.onOpenChange(val);
|
|
305
|
+
}
|
|
306
|
+
}}
|
|
307
|
+
open={context.open}
|
|
308
|
+
hidden={breakpointActive === false}
|
|
309
|
+
>{props.children}</SheetController>;
|
|
310
|
+
};
|
|
311
|
+
const SelectSheetImpl = (props) => {
|
|
312
|
+
return <>{props.children}</>;
|
|
313
|
+
};
|
|
314
|
+
const Select = withStaticProperties(
|
|
315
|
+
(props) => {
|
|
316
|
+
const {
|
|
317
|
+
__scopeSelect,
|
|
318
|
+
children,
|
|
319
|
+
open: openProp,
|
|
320
|
+
defaultOpen,
|
|
321
|
+
onOpenChange,
|
|
322
|
+
value: valueProp,
|
|
323
|
+
defaultValue,
|
|
324
|
+
onValueChange,
|
|
325
|
+
size: sizeProp = "$true",
|
|
326
|
+
dir
|
|
327
|
+
} = props;
|
|
328
|
+
const id = useId();
|
|
329
|
+
const scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id;
|
|
330
|
+
const { when, AdaptProvider } = useAdaptParent({
|
|
331
|
+
Contents: React.useCallback(
|
|
332
|
+
() => <PortalHost name={`${scopeKey}SheetContents`} />,
|
|
333
|
+
[scopeKey]
|
|
334
|
+
)
|
|
335
|
+
});
|
|
336
|
+
const sheetBreakpoint = when;
|
|
337
|
+
const isSheet = useSelectBreakpointActive(sheetBreakpoint);
|
|
338
|
+
const SelectImpl = isSheet || !isWeb ? SelectSheetImpl : SelectInlineImpl;
|
|
339
|
+
const forceUpdate = React.useReducer(() => ({}), {})[1];
|
|
340
|
+
const [selectedItem, setSelectedItem] = React.useState(null);
|
|
341
|
+
const [open, setOpen] = useControllableState({
|
|
342
|
+
prop: openProp,
|
|
343
|
+
defaultProp: defaultOpen || false,
|
|
344
|
+
onChange: onOpenChange,
|
|
345
|
+
strategy: "most-recent-wins"
|
|
346
|
+
});
|
|
347
|
+
const [value, setValue] = useControllableState({
|
|
348
|
+
prop: valueProp,
|
|
349
|
+
defaultProp: defaultValue || "",
|
|
350
|
+
onChange: onValueChange,
|
|
351
|
+
strategy: "most-recent-wins",
|
|
352
|
+
transition: true
|
|
353
|
+
});
|
|
354
|
+
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
355
|
+
const selectedIndexRef = React.useRef(null);
|
|
356
|
+
const activeIndexRef = React.useRef(null);
|
|
357
|
+
const listContentRef = React.useRef([]);
|
|
358
|
+
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
359
|
+
const [valueNode, setValueNode] = React.useState(null);
|
|
360
|
+
const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
|
|
361
|
+
useIsomorphicLayoutEffect(() => {
|
|
362
|
+
selectedIndexRef.current = selectedIndex;
|
|
363
|
+
activeIndexRef.current = activeIndex;
|
|
364
|
+
});
|
|
365
|
+
return <AdaptProvider><SelectProvider
|
|
366
|
+
dir={dir}
|
|
367
|
+
blockSelection={false}
|
|
368
|
+
size={sizeProp}
|
|
369
|
+
fallback={false}
|
|
370
|
+
selectedItem={selectedItem}
|
|
371
|
+
setSelectedItem={setSelectedItem}
|
|
372
|
+
forceUpdate={forceUpdate}
|
|
373
|
+
valueNode={valueNode}
|
|
374
|
+
onValueNodeChange={setValueNode}
|
|
375
|
+
onValueNodeHasChildrenChange={setValueNodeHasChildren}
|
|
376
|
+
valueNodeHasChildren={valueNodeHasChildren}
|
|
377
|
+
scopeKey={scopeKey}
|
|
378
|
+
sheetBreakpoint={sheetBreakpoint}
|
|
379
|
+
scope={__scopeSelect}
|
|
380
|
+
setValueAtIndex={(index, value2) => {
|
|
381
|
+
listContentRef.current[index] = value2;
|
|
382
|
+
}}
|
|
383
|
+
activeIndex={activeIndex}
|
|
384
|
+
onChange={setValue}
|
|
385
|
+
selectedIndex={selectedIndex}
|
|
386
|
+
setActiveIndex={setActiveIndex}
|
|
387
|
+
setOpen={setOpen}
|
|
388
|
+
setSelectedIndex={setSelectedIndex}
|
|
389
|
+
value={value}
|
|
390
|
+
open={open}
|
|
391
|
+
><SelectSheetController onOpenChange={setOpen} __scopeSelect={__scopeSelect}><SelectImpl
|
|
392
|
+
activeIndexRef={activeIndexRef}
|
|
393
|
+
listContentRef={listContentRef}
|
|
394
|
+
selectedIndexRef={selectedIndexRef}
|
|
395
|
+
{...props}
|
|
396
|
+
open={open}
|
|
397
|
+
value={value}
|
|
398
|
+
>{children}</SelectImpl></SelectSheetController></SelectProvider></AdaptProvider>;
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
Adapt,
|
|
402
|
+
Content: SelectContent,
|
|
403
|
+
Group: SelectGroup,
|
|
404
|
+
Icon: SelectIcon,
|
|
405
|
+
Item: SelectItem,
|
|
406
|
+
ItemIndicator: SelectItemIndicator,
|
|
407
|
+
ItemText: SelectItemText,
|
|
408
|
+
Label: SelectLabel,
|
|
409
|
+
ScrollDownButton: SelectScrollDownButton,
|
|
410
|
+
ScrollUpButton: SelectScrollUpButton,
|
|
411
|
+
Trigger: SelectTrigger,
|
|
412
|
+
Value: SelectValue,
|
|
413
|
+
Viewport: SelectViewport,
|
|
414
|
+
Sheet: ControlledSheet
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
Select.displayName = SELECT_NAME;
|
|
418
|
+
export {
|
|
419
|
+
Select,
|
|
420
|
+
SelectGroupFrame,
|
|
421
|
+
SelectIcon,
|
|
422
|
+
SelectItem,
|
|
423
|
+
SelectItemTextFrame,
|
|
424
|
+
SelectSeparator,
|
|
425
|
+
SelectTrigger
|
|
426
|
+
};
|
|
427
|
+
//# sourceMappingURL=Select.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Select.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Adapt, useAdaptParent } from '@tamagui/adapt'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { GetProps, TamaguiElement, isClient, isWeb } from '@tamagui/core'\nimport {\n styled,\n useGet,\n useIsomorphicLayoutEffect,\n withStaticProperties,\n} from '@tamagui/core'\nimport { useId } from '@tamagui/core'\nimport { ListItem, ListItemProps } from '@tamagui/list-item'\nimport { PortalHost } from '@tamagui/portal'\nimport { Separator } from '@tamagui/separator'\nimport { ControlledSheet, SheetController } from '@tamagui/sheet'\nimport { XStack, YStack, YStackProps } from '@tamagui/stacks'\nimport { Paragraph, SizableText } from '@tamagui/text'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\n\nimport { SELECT_NAME } from './constants'\nimport { SelectProvider, createSelectContext, useSelectContext } from './context'\nimport { SelectContent } from './SelectContent'\nimport { SelectInlineImpl } from './SelectImpl'\nimport { SelectScrollDownButton, SelectScrollUpButton } from './SelectScrollButton'\nimport { SelectViewport } from './SelectViewport'\nimport { ScopedProps, SelectImplProps, SelectProps } from './types'\nimport {\n useSelectBreakpointActive,\n useShowSelectSheet,\n} from './useSelectBreakpointActive'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SelectTrigger'\n\nexport type SelectTriggerProps = ListItemProps\n\nexport const SelectTrigger = React.forwardRef<TamaguiElement, SelectTriggerProps>(\n (props: ScopedProps<SelectTriggerProps>, forwardedRef) => {\n const {\n __scopeSelect,\n disabled = false,\n // @ts-ignore\n 'aria-labelledby': ariaLabelledby,\n ...triggerProps\n } = props\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect)\n // const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange)\n // const getItems = useCollection(__scopeSelect)\n // const labelId = useLabelContext(context.trigger)\n const labelledBy = ariaLabelledby // || labelId\n\n return (\n <ListItem\n componentName={TRIGGER_NAME}\n backgrounded\n radiused\n hoverTheme\n pressTheme\n focusTheme\n focusable\n borderWidth={1}\n size={context.size}\n // aria-controls={context.contentId}\n aria-expanded={context.open}\n aria-autocomplete=\"none\"\n aria-labelledby={labelledBy}\n dir={context.dir}\n disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n {...triggerProps}\n ref={forwardedRef}\n {...(process.env.TAMAGUI_TARGET === 'web' && context.interactions\n ? context.interactions.getReferenceProps()\n : {\n onPress() {\n context.setOpen(!context.open)\n },\n })}\n />\n )\n }\n)\n\nSelectTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectValue\n * -----------------------------------------------------------------------------------------------*/\n\nconst VALUE_NAME = 'SelectValue'\n\nconst SelectValueFrame = styled(Paragraph, {\n name: VALUE_NAME,\n userSelect: 'none',\n})\n\ntype SelectValueProps = GetProps<typeof SelectValueFrame> & {\n placeholder?: React.ReactNode\n}\n\nconst SelectValue = SelectValueFrame.extractable(\n React.forwardRef<TamaguiElement, SelectValueProps>(\n (\n {\n __scopeSelect,\n children: childrenProp,\n placeholder,\n }: ScopedProps<SelectValueProps>,\n forwardedRef\n ) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const context = useSelectContext(VALUE_NAME, __scopeSelect)\n const { onValueNodeHasChildrenChange } = context\n const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange)\n\n const children = childrenProp ?? context.selectedItem\n const hasChildren = !!children\n const selectValueChildren =\n context.value === undefined && placeholder !== undefined ? placeholder : children\n\n useIsomorphicLayoutEffect(() => {\n onValueNodeHasChildrenChange(hasChildren)\n }, [onValueNodeHasChildrenChange, hasChildren])\n\n return (\n <SelectValueFrame\n size={context.size}\n ref={composedRefs}\n // we don't want events from the portalled `SelectValue` children to bubble\n // through the item they came from\n pointerEvents=\"none\"\n >\n {selectValueChildren}\n </SelectValueFrame>\n )\n }\n )\n)\n\nSelectValue.displayName = VALUE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectIcon\n * -----------------------------------------------------------------------------------------------*/\n\nexport const SelectIcon = styled(XStack, {\n name: 'SelectIcon',\n // @ts-ignore\n 'aria-hidden': true,\n children: <Paragraph>\u25BC</Paragraph>,\n})\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'SelectItem'\n\ntype SelectItemContextValue = {\n value: string\n textId: string\n isSelected: boolean\n}\n\nconst [SelectItemContextProvider, useSelectItemContext] =\n createSelectContext<SelectItemContextValue>(ITEM_NAME)\n\nexport interface SelectItemProps extends ListItemProps {\n value: string\n index: number\n disabled?: boolean\n textValue?: string\n}\n\nexport const SelectItem = React.forwardRef<TamaguiElement, SelectItemProps>(\n (props: ScopedProps<SelectItemProps>, forwardedRef) => {\n const {\n __scopeSelect,\n value,\n disabled = false,\n textValue: textValueProp,\n index,\n ...itemProps\n } = props\n const context = useSelectContext(ITEM_NAME, __scopeSelect)\n const isSelected = context.value === value\n const textId = useId()\n\n const {\n selectedIndex,\n setSelectedIndex,\n listRef,\n open,\n setOpen,\n onChange,\n setActiveIndex,\n allowMouseUpRef,\n allowSelectRef,\n setValueAtIndex,\n selectTimeoutRef,\n dataRef,\n } = context\n\n const composedRefs = useComposedRefs(forwardedRef, (node) => {\n if (!isWeb) return\n if (node instanceof HTMLElement) {\n if (listRef) {\n listRef.current[index] = node\n }\n }\n })\n\n React.useEffect(() => {\n setValueAtIndex(index, value)\n }, [index, setValueAtIndex, value])\n\n function handleSelect() {\n setSelectedIndex(index)\n onChange(value)\n setOpen(false)\n }\n\n const selectItemProps = context.interactions\n ? context.interactions.getItemProps({\n onTouchStart() {\n allowSelectRef!.current = true\n allowMouseUpRef!.current = false\n },\n onKeyDown(event) {\n if (\n event.key === 'Enter' ||\n (event.key === ' ' && !dataRef?.current.typing)\n ) {\n event.preventDefault()\n handleSelect()\n } else {\n allowSelectRef!.current = true\n }\n },\n onClick() {\n if (allowSelectRef!.current) {\n setSelectedIndex(index)\n setOpen(false)\n }\n },\n onMouseUp() {\n if (!allowMouseUpRef!.current) {\n return\n }\n\n if (allowSelectRef!.current) {\n handleSelect()\n }\n\n // On touch devices, prevent the element from\n // immediately closing `onClick` by deferring it\n clearTimeout(selectTimeoutRef!.current)\n selectTimeoutRef!.current = setTimeout(() => {\n allowSelectRef!.current = true\n })\n },\n })\n : {\n onPress: handleSelect,\n }\n\n return (\n <SelectItemContextProvider\n scope={__scopeSelect}\n value={value}\n textId={textId || ''}\n isSelected={isSelected}\n >\n <ListItem\n tag=\"div\"\n backgrounded\n pressTheme\n cursor=\"\"\n focusTheme\n outlineWidth={0}\n componentName={ITEM_NAME}\n ref={composedRefs}\n aria-labelledby={textId}\n aria-selected={isSelected}\n data-state={isSelected ? 'active' : 'inactive'}\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n tabIndex={disabled ? undefined : -1}\n size={context.size}\n {...itemProps}\n {...selectItemProps}\n />\n </SelectItemContextProvider>\n )\n }\n)\n\nSelectItem.displayName = ITEM_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'SelectItemText'\n\nexport const SelectItemTextFrame = styled(SizableText, {\n name: ITEM_TEXT_NAME,\n userSelect: 'none',\n})\n\ntype SelectItemTextProps = GetProps<typeof SelectItemTextFrame>\n\nconst SelectItemText = React.forwardRef<TamaguiElement, SelectItemTextProps>(\n (props: ScopedProps<SelectItemTextProps>, forwardedRef) => {\n const { __scopeSelect, className, ...itemTextProps } = props\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect)\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect)\n const ref = React.useRef<TamaguiElement | null>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const isSelected = Boolean(itemContext.isSelected && context.valueNode)\n\n const contents = React.useMemo(\n () => (\n <SelectItemTextFrame\n className={className}\n size={context.size}\n id={itemContext.textId}\n {...itemTextProps}\n ref={composedRefs}\n />\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [props, context.size, className, itemContext.textId]\n )\n\n // until portals work in sub-trees on RN, use this just for native:\n useIsomorphicLayoutEffect(() => {\n if (isSelected) {\n context.setSelectedItem(contents)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isSelected, contents])\n\n return (\n <>\n {contents}\n\n {/* Portal the select item text into the trigger value node */}\n {/* this needs some extra stability between renders */}\n {/* {isWeb && isSelected\n ? ReactDOM.createPortal(itemTextProps.children, context.valueNode!)\n : null} */}\n\n {/* Portal an option in the bubble select */}\n {/* {context.bubbleSelect\n ? ReactDOM.createPortal(\n // we use `.textContent` because `option` only support `string` or `number`\n <option value={itemContext.value}>{ref.current?.textContent}</option>,\n context.bubbleSelect\n )\n : null} */}\n </>\n )\n }\n)\n\nSelectItemText.displayName = ITEM_TEXT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'SelectItemIndicator'\n\nconst SelectItemIndicatorFrame = styled(XStack, {\n name: ITEM_TEXT_NAME,\n})\n\ntype SelectItemIndicatorProps = GetProps<typeof SelectItemIndicatorFrame>\n\nconst SelectItemIndicator = React.forwardRef<TamaguiElement, SelectItemIndicatorProps>(\n (props: ScopedProps<SelectItemIndicatorProps>, forwardedRef) => {\n const { __scopeSelect, ...itemIndicatorProps } = props\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect)\n return itemContext.isSelected ? (\n <SelectItemIndicatorFrame aria-hidden {...itemIndicatorProps} ref={forwardedRef} />\n ) : null\n }\n)\n\nSelectItemIndicator.displayName = ITEM_INDICATOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'SelectGroup'\n\ntype SelectGroupContextValue = { id: string }\n\nconst [SelectGroupContextProvider, useSelectGroupContext] =\n createSelectContext<SelectGroupContextValue>(GROUP_NAME)\n\nexport const SelectGroupFrame = styled(YStack, {\n name: GROUP_NAME,\n width: '100%',\n})\n\ntype SelectGroupProps = GetProps<typeof SelectGroupFrame>\n\nconst SelectGroup = React.forwardRef<TamaguiElement, SelectGroupProps>(\n (props: ScopedProps<SelectGroupProps>, forwardedRef) => {\n const { __scopeSelect, ...groupProps } = props\n const groupId = useId()\n return (\n <SelectGroupContextProvider scope={__scopeSelect} id={groupId || ''}>\n <SelectGroupFrame\n // @ts-ignore\n role=\"group\"\n aria-labelledby={groupId}\n {...groupProps}\n ref={forwardedRef}\n />\n </SelectGroupContextProvider>\n )\n }\n)\n\nSelectGroup.displayName = GROUP_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'SelectLabel'\n\nexport type SelectLabelProps = ListItemProps\n\nconst SelectLabel = React.forwardRef<TamaguiElement, SelectLabelProps>(\n (props: ScopedProps<SelectLabelProps>, forwardedRef) => {\n const { __scopeSelect, ...labelProps } = props\n const context = useSelectContext(LABEL_NAME, __scopeSelect)\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect)\n return (\n <ListItem\n tag=\"div\"\n componentName={LABEL_NAME}\n fontWeight=\"800\"\n id={groupContext.id}\n size={context.size}\n {...labelProps}\n ref={forwardedRef}\n />\n )\n }\n)\n\nSelectLabel.displayName = LABEL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nexport const SelectSeparator = styled(Separator, {\n name: 'SelectSeparator',\n})\n\nconst SelectSheetController = (\n props: ScopedProps<{}> & {\n children: React.ReactNode\n onOpenChange: React.Dispatch<React.SetStateAction<boolean>>\n }\n) => {\n const context = useSelectContext('SelectSheetController', props.__scopeSelect)\n const showSheet = useShowSelectSheet(context)\n const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint)\n const getShowSheet = useGet(showSheet)\n\n return (\n <SheetController\n onOpenChange={(val) => {\n if (getShowSheet()) {\n props.onOpenChange(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst SelectSheetImpl = (props: SelectImplProps) => {\n return <>{props.children}</>\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Select = withStaticProperties(\n (props: ScopedProps<SelectProps>) => {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n size: sizeProp = '$true',\n dir,\n } = props\n\n const id = useId()\n const scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id\n\n const { when, AdaptProvider } = useAdaptParent({\n Contents: React.useCallback(\n () => <PortalHost name={`${scopeKey}SheetContents`} />,\n [scopeKey]\n ),\n })\n const sheetBreakpoint = when\n const isSheet = useSelectBreakpointActive(sheetBreakpoint)\n const SelectImpl = isSheet || !isWeb ? SelectSheetImpl : SelectInlineImpl\n const forceUpdate = React.useReducer(() => ({}), {})[1]\n const [selectedItem, setSelectedItem] = React.useState<React.ReactNode>(null)\n\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n strategy: 'most-recent-wins',\n })\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue || '',\n onChange: onValueChange,\n strategy: 'most-recent-wins',\n transition: true,\n })\n\n const [activeIndex, setActiveIndex] = React.useState<number | null>(0)\n const selectedIndexRef = React.useRef<number | null>(null)\n const activeIndexRef = React.useRef<number | null>(null)\n const listContentRef = React.useRef<string[]>([])\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n const [valueNode, setValueNode] = React.useState<HTMLElement | null>(null)\n const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false)\n\n useIsomorphicLayoutEffect(() => {\n selectedIndexRef.current = selectedIndex\n activeIndexRef.current = activeIndex\n })\n\n return (\n <AdaptProvider>\n <SelectProvider\n dir={dir}\n blockSelection={false}\n size={sizeProp}\n fallback={false}\n selectedItem={selectedItem}\n setSelectedItem={setSelectedItem}\n forceUpdate={forceUpdate}\n valueNode={valueNode}\n onValueNodeChange={setValueNode}\n onValueNodeHasChildrenChange={setValueNodeHasChildren}\n valueNodeHasChildren={valueNodeHasChildren}\n scopeKey={scopeKey}\n sheetBreakpoint={sheetBreakpoint}\n scope={__scopeSelect}\n setValueAtIndex={(index, value) => {\n listContentRef.current[index] = value\n }}\n activeIndex={activeIndex}\n onChange={setValue}\n selectedIndex={selectedIndex}\n setActiveIndex={setActiveIndex}\n setOpen={setOpen}\n setSelectedIndex={setSelectedIndex}\n value={value}\n open={open}\n >\n <SelectSheetController onOpenChange={setOpen} __scopeSelect={__scopeSelect}>\n <SelectImpl\n activeIndexRef={activeIndexRef}\n listContentRef={listContentRef}\n selectedIndexRef={selectedIndexRef}\n {...props}\n open={open}\n value={value}\n >\n {children}\n </SelectImpl>\n </SelectSheetController>\n </SelectProvider>\n </AdaptProvider>\n )\n },\n {\n Adapt,\n Content: SelectContent,\n Group: SelectGroup,\n Icon: SelectIcon,\n Item: SelectItem,\n ItemIndicator: SelectItemIndicator,\n ItemText: SelectItemText,\n Label: SelectLabel,\n ScrollDownButton: SelectScrollDownButton,\n ScrollUpButton: SelectScrollUpButton,\n Trigger: SelectTrigger,\n Value: SelectValue,\n Viewport: SelectViewport,\n Sheet: ControlledSheet,\n }\n)\n\n// @ts-ignore\nSelect.displayName = SELECT_NAME\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAA6C,aAAa;AAC1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,gBAA+B;AACxC,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,QAAQ,cAA2B;AAC5C,SAAS,WAAW,mBAAmB;AACvC,SAAS,4BAA4B;AACrC,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB,qBAAqB,wBAAwB;AACtE,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB,4BAA4B;AAC7D,SAAS,sBAAsB;AAE/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAMP,MAAM,eAAe;AAId,MAAM,gBAAgB,MAAM;AAAA,EACjC,CAAC,OAAwC,iBAAiB;AACxD,UAAM;AAAA,MACJ;AAAA,MACA,WAAW;AAAA;AAAA,MAEX,mBAAmB;AA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