@tamagui/select 1.61.2 → 1.62.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/dist/cjs/BubbleSelect.js +12 -26
- package/dist/cjs/BubbleSelect.js.map +1 -1
- package/dist/cjs/BubbleSelect.native.js +35 -0
- package/dist/cjs/BubbleSelect.native.js.map +6 -0
- package/dist/cjs/Select.js +80 -205
- package/dist/cjs/Select.js.map +2 -2
- package/dist/cjs/Select.native.js +353 -0
- package/dist/cjs/Select.native.js.map +6 -0
- package/dist/cjs/SelectContent.js +10 -34
- package/dist/cjs/SelectContent.js.map +1 -1
- package/dist/cjs/SelectContent.native.js +6 -11
- package/dist/cjs/SelectContent.native.js.map +1 -1
- package/dist/cjs/SelectImpl.js +94 -190
- package/dist/cjs/SelectImpl.js.map +1 -1
- package/dist/cjs/SelectImpl.native.js +6 -14
- package/dist/cjs/SelectImpl.native.js.map +1 -1
- package/dist/cjs/SelectItem.js +36 -88
- package/dist/cjs/SelectItem.js.map +1 -1
- package/dist/cjs/SelectItem.native.js +145 -0
- package/dist/cjs/SelectItem.native.js.map +6 -0
- package/dist/cjs/SelectScrollButton.js +40 -87
- package/dist/cjs/SelectScrollButton.js.map +2 -2
- package/dist/cjs/SelectScrollButton.native.js +6 -10
- package/dist/cjs/SelectScrollButton.native.js.map +1 -1
- package/dist/cjs/SelectTrigger.js +20 -40
- package/dist/cjs/SelectTrigger.js.map +2 -2
- package/dist/cjs/SelectTrigger.native.js +73 -0
- package/dist/cjs/SelectTrigger.native.js.map +6 -0
- package/dist/cjs/SelectViewport.js +24 -54
- package/dist/cjs/SelectViewport.js.map +2 -2
- package/dist/cjs/SelectViewport.native.js +9 -24
- package/dist/cjs/SelectViewport.native.js.map +1 -1
- package/dist/cjs/constants.js +6 -16
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/constants.native.js +38 -0
- package/dist/cjs/constants.native.js.map +6 -0
- package/dist/cjs/context.js +8 -20
- package/dist/cjs/context.js.map +1 -1
- package/dist/cjs/context.native.js +48 -0
- package/dist/cjs/context.native.js.map +6 -0
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +22 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/types.js +3 -6
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/types.native.js +15 -0
- package/dist/cjs/types.native.js.map +6 -0
- package/dist/cjs/useSelectBreakpointActive.js +8 -17
- package/dist/cjs/useSelectBreakpointActive.js.map +1 -1
- package/dist/cjs/useSelectBreakpointActive.native.js +35 -0
- package/dist/cjs/useSelectBreakpointActive.native.js.map +6 -0
- package/dist/esm/BubbleSelect.js +7 -15
- package/dist/esm/BubbleSelect.js.map +1 -1
- package/dist/esm/Select.js +73 -171
- package/dist/esm/Select.js.map +2 -2
- package/dist/esm/SelectContent.js +5 -20
- package/dist/esm/SelectContent.js.map +1 -1
- package/dist/esm/SelectImpl.js +87 -171
- package/dist/esm/SelectImpl.js.map +1 -1
- package/dist/esm/SelectItem.js +29 -70
- package/dist/esm/SelectItem.js.map +1 -1
- package/dist/esm/SelectScrollButton.js +33 -68
- package/dist/esm/SelectScrollButton.js.map +2 -2
- package/dist/esm/SelectTrigger.js +13 -23
- package/dist/esm/SelectTrigger.js.map +2 -2
- package/dist/esm/SelectViewport.js +19 -36
- package/dist/esm/SelectViewport.js.map +2 -2
- package/dist/esm/constants.js +1 -7
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/context.js +3 -9
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/useSelectBreakpointActive.js +3 -8
- package/dist/esm/useSelectBreakpointActive.js.map +1 -1
- package/dist/jsx/BubbleSelect.js +7 -15
- package/dist/jsx/BubbleSelect.js.map +1 -1
- package/dist/jsx/BubbleSelect.native.js +17 -0
- package/dist/jsx/BubbleSelect.native.js.map +6 -0
- package/dist/jsx/Select.js +68 -165
- package/dist/jsx/Select.js.map +2 -2
- package/dist/jsx/Select.native.js +337 -0
- package/dist/jsx/Select.native.js.map +6 -0
- package/dist/jsx/SelectContent.js +3 -18
- package/dist/jsx/SelectContent.js.map +1 -1
- package/dist/jsx/SelectContent.native.js +1 -3
- package/dist/jsx/SelectContent.native.js.map +1 -1
- package/dist/jsx/SelectImpl.js +86 -167
- package/dist/jsx/SelectImpl.js.map +1 -1
- package/dist/jsx/SelectImpl.native.js +1 -6
- package/dist/jsx/SelectImpl.native.js.map +1 -1
- package/dist/jsx/SelectItem.js +28 -68
- package/dist/jsx/SelectItem.js.map +1 -1
- package/dist/jsx/SelectItem.native.js +115 -0
- package/dist/jsx/SelectItem.native.js.map +6 -0
- package/dist/jsx/SelectScrollButton.js +22 -53
- package/dist/jsx/SelectScrollButton.js.map +1 -1
- package/dist/jsx/SelectScrollButton.native.js +1 -2
- package/dist/jsx/SelectScrollButton.native.js.map +1 -1
- package/dist/jsx/SelectTrigger.js +11 -19
- package/dist/jsx/SelectTrigger.js.map +2 -2
- package/dist/jsx/SelectTrigger.native.js +44 -0
- package/dist/jsx/SelectTrigger.native.js.map +6 -0
- package/dist/jsx/SelectViewport.js +16 -32
- package/dist/jsx/SelectViewport.js.map +2 -2
- package/dist/jsx/SelectViewport.native.js +1 -5
- package/dist/jsx/SelectViewport.native.js.map +1 -1
- package/dist/jsx/constants.js +1 -7
- package/dist/jsx/constants.js.map +1 -1
- package/dist/jsx/constants.native.js +11 -0
- package/dist/jsx/constants.native.js.map +6 -0
- package/dist/jsx/context.js +2 -8
- package/dist/jsx/context.js.map +1 -1
- package/dist/jsx/context.native.js +20 -0
- package/dist/jsx/context.native.js.map +6 -0
- package/dist/jsx/index.native.js +3 -0
- package/dist/jsx/index.native.js.map +6 -0
- package/dist/jsx/types.native.js +1 -0
- package/dist/jsx/types.native.js.map +6 -0
- package/dist/jsx/useSelectBreakpointActive.js +3 -8
- package/dist/jsx/useSelectBreakpointActive.js.map +1 -1
- package/dist/jsx/useSelectBreakpointActive.native.js +13 -0
- package/dist/jsx/useSelectBreakpointActive.native.js.map +6 -0
- package/package.json +19 -19
- package/types/Select.d.ts +1 -0
- package/types/Select.d.ts.map +1 -1
- package/dist/esm/SelectContent.native.js +0 -7
- package/dist/esm/SelectContent.native.js.map +0 -6
- package/dist/esm/SelectImpl.native.js +0 -11
- package/dist/esm/SelectImpl.native.js.map +0 -6
- package/dist/esm/SelectScrollButton.native.js +0 -7
- package/dist/esm/SelectScrollButton.native.js.map +0 -6
- package/dist/esm/SelectViewport.native.js +0 -32
- package/dist/esm/SelectViewport.native.js.map +0 -6
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
+
var Select_exports = {};
|
|
25
|
+
__export(Select_exports, {
|
|
26
|
+
Select: () => Select,
|
|
27
|
+
SelectGroupFrame: () => SelectGroupFrame,
|
|
28
|
+
SelectIcon: () => SelectIcon,
|
|
29
|
+
SelectItemTextFrame: () => SelectItemTextFrame,
|
|
30
|
+
SelectSeparator: () => SelectSeparator
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Select_exports);
|
|
33
|
+
var import_adapt = require("@tamagui/adapt"), import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_list_item = require("@tamagui/list-item"), import_portal = require("@tamagui/portal"), import_separator = require("@tamagui/separator"), import_sheet = require("@tamagui/sheet"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_constants = require("./constants"), import_context = require("./context"), import_SelectContent = require("./SelectContent"), import_SelectImpl = require("./SelectImpl"), import_SelectItem = require("./SelectItem"), import_SelectScrollButton = require("./SelectScrollButton"), import_SelectTrigger = require("./SelectTrigger"), import_SelectViewport = require("./SelectViewport"), import_useSelectBreakpointActive = require("./useSelectBreakpointActive"), import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
const VALUE_NAME = "SelectValue", SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
35
|
+
name: VALUE_NAME,
|
|
36
|
+
userSelect: "none"
|
|
37
|
+
}), SelectValue = SelectValueFrame.styleable(function({
|
|
38
|
+
__scopeSelect,
|
|
39
|
+
children: childrenProp,
|
|
40
|
+
placeholder,
|
|
41
|
+
...props
|
|
42
|
+
}, forwardedRef) {
|
|
43
|
+
const context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(VALUE_NAME, __scopeSelect), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange), children = childrenProp ?? context.selectedItem, selectValueChildren = context.value == null || context.value === "" ? placeholder ?? children : children;
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
|
+
SelectValueFrame,
|
|
46
|
+
{
|
|
47
|
+
...!props.unstyled && {
|
|
48
|
+
size: itemParentContext.size,
|
|
49
|
+
ellipse: !0
|
|
50
|
+
},
|
|
51
|
+
ref: composedRefs,
|
|
52
|
+
pointerEvents: "none",
|
|
53
|
+
...props,
|
|
54
|
+
children: unwrapSelectItem(selectValueChildren)
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
function unwrapSelectItem(selectValueChildren) {
|
|
59
|
+
return React.Children.map(selectValueChildren, (child) => {
|
|
60
|
+
if (child) {
|
|
61
|
+
if (child.type?.staticConfig?.componentName === ITEM_TEXT_NAME)
|
|
62
|
+
return child.props.children;
|
|
63
|
+
if (child.props?.children)
|
|
64
|
+
return unwrapSelectItem(child.props.children);
|
|
65
|
+
}
|
|
66
|
+
return child;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const SelectIcon = (0, import_core.styled)(import_stacks.XStack, {
|
|
70
|
+
name: "SelectIcon",
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
"aria-hidden": !0,
|
|
73
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.Paragraph, { children: "\u25BC" })
|
|
74
|
+
}), ITEM_TEXT_NAME = "SelectItemText", SelectItemTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
75
|
+
name: ITEM_TEXT_NAME,
|
|
76
|
+
variants: {
|
|
77
|
+
unstyled: {
|
|
78
|
+
false: {
|
|
79
|
+
userSelect: "none",
|
|
80
|
+
color: "$color",
|
|
81
|
+
ellipse: !0
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
defaultVariants: {
|
|
86
|
+
unstyled: !1
|
|
87
|
+
}
|
|
88
|
+
}), SelectItemText = React.forwardRef(
|
|
89
|
+
(props, forwardedRef) => {
|
|
90
|
+
const { __scopeSelect, className, ...itemTextProps } = props, context = (0, import_context.useSelectContext)(ITEM_TEXT_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(ITEM_TEXT_NAME, __scopeSelect), ref = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_TEXT_NAME, __scopeSelect), contents = React.useMemo(
|
|
91
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
SelectItemTextFrame,
|
|
93
|
+
{
|
|
94
|
+
className,
|
|
95
|
+
size: itemParentContext.size,
|
|
96
|
+
id: itemContext.textId,
|
|
97
|
+
...itemTextProps,
|
|
98
|
+
ref: composedRefs
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
102
|
+
[props, itemParentContext.size, className, itemContext.textId]
|
|
103
|
+
);
|
|
104
|
+
return React.useEffect(() => {
|
|
105
|
+
itemParentContext.initialValue === itemContext.value && !context.selectedIndex && context.setSelectedItem(contents);
|
|
106
|
+
}, []), React.useEffect(() => itemParentContext.valueSubscribe((val) => {
|
|
107
|
+
val === itemContext.value && context.setSelectedItem(contents);
|
|
108
|
+
}), [itemContext.value]), itemParentContext.shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: contents });
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
112
|
+
const ITEM_INDICATOR_NAME = "SelectItemIndicator", SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
|
|
113
|
+
name: ITEM_TEXT_NAME
|
|
114
|
+
}), SelectItemIndicator = React.forwardRef(
|
|
115
|
+
(props, forwardedRef) => {
|
|
116
|
+
const { __scopeSelect, ...itemIndicatorProps } = props, context = (0, import_context.useSelectItemParentContext)(ITEM_INDICATOR_NAME, __scopeSelect), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
117
|
+
return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, { "aria-hidden": !0, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
121
|
+
const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME), SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
122
|
+
name: GROUP_NAME,
|
|
123
|
+
width: "100%"
|
|
124
|
+
}), NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
125
|
+
tag: "select",
|
|
126
|
+
backgroundColor: "$background",
|
|
127
|
+
borderColor: "$borderColor",
|
|
128
|
+
hoverStyle: {
|
|
129
|
+
backgroundColor: "$backgroundHover"
|
|
130
|
+
}
|
|
131
|
+
}), NativeSelectFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
132
|
+
name: "NativeSelect",
|
|
133
|
+
bordered: !0,
|
|
134
|
+
userSelect: "none",
|
|
135
|
+
outlineWidth: 0,
|
|
136
|
+
paddingRight: 10,
|
|
137
|
+
variants: {
|
|
138
|
+
size: {
|
|
139
|
+
"...size": (val, extras) => {
|
|
140
|
+
const { tokens } = extras, paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]);
|
|
141
|
+
return {
|
|
142
|
+
borderRadius: tokens.radius[val] ?? val,
|
|
143
|
+
minHeight: tokens.size[val],
|
|
144
|
+
paddingRight: paddingHorizontal + 20,
|
|
145
|
+
paddingLeft: paddingHorizontal,
|
|
146
|
+
paddingVertical: (0, import_get_token.getSpace)(val, {
|
|
147
|
+
shift: -3
|
|
148
|
+
})
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
defaultVariants: {
|
|
154
|
+
size: "$2"
|
|
155
|
+
}
|
|
156
|
+
}), SelectGroup = React.forwardRef(
|
|
157
|
+
(props, forwardedRef) => {
|
|
158
|
+
const { __scopeSelect, ...groupProps } = props, groupId = React.useId(), context = (0, import_context.useSelectContext)(GROUP_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(GROUP_NAME, __scopeSelect), size = itemParentContext.size ?? "$true", nativeSelectRef = React.useRef(null), content = function() {
|
|
159
|
+
return itemParentContext.shouldRenderWebNative ? (
|
|
160
|
+
// @ts-expect-error until we support typing based on tag
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeSelectFrame, { asChild: !0, size, value: context.value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
162
|
+
NativeSelectTextFrame,
|
|
163
|
+
{
|
|
164
|
+
onChange: (event) => {
|
|
165
|
+
itemParentContext.onChange(event.currentTarget.value);
|
|
166
|
+
},
|
|
167
|
+
size,
|
|
168
|
+
ref: nativeSelectRef,
|
|
169
|
+
style: {
|
|
170
|
+
color: "var(--color)",
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
appearance: "none"
|
|
173
|
+
},
|
|
174
|
+
children: props.children
|
|
175
|
+
}
|
|
176
|
+
) })
|
|
177
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
SelectGroupFrame,
|
|
179
|
+
{
|
|
180
|
+
role: "group",
|
|
181
|
+
"aria-labelledby": groupId,
|
|
182
|
+
...groupProps,
|
|
183
|
+
ref: forwardedRef
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}();
|
|
187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId || "", children: content });
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
SelectGroup.displayName = GROUP_NAME;
|
|
191
|
+
const LABEL_NAME = "SelectLabel", SelectLabel = React.forwardRef(
|
|
192
|
+
(props, forwardedRef) => {
|
|
193
|
+
const { __scopeSelect, ...labelProps } = props, context = (0, import_context.useSelectItemParentContext)(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
194
|
+
return context.shouldRenderWebNative ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
+
import_list_item.ListItem,
|
|
196
|
+
{
|
|
197
|
+
tag: "div",
|
|
198
|
+
componentName: LABEL_NAME,
|
|
199
|
+
fontWeight: "800",
|
|
200
|
+
id: groupContext.id,
|
|
201
|
+
size: context.size,
|
|
202
|
+
...labelProps,
|
|
203
|
+
ref: forwardedRef
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
SelectLabel.displayName = LABEL_NAME;
|
|
209
|
+
const SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
210
|
+
name: "SelectSeparator"
|
|
211
|
+
}), SelectSheetController = (props) => {
|
|
212
|
+
const context = (0, import_context.useSelectContext)("SelectSheetController", props.__scopeSelect), showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context), breakpointActive = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(context.sheetBreakpoint), getShowSheet = (0, import_core.useGet)(showSheet);
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
214
|
+
import_sheet.SheetController,
|
|
215
|
+
{
|
|
216
|
+
onOpenChange: (val) => {
|
|
217
|
+
getShowSheet() && props.onOpenChange(val);
|
|
218
|
+
},
|
|
219
|
+
open: context.open,
|
|
220
|
+
hidden: breakpointActive === !1,
|
|
221
|
+
children: props.children
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
}, SelectSheetImpl = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children }), Select = (0, import_core.withStaticProperties)(
|
|
225
|
+
(props) => {
|
|
226
|
+
const {
|
|
227
|
+
__scopeSelect,
|
|
228
|
+
native,
|
|
229
|
+
children,
|
|
230
|
+
open: openProp,
|
|
231
|
+
defaultOpen,
|
|
232
|
+
onOpenChange,
|
|
233
|
+
value: valueProp,
|
|
234
|
+
defaultValue,
|
|
235
|
+
onValueChange,
|
|
236
|
+
size: sizeProp = "$true",
|
|
237
|
+
dir
|
|
238
|
+
} = props, id = React.useId(), scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id, { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
|
|
239
|
+
Contents: React.useCallback(
|
|
240
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { name: `${scopeKey}SheetContents` }),
|
|
241
|
+
[scopeKey]
|
|
242
|
+
)
|
|
243
|
+
}), sheetBreakpoint = when, SelectImpl = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint) || !import_core.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl, forceUpdate = React.useReducer(() => ({}), {})[1], [selectedItem, setSelectedItem] = React.useState(null), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
244
|
+
prop: openProp,
|
|
245
|
+
defaultProp: defaultOpen || !1,
|
|
246
|
+
onChange: onOpenChange
|
|
247
|
+
}), [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
248
|
+
prop: valueProp,
|
|
249
|
+
defaultProp: defaultValue || "",
|
|
250
|
+
onChange: onValueChange,
|
|
251
|
+
transition: !0
|
|
252
|
+
});
|
|
253
|
+
React.useEffect(() => {
|
|
254
|
+
open && emitValue(value);
|
|
255
|
+
}, [open]);
|
|
256
|
+
const [activeIndex, setActiveIndex] = React.useState(0), [emitValue, valueSubscribe] = useEmitter(), [emitActiveIndex, activeIndexSubscribe] = useEmitter(), selectedIndexRef = React.useRef(null), activeIndexRef = React.useRef(null), listContentRef = React.useRef([]), [selectedIndex, setSelectedIndex] = React.useState(0), [valueNode, setValueNode] = React.useState(null);
|
|
257
|
+
(0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
258
|
+
selectedIndexRef.current = selectedIndex, activeIndexRef.current = activeIndex;
|
|
259
|
+
});
|
|
260
|
+
const shouldRenderWebNative = import_core.isWeb && (native === !0 || native === "web" || Array.isArray(native) && native.includes("web"));
|
|
261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
262
|
+
import_context.SelectItemParentProvider,
|
|
263
|
+
{
|
|
264
|
+
scope: __scopeSelect,
|
|
265
|
+
initialValue: React.useMemo(() => value, []),
|
|
266
|
+
size: sizeProp,
|
|
267
|
+
activeIndexSubscribe,
|
|
268
|
+
valueSubscribe,
|
|
269
|
+
setOpen,
|
|
270
|
+
onChange: React.useCallback((val) => {
|
|
271
|
+
setValue(val), emitValue(val);
|
|
272
|
+
}, []),
|
|
273
|
+
setSelectedIndex,
|
|
274
|
+
setValueAtIndex: React.useCallback((index, value2) => {
|
|
275
|
+
listContentRef.current[index] = value2;
|
|
276
|
+
}, []),
|
|
277
|
+
shouldRenderWebNative,
|
|
278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
279
|
+
import_context.SelectProvider,
|
|
280
|
+
{
|
|
281
|
+
scope: __scopeSelect,
|
|
282
|
+
dir,
|
|
283
|
+
blockSelection: !1,
|
|
284
|
+
fallback: !1,
|
|
285
|
+
selectedItem,
|
|
286
|
+
setSelectedItem,
|
|
287
|
+
forceUpdate,
|
|
288
|
+
valueNode,
|
|
289
|
+
onValueNodeChange: setValueNode,
|
|
290
|
+
scopeKey,
|
|
291
|
+
sheetBreakpoint,
|
|
292
|
+
activeIndex,
|
|
293
|
+
selectedIndex,
|
|
294
|
+
setActiveIndex: React.useCallback((index) => {
|
|
295
|
+
setActiveIndex(index), typeof index == "number" && emitActiveIndex(index);
|
|
296
|
+
}, []),
|
|
297
|
+
value,
|
|
298
|
+
open,
|
|
299
|
+
native,
|
|
300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectSheetController, { onOpenChange: setOpen, __scopeSelect, children: shouldRenderWebNative ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
301
|
+
SelectImpl,
|
|
302
|
+
{
|
|
303
|
+
activeIndexRef,
|
|
304
|
+
listContentRef,
|
|
305
|
+
selectedIndexRef,
|
|
306
|
+
...props,
|
|
307
|
+
open,
|
|
308
|
+
value,
|
|
309
|
+
children
|
|
310
|
+
}
|
|
311
|
+
) })
|
|
312
|
+
}
|
|
313
|
+
)
|
|
314
|
+
}
|
|
315
|
+
) });
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
Adapt: import_adapt.Adapt,
|
|
319
|
+
Content: import_SelectContent.SelectContent,
|
|
320
|
+
Group: SelectGroup,
|
|
321
|
+
Icon: SelectIcon,
|
|
322
|
+
Item: import_SelectItem.SelectItem,
|
|
323
|
+
ItemIndicator: SelectItemIndicator,
|
|
324
|
+
ItemText: SelectItemText,
|
|
325
|
+
Label: SelectLabel,
|
|
326
|
+
ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
|
|
327
|
+
ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
|
|
328
|
+
Trigger: import_SelectTrigger.SelectTrigger,
|
|
329
|
+
Value: SelectValue,
|
|
330
|
+
Viewport: import_SelectViewport.SelectViewport,
|
|
331
|
+
Sheet: import_sheet.Sheet.Controlled
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
function useEmitter() {
|
|
335
|
+
const listeners = React.useRef();
|
|
336
|
+
listeners.current || (listeners.current = /* @__PURE__ */ new Set());
|
|
337
|
+
const emit = (value) => {
|
|
338
|
+
listeners.current.forEach((l) => l(value));
|
|
339
|
+
}, subscribe = React.useCallback((listener) => (listeners.current.add(listener), () => {
|
|
340
|
+
listeners.current.delete(listener);
|
|
341
|
+
}), []);
|
|
342
|
+
return [emit, subscribe];
|
|
343
|
+
}
|
|
344
|
+
Select.displayName = import_constants.SELECT_NAME;
|
|
345
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
346
|
+
0 && (module.exports = {
|
|
347
|
+
Select,
|
|
348
|
+
SelectGroupFrame,
|
|
349
|
+
SelectIcon,
|
|
350
|
+
SelectItemTextFrame,
|
|
351
|
+
SelectSeparator
|
|
352
|
+
});
|
|
353
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Select.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsC,2BACtC,sBAAgC,kCAChC,cAYO,0BACP,mBAAyB,+BACzB,mBAAwC,+BACxC,gBAA2B,4BAC3B,mBAA0B,+BAC1B,eAAuC,2BACvC,gBAA+C,4BAC/C,cAAuC,0BACvC,gCAAqC,4CACrC,QAAuB,2BAEvB,mBAA4B,wBAC5B,iBAMO,sBACP,uBAA8B,4BAC9B,oBAAiC,yBACjC,oBAAiD,yBACjD,4BAA6D,iCAC7D,uBAA8B,4BAC9B,wBAA+B,6BAE/B,mCAGO,wCAmCH;AA7BJ,MAAM,aAAa,eAEb,uBAAmB,oBAAO,yBAAa;AAAA,EAC3C,MAAM;AAAA,EACN,YAAY;AACd,CAAC,GAMK,cAAc,iBAAiB,UAA4B,SAC/D;AAAA,EACE;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,G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C;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACC,GAAG;AAAA,gBACJ;AAAA,gBACA;AAAA,gBAEC;AAAA;AAAA,YACH,GAEJ;AAAA;AAAA,QACF;AAAA;AAAA,IACF,GACF;AAAA,EAEJ;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,mBAAM;AAAA,EACf;AACF;AAEA,SAAS,aAAgB;AACvB,QAAM,YAAY,MAAM,OAAsB;AAC9C,EAAK,UAAU,YACb,UAAU,UAAU,oBAAI,IAAI;AAE9B,QAAM,OAAO,CAAC,UAAa;AACzB,cAAU,QAAS,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;AAAA,EAC5C,GACM,YAAY,MAAM,YAAY,CAAC,cACnC,UAAU,QAAS,IAAI,QAAQ,GACxB,MAAM;AACX,cAAU,QAAS,OAAO,QAAQ;AAAA,EACpC,IACC,CAAC,CAAC;AACL,SAAO,CAAC,MAAM,SAAS;AACzB;AAGA,OAAO,cAAc;",
|
|
5
|
+
"names": ["value"]
|
|
6
|
+
}
|
|
@@ -1,60 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
10
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
15
|
var SelectContent_exports = {};
|
|
20
16
|
__export(SelectContent_exports, {
|
|
21
17
|
SelectContent: () => SelectContent
|
|
22
18
|
});
|
|
23
19
|
module.exports = __toCommonJS(SelectContent_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
|
|
26
|
-
var import_core = require("@tamagui/core");
|
|
27
|
-
var import_focus_scope = require("@tamagui/focus-scope");
|
|
28
|
-
var import_context = require("./context");
|
|
29
|
-
var import_useSelectBreakpointActive = require("./useSelectBreakpointActive");
|
|
30
|
-
const CONTENT_NAME = "SelectContent";
|
|
31
|
-
const SelectContent = ({
|
|
20
|
+
var import_react = require("@floating-ui/react"), import_core = require("@tamagui/core"), import_focus_scope = require("@tamagui/focus-scope"), import_context = require("./context"), import_useSelectBreakpointActive = require("./useSelectBreakpointActive"), import_jsx_runtime = require("react/jsx-runtime");
|
|
21
|
+
const CONTENT_NAME = "SelectContent", SelectContent = ({
|
|
32
22
|
children,
|
|
33
23
|
__scopeSelect,
|
|
34
24
|
zIndex = 1e3,
|
|
35
25
|
...focusScopeProps
|
|
36
26
|
}) => {
|
|
37
|
-
const context = (0, import_context.useSelectContext)(CONTENT_NAME, __scopeSelect);
|
|
38
|
-
|
|
39
|
-
const themeName = (0, import_core.useThemeName)();
|
|
40
|
-
const showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context);
|
|
41
|
-
const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { forceClassName: true, name: themeName, children });
|
|
42
|
-
const touch = (0, import_core.useIsTouchDevice)();
|
|
43
|
-
if (itemParentContext.shouldRenderWebNative) {
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
45
|
-
}
|
|
46
|
-
if (showSheet) {
|
|
47
|
-
if (!context.open) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: contents });
|
|
51
|
-
}
|
|
52
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
27
|
+
const context = (0, import_context.useSelectContext)(CONTENT_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(CONTENT_NAME, __scopeSelect), themeName = (0, import_core.useThemeName)(), showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context), contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { forceClassName: !0, name: themeName, children }), touch = (0, import_core.useIsTouchDevice)();
|
|
28
|
+
return itemParentContext.shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }) : showSheet ? context.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: contents }) : null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
29
|
import_react.FloatingOverlay,
|
|
54
30
|
{
|
|
55
31
|
style: { zIndex, pointerEvents: context.open ? "auto" : "none" },
|
|
56
32
|
lockScroll: !!context.open && !touch,
|
|
57
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_focus_scope.FocusScope, { loop:
|
|
33
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_focus_scope.FocusScope, { loop: !0, enabled: !!context.open, trapped: !0, ...focusScopeProps, children: contents })
|
|
58
34
|
}
|
|
59
35
|
) });
|
|
60
36
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SelectContent.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgD,+BAChD,cAAsD,0BACtD,qBAA4C,iCAE5C,iBAA6D,sBAE7D,mCAAmC,wCAoB/B;AAdJ,MAAM,eAAe,iBAER,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,GAAG;AACL,MAA4C;AAC1C,QAAM,cAAU,iCAAiB,cAAc,aAAa,GACtD,wBAAoB,2CAA2B,cAAc,aAAa,GAC1E,gBAAY,0BAAa,GACzB,gBAAY,qDAAmB,OAAO,GAEtC,WACJ,4CAAC,qBAAM,gBAAc,IAAC,MAAM,WACzB,UACH,GAGI,YAAQ,8BAAiB;AAE/B,SAAI,kBAAkB,wBACb,2EAAG,UAAS,IAGjB,YACG,QAAQ,OAGN,2EAAG,oBAAS,IAFV,OAMT,4CAAC,+BACC;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,QAAQ,eAAe,QAAQ,OAAO,SAAS,OAAO;AAAA,MAC/D,YAAY,CAAC,CAAC,QAAQ,QAAQ,CAAC;AAAA,MAE/B,sDAAC,iCAAW,MAAI,IAAC,SAAS,CAAC,CAAC,QAAQ,MAAM,SAAO,IAAE,GAAG,iBACnD,oBACH;AAAA;AAAA,EACF,GACF;AAEJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -5,25 +5,20 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __export = (target, all) => {
|
|
7
7
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
11
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
13
|
return to;
|
|
17
14
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
16
|
var SelectContent_native_exports = {};
|
|
20
17
|
__export(SelectContent_native_exports, {
|
|
21
18
|
SelectContent: () => SelectContent
|
|
22
19
|
});
|
|
23
20
|
module.exports = __toCommonJS(SelectContent_native_exports);
|
|
24
|
-
const SelectContent = ({ children }) =>
|
|
25
|
-
return children;
|
|
26
|
-
};
|
|
21
|
+
const SelectContent = ({ children }) => children;
|
|
27
22
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
23
|
0 && (module.exports = {
|
|
29
24
|
SelectContent
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SelectContent.native.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,gBAAgB,CAAC,EAAE,SAAS,MAChC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|