@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.
- package/dist/cjs/Button.cjs +247 -174
- package/dist/cjs/Button.native.js +252 -177
- package/dist/cjs/Button.native.js.map +1 -1
- package/dist/cjs/Button.test.cjs +33 -5
- package/dist/cjs/Button.test.native.js +34 -6
- package/dist/cjs/Button.test.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/v1/Button.cjs +221 -212
- package/dist/cjs/v1/Button.native.js +223 -215
- package/dist/cjs/v1/Button.native.js.map +1 -1
- package/dist/cjs/v1/Button.test.cjs +5 -5
- package/dist/cjs/v1/Button.test.native.js +6 -6
- package/dist/cjs/v1/Button.test.native.js.map +1 -1
- package/dist/cjs/v1/index.cjs +7 -5
- package/dist/cjs/v1/index.native.js +7 -5
- package/dist/cjs/v1/index.native.js.map +1 -1
- package/dist/esm/Button.mjs +227 -156
- package/dist/esm/Button.mjs.map +1 -1
- package/dist/esm/Button.native.js +232 -159
- package/dist/esm/Button.native.js.map +1 -1
- package/dist/esm/Button.test.mjs +30 -2
- package/dist/esm/Button.test.mjs.map +1 -1
- package/dist/esm/Button.test.native.js +30 -2
- package/dist/esm/Button.test.native.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/v1/Button.mjs +199 -192
- package/dist/esm/v1/Button.mjs.map +1 -1
- package/dist/esm/v1/Button.native.js +200 -194
- package/dist/esm/v1/Button.native.js.map +1 -1
- package/dist/esm/v1/Button.test.mjs +2 -2
- package/dist/esm/v1/Button.test.mjs.map +1 -1
- package/dist/esm/v1/Button.test.native.js +2 -2
- package/dist/esm/v1/Button.test.native.js.map +1 -1
- package/dist/jsx/Button.mjs +227 -156
- package/dist/jsx/Button.mjs.map +1 -1
- package/dist/jsx/Button.native.js +252 -177
- package/dist/jsx/Button.native.js.map +1 -1
- package/dist/jsx/Button.test.mjs +30 -2
- package/dist/jsx/Button.test.mjs.map +1 -1
- package/dist/jsx/Button.test.native.js +34 -6
- package/dist/jsx/Button.test.native.js.map +1 -1
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/v1/Button.mjs +199 -192
- package/dist/jsx/v1/Button.mjs.map +1 -1
- package/dist/jsx/v1/Button.native.js +223 -215
- package/dist/jsx/v1/Button.native.js.map +1 -1
- package/dist/jsx/v1/Button.test.mjs +2 -2
- package/dist/jsx/v1/Button.test.mjs.map +1 -1
- package/dist/jsx/v1/Button.test.native.js +6 -6
- package/dist/jsx/v1/Button.test.native.js.map +1 -1
- package/dist/jsx/v1/index.native.js +7 -5
- package/package.json +14 -13
- package/src/Button.test.tsx +24 -0
- package/src/Button.tsx +129 -25
- package/src/v1/Button.tsx +6 -0
- package/types/Button.d.ts +148 -39
- package/types/Button.d.ts.map +1 -1
- package/types/v1/Button.d.ts +21 -21
- package/types/v1/Button.d.ts.map +1 -1
- package/dist/cjs/Button.js +0 -176
- package/dist/cjs/Button.js.map +0 -6
- package/dist/cjs/Button.test.js +0 -8
- package/dist/cjs/Button.test.js.map +0 -6
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/v1/Button.js +0 -208
- package/dist/cjs/v1/Button.js.map +0 -6
- package/dist/cjs/v1/Button.test.js +0 -8
- package/dist/cjs/v1/Button.test.js.map +0 -6
- package/dist/cjs/v1/index.js +0 -15
- package/dist/cjs/v1/index.js.map +0 -6
- package/dist/esm/Button.js +0 -174
- package/dist/esm/Button.js.map +0 -6
- package/dist/esm/Button.test.js +0 -10
- package/dist/esm/Button.test.js.map +0 -6
- package/dist/esm/v1/Button.js +0 -201
- package/dist/esm/v1/Button.js.map +0 -6
- package/dist/esm/v1/Button.test.js +0 -10
- package/dist/esm/v1/Button.test.js.map +0 -6
- package/dist/esm/v1/index.js +0 -2
- package/dist/esm/v1/index.js.map +0 -6
- package/dist/jsx/Button.js +0 -174
- package/dist/jsx/Button.js.map +0 -6
- package/dist/jsx/Button.test.js +0 -10
- package/dist/jsx/Button.test.js.map +0 -6
- package/dist/jsx/v1/Button.js +0 -201
- package/dist/jsx/v1/Button.js.map +0 -6
- package/dist/jsx/v1/Button.test.js +0 -10
- package/dist/jsx/v1/Button.test.js.map +0 -6
- package/dist/jsx/v1/index.js +0 -2
- package/dist/jsx/v1/index.js.map +0 -6
package/dist/cjs/index.native.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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:
|
|
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":"
|
|
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":[]}
|
package/dist/cjs/v1/Button.cjs
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
133
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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,
|