@tamagui/menu 1.82.2 → 1.82.4

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.
Files changed (80) hide show
  1. package/package.json +5 -5
  2. package/dist/cjs/createNativeMenu/createNativeMenu.android.js +0 -263
  3. package/dist/cjs/createNativeMenu/createNativeMenu.android.js.map +0 -6
  4. package/dist/cjs/createNativeMenu/createNativeMenu.ios.js +0 -336
  5. package/dist/cjs/createNativeMenu/createNativeMenu.ios.js.map +0 -6
  6. package/dist/cjs/createNativeMenu/createNativeMenu.js +0 -46
  7. package/dist/cjs/createNativeMenu/createNativeMenu.js.map +0 -6
  8. package/dist/cjs/createNativeMenu/createNativeMenu.native.js +0 -47
  9. package/dist/cjs/createNativeMenu/createNativeMenu.native.js.map +0 -6
  10. package/dist/cjs/createNativeMenu/createNativeMenuTypes.js +0 -14
  11. package/dist/cjs/createNativeMenu/createNativeMenuTypes.js.map +0 -6
  12. package/dist/cjs/createNativeMenu/createNativeMenuTypes.native.js +0 -15
  13. package/dist/cjs/createNativeMenu/createNativeMenuTypes.native.js.map +0 -6
  14. package/dist/cjs/createNativeMenu/index.js +0 -21
  15. package/dist/cjs/createNativeMenu/index.js.map +0 -6
  16. package/dist/cjs/createNativeMenu/index.native.js +0 -22
  17. package/dist/cjs/createNativeMenu/index.native.js.map +0 -6
  18. package/dist/cjs/createNativeMenu/utils.js +0 -78
  19. package/dist/cjs/createNativeMenu/utils.js.map +0 -6
  20. package/dist/cjs/createNativeMenu/utils.native.js +0 -79
  21. package/dist/cjs/createNativeMenu/utils.native.js.map +0 -6
  22. package/dist/cjs/createNativeMenu/withNativeMenu.js +0 -40
  23. package/dist/cjs/createNativeMenu/withNativeMenu.js.map +0 -6
  24. package/dist/cjs/createNativeMenu/withNativeMenu.native.js +0 -41
  25. package/dist/cjs/createNativeMenu/withNativeMenu.native.js.map +0 -6
  26. package/dist/esm/createNativeMenu/createNativeMenu.android.js +0 -251
  27. package/dist/esm/createNativeMenu/createNativeMenu.android.js.map +0 -6
  28. package/dist/esm/createNativeMenu/createNativeMenu.ios.js +0 -323
  29. package/dist/esm/createNativeMenu/createNativeMenu.ios.js.map +0 -6
  30. package/dist/esm/createNativeMenu/createNativeMenu.js +0 -26
  31. package/dist/esm/createNativeMenu/createNativeMenu.js.map +0 -6
  32. package/dist/esm/createNativeMenu/createNativeMenu.native.js +0 -26
  33. package/dist/esm/createNativeMenu/createNativeMenu.native.js.map +0 -6
  34. package/dist/esm/createNativeMenu/createNativeMenuTypes.js +0 -1
  35. package/dist/esm/createNativeMenu/createNativeMenuTypes.js.map +0 -6
  36. package/dist/esm/createNativeMenu/createNativeMenuTypes.native.js +0 -1
  37. package/dist/esm/createNativeMenu/createNativeMenuTypes.native.js.map +0 -6
  38. package/dist/esm/createNativeMenu/index.js +0 -3
  39. package/dist/esm/createNativeMenu/index.js.map +0 -6
  40. package/dist/esm/createNativeMenu/index.native.js +0 -3
  41. package/dist/esm/createNativeMenu/index.native.js.map +0 -6
  42. package/dist/esm/createNativeMenu/utils.js +0 -47
  43. package/dist/esm/createNativeMenu/utils.js.map +0 -6
  44. package/dist/esm/createNativeMenu/utils.native.js +0 -47
  45. package/dist/esm/createNativeMenu/utils.native.js.map +0 -6
  46. package/dist/esm/createNativeMenu/withNativeMenu.js +0 -21
  47. package/dist/esm/createNativeMenu/withNativeMenu.js.map +0 -6
  48. package/dist/esm/createNativeMenu/withNativeMenu.native.js +0 -21
  49. package/dist/esm/createNativeMenu/withNativeMenu.native.js.map +0 -6
  50. package/dist/jsx/createNativeMenu/createNativeMenu.android.js +0 -245
  51. package/dist/jsx/createNativeMenu/createNativeMenu.android.js.map +0 -6
  52. package/dist/jsx/createNativeMenu/createNativeMenu.ios.js +0 -322
  53. package/dist/jsx/createNativeMenu/createNativeMenu.ios.js.map +0 -6
  54. package/dist/jsx/createNativeMenu/createNativeMenu.js +0 -26
  55. package/dist/jsx/createNativeMenu/createNativeMenu.js.map +0 -6
  56. package/dist/jsx/createNativeMenu/createNativeMenu.native.js +0 -26
  57. package/dist/jsx/createNativeMenu/createNativeMenu.native.js.map +0 -6
  58. package/dist/jsx/createNativeMenu/createNativeMenuTypes.js +0 -1
  59. package/dist/jsx/createNativeMenu/createNativeMenuTypes.js.map +0 -6
  60. package/dist/jsx/createNativeMenu/createNativeMenuTypes.native.js +0 -1
  61. package/dist/jsx/createNativeMenu/createNativeMenuTypes.native.js.map +0 -6
  62. package/dist/jsx/createNativeMenu/index.js +0 -3
  63. package/dist/jsx/createNativeMenu/index.js.map +0 -6
  64. package/dist/jsx/createNativeMenu/index.native.js +0 -3
  65. package/dist/jsx/createNativeMenu/index.native.js.map +0 -6
  66. package/dist/jsx/createNativeMenu/utils.js +0 -46
  67. package/dist/jsx/createNativeMenu/utils.js.map +0 -6
  68. package/dist/jsx/createNativeMenu/utils.native.js +0 -49
  69. package/dist/jsx/createNativeMenu/utils.native.js.map +0 -6
  70. package/dist/jsx/createNativeMenu/withNativeMenu.js +0 -20
  71. package/dist/jsx/createNativeMenu/withNativeMenu.js.map +0 -6
  72. package/dist/jsx/createNativeMenu/withNativeMenu.native.js +0 -20
  73. package/dist/jsx/createNativeMenu/withNativeMenu.native.js.map +0 -6
  74. package/types/createNativeMenu/createNativeMenu.android.d.ts.map +0 -1
  75. package/types/createNativeMenu/createNativeMenu.d.ts.map +0 -1
  76. package/types/createNativeMenu/createNativeMenu.ios.d.ts.map +0 -1
  77. package/types/createNativeMenu/createNativeMenuTypes.d.ts.map +0 -1
  78. package/types/createNativeMenu/index.d.ts.map +0 -1
  79. package/types/createNativeMenu/utils.d.ts.map +0 -1
  80. package/types/createNativeMenu/withNativeMenu.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/menu",
