@tamagui/select 1.88.1 → 1.88.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Select.js +3 -11
- package/dist/cjs/Select.js.map +1 -1
- package/dist/cjs/SelectContent.js +0 -4
- package/dist/cjs/SelectImpl.js +4 -11
- package/dist/cjs/SelectImpl.js.map +1 -1
- package/dist/cjs/SelectItem.js +2 -9
- package/dist/cjs/SelectItem.js.map +1 -1
- package/dist/cjs/SelectItemText.js +0 -6
- package/dist/cjs/SelectScrollButton.js +5 -14
- package/dist/cjs/SelectScrollButton.js.map +2 -2
- package/dist/cjs/SelectTrigger.js +2 -8
- package/dist/cjs/SelectTrigger.js.map +2 -2
- package/dist/cjs/SelectViewport.js +1 -7
- package/dist/cjs/SelectViewport.js.map +1 -1
- package/dist/cjs/constants.js +0 -10
- package/dist/cjs/context.js +0 -12
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/useSelectBreakpointActive.js +0 -5
- package/dist/esm/BubbleSelect.native.js +22 -4
- package/dist/esm/BubbleSelect.native.js.map +1 -1
- package/dist/esm/Select.native.js +87 -92
- package/dist/esm/Select.native.js.map +2 -2
- package/dist/esm/SelectContent.native.js +23 -2
- package/dist/esm/SelectContent.native.js.map +1 -1
- package/dist/esm/SelectImpl.native.js +25 -4
- package/dist/esm/SelectImpl.native.js.map +1 -1
- package/dist/esm/SelectItem.native.js +47 -20
- package/dist/esm/SelectItem.native.js.map +1 -1
- package/dist/esm/SelectItemText.native.js +38 -13
- package/dist/esm/SelectItemText.native.js.map +1 -1
- package/dist/esm/SelectScrollButton.native.js +24 -2
- package/dist/esm/SelectScrollButton.native.js.map +1 -1
- package/dist/esm/SelectTrigger.native.js +37 -11
- package/dist/esm/SelectTrigger.native.js.map +1 -1
- package/dist/esm/SelectViewport.native.js +37 -18
- package/dist/esm/SelectViewport.native.js.map +1 -1
- package/dist/esm/constants.native.js +29 -2
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/context.native.js +34 -7
- package/dist/esm/context.native.js.map +1 -1
- package/dist/esm/index.native.js +21 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/types.native.js +14 -0
- package/dist/esm/types.native.js.map +2 -2
- package/dist/esm/useSelectBreakpointActive.native.js +26 -4
- package/dist/esm/useSelectBreakpointActive.native.js.map +1 -1
- package/dist/jsx/BubbleSelect.native.js +22 -4
- package/dist/jsx/BubbleSelect.native.js.map +1 -1
- package/dist/jsx/Select.js +128 -97
- package/dist/jsx/Select.js.map +1 -1
- package/dist/jsx/Select.native.js +193 -168
- package/dist/jsx/Select.native.js.map +2 -2
- package/dist/jsx/SelectContent.js +10 -5
- package/dist/jsx/SelectContent.js.map +1 -1
- package/dist/jsx/SelectContent.native.js +23 -2
- package/dist/jsx/SelectContent.native.js.map +1 -1
- package/dist/jsx/SelectImpl.js +32 -39
- package/dist/jsx/SelectImpl.js.map +1 -1
- package/dist/jsx/SelectImpl.native.js +25 -3
- package/dist/jsx/SelectImpl.native.js.map +1 -1
- package/dist/jsx/SelectItem.js +33 -25
- package/dist/jsx/SelectItem.js.map +1 -1
- package/dist/jsx/SelectItem.native.js +73 -39
- package/dist/jsx/SelectItem.native.js.map +1 -1
- package/dist/jsx/SelectItemText.js +12 -22
- package/dist/jsx/SelectItemText.js.map +1 -1
- package/dist/jsx/SelectItemText.native.js +47 -32
- package/dist/jsx/SelectItemText.native.js.map +1 -1
- package/dist/jsx/SelectScrollButton.js +50 -40
- package/dist/jsx/SelectScrollButton.js.map +1 -1
- package/dist/jsx/SelectScrollButton.native.js +24 -2
- package/dist/jsx/SelectScrollButton.native.js.map +1 -1
- package/dist/jsx/SelectTrigger.js +37 -33
- package/dist/jsx/SelectTrigger.js.map +1 -1
- package/dist/jsx/SelectTrigger.native.js +63 -34
- package/dist/jsx/SelectTrigger.native.js.map +1 -1
- package/dist/jsx/SelectViewport.js +39 -30
- package/dist/jsx/SelectViewport.js.map +1 -1
- package/dist/jsx/SelectViewport.native.js +43 -19
- package/dist/jsx/SelectViewport.native.js.map +1 -1
- package/dist/jsx/constants.native.js +29 -2
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/context.js +2 -1
- package/dist/jsx/context.js.map +1 -1
- package/dist/jsx/context.native.js +34 -6
- package/dist/jsx/context.native.js.map +1 -1
- package/dist/jsx/index.native.js +21 -2
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/types.native.js +14 -0
- package/dist/jsx/types.native.js.map +2 -2
- package/dist/jsx/useSelectBreakpointActive.native.js +26 -4
- package/dist/jsx/useSelectBreakpointActive.native.js.map +1 -1
- package/package.json +22 -22
|
@@ -1,43 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
import { SelectViewport } from "./SelectViewport";
|
|
35
|
-
import {
|
|
36
|
-
useSelectBreakpointActive,
|
|
37
|
-
useShowSelectSheet
|
|
38
|
-
} from "./useSelectBreakpointActive";
|
|
39
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
40
|
-
const VALUE_NAME = "SelectValue", SelectValueFrame = styled(SizableText, {
|
|
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
|
+
SelectSeparator: () => SelectSeparator
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(Select_exports);
|
|
32
|
+
var import_adapt = require("@tamagui/adapt"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_helpers = require("@tamagui/helpers"), 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_constants2 = require("./constants"), import_context = require("./context"), import_SelectContent = require("./SelectContent"), import_SelectImpl = require("./SelectImpl"), import_SelectItem = require("./SelectItem"), import_SelectItemText = require("./SelectItemText"), import_SelectScrollButton = require("./SelectScrollButton"), import_SelectTrigger = require("./SelectTrigger"), import_SelectViewport = require("./SelectViewport"), import_useSelectBreakpointActive = require("./useSelectBreakpointActive"), import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
const VALUE_NAME = "SelectValue", SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
41
34
|
name: VALUE_NAME,
|
|
42
35
|
userSelect: "none"
|
|
43
36
|
}), SelectValue = SelectValueFrame.styleable(function({
|
|
@@ -46,8 +39,8 @@ const VALUE_NAME = "SelectValue", SelectValueFrame = styled(SizableText, {
|
|
|
46
39
|
placeholder,
|
|
47
40
|
...props
|
|
48
41
|
}, forwardedRef) {
|
|
49
|
-
const context = useSelectContext(VALUE_NAME, __scopeSelect), itemParentContext = useSelectItemParentContext(VALUE_NAME, __scopeSelect), composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange), children = childrenProp ?? context.selectedItem, selectValueChildren = context.value == null || context.value === "" ? placeholder ?? children : children;
|
|
50
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
+
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;
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
44
|
SelectValueFrame,
|
|
52
45
|
{
|
|
53
46
|
...!props.unstyled && {
|
|
@@ -65,40 +58,41 @@ const VALUE_NAME = "SelectValue", SelectValueFrame = styled(SizableText, {
|
|
|
65
58
|
});
|
|
66
59
|
function unwrapSelectItem(selectValueChildren) {
|
|
67
60
|
return React.Children.map(selectValueChildren, (child) => {
|
|
61
|
+
var _a, _b, _c;
|
|
68
62
|
if (child) {
|
|
69
|
-
if (child.type
|
|
63
|
+
if (((_b = (_a = child.type) == null ? void 0 : _a.staticConfig) == null ? void 0 : _b.componentName) === import_SelectItemText.ITEM_TEXT_NAME)
|
|
70
64
|
return child.props.children;
|
|
71
|
-
if (child.props
|
|
65
|
+
if ((_c = child.props) != null && _c.children)
|
|
72
66
|
return unwrapSelectItem(child.props.children);
|
|
73
67
|
}
|
|
74
68
|
return child;
|
|
75
69
|
});
|
|
76
70
|
}
|
|
77
|
-
const SelectIcon = styled(XStack, {
|
|
71
|
+
const SelectIcon = (0, import_core.styled)(import_stacks.XStack, {
|
|
78
72
|
name: "SelectIcon",
|
|
79
73
|
// @ts-ignore
|
|
80
74
|
"aria-hidden": !0,
|
|
81
|
-
children: /* @__PURE__ */ jsx(Paragraph, { children: "\u25BC" })
|
|
82
|
-
}), ITEM_INDICATOR_NAME = "SelectItemIndicator", SelectItemIndicatorFrame = styled(XStack, {
|
|
83
|
-
name: ITEM_TEXT_NAME
|
|
75
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.Paragraph, { children: "\u25BC" })
|
|
76
|
+
}), ITEM_INDICATOR_NAME = "SelectItemIndicator", SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
|
|
77
|
+
name: import_SelectItemText.ITEM_TEXT_NAME
|
|
84
78
|
}), SelectItemIndicator = React.forwardRef(
|
|
85
79
|
(props, forwardedRef) => {
|
|
86
|
-
const { __scopeSelect, ...itemIndicatorProps } = props, context = useSelectItemParentContext(ITEM_INDICATOR_NAME, __scopeSelect), itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
87
|
-
return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */ jsx(SelectItemIndicatorFrame, { "aria-hidden": !0, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
80
|
+
const { __scopeSelect, ...itemIndicatorProps } = props, context = (0, import_context.useSelectItemParentContext)(ITEM_INDICATOR_NAME, __scopeSelect), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
81
|
+
return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, { "aria-hidden": !0, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
88
82
|
}
|
|
89
83
|
);
|
|
90
84
|
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
91
|
-
const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME), SelectGroupFrame = styled(YStack, {
|
|
85
|
+
const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME), SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
92
86
|
name: GROUP_NAME,
|
|
93
87
|
width: "100%"
|
|
94
|
-
}), NativeSelectTextFrame = styled(SizableText, {
|
|
88
|
+
}), NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
95
89
|
tag: "select",
|
|
96
90
|
backgroundColor: "$background",
|
|
97
91
|
borderColor: "$borderColor",
|
|
98
92
|
hoverStyle: {
|
|
99
93
|
backgroundColor: "$backgroundHover"
|
|
100
94
|
}
|
|
101
|
-
}), NativeSelectFrame = styled(ThemeableStack, {
|
|
95
|
+
}), NativeSelectFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
102
96
|
name: "NativeSelect",
|
|
103
97
|
bordered: !0,
|
|
104
98
|
userSelect: "none",
|
|
@@ -107,13 +101,13 @@ const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupCon
|
|
|
107
101
|
variants: {
|
|
108
102
|
size: {
|
|
109
103
|
"...size": (val, extras) => {
|
|
110
|
-
const { tokens } = extras, paddingHorizontal = getVariableValue(tokens.space[val]);
|
|
104
|
+
const { tokens } = extras, paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]);
|
|
111
105
|
return {
|
|
112
106
|
borderRadius: tokens.radius[val] ?? val,
|
|
113
107
|
minHeight: tokens.size[val],
|
|
114
108
|
paddingRight: paddingHorizontal + 20,
|
|
115
109
|
paddingLeft: paddingHorizontal,
|
|
116
|
-
paddingVertical: getSpace(val, {
|
|
110
|
+
paddingVertical: (0, import_get_token.getSpace)(val, {
|
|
117
111
|
shift: -3
|
|
118
112
|
})
|
|
119
113
|
};
|
|
@@ -125,9 +119,9 @@ const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupCon
|
|
|
125
119
|
}
|
|
126
120
|
}), SelectGroup = React.forwardRef(
|
|
127
121
|
(props, forwardedRef) => {
|
|
128
|
-
const { __scopeSelect, ...groupProps } = props, groupId = React.useId(), context = useSelectContext(GROUP_NAME, __scopeSelect), itemParentContext = useSelectItemParentContext(GROUP_NAME, __scopeSelect), size = itemParentContext.size ?? "$true", nativeSelectRef = React.useRef(null), content = itemParentContext.shouldRenderWebNative ? (
|
|
122
|
+
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 = itemParentContext.shouldRenderWebNative ? (
|
|
129
123
|
// @ts-expect-error until we support typing based on tag
|
|
130
|
-
/* @__PURE__ */ jsx(NativeSelectFrame, { asChild: !0, size, value: context.value, children: /* @__PURE__ */ jsx(
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeSelectFrame, { asChild: !0, size, value: context.value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
125
|
NativeSelectTextFrame,
|
|
132
126
|
{
|
|
133
127
|
onChange: (event) => {
|
|
@@ -143,7 +137,7 @@ const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupCon
|
|
|
143
137
|
children: props.children
|
|
144
138
|
}
|
|
145
139
|
) })
|
|
146
|
-
) : /* @__PURE__ */ jsx(
|
|
140
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
147
141
|
SelectGroupFrame,
|
|
148
142
|
{
|
|
149
143
|
role: "group",
|
|
@@ -152,15 +146,15 @@ const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupCon
|
|
|
152
146
|
ref: forwardedRef
|
|
153
147
|
}
|
|
154
148
|
);
|
|
155
|
-
return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId || "", children: content });
|
|
149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId || "", children: content });
|
|
156
150
|
}
|
|
157
151
|
);
|
|
158
152
|
SelectGroup.displayName = GROUP_NAME;
|
|
159
153
|
const LABEL_NAME = "SelectLabel", SelectLabel = React.forwardRef(
|
|
160
154
|
(props, forwardedRef) => {
|
|
161
|
-
const { __scopeSelect, ...labelProps } = props, context = useSelectItemParentContext(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
162
|
-
return context.shouldRenderWebNative ? null : /* @__PURE__ */ jsx(
|
|
163
|
-
ListItem,
|
|
155
|
+
const { __scopeSelect, ...labelProps } = props, context = (0, import_context.useSelectItemParentContext)(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
156
|
+
return context.shouldRenderWebNative ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
|
+
import_list_item.ListItem,
|
|
164
158
|
{
|
|
165
159
|
tag: "div",
|
|
166
160
|
componentName: LABEL_NAME,
|
|
@@ -174,12 +168,12 @@ const LABEL_NAME = "SelectLabel", SelectLabel = React.forwardRef(
|
|
|
174
168
|
}
|
|
175
169
|
);
|
|
176
170
|
SelectLabel.displayName = LABEL_NAME;
|
|
177
|
-
const SelectSeparator = styled(Separator, {
|
|
171
|
+
const SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
178
172
|
name: "SelectSeparator"
|
|
179
173
|
}), SelectSheetController = (props) => {
|
|
180
|
-
const context = useSelectContext("SelectSheetController", props.__scopeSelect), showSheet = useShowSelectSheet(context), breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint), getShowSheet = useGet(showSheet);
|
|
181
|
-
return /* @__PURE__ */ jsx(
|
|
182
|
-
SheetController,
|
|
174
|
+
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);
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
+
import_sheet.SheetController,
|
|
183
177
|
{
|
|
184
178
|
onOpenChange: (val) => {
|
|
185
179
|
getShowSheet() && props.onOpenChange(val);
|
|
@@ -189,7 +183,7 @@ const SelectSeparator = styled(Separator, {
|
|
|
189
183
|
children: props.children
|
|
190
184
|
}
|
|
191
185
|
);
|
|
192
|
-
}, SelectSheetImpl = (props) => /* @__PURE__ */ jsx(Fragment, { children: props.children }), Select = withStaticProperties(
|
|
186
|
+
}, SelectSheetImpl = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children }), Select = (0, import_helpers.withStaticProperties)(
|
|
193
187
|
(props) => {
|
|
194
188
|
const {
|
|
195
189
|
__scopeSelect,
|
|
@@ -205,16 +199,16 @@ const SelectSeparator = styled(Separator, {
|
|
|
205
199
|
size: sizeProp = "$true",
|
|
206
200
|
onActiveChange,
|
|
207
201
|
dir
|
|
208
|
-
} = props, id = React.useId(), scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id, { when, AdaptProvider } = useAdaptParent({
|
|
202
|
+
} = props, id = React.useId(), scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id, { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
|
|
209
203
|
Contents: React.useCallback(
|
|
210
|
-
() => /* @__PURE__ */ jsx(PortalHost, { name: `${scopeKey}SheetContents` }),
|
|
204
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { name: `${scopeKey}SheetContents` }),
|
|
211
205
|
[scopeKey]
|
|
212
206
|
)
|
|
213
|
-
}), sheetBreakpoint = when, SelectImpl = useSelectBreakpointActive(sheetBreakpoint) || !isWeb ? SelectSheetImpl : SelectInlineImpl, forceUpdate = React.useReducer(() => ({}), {})[1], [selectedItem, setSelectedItem] = React.useState(null), [open, setOpen] = useControllableState({
|
|
207
|
+
}), sheetBreakpoint = when, SelectImpl = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint) || !import_constants.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl, forceUpdate = React.useReducer(() => ({}), {})[1], [selectedItem, setSelectedItem] = React.useState(null), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
214
208
|
prop: openProp,
|
|
215
209
|
defaultProp: defaultOpen || !1,
|
|
216
210
|
onChange: onOpenChange
|
|
217
|
-
}), [value, setValue] = useControllableState({
|
|
211
|
+
}), [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
218
212
|
prop: valueProp,
|
|
219
213
|
defaultProp: defaultValue || "",
|
|
220
214
|
onChange: onValueChange,
|
|
@@ -226,12 +220,12 @@ const SelectSeparator = styled(Separator, {
|
|
|
226
220
|
emitValue(value);
|
|
227
221
|
}, [value]);
|
|
228
222
|
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);
|
|
229
|
-
useIsomorphicLayoutEffect(() => {
|
|
223
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
230
224
|
selectedIndexRef.current = selectedIndex, activeIndexRef.current = activeIndex;
|
|
231
225
|
});
|
|
232
|
-
const shouldRenderWebNative = isWeb && (native === !0 || native === "web" || Array.isArray(native) && native.includes("web"));
|
|
233
|
-
return /* @__PURE__ */ jsx(AdaptProvider, { children: /* @__PURE__ */ jsx(
|
|
234
|
-
SelectItemParentProvider,
|
|
226
|
+
const shouldRenderWebNative = import_constants.isWeb && (native === !0 || native === "web" || Array.isArray(native) && native.includes("web"));
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
|
+
import_context.SelectItemParentProvider,
|
|
235
229
|
{
|
|
236
230
|
scope: __scopeSelect,
|
|
237
231
|
initialValue: React.useMemo(() => value, []),
|
|
@@ -242,16 +236,16 @@ const SelectSeparator = styled(Separator, {
|
|
|
242
236
|
onChange: React.useCallback((val) => {
|
|
243
237
|
setValue(val), emitValue(val);
|
|
244
238
|
}, []),
|
|
245
|
-
onActiveChange: useEvent((...args) => {
|
|
246
|
-
onActiveChange
|
|
239
|
+
onActiveChange: (0, import_core.useEvent)((...args) => {
|
|
240
|
+
onActiveChange == null || onActiveChange(...args);
|
|
247
241
|
}),
|
|
248
242
|
setSelectedIndex,
|
|
249
243
|
setValueAtIndex: React.useCallback((index, value2) => {
|
|
250
244
|
listContentRef.current[index] = value2;
|
|
251
245
|
}, []),
|
|
252
246
|
shouldRenderWebNative,
|
|
253
|
-
children: /* @__PURE__ */ jsx(
|
|
254
|
-
SelectProvider,
|
|
247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
248
|
+
import_context.SelectProvider,
|
|
255
249
|
{
|
|
256
250
|
scope: __scopeSelect,
|
|
257
251
|
disablePreventBodyScroll,
|
|
@@ -273,7 +267,7 @@ const SelectSeparator = styled(Separator, {
|
|
|
273
267
|
value,
|
|
274
268
|
open,
|
|
275
269
|
native,
|
|
276
|
-
children: /* @__PURE__ */ jsx(SelectSheetController, { onOpenChange: setOpen, __scopeSelect, children: shouldRenderWebNative ? children : /* @__PURE__ */ jsx(
|
|
270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectSheetController, { onOpenChange: setOpen, __scopeSelect, children: shouldRenderWebNative ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
277
271
|
SelectImpl,
|
|
278
272
|
{
|
|
279
273
|
activeIndexRef,
|
|
@@ -291,20 +285,20 @@ const SelectSeparator = styled(Separator, {
|
|
|
291
285
|
) });
|
|
292
286
|
},
|
|
293
287
|
{
|
|
294
|
-
Adapt,
|
|
295
|
-
Content: SelectContent,
|
|
288
|
+
Adapt: import_adapt.Adapt,
|
|
289
|
+
Content: import_SelectContent.SelectContent,
|
|
296
290
|
Group: SelectGroup,
|
|
297
291
|
Icon: SelectIcon,
|
|
298
|
-
Item: SelectItem,
|
|
292
|
+
Item: import_SelectItem.SelectItem,
|
|
299
293
|
ItemIndicator: SelectItemIndicator,
|
|
300
|
-
ItemText: SelectItemText,
|
|
294
|
+
ItemText: import_SelectItemText.SelectItemText,
|
|
301
295
|
Label: SelectLabel,
|
|
302
|
-
ScrollDownButton: SelectScrollDownButton,
|
|
303
|
-
ScrollUpButton: SelectScrollUpButton,
|
|
304
|
-
Trigger: SelectTrigger,
|
|
296
|
+
ScrollDownButton: import_SelectScrollButton.SelectScrollDownButton,
|
|
297
|
+
ScrollUpButton: import_SelectScrollButton.SelectScrollUpButton,
|
|
298
|
+
Trigger: import_SelectTrigger.SelectTrigger,
|
|
305
299
|
Value: SelectValue,
|
|
306
|
-
Viewport: SelectViewport,
|
|
307
|
-
Sheet: Sheet.Controlled
|
|
300
|
+
Viewport: import_SelectViewport.SelectViewport,
|
|
301
|
+
Sheet: import_sheet.Sheet.Controlled
|
|
308
302
|
}
|
|
309
303
|
);
|
|
310
304
|
function useEmitter() {
|
|
@@ -317,11 +311,12 @@ function useEmitter() {
|
|
|
317
311
|
}), []);
|
|
318
312
|
return [emit, subscribe];
|
|
319
313
|
}
|
|
320
|
-
Select.displayName = SELECT_NAME;
|
|
321
|
-
export
|
|
314
|
+
Select.displayName = import_constants2.SELECT_NAME;
|
|
315
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
316
|
+
0 && (module.exports = {
|
|
322
317
|
Select,
|
|
323
318
|
SelectGroupFrame,
|
|
324
319
|
SelectIcon,
|
|
325
320
|
SelectSeparator
|
|
326
|
-
};
|
|
321
|
+
});
|
|
327
322
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Select.tsx"],
|
|
4
|
-
"mappings": "AAAA
|
|
5
|
-
"names": ["value"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsC,2BACtC,sBAAgC,kCAChC,mBAAiD,+BACjD,cAQO,0BACP,mBAAyB,+BACzB,iBAAqC,6BACrC,mBAAwC,+BACxC,gBAA2B,4BAC3B,mBAA0B,+BAC1B,eAAuC,2BACvC,gBAA+C,4BAC/C,cAAuC,0BACvC,gCAAqC,4CACrC,QAAuB,2BAEvBA,oBAA4B,wBAC5B,iBAMO,sBACP,uBAA8B,4BAC9B,oBAAiC,yBACjC,oBAAiD,yBACjD,wBAA+C,6BAC/C,4BAA6D,iCAC7D,uBAA8B,4BAC9B,wBAA+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O,QAAQ;AAAA,EACpC,IACC,CAAC,CAAC;AACL,SAAO,CAAC,MAAM,SAAS;AACzB;AAGA,OAAO,cAAc;",
|
|
5
|
+
"names": ["import_constants", "value"]
|
|
6
6
|
}
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var SelectContent_native_exports = {};
|
|
17
|
+
__export(SelectContent_native_exports, {
|
|
18
|
+
SelectContent: () => SelectContent
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(SelectContent_native_exports);
|
|
1
21
|
const SelectContent = ({ children }) => children;
|
|
2
|
-
export
|
|
22
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
23
|
+
0 && (module.exports = {
|
|
3
24
|
SelectContent
|
|
4
|
-
};
|
|
25
|
+
});
|
|
5
26
|
//# sourceMappingURL=SelectContent.native.js.map
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
5
14
|
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var SelectImpl_native_exports = {};
|
|
17
|
+
__export(SelectImpl_native_exports, {
|
|
18
|
+
SelectInlineImpl: () => SelectInlineImpl
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(SelectImpl_native_exports);
|
|
21
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
22
|
+
const SelectInlineImpl = (props) => (process.env.NODE_ENV === "development" && console.warn("Sheet not implemented inline on native"), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children }));
|
|
23
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
+
0 && (module.exports = {
|
|
25
|
+
SelectInlineImpl
|
|
26
|
+
});
|
|
6
27
|
//# sourceMappingURL=SelectImpl.native.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SelectImpl.native.tsx"],
|
|
4
|
-
"mappings": "AAWS;AAJF,MAAM,mBAAmB,CAAC,WAC3B,QAAQ,IAAI,aAAa,iBAC3B,QAAQ,KAAK,wCAAwC,GAEhD,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWS;AAJF,MAAM,mBAAmB,CAAC,WAC3B,QAAQ,IAAI,aAAa,iBAC3B,QAAQ,KAAK,wCAAwC,GAEhD,2EAAG,gBAAM,UAAS;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,10 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 SelectItem_exports = {};
|
|
25
|
+
__export(SelectItem_exports, {
|
|
26
|
+
SelectItem: () => SelectItem,
|
|
27
|
+
SelectItemContextProvider: () => SelectItemContextProvider,
|
|
28
|
+
useSelectItemContext: () => useSelectItemContext
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(SelectItem_exports);
|
|
31
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_list_item = require("@tamagui/list-item"), React = __toESM(require("react")), import_context = require("./context"), import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
const ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext] = (0, import_context.createSelectContext)(ITEM_NAME), SelectItem = import_list_item.ListItemFrame.styleable(
|
|
8
33
|
function(props, forwardedRef) {
|
|
9
34
|
const {
|
|
10
35
|
__scopeSelect,
|
|
@@ -13,12 +38,12 @@ const ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext
|
|
|
13
38
|
textValue: textValueProp,
|
|
14
39
|
index,
|
|
15
40
|
...restProps
|
|
16
|
-
} = props, { props: listItemProps } = useListItem({
|
|
41
|
+
} = props, { props: listItemProps } = (0, import_list_item.useListItem)({
|
|
17
42
|
...!props.unstyled && {
|
|
18
43
|
ellipse: !0
|
|
19
44
|
},
|
|
20
45
|
...restProps
|
|
21
|
-
}), context = useSelectItemParentContext(ITEM_NAME, __scopeSelect), {
|
|
46
|
+
}), context = (0, import_context.useSelectItemParentContext)(ITEM_NAME, __scopeSelect), {
|
|
22
47
|
setSelectedIndex,
|
|
23
48
|
listRef,
|
|
24
49
|
setOpen,
|
|
@@ -42,10 +67,10 @@ const ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext
|
|
|
42
67
|
}), [index]), React.useEffect(() => valueSubscribe((val) => {
|
|
43
68
|
setSelected(val === value);
|
|
44
69
|
}), [value]);
|
|
45
|
-
const textId = React.useId(), composedRefs = useComposedRefs(forwardedRef, (node) => {
|
|
46
|
-
isWeb && node instanceof HTMLElement && listRef && (listRef.current[index] = node);
|
|
70
|
+
const textId = React.useId(), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (node) => {
|
|
71
|
+
import_constants.isWeb && node instanceof HTMLElement && listRef && (listRef.current[index] = node);
|
|
47
72
|
});
|
|
48
|
-
useIsomorphicLayoutEffect(() => {
|
|
73
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
49
74
|
setValueAtIndex(index, value);
|
|
50
75
|
}, [index, setValueAtIndex, value]);
|
|
51
76
|
function handleSelect() {
|
|
@@ -59,7 +84,7 @@ const ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext
|
|
|
59
84
|
allowSelectRef.current = !1, allowMouseUpRef.current = !0;
|
|
60
85
|
},
|
|
61
86
|
onKeyDown(event) {
|
|
62
|
-
event.key === "Enter" || event.key === " " && !dataRef
|
|
87
|
+
event.key === "Enter" || event.key === " " && !(dataRef != null && dataRef.current.typing) ? (event.preventDefault(), handleSelect()) : allowSelectRef.current = !0;
|
|
63
88
|
},
|
|
64
89
|
onClick() {
|
|
65
90
|
allowSelectRef.current && handleSelect();
|
|
@@ -72,17 +97,18 @@ const ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext
|
|
|
72
97
|
}) : {
|
|
73
98
|
onPress: handleSelect
|
|
74
99
|
}, [handleSelect]);
|
|
75
|
-
return useIsomorphicLayoutEffect(() => {
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
return (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
101
|
+
var _a;
|
|
102
|
+
isActive && ((_a = listRef == null ? void 0 : listRef.current[index]) == null || _a.focus());
|
|
103
|
+
}, [isActive]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
104
|
SelectItemContextProvider,
|
|
79
105
|
{
|
|
80
106
|
scope: __scopeSelect,
|
|
81
107
|
value,
|
|
82
108
|
textId: textId || "",
|
|
83
109
|
isSelected,
|
|
84
|
-
children: shouldRenderWebNative ? /* @__PURE__ */ jsx("option", { value, children: props.children }) : /* @__PURE__ */ jsx(
|
|
85
|
-
ListItemFrame,
|
|
110
|
+
children: shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value, children: props.children }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
import_list_item.ListItemFrame,
|
|
86
112
|
{
|
|
87
113
|
tag: "div",
|
|
88
114
|
componentName: ITEM_NAME,
|
|
@@ -111,9 +137,10 @@ const ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext
|
|
|
111
137
|
disableTheme: !0
|
|
112
138
|
}
|
|
113
139
|
);
|
|
114
|
-
export
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
115
142
|
SelectItem,
|
|
116
143
|
SelectItemContextProvider,
|
|
117
144
|
useSelectItemContext
|
|
118
|
-
};
|
|
145
|
+
});
|
|
119
146
|
//# sourceMappingURL=SelectItem.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SelectItem.tsx"],
|
|
4
|
-
"mappings": "AAAA
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,mBAAiD,+BACjD,mBAA0D,+BAC1D,QAAuB,2BAEvB,iBAAgE,sBA0KtD;AAnKV,MAAM,YAAY,cAQL,CAAC,2BAA2B,oBAAoB,QAC3D,oCAA4C,SAAS,GAS1C,aAAa,+BAAc;AAAA,EACtC,SAAoB,OAAqC,cAAc;AACrE,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,WAAW;AAAA,MACX;AAAA,MACA,G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