@tamagui/button 1.143.1 → 1.144.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/v1/Button.cjs +259 -0
- package/dist/cjs/v1/Button.js +208 -0
- package/dist/cjs/v1/Button.js.map +6 -0
- package/dist/cjs/v1/Button.native.js +265 -0
- package/dist/cjs/v1/Button.native.js.map +1 -0
- package/dist/cjs/v1/Button.test.cjs +9 -0
- package/dist/cjs/v1/Button.test.js +8 -0
- package/dist/cjs/v1/Button.test.js.map +6 -0
- package/dist/cjs/v1/Button.test.native.js +12 -0
- package/dist/cjs/v1/Button.test.native.js.map +1 -0
- package/dist/cjs/v1/index.cjs +18 -0
- package/dist/cjs/v1/index.js +15 -0
- package/dist/cjs/v1/index.js.map +6 -0
- package/dist/cjs/v1/index.native.js +21 -0
- package/dist/cjs/v1/index.native.js.map +1 -0
- package/dist/esm/v1/Button.js +201 -0
- package/dist/esm/v1/Button.js.map +6 -0
- package/dist/esm/v1/Button.mjs +231 -0
- package/dist/esm/v1/Button.mjs.map +1 -0
- package/dist/esm/v1/Button.native.js +234 -0
- package/dist/esm/v1/Button.native.js.map +1 -0
- package/dist/esm/v1/Button.test.js +10 -0
- package/dist/esm/v1/Button.test.js.map +6 -0
- package/dist/esm/v1/Button.test.mjs +10 -0
- package/dist/esm/v1/Button.test.mjs.map +1 -0
- package/dist/esm/v1/Button.test.native.js +10 -0
- package/dist/esm/v1/Button.test.native.js.map +1 -0
- package/dist/esm/v1/index.js +2 -0
- package/dist/esm/v1/index.js.map +6 -0
- package/dist/esm/v1/index.mjs +2 -0
- package/dist/esm/v1/index.mjs.map +1 -0
- package/dist/esm/v1/index.native.js +2 -0
- package/dist/esm/v1/index.native.js.map +1 -0
- package/dist/jsx/v1/Button.js +201 -0
- package/dist/jsx/v1/Button.js.map +6 -0
- package/dist/jsx/v1/Button.mjs +231 -0
- package/dist/jsx/v1/Button.mjs.map +1 -0
- package/dist/jsx/v1/Button.native.js +265 -0
- package/dist/jsx/v1/Button.native.js.map +1 -0
- package/dist/jsx/v1/Button.test.js +10 -0
- package/dist/jsx/v1/Button.test.js.map +6 -0
- package/dist/jsx/v1/Button.test.mjs +10 -0
- package/dist/jsx/v1/Button.test.mjs.map +1 -0
- package/dist/jsx/v1/Button.test.native.js +12 -0
- package/dist/jsx/v1/Button.test.native.js.map +1 -0
- package/dist/jsx/v1/index.js +2 -0
- package/dist/jsx/v1/index.js.map +6 -0
- package/dist/jsx/v1/index.mjs +2 -0
- package/dist/jsx/v1/index.mjs.map +1 -0
- package/dist/jsx/v1/index.native.js +21 -0
- package/dist/jsx/v1/index.native.js.map +1 -0
- package/package.json +11 -11
- package/types/v1/Button.d.ts.map +1 -0
- package/types/v1/Button.test.d.ts.map +1 -0
- package/types/v1/index.d.ts.map +1 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: !0
|
|
22
|
+
}), mod);
|
|
23
|
+
var Button_exports = {};
|
|
24
|
+
__export(Button_exports, {
|
|
25
|
+
Button: () => Button2,
|
|
26
|
+
ButtonContext: () => ButtonContext,
|
|
27
|
+
ButtonFrame: () => ButtonFrame,
|
|
28
|
+
ButtonIcon: () => ButtonIcon,
|
|
29
|
+
ButtonText: () => ButtonText,
|
|
30
|
+
useButton: () => useButton
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Button_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime"),
|
|
34
|
+
import_font_size = require("@tamagui/font-size"),
|
|
35
|
+
import_get_button_sized = require("@tamagui/get-button-sized"),
|
|
36
|
+
import_helpers = require("@tamagui/helpers"),
|
|
37
|
+
import_helpers_tamagui = require("@tamagui/helpers-tamagui"),
|
|
38
|
+
import_stacks = require("@tamagui/stacks"),
|
|
39
|
+
import_text = require("@tamagui/text"),
|
|
40
|
+
import_web = require("@tamagui/web"),
|
|
41
|
+
import_react = require("react"),
|
|
42
|
+
import_spacer = require("@tamagui/spacer"),
|
|
43
|
+
ButtonContext = (0, import_web.createStyledContext)({
|
|
44
|
+
// keeping these here means they work with styled() passing down color to text
|
|
45
|
+
color: void 0,
|
|
46
|
+
ellipsis: void 0,
|
|
47
|
+
fontFamily: void 0,
|
|
48
|
+
fontSize: void 0,
|
|
49
|
+
fontStyle: void 0,
|
|
50
|
+
fontWeight: void 0,
|
|
51
|
+
letterSpacing: void 0,
|
|
52
|
+
maxFontSizeMultiplier: void 0,
|
|
53
|
+
size: void 0,
|
|
54
|
+
textAlign: void 0,
|
|
55
|
+
variant: void 0
|
|
56
|
+
}),
|
|
57
|
+
BUTTON_NAME = "Button",
|
|
58
|
+
ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
59
|
+
name: BUTTON_NAME,
|
|
60
|
+
tag: "button",
|
|
61
|
+
context: ButtonContext,
|
|
62
|
+
role: "button",
|
|
63
|
+
focusable: !0,
|
|
64
|
+
variants: {
|
|
65
|
+
unstyled: {
|
|
66
|
+
false: {
|
|
67
|
+
size: "$true",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
flexWrap: "nowrap",
|
|
71
|
+
flexDirection: "row",
|
|
72
|
+
cursor: "pointer",
|
|
73
|
+
hoverTheme: !0,
|
|
74
|
+
pressTheme: !0,
|
|
75
|
+
backgrounded: !0,
|
|
76
|
+
borderWidth: 1,
|
|
77
|
+
borderColor: "transparent",
|
|
78
|
+
focusVisibleStyle: {
|
|
79
|
+
outlineColor: "$outlineColor",
|
|
80
|
+
outlineStyle: "solid",
|
|
81
|
+
outlineWidth: 2
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
variant: {
|
|
86
|
+
outlined: {
|
|
87
|
+
backgroundColor: "transparent",
|
|
88
|
+
borderWidth: 2,
|
|
89
|
+
borderColor: "$borderColor",
|
|
90
|
+
hoverStyle: {
|
|
91
|
+
backgroundColor: "transparent",
|
|
92
|
+
borderColor: "$borderColorHover"
|
|
93
|
+
},
|
|
94
|
+
pressStyle: {
|
|
95
|
+
backgroundColor: "transparent",
|
|
96
|
+
borderColor: "$borderColorPress"
|
|
97
|
+
},
|
|
98
|
+
focusVisibleStyle: {
|
|
99
|
+
backgroundColor: "transparent",
|
|
100
|
+
borderColor: "$borderColorFocus"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
size: {
|
|
105
|
+
"...size": import_get_button_sized.getButtonSized,
|
|
106
|
+
":number": import_get_button_sized.getButtonSized
|
|
107
|
+
},
|
|
108
|
+
disabled: {
|
|
109
|
+
true: {
|
|
110
|
+
pointerEvents: "none"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
defaultVariants: {
|
|
115
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
116
|
+
}
|
|
117
|
+
}),
|
|
118
|
+
ButtonText = (0, import_web.styled)(import_text.SizableText, {
|
|
119
|
+
name: "Button",
|
|
120
|
+
context: ButtonContext,
|
|
121
|
+
variants: {
|
|
122
|
+
unstyled: {
|
|
123
|
+
false: {
|
|
124
|
+
userSelect: "none",
|
|
125
|
+
cursor: "pointer",
|
|
126
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
127
|
+
flexGrow: 0,
|
|
128
|
+
flexShrink: 1,
|
|
129
|
+
ellipsis: !0,
|
|
130
|
+
color: "$color"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
defaultVariants: {
|
|
135
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
ButtonIcon = function (props) {
|
|
139
|
+
var {
|
|
140
|
+
children,
|
|
141
|
+
scaleIcon = 1
|
|
142
|
+
} = props,
|
|
143
|
+
{
|
|
144
|
+
size,
|
|
145
|
+
color
|
|
146
|
+
} = (0, import_react.useContext)(ButtonContext),
|
|
147
|
+
iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon,
|
|
148
|
+
getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
149
|
+
size: iconSize,
|
|
150
|
+
color
|
|
151
|
+
});
|
|
152
|
+
return getThemedIcon(children);
|
|
153
|
+
},
|
|
154
|
+
ButtonComponent = ButtonFrame.styleable(function (props, ref) {
|
|
155
|
+
var {
|
|
156
|
+
props: buttonProps
|
|
157
|
+
} = useButton(props);
|
|
158
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ButtonFrame, {
|
|
159
|
+
"data-disable-theme": !0,
|
|
160
|
+
...buttonProps,
|
|
161
|
+
ref
|
|
162
|
+
});
|
|
163
|
+
}),
|
|
164
|
+
Button2 = (0, import_helpers.withStaticProperties)(ButtonComponent, {
|
|
165
|
+
Text: ButtonText,
|
|
166
|
+
Icon: ButtonIcon
|
|
167
|
+
});
|
|
168
|
+
function useButton(param) {
|
|
169
|
+
var {
|
|
170
|
+
textProps,
|
|
171
|
+
...propsIn
|
|
172
|
+
} = param,
|
|
173
|
+
{
|
|
174
|
+
Text = Button2.Text
|
|
175
|
+
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
176
|
+
Text: Button2.Text
|
|
177
|
+
},
|
|
178
|
+
isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext),
|
|
179
|
+
propsActive = (0, import_web.useProps)(propsIn, {
|
|
180
|
+
noNormalize: !0,
|
|
181
|
+
noExpand: !0
|
|
182
|
+
}),
|
|
183
|
+
{
|
|
184
|
+
icon,
|
|
185
|
+
iconAfter,
|
|
186
|
+
gap,
|
|
187
|
+
spaceFlex,
|
|
188
|
+
scaleIcon = 1,
|
|
189
|
+
scaleSpace = 0.66,
|
|
190
|
+
noTextWrap,
|
|
191
|
+
fontFamily,
|
|
192
|
+
fontSize,
|
|
193
|
+
fontWeight,
|
|
194
|
+
fontStyle,
|
|
195
|
+
letterSpacing,
|
|
196
|
+
tag,
|
|
197
|
+
ellipsis,
|
|
198
|
+
maxFontSizeMultiplier,
|
|
199
|
+
...restProps
|
|
200
|
+
} = propsActive,
|
|
201
|
+
size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"),
|
|
202
|
+
color = propsActive.color,
|
|
203
|
+
iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
|
|
204
|
+
font: fontFamily?.[0] === "$" ? fontFamily : void 0
|
|
205
|
+
})) * scaleIcon,
|
|
206
|
+
getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
207
|
+
size: iconSize,
|
|
208
|
+
color
|
|
209
|
+
}),
|
|
210
|
+
[themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon),
|
|
211
|
+
spaceSize = gap ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace,
|
|
212
|
+
contents = noTextWrap ? [propsIn.children] : (0, import_text.wrapChildrenInText)(Text, {
|
|
213
|
+
children: propsIn.children,
|
|
214
|
+
fontFamily,
|
|
215
|
+
fontSize,
|
|
216
|
+
textProps,
|
|
217
|
+
fontWeight,
|
|
218
|
+
fontStyle,
|
|
219
|
+
letterSpacing,
|
|
220
|
+
ellipsis,
|
|
221
|
+
maxFontSizeMultiplier
|
|
222
|
+
}, Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
223
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
224
|
+
size
|
|
225
|
+
} : void 0),
|
|
226
|
+
inner = (0, import_spacer.spacedChildren)({
|
|
227
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
228
|
+
space: spaceSize,
|
|
229
|
+
spaceFlex,
|
|
230
|
+
ensureKeys: !0,
|
|
231
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
232
|
+
// for keys to stay the same we keep indices as similar a possible
|
|
233
|
+
// so even if icons are undefined we still pass them
|
|
234
|
+
children: [themedIcon, ...contents, themedIconAfter]
|
|
235
|
+
}),
|
|
236
|
+
props = {
|
|
237
|
+
size,
|
|
238
|
+
...(propsIn.disabled && {
|
|
239
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
240
|
+
focusable: void 0,
|
|
241
|
+
// even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
|
|
242
|
+
focusVisibleStyle: {
|
|
243
|
+
borderColor: "$background"
|
|
244
|
+
}
|
|
245
|
+
}),
|
|
246
|
+
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
247
|
+
tag: tag ?? (isNested ? "span" :
|
|
248
|
+
// defaults to <a /> when accessibilityRole = link
|
|
249
|
+
// see https://github.com/tamagui/tamagui/issues/505
|
|
250
|
+
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"),
|
|
251
|
+
...restProps,
|
|
252
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
|
|
253
|
+
value: !0,
|
|
254
|
+
children: inner
|
|
255
|
+
}),
|
|
256
|
+
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
257
|
+
disableClassName: !0
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
spaceSize,
|
|
261
|
+
isNested,
|
|
262
|
+
props
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=Button.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Button_exports","__export","Button","Button2","ButtonContext","ButtonFrame","ButtonIcon","ButtonText","useButton","module","exports","import_jsx_runtime","require","import_font_size","import_get_button_sized","import_helpers","import_helpers_tamagui","import_stacks","import_text","import_web","import_react","import_spacer","createStyledContext","color","ellipsis","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","maxFontSizeMultiplier","size","textAlign","variant","BUTTON_NAME","styled","ThemeableStack","name","tag","context","role","focusable","variants","unstyled","false","justifyContent","alignItems","flexWrap","flexDirection","cursor","hoverTheme","pressTheme","backgrounded","borderWidth","borderColor","focusVisibleStyle","outlineColor","outlineStyle","outlineWidth","outlined","backgroundColor","hoverStyle","pressStyle","getButtonSized","disabled","true","pointerEvents","defaultVariants","process","env","TAMAGUI_HEADLESS","SizableText","userSelect","flexGrow","flexShrink","props","children","scaleIcon","useContext","iconSize","getFontSize","getThemedIcon","useGetThemedIcon","ButtonComponent","styleable","ref","buttonProps","jsx","withStaticProperties","Text","Icon","param","textProps","propsIn","arguments","length","isNested","ButtonNestingContext","propsActive","useProps","noNormalize","noExpand","icon","iconAfter","gap","spaceFlex","scaleSpace","noTextWrap","restProps","font","themedIcon","themedIconAfter","map","spaceSize","getVariableValue","contents","wrapChildrenInText","inner","spacedChildren","space","ensureKeys","direction","accessibilityRole","Provider","disableClassName"],"sources":["../../../src/v1/Button.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,G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AAvB,WAAA,CAAclD,aAAY,aAAa,IAC5CkD,WAAA,CAAAlD,aAAA;MAAA;MAC6C;MAE7C4B,QACA,GAGJkC,UAAA,EAAuB,GAAAK,QAAA,EAE3BJ,eAAO;IACP,EACA;IAAApC,KAAA;MACA5C,IAAA;MAIM,IAAA8D,OAAA,CAAA7B,QAAA;QAAA;QAGNvB,SAAW;QAGP;QACJc,iBAAA;UACID,WAAQ;QAAY;MAAA;MAEX;MAAAhB,GAEX,EAAAA,GAAA,KAAA0D,QAAmB;MAAA;MAEnB;MACFE,WAAA,CAAAwB,iBAAA,eAAAxB,WAAA,CAAA1D,IAAA;MAEA,GAAAoE,SACE;MAEIhC,QAAA,qBAAAjE,kBAAA,CAAA4E,GAAA,EAAAtE,aAAA,CAAAgF,oBAAA,CAAA0B,QAAA;QAAA5H,KAAA;QAGA6E,QAAA,EAAAyC;MAEE;MAER;MAEAO,gBACE;IAAmD;EAAA,OAGrD;IACFX,SAAA;IAEAjB,QAAO;IACLrB;EAAA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var import_config_default = require("@tamagui/config-default"),
|
|
2
|
+
import_core = require("@tamagui/core"),
|
|
3
|
+
import_vitest = require("vitest");
|
|
4
|
+
const conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
5
|
+
(0, import_vitest.describe)("Button", () => {
|
|
6
|
+
(0, import_vitest.test)("123", () => {
|
|
7
|
+
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var import_config_default = require("@tamagui/config-default"), import_core = require("@tamagui/core"), import_vitest = require("vitest");
|
|
2
|
+
const conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
3
|
+
(0, import_vitest.describe)("Button", () => {
|
|
4
|
+
(0, import_vitest.test)("123", () => {
|
|
5
|
+
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/v1/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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var import_config_default = require("@tamagui/config-default"),
|
|
4
|
+
import_core = require("@tamagui/core"),
|
|
5
|
+
import_vitest = require("vitest"),
|
|
6
|
+
conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
7
|
+
(0, import_vitest.describe)("Button", function () {
|
|
8
|
+
(0, import_vitest.test)("123", function () {
|
|
9
|
+
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=Button.test.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["import_config_default","require","import_core","import_vitest","conf","createTamagui","getDefaultTamaguiConfig","describe","test","expect","toBeTruthy"],"sources":["../../../src/v1/Button.test.tsx"],"sourcesContent":[null],"mappings":"AAAA;;AAIA,IAAAA,qBAAa,GAAAC,OAAA,0BAAc;EAAAC,WAAA,GAAAD,OAAA,gBAAyB;EAAAE,aAAA,GAAAF,OAAA;EAAAG,IAAA,OAAAF,WAAA,CAAAG,aAAA,MAAAL,qBAAA,CAAAM,uBAAA;AAAA,IAEpDH,aAAA,CAAAI,QAAA,EAAS,UAAU,YAAM;EACvB,IAAAJ,aAAA,CAAAK,IAAA,EAAK,OAAO,YAAM;IAChB,IAAAL,aAAA,CAAAM,MAAA,EAAO,EAAI,EAAEC,UAAA,CAAW;EAC1B,CAAC;AAWH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
7
|
+
get: () => from[key],
|
|
8
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
|
+
});
|
|
10
|
+
return to;
|
|
11
|
+
},
|
|
12
|
+
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
13
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
14
|
+
value: !0
|
|
15
|
+
}), mod);
|
|
16
|
+
var v1_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(v1_exports);
|
|
18
|
+
__reExport(v1_exports, require("./Button.cjs"), module.exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
+
return to;
|
|
10
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
+
var v1_exports = {};
|
|
13
|
+
module.exports = __toCommonJS(v1_exports);
|
|
14
|
+
__reExport(v1_exports, require("./Button"), module.exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
return to;
|
|
13
|
+
},
|
|
14
|
+
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
+
value: !0
|
|
17
|
+
}), mod);
|
|
18
|
+
var v1_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(v1_exports);
|
|
20
|
+
__reExport(v1_exports, require("./Button.native.js"), module.exports);
|
|
21
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","v1_exports","module","exports"],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,UAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,UAAA","ignoreList":[]}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
2
|
+
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
3
|
+
import { withStaticProperties } from "@tamagui/helpers";
|
|
4
|
+
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
5
|
+
import { ButtonNestingContext, ThemeableStack } from "@tamagui/stacks";
|
|
6
|
+
import { SizableText, wrapChildrenInText } from "@tamagui/text";
|
|
7
|
+
import { createStyledContext, getVariableValue, styled, useProps } from "@tamagui/web";
|
|
8
|
+
import { useContext } from "react";
|
|
9
|
+
import { spacedChildren } from "@tamagui/spacer";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
const ButtonContext = createStyledContext({
|
|
12
|
+
// keeping these here means they work with styled() passing down color to text
|
|
13
|
+
color: void 0,
|
|
14
|
+
ellipsis: void 0,
|
|
15
|
+
fontFamily: void 0,
|
|
16
|
+
fontSize: void 0,
|
|
17
|
+
fontStyle: void 0,
|
|
18
|
+
fontWeight: void 0,
|
|
19
|
+
letterSpacing: void 0,
|
|
20
|
+
maxFontSizeMultiplier: void 0,
|
|
21
|
+
size: void 0,
|
|
22
|
+
textAlign: void 0,
|
|
23
|
+
variant: void 0
|
|
24
|
+
}), BUTTON_NAME = "Button", ButtonFrame = styled(ThemeableStack, {
|
|
25
|
+
name: BUTTON_NAME,
|
|
26
|
+
tag: "button",
|
|
27
|
+
context: ButtonContext,
|
|
28
|
+
role: "button",
|
|
29
|
+
focusable: !0,
|
|
30
|
+
variants: {
|
|
31
|
+
unstyled: {
|
|
32
|
+
false: {
|
|
33
|
+
size: "$true",
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
flexWrap: "nowrap",
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
cursor: "pointer",
|
|
39
|
+
hoverTheme: !0,
|
|
40
|
+
pressTheme: !0,
|
|
41
|
+
backgrounded: !0,
|
|
42
|
+
borderWidth: 1,
|
|
43
|
+
borderColor: "transparent",
|
|
44
|
+
focusVisibleStyle: {
|
|
45
|
+
outlineColor: "$outlineColor",
|
|
46
|
+
outlineStyle: "solid",
|
|
47
|
+
outlineWidth: 2
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
variant: {
|
|
52
|
+
outlined: {
|
|
53
|
+
backgroundColor: "transparent",
|
|
54
|
+
borderWidth: 2,
|
|
55
|
+
borderColor: "$borderColor",
|
|
56
|
+
hoverStyle: {
|
|
57
|
+
backgroundColor: "transparent",
|
|
58
|
+
borderColor: "$borderColorHover"
|
|
59
|
+
},
|
|
60
|
+
pressStyle: {
|
|
61
|
+
backgroundColor: "transparent",
|
|
62
|
+
borderColor: "$borderColorPress"
|
|
63
|
+
},
|
|
64
|
+
focusVisibleStyle: {
|
|
65
|
+
backgroundColor: "transparent",
|
|
66
|
+
borderColor: "$borderColorFocus"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
size: {
|
|
71
|
+
"...size": getButtonSized,
|
|
72
|
+
":number": getButtonSized
|
|
73
|
+
},
|
|
74
|
+
disabled: {
|
|
75
|
+
true: {
|
|
76
|
+
pointerEvents: "none"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
defaultVariants: {
|
|
81
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
82
|
+
}
|
|
83
|
+
}), ButtonText = styled(SizableText, {
|
|
84
|
+
name: "Button",
|
|
85
|
+
context: ButtonContext,
|
|
86
|
+
variants: {
|
|
87
|
+
unstyled: {
|
|
88
|
+
false: {
|
|
89
|
+
userSelect: "none",
|
|
90
|
+
cursor: "pointer",
|
|
91
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
92
|
+
flexGrow: 0,
|
|
93
|
+
flexShrink: 1,
|
|
94
|
+
ellipsis: !0,
|
|
95
|
+
color: "$color"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
defaultVariants: {
|
|
100
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
101
|
+
}
|
|
102
|
+
}), ButtonIcon = (props) => {
|
|
103
|
+
const { children, scaleIcon = 1 } = props, { size, color } = useContext(ButtonContext), iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
104
|
+
return useGetThemedIcon({ size: iconSize, color })(children);
|
|
105
|
+
}, ButtonComponent = ButtonFrame.styleable(
|
|
106
|
+
function(props, ref) {
|
|
107
|
+
const { props: buttonProps } = useButton(props);
|
|
108
|
+
return /* @__PURE__ */ jsx(ButtonFrame, { "data-disable-theme": !0, ...buttonProps, ref });
|
|
109
|
+
}
|
|
110
|
+
), Button2 = withStaticProperties(ButtonComponent, {
|
|
111
|
+
Text: ButtonText,
|
|
112
|
+
Icon: ButtonIcon
|
|
113
|
+
});
|
|
114
|
+
function useButton({ textProps, ...propsIn }, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
115
|
+
const isNested = useContext(ButtonNestingContext), propsActive = useProps(propsIn, {
|
|
116
|
+
noNormalize: !0,
|
|
117
|
+
noExpand: !0
|
|
118
|
+
}), {
|
|
119
|
+
icon,
|
|
120
|
+
iconAfter,
|
|
121
|
+
gap,
|
|
122
|
+
spaceFlex,
|
|
123
|
+
scaleIcon = 1,
|
|
124
|
+
scaleSpace = 0.66,
|
|
125
|
+
noTextWrap,
|
|
126
|
+
fontFamily,
|
|
127
|
+
fontSize,
|
|
128
|
+
fontWeight,
|
|
129
|
+
fontStyle,
|
|
130
|
+
letterSpacing,
|
|
131
|
+
tag,
|
|
132
|
+
ellipsis,
|
|
133
|
+
maxFontSizeMultiplier,
|
|
134
|
+
...restProps
|
|
135
|
+
} = propsActive, size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), color = propsActive.color, iconSize = (typeof size == "number" ? size * 0.5 : getFontSize(size, {
|
|
136
|
+
font: fontFamily?.[0] === "$" ? fontFamily : void 0
|
|
137
|
+
})) * scaleIcon, getThemedIcon = useGetThemedIcon({
|
|
138
|
+
size: iconSize,
|
|
139
|
+
color
|
|
140
|
+
}), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = gap ?? getVariableValue(iconSize) * scaleSpace, contents = noTextWrap ? [propsIn.children] : wrapChildrenInText(
|
|
141
|
+
Text,
|
|
142
|
+
{
|
|
143
|
+
children: propsIn.children,
|
|
144
|
+
fontFamily,
|
|
145
|
+
fontSize,
|
|
146
|
+
textProps,
|
|
147
|
+
fontWeight,
|
|
148
|
+
fontStyle,
|
|
149
|
+
letterSpacing,
|
|
150
|
+
ellipsis,
|
|
151
|
+
maxFontSizeMultiplier
|
|
152
|
+
},
|
|
153
|
+
Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
154
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
155
|
+
size
|
|
156
|
+
} : void 0
|
|
157
|
+
), inner = spacedChildren({
|
|
158
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
159
|
+
space: spaceSize,
|
|
160
|
+
spaceFlex,
|
|
161
|
+
ensureKeys: !0,
|
|
162
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
163
|
+
// for keys to stay the same we keep indices as similar a possible
|
|
164
|
+
// so even if icons are undefined we still pass them
|
|
165
|
+
children: [themedIcon, ...contents, themedIconAfter]
|
|
166
|
+
}), props = {
|
|
167
|
+
size,
|
|
168
|
+
...propsIn.disabled && {
|
|
169
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
170
|
+
focusable: void 0,
|
|
171
|
+
// even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
|
|
172
|
+
focusVisibleStyle: {
|
|
173
|
+
borderColor: "$background"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
177
|
+
tag: tag ?? (isNested ? "span" : (
|
|
178
|
+
// defaults to <a /> when accessibilityRole = link
|
|
179
|
+
// see https://github.com/tamagui/tamagui/issues/505
|
|
180
|
+
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
181
|
+
)),
|
|
182
|
+
...restProps,
|
|
183
|
+
children: /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: !0, children: inner }),
|
|
184
|
+
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
185
|
+
disableClassName: !0
|
|
186
|
+
};
|
|
187
|
+
return {
|
|
188
|
+
spaceSize,
|
|
189
|
+
isNested,
|
|
190
|
+
props
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
export {
|
|
194
|
+
Button2 as Button,
|
|
195
|
+
ButtonContext,
|
|
196
|
+
ButtonFrame,
|
|
197
|
+
ButtonIcon,
|
|
198
|
+
ButtonText,
|
|
199
|
+
useButton
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/v1/Button.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB,sBAAsB;AAErD,SAAS,aAAa,0BAA0B;AAEhD,SAAS,qBAAqB,kBAAkB,QAAQ,gBAAgB;AAExE,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAiLpB;AA7K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