@tamagui/button 2.0.0-rc.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/cjs/Button.cjs +247 -174
  2. package/dist/cjs/Button.native.js +252 -177
  3. package/dist/cjs/Button.native.js.map +1 -1
  4. package/dist/cjs/Button.test.cjs +33 -5
  5. package/dist/cjs/Button.test.native.js +34 -6
  6. package/dist/cjs/Button.test.native.js.map +1 -1
  7. package/dist/cjs/index.cjs +7 -5
  8. package/dist/cjs/index.native.js +7 -5
  9. package/dist/cjs/index.native.js.map +1 -1
  10. package/dist/cjs/v1/Button.cjs +221 -212
  11. package/dist/cjs/v1/Button.native.js +223 -215
  12. package/dist/cjs/v1/Button.native.js.map +1 -1
  13. package/dist/cjs/v1/Button.test.cjs +5 -5
  14. package/dist/cjs/v1/Button.test.native.js +6 -6
  15. package/dist/cjs/v1/Button.test.native.js.map +1 -1
  16. package/dist/cjs/v1/index.cjs +7 -5
  17. package/dist/cjs/v1/index.native.js +7 -5
  18. package/dist/cjs/v1/index.native.js.map +1 -1
  19. package/dist/esm/Button.mjs +227 -156
  20. package/dist/esm/Button.mjs.map +1 -1
  21. package/dist/esm/Button.native.js +232 -159
  22. package/dist/esm/Button.native.js.map +1 -1
  23. package/dist/esm/Button.test.mjs +30 -2
  24. package/dist/esm/Button.test.mjs.map +1 -1
  25. package/dist/esm/Button.test.native.js +30 -2
  26. package/dist/esm/Button.test.native.js.map +1 -1
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/index.js.map +1 -6
  29. package/dist/esm/v1/Button.mjs +199 -192
  30. package/dist/esm/v1/Button.mjs.map +1 -1
  31. package/dist/esm/v1/Button.native.js +200 -194
  32. package/dist/esm/v1/Button.native.js.map +1 -1
  33. package/dist/esm/v1/Button.test.mjs +2 -2
  34. package/dist/esm/v1/Button.test.mjs.map +1 -1
  35. package/dist/esm/v1/Button.test.native.js +2 -2
  36. package/dist/esm/v1/Button.test.native.js.map +1 -1
  37. package/dist/jsx/Button.mjs +227 -156
  38. package/dist/jsx/Button.mjs.map +1 -1
  39. package/dist/jsx/Button.native.js +252 -177
  40. package/dist/jsx/Button.native.js.map +1 -1
  41. package/dist/jsx/Button.test.mjs +30 -2
  42. package/dist/jsx/Button.test.mjs.map +1 -1
  43. package/dist/jsx/Button.test.native.js +34 -6
  44. package/dist/jsx/Button.test.native.js.map +1 -1
  45. package/dist/jsx/index.js +1 -1
  46. package/dist/jsx/index.js.map +1 -6
  47. package/dist/jsx/index.native.js +7 -5
  48. package/dist/jsx/v1/Button.mjs +199 -192
  49. package/dist/jsx/v1/Button.mjs.map +1 -1
  50. package/dist/jsx/v1/Button.native.js +223 -215
  51. package/dist/jsx/v1/Button.native.js.map +1 -1
  52. package/dist/jsx/v1/Button.test.mjs +2 -2
  53. package/dist/jsx/v1/Button.test.mjs.map +1 -1
  54. package/dist/jsx/v1/Button.test.native.js +6 -6
  55. package/dist/jsx/v1/Button.test.native.js.map +1 -1
  56. package/dist/jsx/v1/index.native.js +7 -5
  57. package/package.json +14 -13
  58. package/src/Button.test.tsx +24 -0
  59. package/src/Button.tsx +129 -25
  60. package/src/v1/Button.tsx +6 -0
  61. package/types/Button.d.ts +148 -39
  62. package/types/Button.d.ts.map +1 -1
  63. package/types/v1/Button.d.ts +21 -21
  64. package/types/v1/Button.d.ts.map +1 -1
  65. package/dist/cjs/Button.js +0 -176
  66. package/dist/cjs/Button.js.map +0 -6
  67. package/dist/cjs/Button.test.js +0 -8
  68. package/dist/cjs/Button.test.js.map +0 -6
  69. package/dist/cjs/index.js +0 -15
  70. package/dist/cjs/index.js.map +0 -6
  71. package/dist/cjs/v1/Button.js +0 -208
  72. package/dist/cjs/v1/Button.js.map +0 -6
  73. package/dist/cjs/v1/Button.test.js +0 -8
  74. package/dist/cjs/v1/Button.test.js.map +0 -6
  75. package/dist/cjs/v1/index.js +0 -15
  76. package/dist/cjs/v1/index.js.map +0 -6
  77. package/dist/esm/Button.js +0 -174
  78. package/dist/esm/Button.js.map +0 -6
  79. package/dist/esm/Button.test.js +0 -10
  80. package/dist/esm/Button.test.js.map +0 -6
  81. package/dist/esm/v1/Button.js +0 -201
  82. package/dist/esm/v1/Button.js.map +0 -6
  83. package/dist/esm/v1/Button.test.js +0 -10
  84. package/dist/esm/v1/Button.test.js.map +0 -6
  85. package/dist/esm/v1/index.js +0 -2
  86. package/dist/esm/v1/index.js.map +0 -6
  87. package/dist/jsx/Button.js +0 -174
  88. package/dist/jsx/Button.js.map +0 -6
  89. package/dist/jsx/Button.test.js +0 -10
  90. package/dist/jsx/Button.test.js.map +0 -6
  91. package/dist/jsx/v1/Button.js +0 -201
  92. package/dist/jsx/v1/Button.js.map +0 -6
  93. package/dist/jsx/v1/Button.test.js +0 -10
  94. package/dist/jsx/v1/Button.test.js.map +0 -6
  95. package/dist/jsx/v1/index.js +0 -2
  96. package/dist/jsx/v1/index.js.map +0 -6
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
10
  get: () => from[key],
