@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/useSelectBreakpointActive.mjs.map +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/select",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"@floating-ui/react": "^0.24.7",
|
|
35
35
|
"@floating-ui/react-dom": "^2.0.1",
|
|
36
36
|
"@floating-ui/react-native": "^0.10.1",
|
|
37
|
-
"@tamagui/adapt": "1.
|
|
38
|
-
"@tamagui/animate-presence": "1.
|
|
39
|
-
"@tamagui/compose-refs": "1.
|
|
40
|
-
"@tamagui/core": "1.
|
|
41
|
-
"@tamagui/create-context": "1.
|
|
42
|
-
"@tamagui/dismissable": "1.
|
|
43
|
-
"@tamagui/focus-scope": "1.
|
|
44
|
-
"@tamagui/get-token": "1.
|
|
45
|
-
"@tamagui/list-item": "1.
|
|
46
|
-
"@tamagui/portal": "1.
|
|
47
|
-
"@tamagui/separator": "1.
|
|
48
|
-
"@tamagui/sheet": "1.
|
|
49
|
-
"@tamagui/stacks": "1.
|
|
50
|
-
"@tamagui/text": "1.
|
|
51
|
-
"@tamagui/use-controllable-state": "1.
|
|
52
|
-
"@tamagui/use-event": "1.
|
|
53
|
-
"@tamagui/use-previous": "1.
|
|
37
|
+
"@tamagui/adapt": "1.47.0",
|
|
38
|
+
"@tamagui/animate-presence": "1.47.0",
|
|
39
|
+
"@tamagui/compose-refs": "1.47.0",
|
|
40
|
+
"@tamagui/core": "1.47.0",
|
|
41
|
+
"@tamagui/create-context": "1.47.0",
|
|
42
|
+
"@tamagui/dismissable": "1.47.0",
|
|
43
|
+
"@tamagui/focus-scope": "1.47.0",
|
|
44
|
+
"@tamagui/get-token": "1.47.0",
|
|
45
|
+
"@tamagui/list-item": "1.47.0",
|
|
46
|
+
"@tamagui/portal": "1.47.0",
|
|
47
|
+
"@tamagui/separator": "1.47.0",
|
|
48
|
+
"@tamagui/sheet": "1.47.0",
|
|
49
|
+
"@tamagui/stacks": "1.47.0",
|
|
50
|
+
"@tamagui/text": "1.47.0",
|
|
51
|
+
"@tamagui/use-controllable-state": "1.47.0",
|
|
52
|
+
"@tamagui/use-event": "1.47.0",
|
|
53
|
+
"@tamagui/use-previous": "1.47.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "*",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-native": "*"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@tamagui/build": "1.
|
|
61
|
+
"@tamagui/build": "1.47.0",
|
|
62
62
|
"react": "^18.2.0",
|
|
63
63
|
"react-dom": "^18.2.0",
|
|
64
64
|
"react-native": "^0.72.1"
|
package/types/Select.d.ts
CHANGED
|
@@ -632,7 +632,7 @@ export declare const Select: ((props: ScopedProps<SelectProps>) => JSX.Element)
|
|
|
632
632
|
}, string | number> & {
|
|
633
633
|
[x: string]: undefined;
|
|
634
634
|
}>>), "style" | "ellipse" | "disabled" | "size" | "className" | "id" | "placeholder" | "tabIndex" | "role" | "color" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-hidden" | "aria-label" | "aria-labelledby" | "aria-live" | "aria-modal" | "aria-selected" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onFocus" | "onMouseDown" | "onMouseEnter" | "onMouseLeave" | "onMouseUp" | "onScroll" | "space" | "zIndex" | `$${string}` | `$${number}` | "x" | "y" | "display" | "hitSlop" | "pointerEvents" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "importantForAccessibility" | "accessibilityLiveRegion" | "accessibilityLabelledBy" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "gap" | "columnGap" | "rowGap" | "contain" | "cursor" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "spaceDirection" | "separator" | "animation" | "animateOnly" | "userSelect" | "backgroundColor" | "borderBlockColor" | "borderBlockEndColor" | "borderBlockStartColor" | "borderBottomColor" | "borderBottomEndRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStartRadius" | "borderColor" | "borderCurve" | "borderEndColor" | "borderEndEndRadius" | "borderEndStartRadius" | "borderLeftColor" | "borderRadius" | "borderRightColor" | "borderStartColor" | "borderStartEndRadius" | "borderStartStartRadius" | "borderStyle" | "borderTopColor" | "borderTopEndRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStartRadius" | "opacity" | "alignContent" | "alignItems" | "alignSelf" | "aspectRatio" | "borderBottomWidth" | "borderEndWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStartWidth" | "borderTopWidth" | "borderWidth" | "bottom" | "end" | "flex" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "height" | "justifyContent" | "left" | "margin" | "marginBottom" | "marginEnd" | "marginHorizontal" | "marginLeft" | "marginRight" | "marginStart" | "marginTop" | "marginVertical" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "overflow" | "padding" | "paddingBottom" | "paddingEnd" | "paddingHorizontal" | "paddingLeft" | "paddingRight" | "paddingStart" | "paddingTop" | "paddingVertical" | "position" | "right" | "start" | "top" | "width" | "direction" | "shadowColor" | "shadowOffset" | "shadowOpacity" | "shadowRadius" | "transform" | "transformMatrix" | "rotation" | "scaleX" | "scaleY" | "translateX" | "translateY" | "perspective" | "scale" | "skewX" | "skewY" | "matrix" | "rotate" | "rotateY" | "rotateX" | "rotateZ" | "theme" | "fontFamily" | "fontSize" | "textShadowColor" | "lineHeight" | "fontWeight" | "letterSpacing" | `$theme-${string}` | `$theme-${number}` | "target" | "asChild" | "debug" | "themeShallow" | "tag" | "componentName" | "disableOptimization" | "forceStyle" | "onPress" | "onLongPress" | "onPressIn" | "onPressOut" | "onHoverIn" | "onHoverOut" | "hoverStyle" | "pressStyle" | "focusStyle" | "exitStyle" | "enterStyle" | "fontStyle" | "textAlign" | "unstyled" | "allowFontScaling" | "ellipsizeMode" | "lineBreakMode" | "numberOfLines" | "onTextLayout" | "maxFontSizeMultiplier" | "adjustsFontSizeToFit" | "dynamicTypeRamp" | "minimumFontScale" | "suppressHighlighting" | "lineBreakStrategyIOS" | "selectable" | "selectionColor" | "textBreakStrategy" | "dataDetectorType" | "android_hyphenationFrequency" | "textDecorationDistance" | "textOverflow" | "whiteSpace" | "wordWrap" | "textDecorationLine" | "textDecorationStyle" | "textDecorationColor" | "textShadowOffset" | "textShadowRadius" | "textTransform" | "fontVariant" | "writingDirection" | "textAlignVertical" | "verticalAlign" | "includeFontPadding">, TamaguiTextElement> & {
|
|
635
|
-
staticConfig: import("@tamagui/core").
|
|
635
|
+
staticConfig: import("@tamagui/core").StaticConfig;
|
|
636
636
|
styleable: import("@tamagui/core").Styleable<(Omit<import("react-native").TextProps, "style" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseTextProps & import("@tamagui/core").TamaguiComponentPropsBase & {
|
|
637
637
|
style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").TextStyle | (React.CSSProperties & import("react-native").TextStyle)>;
|
|
638
638
|
} & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size" | "unstyled"> & {
|
|
@@ -822,7 +822,7 @@ export declare const Select: ((props: ScopedProps<SelectProps>) => JSX.Element)
|
|
|
822
822
|
readonly transparent?: boolean | undefined;
|
|
823
823
|
readonly chromeless?: boolean | "all" | undefined;
|
|
824
824
|
}>> | "unstyled" | "disableScroll">, TamaguiElement> & {
|
|
825
|
-
staticConfig: import("@tamagui/core").
|
|
825
|
+
staticConfig: import("@tamagui/core").StaticConfig;
|
|
826
826
|
styleable: import("@tamagui/core").Styleable<Omit<import("react-native").ViewProps, "style" | "children" | "display" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
|
|
827
827
|
style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
|
|
828
828
|
} & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{
|
|
@@ -258,7 +258,7 @@ export declare const SelectViewport: import("@tamagui/core").ReactComponentWithR
|
|
|
258
258
|
readonly transparent?: boolean | undefined;
|
|
259
259
|
readonly chromeless?: boolean | "all" | undefined;
|
|
260
260
|
}>> | "unstyled" | "disableScroll">, TamaguiElement> & {
|
|
261
|
-
staticConfig: import("@tamagui/core").
|
|
261
|
+
staticConfig: import("@tamagui/core").StaticConfig;
|
|
262
262
|
styleable: import("@tamagui/core").Styleable<Omit<import("react-native").ViewProps, "style" | "children" | "display" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
|
|
263
263
|
style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
|
|
264
264
|
} & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
|
-
import { usePrevious } from "@tamagui/use-previous";
|
|
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
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/BubbleSelect.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,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;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/jsx/Select.mjs
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { Adapt, useAdaptParent } from "@tamagui/adapt";
|
|
2
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
-
import {
|
|
4
|
-
getVariableValue,
|
|
5
|
-
isWeb,
|
|
6
|
-
styled,
|
|
7
|
-
useGet,
|
|
8
|
-
useIsomorphicLayoutEffect,
|
|
9
|
-
withStaticProperties
|
|
10
|
-
} from "@tamagui/core";
|
|
11
|
-
import { getSpace } from "@tamagui/get-token";
|
|
12
|
-
import { ListItem } from "@tamagui/list-item";
|
|
13
|
-
import { PortalHost } from "@tamagui/portal";
|
|
14
|
-
import { Separator } from "@tamagui/separator";
|
|
15
|
-
import { Sheet, SheetController } from "@tamagui/sheet";
|
|
16
|
-
import { ThemeableStack, XStack, YStack } from "@tamagui/stacks";
|
|
17
|
-
import { Paragraph, SizableText } from "@tamagui/text";
|
|
18
|
-
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
19
|
-
import * as React from "react";
|
|
20
|
-
import { SELECT_NAME } from "./constants";
|
|
21
|
-
import { SelectProvider, createSelectContext, useSelectContext } from "./context";
|
|
22
|
-
import { SelectContent } from "./SelectContent";
|
|
23
|
-
import { SelectInlineImpl } from "./SelectImpl";
|
|
24
|
-
import { SelectItem, useSelectItemContext } from "./SelectItem";
|
|
25
|
-
import { SelectScrollDownButton, SelectScrollUpButton } from "./SelectScrollButton";
|
|
26
|
-
import { SelectTrigger } from "./SelectTrigger";
|
|
27
|
-
import { SelectViewport } from "./SelectViewport";
|
|
28
|
-
import {
|
|
29
|
-
useSelectBreakpointActive,
|
|
30
|
-
useShowSelectSheet
|
|
31
|
-
} from "./useSelectBreakpointActive";
|
|
32
|
-
const VALUE_NAME = "SelectValue";
|
|
33
|
-
const SelectValueFrame = styled(SizableText, {
|
|
34
|
-
name: VALUE_NAME,
|
|
35
|
-
userSelect: "none"
|
|
36
|
-
});
|
|
37
|
-
const SelectValue = SelectValueFrame.styleable(function SelectValue2({
|
|
38
|
-
__scopeSelect,
|
|
39
|
-
children: childrenProp,
|
|
40
|
-
placeholder,
|
|
41
|
-
...props
|
|
42
|
-
}, forwardedRef) {
|
|
43
|
-
const context = useSelectContext(VALUE_NAME, __scopeSelect);
|
|
44
|
-
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
45
|
-
const children = childrenProp ?? context.selectedItem;
|
|
46
|
-
const isEmptyValue = context.value == null || context.value === "";
|
|
47
|
-
const selectValueChildren = isEmptyValue ? placeholder ?? children : children;
|
|
48
|
-
return <SelectValueFrame
|
|
49
|
-
size={context.size}
|
|
50
|
-
ref={composedRefs}
|
|
51
|
-
pointerEvents="none"
|
|
52
|
-
{...props}
|
|
53
|
-
>{unwrapSelectItem(selectValueChildren)}</SelectValueFrame>;
|
|
54
|
-
});
|
|
55
|
-
function unwrapSelectItem(selectValueChildren) {
|
|
56
|
-
return React.Children.map(selectValueChildren, (child) => {
|
|
57
|
-
if (child) {
|
|
58
|
-
if (child.type?.staticConfig?.componentName === ITEM_TEXT_NAME) {
|
|
59
|
-
return child.props.children;
|
|
60
|
-
}
|
|
61
|
-
if (child.props?.children) {
|
|
62
|
-
return unwrapSelectItem(child.props.children);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return child;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
const SelectIcon = styled(XStack, {
|
|
69
|
-
name: "SelectIcon",
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
"aria-hidden": true,
|
|
72
|
-
children: <Paragraph>{"\u25BC"}</Paragraph>
|
|
73
|
-
});
|
|
74
|
-
const ITEM_TEXT_NAME = "SelectItemText";
|
|
75
|
-
const SelectItemTextFrame = styled(SizableText, {
|
|
76
|
-
name: ITEM_TEXT_NAME,
|
|
77
|
-
variants: {
|
|
78
|
-
unstyled: {
|
|
79
|
-
false: {
|
|
80
|
-
userSelect: "none",
|
|
81
|
-
color: "$color"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
defaultVariants: {
|
|
86
|
-
unstyled: false
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const SelectItemText = React.forwardRef(
|
|
90
|
-
(props, forwardedRef) => {
|
|
91
|
-
const { __scopeSelect, className, ...itemTextProps } = props;
|
|
92
|
-
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
93
|
-
const ref = React.useRef(null);
|
|
94
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
95
|
-
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
96
|
-
const isSelected = Boolean(itemContext.isSelected && context.valueNode);
|
|
97
|
-
const contents = React.useMemo(
|
|
98
|
-
() => <SelectItemTextFrame
|
|
99
|
-
className={className}
|
|
100
|
-
size={context.size}
|
|
101
|
-
id={itemContext.textId}
|
|
102
|
-
{...itemTextProps}
|
|
103
|
-
ref={composedRefs}
|
|
104
|
-
/>,
|
|
105
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
106
|
-
[props, context.size, className, itemContext.textId]
|
|
107
|
-
);
|
|
108
|
-
useIsomorphicLayoutEffect(() => {
|
|
109
|
-
if (isSelected) {
|
|
110
|
-
context.setSelectedItem(contents);
|
|
111
|
-
}
|
|
112
|
-
}, [isSelected, contents]);
|
|
113
|
-
if (context.shouldRenderWebNative) {
|
|
114
|
-
return <>{props.children}</>;
|
|
115
|
-
}
|
|
116
|
-
return <>
|
|
117
|
-
{contents}
|
|
118
|
-
{
|
|
119
|
-
/* Portal an option in the bubble select */
|
|
120
|
-
}
|
|
121
|
-
{
|
|
122
|
-
/* {context.bubbleSelect
|
|
123
|
-
? ReactDOM.createPortal(
|
|
124
|
-
// we use `.textContent` because `option` only support `string` or `number`
|
|
125
|
-
<option value={itemContext.value}>{ref.current?.textContent}</option>,
|
|
126
|
-
context.bubbleSelect
|
|
127
|
-
)
|
|
128
|
-
: null} */
|
|
129
|
-
}
|
|
130
|
-
</>;
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
134
|
-
const ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
135
|
-
const SelectItemIndicatorFrame = styled(XStack, {
|
|
136
|
-
name: ITEM_TEXT_NAME
|
|
137
|
-
});
|
|
138
|
-
const SelectItemIndicator = React.forwardRef(
|
|
139
|
-
(props, forwardedRef) => {
|
|
140
|
-
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
141
|
-
const context = useSelectContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
142
|
-
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
143
|
-
if (context.shouldRenderWebNative) {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
return itemContext.isSelected ? <SelectItemIndicatorFrame aria-hidden {...itemIndicatorProps} ref={forwardedRef} /> : null;
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
150
|
-
const GROUP_NAME = "SelectGroup";
|
|
151
|
-
const [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);
|
|
152
|
-
const SelectGroupFrame = styled(YStack, {
|
|
153
|
-
name: GROUP_NAME,
|
|
154
|
-
width: "100%"
|
|
155
|
-
});
|
|
156
|
-
const NativeSelectTextFrame = styled(SizableText, {
|
|
157
|
-
tag: "select",
|
|
158
|
-
backgroundColor: "$background",
|
|
159
|
-
borderColor: "$borderColor",
|
|
160
|
-
hoverStyle: {
|
|
161
|
-
backgroundColor: "$backgroundHover"
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
const NativeSelectFrame = styled(ThemeableStack, {
|
|
165
|
-
name: "NativeSelect",
|
|
166
|
-
bordered: true,
|
|
167
|
-
userSelect: "none",
|
|
168
|
-
outlineWidth: 0,
|
|
169
|
-
paddingRight: 10,
|
|
170
|
-
variants: {
|
|
171
|
-
size: {
|
|
172
|
-
"...size": (val, extras) => {
|
|
173
|
-
const { tokens } = extras;
|
|
174
|
-
const paddingHorizontal = getVariableValue(tokens.space[val]);
|
|
175
|
-
return {
|
|
176
|
-
borderRadius: tokens.radius[val] ?? val,
|
|
177
|
-
minHeight: tokens.size[val],
|
|
178
|
-
paddingRight: paddingHorizontal + 20,
|
|
179
|
-
paddingLeft: paddingHorizontal,
|
|
180
|
-
paddingVertical: getSpace(val, {
|
|
181
|
-
shift: -3
|
|
182
|
-
})
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
defaultVariants: {
|
|
188
|
-
size: "$2"
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
const SelectGroup = React.forwardRef(
|
|
192
|
-
(props, forwardedRef) => {
|
|
193
|
-
const { __scopeSelect, ...groupProps } = props;
|
|
194
|
-
const groupId = React.useId();
|
|
195
|
-
const context = useSelectContext(GROUP_NAME, __scopeSelect);
|
|
196
|
-
const size = context.size ?? "$true";
|
|
197
|
-
const nativeSelectRef = React.useRef(null);
|
|
198
|
-
const content = function() {
|
|
199
|
-
if (context.shouldRenderWebNative) {
|
|
200
|
-
return (
|
|
201
|
-
// @ts-expect-error until we support typing based on tag
|
|
202
|
-
<NativeSelectFrame asChild size={size} value={context.value}><NativeSelectTextFrame
|
|
203
|
-
onChange={(event) => {
|
|
204
|
-
context.onChange(event.currentTarget.value);
|
|
205
|
-
}}
|
|
206
|
-
size={size}
|
|
207
|
-
ref={nativeSelectRef}
|
|
208
|
-
style={{
|
|
209
|
-
color: "var(--color)",
|
|
210
|
-
// @ts-ignore
|
|
211
|
-
appearance: "none"
|
|
212
|
-
}}
|
|
213
|
-
>{props.children}</NativeSelectTextFrame></NativeSelectFrame>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
return <SelectGroupFrame
|
|
217
|
-
role="group"
|
|
218
|
-
aria-labelledby={groupId}
|
|
219
|
-
{...groupProps}
|
|
220
|
-
ref={forwardedRef}
|
|
221
|
-
/>;
|
|
222
|
-
}();
|
|
223
|
-
return <SelectGroupContextProvider scope={__scopeSelect} id={groupId || ""}>{content}</SelectGroupContextProvider>;
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
SelectGroup.displayName = GROUP_NAME;
|
|
227
|
-
const LABEL_NAME = "SelectLabel";
|
|
228
|
-
const SelectLabel = React.forwardRef(
|
|
229
|
-
(props, forwardedRef) => {
|
|
230
|
-
const { __scopeSelect, ...labelProps } = props;
|
|
231
|
-
const context = useSelectContext(LABEL_NAME, __scopeSelect);
|
|
232
|
-
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
233
|
-
if (context.shouldRenderWebNative) {
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
return <ListItem
|
|
237
|
-
tag="div"
|
|
238
|
-
componentName={LABEL_NAME}
|
|
239
|
-
fontWeight="800"
|
|
240
|
-
id={groupContext.id}
|
|
241
|
-
size={context.size}
|
|
242
|
-
{...labelProps}
|
|
243
|
-
ref={forwardedRef}
|
|
244
|
-
/>;
|
|
245
|
-
}
|
|
246
|
-
);
|
|
247
|
-
SelectLabel.displayName = LABEL_NAME;
|
|
248
|
-
const SelectSeparator = styled(Separator, {
|
|
249
|
-
name: "SelectSeparator"
|
|
250
|
-
});
|
|
251
|
-
const SelectSheetController = (props) => {
|
|
252
|
-
const context = useSelectContext("SelectSheetController", props.__scopeSelect);
|
|
253
|
-
const showSheet = useShowSelectSheet(context);
|
|
254
|
-
const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
|
|
255
|
-
const getShowSheet = useGet(showSheet);
|
|
256
|
-
return <SheetController
|
|
257
|
-
onOpenChange={(val) => {
|
|
258
|
-
if (getShowSheet()) {
|
|
259
|
-
props.onOpenChange(val);
|
|
260
|
-
}
|
|
261
|
-
}}
|
|
262
|
-
open={context.open}
|
|
263
|
-
hidden={breakpointActive === false}
|
|
264
|
-
>{props.children}</SheetController>;
|
|
265
|
-
};
|
|
266
|
-
const SelectSheetImpl = (props) => {
|
|
267
|
-
return <>{props.children}</>;
|
|
268
|
-
};
|
|
269
|
-
const Select = withStaticProperties(
|
|
270
|
-
(props) => {
|
|
271
|
-
const {
|
|
272
|
-
__scopeSelect,
|
|
273
|
-
native,
|
|
274
|
-
children,
|
|
275
|
-
open: openProp,
|
|
276
|
-
defaultOpen,
|
|
277
|
-
onOpenChange,
|
|
278
|
-
value: valueProp,
|
|
279
|
-
defaultValue,
|
|
280
|
-
onValueChange,
|
|
281
|
-
size: sizeProp = "$true",
|
|
282
|
-
dir
|
|
283
|
-
} = props;
|
|
284
|
-
const id = React.useId();
|
|
285
|
-
const scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id;
|
|
286
|
-
const { when, AdaptProvider } = useAdaptParent({
|
|
287
|
-
Contents: React.useCallback(
|
|
288
|
-
() => <PortalHost name={`${scopeKey}SheetContents`} />,
|
|
289
|
-
[scopeKey]
|
|
290
|
-
)
|
|
291
|
-
});
|
|
292
|
-
const sheetBreakpoint = when;
|
|
293
|
-
const isSheet = useSelectBreakpointActive(sheetBreakpoint);
|
|
294
|
-
const SelectImpl = isSheet || !isWeb ? SelectSheetImpl : SelectInlineImpl;
|
|
295
|
-
const forceUpdate = React.useReducer(() => ({}), {})[1];
|
|
296
|
-
const [selectedItem, setSelectedItem] = React.useState(null);
|
|
297
|
-
const [open, setOpen] = useControllableState({
|
|
298
|
-
prop: openProp,
|
|
299
|
-
defaultProp: defaultOpen || false,
|
|
300
|
-
onChange: onOpenChange
|
|
301
|
-
});
|
|
302
|
-
const [value, setValue] = useControllableState({
|
|
303
|
-
prop: valueProp,
|
|
304
|
-
defaultProp: defaultValue || "",
|
|
305
|
-
onChange: onValueChange,
|
|
306
|
-
transition: true
|
|
307
|
-
});
|
|
308
|
-
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
309
|
-
const selectedIndexRef = React.useRef(null);
|
|
310
|
-
const activeIndexRef = React.useRef(null);
|
|
311
|
-
const listContentRef = React.useRef([]);
|
|
312
|
-
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
313
|
-
const [valueNode, setValueNode] = React.useState(null);
|
|
314
|
-
useIsomorphicLayoutEffect(() => {
|
|
315
|
-
selectedIndexRef.current = selectedIndex;
|
|
316
|
-
activeIndexRef.current = activeIndex;
|
|
317
|
-
});
|
|
318
|
-
const shouldRenderWebNative = isWeb && (native === true || native === "web" || Array.isArray(native) && native.includes("web"));
|
|
319
|
-
return <AdaptProvider><SelectProvider
|
|
320
|
-
dir={dir}
|
|
321
|
-
blockSelection={false}
|
|
322
|
-
size={sizeProp}
|
|
323
|
-
fallback={false}
|
|
324
|
-
selectedItem={selectedItem}
|
|
325
|
-
setSelectedItem={setSelectedItem}
|
|
326
|
-
forceUpdate={forceUpdate}
|
|
327
|
-
valueNode={valueNode}
|
|
328
|
-
onValueNodeChange={setValueNode}
|
|
329
|
-
scopeKey={scopeKey}
|
|
330
|
-
sheetBreakpoint={sheetBreakpoint}
|
|
331
|
-
scope={__scopeSelect}
|
|
332
|
-
setValueAtIndex={(index, value2) => {
|
|
333
|
-
listContentRef.current[index] = value2;
|
|
334
|
-
}}
|
|
335
|
-
activeIndex={activeIndex}
|
|
336
|
-
onChange={setValue}
|
|
337
|
-
selectedIndex={selectedIndex}
|
|
338
|
-
setActiveIndex={setActiveIndex}
|
|
339
|
-
setOpen={setOpen}
|
|
340
|
-
setSelectedIndex={setSelectedIndex}
|
|
341
|
-
value={value}
|
|
342
|
-
open={open}
|
|
343
|
-
native={native}
|
|
344
|
-
shouldRenderWebNative={shouldRenderWebNative}
|
|
345
|
-
><SelectSheetController onOpenChange={setOpen} __scopeSelect={__scopeSelect}>{shouldRenderWebNative ? children : <SelectImpl
|
|
346
|
-
activeIndexRef={activeIndexRef}
|
|
347
|
-
listContentRef={listContentRef}
|
|
348
|
-
selectedIndexRef={selectedIndexRef}
|
|
349
|
-
{...props}
|
|
350
|
-
open={open}
|
|
351
|
-
value={value}
|
|
352
|
-
>{children}</SelectImpl>}</SelectSheetController></SelectProvider></AdaptProvider>;
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
Adapt,
|
|
356
|
-
Content: SelectContent,
|
|
357
|
-
Group: SelectGroup,
|
|
358
|
-
Icon: SelectIcon,
|
|
359
|
-
Item: SelectItem,
|
|
360
|
-
ItemIndicator: SelectItemIndicator,
|
|
361
|
-
ItemText: SelectItemText,
|
|
362
|
-
Label: SelectLabel,
|
|
363
|
-
ScrollDownButton: SelectScrollDownButton,
|
|
364
|
-
ScrollUpButton: SelectScrollUpButton,
|
|
365
|
-
Trigger: SelectTrigger,
|
|
366
|
-
Value: SelectValue,
|
|
367
|
-
Viewport: SelectViewport,
|
|
368
|
-
Sheet: Sheet.Controlled
|
|
369
|
-
}
|
|
370
|
-
);
|
|
371
|
-
Select.displayName = SELECT_NAME;
|
|
372
|
-
export {
|
|
373
|
-
Select,
|
|
374
|
-
SelectGroupFrame,
|
|
375
|
-
SelectIcon,
|
|
376
|
-
SelectItemTextFrame,
|
|
377
|
-
SelectSeparator
|
|
378
|
-
};
|
|
379
|
-
//# sourceMappingURL=Select.mjs.map
|
package/dist/jsx/Select.mjs.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Select.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,OAAO,sBAAs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AAA,MACjB,aAAa;AAAA,MACb,WAAW;AAAA,MACX,mBAAmB;AAAA,MACnB,UAAU;AAAA,MACV,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,iBAAiB,CAAC,OAAOC,WAAU;AACjC,uBAAe,QAAQ,KAAK,IAAIA;AAAA,MAClC;AAAA,MACA,aAAa;AAAA,MACb,UAAU;AAAA,MACV,eAAe;AAAA,MACf,gBAAgB;AAAA,MAChB,SAAS;AAAA,MACT,kBAAkB;AAAA,MAClB,OAAO;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,uBAAuB;AAAA,KAEvB,CAAC,sBAAsB,cAAc,SAAS,eAAe,gBAC1D,wBACC,WAEA,CAAC;AAAA,MACC,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,kBAAkB;AAAA,UACd;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MAEN,SACH,EATC,YAWL,EAfC,sBAgBH,EA3CC,eA4CH,EA7CC;AAAA,EA+CL;AAAA,EACA;AAAA,IACE;AAAA,IACA,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,IACN,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,OAAO,MAAM;AAAA,EACf;AACF;AAGA,OAAO,cAAc;",
|
|
5
|
-
"names": ["SelectValue", "value"]
|
|
6
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FloatingOverlay, FloatingPortal } from "@floating-ui/react";
|
|
2
|
-
import { Theme, useIsTouchDevice, useThemeName } from "@tamagui/core";
|
|
3
|
-
import { FocusScope } from "@tamagui/focus-scope";
|
|
4
|
-
import { useSelectContext } from "./context";
|
|
5
|
-
import { useShowSelectSheet } from "./useSelectBreakpointActive";
|
|
6
|
-
const CONTENT_NAME = "SelectContent";
|
|
7
|
-
const SelectContent = ({
|
|
8
|
-
children,
|
|
9
|
-
__scopeSelect,
|
|
10
|
-
zIndex = 1e3,
|
|
11
|
-
...focusScopeProps
|
|
12
|
-
}) => {
|
|
13
|
-
const context = useSelectContext(CONTENT_NAME, __scopeSelect);
|
|
14
|
-
const themeName = useThemeName();
|
|
15
|
-
const showSheet = useShowSelectSheet(context);
|
|
16
|
-
const contents = <Theme forceClassName name={themeName}>{children}</Theme>;
|
|
17
|
-
const touch = useIsTouchDevice();
|
|
18
|
-
if (context.shouldRenderWebNative) {
|
|
19
|
-
return <>{children}</>;
|
|
20
|
-
}
|
|
21
|
-
if (showSheet) {
|
|
22
|
-
if (!context.open) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return <>{contents}</>;
|
|
26
|
-
}
|
|
27
|
-
return <FloatingPortal><FloatingOverlay
|
|
28
|
-
style={{ zIndex, pointerEvents: context.open ? "auto" : "none" }}
|
|
29
|
-
lockScroll={!!context.open && !touch}
|
|
30
|
-
><FocusScope loop trapped={!!context.open} {...focusScopeProps}>{contents}</FocusScope></FloatingOverlay></FloatingPortal>;
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
SelectContent
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=SelectContent.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/SelectContent.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,OAAO,kBAAkB,oBAAoB;AACtD,SAAS,kBAAmC;AAE5C,SAAS,wBAAwB;AAEjC,SAAS,0BAA0B;AAMnC,MAAM,eAAe;AAEd,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,GAAG;AACL,MAA4C;AAC1C,QAAM,UAAU,iBAAiB,cAAc,aAAa;AAC5D,QAAM,YAAY,aAAa;AAC/B,QAAM,YAAY,mBAAmB,OAAO;AAE5C,QAAM,WACJ,CAAC,MAAM,eAAe,MAAM,YACzB,SACH,EAFC;AAKH,QAAM,QAAQ,iBAAiB;AAE/B,MAAI,QAAQ,uBAAuB;AACjC,WAAO,GAAG,SAAS;AAAA,EACrB;AAEA,MAAI,WAAW;AACb,QAAI,CAAC,QAAQ,MAAM;AACjB,aAAO;AAAA,IACT;AACA,WAAO,GAAG,SAAS;AAAA,EACrB;AAEA,SACE,CAAC,eACC,CAAC;AAAA,IACC,OAAO,EAAE,QAAQ,eAAe,QAAQ,OAAO,SAAS,OAAO;AAAA,IAC/D,YAAY,CAAC,CAAC,QAAQ,QAAQ,CAAC;AAAA,GAE/B,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,QAAQ,UAAU,kBAC3C,SACH,EAFC,WAGH,EAPC,gBAQH,EATC;AAWL;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|