@tamagui/button 1.61.3 → 1.62.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Button.js +29 -62
- package/dist/cjs/Button.js.map +1 -1
- package/dist/cjs/Button.native.js +202 -0
- package/dist/cjs/Button.native.js.map +6 -0
- package/dist/cjs/Button.test.js +3 -7
- package/dist/cjs/Button.test.js.map +1 -1
- package/dist/cjs/Button.test.native.js +9 -0
- package/dist/cjs/Button.test.native.js.map +6 -0
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +20 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/esm/Button.js +24 -46
- package/dist/esm/Button.js.map +1 -1
- package/dist/esm/Button.test.js +2 -3
- package/dist/esm/Button.test.js.map +1 -1
- package/dist/jsx/Button.js +23 -45
- package/dist/jsx/Button.js.map +1 -1
- package/dist/jsx/Button.native.js +190 -0
- package/dist/jsx/Button.native.js.map +6 -0
- package/dist/jsx/Button.test.js +2 -3
- package/dist/jsx/Button.test.js.map +1 -1
- package/dist/jsx/Button.test.native.js +10 -0
- package/dist/jsx/Button.test.native.js.map +6 -0
- package/dist/jsx/index.native.js +2 -0
- package/dist/jsx/index.native.js.map +6 -0
- package/package.json +7 -7
- package/src/Button.test.tsx +0 -2
package/dist/cjs/Button.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
10
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
15
|
var Button_exports = {};
|
|
20
16
|
__export(Button_exports, {
|
|
21
17
|
Button: () => Button2,
|
|
@@ -28,21 +24,12 @@ __export(Button_exports, {
|
|
|
28
24
|
useButton: () => useButton
|
|
29
25
|
});
|
|
30
26
|
module.exports = __toCommonJS(Button_exports);
|
|
31
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
|
|
33
|
-
var import_get_button_sized = require("@tamagui/get-button-sized");
|
|
34
|
-
var import_helpers_tamagui = require("@tamagui/helpers-tamagui");
|
|
35
|
-
var import_stacks = require("@tamagui/stacks");
|
|
36
|
-
var import_text = require("@tamagui/text");
|
|
37
|
-
var import_web = require("@tamagui/web");
|
|
38
|
-
var import_react = require("react");
|
|
39
|
-
const ButtonContext = (0, import_web.createStyledContext)({});
|
|
40
|
-
const BUTTON_NAME = "Button";
|
|
41
|
-
const ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
27
|
+
var import_font_size = require("@tamagui/font-size"), import_get_button_sized = require("@tamagui/get-button-sized"), 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"), import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
const ButtonContext = (0, import_web.createStyledContext)({}), BUTTON_NAME = "Button", ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
42
29
|
name: BUTTON_NAME,
|
|
43
30
|
tag: "button",
|
|
44
31
|
context: ButtonContext,
|
|
45
|
-
focusable:
|
|
32
|
+
focusable: !0,
|
|
46
33
|
role: "button",
|
|
47
34
|
variants: {
|
|
48
35
|
unstyled: {
|
|
@@ -53,9 +40,9 @@ const ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
|
53
40
|
flexWrap: "nowrap",
|
|
54
41
|
flexDirection: "row",
|
|
55
42
|
cursor: "pointer",
|
|
56
|
-
hoverTheme:
|
|
57
|
-
pressTheme:
|
|
58
|
-
backgrounded:
|
|
43
|
+
hoverTheme: !0,
|
|
44
|
+
pressTheme: !0,
|
|
45
|
+
backgrounded: !0,
|
|
59
46
|
borderWidth: 1,
|
|
60
47
|
borderColor: "transparent",
|
|
61
48
|
focusStyle: {
|
|
@@ -94,10 +81,9 @@ const ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
|
94
81
|
}
|
|
95
82
|
},
|
|
96
83
|
defaultVariants: {
|
|
97
|
-
unstyled:
|
|
84
|
+
unstyled: !1
|
|
98
85
|
}
|
|
99
|
-
})
|
|
100
|
-
const ButtonText = (0, import_web.styled)(import_text.SizableText, {
|
|
86
|
+
}), ButtonText = (0, import_web.styled)(import_text.SizableText, {
|
|
101
87
|
name: "Button",
|
|
102
88
|
// same name as the frame so they can share a single theme
|
|
103
89
|
context: ButtonContext,
|
|
@@ -109,27 +95,21 @@ const ButtonText = (0, import_web.styled)(import_text.SizableText, {
|
|
|
109
95
|
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
110
96
|
flexGrow: 0,
|
|
111
97
|
flexShrink: 1,
|
|
112
|
-
ellipse:
|
|
98
|
+
ellipse: !0,
|
|
113
99
|
color: "$color"
|
|
114
100
|
}
|
|
115
101
|
}
|
|
116
102
|
},
|
|
117
103
|
defaultVariants: {
|
|
118
|
-
unstyled:
|
|
104
|
+
unstyled: !1
|
|
119
105
|
}
|
|
120
|
-
})
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const iconSize = (typeof size === "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon;
|
|
125
|
-
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color });
|
|
126
|
-
return getThemedIcon(children);
|
|
127
|
-
};
|
|
128
|
-
const ButtonComponent = ButtonFrame.styleable(function Button(props, ref) {
|
|
106
|
+
}), ButtonIcon = (props) => {
|
|
107
|
+
const { 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;
|
|
108
|
+
return (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color })(children);
|
|
109
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
129
110
|
const { props: buttonProps } = useButton(props);
|
|
130
111
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, { ...buttonProps, ref });
|
|
131
|
-
})
|
|
132
|
-
const buttonStaticConfig = {
|
|
112
|
+
}), buttonStaticConfig = {
|
|
133
113
|
inlineProps: /* @__PURE__ */ new Set([
|
|
134
114
|
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
135
115
|
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
@@ -142,12 +122,10 @@ const buttonStaticConfig = {
|
|
|
142
122
|
"textAlign",
|
|
143
123
|
"unstyled"
|
|
144
124
|
])
|
|
145
|
-
}
|
|
146
|
-
const Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
|
|
125
|
+
}, Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
|
|
147
126
|
Text: ButtonText,
|
|
148
127
|
Icon: ButtonIcon
|
|
149
|
-
});
|
|
150
|
-
const ButtonNestingContext = (0, import_react.createContext)(false);
|
|
128
|
+
}), ButtonNestingContext = (0, import_react.createContext)(!1);
|
|
151
129
|
function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
152
130
|
const {
|
|
153
131
|
children,
|
|
@@ -170,36 +148,25 @@ function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
|
170
148
|
textAlign,
|
|
171
149
|
textProps,
|
|
172
150
|
...rest
|
|
173
|
-
} = propsIn
|
|
174
|
-
const isNested = (0, import_react.useContext)(ButtonNestingContext);
|
|
175
|
-
const propsActive = (0, import_web.useProps)(propsIn);
|
|
176
|
-
const size = propsActive.size || (propsActive.unstyled ? void 0 : "$true");
|
|
177
|
-
const iconSize = (typeof size === "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon;
|
|
178
|
-
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color });
|
|
179
|
-
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
180
|
-
const spaceSize = propsActive.space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace;
|
|
181
|
-
const contents = (0, import_text.wrapChildrenInText)(
|
|
151
|
+
} = propsIn, isNested = (0, import_react.useContext)(ButtonNestingContext), propsActive = (0, import_web.useProps)(propsIn), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon, getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color }), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = propsActive.space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace, contents = (0, import_text.wrapChildrenInText)(
|
|
182
152
|
Text,
|
|
183
153
|
propsActive,
|
|
184
|
-
Text === ButtonText && propsIn.unstyled !==
|
|
185
|
-
unstyled:
|
|
154
|
+
Text === ButtonText && propsIn.unstyled !== !0 ? {
|
|
155
|
+
unstyled: !1,
|
|
186
156
|
size
|
|
187
157
|
} : void 0
|
|
188
|
-
)
|
|
189
|
-
const inner = (0, import_web.spacedChildren)({
|
|
158
|
+
), inner = (0, import_web.spacedChildren)({
|
|
190
159
|
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
191
160
|
space: spaceSize,
|
|
192
161
|
spaceFlex,
|
|
193
162
|
separator,
|
|
194
163
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
195
164
|
children: [themedIcon, ...contents, themedIconAfter]
|
|
196
|
-
})
|
|
197
|
-
const tag = isNested ? "span" : (
|
|
165
|
+
}), tag = isNested ? "span" : (
|
|
198
166
|
// defaults to <a /> when accessibilityRole = link
|
|
199
167
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
200
168
|
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
201
|
-
)
|
|
202
|
-
const props = {
|
|
169
|
+
), props = {
|
|
203
170
|
...propsActive.disabled && {
|
|
204
171
|
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
205
172
|
focusable: void 0,
|
|
@@ -212,7 +179,7 @@ function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
|
212
179
|
tag
|
|
213
180
|
},
|
|
214
181
|
...rest,
|
|
215
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonNestingContext.Provider, { value:
|
|
182
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonNestingContext.Provider, { value: !0, children: inner })
|
|
216
183
|
};
|
|
217
184
|
return {
|
|
218
185
|
spaceSize,
|
package/dist/cjs/Button.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
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
5
|
"names": ["Button"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
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);
|
|
16
|
+
var Button_exports = {};
|
|
17
|
+
__export(Button_exports, {
|
|
18
|
+
Button: () => Button2,
|
|
19
|
+
ButtonContext: () => ButtonContext,
|
|
20
|
+
ButtonFrame: () => ButtonFrame,
|
|
21
|
+
ButtonIcon: () => ButtonIcon,
|
|
22
|
+
ButtonNestingContext: () => ButtonNestingContext,
|
|
23
|
+
ButtonText: () => ButtonText,
|
|
24
|
+
buttonStaticConfig: () => buttonStaticConfig,
|
|
25
|
+
useButton: () => useButton
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(Button_exports);
|
|
28
|
+
var import_font_size = require("@tamagui/font-size"), import_get_button_sized = require("@tamagui/get-button-sized"), 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"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
const ButtonContext = (0, import_web.createStyledContext)({}), BUTTON_NAME = "Button", ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
30
|
+
name: BUTTON_NAME,
|
|
31
|
+
tag: "button",
|
|
32
|
+
context: ButtonContext,
|
|
33
|
+
focusable: !0,
|
|
34
|
+
role: "button",
|
|
35
|
+
variants: {
|
|
36
|
+
unstyled: {
|
|
37
|
+
false: {
|
|
38
|
+
size: "$true",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
flexWrap: "nowrap",
|
|
42
|
+
flexDirection: "row",
|
|
43
|
+
cursor: "pointer",
|
|
44
|
+
hoverTheme: !0,
|
|
45
|
+
pressTheme: !0,
|
|
46
|
+
backgrounded: !0,
|
|
47
|
+
borderWidth: 1,
|
|
48
|
+
borderColor: "transparent",
|
|
49
|
+
focusStyle: {
|
|
50
|
+
outlineColor: "$borderColorFocus",
|
|
51
|
+
outlineStyle: "solid",
|
|
52
|
+
outlineWidth: 2
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
variant: {
|
|
57
|
+
outlined: {
|
|
58
|
+
backgroundColor: "transparent",
|
|
59
|
+
borderWidth: 2,
|
|
60
|
+
borderColor: "$borderColor",
|
|
61
|
+
hoverStyle: {
|
|
62
|
+
backgroundColor: "transparent",
|
|
63
|
+
borderColor: "$borderColorHover"
|
|
64
|
+
},
|
|
65
|
+
pressStyle: {
|
|
66
|
+
backgroundColor: "transparent",
|
|
67
|
+
borderColor: "$borderColorPress"
|
|
68
|
+
},
|
|
69
|
+
focusStyle: {
|
|
70
|
+
backgroundColor: "transparent",
|
|
71
|
+
borderColor: "$borderColorFocus"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
size: {
|
|
76
|
+
"...size": import_get_button_sized.getButtonSized
|
|
77
|
+
},
|
|
78
|
+
disabled: {
|
|
79
|
+
true: {
|
|
80
|
+
pointerEvents: "none"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
unstyled: !1
|
|
86
|
+
}
|
|
87
|
+
}), ButtonText = (0, import_web.styled)(import_text.SizableText, {
|
|
88
|
+
name: "Button",
|
|
89
|
+
// same name as the frame so they can share a single theme
|
|
90
|
+
context: ButtonContext,
|
|
91
|
+
variants: {
|
|
92
|
+
unstyled: {
|
|
93
|
+
false: {
|
|
94
|
+
userSelect: "none",
|
|
95
|
+
cursor: "pointer",
|
|
96
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
97
|
+
flexGrow: 0,
|
|
98
|
+
flexShrink: 1,
|
|
99
|
+
ellipse: !0,
|
|
100
|
+
color: "$color"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
defaultVariants: {
|
|
105
|
+
unstyled: !1
|
|
106
|
+
}
|
|
107
|
+
}), ButtonIcon = (props) => {
|
|
108
|
+
const { 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;
|
|
109
|
+
return (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color })(children);
|
|
110
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
111
|
+
const { props: buttonProps } = useButton(props);
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, { ...buttonProps, ref });
|
|
113
|
+
}), buttonStaticConfig = {
|
|
114
|
+
inlineProps: /* @__PURE__ */ new Set([
|
|
115
|
+
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
116
|
+
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
117
|
+
"color",
|
|
118
|
+
"fontWeight",
|
|
119
|
+
"fontSize",
|
|
120
|
+
"fontFamily",
|
|
121
|
+
"fontStyle",
|
|
122
|
+
"letterSpacing",
|
|
123
|
+
"textAlign",
|
|
124
|
+
"unstyled"
|
|
125
|
+
])
|
|
126
|
+
}, Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
|
|
127
|
+
Text: ButtonText,
|
|
128
|
+
Icon: ButtonIcon
|
|
129
|
+
}), ButtonNestingContext = (0, import_react.createContext)(!1);
|
|
130
|
+
function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
131
|
+
const {
|
|
132
|
+
children,
|
|
133
|
+
icon,
|
|
134
|
+
iconAfter,
|
|
135
|
+
noTextWrap,
|
|
136
|
+
theme: themeName,
|
|
137
|
+
space,
|
|
138
|
+
spaceFlex,
|
|
139
|
+
scaleIcon = 1,
|
|
140
|
+
scaleSpace = 0.66,
|
|
141
|
+
separator,
|
|
142
|
+
// text props
|
|
143
|
+
color,
|
|
144
|
+
fontWeight,
|
|
145
|
+
letterSpacing,
|
|
146
|
+
fontSize,
|
|
147
|
+
fontFamily,
|
|
148
|
+
fontStyle,
|
|
149
|
+
textAlign,
|
|
150
|
+
textProps,
|
|
151
|
+
...rest
|
|
152
|
+
} = propsIn, isNested = (0, import_react.useContext)(ButtonNestingContext), propsActive = (0, import_web.useProps)(propsIn), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon, getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color }), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = propsActive.space ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace, contents = (0, import_text.wrapChildrenInText)(
|
|
153
|
+
Text,
|
|
154
|
+
propsActive,
|
|
155
|
+
Text === ButtonText && propsIn.unstyled !== !0 ? {
|
|
156
|
+
unstyled: !1,
|
|
157
|
+
size
|
|
158
|
+
} : void 0
|
|
159
|
+
), inner = (0, import_web.spacedChildren)({
|
|
160
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
161
|
+
space: spaceSize,
|
|
162
|
+
spaceFlex,
|
|
163
|
+
separator,
|
|
164
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
165
|
+
children: [themedIcon, ...contents, themedIconAfter]
|
|
166
|
+
}), tag = isNested ? "span" : (
|
|
167
|
+
// defaults to <a /> when accessibilityRole = link
|
|
168
|
+
// see https://github.com/tamagui/tamagui/issues/505
|
|
169
|
+
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
170
|
+
), props = {
|
|
171
|
+
...propsActive.disabled && {
|
|
172
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
173
|
+
focusable: void 0,
|
|
174
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
175
|
+
focusStyle: {
|
|
176
|
+
borderColor: "$background"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
...tag && {
|
|
180
|
+
tag
|
|
181
|
+
},
|
|
182
|
+
...rest,
|
|
183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonNestingContext.Provider, { value: !0, children: inner })
|
|
184
|
+
};
|
|
185
|
+
return {
|
|
186
|
+
spaceSize,
|
|
187
|
+
isNested,
|
|
188
|
+
props
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
192
|
+
0 && (module.exports = {
|
|
193
|
+
Button,
|
|
194
|
+
ButtonContext,
|
|
195
|
+
ButtonFrame,
|
|
196
|
+
ButtonIcon,
|
|
197
|
+
ButtonNestingContext,
|
|
198
|
+
ButtonText,
|
|
199
|
+
buttonStaticConfig,
|
|
200
|
+
useButton
|
|
201
|
+
});
|
|
202
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAA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,12 +1,8 @@
|
|
|
1
|
-
"
|
|
2
|
-
var import_config_default = require("@tamagui/config-default");
|
|
3
|
-
var import_core = require("@tamagui/core");
|
|
4
|
-
var import_vitest = require("vitest");
|
|
5
|
-
process.env.TAMAGUI_TARGET = "web";
|
|
1
|
+
var import_config_default = require("@tamagui/config-default"), import_core = require("@tamagui/core"), import_vitest = require("vitest");
|
|
6
2
|
const conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
7
3
|
(0, import_vitest.describe)("Button", () => {
|
|
8
|
-
(0, import_vitest.test)(
|
|
9
|
-
(0, import_vitest.expect)(
|
|
4
|
+
(0, import_vitest.test)("123", () => {
|
|
5
|
+
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
10
6
|
});
|
|
11
7
|
});
|
|
12
8
|
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,4BAAwC,oCACxC,cAA8B,0BAC9B,gBAAuC;AAEvC,MAAM,WAAO,+BAAc,+CAAwB,CAAC;AAAA,IAEpD,wBAAS,UAAU,MAAM;AACvB,0BAAK,OAAO,MAAM;AAChB,8BAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_config_default = require("@tamagui/config-default"), import_core = require("@tamagui/core"), import_vitest = require("vitest");
|
|
3
|
+
const conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
4
|
+
(0, import_vitest.describe)("Button", () => {
|
|
5
|
+
(0, import_vitest.test)("123", () => {
|
|
6
|
+
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
+
"mappings": ";AAAA,4BAAwC,oCACxC,cAA8B,0BAC9B,gBAAuC;AAEvC,MAAM,WAAO,+BAAc,+CAAwB,CAAC;AAAA,IAEpD,wBAAS,UAAU,MAAM;AACvB,0BAAK,OAAO,MAAM;AAChB,8BAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
7
|
for (let key of __getOwnPropNames(from))
|
|
9
|
-
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
9
|
return to;
|
|
13
|
-
};
|
|
14
|
-
var
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
12
|
var src_exports = {};
|
|
17
13
|
module.exports = __toCommonJS(src_exports);
|
|
18
14
|
__reExport(src_exports, require("./Button"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
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);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_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
|
package/dist/esm/Button.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { getFontSize } from "@tamagui/font-size";
|
|
3
2
|
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
4
3
|
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
@@ -16,13 +15,12 @@ import {
|
|
|
16
15
|
withStaticProperties
|
|
17
16
|
} from "@tamagui/web";
|
|
18
17
|
import { createContext, useContext } from "react";
|
|
19
|
-
|
|
20
|
-
const BUTTON_NAME = "Button"
|
|
21
|
-
const ButtonFrame = styled(ThemeableStack, {
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
const ButtonContext = createStyledContext({}), BUTTON_NAME = "Button", ButtonFrame = styled(ThemeableStack, {
|
|
22
20
|
name: BUTTON_NAME,
|
|
23
21
|
tag: "button",
|
|
24
22
|
context: ButtonContext,
|
|
25
|
-
focusable:
|
|
23
|
+
focusable: !0,
|
|
26
24
|
role: "button",
|
|
27
25
|
variants: {
|
|
28
26
|
unstyled: {
|
|
@@ -33,9 +31,9 @@ const ButtonFrame = styled(ThemeableStack, {
|
|
|
33
31
|
flexWrap: "nowrap",
|
|
34
32
|
flexDirection: "row",
|
|
35
33
|
cursor: "pointer",
|
|
36
|
-
hoverTheme:
|
|
37
|
-
pressTheme:
|
|
38
|
-
backgrounded:
|
|
34
|
+
hoverTheme: !0,
|
|
35
|
+
pressTheme: !0,
|
|
36
|
+
backgrounded: !0,
|
|
39
37
|
borderWidth: 1,
|
|
40
38
|
borderColor: "transparent",
|
|
41
39
|
focusStyle: {
|
|
@@ -74,10 +72,9 @@ const ButtonFrame = styled(ThemeableStack, {
|
|
|
74
72
|
}
|
|
75
73
|
},
|
|
76
74
|
defaultVariants: {
|
|
77
|
-
unstyled:
|
|
75
|
+
unstyled: !1
|
|
78
76
|
}
|
|
79
|
-
})
|
|
80
|
-
const ButtonText = styled(SizableText, {
|
|
77
|
+
}), ButtonText = styled(SizableText, {
|
|
81
78
|
name: "Button",
|
|
82
79
|
// same name as the frame so they can share a single theme
|
|
83
80
|
context: ButtonContext,
|
|
@@ -89,27 +86,21 @@ const ButtonText = styled(SizableText, {
|
|
|
89
86
|
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
90
87
|
flexGrow: 0,
|
|
91
88
|
flexShrink: 1,
|
|
92
|
-
ellipse:
|
|
89
|
+
ellipse: !0,
|
|
93
90
|
color: "$color"
|
|
94
91
|
}
|
|
95
92
|
}
|
|
96
93
|
},
|
|
97
94
|
defaultVariants: {
|
|
98
|
-
unstyled:
|
|
95
|
+
unstyled: !1
|
|
99
96
|
}
|
|
100
|
-
})
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const iconSize = (typeof size === "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
105
|
-
const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
|
|
106
|
-
return getThemedIcon(children);
|
|
107
|
-
};
|
|
108
|
-
const ButtonComponent = ButtonFrame.styleable(function Button(props, ref) {
|
|
97
|
+
}), ButtonIcon = (props) => {
|
|
98
|
+
const { children, scaleIcon = 1 } = props, { size, color } = useContext(ButtonContext), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
99
|
+
return useGetThemedIcon({ size: iconSize, color })(children);
|
|
100
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
109
101
|
const { props: buttonProps } = useButton(props);
|
|
110
102
|
return /* @__PURE__ */ jsx(ButtonFrame, { ...buttonProps, ref });
|
|
111
|
-
})
|
|
112
|
-
const buttonStaticConfig = {
|
|
103
|
+
}), buttonStaticConfig = {
|
|
113
104
|
inlineProps: /* @__PURE__ */ new Set([
|
|
114
105
|
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
115
106
|
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
@@ -122,12 +113,10 @@ const buttonStaticConfig = {
|
|
|
122
113
|
"textAlign",
|
|
123
114
|
"unstyled"
|
|
124
115
|
])
|
|
125
|
-
}
|
|
126
|
-
const Button2 = withStaticProperties(ButtonComponent, {
|
|
116
|
+
}, Button2 = withStaticProperties(ButtonComponent, {
|
|
127
117
|
Text: ButtonText,
|
|
128
118
|
Icon: ButtonIcon
|
|
129
|
-
});
|
|
130
|
-
const ButtonNestingContext = createContext(false);
|
|
119
|
+
}), ButtonNestingContext = createContext(!1);
|
|
131
120
|
function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
132
121
|
const {
|
|
133
122
|
children,
|
|
@@ -150,36 +139,25 @@ function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
|
150
139
|
textAlign,
|
|
151
140
|
textProps,
|
|
152
141
|
...rest
|
|
153
|
-
} = propsIn
|
|
154
|
-
const isNested = useContext(ButtonNestingContext);
|
|
155
|
-
const propsActive = useProps(propsIn);
|
|
156
|
-
const size = propsActive.size || (propsActive.unstyled ? void 0 : "$true");
|
|
157
|
-
const iconSize = (typeof size === "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
158
|
-
const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
|
|
159
|
-
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
160
|
-
const spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace;
|
|
161
|
-
const contents = wrapChildrenInText(
|
|
142
|
+
} = propsIn, isNested = useContext(ButtonNestingContext), propsActive = useProps(propsIn), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon, getThemedIcon = useGetThemedIcon({ size: iconSize, color }), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace, contents = wrapChildrenInText(
|
|
162
143
|
Text,
|
|
163
144
|
propsActive,
|
|
164
|
-
Text === ButtonText && propsIn.unstyled !==
|
|
165
|
-
unstyled:
|
|
145
|
+
Text === ButtonText && propsIn.unstyled !== !0 ? {
|
|
146
|
+
unstyled: !1,
|
|
166
147
|
size
|
|
167
148
|
} : void 0
|
|
168
|
-
)
|
|
169
|
-
const inner = spacedChildren({
|
|
149
|
+
), inner = spacedChildren({
|
|
170
150
|
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
171
151
|
space: spaceSize,
|
|
172
152
|
spaceFlex,
|
|
173
153
|
separator,
|
|
174
154
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
175
155
|
children: [themedIcon, ...contents, themedIconAfter]
|
|
176
|
-
})
|
|
177
|
-
const tag = isNested ? "span" : (
|
|
156
|
+
}), tag = isNested ? "span" : (
|
|
178
157
|
// defaults to <a /> when accessibilityRole = link
|
|
179
158
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
180
159
|
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
181
|
-
)
|
|
182
|
-
const props = {
|
|
160
|
+
), props = {
|
|
183
161
|
...propsActive.disabled && {
|
|
184
162
|
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
185
163
|
focusable: void 0,
|
|
@@ -192,7 +170,7 @@ function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
|
192
170
|
tag
|
|
193
171
|
},
|
|
194
172
|
...rest,
|
|
195
|
-
children: /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value:
|
|
173
|
+
children: /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: !0, children: inner })
|
|
196
174
|
};
|
|
197
175
|
return {
|
|
198
176
|
spaceSize,
|
package/dist/esm/Button.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,eAAe,kBAAkB;AAwJpD;AAtJF,MAAM,gBAAgB,oBAM3B,CAAC,CAAC,GAoCE,cAAc,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,WAEI,gBAAgB,iBAAiB,EAAE,MAAM,UAAU,MAAoB,CAAC,GACxE,CAAC,YAAY,eAAe,IAAI,CAAC,MAAM,SAAS,EAAE,IAAI,aAAa,GACnE,YAAY,YAAY,SAAS,iBAAiB,QAAQ,IAAI,YAC9D,WAAW;AAAA,IACf;AAAA,IACA;AAAA,IACA,SAAS,cAAc,QAAQ,aAAa,KACxC;AAAA,MACE,UAAU;AAAA,MACV;AAAA,IACF,IACA;AAAA,EACN,GAEM,QAAQ,eAAe;AAAA;AAAA,IAE3B,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WACE,YAAY,kBAAkB,YAC9B,YAAY,kBAAkB,mBAC1B,aACA;AAAA,IACN,UAAU,CAAC,YAAY,GAAG,UAAU,eAAe;AAAA,EACrD,CAAC,GAGK,MAAM,WACR;AAAA;AAAA;AAAA,IAGF,QAAQ,sBAAsB,SAC5B,MACA;AAAA,KAEE,QAAQ;AAAA,IACZ,GAAI,YAAY,YAAY;AAAA;AAAA,MAE1B,WAAW;AAAA;AAAA,MAEX,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,GAAI,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,GAAG;AAAA,IACH,UACE,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,IAAO,iBAAM;AAAA,EAEvD;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
5
5
|
"names": ["Button"]
|
|
6
6
|
}
|
package/dist/esm/Button.test.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
process.env.TAMAGUI_TARGET = "web";
|
|
2
1
|
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
3
2
|
import { createTamagui } from "@tamagui/core";
|
|
4
3
|
import { describe, expect, test } from "vitest";
|
|
5
4
|
const conf = createTamagui(getDefaultTamaguiConfig());
|
|
6
5
|
describe("Button", () => {
|
|
7
|
-
test(
|
|
8
|
-
expect(
|
|
6
|
+
test("123", () => {
|
|
7
|
+
expect(!0).toBeTruthy();
|
|
9
8
|
});
|
|
10
9
|
});
|
|
11
10
|
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
4
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAC9B,SAAS,UAAU,QAAQ,YAAY;AAEvC,MAAM,OAAO,cAAc,wBAAwB,CAAC;AAEpD,SAAS,UAAU,MAAM;AACvB,OAAK,OAAO,MAAM;AAChB,WAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/jsx/Button.js
CHANGED
|
@@ -15,13 +15,11 @@ import {
|
|
|
15
15
|
withStaticProperties
|
|
16
16
|
} from "@tamagui/web";
|
|
17
17
|
import { createContext, useContext } from "react";
|
|
18
|
-
const ButtonContext = createStyledContext({})
|
|
19
|
-
const BUTTON_NAME = "Button";
|
|
20
|
-
const ButtonFrame = styled(ThemeableStack, {
|
|
18
|
+
const ButtonContext = createStyledContext({}), BUTTON_NAME = "Button", ButtonFrame = styled(ThemeableStack, {
|
|
21
19
|
name: BUTTON_NAME,
|
|
22
20
|
tag: "button",
|
|
23
21
|
context: ButtonContext,
|
|
24
|
-
focusable:
|
|
22
|
+
focusable: !0,
|
|
25
23
|
role: "button",
|
|
26
24
|
variants: {
|
|
27
25
|
unstyled: {
|
|
@@ -32,9 +30,9 @@ const ButtonFrame = styled(ThemeableStack, {
|
|
|
32
30
|
flexWrap: "nowrap",
|
|
33
31
|
flexDirection: "row",
|
|
34
32
|
cursor: "pointer",
|
|
35
|
-
hoverTheme:
|
|
36
|
-
pressTheme:
|
|
37
|
-
backgrounded:
|
|
33
|
+
hoverTheme: !0,
|
|
34
|
+
pressTheme: !0,
|
|
35
|
+
backgrounded: !0,
|
|
38
36
|
borderWidth: 1,
|
|
39
37
|
borderColor: "transparent",
|
|
40
38
|
focusStyle: {
|
|
@@ -73,10 +71,9 @@ const ButtonFrame = styled(ThemeableStack, {
|
|
|
73
71
|
}
|
|
74
72
|
},
|
|
75
73
|
defaultVariants: {
|
|
76
|
-
unstyled:
|
|
74
|
+
unstyled: !1
|
|
77
75
|
}
|
|
78
|
-
})
|
|
79
|
-
const ButtonText = styled(SizableText, {
|
|
76
|
+
}), ButtonText = styled(SizableText, {
|
|
80
77
|
name: "Button",
|
|
81
78
|
// same name as the frame so they can share a single theme
|
|
82
79
|
context: ButtonContext,
|
|
@@ -88,27 +85,21 @@ const ButtonText = styled(SizableText, {
|
|
|
88
85
|
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
89
86
|
flexGrow: 0,
|
|
90
87
|
flexShrink: 1,
|
|
91
|
-
ellipse:
|
|
88
|
+
ellipse: !0,
|
|
92
89
|
color: "$color"
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
92
|
},
|
|
96
93
|
defaultVariants: {
|
|
97
|
-
unstyled:
|
|
94
|
+
unstyled: !1
|
|
98
95
|
}
|
|
99
|
-
})
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const iconSize = (typeof size === "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
104
|
-
const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
|
|
105
|
-
return getThemedIcon(children);
|
|
106
|
-
};
|
|
107
|
-
const ButtonComponent = ButtonFrame.styleable(function Button(props, ref) {
|
|
96
|
+
}), ButtonIcon = (props) => {
|
|
97
|
+
const { children, scaleIcon = 1 } = props, { size, color } = useContext(ButtonContext), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
98
|
+
return useGetThemedIcon({ size: iconSize, color })(children);
|
|
99
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
108
100
|
const { props: buttonProps } = useButton(props);
|
|
109
101
|
return <ButtonFrame {...buttonProps} ref={ref} />;
|
|
110
|
-
})
|
|
111
|
-
const buttonStaticConfig = {
|
|
102
|
+
}), buttonStaticConfig = {
|
|
112
103
|
inlineProps: /* @__PURE__ */ new Set([
|
|
113
104
|
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
114
105
|
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
@@ -121,12 +112,10 @@ const buttonStaticConfig = {
|
|
|
121
112
|
"textAlign",
|
|
122
113
|
"unstyled"
|
|
123
114
|
])
|
|
124
|
-
}
|
|
125
|
-
const Button2 = withStaticProperties(ButtonComponent, {
|
|
115
|
+
}, Button2 = withStaticProperties(ButtonComponent, {
|
|
126
116
|
Text: ButtonText,
|
|
127
117
|
Icon: ButtonIcon
|
|
128
|
-
});
|
|
129
|
-
const ButtonNestingContext = createContext(false);
|
|
118
|
+
}), ButtonNestingContext = createContext(!1);
|
|
130
119
|
function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
131
120
|
const {
|
|
132
121
|
children,
|
|
@@ -149,36 +138,25 @@ function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
|
149
138
|
textAlign,
|
|
150
139
|
textProps,
|
|
151
140
|
...rest
|
|
152
|
-
} = propsIn
|
|
153
|
-
const isNested = useContext(ButtonNestingContext);
|
|
154
|
-
const propsActive = useProps(propsIn);
|
|
155
|
-
const size = propsActive.size || (propsActive.unstyled ? void 0 : "$true");
|
|
156
|
-
const iconSize = (typeof size === "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
157
|
-
const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
|
|
158
|
-
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
159
|
-
const spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace;
|
|
160
|
-
const contents = wrapChildrenInText(
|
|
141
|
+
} = propsIn, isNested = useContext(ButtonNestingContext), propsActive = useProps(propsIn), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon, getThemedIcon = useGetThemedIcon({ size: iconSize, color }), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace, contents = wrapChildrenInText(
|
|
161
142
|
Text,
|
|
162
143
|
propsActive,
|
|
163
|
-
Text === ButtonText && propsIn.unstyled !==
|
|
164
|
-
unstyled:
|
|
144
|
+
Text === ButtonText && propsIn.unstyled !== !0 ? {
|
|
145
|
+
unstyled: !1,
|
|
165
146
|
size
|
|
166
147
|
} : void 0
|
|
167
|
-
)
|
|
168
|
-
const inner = spacedChildren({
|
|
148
|
+
), inner = spacedChildren({
|
|
169
149
|
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
170
150
|
space: spaceSize,
|
|
171
151
|
spaceFlex,
|
|
172
152
|
separator,
|
|
173
153
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
174
154
|
children: [themedIcon, ...contents, themedIconAfter]
|
|
175
|
-
})
|
|
176
|
-
const tag = isNested ? "span" : (
|
|
155
|
+
}), tag = isNested ? "span" : (
|
|
177
156
|
// defaults to <a /> when accessibilityRole = link
|
|
178
157
|
// see https://github.com/tamagui/tamagui/issues/505
|
|
179
158
|
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
180
|
-
)
|
|
181
|
-
const props = {
|
|
159
|
+
), props = {
|
|
182
160
|
...propsActive.disabled && {
|
|
183
161
|
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
184
162
|
focusable: void 0,
|
|
@@ -191,7 +169,7 @@ function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
|
191
169
|
tag
|
|
192
170
|
},
|
|
193
171
|
...rest,
|
|
194
|
-
children: <ButtonNestingContext.Provider value={
|
|
172
|
+
children: <ButtonNestingContext.Provider value={!0}>{inner}</ButtonNestingContext.Provider>
|
|
195
173
|
};
|
|
196
174
|
return {
|
|
197
175
|
spaceSize,
|
package/dist/jsx/Button.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,eAAe,kBAAkB;AAEtD,MAAM,gBAAgB,oBAM3B,CAAC,CAAC
|
|
4
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,eAAe,kBAAkB;AAEtD,MAAM,gBAAgB,oBAM3B,CAAC,CAAC,GAoCE,cAAc,UAEd,cAAc,OAAO,gBAAgB;AAAA,EACzC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,eAAe;AAAA,QACf,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,aAAa;AAAA,QACb,aAAa;AAAA,QAEb,YAAY;AAAA,UAC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AY,kBAAkB,YAC9B,YAAY,kBAAkB,mBAC1B,aACA;AAAA,IACN,UAAU,CAAC,YAAY,GAAG,UAAU,eAAe;AAAA,EACrD,CAAC,GAGK,MAAM,WACR;AAAA;AAAA;AAAA,IAGF,QAAQ,sBAAsB,SAC5B,MACA;AAAA,KAEE,QAAQ;AAAA,IACZ,GAAI,YAAY,YAAY;AAAA;AAAA,MAE1B,WAAW;AAAA;AAAA,MAEX,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,GAAI,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,GAAG;AAAA,IACH,UACE,CAAC,qBAAqB,SAAS,OAAO,KAAO,MAAM,EAAlD,qBAAqB;AAAA,EAE1B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
5
5
|
"names": ["Button"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
2
|
+
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
3
|
+
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
4
|
+
import { ThemeableStack } from "@tamagui/stacks";
|
|
5
|
+
import {
|
|
6
|
+
SizableText,
|
|
7
|
+
wrapChildrenInText
|
|
8
|
+
} from "@tamagui/text";
|
|
9
|
+
import {
|
|
10
|
+
createStyledContext,
|
|
11
|
+
getVariableValue,
|
|
12
|
+
spacedChildren,
|
|
13
|
+
styled,
|
|
14
|
+
useProps,
|
|
15
|
+
withStaticProperties
|
|
16
|
+
} from "@tamagui/web";
|
|
17
|
+
import { createContext, useContext } from "react";
|
|
18
|
+
const ButtonContext = createStyledContext({}), BUTTON_NAME = "Button", ButtonFrame = styled(ThemeableStack, {
|
|
19
|
+
name: BUTTON_NAME,
|
|
20
|
+
tag: "button",
|
|
21
|
+
context: ButtonContext,
|
|
22
|
+
focusable: !0,
|
|
23
|
+
role: "button",
|
|
24
|
+
variants: {
|
|
25
|
+
unstyled: {
|
|
26
|
+
false: {
|
|
27
|
+
size: "$true",
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
flexWrap: "nowrap",
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
cursor: "pointer",
|
|
33
|
+
hoverTheme: !0,
|
|
34
|
+
pressTheme: !0,
|
|
35
|
+
backgrounded: !0,
|
|
36
|
+
borderWidth: 1,
|
|
37
|
+
borderColor: "transparent",
|
|
38
|
+
focusStyle: {
|
|
39
|
+
outlineColor: "$borderColorFocus",
|
|
40
|
+
outlineStyle: "solid",
|
|
41
|
+
outlineWidth: 2
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
variant: {
|
|
46
|
+
outlined: {
|
|
47
|
+
backgroundColor: "transparent",
|
|
48
|
+
borderWidth: 2,
|
|
49
|
+
borderColor: "$borderColor",
|
|
50
|
+
hoverStyle: {
|
|
51
|
+
backgroundColor: "transparent",
|
|
52
|
+
borderColor: "$borderColorHover"
|
|
53
|
+
},
|
|
54
|
+
pressStyle: {
|
|
55
|
+
backgroundColor: "transparent",
|
|
56
|
+
borderColor: "$borderColorPress"
|
|
57
|
+
},
|
|
58
|
+
focusStyle: {
|
|
59
|
+
backgroundColor: "transparent",
|
|
60
|
+
borderColor: "$borderColorFocus"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
size: {
|
|
65
|
+
"...size": getButtonSized
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
true: {
|
|
69
|
+
pointerEvents: "none"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
unstyled: !1
|
|
75
|
+
}
|
|
76
|
+
}), ButtonText = styled(SizableText, {
|
|
77
|
+
name: "Button",
|
|
78
|
+
// same name as the frame so they can share a single theme
|
|
79
|
+
context: ButtonContext,
|
|
80
|
+
variants: {
|
|
81
|
+
unstyled: {
|
|
82
|
+
false: {
|
|
83
|
+
userSelect: "none",
|
|
84
|
+
cursor: "pointer",
|
|
85
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
86
|
+
flexGrow: 0,
|
|
87
|
+
flexShrink: 1,
|
|
88
|
+
ellipse: !0,
|
|
89
|
+
color: "$color"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
defaultVariants: {
|
|
94
|
+
unstyled: !1
|
|
95
|
+
}
|
|
96
|
+
}), ButtonIcon = (props) => {
|
|
97
|
+
const { children, scaleIcon = 1 } = props, { size, color } = useContext(ButtonContext), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
98
|
+
return useGetThemedIcon({ size: iconSize, color })(children);
|
|
99
|
+
}, ButtonComponent = ButtonFrame.styleable(function(props, ref) {
|
|
100
|
+
const { props: buttonProps } = useButton(props);
|
|
101
|
+
return <ButtonFrame {...buttonProps} ref={ref} />;
|
|
102
|
+
}), buttonStaticConfig = {
|
|
103
|
+
inlineProps: /* @__PURE__ */ new Set([
|
|
104
|
+
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
105
|
+
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
106
|
+
"color",
|
|
107
|
+
"fontWeight",
|
|
108
|
+
"fontSize",
|
|
109
|
+
"fontFamily",
|
|
110
|
+
"fontStyle",
|
|
111
|
+
"letterSpacing",
|
|
112
|
+
"textAlign",
|
|
113
|
+
"unstyled"
|
|
114
|
+
])
|
|
115
|
+
}, Button2 = withStaticProperties(ButtonComponent, {
|
|
116
|
+
Text: ButtonText,
|
|
117
|
+
Icon: ButtonIcon
|
|
118
|
+
}), ButtonNestingContext = createContext(!1);
|
|
119
|
+
function useButton(propsIn, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
120
|
+
const {
|
|
121
|
+
children,
|
|
122
|
+
icon,
|
|
123
|
+
iconAfter,
|
|
124
|
+
noTextWrap,
|
|
125
|
+
theme: themeName,
|
|
126
|
+
space,
|
|
127
|
+
spaceFlex,
|
|
128
|
+
scaleIcon = 1,
|
|
129
|
+
scaleSpace = 0.66,
|
|
130
|
+
separator,
|
|
131
|
+
// text props
|
|
132
|
+
color,
|
|
133
|
+
fontWeight,
|
|
134
|
+
letterSpacing,
|
|
135
|
+
fontSize,
|
|
136
|
+
fontFamily,
|
|
137
|
+
fontStyle,
|
|
138
|
+
textAlign,
|
|
139
|
+
textProps,
|
|
140
|
+
...rest
|
|
141
|
+
} = propsIn, isNested = useContext(ButtonNestingContext), propsActive = useProps(propsIn), size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon, getThemedIcon = useGetThemedIcon({ size: iconSize, color }), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace, contents = wrapChildrenInText(
|
|
142
|
+
Text,
|
|
143
|
+
propsActive,
|
|
144
|
+
Text === ButtonText && propsIn.unstyled !== !0 ? {
|
|
145
|
+
unstyled: !1,
|
|
146
|
+
size
|
|
147
|
+
} : void 0
|
|
148
|
+
), inner = spacedChildren({
|
|
149
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
150
|
+
space: spaceSize,
|
|
151
|
+
spaceFlex,
|
|
152
|
+
separator,
|
|
153
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
154
|
+
children: [themedIcon, ...contents, themedIconAfter]
|
|
155
|
+
}), tag = isNested ? "span" : (
|
|
156
|
+
// defaults to <a /> when accessibilityRole = link
|
|
157
|
+
// see https://github.com/tamagui/tamagui/issues/505
|
|
158
|
+
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
159
|
+
), props = {
|
|
160
|
+
...propsActive.disabled && {
|
|
161
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
162
|
+
focusable: void 0,
|
|
163
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
164
|
+
focusStyle: {
|
|
165
|
+
borderColor: "$background"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
...tag && {
|
|
169
|
+
tag
|
|
170
|
+
},
|
|
171
|
+
...rest,
|
|
172
|
+
children: <ButtonNestingContext.Provider value={!0}>{inner}</ButtonNestingContext.Provider>
|
|
173
|
+
};
|
|
174
|
+
return {
|
|
175
|
+
spaceSize,
|
|
176
|
+
isNested,
|
|
177
|
+
props
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
Button2 as Button,
|
|
182
|
+
ButtonContext,
|
|
183
|
+
ButtonFrame,
|
|
184
|
+
ButtonIcon,
|
|
185
|
+
ButtonNestingContext,
|
|
186
|
+
ButtonText,
|
|
187
|
+
buttonStaticConfig,
|
|
188
|
+
useButton
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,eAAe,kBAAkB;AAEtD,MAAM,gBAAgB,oBAM3B,CAAC,CAAC,GAoCE,cAAc,UAEd,cAAc,OAAO,gBAAgB;AAAA,EACzC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,gB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AAA,IACA;AAAA,IACA,SAAS,cAAc,QAAQ,aAAa,KACxC;AAAA,MACE,UAAU;AAAA,MACV;AAAA,IACF,IACA;AAAA,EACN,GAEM,QAAQ,eAAe;AAAA;AAAA,IAE3B,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WACE,YAAY,kBAAkB,YAC9B,YAAY,kBAAkB,mBAC1B,aACA;AAAA,IACN,UAAU,CAAC,YAAY,GAAG,UAAU,eAAe;AAAA,EACrD,CAAC,GAGK,MAAM,WACR;AAAA;AAAA;AAAA,IAGF,QAAQ,sBAAsB,SAC5B,MACA;AAAA,KAEE,QAAQ;AAAA,IACZ,GAAI,YAAY,YAAY;AAAA;AAAA,MAE1B,WAAW;AAAA;AAAA,MAEX,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,GAAI,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,GAAG;AAAA,IACH,UACE,CAAC,qBAAqB,SAAS,OAAO,KAAO,MAAM,EAAlD,qBAAqB;AAAA,EAE1B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["Button"]
|
|
6
|
+
}
|
package/dist/jsx/Button.test.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
process.env.TAMAGUI_TARGET = "web";
|
|
2
1
|
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
3
2
|
import { createTamagui } from "@tamagui/core";
|
|
4
3
|
import { describe, expect, test } from "vitest";
|
|
5
4
|
const conf = createTamagui(getDefaultTamaguiConfig());
|
|
6
5
|
describe("Button", () => {
|
|
7
|
-
test(
|
|
8
|
-
expect(
|
|
6
|
+
test("123", () => {
|
|
7
|
+
expect(!0).toBeTruthy();
|
|
9
8
|
});
|
|
10
9
|
});
|
|
11
10
|
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
4
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAC9B,SAAS,UAAU,QAAQ,YAAY;AAEvC,MAAM,OAAO,cAAc,wBAAwB,CAAC;AAEpD,SAAS,UAAU,MAAM;AACvB,OAAK,OAAO,MAAM;AAChB,WAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
2
|
+
import { createTamagui } from "@tamagui/core";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
const conf = createTamagui(getDefaultTamaguiConfig());
|
|
5
|
+
describe("Button", () => {
|
|
6
|
+
test("123", () => {
|
|
7
|
+
expect(!0).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAC9B,SAAS,UAAU,QAAQ,YAAY;AAEvC,MAAM,OAAO,cAAc,wBAAwB,CAAC;AAEpD,SAAS,UAAU,MAAM;AACvB,OAAK,OAAO,MAAM;AAChB,WAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/button",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.1",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tamagui/font-size": "1.
|
|
33
|
-
"@tamagui/get-button-sized": "1.
|
|
34
|
-
"@tamagui/helpers-tamagui": "1.
|
|
35
|
-
"@tamagui/text": "1.
|
|
36
|
-
"@tamagui/web": "1.
|
|
32
|
+
"@tamagui/font-size": "1.62.1",
|
|
33
|
+
"@tamagui/get-button-sized": "1.62.1",
|
|
34
|
+
"@tamagui/helpers-tamagui": "1.62.1",
|
|
35
|
+
"@tamagui/text": "1.62.1",
|
|
36
|
+
"@tamagui/web": "1.62.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "1.
|
|
42
|
+
"@tamagui/build": "1.62.1",
|
|
43
43
|
"react": "^18.2.0",
|
|
44
44
|
"vitest": "^0.34.3"
|
|
45
45
|
},
|