@tamagui/button 1.0.1-beta.38
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 +247 -0
- package/dist/cjs/Button.js.map +7 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/Button.js +188 -0
- package/dist/esm/Button.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/jsx/Button.js +175 -0
- package/dist/jsx/index.js +1 -0
- package/package.json +35 -0
- package/types/Button.d.ts +123 -0
- package/types/Button.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
50
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
51
|
+
var Button_exports = {};
|
|
52
|
+
__export(Button_exports, {
|
|
53
|
+
Button: () => Button,
|
|
54
|
+
ButtonText: () => ButtonText
|
|
55
|
+
});
|
|
56
|
+
module.exports = __toCommonJS(Button_exports);
|
|
57
|
+
var import_core = require("@tamagui/core");
|
|
58
|
+
var import_font_size = require("@tamagui/font-size");
|
|
59
|
+
var import_stacks = require("@tamagui/stacks");
|
|
60
|
+
var import_text = require("@tamagui/text");
|
|
61
|
+
var import_react = __toESM(require("react"));
|
|
62
|
+
import_react.default["createElement"];
|
|
63
|
+
const ButtonFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
64
|
+
name: "Button",
|
|
65
|
+
tag: "button",
|
|
66
|
+
hoverable: true,
|
|
67
|
+
pressable: true,
|
|
68
|
+
borderWidth: 1,
|
|
69
|
+
borderColor: "transparent",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
flexWrap: "nowrap",
|
|
73
|
+
cursor: "pointer",
|
|
74
|
+
pressStyle: {
|
|
75
|
+
borderColor: "transparent"
|
|
76
|
+
},
|
|
77
|
+
hoverStyle: {
|
|
78
|
+
borderColor: "transparent"
|
|
79
|
+
},
|
|
80
|
+
focusStyle: {
|
|
81
|
+
borderColor: "$borderColorFocus"
|
|
82
|
+
},
|
|
83
|
+
variants: {
|
|
84
|
+
size: {
|
|
85
|
+
"...size": import_core.getButtonSize
|
|
86
|
+
},
|
|
87
|
+
active: {
|
|
88
|
+
true: {
|
|
89
|
+
hoverStyle: {
|
|
90
|
+
backgroundColor: "$background"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
disabled: {
|
|
95
|
+
true: {
|
|
96
|
+
opacity: 0.5,
|
|
97
|
+
pointerEvents: "none"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
defaultVariants: {
|
|
102
|
+
size: "$4"
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const ButtonText = (0, import_core.styled)(import_text.SizableText, {
|
|
106
|
+
color: "$color",
|
|
107
|
+
selectable: false,
|
|
108
|
+
flexGrow: 1,
|
|
109
|
+
flexShrink: 1,
|
|
110
|
+
ellipse: true
|
|
111
|
+
});
|
|
112
|
+
const ButtonComponent = (0, import_react.forwardRef)((props, ref) => {
|
|
113
|
+
const _a = props, {
|
|
114
|
+
children,
|
|
115
|
+
icon,
|
|
116
|
+
iconAfter,
|
|
117
|
+
noTextWrap,
|
|
118
|
+
theme: themeName,
|
|
119
|
+
space,
|
|
120
|
+
spaceFlex,
|
|
121
|
+
scaleIcon = 1,
|
|
122
|
+
scaleSpace = 0.5,
|
|
123
|
+
color: colorProp,
|
|
124
|
+
fontWeight,
|
|
125
|
+
letterSpacing,
|
|
126
|
+
fontSize,
|
|
127
|
+
fontFamily,
|
|
128
|
+
textAlign,
|
|
129
|
+
textProps
|
|
130
|
+
} = _a, rest = __objRest(_a, [
|
|
131
|
+
"children",
|
|
132
|
+
"icon",
|
|
133
|
+
"iconAfter",
|
|
134
|
+
"noTextWrap",
|
|
135
|
+
"theme",
|
|
136
|
+
"space",
|
|
137
|
+
"spaceFlex",
|
|
138
|
+
"scaleIcon",
|
|
139
|
+
"scaleSpace",
|
|
140
|
+
"color",
|
|
141
|
+
"fontWeight",
|
|
142
|
+
"letterSpacing",
|
|
143
|
+
"fontSize",
|
|
144
|
+
"fontFamily",
|
|
145
|
+
"textAlign",
|
|
146
|
+
"textProps"
|
|
147
|
+
]);
|
|
148
|
+
const isInsideButton = (0, import_react.useContext)(import_core.ButtonInsideButtonContext);
|
|
149
|
+
const theme = (0, import_core.useTheme)();
|
|
150
|
+
const size = props.size || "$4";
|
|
151
|
+
let color;
|
|
152
|
+
if (theme && colorProp && colorProp in theme) {
|
|
153
|
+
color = theme[colorProp];
|
|
154
|
+
} else if (colorProp) {
|
|
155
|
+
color = colorProp;
|
|
156
|
+
} else {
|
|
157
|
+
color = theme == null ? void 0 : theme.color;
|
|
158
|
+
}
|
|
159
|
+
color = color == null ? void 0 : color.toString();
|
|
160
|
+
const iconSize = (0, import_font_size.getFontSize)(size) * scaleIcon;
|
|
161
|
+
const addTheme = /* @__PURE__ */ __name((el) => {
|
|
162
|
+
if ((0, import_react.isValidElement)(el)) {
|
|
163
|
+
return el;
|
|
164
|
+
}
|
|
165
|
+
if (el) {
|
|
166
|
+
return import_react.default.createElement(el, {
|
|
167
|
+
color,
|
|
168
|
+
size: iconSize
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return el;
|
|
172
|
+
}, "addTheme");
|
|
173
|
+
const themedIcon = icon ? addTheme(icon) : null;
|
|
174
|
+
const themedIconAfter = iconAfter ? addTheme(iconAfter) : null;
|
|
175
|
+
let contents = children;
|
|
176
|
+
if (!noTextWrap && children) {
|
|
177
|
+
let concatStringChildren = function() {
|
|
178
|
+
if (!lastIsString)
|
|
179
|
+
return;
|
|
180
|
+
const index = nextChildren.length - 1;
|
|
181
|
+
const childrenStrings = nextChildren[index];
|
|
182
|
+
nextChildren[index] = /* @__PURE__ */ import_react.default.createElement(ButtonText, __spreadValues(__spreadValues(__spreadValues({
|
|
183
|
+
key: index
|
|
184
|
+
}, {
|
|
185
|
+
fontWeight,
|
|
186
|
+
letterSpacing,
|
|
187
|
+
fontSize,
|
|
188
|
+
fontFamily,
|
|
189
|
+
textAlign,
|
|
190
|
+
size
|
|
191
|
+
}), colorProp && {
|
|
192
|
+
color: colorProp
|
|
193
|
+
}), textProps), childrenStrings);
|
|
194
|
+
};
|
|
195
|
+
__name(concatStringChildren, "concatStringChildren");
|
|
196
|
+
let allChildren = import_react.default.Children.toArray(children);
|
|
197
|
+
let nextChildren = [];
|
|
198
|
+
let lastIsString = false;
|
|
199
|
+
for (const child of allChildren) {
|
|
200
|
+
const last = nextChildren[nextChildren.length - 1];
|
|
201
|
+
const isString = typeof child === "string";
|
|
202
|
+
if (isString) {
|
|
203
|
+
if (lastIsString) {
|
|
204
|
+
last.push(child);
|
|
205
|
+
} else {
|
|
206
|
+
nextChildren.push([child]);
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
concatStringChildren();
|
|
210
|
+
nextChildren.push(child);
|
|
211
|
+
}
|
|
212
|
+
lastIsString = isString;
|
|
213
|
+
}
|
|
214
|
+
concatStringChildren();
|
|
215
|
+
contents = nextChildren;
|
|
216
|
+
}
|
|
217
|
+
return /* @__PURE__ */ import_react.default.createElement(import_core.ButtonInsideButtonContext.Provider, {
|
|
218
|
+
value: true
|
|
219
|
+
}, /* @__PURE__ */ import_react.default.createElement(ButtonFrame, __spreadValues(__spreadProps(__spreadValues({
|
|
220
|
+
fontFamily
|
|
221
|
+
}, isInsideButton && {
|
|
222
|
+
tag: "span"
|
|
223
|
+
}), {
|
|
224
|
+
ref
|
|
225
|
+
}), rest), themedIcon || themedIconAfter ? (0, import_core.spacedChildren)({
|
|
226
|
+
space: (0, import_core.getVariableValue)(iconSize) * scaleSpace,
|
|
227
|
+
spaceFlex,
|
|
228
|
+
direction: props.flexDirection || "row",
|
|
229
|
+
children: [themedIcon, contents, themedIconAfter]
|
|
230
|
+
}) : contents));
|
|
231
|
+
});
|
|
232
|
+
const Button = ButtonFrame.extractable((0, import_core.themeable)(ButtonComponent), {
|
|
233
|
+
inlineProps: /* @__PURE__ */ new Set([
|
|
234
|
+
"color",
|
|
235
|
+
"fontWeight",
|
|
236
|
+
"fontSize",
|
|
237
|
+
"fontFamily",
|
|
238
|
+
"letterSpacing",
|
|
239
|
+
"textAlign"
|
|
240
|
+
])
|
|
241
|
+
});
|
|
242
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
243
|
+
0 && (module.exports = {
|
|
244
|
+
Button,
|
|
245
|
+
ButtonText
|
|
246
|
+
});
|
|
247
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n ButtonInsideButtonContext,\n GetProps,\n ReactComponentWithRef,\n ThemeableProps,\n getButtonSize,\n getVariableValue,\n spacedChildren,\n styled,\n themeable,\n useTheme,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, SizableTextProps } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef, isValidElement, useContext } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // dont wrap inner contents in a text element\n noTextWrap?: boolean\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n\n // pass text properties:\n color?: SizableTextProps['color']\n fontWeight?: SizableTextProps['fontWeight']\n fontSize?: SizableTextProps['fontSize']\n fontFamily?: SizableTextProps['fontFamily']\n letterSpacing?: SizableTextProps['letterSpacing']\n textAlign?: SizableTextProps['textAlign']\n\n // all the other text controls\n textProps?: Partial<SizableTextProps>\n }\n\nconst ButtonFrame = styled(ThemeableStack, {\n name: 'Button',\n tag: 'button',\n hoverable: true,\n pressable: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSize,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nconst ButtonComponent = forwardRef((props: ButtonProps, ref) => {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 0.5,\n\n // text props\n color: colorProp,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n ...rest\n } = props as ButtonProps\n\n const isInsideButton = useContext(ButtonInsideButtonContext)\n const theme = useTheme()\n const size = props.size || '$4'\n\n // get color from prop or theme\n let color: any\n // @ts-expect-error\n if (theme && colorProp && colorProp in theme) {\n // @ts-expect-error\n color = theme[colorProp]\n } else if (colorProp) {\n color = colorProp\n } else {\n color = theme?.color\n }\n color = color?.toString()\n\n const iconSize = getFontSize(size) * scaleIcon\n\n const addTheme = (el: any) => {\n if (isValidElement(el)) {\n return el\n }\n if (el) {\n return React.createElement(el, {\n color,\n size: iconSize,\n })\n }\n return el\n }\n const themedIcon = icon ? addTheme(icon) : null\n const themedIconAfter = iconAfter ? addTheme(iconAfter) : null\n\n let contents = children\n\n if (!noTextWrap && children) {\n // in the case of using variables, like so:\n // <Button>Hello, {name}</Button>\n // it gives us props.children as ['Hello, ', 'name']\n // but we don't want to wrap multiple SizableText around each part\n // so we group them\n let allChildren = React.Children.toArray(children)\n let nextChildren: any[] = []\n let lastIsString = false\n\n function concatStringChildren() {\n if (!lastIsString) return\n const index = nextChildren.length - 1\n const childrenStrings = nextChildren[index]\n nextChildren[index] = (\n <ButtonText\n key={index}\n {...{\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n size,\n }}\n {...(colorProp && {\n color: colorProp,\n })}\n {...textProps}\n >\n {childrenStrings}\n </ButtonText>\n )\n }\n\n for (const child of allChildren) {\n const last = nextChildren[nextChildren.length - 1]\n const isString = typeof child === 'string'\n if (isString) {\n if (lastIsString) {\n last.push(child)\n } else {\n nextChildren.push([child])\n }\n } else {\n concatStringChildren()\n nextChildren.push(child)\n }\n lastIsString = isString\n }\n concatStringChildren()\n\n contents = nextChildren\n }\n\n return (\n // careful not to desctructure and re-order props, order is important\n <ButtonInsideButtonContext.Provider value={true}>\n <ButtonFrame\n fontFamily={fontFamily}\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n {...(isInsideButton && {\n tag: 'span',\n })}\n ref={ref as any}\n {...rest}\n >\n {themedIcon || themedIconAfter\n ? spacedChildren({\n // a bit arbitrary but scaling to font size is necessary so long as button does\n space: getVariableValue(iconSize) * scaleSpace,\n spaceFlex,\n direction: props.flexDirection || 'row',\n children: [themedIcon, contents, themedIconAfter],\n })\n : contents}\n </ButtonFrame>\n </ButtonInsideButtonContext.Provider>\n )\n})\n\nexport const Button: ReactComponentWithRef<ButtonProps, HTMLButtonElement | View> =\n ButtonFrame.extractable(themeable(ButtonComponent as any) as any, {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract button anyway)\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAWO;AACP,uBAA4B;AAC5B,oBAA+B;AAC/B,kBAA8C;AAC9C,mBAAiF;AAIjF,qBAAM;AAiCN,MAAM,cAAc,wBAAO,8BAAgB;AAAA,EACzC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU;AAAA,EAGV,QAAQ;AAAA,EAER,YAAY;AAAA,IACV,aAAa;AAAA,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AEE,mDAAC,sCAA0B,UAA1B;AAAA,IAAmC,OAAO;AAAA,KACzC,mDAAC;AAAA,IACC;AAAA,KAEK,kBAAkB;AAAA,IACrB,KAAK;AAAA,EACP,IALD;AAAA,IAMC;AAAA,MACI,OAEH,cAAc,kBACX,gCAAe;AAAA,IAEb,OAAO,kCAAiB,QAAQ,IAAI;AAAA,IACpC;AAAA,IACA,WAAW,MAAM,iBAAiB;AAAA,IAClC,UAAU,CAAC,YAAY,UAAU,eAAe;AAAA,EAClD,CAAC,IACD,QACN,CACF;AAEJ,CAAC;AAEM,MAAM,SACX,YAAY,YAAY,2BAAU,eAAsB,GAAU;AAAA,EAChE,aAAa,oBAAI,IAAI;AAAA,IAEnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./Button"), module.exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import {
|
|
4
|
+
ButtonInsideButtonContext,
|
|
5
|
+
getButtonSize,
|
|
6
|
+
getVariableValue,
|
|
7
|
+
spacedChildren,
|
|
8
|
+
styled,
|
|
9
|
+
themeable,
|
|
10
|
+
useTheme
|
|
11
|
+
} from "@tamagui/core";
|
|
12
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
13
|
+
import { ThemeableStack } from "@tamagui/stacks";
|
|
14
|
+
import { SizableText } from "@tamagui/text";
|
|
15
|
+
import React, { forwardRef, isValidElement, useContext } from "react";
|
|
16
|
+
React["createElement"];
|
|
17
|
+
const ButtonFrame = styled(ThemeableStack, {
|
|
18
|
+
name: "Button",
|
|
19
|
+
tag: "button",
|
|
20
|
+
hoverable: true,
|
|
21
|
+
pressable: true,
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderColor: "transparent",
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
flexWrap: "nowrap",
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
pressStyle: {
|
|
29
|
+
borderColor: "transparent"
|
|
30
|
+
},
|
|
31
|
+
hoverStyle: {
|
|
32
|
+
borderColor: "transparent"
|
|
33
|
+
},
|
|
34
|
+
focusStyle: {
|
|
35
|
+
borderColor: "$borderColorFocus"
|
|
36
|
+
},
|
|
37
|
+
variants: {
|
|
38
|
+
size: {
|
|
39
|
+
"...size": getButtonSize
|
|
40
|
+
},
|
|
41
|
+
active: {
|
|
42
|
+
true: {
|
|
43
|
+
hoverStyle: {
|
|
44
|
+
backgroundColor: "$background"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
true: {
|
|
50
|
+
opacity: 0.5,
|
|
51
|
+
pointerEvents: "none"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
size: "$4"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const ButtonText = styled(SizableText, {
|
|
60
|
+
color: "$color",
|
|
61
|
+
selectable: false,
|
|
62
|
+
flexGrow: 1,
|
|
63
|
+
flexShrink: 1,
|
|
64
|
+
ellipse: true
|
|
65
|
+
});
|
|
66
|
+
const ButtonComponent = forwardRef((props, ref) => {
|
|
67
|
+
const {
|
|
68
|
+
children,
|
|
69
|
+
icon,
|
|
70
|
+
iconAfter,
|
|
71
|
+
noTextWrap,
|
|
72
|
+
theme: themeName,
|
|
73
|
+
space,
|
|
74
|
+
spaceFlex,
|
|
75
|
+
scaleIcon = 1,
|
|
76
|
+
scaleSpace = 0.5,
|
|
77
|
+
color: colorProp,
|
|
78
|
+
fontWeight,
|
|
79
|
+
letterSpacing,
|
|
80
|
+
fontSize,
|
|
81
|
+
fontFamily,
|
|
82
|
+
textAlign,
|
|
83
|
+
textProps,
|
|
84
|
+
...rest
|
|
85
|
+
} = props;
|
|
86
|
+
const isInsideButton = useContext(ButtonInsideButtonContext);
|
|
87
|
+
const theme = useTheme();
|
|
88
|
+
const size = props.size || "$4";
|
|
89
|
+
let color;
|
|
90
|
+
if (theme && colorProp && colorProp in theme) {
|
|
91
|
+
color = theme[colorProp];
|
|
92
|
+
} else if (colorProp) {
|
|
93
|
+
color = colorProp;
|
|
94
|
+
} else {
|
|
95
|
+
color = theme == null ? void 0 : theme.color;
|
|
96
|
+
}
|
|
97
|
+
color = color == null ? void 0 : color.toString();
|
|
98
|
+
const iconSize = getFontSize(size) * scaleIcon;
|
|
99
|
+
const addTheme = /* @__PURE__ */ __name((el) => {
|
|
100
|
+
if (isValidElement(el)) {
|
|
101
|
+
return el;
|
|
102
|
+
}
|
|
103
|
+
if (el) {
|
|
104
|
+
return React.createElement(el, {
|
|
105
|
+
color,
|
|
106
|
+
size: iconSize
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return el;
|
|
110
|
+
}, "addTheme");
|
|
111
|
+
const themedIcon = icon ? addTheme(icon) : null;
|
|
112
|
+
const themedIconAfter = iconAfter ? addTheme(iconAfter) : null;
|
|
113
|
+
let contents = children;
|
|
114
|
+
if (!noTextWrap && children) {
|
|
115
|
+
let concatStringChildren = function() {
|
|
116
|
+
if (!lastIsString)
|
|
117
|
+
return;
|
|
118
|
+
const index = nextChildren.length - 1;
|
|
119
|
+
const childrenStrings = nextChildren[index];
|
|
120
|
+
nextChildren[index] = /* @__PURE__ */ React.createElement(ButtonText, {
|
|
121
|
+
key: index,
|
|
122
|
+
...{
|
|
123
|
+
fontWeight,
|
|
124
|
+
letterSpacing,
|
|
125
|
+
fontSize,
|
|
126
|
+
fontFamily,
|
|
127
|
+
textAlign,
|
|
128
|
+
size
|
|
129
|
+
},
|
|
130
|
+
...colorProp && {
|
|
131
|
+
color: colorProp
|
|
132
|
+
},
|
|
133
|
+
...textProps
|
|
134
|
+
}, childrenStrings);
|
|
135
|
+
};
|
|
136
|
+
__name(concatStringChildren, "concatStringChildren");
|
|
137
|
+
let allChildren = React.Children.toArray(children);
|
|
138
|
+
let nextChildren = [];
|
|
139
|
+
let lastIsString = false;
|
|
140
|
+
for (const child of allChildren) {
|
|
141
|
+
const last = nextChildren[nextChildren.length - 1];
|
|
142
|
+
const isString = typeof child === "string";
|
|
143
|
+
if (isString) {
|
|
144
|
+
if (lastIsString) {
|
|
145
|
+
last.push(child);
|
|
146
|
+
} else {
|
|
147
|
+
nextChildren.push([child]);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
concatStringChildren();
|
|
151
|
+
nextChildren.push(child);
|
|
152
|
+
}
|
|
153
|
+
lastIsString = isString;
|
|
154
|
+
}
|
|
155
|
+
concatStringChildren();
|
|
156
|
+
contents = nextChildren;
|
|
157
|
+
}
|
|
158
|
+
return /* @__PURE__ */ React.createElement(ButtonInsideButtonContext.Provider, {
|
|
159
|
+
value: true
|
|
160
|
+
}, /* @__PURE__ */ React.createElement(ButtonFrame, {
|
|
161
|
+
fontFamily,
|
|
162
|
+
...isInsideButton && {
|
|
163
|
+
tag: "span"
|
|
164
|
+
},
|
|
165
|
+
ref,
|
|
166
|
+
...rest
|
|
167
|
+
}, themedIcon || themedIconAfter ? spacedChildren({
|
|
168
|
+
space: getVariableValue(iconSize) * scaleSpace,
|
|
169
|
+
spaceFlex,
|
|
170
|
+
direction: props.flexDirection || "row",
|
|
171
|
+
children: [themedIcon, contents, themedIconAfter]
|
|
172
|
+
}) : contents));
|
|
173
|
+
});
|
|
174
|
+
const Button = ButtonFrame.extractable(themeable(ButtonComponent), {
|
|
175
|
+
inlineProps: /* @__PURE__ */ new Set([
|
|
176
|
+
"color",
|
|
177
|
+
"fontWeight",
|
|
178
|
+
"fontSize",
|
|
179
|
+
"fontFamily",
|
|
180
|
+
"letterSpacing",
|
|
181
|
+
"textAlign"
|
|
182
|
+
])
|
|
183
|
+
});
|
|
184
|
+
export {
|
|
185
|
+
Button,
|
|
186
|
+
ButtonText
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n ButtonInsideButtonContext,\n GetProps,\n ReactComponentWithRef,\n ThemeableProps,\n getButtonSize,\n getVariableValue,\n spacedChildren,\n styled,\n themeable,\n useTheme,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, SizableTextProps } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef, isValidElement, useContext } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // dont wrap inner contents in a text element\n noTextWrap?: boolean\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n\n // pass text properties:\n color?: SizableTextProps['color']\n fontWeight?: SizableTextProps['fontWeight']\n fontSize?: SizableTextProps['fontSize']\n fontFamily?: SizableTextProps['fontFamily']\n letterSpacing?: SizableTextProps['letterSpacing']\n textAlign?: SizableTextProps['textAlign']\n\n // all the other text controls\n textProps?: Partial<SizableTextProps>\n }\n\nconst ButtonFrame = styled(ThemeableStack, {\n name: 'Button',\n tag: 'button',\n hoverable: true,\n pressable: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSize,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nconst ButtonComponent = forwardRef((props: ButtonProps, ref) => {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 0.5,\n\n // text props\n color: colorProp,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n ...rest\n } = props as ButtonProps\n\n const isInsideButton = useContext(ButtonInsideButtonContext)\n const theme = useTheme()\n const size = props.size || '$4'\n\n // get color from prop or theme\n let color: any\n // @ts-expect-error\n if (theme && colorProp && colorProp in theme) {\n // @ts-expect-error\n color = theme[colorProp]\n } else if (colorProp) {\n color = colorProp\n } else {\n color = theme?.color\n }\n color = color?.toString()\n\n const iconSize = getFontSize(size) * scaleIcon\n\n const addTheme = (el: any) => {\n if (isValidElement(el)) {\n return el\n }\n if (el) {\n return React.createElement(el, {\n color,\n size: iconSize,\n })\n }\n return el\n }\n const themedIcon = icon ? addTheme(icon) : null\n const themedIconAfter = iconAfter ? addTheme(iconAfter) : null\n\n let contents = children\n\n if (!noTextWrap && children) {\n // in the case of using variables, like so:\n // <Button>Hello, {name}</Button>\n // it gives us props.children as ['Hello, ', 'name']\n // but we don't want to wrap multiple SizableText around each part\n // so we group them\n let allChildren = React.Children.toArray(children)\n let nextChildren: any[] = []\n let lastIsString = false\n\n function concatStringChildren() {\n if (!lastIsString) return\n const index = nextChildren.length - 1\n const childrenStrings = nextChildren[index]\n nextChildren[index] = (\n <ButtonText\n key={index}\n {...{\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n size,\n }}\n {...(colorProp && {\n color: colorProp,\n })}\n {...textProps}\n >\n {childrenStrings}\n </ButtonText>\n )\n }\n\n for (const child of allChildren) {\n const last = nextChildren[nextChildren.length - 1]\n const isString = typeof child === 'string'\n if (isString) {\n if (lastIsString) {\n last.push(child)\n } else {\n nextChildren.push([child])\n }\n } else {\n concatStringChildren()\n nextChildren.push(child)\n }\n lastIsString = isString\n }\n concatStringChildren()\n\n contents = nextChildren\n }\n\n return (\n // careful not to desctructure and re-order props, order is important\n <ButtonInsideButtonContext.Provider value={true}>\n <ButtonFrame\n fontFamily={fontFamily}\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n {...(isInsideButton && {\n tag: 'span',\n })}\n ref={ref as any}\n {...rest}\n >\n {themedIcon || themedIconAfter\n ? spacedChildren({\n // a bit arbitrary but scaling to font size is necessary so long as button does\n space: getVariableValue(iconSize) * scaleSpace,\n spaceFlex,\n direction: props.flexDirection || 'row',\n children: [themedIcon, contents, themedIconAfter],\n })\n : contents}\n </ButtonFrame>\n </ButtonInsideButtonContext.Provider>\n )\n})\n\nexport const Button: ReactComponentWithRef<ButtonProps, HTMLButtonElement | View> =\n ButtonFrame.extractable(themeable(ButtonComponent as any) as any, {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract button anyway)\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n })\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AACA;AACA;AACA;AAIA,MAAM;AAiCN,MAAM,cAAc,OAAO,gBAAgB;AAAA,EACzC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU;AAAA,EAGV,QAAQ;AAAA,EAER,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,IAEA,UAAU;AAAA,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AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import {
|
|
4
|
+
ButtonInsideButtonContext,
|
|
5
|
+
getButtonSize,
|
|
6
|
+
getVariableValue,
|
|
7
|
+
spacedChildren,
|
|
8
|
+
styled,
|
|
9
|
+
themeable,
|
|
10
|
+
useTheme
|
|
11
|
+
} from "@tamagui/core";
|
|
12
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
13
|
+
import { ThemeableStack } from "@tamagui/stacks";
|
|
14
|
+
import { SizableText } from "@tamagui/text";
|
|
15
|
+
import React, { forwardRef, isValidElement, useContext } from "react";
|
|
16
|
+
React["createElement"];
|
|
17
|
+
const ButtonFrame = styled(ThemeableStack, {
|
|
18
|
+
name: "Button",
|
|
19
|
+
tag: "button",
|
|
20
|
+
hoverable: true,
|
|
21
|
+
pressable: true,
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderColor: "transparent",
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
flexWrap: "nowrap",
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
pressStyle: {
|
|
29
|
+
borderColor: "transparent"
|
|
30
|
+
},
|
|
31
|
+
hoverStyle: {
|
|
32
|
+
borderColor: "transparent"
|
|
33
|
+
},
|
|
34
|
+
focusStyle: {
|
|
35
|
+
borderColor: "$borderColorFocus"
|
|
36
|
+
},
|
|
37
|
+
variants: {
|
|
38
|
+
size: {
|
|
39
|
+
"...size": getButtonSize
|
|
40
|
+
},
|
|
41
|
+
active: {
|
|
42
|
+
true: {
|
|
43
|
+
hoverStyle: {
|
|
44
|
+
backgroundColor: "$background"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
true: {
|
|
50
|
+
opacity: 0.5,
|
|
51
|
+
pointerEvents: "none"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
size: "$4"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const ButtonText = styled(SizableText, {
|
|
60
|
+
color: "$color",
|
|
61
|
+
selectable: false,
|
|
62
|
+
flexGrow: 1,
|
|
63
|
+
flexShrink: 1,
|
|
64
|
+
ellipse: true
|
|
65
|
+
});
|
|
66
|
+
const ButtonComponent = forwardRef((props, ref) => {
|
|
67
|
+
const {
|
|
68
|
+
children,
|
|
69
|
+
icon,
|
|
70
|
+
iconAfter,
|
|
71
|
+
noTextWrap,
|
|
72
|
+
theme: themeName,
|
|
73
|
+
space,
|
|
74
|
+
spaceFlex,
|
|
75
|
+
scaleIcon = 1,
|
|
76
|
+
scaleSpace = 0.5,
|
|
77
|
+
color: colorProp,
|
|
78
|
+
fontWeight,
|
|
79
|
+
letterSpacing,
|
|
80
|
+
fontSize,
|
|
81
|
+
fontFamily,
|
|
82
|
+
textAlign,
|
|
83
|
+
textProps,
|
|
84
|
+
...rest
|
|
85
|
+
} = props;
|
|
86
|
+
const isInsideButton = useContext(ButtonInsideButtonContext);
|
|
87
|
+
const theme = useTheme();
|
|
88
|
+
const size = props.size || "$4";
|
|
89
|
+
let color;
|
|
90
|
+
if (theme && colorProp && colorProp in theme) {
|
|
91
|
+
color = theme[colorProp];
|
|
92
|
+
} else if (colorProp) {
|
|
93
|
+
color = colorProp;
|
|
94
|
+
} else {
|
|
95
|
+
color = theme == null ? void 0 : theme.color;
|
|
96
|
+
}
|
|
97
|
+
color = color == null ? void 0 : color.toString();
|
|
98
|
+
const iconSize = getFontSize(size) * scaleIcon;
|
|
99
|
+
const addTheme = /* @__PURE__ */ __name((el) => {
|
|
100
|
+
if (isValidElement(el)) {
|
|
101
|
+
return el;
|
|
102
|
+
}
|
|
103
|
+
if (el) {
|
|
104
|
+
return React.createElement(el, {
|
|
105
|
+
color,
|
|
106
|
+
size: iconSize
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return el;
|
|
110
|
+
}, "addTheme");
|
|
111
|
+
const themedIcon = icon ? addTheme(icon) : null;
|
|
112
|
+
const themedIconAfter = iconAfter ? addTheme(iconAfter) : null;
|
|
113
|
+
let contents = children;
|
|
114
|
+
if (!noTextWrap && children) {
|
|
115
|
+
let concatStringChildren = function() {
|
|
116
|
+
if (!lastIsString)
|
|
117
|
+
return;
|
|
118
|
+
const index = nextChildren.length - 1;
|
|
119
|
+
const childrenStrings = nextChildren[index];
|
|
120
|
+
nextChildren[index] = <ButtonText key={index} {...{
|
|
121
|
+
fontWeight,
|
|
122
|
+
letterSpacing,
|
|
123
|
+
fontSize,
|
|
124
|
+
fontFamily,
|
|
125
|
+
textAlign,
|
|
126
|
+
size
|
|
127
|
+
}} {...colorProp && {
|
|
128
|
+
color: colorProp
|
|
129
|
+
}} {...textProps}>{childrenStrings}</ButtonText>;
|
|
130
|
+
};
|
|
131
|
+
__name(concatStringChildren, "concatStringChildren");
|
|
132
|
+
let allChildren = React.Children.toArray(children);
|
|
133
|
+
let nextChildren = [];
|
|
134
|
+
let lastIsString = false;
|
|
135
|
+
for (const child of allChildren) {
|
|
136
|
+
const last = nextChildren[nextChildren.length - 1];
|
|
137
|
+
const isString = typeof child === "string";
|
|
138
|
+
if (isString) {
|
|
139
|
+
if (lastIsString) {
|
|
140
|
+
last.push(child);
|
|
141
|
+
} else {
|
|
142
|
+
nextChildren.push([child]);
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
concatStringChildren();
|
|
146
|
+
nextChildren.push(child);
|
|
147
|
+
}
|
|
148
|
+
lastIsString = isString;
|
|
149
|
+
}
|
|
150
|
+
concatStringChildren();
|
|
151
|
+
contents = nextChildren;
|
|
152
|
+
}
|
|
153
|
+
return <ButtonInsideButtonContext.Provider value={true}><ButtonFrame fontFamily={fontFamily} {...isInsideButton && {
|
|
154
|
+
tag: "span"
|
|
155
|
+
}} ref={ref} {...rest}>{themedIcon || themedIconAfter ? spacedChildren({
|
|
156
|
+
space: getVariableValue(iconSize) * scaleSpace,
|
|
157
|
+
spaceFlex,
|
|
158
|
+
direction: props.flexDirection || "row",
|
|
159
|
+
children: [themedIcon, contents, themedIconAfter]
|
|
160
|
+
}) : contents}</ButtonFrame></ButtonInsideButtonContext.Provider>;
|
|
161
|
+
});
|
|
162
|
+
const Button = ButtonFrame.extractable(themeable(ButtonComponent), {
|
|
163
|
+
inlineProps: /* @__PURE__ */ new Set([
|
|
164
|
+
"color",
|
|
165
|
+
"fontWeight",
|
|
166
|
+
"fontSize",
|
|
167
|
+
"fontFamily",
|
|
168
|
+
"letterSpacing",
|
|
169
|
+
"textAlign"
|
|
170
|
+
])
|
|
171
|
+
});
|
|
172
|
+
export {
|
|
173
|
+
Button,
|
|
174
|
+
ButtonText
|
|
175
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Button";
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tamagui/button",
|
|
3
|
+
"version": "1.0.1-beta.38",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"source": "src/index.ts",
|
|
6
|
+
"types": "./types/index.d.ts",
|
|
7
|
+
"main": "dist/cjs",
|
|
8
|
+
"module": "dist/esm",
|
|
9
|
+
"module:jsx": "dist/jsx",
|
|
10
|
+
"files": [
|
|
11
|
+
"types",
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tamagui-build",
|
|
16
|
+
"watch": "tamagui-build --watch"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@tamagui/core": "^1.0.1-beta.38",
|
|
20
|
+
"@tamagui/font-size": "^1.0.1-beta.38"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": "*",
|
|
24
|
+
"react-dom": "*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@tamagui/build": "^1.0.1-beta.38",
|
|
28
|
+
"react": "*",
|
|
29
|
+
"react-dom": "*"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
|
|
35
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { GetProps, ReactComponentWithRef, ThemeableProps } from '@tamagui/core';
|
|
2
|
+
import { SizableTextProps } from '@tamagui/text';
|
|
3
|
+
import { FunctionComponent } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
declare type ButtonIconProps = {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
};
|
|
9
|
+
declare type IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null;
|
|
10
|
+
export declare type ButtonProps = GetProps<typeof ButtonFrame> & ThemeableProps & {
|
|
11
|
+
icon?: IconProp;
|
|
12
|
+
iconAfter?: IconProp;
|
|
13
|
+
scaleIcon?: number;
|
|
14
|
+
noTextWrap?: boolean;
|
|
15
|
+
spaceFlex?: number | boolean;
|
|
16
|
+
scaleSpace?: number;
|
|
17
|
+
color?: SizableTextProps['color'];
|
|
18
|
+
fontWeight?: SizableTextProps['fontWeight'];
|
|
19
|
+
fontSize?: SizableTextProps['fontSize'];
|
|
20
|
+
fontFamily?: SizableTextProps['fontFamily'];
|
|
21
|
+
letterSpacing?: SizableTextProps['letterSpacing'];
|
|
22
|
+
textAlign?: SizableTextProps['textAlign'];
|
|
23
|
+
textProps?: Partial<SizableTextProps>;
|
|
24
|
+
};
|
|
25
|
+
declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
26
|
+
fullscreen?: boolean | undefined;
|
|
27
|
+
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
28
|
+
} & {
|
|
29
|
+
fontFamily?: unknown;
|
|
30
|
+
hoverable?: boolean | undefined;
|
|
31
|
+
pressable?: boolean | undefined;
|
|
32
|
+
focusable?: boolean | undefined;
|
|
33
|
+
circular?: boolean | undefined;
|
|
34
|
+
pad?: boolean | undefined;
|
|
35
|
+
elevate?: boolean | undefined;
|
|
36
|
+
bordered?: number | boolean | undefined;
|
|
37
|
+
transparent?: boolean | undefined;
|
|
38
|
+
chromeless?: boolean | undefined;
|
|
39
|
+
}, "disabled" | "size" | "active"> & {
|
|
40
|
+
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
41
|
+
active?: boolean | undefined;
|
|
42
|
+
disabled?: boolean | undefined;
|
|
43
|
+
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
44
|
+
fullscreen?: boolean | undefined;
|
|
45
|
+
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
fontFamily?: unknown;
|
|
48
|
+
hoverable?: boolean | undefined;
|
|
49
|
+
pressable?: boolean | undefined;
|
|
50
|
+
focusable?: boolean | undefined;
|
|
51
|
+
circular?: boolean | undefined;
|
|
52
|
+
pad?: boolean | undefined;
|
|
53
|
+
elevate?: boolean | undefined;
|
|
54
|
+
bordered?: number | boolean | undefined;
|
|
55
|
+
transparent?: boolean | undefined;
|
|
56
|
+
chromeless?: boolean | undefined;
|
|
57
|
+
}, "disabled" | "size" | "active"> & {
|
|
58
|
+
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
59
|
+
active?: boolean | undefined;
|
|
60
|
+
disabled?: boolean | undefined;
|
|
61
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
62
|
+
fullscreen?: boolean | undefined;
|
|
63
|
+
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
64
|
+
} & {
|
|
65
|
+
fontFamily?: unknown;
|
|
66
|
+
hoverable?: boolean | undefined;
|
|
67
|
+
pressable?: boolean | undefined;
|
|
68
|
+
focusable?: boolean | undefined;
|
|
69
|
+
circular?: boolean | undefined;
|
|
70
|
+
pad?: boolean | undefined;
|
|
71
|
+
elevate?: boolean | undefined;
|
|
72
|
+
bordered?: number | boolean | undefined;
|
|
73
|
+
transparent?: boolean | undefined;
|
|
74
|
+
chromeless?: boolean | undefined;
|
|
75
|
+
}, "disabled" | "size" | "active"> & {
|
|
76
|
+
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
77
|
+
active?: boolean | undefined;
|
|
78
|
+
disabled?: boolean | undefined;
|
|
79
|
+
}>>, any, import("@tamagui/core").StackPropsBase, {
|
|
80
|
+
fullscreen?: boolean | undefined;
|
|
81
|
+
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
82
|
+
} & {
|
|
83
|
+
fontFamily?: unknown;
|
|
84
|
+
hoverable?: boolean | undefined;
|
|
85
|
+
pressable?: boolean | undefined;
|
|
86
|
+
focusable?: boolean | undefined;
|
|
87
|
+
circular?: boolean | undefined;
|
|
88
|
+
pad?: boolean | undefined;
|
|
89
|
+
elevate?: boolean | undefined;
|
|
90
|
+
bordered?: number | boolean | undefined;
|
|
91
|
+
transparent?: boolean | undefined;
|
|
92
|
+
chromeless?: boolean | undefined;
|
|
93
|
+
} & {
|
|
94
|
+
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
95
|
+
active?: boolean | undefined;
|
|
96
|
+
disabled?: boolean | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
export declare const ButtonText: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
99
|
+
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
100
|
+
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
101
|
+
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
102
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
103
|
+
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
104
|
+
}>>) | (Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|
|
105
|
+
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
106
|
+
}, string | number> & {
|
|
107
|
+
[x: string]: undefined;
|
|
108
|
+
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|
|
109
|
+
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
110
|
+
}, string | number> & {
|
|
111
|
+
[x: string]: undefined;
|
|
112
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|
|
113
|
+
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
114
|
+
}, string | number> & {
|
|
115
|
+
[x: string]: undefined;
|
|
116
|
+
}>>), any, import("@tamagui/core").TextPropsBase, {
|
|
117
|
+
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
118
|
+
} & ({} | {
|
|
119
|
+
[x: string]: undefined;
|
|
120
|
+
})>;
|
|
121
|
+
export declare const Button: ReactComponentWithRef<ButtonProps, HTMLButtonElement | View>;
|
|
122
|
+
export {};
|
|
123
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mapp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