@tamagui/button 1.89.26 → 1.89.27-1708112217600
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 +188 -62
- package/dist/cjs/Button.native.js.map +3 -3
- package/dist/cjs/Button.test.native.js +3 -4
- package/dist/cjs/Button.test.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/esm/Button.native.js +188 -69
- package/dist/esm/Button.native.js.map +3 -3
- package/dist/esm/Button.test.native.js +3 -3
- package/dist/esm/Button.test.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/jsx/Button.native.js +188 -69
- package/dist/jsx/Button.native.js.map +3 -3
- package/dist/jsx/Button.test.native.js +3 -3
- package/dist/jsx/Button.test.native.js.map +3 -3
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +9 -9
|
@@ -24,8 +24,122 @@ __export(Button_exports, {
|
|
|
24
24
|
useButton: () => useButton
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(Button_exports);
|
|
27
|
-
var 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")
|
|
28
|
-
|
|
27
|
+
var 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");
|
|
28
|
+
function _array_like_to_array(arr, len) {
|
|
29
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
30
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
31
|
+
arr2[i] = arr[i];
|
|
32
|
+
return arr2;
|
|
33
|
+
}
|
|
34
|
+
function _array_with_holes(arr) {
|
|
35
|
+
if (Array.isArray(arr))
|
|
36
|
+
return arr;
|
|
37
|
+
}
|
|
38
|
+
function _array_without_holes(arr) {
|
|
39
|
+
if (Array.isArray(arr))
|
|
40
|
+
return _array_like_to_array(arr);
|
|
41
|
+
}
|
|
42
|
+
function _define_property(obj, key, value) {
|
|
43
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
44
|
+
value,
|
|
45
|
+
enumerable: !0,
|
|
46
|
+
configurable: !0,
|
|
47
|
+
writable: !0
|
|
48
|
+
}) : obj[key] = value, obj;
|
|
49
|
+
}
|
|
50
|
+
function _iterable_to_array(iter) {
|
|
51
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
52
|
+
return Array.from(iter);
|
|
53
|
+
}
|
|
54
|
+
function _iterable_to_array_limit(arr, i) {
|
|
55
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
56
|
+
if (_i != null) {
|
|
57
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
58
|
+
try {
|
|
59
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
60
|
+
;
|
|
61
|
+
} catch (err) {
|
|
62
|
+
_d = !0, _e = err;
|
|
63
|
+
} finally {
|
|
64
|
+
try {
|
|
65
|
+
!_n && _i.return != null && _i.return();
|
|
66
|
+
} finally {
|
|
67
|
+
if (_d)
|
|
68
|
+
throw _e;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return _arr;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function _non_iterable_rest() {
|
|
75
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
76
|
+
}
|
|
77
|
+
function _non_iterable_spread() {
|
|
78
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
79
|
+
}
|
|
80
|
+
function _object_spread(target) {
|
|
81
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
82
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
83
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
84
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
85
|
+
}))), ownKeys2.forEach(function(key) {
|
|
86
|
+
_define_property(target, key, source[key]);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return target;
|
|
90
|
+
}
|
|
91
|
+
function ownKeys(object, enumerableOnly) {
|
|
92
|
+
var keys = Object.keys(object);
|
|
93
|
+
if (Object.getOwnPropertySymbols) {
|
|
94
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
95
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
96
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
97
|
+
})), keys.push.apply(keys, symbols);
|
|
98
|
+
}
|
|
99
|
+
return keys;
|
|
100
|
+
}
|
|
101
|
+
function _object_spread_props(target, source) {
|
|
102
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
103
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
104
|
+
}), target;
|
|
105
|
+
}
|
|
106
|
+
function _object_without_properties(source, excluded) {
|
|
107
|
+
if (source == null)
|
|
108
|
+
return {};
|
|
109
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
110
|
+
if (Object.getOwnPropertySymbols) {
|
|
111
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
112
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
113
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
114
|
+
}
|
|
115
|
+
return target;
|
|
116
|
+
}
|
|
117
|
+
function _object_without_properties_loose(source, excluded) {
|
|
118
|
+
if (source == null)
|
|
119
|
+
return {};
|
|
120
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
121
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
122
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
123
|
+
return target;
|
|
124
|
+
}
|
|
125
|
+
function _sliced_to_array(arr, i) {
|
|
126
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
127
|
+
}
|
|
128
|
+
function _to_consumable_array(arr) {
|
|
129
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
130
|
+
}
|
|
131
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
132
|
+
if (o) {
|
|
133
|
+
if (typeof o == "string")
|
|
134
|
+
return _array_like_to_array(o, minLen);
|
|
135
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
136
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
137
|
+
return Array.from(n);
|
|
138
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
139
|
+
return _array_like_to_array(o, minLen);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
var ButtonContext = (0, import_web.createStyledContext)({
|
|
29
143
|
// keeping these here means they work with styled() passing down color to text
|
|
30
144
|
color: void 0,
|
|
31
145
|
ellipse: void 0,
|
|
@@ -115,15 +229,18 @@ const ButtonContext = (0, import_web.createStyledContext)({
|
|
|
115
229
|
defaultVariants: {
|
|
116
230
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
117
231
|
}
|
|
118
|
-
}), ButtonIcon = (props)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
232
|
+
}), ButtonIcon = function(props) {
|
|
233
|
+
var children = props.children, _props_scaleIcon = props.scaleIcon, scaleIcon = _props_scaleIcon === void 0 ? 1 : _props_scaleIcon, _useContext = (0, import_react.useContext)(ButtonContext), size = _useContext.size, color = _useContext.color, iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon, getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
234
|
+
size: iconSize,
|
|
235
|
+
color
|
|
236
|
+
});
|
|
237
|
+
return getThemedIcon(children);
|
|
238
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
239
|
+
var _useButton = useButton(props), buttonProps = _useButton.props;
|
|
240
|
+
return /* @__PURE__ */ React.createElement(ButtonFrame, _object_spread_props(_object_spread({}, buttonProps), {
|
|
241
|
+
ref
|
|
242
|
+
}));
|
|
243
|
+
}), buttonStaticConfig = {
|
|
127
244
|
inlineProps: /* @__PURE__ */ new Set([
|
|
128
245
|
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
129
246
|
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
@@ -140,75 +257,84 @@ const ButtonContext = (0, import_web.createStyledContext)({
|
|
|
140
257
|
Text: ButtonText,
|
|
141
258
|
Icon: ButtonIcon
|
|
142
259
|
});
|
|
143
|
-
function useButton(
|
|
144
|
-
|
|
260
|
+
function useButton(_param) {
|
|
261
|
+
var _$_param = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
262
|
+
Text: Button2.Text
|
|
263
|
+
}, textProps = _param.textProps, propsIn = _object_without_properties(_param, [
|
|
264
|
+
"textProps"
|
|
265
|
+
]), _param_Text = _$_param.Text, Text = _param_Text === void 0 ? Button2.Text : _param_Text, isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext), propsActive = (0, import_web.useProps)(propsIn), icon = propsActive.icon, iconAfter = propsActive.iconAfter, space = propsActive.space, spaceFlex = propsActive.spaceFlex, _propsActive_scaleIcon = propsActive.scaleIcon, scaleIcon = _propsActive_scaleIcon === void 0 ? 1 : _propsActive_scaleIcon, _propsActive_scaleSpace = propsActive.scaleSpace, scaleSpace = _propsActive_scaleSpace === void 0 ? 0.66 : _propsActive_scaleSpace, separator = propsActive.separator, noTextWrap = propsActive.noTextWrap, fontFamily = propsActive.fontFamily, fontSize = propsActive.fontSize, fontWeight = propsActive.fontWeight, fontStyle = propsActive.fontStyle, letterSpacing = propsActive.letterSpacing, tag = propsActive.tag, ellipse = propsActive.ellipse, maxFontSizeMultiplier = propsActive.maxFontSizeMultiplier, restProps = _object_without_properties(propsActive, [
|
|
266
|
+
"icon",
|
|
267
|
+
"iconAfter",
|
|
268
|
+
"space",
|
|
269
|
+
"spaceFlex",
|
|
270
|
+
"scaleIcon",
|
|
271
|
+
"scaleSpace",
|
|
272
|
+
"separator",
|
|
273
|
+
"noTextWrap",
|
|
274
|
+
"fontFamily",
|
|
275
|
+
"fontSize",
|
|
276
|
+
"fontWeight",
|
|
277
|
+
"fontStyle",
|
|
278
|
+
"letterSpacing",
|
|
279
|
+
"tag",
|
|
280
|
+
"ellipse",
|
|
281
|
+
"maxFontSizeMultiplier"
|
|
282
|
+
]), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), color = propsActive.color, iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
|
|
283
|
+
font: (fontFamily == null ? void 0 : fontFamily[0]) === "$" ? fontFamily : void 0
|
|
284
|
+
})) * scaleIcon, getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
285
|
+
size: iconSize,
|
|
286
|
+
color
|
|
287
|
+
}), _map = _sliced_to_array([
|
|
145
288
|
icon,
|
|
146
|
-
iconAfter
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
separator,
|
|
152
|
-
noTextWrap,
|
|
289
|
+
iconAfter
|
|
290
|
+
].map(getThemedIcon), 2), themedIcon = _map[0], themedIconAfter = _map[1], spaceSize = space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace, contents = noTextWrap ? [
|
|
291
|
+
propsIn.children
|
|
292
|
+
] : (0, import_text.wrapChildrenInText)(Text, {
|
|
293
|
+
children: propsIn.children,
|
|
153
294
|
fontFamily,
|
|
154
295
|
fontSize,
|
|
296
|
+
textProps,
|
|
155
297
|
fontWeight,
|
|
156
298
|
fontStyle,
|
|
157
299
|
letterSpacing,
|
|
158
|
-
tag,
|
|
159
300
|
ellipse,
|
|
160
|
-
maxFontSizeMultiplier
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
size: iconSize,
|
|
166
|
-
color
|
|
167
|
-
}), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace, contents = noTextWrap ? [propsIn.children] : (0, import_text.wrapChildrenInText)(
|
|
168
|
-
Text,
|
|
169
|
-
{
|
|
170
|
-
children: propsIn.children,
|
|
171
|
-
fontFamily,
|
|
172
|
-
fontSize,
|
|
173
|
-
textProps,
|
|
174
|
-
fontWeight,
|
|
175
|
-
fontStyle,
|
|
176
|
-
letterSpacing,
|
|
177
|
-
ellipse,
|
|
178
|
-
maxFontSizeMultiplier
|
|
179
|
-
},
|
|
180
|
-
Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
181
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
182
|
-
size
|
|
183
|
-
} : void 0
|
|
184
|
-
), inner = (0, import_web.spacedChildren)({
|
|
301
|
+
maxFontSizeMultiplier
|
|
302
|
+
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
303
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
304
|
+
size
|
|
305
|
+
} : void 0), inner = (0, import_web.spacedChildren)({
|
|
185
306
|
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
186
307
|
space: spaceSize,
|
|
187
308
|
spaceFlex,
|
|
188
309
|
separator,
|
|
189
310
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
190
|
-
children: [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
311
|
+
children: [
|
|
312
|
+
themedIcon
|
|
313
|
+
].concat(_to_consumable_array(contents), [
|
|
314
|
+
themedIconAfter
|
|
315
|
+
])
|
|
316
|
+
}), props = _object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
317
|
+
size
|
|
318
|
+
}, propsIn.disabled && {
|
|
319
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
320
|
+
focusable: void 0,
|
|
321
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
322
|
+
focusStyle: {
|
|
323
|
+
borderColor: "$background"
|
|
324
|
+
}
|
|
325
|
+
}), {
|
|
201
326
|
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
202
327
|
tag: tag ?? (isNested ? "span" : (
|
|
203
|
-
// defaults to <a /> when accessibilityRole = link
|
|
204
328
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
205
329
|
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
206
|
-
))
|
|
207
|
-
|
|
208
|
-
children: /* @__PURE__ */
|
|
330
|
+
))
|
|
331
|
+
}), restProps), {
|
|
332
|
+
children: /* @__PURE__ */ React.createElement(import_stacks.ButtonNestingContext.Provider, {
|
|
333
|
+
value: !0
|
|
334
|
+
}, inner),
|
|
209
335
|
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
210
336
|
disableClassName: !0
|
|
211
|
-
};
|
|
337
|
+
});
|
|
212
338
|
return {
|
|
213
339
|
spaceSize,
|
|
214
340
|
isNested,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["Button"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/button/src/Button.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAA4B,+BAC5B,0BAA+B,sCAC/B,iBAAqC,6BACrC,yBAAiC,qCACjC,gBAAqD,4BAErD,cAAgD,0BAEhD,aAMO,yBAEP,eAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIpB,IAAMA,oBAAgBC,gCAO3B;;EAEAC,OAAOC;EACPC,SAASD;EACTE,YAAYF;EACZG,UAAUH;EACVI,WAAWJ;EACXK,YAAYL;EACZM,eAAeN;EACfO,uBAAuBP;EACvBQ,MAAMR;EACNS,WAAWT;EACXU,SAASV;AACX,CAAA,GAyCMW,cAAc,UAEdC,kBAAcC,mBAAOC,8BAAgB;EACzCC,MAAMJ;EACNK,KAAK;EACLC,SAASpB;EACTqB,MAAM;EACNC,WAAW;EAEXC,UAAU;IACRC,UAAU;MACRC,OAAO;QACLd,MAAM;QACNe,gBAAgB;QAChBC,YAAY;QACZC,UAAU;QACVC,eAAe;QACfC,QAAQ;QACRC,YAAY;QACZC,YAAY;QACZC,cAAc;QACdC,aAAa;QACbC,aAAa;QAEbC,YAAY;UACVC,cAAc;UACdC,cAAc;UACdC,cAAc;QAChB;MACF;IACF;IAEA1B,SAAS;MACP2B,UAAU;Q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D,WAENI,oBAAgBC,yCAAiB;IACrCtD,MAAMmD;IACN5D;EACF,CAAA,GAEsC,OAAA,iBAAA;IAACkF;IAAMC;IAAWQ,IAAI7B,aAAAA,GAAAA,CAAAA,GAArD8B,aAA+B,KAAA,CAAA,GAAnBC,kBAAmB,KAAA,CAAA,GAChCC,YAAYV,aAASW,6BAAiBnC,QAAAA,IAAY0B,YAClDU,WAAWR,aACb;IAACX,QAAQpB;UACTwC,gCACEvB,MACA;IACEjB,UAAUoB,QAAQpB;IAClBtD;IACAC;IACAwE;IACAtE;IACAD;IACAE;IACAL;IACAM;EACF,GACAkE,SAASxB,cAAc8B,YAAY1D,aAAa,KAC5C;IACEA,UAAUyB,QAAQC,IAAIC,qBAAqB;IAC3CxC;EACF,IACAR,MAAAA,GAGJiG,YAAQC,2BAAe;;IAE3Bf,OAAOU;IACPT;IACAE;IACAa,WACEpB,YAAYrD,kBAAkB,YAC9BqD,YAAYrD,kBAAkB,mBAC1B,aACA;IACN8B,UAAU;MAACmC;MAAD,OAAa,qBAAGI,QAAAA,GAAhB;MAA0BH;KAAgB;EACtD,CAAA,GAEMrC,QAAQ,qBAAA,eAAA,qBAAA,eAAA;IACZ/C;KACIoE,QAAQlC,YAAY;;IAEtBvB,WAAWnB;;IAEXiC,YAAY;MACVD,aAAa;IACf;EACF,CAAA,GAAA;;IAEAhB,KACEA,QACC6D,WACG;;MAGAE,YAAYqB,sBAAsB,UAAUrB,YAAY7D,SAAS,SAC/D,MACA;;MACLsE,SAAAA,GAAAA;IACHhC,UACE,sBAAA,cAACsB,mCAAqBuB,UAAQ;MAACC,OAAO;OAAOL,KAAAA;;IAG/CM,kBAAkB;;AAGpB,SAAO;IACLV;IACAhB;IACAtB;EACF;AACF;",
|
|
5
|
+
"names": ["ButtonContext", "createStyledContext", "color", "undefined", "ellipse", "fontFamily", "fontSize", "fontStyle", "fontWeight", "letterSpacing", "maxFontSizeMultiplier", "size", "textAlign", "variant", "BUTTON_NAME", "ButtonFrame", "styled", "ThemeableStack", "name", "tag", "context", "role", "focusable", "variants", "unstyled", "false", "justifyContent", "alignItems", "flexWrap", "flexDirection", "cursor", "hoverTheme", "pressTheme", "backgrounded", "borderWidth", "borderColor", "focusStyle", "outlineColor", "outlineStyle", "outlineWidth", "outlined", "backgroundColor", "hoverStyle", "pressStyle", "getButtonSized", "disabled", "true", "pointerEvents", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ButtonText", "SizableText", "userSelect", "flexGrow", "flexShrink", "ButtonIcon", "props", "children", "scaleIcon", "useContext", "iconSize", "getFontSize", "getThemedIcon", "useGetThemedIcon", "ButtonComponent", "styleable", "ref", "useButton", "buttonProps", "buttonStaticConfig", "inlineProps", "Set", "Button", "withStaticProperties", "Text", "Icon", "textProps", "propsIn", "isNested", "ButtonNestingContext", "propsActive", "useProps", "icon", "iconAfter", "space", "spaceFlex", "scaleSpace", "separator", "noTextWrap", "restProps", "font", "map", "themedIcon", "themedIconAfter", "spaceSize", "getVariableValue", "contents", "wrapChildrenInText", "inner", "spacedChildren", "direction", "accessibilityRole", "Provider", "value", "disableClassName"]
|
|
6
6
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var import_config_default = require("@tamagui/config-default"), import_core = require("@tamagui/core"), import_vitest = require("vitest");
|
|
3
|
-
|
|
4
|
-
(0, import_vitest.
|
|
5
|
-
(0, import_vitest.test)("123", () => {
|
|
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() {
|
|
6
5
|
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
7
6
|
});
|
|
8
7
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
-
"mappings": ";AAAA,4BAAwC,oCACxC,cAA8B,0BAC9B,gBAAuC
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/button/src/Button.test.tsx"],
|
|
4
|
+
"mappings": ";AAAA,4BAAwC,oCACxC,cAA8B,0BAC9B,gBAAuC,mBAEjCA,WAAOC,+BAAcC,+CAAAA,CAAAA;IAE3BC,wBAAS,UAAU,WAAA;AACjBC,0BAAM,OAAM,WAAA;AACVC,8BAAO,EAAA,EAAMC,WAAU;EACzB,CAAA;AAWF,CAAA;",
|
|
5
|
+
"names": ["conf", "createTamagui", "getDefaultTamaguiConfig", "describe", "test", "expect", "toBeTruthy"]
|
|
6
6
|
}
|
|
@@ -4,16 +4,123 @@ import { withStaticProperties } from "@tamagui/helpers";
|
|
|
4
4
|
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
5
5
|
import { ButtonNestingContext, ThemeableStack } from "@tamagui/stacks";
|
|
6
6
|
import { SizableText, wrapChildrenInText } from "@tamagui/text";
|
|
7
|
-
import {
|
|
8
|
-
createStyledContext,
|
|
9
|
-
getVariableValue,
|
|
10
|
-
spacedChildren,
|
|
11
|
-
styled,
|
|
12
|
-
useProps
|
|
13
|
-
} from "@tamagui/web";
|
|
7
|
+
import { createStyledContext, getVariableValue, spacedChildren, styled, useProps } from "@tamagui/web";
|
|
14
8
|
import { useContext } from "react";
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
function _array_like_to_array(arr, len) {
|
|
10
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
11
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
12
|
+
arr2[i] = arr[i];
|
|
13
|
+
return arr2;
|
|
14
|
+
}
|
|
15
|
+
function _array_with_holes(arr) {
|
|
16
|
+
if (Array.isArray(arr))
|
|
17
|
+
return arr;
|
|
18
|
+
}
|
|
19
|
+
function _array_without_holes(arr) {
|
|
20
|
+
if (Array.isArray(arr))
|
|
21
|
+
return _array_like_to_array(arr);
|
|
22
|
+
}
|
|
23
|
+
function _define_property(obj, key, value) {
|
|
24
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
25
|
+
value,
|
|
26
|
+
enumerable: !0,
|
|
27
|
+
configurable: !0,
|
|
28
|
+
writable: !0
|
|
29
|
+
}) : obj[key] = value, obj;
|
|
30
|
+
}
|
|
31
|
+
function _iterable_to_array(iter) {
|
|
32
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
33
|
+
return Array.from(iter);
|
|
34
|
+
}
|
|
35
|
+
function _iterable_to_array_limit(arr, i) {
|
|
36
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
37
|
+
if (_i != null) {
|
|
38
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
39
|
+
try {
|
|
40
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
41
|
+
;
|
|
42
|
+
} catch (err) {
|
|
43
|
+
_d = !0, _e = err;
|
|
44
|
+
} finally {
|
|
45
|
+
try {
|
|
46
|
+
!_n && _i.return != null && _i.return();
|
|
47
|
+
} finally {
|
|
48
|
+
if (_d)
|
|
49
|
+
throw _e;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return _arr;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function _non_iterable_rest() {
|
|
56
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
+
}
|
|
58
|
+
function _non_iterable_spread() {
|
|
59
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
60
|
+
}
|
|
61
|
+
function _object_spread(target) {
|
|
62
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
63
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
64
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
65
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
66
|
+
}))), ownKeys2.forEach(function(key) {
|
|
67
|
+
_define_property(target, key, source[key]);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
function ownKeys(object, enumerableOnly) {
|
|
73
|
+
var keys = Object.keys(object);
|
|
74
|
+
if (Object.getOwnPropertySymbols) {
|
|
75
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
76
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
77
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
78
|
+
})), keys.push.apply(keys, symbols);
|
|
79
|
+
}
|
|
80
|
+
return keys;
|
|
81
|
+
}
|
|
82
|
+
function _object_spread_props(target, source) {
|
|
83
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
84
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
85
|
+
}), target;
|
|
86
|
+
}
|
|
87
|
+
function _object_without_properties(source, excluded) {
|
|
88
|
+
if (source == null)
|
|
89
|
+
return {};
|
|
90
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
91
|
+
if (Object.getOwnPropertySymbols) {
|
|
92
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
93
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
94
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
95
|
+
}
|
|
96
|
+
return target;
|
|
97
|
+
}
|
|
98
|
+
function _object_without_properties_loose(source, excluded) {
|
|
99
|
+
if (source == null)
|
|
100
|
+
return {};
|
|
101
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
102
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
103
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
104
|
+
return target;
|
|
105
|
+
}
|
|
106
|
+
function _sliced_to_array(arr, i) {
|
|
107
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
108
|
+
}
|
|
109
|
+
function _to_consumable_array(arr) {
|
|
110
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
111
|
+
}
|
|
112
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
113
|
+
if (o) {
|
|
114
|
+
if (typeof o == "string")
|
|
115
|
+
return _array_like_to_array(o, minLen);
|
|
116
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
117
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
118
|
+
return Array.from(n);
|
|
119
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
120
|
+
return _array_like_to_array(o, minLen);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
var ButtonContext = createStyledContext({
|
|
17
124
|
// keeping these here means they work with styled() passing down color to text
|
|
18
125
|
color: void 0,
|
|
19
126
|
ellipse: void 0,
|
|
@@ -103,15 +210,18 @@ const ButtonContext = createStyledContext({
|
|
|
103
210
|
defaultVariants: {
|
|
104
211
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
105
212
|
}
|
|
106
|
-
}), ButtonIcon = (props)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
213
|
+
}), ButtonIcon = function(props) {
|
|
214
|
+
var children = props.children, _props_scaleIcon = props.scaleIcon, scaleIcon = _props_scaleIcon === void 0 ? 1 : _props_scaleIcon, _useContext = useContext(ButtonContext), size = _useContext.size, color = _useContext.color, iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon, getThemedIcon = useGetThemedIcon({
|
|
215
|
+
size: iconSize,
|
|
216
|
+
color
|
|
217
|
+
});
|
|
218
|
+
return getThemedIcon(children);
|
|
219
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
220
|
+
var _useButton = useButton(props), buttonProps = _useButton.props;
|
|
221
|
+
return /* @__PURE__ */ React.createElement(ButtonFrame, _object_spread_props(_object_spread({}, buttonProps), {
|
|
222
|
+
ref
|
|
223
|
+
}));
|
|
224
|
+
}), buttonStaticConfig = {
|
|
115
225
|
inlineProps: /* @__PURE__ */ new Set([
|
|
116
226
|
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
117
227
|
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
@@ -128,75 +238,84 @@ const ButtonContext = createStyledContext({
|
|
|
128
238
|
Text: ButtonText,
|
|
129
239
|
Icon: ButtonIcon
|
|
130
240
|
});
|
|
131
|
-
function useButton(
|
|
132
|
-
|
|
241
|
+
function useButton(_param) {
|
|
242
|
+
var _$_param = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
243
|
+
Text: Button2.Text
|
|
244
|
+
}, textProps = _param.textProps, propsIn = _object_without_properties(_param, [
|
|
245
|
+
"textProps"
|
|
246
|
+
]), _param_Text = _$_param.Text, Text = _param_Text === void 0 ? Button2.Text : _param_Text, isNested = useContext(ButtonNestingContext), propsActive = useProps(propsIn), icon = propsActive.icon, iconAfter = propsActive.iconAfter, space = propsActive.space, spaceFlex = propsActive.spaceFlex, _propsActive_scaleIcon = propsActive.scaleIcon, scaleIcon = _propsActive_scaleIcon === void 0 ? 1 : _propsActive_scaleIcon, _propsActive_scaleSpace = propsActive.scaleSpace, scaleSpace = _propsActive_scaleSpace === void 0 ? 0.66 : _propsActive_scaleSpace, separator = propsActive.separator, noTextWrap = propsActive.noTextWrap, fontFamily = propsActive.fontFamily, fontSize = propsActive.fontSize, fontWeight = propsActive.fontWeight, fontStyle = propsActive.fontStyle, letterSpacing = propsActive.letterSpacing, tag = propsActive.tag, ellipse = propsActive.ellipse, maxFontSizeMultiplier = propsActive.maxFontSizeMultiplier, restProps = _object_without_properties(propsActive, [
|
|
247
|
+
"icon",
|
|
248
|
+
"iconAfter",
|
|
249
|
+
"space",
|
|
250
|
+
"spaceFlex",
|
|
251
|
+
"scaleIcon",
|
|
252
|
+
"scaleSpace",
|
|
253
|
+
"separator",
|
|
254
|
+
"noTextWrap",
|
|
255
|
+
"fontFamily",
|
|
256
|
+
"fontSize",
|
|
257
|
+
"fontWeight",
|
|
258
|
+
"fontStyle",
|
|
259
|
+
"letterSpacing",
|
|
260
|
+
"tag",
|
|
261
|
+
"ellipse",
|
|
262
|
+
"maxFontSizeMultiplier"
|
|
263
|
+
]), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), color = propsActive.color, iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size, {
|
|
264
|
+
font: (fontFamily == null ? void 0 : fontFamily[0]) === "$" ? fontFamily : void 0
|
|
265
|
+
})) * scaleIcon, getThemedIcon = useGetThemedIcon({
|
|
266
|
+
size: iconSize,
|
|
267
|
+
color
|
|
268
|
+
}), _map = _sliced_to_array([
|
|
133
269
|
icon,
|
|
134
|
-
iconAfter
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
separator,
|
|
140
|
-
noTextWrap,
|
|
270
|
+
iconAfter
|
|
271
|
+
].map(getThemedIcon), 2), themedIcon = _map[0], themedIconAfter = _map[1], spaceSize = space ?? getVariableValue(iconSize) * scaleSpace, contents = noTextWrap ? [
|
|
272
|
+
propsIn.children
|
|
273
|
+
] : wrapChildrenInText(Text, {
|
|
274
|
+
children: propsIn.children,
|
|
141
275
|
fontFamily,
|
|
142
276
|
fontSize,
|
|
277
|
+
textProps,
|
|
143
278
|
fontWeight,
|
|
144
279
|
fontStyle,
|
|
145
280
|
letterSpacing,
|
|
146
|
-
tag,
|
|
147
281
|
ellipse,
|
|
148
|
-
maxFontSizeMultiplier
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
size: iconSize,
|
|
154
|
-
color
|
|
155
|
-
}), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = space ?? getVariableValue(iconSize) * scaleSpace, contents = noTextWrap ? [propsIn.children] : wrapChildrenInText(
|
|
156
|
-
Text,
|
|
157
|
-
{
|
|
158
|
-
children: propsIn.children,
|
|
159
|
-
fontFamily,
|
|
160
|
-
fontSize,
|
|
161
|
-
textProps,
|
|
162
|
-
fontWeight,
|
|
163
|
-
fontStyle,
|
|
164
|
-
letterSpacing,
|
|
165
|
-
ellipse,
|
|
166
|
-
maxFontSizeMultiplier
|
|
167
|
-
},
|
|
168
|
-
Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
169
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
170
|
-
size
|
|
171
|
-
} : void 0
|
|
172
|
-
), inner = spacedChildren({
|
|
282
|
+
maxFontSizeMultiplier
|
|
283
|
+
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
284
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
285
|
+
size
|
|
286
|
+
} : void 0), inner = spacedChildren({
|
|
173
287
|
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
174
288
|
space: spaceSize,
|
|
175
289
|
spaceFlex,
|
|
176
290
|
separator,
|
|
177
291
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
178
|
-
children: [
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
292
|
+
children: [
|
|
293
|
+
themedIcon
|
|
294
|
+
].concat(_to_consumable_array(contents), [
|
|
295
|
+
themedIconAfter
|
|
296
|
+
])
|
|
297
|
+
}), props = _object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
298
|
+
size
|
|
299
|
+
}, propsIn.disabled && {
|
|
300
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
301
|
+
focusable: void 0,
|
|
302
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
303
|
+
focusStyle: {
|
|
304
|
+
borderColor: "$background"
|
|
305
|
+
}
|
|
306
|
+
}), {
|
|
189
307
|
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
190
308
|
tag: tag ?? (isNested ? "span" : (
|
|
191
|
-
// defaults to <a /> when accessibilityRole = link
|
|
192
309
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
193
310
|
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
194
|
-
))
|
|
195
|
-
|
|
196
|
-
children: /* @__PURE__ */
|
|
311
|
+
))
|
|
312
|
+
}), restProps), {
|
|
313
|
+
children: /* @__PURE__ */ React.createElement(ButtonNestingContext.Provider, {
|
|
314
|
+
value: !0
|
|
315
|
+
}, inner),
|
|
197
316
|
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
198
317
|
disableClassName: !0
|
|
199
|
-
};
|
|
318
|
+
});
|
|
200
319
|
return {
|
|
201
320
|
spaceSize,
|
|
202
321
|
isNested,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": ["Button"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/button/src/Button.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MACA;IACEb,UAAUgB,QAAQhB;IAClBlD;IACAC;IACAgE;IACA9D;IACAD;IACAE;IACAL;IACAM;EACF,GACA0D,SAASnB,cAAcwB,YAAYnD,aAAa,KAC5C;IACEA,UAAUwB,QAAQC,IAAIC,qBAAqB;IAC3CrC;EACF,IACAR,MAAAA,GAGJqF,QAAQ3F,eAAe;;IAE3B+E,OAAOU;IACPT;IACAE;IACAU,WACEhB,YAAY9C,kBAAkB,YAC9B8C,YAAY9C,kBAAkB,mBAC1B,aACA;IACN4B,UAAU;MAAC6B;MAAD,OAAa,qBAAGG,QAAAA,GAAhB;MAA0BF;KAAgB;EACtD,CAAA,GAEM/B,QAAQ,qBAAA,eAAA,qBAAA,eAAA;IACZ3C;KACI4D,QAAQ7B,YAAY;;IAEtBtB,WAAWjB;;IAEX+B,YAAY;MACVD,aAAa;IACf;EACF,CAAA,GAAA;;IAEAhB,KACEA,QACCuD,WACG;;MAGAC,YAAYiB,sBAAsB,UAAUjB,YAAYtD,SAAS,SAC/D,MACA;;MACL8D,SAAAA,GAAAA;IACH1B,UACE,sBAAA,cAAChE,qBAAqBoG,UAAQ;MAACC,OAAO;OAAOJ,KAAAA;;IAG/CK,kBAAkB;;AAGpB,SAAO;IACLP;IACAd;IACAlB;EACF;AACF;",
|
|
5
|
+
"names": ["getFontSize", "getButtonSized", "withStaticProperties", "useGetThemedIcon", "ButtonNestingContext", "ThemeableStack", "SizableText", "wrapChildrenInText", "createStyledContext", "getVariableValue", "spacedChildren", "styled", "useProps", "useContext", "ButtonContext", "color", "undefined", "ellipse", "fontFamily", "fontSize", "fontStyle", "fontWeight", "letterSpacing", "maxFontSizeMultiplier", "size", "textAlign", "variant", "BUTTON_NAME", "ButtonFrame", "name", "tag", "context", "role", "focusable", "variants", "unstyled", "false", "justifyContent", "alignItems", "flexWrap", "flexDirection", "cursor", "hoverTheme", "pressTheme", "backgrounded", "borderWidth", "borderColor", "focusStyle", "outlineColor", "outlineStyle", "outlineWidth", "outlined", "backgroundColor", "hoverStyle", "pressStyle", "disabled", "true", "pointerEvents", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ButtonText", "userSelect", "flexGrow", "flexShrink", "ButtonIcon", "props", "children", "scaleIcon", "iconSize", "getThemedIcon", "ButtonComponent", "styleable", "ref", "useButton", "buttonProps", "buttonStaticConfig", "inlineProps", "Set", "Button", "Text", "Icon", "textProps", "propsIn", "isNested", "propsActive", "icon", "iconAfter", "space", "spaceFlex", "scaleSpace", "separator", "noTextWrap", "restProps", "font", "map", "themedIcon", "themedIconAfter", "spaceSize", "contents", "inner", "direction", "accessibilityRole", "Provider", "value", "disableClassName"]
|
|
6
6
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
2
2
|
import { createTamagui } from "@tamagui/core";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
|
|
5
|
-
describe("Button", ()
|
|
6
|
-
test("123", ()
|
|
4
|
+
var conf = createTamagui(getDefaultTamaguiConfig());
|
|
5
|
+
describe("Button", function() {
|
|
6
|
+
test("123", function() {
|
|
7
7
|
expect(!0).toBeTruthy();
|
|
8
8
|
});
|
|
9
9
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/button/src/Button.test.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,+BAA+B;AACxC,SAASC,qBAAqB;AAC9B,SAASC,UAAUC,QAAQC,YAAY;AAEvC,IAAMC,OAAOJ,cAAcD,wBAAAA,CAAAA;AAE3BE,SAAS,UAAU,WAAA;AACjBE,OAAM,OAAM,WAAA;AACVD,WAAO,EAAA,EAAMG,WAAU;EACzB,CAAA;AAWF,CAAA;",
|
|
5
|
+
"names": ["getDefaultTamaguiConfig", "createTamagui", "describe", "expect", "test", "conf", "toBeTruthy"]
|
|
6
6
|
}
|
|
@@ -4,16 +4,123 @@ import { withStaticProperties } from "@tamagui/helpers";
|
|
|
4
4
|
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
5
5
|
import { ButtonNestingContext, ThemeableStack } from "@tamagui/stacks";
|
|
6
6
|
import { SizableText, wrapChildrenInText } from "@tamagui/text";
|
|
7
|
-
import {
|
|
8
|
-
createStyledContext,
|
|
9
|
-
getVariableValue,
|
|
10
|
-
spacedChildren,
|
|
11
|
-
styled,
|
|
12
|
-
useProps
|
|
13
|
-
} from "@tamagui/web";
|
|
7
|
+
import { createStyledContext, getVariableValue, spacedChildren, styled, useProps } from "@tamagui/web";
|
|
14
8
|
import { useContext } from "react";
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
function _array_like_to_array(arr, len) {
|
|
10
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
11
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
12
|
+
arr2[i] = arr[i];
|
|
13
|
+
return arr2;
|
|
14
|
+
}
|
|
15
|
+
function _array_with_holes(arr) {
|
|
16
|
+
if (Array.isArray(arr))
|
|
17
|
+
return arr;
|
|
18
|
+
}
|
|
19
|
+
function _array_without_holes(arr) {
|
|
20
|
+
if (Array.isArray(arr))
|
|
21
|
+
return _array_like_to_array(arr);
|
|
22
|
+
}
|
|
23
|
+
function _define_property(obj, key, value) {
|
|
24
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
25
|
+
value,
|
|
26
|
+
enumerable: !0,
|
|
27
|
+
configurable: !0,
|
|
28
|
+
writable: !0
|
|
29
|
+
}) : obj[key] = value, obj;
|
|
30
|
+
}
|
|
31
|
+
function _iterable_to_array(iter) {
|
|
32
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
33
|
+
return Array.from(iter);
|
|
34
|
+
}
|
|
35
|
+
function _iterable_to_array_limit(arr, i) {
|
|
36
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
37
|
+
if (_i != null) {
|
|
38
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
39
|
+
try {
|
|
40
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
41
|
+
;
|
|
42
|
+
} catch (err) {
|
|
43
|
+
_d = !0, _e = err;
|
|
44
|
+
} finally {
|
|
45
|
+
try {
|
|
46
|
+
!_n && _i.return != null && _i.return();
|
|
47
|
+
} finally {
|
|
48
|
+
if (_d)
|
|
49
|
+
throw _e;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return _arr;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function _non_iterable_rest() {
|
|
56
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
+
}
|
|
58
|
+
function _non_iterable_spread() {
|
|
59
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
60
|
+
}
|
|
61
|
+
function _object_spread(target) {
|
|
62
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
63
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
64
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
65
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
66
|
+
}))), ownKeys2.forEach(function(key) {
|
|
67
|
+
_define_property(target, key, source[key]);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
function ownKeys(object, enumerableOnly) {
|
|
73
|
+
var keys = Object.keys(object);
|
|
74
|
+
if (Object.getOwnPropertySymbols) {
|
|
75
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
76
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
77
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
78
|
+
})), keys.push.apply(keys, symbols);
|
|
79
|
+
}
|
|
80
|
+
return keys;
|
|
81
|
+
}
|
|
82
|
+
function _object_spread_props(target, source) {
|
|
83
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
84
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
85
|
+
}), target;
|
|
86
|
+
}
|
|
87
|
+
function _object_without_properties(source, excluded) {
|
|
88
|
+
if (source == null)
|
|
89
|
+
return {};
|
|
90
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
91
|
+
if (Object.getOwnPropertySymbols) {
|
|
92
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
93
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
94
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
95
|
+
}
|
|
96
|
+
return target;
|
|
97
|
+
}
|
|
98
|
+
function _object_without_properties_loose(source, excluded) {
|
|
99
|
+
if (source == null)
|
|
100
|
+
return {};
|
|
101
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
102
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
103
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
104
|
+
return target;
|
|
105
|
+
}
|
|
106
|
+
function _sliced_to_array(arr, i) {
|
|
107
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
108
|
+
}
|
|
109
|
+
function _to_consumable_array(arr) {
|
|
110
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
111
|
+
}
|
|
112
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
113
|
+
if (o) {
|
|
114
|
+
if (typeof o == "string")
|
|
115
|
+
return _array_like_to_array(o, minLen);
|
|
116
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
117
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
118
|
+
return Array.from(n);
|
|
119
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
120
|
+
return _array_like_to_array(o, minLen);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
var ButtonContext = createStyledContext({
|
|
17
124
|
// keeping these here means they work with styled() passing down color to text
|
|
18
125
|
color: void 0,
|
|
19
126
|
ellipse: void 0,
|
|
@@ -103,15 +210,18 @@ const ButtonContext = createStyledContext({
|
|
|
103
210
|
defaultVariants: {
|
|
104
211
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
105
212
|
}
|
|
106
|
-
}), ButtonIcon = (props)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
213
|
+
}), ButtonIcon = function(props) {
|
|
214
|
+
var children = props.children, _props_scaleIcon = props.scaleIcon, scaleIcon = _props_scaleIcon === void 0 ? 1 : _props_scaleIcon, _useContext = useContext(ButtonContext), size = _useContext.size, color = _useContext.color, iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon, getThemedIcon = useGetThemedIcon({
|
|
215
|
+
size: iconSize,
|
|
216
|
+
color
|
|
217
|
+
});
|
|
218
|
+
return getThemedIcon(children);
|
|
219
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
220
|
+
var _useButton = useButton(props), buttonProps = _useButton.props;
|
|
221
|
+
return /* @__PURE__ */ React.createElement(ButtonFrame, _object_spread_props(_object_spread({}, buttonProps), {
|
|
222
|
+
ref
|
|
223
|
+
}));
|
|
224
|
+
}), buttonStaticConfig = {
|
|
115
225
|
inlineProps: /* @__PURE__ */ new Set([
|
|
116
226
|
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
117
227
|
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
@@ -128,75 +238,84 @@ const ButtonContext = createStyledContext({
|
|
|
128
238
|
Text: ButtonText,
|
|
129
239
|
Icon: ButtonIcon
|
|
130
240
|
});
|
|
131
|
-
function useButton(
|
|
132
|
-
|
|
241
|
+
function useButton(_param) {
|
|
242
|
+
var _$_param = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
243
|
+
Text: Button2.Text
|
|
244
|
+
}, textProps = _param.textProps, propsIn = _object_without_properties(_param, [
|
|
245
|
+
"textProps"
|
|
246
|
+
]), _param_Text = _$_param.Text, Text = _param_Text === void 0 ? Button2.Text : _param_Text, isNested = useContext(ButtonNestingContext), propsActive = useProps(propsIn), icon = propsActive.icon, iconAfter = propsActive.iconAfter, space = propsActive.space, spaceFlex = propsActive.spaceFlex, _propsActive_scaleIcon = propsActive.scaleIcon, scaleIcon = _propsActive_scaleIcon === void 0 ? 1 : _propsActive_scaleIcon, _propsActive_scaleSpace = propsActive.scaleSpace, scaleSpace = _propsActive_scaleSpace === void 0 ? 0.66 : _propsActive_scaleSpace, separator = propsActive.separator, noTextWrap = propsActive.noTextWrap, fontFamily = propsActive.fontFamily, fontSize = propsActive.fontSize, fontWeight = propsActive.fontWeight, fontStyle = propsActive.fontStyle, letterSpacing = propsActive.letterSpacing, tag = propsActive.tag, ellipse = propsActive.ellipse, maxFontSizeMultiplier = propsActive.maxFontSizeMultiplier, restProps = _object_without_properties(propsActive, [
|
|
247
|
+
"icon",
|
|
248
|
+
"iconAfter",
|
|
249
|
+
"space",
|
|
250
|
+
"spaceFlex",
|
|
251
|
+
"scaleIcon",
|
|
252
|
+
"scaleSpace",
|
|
253
|
+
"separator",
|
|
254
|
+
"noTextWrap",
|
|
255
|
+
"fontFamily",
|
|
256
|
+
"fontSize",
|
|
257
|
+
"fontWeight",
|
|
258
|
+
"fontStyle",
|
|
259
|
+
"letterSpacing",
|
|
260
|
+
"tag",
|
|
261
|
+
"ellipse",
|
|
262
|
+
"maxFontSizeMultiplier"
|
|
263
|
+
]), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), color = propsActive.color, iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size, {
|
|
264
|
+
font: (fontFamily == null ? void 0 : fontFamily[0]) === "$" ? fontFamily : void 0
|
|
265
|
+
})) * scaleIcon, getThemedIcon = useGetThemedIcon({
|
|
266
|
+
size: iconSize,
|
|
267
|
+
color
|
|
268
|
+
}), _map = _sliced_to_array([
|
|
133
269
|
icon,
|
|
134
|
-
iconAfter
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
separator,
|
|
140
|
-
noTextWrap,
|
|
270
|
+
iconAfter
|
|
271
|
+
].map(getThemedIcon), 2), themedIcon = _map[0], themedIconAfter = _map[1], spaceSize = space ?? getVariableValue(iconSize) * scaleSpace, contents = noTextWrap ? [
|
|
272
|
+
propsIn.children
|
|
273
|
+
] : wrapChildrenInText(Text, {
|
|
274
|
+
children: propsIn.children,
|
|
141
275
|
fontFamily,
|
|
142
276
|
fontSize,
|
|
277
|
+
textProps,
|
|
143
278
|
fontWeight,
|
|
144
279
|
fontStyle,
|
|
145
280
|
letterSpacing,
|
|
146
|
-
tag,
|
|
147
281
|
ellipse,
|
|
148
|
-
maxFontSizeMultiplier
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
size: iconSize,
|
|
154
|
-
color
|
|
155
|
-
}), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = space ?? getVariableValue(iconSize) * scaleSpace, contents = noTextWrap ? [propsIn.children] : wrapChildrenInText(
|
|
156
|
-
Text,
|
|
157
|
-
{
|
|
158
|
-
children: propsIn.children,
|
|
159
|
-
fontFamily,
|
|
160
|
-
fontSize,
|
|
161
|
-
textProps,
|
|
162
|
-
fontWeight,
|
|
163
|
-
fontStyle,
|
|
164
|
-
letterSpacing,
|
|
165
|
-
ellipse,
|
|
166
|
-
maxFontSizeMultiplier
|
|
167
|
-
},
|
|
168
|
-
Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
169
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
170
|
-
size
|
|
171
|
-
} : void 0
|
|
172
|
-
), inner = spacedChildren({
|
|
282
|
+
maxFontSizeMultiplier
|
|
283
|
+
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
284
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
285
|
+
size
|
|
286
|
+
} : void 0), inner = spacedChildren({
|
|
173
287
|
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
174
288
|
space: spaceSize,
|
|
175
289
|
spaceFlex,
|
|
176
290
|
separator,
|
|
177
291
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
178
|
-
children: [
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
292
|
+
children: [
|
|
293
|
+
themedIcon
|
|
294
|
+
].concat(_to_consumable_array(contents), [
|
|
295
|
+
themedIconAfter
|
|
296
|
+
])
|
|
297
|
+
}), props = _object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
298
|
+
size
|
|
299
|
+
}, propsIn.disabled && {
|
|
300
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
301
|
+
focusable: void 0,
|
|
302
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
303
|
+
focusStyle: {
|
|
304
|
+
borderColor: "$background"
|
|
305
|
+
}
|
|
306
|
+
}), {
|
|
189
307
|
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
190
308
|
tag: tag ?? (isNested ? "span" : (
|
|
191
|
-
// defaults to <a /> when accessibilityRole = link
|
|
192
309
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
193
310
|
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
194
|
-
))
|
|
195
|
-
|
|
196
|
-
children: /* @__PURE__ */
|
|
311
|
+
))
|
|
312
|
+
}), restProps), {
|
|
313
|
+
children: /* @__PURE__ */ React.createElement(ButtonNestingContext.Provider, {
|
|
314
|
+
value: !0
|
|
315
|
+
}, inner),
|
|
197
316
|
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
198
317
|
disableClassName: !0
|
|
199
|
-
};
|
|
318
|
+
});
|
|
200
319
|
return {
|
|
201
320
|
spaceSize,
|
|
202
321
|
isNested,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": ["Button"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/button/src/Button.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAC5B,SAASC,sBAAsB;AAC/B,SAASC,4BAA4B;AACrC,SAASC,wBAAwB;AACjC,SAASC,sBAAsBC,sBAAsB;AAErD,SAASC,aAAaC,0BAA0B;AAEhD,SACEC,qBACAC,kBACAC,gBACAC,QACAC,gBACK;AAEP,SAASC,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIpB,IAAMC,gBAAgBN,o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AAA,GAEM/B,QAAQ,qBAAA,eAAA,qBAAA,eAAA;IACZ3C;KACI4D,QAAQ7B,YAAY;;IAEtBtB,WAAWjB;;IAEX+B,YAAY;MACVD,aAAa;IACf;EACF,CAAA,GAAA;;IAEAhB,KACEA,QACCuD,WACG;;MAGAC,YAAYiB,sBAAsB,UAAUjB,YAAYtD,SAAS,SAC/D,MACA;;MACL8D,SAAAA,GAAAA;IACH1B,UACE,sBAAA,cAAChE,qBAAqBoG,UAAQ;MAACC,OAAO;OAAOJ,KAAAA;;IAG/CK,kBAAkB;;AAGpB,SAAO;IACLP;IACAd;IACAlB;EACF;AACF;",
|
|
5
|
+
"names": ["getFontSize", "getButtonSized", "withStaticProperties", "useGetThemedIcon", "ButtonNestingContext", "ThemeableStack", "SizableText", "wrapChildrenInText", "createStyledContext", "getVariableValue", "spacedChildren", "styled", "useProps", "useContext", "ButtonContext", "color", "undefined", "ellipse", "fontFamily", "fontSize", "fontStyle", "fontWeight", "letterSpacing", "maxFontSizeMultiplier", "size", "textAlign", "variant", "BUTTON_NAME", "ButtonFrame", "name", "tag", "context", "role", "focusable", "variants", "unstyled", "false", "justifyContent", "alignItems", "flexWrap", "flexDirection", "cursor", "hoverTheme", "pressTheme", "backgrounded", "borderWidth", "borderColor", "focusStyle", "outlineColor", "outlineStyle", "outlineWidth", "outlined", "backgroundColor", "hoverStyle", "pressStyle", "disabled", "true", "pointerEvents", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ButtonText", "userSelect", "flexGrow", "flexShrink", "ButtonIcon", "props", "children", "scaleIcon", "iconSize", "getThemedIcon", "ButtonComponent", "styleable", "ref", "useButton", "buttonProps", "buttonStaticConfig", "inlineProps", "Set", "Button", "Text", "Icon", "textProps", "propsIn", "isNested", "propsActive", "icon", "iconAfter", "space", "spaceFlex", "scaleSpace", "separator", "noTextWrap", "restProps", "font", "map", "themedIcon", "themedIconAfter", "spaceSize", "contents", "inner", "direction", "accessibilityRole", "Provider", "value", "disableClassName"]
|
|
6
6
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
2
2
|
import { createTamagui } from "@tamagui/core";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
|
|
5
|
-
describe("Button", ()
|
|
6
|
-
test("123", ()
|
|
4
|
+
var conf = createTamagui(getDefaultTamaguiConfig());
|
|
5
|
+
describe("Button", function() {
|
|
6
|
+
test("123", function() {
|
|
7
7
|
expect(!0).toBeTruthy();
|
|
8
8
|
});
|
|
9
9
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/button/src/Button.test.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,+BAA+B;AACxC,SAASC,qBAAqB;AAC9B,SAASC,UAAUC,QAAQC,YAAY;AAEvC,IAAMC,OAAOJ,cAAcD,wBAAAA,CAAAA;AAE3BE,SAAS,UAAU,WAAA;AACjBE,OAAM,OAAM,WAAA;AACVD,WAAO,EAAA,EAAMG,WAAU;EACzB,CAAA;AAWF,CAAA;",
|
|
5
|
+
"names": ["getDefaultTamaguiConfig", "createTamagui", "describe", "expect", "test", "conf", "toBeTruthy"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/button",
|
|
3
|
-
"version": "1.89.
|
|
3
|
+
"version": "1.89.27-1708112217600",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tamagui/font-size": "1.89.
|
|
36
|
-
"@tamagui/get-button-sized": "1.89.
|
|
37
|
-
"@tamagui/helpers": "1.89.
|
|
38
|
-
"@tamagui/helpers-tamagui": "1.89.
|
|
39
|
-
"@tamagui/stacks": "1.89.
|
|
40
|
-
"@tamagui/text": "1.89.
|
|
41
|
-
"@tamagui/web": "1.89.
|
|
35
|
+
"@tamagui/font-size": "1.89.27-1708112217600",
|
|
36
|
+
"@tamagui/get-button-sized": "1.89.27-1708112217600",
|
|
37
|
+
"@tamagui/helpers": "1.89.27-1708112217600",
|
|
38
|
+
"@tamagui/helpers-tamagui": "1.89.27-1708112217600",
|
|
39
|
+
"@tamagui/stacks": "1.89.27-1708112217600",
|
|
40
|
+
"@tamagui/text": "1.89.27-1708112217600",
|
|
41
|
+
"@tamagui/web": "1.89.27-1708112217600"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "*"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@tamagui/build": "1.89.
|
|
47
|
+
"@tamagui/build": "1.89.27-1708112217600",
|
|
48
48
|
"react": "^18.2.0",
|
|
49
49
|
"vitest": "^0.34.3"
|
|
50
50
|
},
|