10
11
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
12
  });
12
- return to;
13
- },
14
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
17
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: !0
18
+ value: true
17
19
  }), mod);
18
20
  var index_exports = {};
19
21
  module.exports = __toCommonJS(index_exports);
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var Button_exports = {};
22
24
  __export(Button_exports, {
@@ -28,140 +30,147 @@ __export(Button_exports, {
28
30
  useButton: () => useButton
29
31
  });
30
32
  module.exports = __toCommonJS(Button_exports);
31
- var import_font_size = require("@tamagui/font-size"),
32
- import_get_button_sized = require("@tamagui/get-button-sized"),
33
- import_helpers = require("@tamagui/helpers"),
34
- import_helpers_tamagui = require("@tamagui/helpers-tamagui"),
35
- import_stacks = require("@tamagui/stacks"),
36
- import_text = require("@tamagui/text"),
37
- import_web = require("@tamagui/web"),
38
- import_react = require("react"),
39
- import_spacer = require("@tamagui/spacer"),
40
- import_jsx_runtime = require("react/jsx-runtime");
33
+ var import_font_size = require("@tamagui/font-size");
34
+ var import_get_button_sized = require("@tamagui/get-button-sized");
35
+ var import_helpers = require("@tamagui/helpers");
36
+ var import_helpers_tamagui = require("@tamagui/helpers-tamagui");
37
+ var import_stacks = require("@tamagui/stacks");
38
+ var import_text = require("@tamagui/text");
39
+ var import_web = require("@tamagui/web");
40
+ var import_react = require("react");
41
+ var import_spacer = require("@tamagui/spacer");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
41
43
  const ButtonContext = (0, import_web.createStyledContext)({
42
- // keeping these here means they work with styled() passing down color to text
43
- color: void 0,
44
- ellipsis: void 0,
45
- fontFamily: void 0,
46
- fontSize: void 0,
47
- fontStyle: void 0,
48
- fontWeight: void 0,
49
- letterSpacing: void 0,
50
- maxFontSizeMultiplier: void 0,
51
- size: void 0,
52
- textAlign: void 0,
53
- variant: void 0
54
- }),
55
- BUTTON_NAME = "Button",
56
- ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
57
- name: BUTTON_NAME,
58
- render: "button",
59
- context: ButtonContext,
60
- role: "button",
61
- focusable: !0,
62
- variants: {
63
- unstyled: {
64
- false: {
65
- size: "$true",
66
- justifyContent: "center",
67
- alignItems: "center",
68
- flexWrap: "nowrap",
69
- flexDirection: "row",
70
- cursor: "pointer",
71
- hoverTheme: !0,
72
- pressTheme: !0,
73
- backgroundColor: "$background",
74
- borderWidth: 1,
75
- borderColor: "transparent",
76
- focusVisibleStyle: {
77
- outlineColor: "$outlineColor",
78
- outlineStyle: "solid",
79
- outlineWidth: 2
80
- }
81
- }
82
- },
83
- variant: {
84
- outlined: {
85
- backgroundColor: "transparent",
86
- borderWidth: 2,
87
- borderColor: "$borderColor",
88
- hoverStyle: {
89
- backgroundColor: "transparent",
90
- borderColor: "$borderColorHover"
91
- },
92
- pressStyle: {
93
- backgroundColor: "transparent",
94
- borderColor: "$borderColorPress"
95
- },
96
- focusVisibleStyle: {
97
- backgroundColor: "transparent",
98
- borderColor: "$borderColorFocus"
99
- }
100
- }
101
- },
102
- size: {
103
- "...size": import_get_button_sized.getButtonSized,
104
- ":number": import_get_button_sized.getButtonSized
44
+ // keeping these here means they work with styled() passing down color to text
45
+ color: void 0,
46
+ ellipsis: void 0,
47
+ fontFamily: void 0,
48
+ fontSize: void 0,
49
+ fontStyle: void 0,
50
+ fontWeight: void 0,
51
+ letterSpacing: void 0,
52
+ maxFontSizeMultiplier: void 0,
53
+ size: void 0,
54
+ textAlign: void 0,
55
+ variant: void 0
56
+ });
57
+ const BUTTON_NAME = "Button";
58
+ const ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
59
+ name: BUTTON_NAME,
60
+ render: "button",
61
+ context: ButtonContext,
62
+ role: "button",
63
+ focusable: true,
64
+ variants: {
65
+ unstyled: {
66
+ true: {
67
+ // reset browser <button> defaults
68
+ outlineWidth: 0,
69
+ borderWidth: 0,
70
+ backgroundColor: "transparent"
105
71
  },
106
- disabled: {
107
- true: {
108
- pointerEvents: "none"
72
+ false: {
73
+ size: "$true",
74
+ justifyContent: "center",
75
+ alignItems: "center",
76
+ flexWrap: "nowrap",
77
+ flexDirection: "row",
78
+ cursor: "pointer",
79
+ hoverTheme: true,
80
+ pressTheme: true,
81
+ backgroundColor: "$background",
82
+ borderWidth: 1,
83
+ borderColor: "transparent",
84
+ focusVisibleStyle: {
85
+ outlineColor: "$outlineColor",
86
+ outlineStyle: "solid",
87
+ outlineWidth: 2
109
88
  }
110
89
  }
111
90
  },
112
- defaultVariants: {
113
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
114
- }
115
- }),
116
- ButtonText = (0, import_web.styled)(import_text.SizableText, {
117
- name: "Button",
118
- context: ButtonContext,
119
- variants: {
120
- unstyled: {
121
- false: {
122
- userSelect: "none",
123
- cursor: "pointer",
124
- // flexGrow 1 leads to inconsistent native style where text pushes to start of view
125
- flexGrow: 0,
126
- flexShrink: 1,
127
- ellipsis: !0,
128
- color: "$color"
91
+ variant: {
92
+ outlined: {
93
+ backgroundColor: "transparent",
94
+ borderWidth: 2,
95
+ borderColor: "$borderColor",
96
+ hoverStyle: {
97
+ backgroundColor: "transparent",
98
+ borderColor: "$borderColorHover"
99
+ },
100
+ pressStyle: {
101
+ backgroundColor: "transparent",
102
+ borderColor: "$borderColorPress"
103
+ },
104
+ focusVisibleStyle: {
105
+ backgroundColor: "transparent",
106
+ borderColor: "$borderColorFocus"
129
107
  }
130
108
  }
131
109
  },
132
- defaultVariants: {
133
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
110
+ size: {
111
+ "...size": import_get_button_sized.getButtonSized,
112
+ ":number": import_get_button_sized.getButtonSized
113
+ },
114
+ disabled: {
115
+ true: {
116
+ pointerEvents: "none"
117
+ }
134
118
  }
135
- }),
136
- ButtonIcon = props => {
137
- const {
138
- children,
139
- scaleIcon = 1
140
- } = props,
141
- {
142
- size,
143
- color
144
- } = (0, import_react.useContext)(ButtonContext),
145
- iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon;
146
- return (0, import_helpers_tamagui.useGetThemedIcon)({
147
- size: iconSize,
148
- color
149
- })(children);
150
119
  },
151
- ButtonComponent = ButtonFrame.styleable(function (props, ref) {
152
- const {
153
- props: buttonProps
154
- } = useButton(props);
155
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ButtonFrame, {
156
- "data-disable-theme": !0,
157
- ...buttonProps,
158
- ref
159
- });
160
- }),
161
- Button2 = (0, import_helpers.withStaticProperties)(ButtonComponent, {
162
- Text: ButtonText,
163
- Icon: ButtonIcon
120
+ defaultVariants: {
121
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
122
+ }
123
+ });
124
+ const ButtonText = (0, import_web.styled)(import_text.SizableText, {
125
+ name: "Button",
126
+ context: ButtonContext,
127
+ variants: {
128
+ unstyled: {
129
+ false: {
130
+ userSelect: "none",
131
+ cursor: "pointer",
132
+ // flexGrow 1 leads to inconsistent native style where text pushes to start of view
133
+ flexGrow: 0,
134
+ flexShrink: 1,
135
+ ellipsis: true,
136
+ color: "$color"
137
+ }
138
+ }
139
+ },
140
+ defaultVariants: {
141
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
142
+ }
143
+ });
144
+ const ButtonIcon = props => {
145
+ const {
146
+ children,
147
+ scaleIcon = 1
148
+ } = props;
149
+ const {
150
+ size,
151
+ color
152
+ } = (0, import_react.useContext)(ButtonContext);
153
+ const iconSize = (typeof size === "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon;
154
+ const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
155
+ size: iconSize,
156
+ color
157
+ });
158
+ return getThemedIcon(children);
159
+ };
160
+ const ButtonComponent = ButtonFrame.styleable(function Button(props, ref) {
161
+ const {
162
+ props: buttonProps
163
+ } = useButton(props);
164
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ButtonFrame, {
165
+ "data-disable-theme": true,
166
+ ...buttonProps,
167
+ ref
164
168
  });
169
+ });
170
+ const Button2 = (0, import_helpers.withStaticProperties)(ButtonComponent, {
171
+ Text: ButtonText,
172
+ Icon: ButtonIcon
173
+ });
165
174
  function useButton({
166
175
  textProps,
167
176
  ...propsIn
@@ -170,87 +179,87 @@ function useButton({
170
179
  } = {
171
180
  Text: Button2.Text
172
181
  }) {
173
- const isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext),
174
- propsActive = (0, import_web.useProps)(propsIn, {
175
- noNormalize: !0,
176
- noExpand: !0
177
- }),
178
- {
179
- icon,
180
- iconAfter,
181
- gap,
182
- spaceFlex,
183
- scaleIcon = 1,
184
- scaleSpace = 0.66,
185
- noTextWrap,
186
- fontFamily,
187
- fontSize,
188
- fontWeight,
189
- fontStyle,
190
- letterSpacing,
191
- render,
192
- ellipsis,
193
- maxFontSizeMultiplier,
194
- ...restProps
195
- } = propsActive,
196
- size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"),
197
- color = propsActive.color,
198
- iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
199
- font: fontFamily?.[0] === "$" ? fontFamily : void 0
200
- })) * scaleIcon,
201
- getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
202
- size: iconSize,
203
- color
182
+ const isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
183
+ const propsActive = (0, import_web.useProps)(propsIn, {
184
+ noNormalize: true,
185
+ noExpand: true
186
+ });
187
+ const {
188
+ icon,
189
+ iconAfter,
190
+ gap,
191
+ spaceFlex,
192
+ scaleIcon = 1,
193
+ scaleSpace = 0.66,
194
+ noTextWrap,
195
+ fontFamily,
196
+ fontSize,
197
+ fontWeight,
198
+ fontStyle,
199
+ letterSpacing,
200
+ render,
201
+ ellipsis,
202
+ maxFontSizeMultiplier,
203
+ ...restProps
204
+ } = propsActive;
205
+ const size = propsActive.size || (propsActive.unstyled ? void 0 : "$true");
206
+ const color = propsActive.color;
207
+ const iconSize = (typeof size === "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
208
+ font: fontFamily?.[0] === "$" ? fontFamily : void 0
209
+ })) * scaleIcon;
210
+ const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
211
+ size: iconSize,
212
+ color
213
+ });
214
+ const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
215
+ const spaceSize = gap ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace;
216
+ const contents = noTextWrap ? [propsIn.children] : (0, import_text.wrapChildrenInText)(Text, {
217
+ children: propsIn.children,
218
+ fontFamily,
219
+ fontSize,
220
+ textProps,
221
+ fontWeight,
222
+ fontStyle,
223
+ letterSpacing,
224
+ ellipsis,
225
+ maxFontSizeMultiplier
226
+ }, Text === ButtonText && propsActive.unstyled !== true ? {
227
+ unstyled: process.env.TAMAGUI_HEADLESS === "1",
228
+ size
229
+ } : void 0);
230
+ const inner = (0, import_spacer.spacedChildren)({
231
+ // a bit arbitrary but scaling to font size is necessary so long as button does
232
+ space: spaceSize,
233
+ spaceFlex,
234
+ ensureKeys: true,
235
+ direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
236
+ // for keys to stay the same we keep indices as similar a possible
237
+ // so even if icons are undefined we still pass them
238
+ children: [themedIcon, ...contents, themedIconAfter]
239
+ });
240
+ const props = {
241
+ size,
242
+ ...(propsIn.disabled && {
243
+ // in rnw - false still has keyboard tabIndex, undefined = not actually focusable
244
+ focusable: void 0,
245
+ // even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
246
+ focusVisibleStyle: {
247
+ borderColor: "$background"
248
+ }
204
249
  }),
205
- [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon),
206
- spaceSize = gap ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace,
207
- contents = noTextWrap ? [propsIn.children] : (0, import_text.wrapChildrenInText)(Text, {
208
- children: propsIn.children,
209
- fontFamily,
210
- fontSize,
211
- textProps,
212
- fontWeight,
213
- fontStyle,
214
- letterSpacing,
215
- ellipsis,
216
- maxFontSizeMultiplier
217
- }, Text === ButtonText && propsActive.unstyled !== !0 ? {
218
- unstyled: process.env.TAMAGUI_HEADLESS === "1",
219
- size
220
- } : void 0),
221
- inner = (0, import_spacer.spacedChildren)({
222
- // a bit arbitrary but scaling to font size is necessary so long as button does
223
- space: spaceSize,
224
- spaceFlex,
225
- ensureKeys: !0,
226
- direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
227
- // for keys to stay the same we keep indices as similar a possible
228
- // so even if icons are undefined we still pass them
229
- children: [themedIcon, ...contents, themedIconAfter]
250
+ // fixes SSR issue + DOM nesting issue of not allowing button in button
251
+ render: render ?? (isNested ? "span" :
252
+ // defaults to <a /> when accessibilityRole = link
253
+ // see https://github.com/tamagui/tamagui/issues/505
254
+ propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"),
255
+ ...restProps,
256
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
257
+ value: true,
258
+ children: inner
230
259
  }),
231
- props = {
232
- size,
233
- ...(propsIn.disabled && {
234
- // in rnw - false still has keyboard tabIndex, undefined = not actually focusable
235
- focusable: void 0,
236
- // even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
237
- focusVisibleStyle: {
238
- borderColor: "$background"
239
- }
240
- }),
241
- // fixes SSR issue + DOM nesting issue of not allowing button in button
242
- render: render ?? (isNested ? "span" :
243
- // defaults to <a /> when accessibilityRole = link
244
- // see https://github.com/tamagui/tamagui/issues/505
245
- propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"),
246
- ...restProps,
247
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
248
- value: !0,
249
- children: inner
250
- }),
251
- // forces it to be a runtime pressStyle so it passes through context text colors
252
- disableClassName: !0
253
- };
260
+ // forces it to be a runtime pressStyle so it passes through context text colors
261
+ disableClassName: true
262
+ };
254
263
  return {
255
264
  spaceSize,
256
265
  isNested,