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