@tamagui/button 3.0.0-beta.806.1 → 3.0.0-beta.831.1

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.
@@ -20,8 +20,6 @@ var __copyProps = (to, from, except, desc) => {
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var Button_exports = {};
22
22
  __export(Button_exports, {
23
- Button: () => Button2,
24
- ButtonContext: () => ButtonContext,
25
23
  ButtonFrame: () => ButtonFrame,
26
24
  ButtonIcon: () => ButtonIcon,
27
25
  ButtonText: () => ButtonText,
@@ -34,31 +32,7 @@ var import_text = require("@tamagui/text");
34
32
  var import_web = require("@tamagui/web");
35
33
  var import_react = require("react");
36
34
  var import_jsx_runtime = require("react/jsx-runtime");
37
- const buttonContextKeys = [
38
- "color",
39
- "ellipsis",
40
- "fontFamily",
41
- "fontSize",
42
- "fontStyle",
43
- "fontWeight",
44
- "letterSpacing",
45
- "maxFontSizeMultiplier",
46
- "textAlign"
47
- ];
48
- const ButtonContext = (0, import_web.createStyledContext)({
49
- color: void 0,
50
- ellipsis: void 0,
51
- fontFamily: void 0,
52
- fontSize: void 0,
53
- fontStyle: void 0,
54
- fontWeight: void 0,
55
- letterSpacing: void 0,
56
- maxFontSizeMultiplier: void 0,
57
- textAlign: void 0
58
- }, { keys: buttonContextKeys });
59
35
  const ButtonFrame = (0, import_web.styled)(import_web.View, {
60
- context: ButtonContext,
61
- displayName: "ButtonFrame",
62
36
  role: "button",
63
37
  render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button" }),
64
38
  tabIndex: 0,
@@ -69,88 +43,45 @@ const ButtonFrame = (0, import_web.styled)(import_web.View, {
69
43
  variants: { disabled: { true: { pointerEvents: "none" } } }
70
44
  });
71
45
  const ButtonText = (0, import_web.styled)(import_web.Text, {
72
- context: ButtonContext,
73
- displayName: "ButtonText",
74
46
  flexGrow: 0,
75
47
  flexShrink: 1
76
48
  });
77
- const isOpaqueColor = (value) => typeof value === "object" && value !== null && ("dynamic" in value || "semantic" in value || "resource_paths" in value);
78
49
  const ButtonIcon = ({ children, color, scaleIcon = 1, size }) => {
79
- const styledContext = ButtonContext.useStyledContext();
80
- const iconColor = color ?? styledContext?.color;
81
50
  const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
82
- color: typeof iconColor === "string" && iconColor !== "unset" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,
51
+ color,
83
52
  size: size === void 0 ? void 0 : size * scaleIcon
84
53
  });
85
54
  return getThemedIcon(children);
86
55
  };
87
- const buttonInternalPropNames = [
88
- "children",
89
- "color",
90
- "disabled",
91
- "ellipsis",
92
- "fontFamily",
93
- "fontSize",
94
- "fontStyle",
95
- "fontWeight",
96
- "icon",
97
- "iconAfter",
98
- "iconSize",
99
- "letterSpacing",
100
- "maxFontSizeMultiplier",
101
- "noTextWrap",
102
- "render",
103
- "scaleIcon",
104
- "textAlign",
105
- "textProps"
106
- ];
107
- function useButton(propsIn, { Text: Text2 = ButtonText, iconColor: iconColorOption, iconSize: iconSizeOption, textProps: textPropsOption } = {}) {
56
+ function useButton(propsIn, { Text: Text2 = ButtonText, iconColor, iconSize: iconSizeOption, textProps: textPropsOption } = {}) {
108
57
  const isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
109
- const styledContext = ButtonContext.useStyledContext();
110
- const processedProps = (0, import_web.useProps)(propsIn, {
111
- noNormalize: true,
112
- noExpand: true
58
+ const [wrappedTextProps, buttonProps] = (0, import_web.splitStyleProps)(propsIn, {
59
+ expandShorthands: true,
60
+ filter: import_text.textParentProps
113
61
  });
114
- const { children, color, disabled, ellipsis, fontFamily, fontSize, fontStyle, fontWeight, icon, iconAfter, iconSize, letterSpacing, maxFontSizeMultiplier, noTextWrap, render, scaleIcon = 1, textAlign, textProps } = processedProps;
115
- const frameProps = { ...propsIn };
116
- for (const key of buttonInternalPropNames) {
117
- delete frameProps[key];
118
- }
119
- const contextColor = color ?? styledContext?.color;
120
- const iconColor = iconColorOption ?? contextColor;
62
+ const { children, disabled, icon, iconAfter, iconSize, render, scaleIcon = 1, ...frameProps } = buttonProps;
63
+ const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
121
64
  const resolvedIconSize = iconSize ?? iconSizeOption;
122
65
  const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
123
- color: typeof iconColor === "string" && iconColor !== "unset" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,
66
+ color: iconColor,
124
67
  size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon
125
68
  });
126
69
  const [themedIcon, themedIconAfter] = [icon, iconAfter].map((item) => {
127
70
  return item ? getThemedIcon(item) : null;
128
71
  });
129
- const textContext = {
130
- color: contextColor,
131
- ellipsis: ellipsis ?? styledContext?.ellipsis,
132
- fontFamily: fontFamily ?? styledContext?.fontFamily,
133
- fontSize: fontSize ?? styledContext?.fontSize,
134
- fontStyle: fontStyle ?? styledContext?.fontStyle,
135
- fontWeight: fontWeight ?? styledContext?.fontWeight,
136
- letterSpacing: letterSpacing ?? styledContext?.letterSpacing,
137
- maxFontSizeMultiplier: maxFontSizeMultiplier ?? styledContext?.maxFontSizeMultiplier,
138
- textAlign: textAlign ?? styledContext?.textAlign
139
- };
140
72
  const wrappedChildren = (0, import_text.wrapChildrenInText)(Text2, {
141
73
  children,
142
- ...textContext,
143
74
  noTextWrap,
144
75
  textProps
145
76
  }, {
146
77
  ...textPropsOption,
147
- ...processedProps.size === void 0 ? null : { size: processedProps.size }
78
+ ...textStyleProps
148
79
  });
149
- const resolvedRender = render ?? (isNested ? "span" : processedProps.accessibilityRole === "link" || processedProps.role === "link" ? "a" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
80
+ const resolvedRender = render ?? (isNested ? "span" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
150
81
  type: "button",
151
82
  disabled: true
152
83
  }) : void 0);
153
- const props = {
84
+ const resolvedProps = {
154
85
  ...frameProps,
155
86
  ...disabled && {
156
87
  "aria-disabled": true,
@@ -171,33 +102,17 @@ function useButton(propsIn, { Text: Text2 = ButtonText, iconColor: iconColorOpti
171
102
  onKeyDown: void 0,
172
103
  onKeyUp: void 0
173
104
  },
174
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
105
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.ButtonNestingContext.Provider, {
175
106
  value: true,
176
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ButtonContext.Provider, {
177
- ...textContext,
178
- children: [
179
- themedIcon,
180
- wrappedChildren,
181
- themedIconAfter
182
- ]
183
- })
107
+ children: [
108
+ themedIcon,
109
+ wrappedChildren,
110
+ themedIconAfter
111
+ ]
184
112
  })
185
113
  };
186
114
  return {
187
115
  isNested,
188
- props
116
+ props: resolvedProps
189
117
  };
190
118
  }
191
- const ButtonComponent = (0, import_web.createStyledHOC)(ButtonFrame, function Button(props, ref) {
192
- const { props: buttonProps } = useButton(props);
193
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {
194
- ref,
195
- ...buttonProps
196
- });
197
- });
198
- const Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
199
- Apply: ButtonContext.Provider,
200
- Frame: ButtonFrame,
201
- Icon: ButtonIcon,
202
- Text: ButtonText
203
- });
@@ -22,8 +22,6 @@ var __copyProps = (to, from, except, desc) => {
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var Button_exports = {};
24
24
  __export(Button_exports, {
25
- Button: () => Button2,
26
- ButtonContext: () => ButtonContext,
27
25
  ButtonFrame: () => ButtonFrame,
28
26
  ButtonIcon: () => ButtonIcon,
29
27
  ButtonText: () => ButtonText,
@@ -36,35 +34,7 @@ var import_stacks = require("@tamagui/stacks");
36
34
  var import_text = require("@tamagui/text");
37
35
  var import_web = require("@tamagui/web");
38
36
  var import_react = require("react");
39
- function _type_of(obj) {
40
- "@swc/helpers - typeof";
41
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
42
- }
43
- var buttonContextKeys = [
44
- "color",
45
- "ellipsis",
46
- "fontFamily",
47
- "fontSize",
48
- "fontStyle",
49
- "fontWeight",
50
- "letterSpacing",
51
- "maxFontSizeMultiplier",
52
- "textAlign"
53
- ];
54
- var ButtonContext = (0, import_web.createStyledContext)({
55
- color: void 0,
56
- ellipsis: void 0,
57
- fontFamily: void 0,
58
- fontSize: void 0,
59
- fontStyle: void 0,
60
- fontWeight: void 0,
61
- letterSpacing: void 0,
62
- maxFontSizeMultiplier: void 0,
63
- textAlign: void 0
64
- }, { keys: buttonContextKeys });
65
37
  var ButtonFrame = (0, import_web.styled)(import_web.View, {
66
- context: ButtonContext,
67
- displayName: "ButtonFrame",
68
38
  role: "button",
69
39
  render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button" }),
70
40
  tabIndex: 0,
@@ -75,109 +45,47 @@ var ButtonFrame = (0, import_web.styled)(import_web.View, {
75
45
  variants: { disabled: { true: { pointerEvents: "none" } } }
76
46
  });
77
47
  var ButtonText = (0, import_web.styled)(import_web.Text, {
78
- context: ButtonContext,
79
- displayName: "ButtonText",
80
48
  flexGrow: 0,
81
49
  flexShrink: 1
82
50
  });
83
- var isOpaqueColor = function(value) {
84
- return (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null && ("dynamic" in value || "semantic" in value || "resource_paths" in value);
85
- };
86
51
  var ButtonIcon = function(param) {
87
52
  var { children, color, scaleIcon = 1, size } = param;
88
- var styledContext = ButtonContext.useStyledContext();
89
- var iconColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
90
53
  var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
91
- color: typeof iconColor === "string" && iconColor !== "unset" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,
54
+ color,
92
55
  size: size === void 0 ? void 0 : size * scaleIcon
93
56
  });
94
57
  return getThemedIcon(children);
95
58
  };
96
- var buttonInternalPropNames = [
97
- "children",
98
- "color",
99
- "disabled",
100
- "ellipsis",
101
- "fontFamily",
102
- "fontSize",
103
- "fontStyle",
104
- "fontWeight",
105
- "icon",
106
- "iconAfter",
107
- "iconSize",
108
- "letterSpacing",
109
- "maxFontSizeMultiplier",
110
- "noTextWrap",
111
- "render",
112
- "scaleIcon",
113
- "textAlign",
114
- "textProps"
115
- ];
116
59
  function useButton(propsIn) {
117
- var { Text: _$Text = ButtonText, iconColor: iconColorOption, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
60
+ var { Text: _$Text = ButtonText, iconColor, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
118
61
  var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
119
- var styledContext = ButtonContext.useStyledContext();
120
- var processedProps = (0, import_web.useProps)(propsIn, {
121
- noNormalize: true,
122
- noExpand: true
62
+ var [wrappedTextProps, buttonProps] = (0, import_web.splitStyleProps)(propsIn, {
63
+ expandShorthands: true,
64
+ filter: import_text.textParentProps
123
65
  });
124
- var { children, color, disabled, ellipsis, fontFamily, fontSize, fontStyle, fontWeight, icon, iconAfter, iconSize, letterSpacing, maxFontSizeMultiplier, noTextWrap, render, scaleIcon = 1, textAlign, textProps } = processedProps;
125
- var frameProps = { ...propsIn };
126
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
127
- try {
128
- for (var _iterator = buttonInternalPropNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
129
- var key = _step.value;
130
- delete frameProps[key];
131
- }
132
- } catch (err) {
133
- _didIteratorError = true;
134
- _iteratorError = err;
135
- } finally {
136
- try {
137
- if (!_iteratorNormalCompletion && _iterator.return != null) {
138
- _iterator.return();
139
- }
140
- } finally {
141
- if (_didIteratorError) {
142
- throw _iteratorError;
143
- }
144
- }
145
- }
146
- var contextColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
147
- var iconColor = iconColorOption !== null && iconColorOption !== void 0 ? iconColorOption : contextColor;
66
+ var { children, disabled, icon, iconAfter, iconSize, render, scaleIcon = 1, ...frameProps } = buttonProps;
67
+ var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
148
68
  var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;
149
69
  var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
150
- color: typeof iconColor === "string" && iconColor !== "unset" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,
70
+ color: iconColor,
151
71
  size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon
152
72
  });
153
73
  var [themedIcon, themedIconAfter] = [icon, iconAfter].map(function(item) {
154
74
  return item ? getThemedIcon(item) : null;
155
75
  });
156
- var textContext = {
157
- color: contextColor,
158
- ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,
159
- fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,
160
- fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,
161
- fontStyle: fontStyle !== null && fontStyle !== void 0 ? fontStyle : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,
162
- fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,
163
- letterSpacing: letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,
164
- maxFontSizeMultiplier: maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,
165
- textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign
166
- };
167
76
  var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {
168
77
  children,
169
- ...textContext,
170
78
  noTextWrap,
171
79
  textProps
172
80
  }, {
173
81
  ...textPropsOption,
174
- ...processedProps.size === void 0 ? null : { size: processedProps.size }
82
+ ...textStyleProps
175
83
  });
176
- var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" : processedProps.accessibilityRole === "link" || processedProps.role === "link" ? "a" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
84
+ var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
177
85
  type: "button",
178
86
  disabled: true
179
87
  }) : void 0;
180
- var props = {
88
+ var resolvedProps = {
181
89
  ...frameProps,
182
90
  ...disabled && {
183
91
  "aria-disabled": true,
@@ -198,33 +106,17 @@ function useButton(propsIn) {
198
106
  onKeyDown: void 0,
199
107
  onKeyUp: void 0
200
108
  },
201
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
109
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.ButtonNestingContext.Provider, {
202
110
  value: true,
203
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ButtonContext.Provider, {
204
- ...textContext,
205
- children: [
206
- themedIcon,
207
- wrappedChildren,
208
- themedIconAfter
209
- ]
210
- })
111
+ children: [
112
+ themedIcon,
113
+ wrappedChildren,
114
+ themedIconAfter
115
+ ]
211
116
  })
212
117
  };
213
118
  return {
214
119
  isNested,
215
- props
120
+ props: resolvedProps
216
121
  };
217
122
  }
218
- var ButtonComponent = (0, import_web.createStyledHOC)(ButtonFrame, function Button(props, ref) {
219
- var { props: buttonProps } = useButton(props);
220
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {
221
- ref,
222
- ...buttonProps
223
- });
224
- });
225
- var Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
226
- Apply: ButtonContext.Provider,
227
- Frame: ButtonFrame,
228
- Icon: ButtonIcon,
229
- Text: ButtonText
230
- });
@@ -22,8 +22,6 @@ var __copyProps = (to, from, except, desc) => {
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var Button_exports = {};
24
24
  __export(Button_exports, {
25
- Button: () => Button2,
26
- ButtonContext: () => ButtonContext,
27
25
  ButtonFrame: () => ButtonFrame,
28
26
  ButtonIcon: () => ButtonIcon,
29
27
  ButtonText: () => ButtonText,
@@ -36,35 +34,7 @@ var import_stacks = require("@tamagui/stacks");
36
34
  var import_text = require("@tamagui/text");
37
35
  var import_web = require("@tamagui/web");
38
36
  var import_react = require("react");
39
- function _type_of(obj) {
40
- "@swc/helpers - typeof";
41
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
42
- }
43
- var buttonContextKeys = [
44
- "color",
45
- "ellipsis",
46
- "fontFamily",
47
- "fontSize",
48
- "fontStyle",
49
- "fontWeight",
50
- "letterSpacing",
51
- "maxFontSizeMultiplier",
52
- "textAlign"
53
- ];
54
- var ButtonContext = (0, import_web.createStyledContext)({
55
- color: void 0,
56
- ellipsis: void 0,
57
- fontFamily: void 0,
58
- fontSize: void 0,
59
- fontStyle: void 0,
60
- fontWeight: void 0,
61
- letterSpacing: void 0,
62
- maxFontSizeMultiplier: void 0,
63
- textAlign: void 0
64
- }, { keys: buttonContextKeys });
65
37
  var ButtonFrame = (0, import_web.styled)(import_web.View, {
66
- context: ButtonContext,
67
- displayName: "ButtonFrame",
68
38
  role: "button",
69
39
  render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button" }),
70
40
  tabIndex: 0,
@@ -75,109 +45,47 @@ var ButtonFrame = (0, import_web.styled)(import_web.View, {
75
45
  variants: { disabled: { true: { pointerEvents: "none" } } }
76
46
  });
77
47
  var ButtonText = (0, import_web.styled)(import_web.Text, {
78
- context: ButtonContext,
79
- displayName: "ButtonText",
80
48
  flexGrow: 0,
81
49
  flexShrink: 1
82
50
  });
83
- var isOpaqueColor = function(value) {
84
- return (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null && ("dynamic" in value || "semantic" in value || "resource_paths" in value);
85
- };
86
51
  var ButtonIcon = function(param) {
87
52
  var { children, color, scaleIcon = 1, size } = param;
88
- var styledContext = ButtonContext.useStyledContext();
89
- var iconColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
90
53
  var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
91
- color: typeof iconColor === "string" && iconColor !== "unset" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,
54
+ color,
92
55
  size: size === void 0 ? void 0 : size * scaleIcon
93
56
  });
94
57
  return getThemedIcon(children);
95
58
  };
96
- var buttonInternalPropNames = [
97
- "children",
98
- "color",
99
- "disabled",
100
- "ellipsis",
101
- "fontFamily",
102
- "fontSize",
103
- "fontStyle",
104
- "fontWeight",
105
- "icon",
106
- "iconAfter",
107
- "iconSize",
108
- "letterSpacing",
109
- "maxFontSizeMultiplier",
110
- "noTextWrap",
111
- "render",
112
- "scaleIcon",
113
- "textAlign",
114
- "textProps"
115
- ];
116
59
  function useButton(propsIn) {
117
- var { Text: _$Text = ButtonText, iconColor: iconColorOption, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
60
+ var { Text: _$Text = ButtonText, iconColor, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
118
61
  var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
119
- var styledContext = ButtonContext.useStyledContext();
120
- var processedProps = (0, import_web.useProps)(propsIn, {
121
- noNormalize: true,
122
- noExpand: true
62
+ var [wrappedTextProps, buttonProps] = (0, import_web.splitStyleProps)(propsIn, {
63
+ expandShorthands: true,
64
+ filter: import_text.textParentProps
123
65
  });
124
- var { children, color, disabled, ellipsis, fontFamily, fontSize, fontStyle, fontWeight, icon, iconAfter, iconSize, letterSpacing, maxFontSizeMultiplier, noTextWrap, render, scaleIcon = 1, textAlign, textProps } = processedProps;
125
- var frameProps = { ...propsIn };
126
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
127
- try {
128
- for (var _iterator = buttonInternalPropNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
129
- var key = _step.value;
130
- delete frameProps[key];
131
- }
132
- } catch (err) {
133
- _didIteratorError = true;
134
- _iteratorError = err;
135
- } finally {
136
- try {
137
- if (!_iteratorNormalCompletion && _iterator.return != null) {
138
- _iterator.return();
139
- }
140
- } finally {
141
- if (_didIteratorError) {
142
- throw _iteratorError;
143
- }
144
- }
145
- }
146
- var contextColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
147
- var iconColor = iconColorOption !== null && iconColorOption !== void 0 ? iconColorOption : contextColor;
66
+ var { children, disabled, icon, iconAfter, iconSize, render, scaleIcon = 1, ...frameProps } = buttonProps;
67
+ var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
148
68
  var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;
149
69
  var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
150
- color: typeof iconColor === "string" && iconColor !== "unset" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,
70
+ color: iconColor,
151
71
  size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon
152
72
  });
153
73
  var [themedIcon, themedIconAfter] = [icon, iconAfter].map(function(item) {
154
74
  return item ? getThemedIcon(item) : null;
155
75
  });
156
- var textContext = {
157
- color: contextColor,
158
- ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,
159
- fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,
160
- fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,
161
- fontStyle: fontStyle !== null && fontStyle !== void 0 ? fontStyle : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,
162
- fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,
163
- letterSpacing: letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,
164
- maxFontSizeMultiplier: maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,
165
- textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign
166
- };
167
76
  var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {
168
77
  children,
169
- ...textContext,
170
78
  noTextWrap,
171
79
  textProps
172
80
  }, {
173
81
  ...textPropsOption,
174
- ...processedProps.size === void 0 ? null : { size: processedProps.size }
82
+ ...textStyleProps
175
83
  });
176
- var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" : processedProps.accessibilityRole === "link" || processedProps.role === "link" ? "a" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
84
+ var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
177
85
  type: "button",
178
86
  disabled: true
179
87
  }) : void 0;
180
- var props = {
88
+ var resolvedProps = {
181
89
  ...frameProps,
182
90
  ...disabled && {
183
91
  "aria-disabled": true,
@@ -198,35 +106,19 @@ function useButton(propsIn) {
198
106
  onKeyDown: void 0,
199
107
  onKeyUp: void 0
200
108
  },
201
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
109
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.ButtonNestingContext.Provider, {
202
110
  value: true,
203
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ButtonContext.Provider, {
204
- ...textContext,
205
- children: [
206
- themedIcon,
207
- wrappedChildren,
208
- themedIconAfter
209
- ]
210
- })
111
+ children: [
112
+ themedIcon,
113
+ wrappedChildren,
114
+ themedIconAfter
115
+ ]
211
116
  })
212
117
  };
213
118
  return {
214
119
  isNested,
215
- props
120
+ props: resolvedProps
216
121
  };
217
122
  }
218
- var ButtonComponent = (0, import_web.createStyledHOC)(ButtonFrame, function Button(props, ref) {
219
- var { props: buttonProps } = useButton(props);
220
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {
221
- ref,
222
- ...buttonProps
223
- });
224
- });
225
- var Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
226
- Apply: ButtonContext.Provider,
227
- Frame: ButtonFrame,
228
- Icon: ButtonIcon,
229
- Text: ButtonText
230
- });
231
123
 
232
124
  //# sourceMappingURL=Button.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.native.js","names":[],"sources":["cjs/Button.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Button_exports = {};\n__export(Button_exports, {\n Button: () => Button2,\n ButtonContext: () => ButtonContext,\n ButtonFrame: () => ButtonFrame,\n ButtonIcon: () => ButtonIcon,\n ButtonText: () => ButtonText,\n useButton: () => useButton\n});\nmodule.exports = __toCommonJS(Button_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar import_react = require(\"react\");\nfunction _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar buttonContextKeys = [\n \"color\",\n \"ellipsis\",\n \"fontFamily\",\n \"fontSize\",\n \"fontStyle\",\n \"fontWeight\",\n \"letterSpacing\",\n \"maxFontSizeMultiplier\",\n \"textAlign\"\n];\nvar ButtonContext = (0, import_web.createStyledContext)({\n color: void 0,\n ellipsis: void 0,\n fontFamily: void 0,\n fontSize: void 0,\n fontStyle: void 0,\n fontWeight: void 0,\n letterSpacing: void 0,\n maxFontSizeMultiplier: void 0,\n textAlign: void 0\n}, {\n keys: buttonContextKeys\n});\nvar ButtonFrame = (0, import_web.styled)(import_web.View, {\n context: ButtonContext,\n displayName: \"ButtonFrame\",\n role: \"button\",\n render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\"\n }),\n tabIndex: 0,\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"nowrap\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ButtonText = (0, import_web.styled)(import_web.Text, {\n context: ButtonContext,\n displayName: \"ButtonText\",\n // flexGrow 1 pushes text to the start of its parent on native\n flexGrow: 0,\n flexShrink: 1\n});\nvar isOpaqueColor = function(value) {\n return (typeof value === \"undefined\" ? \"undefined\" : _type_of(value)) === \"object\" && value !== null && (\"dynamic\" in value || \"semantic\" in value || \"resource_paths\" in value);\n};\nvar ButtonIcon = function(param) {\n var { children, color, scaleIcon = 1, size } = param;\n var styledContext = ButtonContext.useStyledContext();\n var iconColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n // icons take one concrete color: conditional values (numbers, flat\n // objects) fall back to the theme color\n color: typeof iconColor === \"string\" && iconColor !== \"unset\" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,\n size: size === void 0 ? void 0 : size * scaleIcon\n });\n return getThemedIcon(children);\n};\nvar buttonInternalPropNames = [\n \"children\",\n \"color\",\n \"disabled\",\n \"ellipsis\",\n \"fontFamily\",\n \"fontSize\",\n \"fontStyle\",\n \"fontWeight\",\n \"icon\",\n \"iconAfter\",\n \"iconSize\",\n \"letterSpacing\",\n \"maxFontSizeMultiplier\",\n \"noTextWrap\",\n \"render\",\n \"scaleIcon\",\n \"textAlign\",\n \"textProps\"\n];\nfunction useButton(propsIn) {\n var { Text: _$Text = ButtonText, iconColor: iconColorOption, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);\n var styledContext = ButtonContext.useStyledContext();\n var processedProps = (0, import_web.useProps)(propsIn, {\n noNormalize: true,\n noExpand: true\n });\n var { children, color, disabled, ellipsis, fontFamily, fontSize, fontStyle, fontWeight, icon, iconAfter, iconSize, letterSpacing, maxFontSizeMultiplier, noTextWrap, render, scaleIcon = 1, textAlign, textProps } = processedProps;\n var frameProps = {\n ...propsIn\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = buttonInternalPropNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n delete frameProps[key];\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var contextColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;\n var iconColor = iconColorOption !== null && iconColorOption !== void 0 ? iconColorOption : contextColor;\n var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n // icons take one concrete color: conditional values (numbers, flat\n // objects) fall back to the theme color\n color: typeof iconColor === \"string\" && iconColor !== \"unset\" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,\n size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon\n });\n var [themedIcon, themedIconAfter] = [\n icon,\n iconAfter\n ].map(function(item) {\n return item ? getThemedIcon(item) : null;\n });\n var textContext = {\n color: contextColor,\n ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,\n fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,\n fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,\n fontStyle: fontStyle !== null && fontStyle !== void 0 ? fontStyle : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,\n fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,\n letterSpacing: letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,\n maxFontSizeMultiplier: maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,\n textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign\n };\n var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {\n children,\n ...textContext,\n noTextWrap,\n textProps\n }, {\n ...textPropsOption,\n ...processedProps.size === void 0 ? null : {\n size: processedProps.size\n }\n });\n var resolvedRender = render !== null && render !== void 0 ? render : isNested ? \"span\" : processedProps.accessibilityRole === \"link\" || processedProps.role === \"link\" ? \"a\" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\",\n disabled: true\n }) : void 0;\n var props = {\n ...frameProps,\n ...disabled && {\n \"aria-disabled\": true,\n disabled: true,\n tabIndex: -1\n },\n ...resolvedRender === void 0 ? null : {\n render: resolvedRender\n },\n ...isNested && {\n // a nested Button is a presentation part, not a control: strip the\n // interactive semantics so we never place a focusable role=button (with\n // its own press/keyboard handlers) inside the outer native <button>. that\n // nesting is invalid html, adds an extra focus stop, and bubbles\n // activation to the outer control. resolvedRender already makes it a span.\n role: \"none\",\n tabIndex: -1,\n \"aria-disabled\": void 0,\n disabled: void 0,\n onPress: void 0,\n onPressIn: void 0,\n onPressOut: void 0,\n onLongPress: void 0,\n onClick: void 0,\n onKeyDown: void 0,\n onKeyUp: void 0\n },\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {\n value: true,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ButtonContext.Provider, {\n ...textContext,\n children: [\n themedIcon,\n wrappedChildren,\n themedIconAfter\n ]\n })\n })\n };\n return {\n isNested,\n props\n };\n}\nvar ButtonComponent = (0, import_web.createStyledHOC)(ButtonFrame, function Button(props, ref) {\n var { props: buttonProps } = useButton(props);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {\n ref,\n ...buttonProps\n });\n});\nvar Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {\n Apply: ButtonContext.Provider,\n Frame: ButtonFrame,\n Icon: ButtonIcon,\n Text: ButtonText\n});\n//# sourceMappingURL=Button.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,iBAAiB,CAAC;AACtB,SAAS,gBAAgB;CACvB,c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,WAAW,KAAK;GAChB,YAAY,KAAK;GACjB,aAAa,KAAK;GAClB,SAAS,KAAK;GACd,WAAW,KAAK;GAChB,SAAS,KAAK;EAChB;EACA,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,cAAc,qBAAqB,UAAU;GACjG,OAAO;GACP,UAA0B,iBAAC,GAAG,mBAAmB,KAAI,CAAE,cAAc,UAAU;IAC7E,GAAG;IACH,UAAU;KACR;KACA;KACA;IACF;GACF,CAAC;EACH,CAAC;CACH;CACA,OAAO;EACL;EACA;CACF;AACF;AACA,IAAI,mBAAmB,GAAG,WAAW,gBAAe,CAAE,aAAa,SAAS,OAAO,OAAO,KAAK;CAC7F,IAAI,EAAE,OAAO,gBAAgB,UAAU,KAAK;CAC5C,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa;EAC9D;EACA,GAAG;CACL,CAAC;AACH,CAAC;AACD,IAAI,WAAW,GAAG,WAAW,qBAAoB,CAAE,iBAAiB;CAClE,OAAO,cAAc;CACrB,OAAO;CACP,MAAM;CACN,MAAM;AACR,CAAC"}
1
+ {"version":3,"file":"Button.native.js","names":[],"sources":["cjs/Button.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Button_exports = {};\n__export(Button_exports, {\n ButtonFrame: () => ButtonFrame,\n ButtonIcon: () => ButtonIcon,\n ButtonText: () => ButtonText,\n useButton: () => useButton\n});\nmodule.exports = __toCommonJS(Button_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar import_react = require(\"react\");\nvar ButtonFrame = (0, import_web.styled)(import_web.View, {\n // role is the cross-platform one; render only lands on web\n role: \"button\",\n render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\"\n }),\n tabIndex: 0,\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"nowrap\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ButtonText = (0, import_web.styled)(import_web.Text, {\n // flexGrow 1 pushes text to the start of its parent on native\n flexGrow: 0,\n flexShrink: 1\n});\nvar ButtonIcon = function(param) {\n var { children, color, scaleIcon = 1, size } = param;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n color,\n size: size === void 0 ? void 0 : size * scaleIcon\n });\n return getThemedIcon(children);\n};\nfunction useButton(propsIn) {\n var { Text: _$Text = ButtonText, iconColor, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);\n var [wrappedTextProps, buttonProps] = (0, import_web.splitStyleProps)(propsIn, {\n expandShorthands: true,\n filter: import_text.textParentProps\n });\n var { children, disabled, icon, iconAfter, iconSize, render, scaleIcon = 1, ...frameProps } = buttonProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n color: iconColor,\n size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon\n });\n var [themedIcon, themedIconAfter] = [\n icon,\n iconAfter\n ].map(function(item) {\n return item ? getThemedIcon(item) : null;\n });\n var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {\n children,\n noTextWrap,\n textProps\n }, {\n ...textPropsOption,\n ...textStyleProps\n });\n var resolvedRender = render !== null && render !== void 0 ? render : isNested ? \"span\" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\",\n disabled: true\n }) : void 0;\n var resolvedProps = {\n ...frameProps,\n ...disabled && {\n \"aria-disabled\": true,\n disabled: true,\n tabIndex: -1\n },\n ...resolvedRender === void 0 ? null : {\n render: resolvedRender\n },\n ...isNested && {\n // a nested Button is a presentation part, not a control: strip the\n // interactive semantics so we never place a focusable role=button (with\n // its own press/keyboard handlers) inside the outer native <button>. that\n // nesting is invalid html, adds an extra focus stop, and bubbles\n // activation to the outer control. resolvedRender already makes it a span.\n role: \"none\",\n tabIndex: -1,\n \"aria-disabled\": void 0,\n disabled: void 0,\n onPress: void 0,\n onPressIn: void 0,\n onPressOut: void 0,\n onLongPress: void 0,\n onClick: void 0,\n onKeyDown: void 0,\n onKeyUp: void 0\n },\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.ButtonNestingContext.Provider, {\n value: true,\n children: [\n themedIcon,\n wrappedChildren,\n themedIconAfter\n ]\n })\n };\n return {\n isNested,\n props: resolvedProps\n };\n}\n//# sourceMappingURL=Button.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAA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