3
- "version": "1.82.2",
3
+ "version": "1.82.4",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -23,15 +23,15 @@
23
23
  "clean:build": "tamagui-build clean:build"
24
24
  },
25
25
  "dependencies": {
26
- "@tamagui/core": "1.82.2",
27
- "@tamagui/helpers": "1.82.2",
28
- "@tamagui/popover": "1.82.2"
26
+ "@tamagui/core": "1.82.4",
27
+ "@tamagui/helpers": "1.82.4",
28
+ "@tamagui/popover": "1.82.4"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "*"
32
32
  },
33
33
  "devDependencies": {
34
- "@tamagui/build": "1.82.2",
34
+ "@tamagui/build": "1.82.4",
35
35
  "react": "^18.2.0"
36
36
  },
37
37
  "publishConfig": {
@@ -1,263 +0,0 @@
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 createNativeMenu_android_exports = {};
17
- __export(createNativeMenu_android_exports, {
18
- createNativeMenu: () => createAndroidMenu
19
- });
20
- module.exports = __toCommonJS(createNativeMenu_android_exports);
21
- var import_menu = require("@react-native-menu/menu"), import_core = require("@tamagui/core"), import_react = require("react"), import_tamagui = require("tamagui"), import_Menu = require("../Menu"), import_utils = require("./utils"), import_jsx_runtime = require("react/jsx-runtime");
22
- const COMPONENTS_TO_IGNORE = ["Portal", "Radio"], createAndroidMenu = (MenuType) => {
23
- const Trigger = (0, import_utils.create)(({ children, asChild, ...rest }) => asChild ? (0, import_react.cloneElement)(children, {
24
- ...rest
25
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.View, { ...rest, children }), `${MenuType}Trigger`), Auxiliary = (0, import_utils.create)(
26
- ({ children }) => null,
27
- `${MenuType}Auxiliary`
28
- ), Group = (0, import_utils.create)(({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }), `${MenuType}Group`), Content = (0, import_utils.create)(({ children }) => (children || console.error(`Menu <Content /> children must be written directly inline.
29
-
30
- You cannot wrap this component into its own component. It should look like this:
31
-
32
- <Menu>
33
- <Content>
34
- <Item />
35
- <Item />
36
- </Content>
37
- </Menu>
38
-
39
- Notice that the <Item /> are all children of the <Content /> component. That's important.
40
-
41
- If you want to use a custom component as your <Content />, you can use the create() method. But you still need to pass all items as children of <Content />.`), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children })), `${MenuType}Content`), ItemTitle = (0, import_utils.create)(({ children }) => {
42
- if (typeof children != "string")
43
- throw new Error("Menu <ItemTitle /> child must be a string");
44
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
45
- }, `${MenuType}ItemTitle`), ItemIcon = (0, import_utils.create)((props) => (props.androidIconName || console.warn(
46
- "Menu <ItemIcon /> missing androidIconName prop. Will do nothing on android. Consider passing an androidIconName or switching to <ItemImage />."
47
- ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {})), `${MenuType}ItemIcon`), ItemImage = (0, import_utils.create)((props) => (props.androidIconName || console.warn(
48
- "Menu <ItemImage /> will not use your custom image on android. You should use the androidIconName prop to render an icon on android too."
49
- ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {})), `${MenuType}ItemImage`), ItemSubtitle = (0, import_utils.create)(({ children }) => {
50
- if (children && typeof children != "string")
51
- throw new Error("Menu <ItemSubtitle /> child must be a string");
52
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
53
- }, `${MenuType}ItemSubtitle`), Item = (0, import_utils.create)(({ children }) => {
54
- const titleChild = (0, import_utils.pickChildren)(children, ItemTitle).targetChildren;
55
- return typeof children != "string" && !(titleChild != null && titleChild.length) && console.error(
56
- `Menu Invalid <Item />. It either needs <ItemTitle /> in the children.
57
-
58
- <Item>
59
- <ItemTitle>
60
- Title here
61
- </ItemTitle>
62
- </Item>
63
- `
64
- ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
65
- }, `${MenuType}Item`), SubTrigger = (0, import_utils.create)(({ children }) => {
66
- const titleChild = (0, import_utils.pickChildren)(children, ItemTitle).targetChildren;
67
- return typeof children != "string" && !(titleChild != null && titleChild.length) && console.error(
68
- `Menu Invalid <SubTrigger />. It either needs an <ItemTitle /> in the children.
69
-
70
- <SubTrigger>
71
- <ItemTitle>
72
- Title here
73
- </ItemTitle>
74
- </SubTrigger>
75
- `
76
- ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
77
- }, `${MenuType}SubTrigger`), Sub = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Sub`), SubContent = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}SubContent`), CheckboxItem = (0, import_utils.create)(({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}CheckboxItem`), Label = (0, import_utils.create)(({ children }) => (typeof children != "string" && console.error("Menu <Label /> children must be a string."), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {})), `${MenuType}Label`), Menu = (0, import_utils.create)((props) => {
78
- var _a, _b, _c;
79
- const trigger = (0, import_utils.pickChildren)(props.children, Trigger), content = (_a = (0, import_utils.pickChildren)(
80
- props.children,
81
- Content,
82
- COMPONENTS_TO_IGNORE
83
- ).targetChildren) == null ? void 0 : _a[0], callbacks = {}, getItemFromChild = (child, index) => {
84
- var _a2, _b2, _c2, _d;
85
- let title;
86
- const key = child.key ? `${child.key}` : `item-${index}`;
87
- let subtitle;
88
- const menuAttributes = {};
89
- child.props.disabled && (menuAttributes.disabled = !0), child.props.destructive && (menuAttributes.destructive = !0), child.props.hidden && (menuAttributes.hidden = !0);
90
- let icon;
91
- if (typeof child.props.children == "string")
92
- title = child.props.children;
93
- else {
94
- const titleChild = (0, import_utils.pickChildren)(
95
- child.props.children,
96
- ItemTitle,
97
- COMPONENTS_TO_IGNORE
98
- ).targetChildren, maybeTitle = child.props.textValue ?? ((_a2 = titleChild == null ? void 0 : titleChild[0]) == null ? void 0 : _a2.props.children);
99
- typeof maybeTitle == "string" ? title = maybeTitle : console.error(
100
- `Menu Invalid <${Menu}.Item key="${key}" /> Missing valid title. Make sure you do one of the following:
101
-
102
- 1. pass a string as the child of <${Menu}.ItemTitle />, nested directly inside of <${Menu}.Item />.
103
- 2. OR, use the textValue prop on <${Menu}.Item textValue="Some value" />`
104
- );
105
- const subtitleChild = (0, import_utils.pickChildren)(
106
- child.props.children,
107
- ItemSubtitle
108
- ).targetChildren;
109
- typeof ((_b2 = subtitleChild == null ? void 0 : subtitleChild[0]) == null ? void 0 : _b2.props.children) == "string" && (subtitle = subtitleChild[0].props.children);
110
- const iconChildren = (0, import_utils.pickChildren)(
111
- child.props.children,
112
- ItemIcon
113
- ).targetChildren;
114
- if ((_c2 = iconChildren == null ? void 0 : iconChildren[0]) != null && _c2.props.androidIconName)
115
- icon = iconChildren[0].props.androidIconName;
116
- else {
117
- const imageChild = (_d = (0, import_utils.pickChildren)(
118
- child.props.children,
119
- ItemImage
120
- ).targetChildren) == null ? void 0 : _d[0];
121
- if (imageChild) {
122
- const { androidIconName } = imageChild.props;
123
- androidIconName && (icon = androidIconName);
124
- }
125
- }
126
- }
127
- if (title) {
128
- const maybeIndexKey = typeof child.key == "string" && child.key.startsWith(".") ? child.key.substring(1) : void 0;
129
- if (
130
- // if the key doesn't exist as a string
131
- (typeof child.key != "string" || // or if flattenChildren assigned the key as `.${key}${index}`
132
- child.key.startsWith(".") && !isNaN(Number(maybeIndexKey))) && console.warn(
133
- `Menu <Item /> is missing a unique key. Pass a unique key string for each item, such as: <Item key="${title.toLowerCase().replace(/ /g, "-") || `action-${index}`}" />. Falling back to index (${key}) instead, but this may have negative consequences.`
134
- ), "onSelect" in child.props && child.props.onSelect
135
- )
136
- callbacks[key] = child.props.onSelect;
137
- else if ("onValueChange" in child.props) {
138
- const menuState = child.props.value, currentState = menuState === !0 ? "on" : menuState === !1 ? "off" : menuState, nextState = currentState === "mixed" || currentState === "on" ? "off" : "on", { onValueChange } = child.props;
139
- callbacks[key] = () => {
140
- onValueChange == null || onValueChange(nextState, currentState);
141
- };
142
- }
143
- return {
144
- key,
145
- title,
146
- subtitle,
147
- menuAttributes,
148
- icon
149
- };
150
- }
151
- }, mapItemsChildren = (children) => import_react.Children.map(
152
- (0, import_utils.flattenChildren)(children, [...COMPONENTS_TO_IGNORE, "Group"]),
153
- (_child, index) => {
154
- var _a2, _b2;
155
- if ((0, import_utils.isInstanceOfComponent)(_child, Item)) {
156
- const item = getItemFromChild(_child, index);
157
- if (item) {
158
- const { icon, title, key, menuAttributes, subtitle } = item;
159
- return {
160
- id: key,
161
- title,
162
- image: icon,
163
- attributes: menuAttributes,
164
- subtitle
165
- };
166
- }
167
- } else if ((0, import_utils.isInstanceOfComponent)(_child, CheckboxItem)) {
168
- const child = _child, item = getItemFromChild(child, index);
169
- if (item) {
170
- const { icon, title, key, menuAttributes, subtitle } = item, menuState = child.props.value;
171
- return {
172
- id: key,
173
- title,
174
- image: icon,
175
- attributes: menuAttributes,
176
- subtitle,
177
- state: menuState === !0 ? "on" : menuState === !1 ? "off" : menuState
178
- };
179
- }
180
- } else if ((0, import_utils.isInstanceOfComponent)(_child, Sub)) {
181
- const child = _child, key = child.key ? `${child.key}` : `sub-${index}`, triggerItemChild = (_a2 = (0, import_utils.pickChildren)(
182
- child.props.children,
183
- SubTrigger
184
- ).targetChildren) == null ? void 0 : _a2[0], triggerItem2 = triggerItemChild && getItemFromChild(triggerItemChild, index);
185
- if (triggerItem2) {
186
- const nestedContent = (_b2 = (0, import_utils.pickChildren)(
187
- child.props.children,
188
- SubContent,
189
- COMPONENTS_TO_IGNORE
190
- ).targetChildren) == null ? void 0 : _b2[0];
191
- if (nestedContent) {
192
- const nestedItems = mapItemsChildren(nestedContent.props.children).filter(
193
- import_utils.filterNull
194
- );
195
- if (nestedItems.length)
196
- return {
197
- id: key,
198
- title: triggerItem2 == null ? void 0 : triggerItem2.title,
199
- image: triggerItem2 == null ? void 0 : triggerItem2.icon,
200
- subactions: nestedItems,
201
- attributes: triggerItem2.menuAttributes
202
- };
203
- }
204
- }
205
- }
206
- return null;
207
- }
208
- ), menuItems = mapItemsChildren(content == null ? void 0 : content.props.children).filter(import_utils.filterNull), labelComp = (_b = (0, import_utils.pickChildren)(content == null ? void 0 : content.props.children, Label).targetChildren) == null ? void 0 : _b[0];
209
- let menuTitle = "";
210
- typeof (labelComp == null ? void 0 : labelComp.props.children) == "string" ? menuTitle = labelComp.props.children : labelComp != null && labelComp.props.textValue && (menuTitle = labelComp.props.textValue);
211
- const triggerItem = (_c = trigger.targetChildren) == null ? void 0 : _c[0];
212
- let shouldOpenOnLongPress = MenuType === "ContextMenu";
213
- return triggerItem != null && triggerItem.props.action && (shouldOpenOnLongPress = triggerItem.props.action === "longPress"), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
214
- import_Menu.NativePropProvider,
215
- {
216
- native: !0,
217
- scope: MenuType === "DropdownMenu" ? "DropdownMenuContext" : "ContextMenuContext",
218
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
219
- import_menu.MenuView,
220
- {
221
- title: menuTitle,
222
- onPressAction: ({ nativeEvent }) => {
223
- callbacks[nativeEvent.event]();
224
- },
225
- shouldOpenOnLongPress,
226
- actions: menuItems,
227
- children: triggerItem
228
- }
229
- )
230
- }
231
- );
232
- }, `${MenuType}`), Separator = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Separator`), ItemIndicator = (0, import_utils.create)(
233
- (_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}),
234
- `${MenuType}ItemIndicator`
235
- ), Preview = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Preview`), Arrow = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Arrow`);
236
- return {
237
- Menu: (0, import_core.withStaticProperties)(Menu, {
238
- Trigger,
239
- Content,
240
- Item,
241
- ItemTitle,
242
- ItemSubtitle,
243
- SubTrigger,
244
- Group,
245
- Separator,
246
- ItemIcon,
247
- ItemIndicator,
248
- CheckboxItem,
249
- ItemImage,
250
- Label,
251
- Preview,
252
- Arrow,
253
- Sub,
254
- SubContent,
255
- Auxiliary
256
- })
257
- };
258
- };
259
- // Annotate the CommonJS export names for ESM import in node:
260
- 0 && (module.exports = {
261
- createNativeMenu
262
- });
263
- //# sourceMappingURL=createNativeMenu.android.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/createNativeMenu/createNativeMenu.android.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyB,oCACzB,cAAqC,0BACrC,eAA4D,kBAC5D,iBAAqB,oBAErB,cAAmC,oBAuBnC,eAMO,oBAWI;AATX,MAAM,uBAAuB,CAAC,UAAU,OAAO,GAEzC,oBAAoB,CAAC,aAA6C;AACtE,QAAM,cAAU,qBAAO,CAAC,EAAE,UAAU,SAAS,GAAG,KAAK,MAC/C,cACK,2BAAa,UAAU;AAAA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,wBAAwB;AAAA,QAE7D;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,YACP,eAAe,CAAC,EAAE,YAAY,MAAM;AAClC,wBAAU,YAAY,KAAK,EAAE;AAAA,YAC/B;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YAER;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ,GAAG,GAAG,QAAQ,EAAE,GAEV,gBAAY,qBAAO,CAAC,MACjB,2EAAE,GACR,GAAG,QAAQ,WAAW,GAEnB,oBAAgB;AAAA,IACpB,CAAC,MAA8B,2EAAE;AAAA,IACjC,GAAG,QAAQ;AAAA,EACb,GAEM,cAAU,qBAAO,CAAC,MAA+B,2EAAE,GAAK,GAAG,QAAQ,SAAS,GAE5E,YAAQ,qBAAO,CAAC,MAAsB,2EAAE,GAAK,GAAG,QAAQ,OAAO;AAErE,SAAO;AAAA,IACL,UAAM,kCAAqB,MAAM;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
5
- "names": ["_a", "_b", "_c", "triggerItem"]
6
- }
@@ -1,336 +0,0 @@
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 createNativeMenu_ios_exports = {};
17
- __export(createNativeMenu_ios_exports, {
18
- createNativeMenu: () => createIosMenu
19
- });
20
- module.exports = __toCommonJS(createNativeMenu_ios_exports);
21
- var import_core = require("@tamagui/core"), import_react = require("react"), import_react_native = require("react-native"), import_react_native_ios_context_menu = require("react-native-ios-context-menu"), import_tamagui = require("tamagui"), import_Menu = require("../Menu"), import_utils = require("./utils"), import_jsx_runtime = require("react/jsx-runtime");
22
- const COMPONENTS_TO_IGNORE = ["Portal", "Radio"], createIosMenu = (MenuType) => {
23
- const Trigger = (0, import_utils.create)(({ children, asChild, ...rest }) => asChild ? (0, import_react.cloneElement)(children, {
24
- ...rest
25
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.View, { ...rest, children }), `${MenuType}Trigger`), Auxiliary = (0, import_utils.create)(({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Auxiliary`), Group = (0, import_utils.create)(({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }), `${MenuType}Group`), Content = (0, import_utils.create)(({ children }) => (children || console.error(`Menu <Content /> children must be written directly inline.
26
-
27
- You cannot wrap this component into its own component. It should look like this:
28
-
29
- <Menu>
30
- <Content>
31
- <Item />
32
- <Item />
33
- </Content>
34
- </Menu>
35
-
36
- Notice that the <Item /> are all children of the <Content /> component. That's important.
37
-
38
- If you want to use a custom component as your <Content />, you can use the create() method. But you still need to pass all items as children of <Content />.`), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children })), `${MenuType}Content`), ItemTitle = (0, import_utils.create)(({ children }) => {
39
- if (typeof children != "string")
40
- throw new Error("Menu <ItemTitle /> child must be a string");
41
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
42
- }, `${MenuType}ItemTitle`), ItemIcon = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}ItemIcon`), ItemImage = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}ItemImage`), ItemSubtitle = (0, import_utils.create)(({ children }) => {
43
- if (children && typeof children != "string")
44
- throw new Error("Menu <ItemSubtitle /> child must be a string");
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
46
- }, `${MenuType}ItemSubtitle`), Item = (0, import_utils.create)(({ children }) => {
47
- const titleChild = (0, import_utils.pickChildren)(children, ItemTitle).targetChildren;
48
- return typeof children != "string" && !(titleChild != null && titleChild.length) && console.error(
49
- `Menu Invalid <Item />. It either needs <ItemTitle /> in the children.
50
-
51
- <Item>
52
- <ItemTitle>
53
- Title here
54
- </ItemTitle>
55
- </Item>
56
- `
57
- ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
58
- }, `${MenuType}Item`), SubTrigger = (0, import_utils.create)(({ children }) => {
59
- const titleChild = (0, import_utils.pickChildren)(children, ItemTitle).targetChildren;
60
- return typeof children != "string" && !(titleChild != null && titleChild.length) && console.error(
61
- `Menu Invalid <SubTrigger />. It either needs a string as the children, or a <ItemTitle /> in the children. However, it got neither.
62
-
63
-
64
- <SubTrigger>
65
- <ItemTitle>
66
- Title here
67
- </ItemTitle>
68
- </SubTrigger>
69
- `
70
- ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
71
- }, `${MenuType}SubTrigger`), Sub = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Sub`), SubContent = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}SubContent`), Preview = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Preview`);
72
- Preview.defaultProps = {
73
- isResizeAnimated: !0
74
- };
75
- const CheckboxItem = (0, import_utils.create)(({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}CheckboxItem`), Label = (0, import_utils.create)(({ children }) => (typeof children != "string" && console.error("Menu <Label /> children must be a string."), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {})), `${MenuType}Label`), Menu = (0, import_utils.create)((props) => {
76
- var _a, _b, _c, _d, _e, _f;
77
- const trigger = (0, import_utils.pickChildren)(props.children, Trigger), content = (_a = (0, import_utils.pickChildren)(
78
- props.children,
79
- Content,
80
- COMPONENTS_TO_IGNORE
81
- ).targetChildren) == null ? void 0 : _a[0], callbacks = {}, getItemFromChild = (child, index) => {
82
- var _a2, _b2, _c2, _d2, _e2, _f2;
83
- let title;
84
- const key = child.key ? `${child.key}` : `item-${index}`;
85
- let subtitle;
86
- const menuAttributes = [];
87
- child.props.disabled && menuAttributes.push("disabled"), child.props.destructive && menuAttributes.push("destructive"), child.props.hidden && menuAttributes.push("hidden");
88
- let icon;
89
- if (typeof child.props.children == "string")
90
- title = child.props.children;
91
- else {
92
- const titleChild = (0, import_utils.pickChildren)(
93
- child.props.children,
94
- ItemTitle
95
- ).targetChildren, maybeTitle = child.props.textValue ?? ((_a2 = titleChild == null ? void 0 : titleChild[0]) == null ? void 0 : _a2.props.children);
96
- typeof maybeTitle == "string" ? title = maybeTitle : console.error(
97
- `Menu Invalid <${Menu}.Item key="${key}" /> Missing valid title. Make sure you do one of the following:
98
-
99
- 1. pass a string as the child of <${Menu}.ItemTitle />, nested directly inside of <${Menu}.Item />.
100
- 2. OR, use the textValue prop on <${Menu}.Item textValue="Some value" />`
101
- );
102
- const subtitleChild = (0, import_utils.pickChildren)(
103
- child.props.children,
104
- ItemSubtitle
105
- ).targetChildren;
106
- typeof ((_b2 = subtitleChild == null ? void 0 : subtitleChild[0]) == null ? void 0 : _b2.props.children) == "string" && (subtitle = subtitleChild[0].props.children);
107
- const iconChildren = (0, import_utils.pickChildren)(
108
- child.props.children,
109
- ItemIcon
110
- ).targetChildren;
111
- if ((_c2 = iconChildren == null ? void 0 : iconChildren[0]) != null && _c2.props.iosIconName || (_d2 = iconChildren == null ? void 0 : iconChildren[0]) != null && _d2.props.ios) {
112
- const iconConfiguration = (_e2 = iconChildren == null ? void 0 : iconChildren[0]) == null ? void 0 : _e2.props.ios;
113
- icon = {
114
- type: "IMAGE_SYSTEM",
115
- imageValue: {
116
- ...iconConfiguration,
117
- systemName: (iconConfiguration == null ? void 0 : iconConfiguration.name) ?? iconChildren[0].props.iosIconName
118
- }
119
- };
120
- } else {
121
- const imageChild = (_f2 = (0, import_utils.pickChildren)(
122
- child.props.children,
123
- ItemImage
124
- ).targetChildren) == null ? void 0 : _f2[0];
125
- if (imageChild && imageChild.props.source) {
126
- const { source, ios: { lazy = !0, style } = {} } = imageChild.props;
127
- typeof source == "object" && "uri" in source && source.uri ? icon = {
128
- type: "IMAGE_REMOTE_URL",
129
- imageValue: {
130
- url: source.uri
131
- },
132
- imageLoadingConfig: {
133
- shouldLazyLoad: lazy ?? !0
134
- },
135
- imageOptions: style
136
- } : icon = {
137
- type: "IMAGE_REQUIRE",
138
- imageValue: import_react_native.Image.resolveAssetSource(imageChild.props.source)
139
- };
140
- }
141
- }
142
- }
143
- if (title) {
144
- const maybeIndexKey = typeof child.key == "string" && child.key.startsWith(".") ? child.key.substring(1) : void 0;
145
- if (
146
- // if the key doesn't exist as a string
147
- (typeof child.key != "string" || // or if flattenChildren assigned the key as `.${key}${index}`
148
- child.key.startsWith(".") && !isNaN(Number(maybeIndexKey))) && console.warn(
149
- `Menu <Item /> is missing a unique key. Pass a unique key string for each item, such as: <Item key="${title.toLowerCase().replace(/ /g, "-") || `action-${index}`}" />. Falling back to index (${key}) instead, but this may have negative consequences.`
150
- ), "onSelect" in child.props && child.props.onSelect
151
- )
152
- callbacks[key] = child.props.onSelect;
153
- else if ("onValueChange" in child.props) {
154
- const menuState = child.props.value, currentState = menuState === !0 ? "on" : menuState === !1 ? "off" : menuState, nextState = currentState === "mixed" || currentState === "on" ? "off" : "on", { onValueChange } = child.props;
155
- callbacks[key] = () => {
156
- onValueChange == null || onValueChange(nextState, currentState);
157
- };
158
- }
159
- return {
160
- key,
161
- title,
162
- subtitle,
163
- menuAttributes,
164
- icon
165
- };
166
- }
167
- }, mapItemsChildren = (children) => import_react.Children.map((0, import_utils.flattenChildren)(children), (_child, index) => {
168
- var _a2, _b2;
169
- if ((0, import_utils.isInstanceOfComponent)(_child, Item)) {
170
- const item = getItemFromChild(_child, index);
171
- if (item) {
172
- const { icon, title, key, menuAttributes, subtitle } = item;
173
- return {
174
- actionKey: key,
175
- actionTitle: title,
176
- icon,
177
- menuAttributes,
178
- discoverabilityTitle: subtitle
179
- };
180
- }
181
- } else if ((0, import_utils.isInstanceOfComponent)(_child, CheckboxItem)) {
182
- const child = _child, item = getItemFromChild(child, index);
183
- if (item) {
184
- const { icon, title, key, menuAttributes, subtitle } = item, menuState = child.props.value;
185
- return {
186
- actionKey: key,
187
- actionTitle: title,
188
- icon,
189
- menuAttributes,
190
- discoverabilityTitle: subtitle,
191
- menuState: menuState === !0 ? "on" : menuState === !1 ? "off" : menuState
192
- };
193
- }
194
- } else if ((0, import_utils.isInstanceOfComponent)(_child, Sub)) {
195
- const child = _child, triggerItemChild = (_a2 = (0, import_utils.pickChildren)(
196
- child.props.children,
197
- SubTrigger
198
- ).targetChildren) == null ? void 0 : _a2[0], triggerItem2 = triggerItemChild && getItemFromChild(triggerItemChild, index);
199
- if (triggerItem2) {
200
- const nestedContent = (_b2 = (0, import_utils.pickChildren)(child.props.children, SubContent, COMPONENTS_TO_IGNORE).targetChildren) == null ? void 0 : _b2[0];
201
- if (nestedContent) {
202
- const nestedItems = mapItemsChildren(nestedContent.props.children).filter(
203
- import_utils.filterNull
204
- );
205
- if (nestedItems.length) {
206
- const menuOptions = [];
207
- return new Set(triggerItem2.menuAttributes || []).has("destructive") && menuOptions.push("destructive"), {
208
- menuTitle: triggerItem2 == null ? void 0 : triggerItem2.title,
209
- icon: triggerItem2 == null ? void 0 : triggerItem2.icon,
210
- menuItems: nestedItems,
211
- menuOptions,
212
- menuAttributes: triggerItem2.menuAttributes
213
- };
214
- }
215
- }
216
- }
217
- } else if ((0, import_utils.isInstanceOfComponent)(_child, Group))
218
- return {
219
- menuTitle: "",
220
- menuItems: mapItemsChildren(_child.props.children).filter(import_utils.filterNull),
221
- menuOptions: ["displayInline"]
222
- };
223
- return null;
224
- }), menuItems = mapItemsChildren(content == null ? void 0 : content.props.children).filter(import_utils.filterNull), labelComp = (_b = (0, import_utils.pickChildren)(content == null ? void 0 : content.props.children, Label).targetChildren) == null ? void 0 : _b[0];
225
- let menuTitle = "";
226
- typeof (labelComp == null ? void 0 : labelComp.props.children) == "string" ? menuTitle = labelComp.props.children : labelComp != null && labelComp.props.textValue && (menuTitle = labelComp.props.textValue);
227
- const Component = MenuType === "ContextMenu" ? import_react_native_ios_context_menu.ContextMenuView : import_react_native_ios_context_menu.ContextMenuButton, preview = (_c = (0, import_utils.pickChildren)(content == null ? void 0 : content.props.children, Preview).targetChildren) == null ? void 0 : _c[0], previewProps = preview == null ? void 0 : preview.props, onMenuDidHide = props.onOpenChange && (() => {
228
- var _a2;
229
- (_a2 = props.onOpenChange) == null || _a2.call(props, !1);
230
- }), onMenuDidShow = props.onOpenChange && (() => {
231
- var _a2;
232
- (_a2 = props.onOpenChange) == null || _a2.call(props, !0);
233
- }), onMenuWillShow = props.onOpenWillChange && (() => {
234
- var _a2;
235
- (_a2 = props.onOpenWillChange) == null || _a2.call(props, !0);
236
- }), onMenuWillHide = props.onOpenWillChange && (() => {
237
- var _a2;
238
- (_a2 = props.onOpenWillChange) == null || _a2.call(props, !1);
239
- }), triggerItem = (_d = trigger.targetChildren) == null ? void 0 : _d[0];
240
- let shouldOpenOnSingleTap = MenuType === "DropdownMenu";
241
- triggerItem != null && triggerItem.props.action && (shouldOpenOnSingleTap = triggerItem.props.action === "press");
242
- const auxiliary = MenuType === "ContextMenu" ? (_e = (0, import_utils.pickChildren)(content == null ? void 0 : content.props.children, Auxiliary)) == null ? void 0 : _e.targetChildren : void 0, auxiliaryProps = (_f = auxiliary == null ? void 0 : auxiliary[0]) == null ? void 0 : _f.props, menuRef = (0, import_react.useRef)();
243
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
244
- import_Menu.NativePropProvider,
245
- {
246
- native: !0,
247
- scope: MenuType === "DropdownMenu" ? "DropdownMenuContext" : "ContextMenuContext",
248
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
249
- Component,
250
- {
251
- ref: menuRef,
252
- onPressMenuItem: ({ nativeEvent }) => {
253
- callbacks[nativeEvent.actionKey] && callbacks[nativeEvent.actionKey]();
254
- },
255
- isMenuPrimaryAction: shouldOpenOnSingleTap,
256
- style: [{ flexGrow: 0 }, props.style],
257
- menuConfig: {
258
- menuTitle,
259
- menuItems
260
- },
261
- renderPreview: MenuType === "ContextMenu" && preview && (previewProps != null && previewProps.children) ? () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: typeof (previewProps == null ? void 0 : previewProps.children) == "function" ? previewProps.children() : previewProps == null ? void 0 : previewProps.children }) : void 0,
262
- lazyPreview: MenuType === "ContextMenu" ? typeof (previewProps == null ? void 0 : previewProps.children) == "function" : void 0,
263
- onPressMenuPreview: MenuType === "ContextMenu" ? previewProps == null ? void 0 : previewProps.onPress : void 0,
264
- auxiliaryPreviewConfig: auxiliaryProps != null && auxiliaryProps.children ? {
265
- alignmentHorizontal: auxiliaryProps == null ? void 0 : auxiliaryProps.alignmentHorizontal,
266
- anchorPosition: auxiliaryProps == null ? void 0 : auxiliaryProps.anchorPosition,
267
- height: auxiliaryProps == null ? void 0 : auxiliaryProps.height,
268
- marginAuxiliaryPreview: auxiliaryProps == null ? void 0 : auxiliaryProps.marginWithScreenEdge,
269
- marginPreview: auxiliaryProps == null ? void 0 : auxiliaryProps.marginPreview,
270
- transitionConfigEntrance: auxiliaryProps == null ? void 0 : auxiliaryProps.transitionConfigEntrance,
271
- transitionEntranceDelay: auxiliaryProps == null ? void 0 : auxiliaryProps.transitionEntranceDelay,
272
- width: auxiliaryProps == null ? void 0 : auxiliaryProps.width
273
- } : void 0,
274
- isAuxiliaryPreviewEnabled: !!(auxiliaryProps != null && auxiliaryProps.children),
275
- onMenuAuxiliaryPreviewDidShow: auxiliaryProps == null ? void 0 : auxiliaryProps.onDidShow,
276
- onMenuAuxiliaryPreviewWillShow: auxiliaryProps == null ? void 0 : auxiliaryProps.onWillShow,
277
- renderAuxiliaryPreview: auxiliaryProps != null && auxiliaryProps.children ? () => {
278
- const child = typeof (auxiliaryProps == null ? void 0 : auxiliaryProps.children) == "function" ? auxiliaryProps == null ? void 0 : auxiliaryProps.children({
279
- dismissMenu() {
280
- var _a2;
281
- (_a2 = menuRef.current) == null || _a2.dismissMenu();
282
- }
283
- }) : auxiliaryProps == null ? void 0 : auxiliaryProps.children;
284
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: child });
285
- } : void 0,
286
- previewConfig: preview ? {
287
- // ...previewProps,
288
- previewType: "CUSTOM",
289
- previewSize: previewProps == null ? void 0 : previewProps.size,
290
- backgroundColor: previewProps == null ? void 0 : previewProps.backgroundColor,
291
- borderRadius: previewProps == null ? void 0 : previewProps.borderRadius,
292
- isResizeAnimated: previewProps == null ? void 0 : previewProps.isResizeAnimated,
293
- preferredCommitStyle: previewProps == null ? void 0 : previewProps.preferredCommitStyle
294
- } : void 0,
295
- onMenuDidHide,
296
- onMenuDidShow,
297
- onMenuWillHide,
298
- onMenuWillShow,
299
- ...props.__unsafeIosProps,
300
- children: triggerItem
301
- }
302
- )
303
- }
304
- );
305
- }, `${MenuType}`), Separator = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Separator`), ItemIndicator = (0, import_utils.create)(
306
- (_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}),
307
- `${MenuType}ItemIndicator`
308
- ), Arrow = (0, import_utils.create)((_) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), `${MenuType}Arrow`);
309
- return {
310
- Menu: (0, import_core.withStaticProperties)(Menu, {
311
- Trigger,
312
- Content,
313
- Item,
314
- ItemTitle,
315
- ItemSubtitle,
316
- SubTrigger,
317
- Group,
318
- Separator,
319
- ItemIcon,
320
- ItemIndicator,
321
- CheckboxItem,
322
- ItemImage,
323
- Label,
324
- Preview,
325
- Arrow,
326
- Sub,
327
- SubContent,
328
- Auxiliary
329
- })
330
- };
331
- };
332
- // Annotate the CommonJS export names for ESM import in node:
333
- 0 && (module.exports = {
334
- createNativeMenu
335
- });
336
- //# sourceMappingURL=createNativeMenu.ios.js.map