@tamagui/button 1.135.4-1761749240853 → 1.135.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.
- package/dist/cjs/Button.native.js +181 -231
- package/dist/cjs/Button.native.js.map +6 -1
- package/dist/cjs/Button.test.native.js +4 -8
- package/dist/cjs/Button.test.native.js.map +6 -1
- package/dist/cjs/index.native.js +12 -13
- package/dist/cjs/index.native.js.map +6 -1
- package/dist/jsx/Button.native.js +180 -247
- package/dist/jsx/Button.native.js.map +6 -1
- package/dist/jsx/Button.test.native.js +8 -10
- package/dist/jsx/Button.test.native.js.map +6 -1
- package/dist/jsx/index.native.js +2 -21
- package/dist/jsx/index.native.js.map +6 -1
- package/package.json +12 -13
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: !0
|
|
22
|
-
}), mod);
|
|
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);
|
|
23
16
|
var Button_exports = {};
|
|
24
17
|
__export(Button_exports, {
|
|
25
18
|
Button: () => Button2,
|
|
@@ -30,238 +23,195 @@ __export(Button_exports, {
|
|
|
30
23
|
useButton: () => useButton
|
|
31
24
|
});
|
|
32
25
|
module.exports = __toCommonJS(Button_exports);
|
|
33
|
-
var import_jsx_runtime = require("react/jsx-runtime"),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
70
|
-
flexDirection: "row",
|
|
71
|
-
cursor: "pointer",
|
|
72
|
-
hoverTheme: !0,
|
|
73
|
-
pressTheme: !0,
|
|
74
|
-
backgrounded: !0,
|
|
75
|
-
borderWidth: 1,
|
|
76
|
-
borderColor: "transparent",
|
|
77
|
-
focusVisibleStyle: {
|
|
78
|
-
outlineColor: "$outlineColor",
|
|
79
|
-
outlineStyle: "solid",
|
|
80
|
-
outlineWidth: 2
|
|
81
|
-
}
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_font_size = require("@tamagui/font-size"), import_get_button_sized = require("@tamagui/get-button-sized"), import_helpers = require("@tamagui/helpers"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_web = require("@tamagui/web"), import_react = require("react"), ButtonContext = (0, import_web.createStyledContext)({
|
|
27
|
+
// keeping these here means they work with styled() passing down color to text
|
|
28
|
+
color: void 0,
|
|
29
|
+
ellipse: void 0,
|
|
30
|
+
fontFamily: void 0,
|
|
31
|
+
fontSize: void 0,
|
|
32
|
+
fontStyle: void 0,
|
|
33
|
+
fontWeight: void 0,
|
|
34
|
+
letterSpacing: void 0,
|
|
35
|
+
maxFontSizeMultiplier: void 0,
|
|
36
|
+
size: void 0,
|
|
37
|
+
textAlign: void 0,
|
|
38
|
+
variant: void 0
|
|
39
|
+
}), BUTTON_NAME = "Button", ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
40
|
+
name: BUTTON_NAME,
|
|
41
|
+
tag: "button",
|
|
42
|
+
context: ButtonContext,
|
|
43
|
+
role: "button",
|
|
44
|
+
focusable: !0,
|
|
45
|
+
variants: {
|
|
46
|
+
unstyled: {
|
|
47
|
+
false: {
|
|
48
|
+
size: "$true",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
flexWrap: "nowrap",
|
|
52
|
+
flexDirection: "row",
|
|
53
|
+
cursor: "pointer",
|
|
54
|
+
hoverTheme: !0,
|
|
55
|
+
pressTheme: !0,
|
|
56
|
+
backgrounded: !0,
|
|
57
|
+
borderWidth: 1,
|
|
58
|
+
borderColor: "transparent",
|
|
59
|
+
focusVisibleStyle: {
|
|
60
|
+
outlineColor: "$outlineColor",
|
|
61
|
+
outlineStyle: "solid",
|
|
62
|
+
outlineWidth: 2
|
|
82
63
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
variant: {
|
|
67
|
+
outlined: {
|
|
68
|
+
backgroundColor: "transparent",
|
|
69
|
+
borderWidth: 2,
|
|
70
|
+
borderColor: "$borderColor",
|
|
71
|
+
hoverStyle: {
|
|
86
72
|
backgroundColor: "transparent",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
focusVisibleStyle: {
|
|
98
|
-
backgroundColor: "transparent",
|
|
99
|
-
borderColor: "$borderColorFocus"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
size: {
|
|
104
|
-
"...size": import_get_button_sized.getButtonSized,
|
|
105
|
-
":number": import_get_button_sized.getButtonSized
|
|
106
|
-
},
|
|
107
|
-
disabled: {
|
|
108
|
-
true: {
|
|
109
|
-
pointerEvents: "none"
|
|
73
|
+
borderColor: "$borderColorHover"
|
|
74
|
+
},
|
|
75
|
+
pressStyle: {
|
|
76
|
+
backgroundColor: "transparent",
|
|
77
|
+
borderColor: "$borderColorPress"
|
|
78
|
+
},
|
|
79
|
+
focusVisibleStyle: {
|
|
80
|
+
backgroundColor: "transparent",
|
|
81
|
+
borderColor: "$borderColorFocus"
|
|
110
82
|
}
|
|
111
83
|
}
|
|
112
84
|
},
|
|
113
|
-
|
|
114
|
-
|
|
85
|
+
size: {
|
|
86
|
+
"...size": import_get_button_sized.getButtonSized,
|
|
87
|
+
":number": import_get_button_sized.getButtonSized
|
|
88
|
+
},
|
|
89
|
+
disabled: {
|
|
90
|
+
true: {
|
|
91
|
+
pointerEvents: "none"
|
|
92
|
+
}
|
|
115
93
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
94
|
+
},
|
|
95
|
+
defaultVariants: {
|
|
96
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
97
|
+
}
|
|
98
|
+
}), ButtonText = (0, import_web.styled)(import_text.SizableText, {
|
|
99
|
+
name: "Button",
|
|
100
|
+
context: ButtonContext,
|
|
101
|
+
variants: {
|
|
102
|
+
unstyled: {
|
|
103
|
+
false: {
|
|
104
|
+
userSelect: "none",
|
|
105
|
+
cursor: "pointer",
|
|
106
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
107
|
+
flexGrow: 0,
|
|
108
|
+
flexShrink: 1,
|
|
109
|
+
ellipse: !0,
|
|
110
|
+
color: "$color"
|
|
131
111
|
}
|
|
132
|
-
},
|
|
133
|
-
defaultVariants: {
|
|
134
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
135
112
|
}
|
|
136
|
-
}),
|
|
137
|
-
ButtonIcon = function (props) {
|
|
138
|
-
var {
|
|
139
|
-
children,
|
|
140
|
-
scaleIcon = 1
|
|
141
|
-
} = props,
|
|
142
|
-
{
|
|
143
|
-
size,
|
|
144
|
-
color
|
|
145
|
-
} = (0, import_react.useContext)(ButtonContext),
|
|
146
|
-
iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon,
|
|
147
|
-
getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
148
|
-
size: iconSize,
|
|
149
|
-
color
|
|
150
|
-
});
|
|
151
|
-
return getThemedIcon(children);
|
|
152
113
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
114
|
+
defaultVariants: {
|
|
115
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
116
|
+
}
|
|
117
|
+
}), ButtonIcon = function(props) {
|
|
118
|
+
var { children, scaleIcon = 1 } = props, { size, color } = (0, import_react.useContext)(ButtonContext), iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon, getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
119
|
+
size: iconSize,
|
|
120
|
+
color
|
|
121
|
+
});
|
|
122
|
+
return getThemedIcon(children);
|
|
123
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
124
|
+
var { props: buttonProps } = useButton(props);
|
|
125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {
|
|
126
|
+
"data-disable-theme": !0,
|
|
127
|
+
...buttonProps,
|
|
128
|
+
ref
|
|
166
129
|
});
|
|
130
|
+
}), Button2 = (0, import_helpers.withStaticProperties)(ButtonComponent, {
|
|
131
|
+
Text: ButtonText,
|
|
132
|
+
Icon: ButtonIcon
|
|
133
|
+
});
|
|
167
134
|
function useButton(param) {
|
|
168
|
-
var {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
135
|
+
var { textProps, ...propsIn } = param, { Text = Button2.Text } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
136
|
+
Text: Button2.Text
|
|
137
|
+
}, isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext), propsActive = (0, import_web.useProps)(propsIn, {
|
|
138
|
+
noNormalize: !0,
|
|
139
|
+
noExpand: !0
|
|
140
|
+
}), { icon, iconAfter, space, spaceFlex, scaleIcon = 1, scaleSpace = 0.66, separator, noTextWrap, fontFamily, fontSize, fontWeight, fontStyle, letterSpacing, tag, ellipse, maxFontSizeMultiplier, ...restProps } = propsActive, size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), color = propsActive.color, iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
|
|
141
|
+
font: (fontFamily == null ? void 0 : fontFamily[0]) === "$" ? fontFamily : void 0
|
|
142
|
+
})) * scaleIcon, getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
143
|
+
size: iconSize,
|
|
144
|
+
color
|
|
145
|
+
}), [themedIcon, themedIconAfter] = [
|
|
146
|
+
icon,
|
|
147
|
+
iconAfter
|
|
148
|
+
].map(getThemedIcon), spaceSize = space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace, contents = noTextWrap ? [
|
|
149
|
+
propsIn.children
|
|
150
|
+
] : (0, import_text.wrapChildrenInText)(Text, {
|
|
151
|
+
children: propsIn.children,
|
|
152
|
+
color,
|
|
153
|
+
fontFamily,
|
|
154
|
+
fontSize,
|
|
155
|
+
textProps,
|
|
156
|
+
fontWeight,
|
|
157
|
+
fontStyle,
|
|
158
|
+
letterSpacing,
|
|
159
|
+
ellipse,
|
|
160
|
+
maxFontSizeMultiplier
|
|
161
|
+
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
162
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
163
|
+
size
|
|
164
|
+
} : void 0), inner = (0, import_web.spacedChildren)({
|
|
165
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
166
|
+
space: spaceSize === !1 ? 0 : spaceSize == !0 ? "$true" : spaceSize,
|
|
167
|
+
spaceFlex,
|
|
168
|
+
ensureKeys: !0,
|
|
169
|
+
separator,
|
|
170
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
171
|
+
// for keys to stay the same we keep indices as similar a possible
|
|
172
|
+
// so even if icons are undefined we still pass them
|
|
173
|
+
children: [
|
|
174
|
+
themedIcon,
|
|
175
|
+
...contents,
|
|
176
|
+
themedIconAfter
|
|
177
|
+
]
|
|
178
|
+
}), props = {
|
|
179
|
+
size,
|
|
180
|
+
...propsIn.disabled && {
|
|
181
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
182
|
+
focusable: void 0,
|
|
183
|
+
// even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
|
|
184
|
+
focusVisibleStyle: {
|
|
185
|
+
borderColor: "$background"
|
|
186
|
+
}
|
|
176
187
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
noNormalize: !0,
|
|
180
|
-
noExpand: !0
|
|
181
|
-
}),
|
|
182
|
-
{
|
|
183
|
-
icon,
|
|
184
|
-
iconAfter,
|
|
185
|
-
space,
|
|
186
|
-
spaceFlex,
|
|
187
|
-
scaleIcon = 1,
|
|
188
|
-
scaleSpace = 0.66,
|
|
189
|
-
separator,
|
|
190
|
-
noTextWrap,
|
|
191
|
-
fontFamily,
|
|
192
|
-
fontSize,
|
|
193
|
-
fontWeight,
|
|
194
|
-
fontStyle,
|
|
195
|
-
letterSpacing,
|
|
196
|
-
tag,
|
|
197
|
-
ellipse,
|
|
198
|
-
maxFontSizeMultiplier,
|
|
199
|
-
...restProps
|
|
200
|
-
} = propsActive,
|
|
201
|
-
size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"),
|
|
202
|
-
color = propsActive.color,
|
|
203
|
-
iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
|
|
204
|
-
font: fontFamily?.[0] === "$" ? fontFamily : void 0
|
|
205
|
-
})) * scaleIcon,
|
|
206
|
-
getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
207
|
-
size: iconSize,
|
|
208
|
-
color
|
|
209
|
-
}),
|
|
210
|
-
[themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon),
|
|
211
|
-
spaceSize = space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace,
|
|
212
|
-
contents = noTextWrap ? [propsIn.children] : (0, import_text.wrapChildrenInText)(Text, {
|
|
213
|
-
children: propsIn.children,
|
|
214
|
-
color,
|
|
215
|
-
fontFamily,
|
|
216
|
-
fontSize,
|
|
217
|
-
textProps,
|
|
218
|
-
fontWeight,
|
|
219
|
-
fontStyle,
|
|
220
|
-
letterSpacing,
|
|
221
|
-
ellipse,
|
|
222
|
-
maxFontSizeMultiplier
|
|
223
|
-
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
224
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
225
|
-
size
|
|
226
|
-
} : void 0),
|
|
227
|
-
inner = (0, import_web.spacedChildren)({
|
|
228
|
-
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
229
|
-
space: spaceSize === !1 ? 0 : spaceSize == !0 ? "$true" : spaceSize,
|
|
230
|
-
spaceFlex,
|
|
231
|
-
ensureKeys: !0,
|
|
232
|
-
separator,
|
|
233
|
-
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
234
|
-
// for keys to stay the same we keep indices as similar a possible
|
|
235
|
-
// so even if icons are undefined we still pass them
|
|
236
|
-
children: [themedIcon, ...contents, themedIconAfter]
|
|
237
|
-
}),
|
|
238
|
-
props = {
|
|
239
|
-
size,
|
|
240
|
-
...(propsIn.disabled && {
|
|
241
|
-
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
242
|
-
focusable: void 0,
|
|
243
|
-
// even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
|
|
244
|
-
focusVisibleStyle: {
|
|
245
|
-
borderColor: "$background"
|
|
246
|
-
}
|
|
247
|
-
}),
|
|
248
|
-
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
249
|
-
tag: tag ?? (isNested ? "span" :
|
|
188
|
+
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
189
|
+
tag: tag ?? (isNested ? "span" : (
|
|
250
190
|
// defaults to <a /> when accessibilityRole = link
|
|
251
191
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
252
|
-
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
192
|
+
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
193
|
+
)),
|
|
194
|
+
...restProps,
|
|
195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
|
|
196
|
+
value: !0,
|
|
197
|
+
children: inner
|
|
198
|
+
}),
|
|
199
|
+
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
200
|
+
disableClassName: !0
|
|
201
|
+
};
|
|
261
202
|
return {
|
|
262
203
|
spaceSize,
|
|
263
204
|
isNested,
|
|
264
205
|
props
|
|
265
206
|
};
|
|
266
207
|
}
|
|
267
|
-
|
|
208
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
209
|
+
0 && (module.exports = {
|
|
210
|
+
Button,
|
|
211
|
+
ButtonContext,
|
|
212
|
+
ButtonFrame,
|
|
213
|
+
ButtonIcon,
|
|
214
|
+
ButtonText,
|
|
215
|
+
useButton
|
|
216
|
+
});
|
|
217
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B,8BAC5B,mBAA4B,+BAC5B,0BAA+B,sCAC/B,iBAAqC,6BACrC,yBAAiC,qCACjC,gBAAqD,4BACrD,cAAgD,0BAChD,aAAwF,yBACxF,eAA2B,kBAChB,oBAAgB,gCAAoB;AAAA;AAAA,EAE3C,OAAO;AAAA,EACP,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,uBAAuB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AACb,CAAC,GAeW,cAAc,UACtB,kBAAc,mBAAO,8BAAgB;AAAA,EACrC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,SAAS;AAAA,EACT,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AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;",
|
|
5
|
+
"names": ["Button", "_jsx"]
|
|
6
|
+
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import_vitest = require("vitest"),
|
|
6
|
-
conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
7
|
-
(0, import_vitest.describe)("Button", function () {
|
|
8
|
-
(0, import_vitest.test)("123", function () {
|
|
2
|
+
var import_config_default = require("@tamagui/config-default"), import_core = require("@tamagui/core"), import_vitest = require("vitest"), conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
3
|
+
(0, import_vitest.describe)("Button", function() {
|
|
4
|
+
(0, import_vitest.test)("123", function() {
|
|
9
5
|
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
10
6
|
});
|
|
11
7
|
});
|
|
12
|
-
//# sourceMappingURL=Button.test.
|
|
8
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
+
"mappings": ";AAAA,4BAAwC,oCACxC,cAA8B,0BAC9B,gBAAuC,mBACnC,WAAO,+BAAc,+CAAwB,CAAC;AAAA,IAClD,wBAAS,UAAU,WAAW;AAC1B,0BAAK,OAAO,WAAW;AACnB,8BAAO,EAAI,EAAE,WAAW;AAAA,EAC5B,CAAC;AACL,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
6
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: !0
|
|
17
|
-
}), mod);
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
18
13
|
var index_exports = {};
|
|
19
14
|
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./Button
|
|
21
|
-
|
|
15
|
+
__reExport(index_exports, require("./Button"), module.exports);
|
|
16
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
17
|
+
0 && (module.exports = {
|
|
18
|
+
...require("./Button")
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,qBAAd;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -1,267 +1,200 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
fontSize: void 0,
|
|
48
|
-
fontStyle: void 0,
|
|
49
|
-
fontWeight: void 0,
|
|
50
|
-
letterSpacing: void 0,
|
|
51
|
-
maxFontSizeMultiplier: void 0,
|
|
52
|
-
size: void 0,
|
|
53
|
-
textAlign: void 0,
|
|
54
|
-
variant: void 0
|
|
55
|
-
}),
|
|
56
|
-
BUTTON_NAME = "Button",
|
|
57
|
-
ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
58
|
-
name: BUTTON_NAME,
|
|
59
|
-
tag: "button",
|
|
60
|
-
context: ButtonContext,
|
|
61
|
-
role: "button",
|
|
62
|
-
focusable: !0,
|
|
63
|
-
variants: {
|
|
64
|
-
unstyled: {
|
|
65
|
-
false: {
|
|
66
|
-
size: "$true",
|
|
67
|
-
justifyContent: "center",
|
|
68
|
-
alignItems: "center",
|
|
69
|
-
flexWrap: "nowrap",
|
|
70
|
-
flexDirection: "row",
|
|
71
|
-
cursor: "pointer",
|
|
72
|
-
hoverTheme: !0,
|
|
73
|
-
pressTheme: !0,
|
|
74
|
-
backgrounded: !0,
|
|
75
|
-
borderWidth: 1,
|
|
76
|
-
borderColor: "transparent",
|
|
77
|
-
focusVisibleStyle: {
|
|
78
|
-
outlineColor: "$outlineColor",
|
|
79
|
-
outlineStyle: "solid",
|
|
80
|
-
outlineWidth: 2
|
|
81
|
-
}
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
3
|
+
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
4
|
+
import { withStaticProperties } from "@tamagui/helpers";
|
|
5
|
+
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
6
|
+
import { ButtonNestingContext, ThemeableStack } from "@tamagui/stacks";
|
|
7
|
+
import { SizableText, wrapChildrenInText } from "@tamagui/text";
|
|
8
|
+
import { createStyledContext, getVariableValue, spacedChildren, styled, useProps } from "@tamagui/web";
|
|
9
|
+
import { useContext } from "react";
|
|
10
|
+
var ButtonContext = createStyledContext({
|
|
11
|
+
// keeping these here means they work with styled() passing down color to text
|
|
12
|
+
color: void 0,
|
|
13
|
+
ellipse: void 0,
|
|
14
|
+
fontFamily: void 0,
|
|
15
|
+
fontSize: void 0,
|
|
16
|
+
fontStyle: void 0,
|
|
17
|
+
fontWeight: void 0,
|
|
18
|
+
letterSpacing: void 0,
|
|
19
|
+
maxFontSizeMultiplier: void 0,
|
|
20
|
+
size: void 0,
|
|
21
|
+
textAlign: void 0,
|
|
22
|
+
variant: void 0
|
|
23
|
+
}), BUTTON_NAME = "Button", ButtonFrame = styled(ThemeableStack, {
|
|
24
|
+
name: BUTTON_NAME,
|
|
25
|
+
tag: "button",
|
|
26
|
+
context: ButtonContext,
|
|
27
|
+
role: "button",
|
|
28
|
+
focusable: !0,
|
|
29
|
+
variants: {
|
|
30
|
+
unstyled: {
|
|
31
|
+
false: {
|
|
32
|
+
size: "$true",
|
|
33
|
+
justifyContent: "center",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
flexWrap: "nowrap",
|
|
36
|
+
flexDirection: "row",
|
|
37
|
+
cursor: "pointer",
|
|
38
|
+
hoverTheme: !0,
|
|
39
|
+
pressTheme: !0,
|
|
40
|
+
backgrounded: !0,
|
|
41
|
+
borderWidth: 1,
|
|
42
|
+
borderColor: "transparent",
|
|
43
|
+
focusVisibleStyle: {
|
|
44
|
+
outlineColor: "$outlineColor",
|
|
45
|
+
outlineStyle: "solid",
|
|
46
|
+
outlineWidth: 2
|
|
82
47
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
variant: {
|
|
51
|
+
outlined: {
|
|
52
|
+
backgroundColor: "transparent",
|
|
53
|
+
borderWidth: 2,
|
|
54
|
+
borderColor: "$borderColor",
|
|
55
|
+
hoverStyle: {
|
|
86
56
|
backgroundColor: "transparent",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
focusVisibleStyle: {
|
|
98
|
-
backgroundColor: "transparent",
|
|
99
|
-
borderColor: "$borderColorFocus"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
size: {
|
|
104
|
-
"...size": import_get_button_sized.getButtonSized,
|
|
105
|
-
":number": import_get_button_sized.getButtonSized
|
|
106
|
-
},
|
|
107
|
-
disabled: {
|
|
108
|
-
true: {
|
|
109
|
-
pointerEvents: "none"
|
|
57
|
+
borderColor: "$borderColorHover"
|
|
58
|
+
},
|
|
59
|
+
pressStyle: {
|
|
60
|
+
backgroundColor: "transparent",
|
|
61
|
+
borderColor: "$borderColorPress"
|
|
62
|
+
},
|
|
63
|
+
focusVisibleStyle: {
|
|
64
|
+
backgroundColor: "transparent",
|
|
65
|
+
borderColor: "$borderColorFocus"
|
|
110
66
|
}
|
|
111
67
|
}
|
|
112
68
|
},
|
|
113
|
-
|
|
114
|
-
|
|
69
|
+
size: {
|
|
70
|
+
"...size": getButtonSized,
|
|
71
|
+
":number": getButtonSized
|
|
72
|
+
},
|
|
73
|
+
disabled: {
|
|
74
|
+
true: {
|
|
75
|
+
pointerEvents: "none"
|
|
76
|
+
}
|
|
115
77
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
81
|
+
}
|
|
82
|
+
}), ButtonText = styled(SizableText, {
|
|
83
|
+
name: "Button",
|
|
84
|
+
context: ButtonContext,
|
|
85
|
+
variants: {
|
|
86
|
+
unstyled: {
|
|
87
|
+
false: {
|
|
88
|
+
userSelect: "none",
|
|
89
|
+
cursor: "pointer",
|
|
90
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
91
|
+
flexGrow: 0,
|
|
92
|
+
flexShrink: 1,
|
|
93
|
+
ellipse: !0,
|
|
94
|
+
color: "$color"
|
|
131
95
|
}
|
|
132
|
-
},
|
|
133
|
-
defaultVariants: {
|
|
134
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
135
96
|
}
|
|
136
|
-
}),
|
|
137
|
-
ButtonIcon = function (props) {
|
|
138
|
-
var {
|
|
139
|
-
children,
|
|
140
|
-
scaleIcon = 1
|
|
141
|
-
} = props,
|
|
142
|
-
{
|
|
143
|
-
size,
|
|
144
|
-
color
|
|
145
|
-
} = (0, import_react.useContext)(ButtonContext),
|
|
146
|
-
iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon,
|
|
147
|
-
getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
148
|
-
size: iconSize,
|
|
149
|
-
color
|
|
150
|
-
});
|
|
151
|
-
return getThemedIcon(children);
|
|
152
97
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
100
|
+
}
|
|
101
|
+
}), ButtonIcon = function(props) {
|
|
102
|
+
var { children, scaleIcon = 1 } = props, { size, color } = useContext(ButtonContext), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon, getThemedIcon = useGetThemedIcon({
|
|
103
|
+
size: iconSize,
|
|
104
|
+
color
|
|
105
|
+
});
|
|
106
|
+
return getThemedIcon(children);
|
|
107
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
108
|
+
var { props: buttonProps } = useButton(props);
|
|
109
|
+
return /* @__PURE__ */ _jsx(ButtonFrame, {
|
|
110
|
+
"data-disable-theme": !0,
|
|
111
|
+
...buttonProps,
|
|
112
|
+
ref
|
|
166
113
|
});
|
|
114
|
+
}), Button2 = withStaticProperties(ButtonComponent, {
|
|
115
|
+
Text: ButtonText,
|
|
116
|
+
Icon: ButtonIcon
|
|
117
|
+
});
|
|
167
118
|
function useButton(param) {
|
|
168
|
-
var {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
119
|
+
var { textProps, ...propsIn } = param, { Text = Button2.Text } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
120
|
+
Text: Button2.Text
|
|
121
|
+
}, isNested = useContext(ButtonNestingContext), propsActive = useProps(propsIn, {
|
|
122
|
+
noNormalize: !0,
|
|
123
|
+
noExpand: !0
|
|
124
|
+
}), { icon, iconAfter, space, spaceFlex, scaleIcon = 1, scaleSpace = 0.66, separator, noTextWrap, fontFamily, fontSize, fontWeight, fontStyle, letterSpacing, tag, ellipse, maxFontSizeMultiplier, ...restProps } = propsActive, size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), color = propsActive.color, iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size, {
|
|
125
|
+
font: (fontFamily == null ? void 0 : fontFamily[0]) === "$" ? fontFamily : void 0
|
|
126
|
+
})) * scaleIcon, getThemedIcon = useGetThemedIcon({
|
|
127
|
+
size: iconSize,
|
|
128
|
+
color
|
|
129
|
+
}), [themedIcon, themedIconAfter] = [
|
|
130
|
+
icon,
|
|
131
|
+
iconAfter
|
|
132
|
+
].map(getThemedIcon), spaceSize = space ?? getVariableValue(iconSize) * scaleSpace, contents = noTextWrap ? [
|
|
133
|
+
propsIn.children
|
|
134
|
+
] : wrapChildrenInText(Text, {
|
|
135
|
+
children: propsIn.children,
|
|
136
|
+
color,
|
|
137
|
+
fontFamily,
|
|
138
|
+
fontSize,
|
|
139
|
+
textProps,
|
|
140
|
+
fontWeight,
|
|
141
|
+
fontStyle,
|
|
142
|
+
letterSpacing,
|
|
143
|
+
ellipse,
|
|
144
|
+
maxFontSizeMultiplier
|
|
145
|
+
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
146
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
147
|
+
size
|
|
148
|
+
} : void 0), inner = spacedChildren({
|
|
149
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
150
|
+
space: spaceSize === !1 ? 0 : spaceSize == !0 ? "$true" : spaceSize,
|
|
151
|
+
spaceFlex,
|
|
152
|
+
ensureKeys: !0,
|
|
153
|
+
separator,
|
|
154
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
155
|
+
// for keys to stay the same we keep indices as similar a possible
|
|
156
|
+
// so even if icons are undefined we still pass them
|
|
157
|
+
children: [
|
|
158
|
+
themedIcon,
|
|
159
|
+
...contents,
|
|
160
|
+
themedIconAfter
|
|
161
|
+
]
|
|
162
|
+
}), props = {
|
|
163
|
+
size,
|
|
164
|
+
...propsIn.disabled && {
|
|
165
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
166
|
+
focusable: void 0,
|
|
167
|
+
// even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
|
|
168
|
+
focusVisibleStyle: {
|
|
169
|
+
borderColor: "$background"
|
|
170
|
+
}
|
|
176
171
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
noNormalize: !0,
|
|
180
|
-
noExpand: !0
|
|
181
|
-
}),
|
|
182
|
-
{
|
|
183
|
-
icon,
|
|
184
|
-
iconAfter,
|
|
185
|
-
space,
|
|
186
|
-
spaceFlex,
|
|
187
|
-
scaleIcon = 1,
|
|
188
|
-
scaleSpace = 0.66,
|
|
189
|
-
separator,
|
|
190
|
-
noTextWrap,
|
|
191
|
-
fontFamily,
|
|
192
|
-
fontSize,
|
|
193
|
-
fontWeight,
|
|
194
|
-
fontStyle,
|
|
195
|
-
letterSpacing,
|
|
196
|
-
tag,
|
|
197
|
-
ellipse,
|
|
198
|
-
maxFontSizeMultiplier,
|
|
199
|
-
...restProps
|
|
200
|
-
} = propsActive,
|
|
201
|
-
size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"),
|
|
202
|
-
color = propsActive.color,
|
|
203
|
-
iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
|
|
204
|
-
font: fontFamily?.[0] === "$" ? fontFamily : void 0
|
|
205
|
-
})) * scaleIcon,
|
|
206
|
-
getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
207
|
-
size: iconSize,
|
|
208
|
-
color
|
|
209
|
-
}),
|
|
210
|
-
[themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon),
|
|
211
|
-
spaceSize = space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace,
|
|
212
|
-
contents = noTextWrap ? [propsIn.children] : (0, import_text.wrapChildrenInText)(Text, {
|
|
213
|
-
children: propsIn.children,
|
|
214
|
-
color,
|
|
215
|
-
fontFamily,
|
|
216
|
-
fontSize,
|
|
217
|
-
textProps,
|
|
218
|
-
fontWeight,
|
|
219
|
-
fontStyle,
|
|
220
|
-
letterSpacing,
|
|
221
|
-
ellipse,
|
|
222
|
-
maxFontSizeMultiplier
|
|
223
|
-
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
224
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
225
|
-
size
|
|
226
|
-
} : void 0),
|
|
227
|
-
inner = (0, import_web.spacedChildren)({
|
|
228
|
-
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
229
|
-
space: spaceSize === !1 ? 0 : spaceSize == !0 ? "$true" : spaceSize,
|
|
230
|
-
spaceFlex,
|
|
231
|
-
ensureKeys: !0,
|
|
232
|
-
separator,
|
|
233
|
-
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
234
|
-
// for keys to stay the same we keep indices as similar a possible
|
|
235
|
-
// so even if icons are undefined we still pass them
|
|
236
|
-
children: [themedIcon, ...contents, themedIconAfter]
|
|
237
|
-
}),
|
|
238
|
-
props = {
|
|
239
|
-
size,
|
|
240
|
-
...(propsIn.disabled && {
|
|
241
|
-
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
242
|
-
focusable: void 0,
|
|
243
|
-
// even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
|
|
244
|
-
focusVisibleStyle: {
|
|
245
|
-
borderColor: "$background"
|
|
246
|
-
}
|
|
247
|
-
}),
|
|
248
|
-
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
249
|
-
tag: tag ?? (isNested ? "span" :
|
|
172
|
+
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
173
|
+
tag: tag ?? (isNested ? "span" : (
|
|
250
174
|
// defaults to <a /> when accessibilityRole = link
|
|
251
175
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
252
|
-
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
176
|
+
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
177
|
+
)),
|
|
178
|
+
...restProps,
|
|
179
|
+
children: /* @__PURE__ */ _jsx(ButtonNestingContext.Provider, {
|
|
180
|
+
value: !0,
|
|
181
|
+
children: inner
|
|
182
|
+
}),
|
|
183
|
+
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
184
|
+
disableClassName: !0
|
|
185
|
+
};
|
|
261
186
|
return {
|
|
262
187
|
spaceSize,
|
|
263
188
|
isNested,
|
|
264
189
|
props
|
|
265
190
|
};
|
|
266
191
|
}
|
|
267
|
-
|
|
192
|
+
export {
|
|
193
|
+
Button2 as Button,
|
|
194
|
+
ButtonContext,
|
|
195
|
+
ButtonFrame,
|
|
196
|
+
ButtonIcon,
|
|
197
|
+
ButtonText,
|
|
198
|
+
useButton
|
|
199
|
+
};
|
|
200
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,OAAO,YAAY;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB,sBAAsB;AACrD,SAAS,aAAa,0BAA0B;AAChD,SAAS,qBAAqB,kBAAkB,gBAAgB,QAAQ,gBAAgB;AACxF,SAAS,kBAAkB;AACpB,IAAI,gBAAgB,oBAAoB;AAAA;AAAA,EAE3C,OAAO;AAAA,EACP,SAAS;AAAA,EACT,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AAA;AAAA;AAAA,MAEvD,YAAY,sBAAsB,UAAU,YAAY,SAAS,SAAS,MAAM;AAAA;AAAA,IAChF,GAAG;AAAA,IACH,UAAwB,qBAAK,qBAAqB,UAAU;AAAA,MACxD,OAAO;AAAA,MACP,UAAU;AAAA,IACd,CAAC;AAAA;AAAA,IAED,kBAAkB;AAAA,EACtB;AACA,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;",
|
|
5
|
+
"names": ["Button"]
|
|
6
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
(0
|
|
8
|
-
(0, import_vitest.test)("123", function () {
|
|
9
|
-
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
1
|
+
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
2
|
+
import { createTamagui } from "@tamagui/core";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
var conf = createTamagui(getDefaultTamaguiConfig());
|
|
5
|
+
describe("Button", function() {
|
|
6
|
+
test("123", function() {
|
|
7
|
+
expect(!0).toBeTruthy();
|
|
10
8
|
});
|
|
11
9
|
});
|
|
12
|
-
//# sourceMappingURL=Button.test.
|
|
10
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAC9B,SAAS,UAAU,QAAQ,YAAY;AACvC,IAAI,OAAO,cAAc,wBAAwB,CAAC;AAClD,SAAS,UAAU,WAAW;AAC1B,OAAK,OAAO,WAAW;AACnB,WAAO,EAAI,EAAE,WAAW;AAAA,EAC5B,CAAC;AACL,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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, {
|
|
9
|
-
get: () => from[key],
|
|
10
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
-
});
|
|
12
|
-
return to;
|
|
13
|
-
},
|
|
14
|
-
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: !0
|
|
17
|
-
}), mod);
|
|
18
|
-
var index_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./Button.native.js"), module.exports);
|
|
21
|
-
//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export * from "./Button";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/button",
|
|
3
|
-
"version": "1.135.4
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "1.135.4",
|
|
5
4
|
"sideEffects": [
|
|
6
5
|
"*.css"
|
|
7
6
|
],
|
|
@@ -37,20 +36,20 @@
|
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@tamagui/config-default": "1.135.4
|
|
41
|
-
"@tamagui/core": "1.135.4
|
|
42
|
-
"@tamagui/font-size": "1.135.4
|
|
43
|
-
"@tamagui/get-button-sized": "1.135.4
|
|
44
|
-
"@tamagui/helpers": "1.135.4
|
|
45
|
-
"@tamagui/helpers-tamagui": "1.135.4
|
|
46
|
-
"@tamagui/stacks": "1.135.4
|
|
47
|
-
"@tamagui/text": "1.135.4
|
|
48
|
-
"@tamagui/web": "1.135.4
|
|
39
|
+
"@tamagui/config-default": "1.135.4",
|
|
40
|
+
"@tamagui/core": "1.135.4",
|
|
41
|
+
"@tamagui/font-size": "1.135.4",
|
|
42
|
+
"@tamagui/get-button-sized": "1.135.4",
|
|
43
|
+
"@tamagui/helpers": "1.135.4",
|
|
44
|
+
"@tamagui/helpers-tamagui": "1.135.4",
|
|
45
|
+
"@tamagui/stacks": "1.135.4",
|
|
46
|
+
"@tamagui/text": "1.135.4",
|
|
47
|
+
"@tamagui/web": "1.135.4"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "1.135.4
|
|
50
|
+
"@tamagui/build": "1.135.4",
|
|
52
51
|
"react": "*",
|
|
53
|
-
"vitest": "^
|
|
52
|
+
"vitest": "^3.2.4"
|
|
54
53
|
},
|
|
55
54
|
"publishConfig": {
|
|
56
55
|
"access": "public"
|