@tamagui/button 3.0.0-beta.807.1 → 3.0.0-beta.831.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Button.cjs +18 -103
- package/dist/cjs/Button.native.cjs +18 -126
- package/dist/cjs/Button.native.js +18 -126
- package/dist/cjs/Button.native.js.map +1 -1
- package/dist/esm/Button.mjs +21 -104
- package/dist/esm/Button.mjs.map +1 -1
- package/dist/esm/Button.native.js +21 -127
- package/dist/esm/Button.native.js.map +1 -1
- package/dist/jsx/Button.mjs +21 -104
- package/dist/jsx/Button.mjs.map +1 -1
- package/dist/jsx/Button.native.cjs +18 -126
- package/dist/jsx/Button.native.js +18 -126
- package/dist/jsx/Button.native.js.map +1 -1
- package/package.json +11 -11
- package/src/Button.tsx +68 -190
- package/types/Button.d.ts +38 -275
- package/types/Button.d.ts.map +1 -1
package/dist/jsx/Button.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":[],"sources":["jsx/Button.js"],"sourcesContent":["import { useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { ButtonNestingContext } from \"@tamagui/stacks\";\nimport { wrapChildrenInText } from \"@tamagui/text\";\nimport {\n createStyledContext,\n createStyledHOC,\n isVariable,\n styled,\n Text,\n useProps,\n View,\n withStaticProperties\n} from \"@tamagui/web\";\nimport { useContext } from \"react\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst buttonContextKeys = [\n \"color\",\n \"ellipsis\",\n \"fontFamily\",\n \"fontSize\",\n \"fontStyle\",\n \"fontWeight\",\n \"letterSpacing\",\n \"maxFontSizeMultiplier\",\n \"textAlign\"\n];\nconst ButtonContext = createStyledContext(\n {\n color: void 0,\n ellipsis: void 0,\n fontFamily: void 0,\n fontSize: void 0,\n fontStyle: void 0,\n fontWeight: void 0,\n letterSpacing: void 0,\n maxFontSizeMultiplier: void 0,\n textAlign: void 0\n },\n {\n keys: buttonContextKeys\n }\n);\nconst ButtonFrame = styled(View, {\n context: ButtonContext,\n displayName: \"ButtonFrame\",\n role: \"button\",\n render: /* @__PURE__ */ jsx(\"button\", { type: \"button\" }),\n tabIndex: 0,\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"nowrap\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nconst ButtonText = styled(Text, {\n context: ButtonContext,\n displayName: \"ButtonText\",\n // flexGrow 1 pushes text to the start of its parent on native\n flexGrow: 0,\n flexShrink: 1\n});\nconst isOpaqueColor = (value) => typeof value === \"object\" && value !== null && (\"dynamic\" in value || \"semantic\" in value || \"resource_paths\" in value);\nconst ButtonIcon = ({ children, color, scaleIcon = 1, size }) => {\n const styledContext = ButtonContext.useStyledContext();\n const iconColor = color ?? styledContext?.color;\n const getThemedIcon = useGetThemedIcon({\n // icons take one concrete color: conditional values (numbers, flat\n // objects) fall back to the theme color\n color: typeof iconColor === \"string\" && iconColor !== \"unset\" || isVariable(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,\n size: size === void 0 ? void 0 : size * scaleIcon\n });\n return getThemedIcon(children);\n};\nconst buttonInternalPropNames = [\n \"children\",\n \"color\",\n \"disabled\",\n \"ellipsis\",\n \"fontFamily\",\n \"fontSize\",\n \"fontStyle\",\n \"fontWeight\",\n \"icon\",\n \"iconAfter\",\n \"iconSize\",\n \"letterSpacing\",\n \"maxFontSizeMultiplier\",\n \"noTextWrap\",\n \"render\",\n \"scaleIcon\",\n \"textAlign\",\n \"textProps\"\n];\nfunction useButton(propsIn, {\n Text: Text2 = ButtonText,\n iconColor: iconColorOption,\n iconSize: iconSizeOption,\n textProps: textPropsOption\n} = {}) {\n const isNested = useContext(ButtonNestingContext);\n const styledContext = ButtonContext.useStyledContext();\n const processedProps = useProps(propsIn, {\n noNormalize: true,\n noExpand: true\n });\n const {\n children,\n color,\n disabled,\n ellipsis,\n fontFamily,\n fontSize,\n fontStyle,\n fontWeight,\n icon,\n iconAfter,\n iconSize,\n letterSpacing,\n maxFontSizeMultiplier,\n noTextWrap,\n render,\n scaleIcon = 1,\n textAlign,\n textProps\n } = processedProps;\n const frameProps = { ...propsIn };\n for (const key of buttonInternalPropNames) {\n delete frameProps[key];\n }\n const contextColor = color ?? styledContext?.color;\n const iconColor = iconColorOption ?? contextColor;\n const resolvedIconSize = iconSize ?? iconSizeOption;\n const getThemedIcon = useGetThemedIcon({\n // icons take one concrete color: conditional values (numbers, flat\n // objects) fall back to the theme color\n color: typeof iconColor === \"string\" && iconColor !== \"unset\" || isVariable(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,\n size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon\n });\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map((item) => {\n return item ? getThemedIcon(item) : null;\n });\n const textContext = {\n color: contextColor,\n ellipsis: ellipsis ?? styledContext?.ellipsis,\n fontFamily: fontFamily ?? styledContext?.fontFamily,\n fontSize: fontSize ?? styledContext?.fontSize,\n fontStyle: fontStyle ?? styledContext?.fontStyle,\n fontWeight: fontWeight ?? styledContext?.fontWeight,\n letterSpacing: letterSpacing ?? styledContext?.letterSpacing,\n maxFontSizeMultiplier: maxFontSizeMultiplier ?? styledContext?.maxFontSizeMultiplier,\n textAlign: textAlign ?? styledContext?.textAlign\n };\n const wrappedChildren = wrapChildrenInText(\n Text2,\n {\n children,\n ...textContext,\n noTextWrap,\n textProps\n },\n {\n ...textPropsOption,\n ...processedProps.size === void 0 ? null : { size: processedProps.size }\n }\n );\n const resolvedRender = render ?? (isNested ? \"span\" : processedProps.accessibilityRole === \"link\" || processedProps.role === \"link\" ? \"a\" : disabled ? /* @__PURE__ */ jsx(\"button\", { type: \"button\", disabled: true }) : void 0);\n const props = {\n ...frameProps,\n ...disabled && {\n \"aria-disabled\": true,\n disabled: true,\n tabIndex: -1\n },\n ...resolvedRender === void 0 ? null : { render: resolvedRender },\n ...isNested && {\n // a nested Button is a presentation part, not a control: strip the\n // interactive semantics so we never place a focusable role=button (with\n // its own press/keyboard handlers) inside the outer native <button>. that\n // nesting is invalid html, adds an extra focus stop, and bubbles\n // activation to the outer control. resolvedRender already makes it a span.\n role: \"none\",\n tabIndex: -1,\n \"aria-disabled\": void 0,\n disabled: void 0,\n onPress: void 0,\n onPressIn: void 0,\n onPressOut: void 0,\n onLongPress: void 0,\n onClick: void 0,\n onKeyDown: void 0,\n onKeyUp: void 0\n },\n children: /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: true, children: /* @__PURE__ */ jsxs(ButtonContext.Provider, { ...textContext, children: [\n themedIcon,\n wrappedChildren,\n themedIconAfter\n ] }) })\n };\n return {\n isNested,\n props\n };\n}\nconst ButtonComponent = createStyledHOC(\n ButtonFrame,\n function Button(props, ref) {\n const { props: buttonProps } = useButton(props);\n return /* @__PURE__ */ jsx(ButtonFrame, { ref, ...buttonProps });\n }\n);\nconst Button2 = withStaticProperties(ButtonComponent, {\n Apply: ButtonContext.Provider,\n Frame: ButtonFrame,\n Icon: ButtonIcon,\n Text: ButtonText\n});\nexport {\n Button2 as Button,\n ButtonContext,\n ButtonFrame,\n ButtonIcon,\n ButtonText,\n useButton\n};\n//# sourceMappingURL=Button.js.map\n"],"mappings":";;;;;;;;AAeA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,gBAAgB,oBACpB;CACE,OAAO,KAAK;CACZ,UAAU,KAAK;CACf,YAAY,KAAK;CACjB,UAAU,KAAK;CACf,WAAW,KAAK;CAChB,YAAY,KAAK;CACjB,eAAe,KAAK;CACpB,uBAAuB,KAAK;CAC5B,WAAW,KAAK;AAClB,GACA,EACE,MAAM,kBACR,CACF;AACA,MAAM,cAAc,OAAO,MAAM;CAC/B,SAAS;CACT,aAAa;CACb,MAAM;CACN,QAAwB,oBAAI,UAAU,EAAE,MAAM,SAAS,CAAC;CACxD,UAAU;CACV,YAAY;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A,UAA0B,oBAAI,qBAAqB,UAAU;GAAE,OAAO;GAAM,UAA0B,qBAAK,cAAc,UAAU;IAAE,GAAG;IAAa,UAAU;KAC7J;KACA;KACA;IACF;GAAE,CAAC;EAAE,CAAC;CACR;CACA,OAAO;EACL;EACA;CACF;AACF;AACA,MAAM,kBAAkB,gBACtB,aACA,SAAS,OAAO,OAAO,KAAK;CAC1B,MAAM,EAAE,OAAO,gBAAgB,UAAU,KAAK;CAC9C,OAAuB,oBAAI,aAAa;EAAE;EAAK,GAAG;CAAY,CAAC;AACjE,CACF;AACA,MAAM,UAAU,qBAAqB,iBAAiB;CACpD,OAAO,cAAc;CACrB,OAAO;CACP,MAAM;CACN,MAAM;AACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"Button.js","names":[],"sources":["jsx/Button.js"],"sourcesContent":["import { useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { ButtonNestingContext } from \"@tamagui/stacks\";\nimport { textParentProps, wrapChildrenInText } from \"@tamagui/text\";\nimport { splitStyleProps, styled, Text, View } from \"@tamagui/web\";\nimport { useContext } from \"react\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst ButtonFrame = styled(View, {\n // role is the cross-platform one; render only lands on web\n role: \"button\",\n render: /* @__PURE__ */ jsx(\"button\", { type: \"button\" }),\n tabIndex: 0,\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"nowrap\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nconst ButtonText = styled(Text, {\n // flexGrow 1 pushes text to the start of its parent on native\n flexGrow: 0,\n flexShrink: 1\n});\nconst ButtonIcon = ({ children, color, scaleIcon = 1, size }) => {\n const getThemedIcon = useGetThemedIcon({\n color,\n size: size === void 0 ? void 0 : size * scaleIcon\n });\n return getThemedIcon(children);\n};\nfunction useButton(propsIn, {\n Text: Text2 = ButtonText,\n iconColor,\n iconSize: iconSizeOption,\n textProps: textPropsOption\n} = {}) {\n const isNested = useContext(ButtonNestingContext);\n const [wrappedTextProps, buttonProps] = splitStyleProps(propsIn, {\n expandShorthands: true,\n filter: textParentProps\n });\n const {\n children,\n disabled,\n icon,\n iconAfter,\n iconSize,\n render,\n scaleIcon = 1,\n ...frameProps\n } = buttonProps;\n const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n const resolvedIconSize = iconSize ?? iconSizeOption;\n const getThemedIcon = useGetThemedIcon({\n color: iconColor,\n size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon\n });\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map((item) => {\n return item ? getThemedIcon(item) : null;\n });\n const wrappedChildren = wrapChildrenInText(\n Text2,\n { children, noTextWrap, textProps },\n { ...textPropsOption, ...textStyleProps }\n );\n const resolvedRender = render ?? (isNested ? \"span\" : disabled ? /* @__PURE__ */ jsx(\"button\", { type: \"button\", disabled: true }) : void 0);\n const resolvedProps = {\n ...frameProps,\n ...disabled && {\n \"aria-disabled\": true,\n disabled: true,\n tabIndex: -1\n },\n ...resolvedRender === void 0 ? null : { render: resolvedRender },\n ...isNested && {\n // a nested Button is a presentation part, not a control: strip the\n // interactive semantics so we never place a focusable role=button (with\n // its own press/keyboard handlers) inside the outer native <button>. that\n // nesting is invalid html, adds an extra focus stop, and bubbles\n // activation to the outer control. resolvedRender already makes it a span.\n role: \"none\",\n tabIndex: -1,\n \"aria-disabled\": void 0,\n disabled: void 0,\n onPress: void 0,\n onPressIn: void 0,\n onPressOut: void 0,\n onLongPress: void 0,\n onClick: void 0,\n onKeyDown: void 0,\n onKeyUp: void 0\n },\n children: /* @__PURE__ */ jsxs(ButtonNestingContext.Provider, { value: true, children: [\n themedIcon,\n wrappedChildren,\n themedIconAfter\n ] })\n };\n return {\n isNested,\n props: resolvedProps\n };\n}\nexport {\n ButtonFrame,\n ButtonIcon,\n ButtonText,\n useButton\n};\n//# sourceMappingURL=Button.js.map\n"],"mappings":";;;;;;;;AAMA,MAAM,cAAc,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1I,MAAM,gBAAgB;EACpB,GAAG;EACH,GAAG,YAAY;GACb,iBAAiB;GACjB,UAAU;GACV,UAAU,CAAC;EACb;EACA,GAAG,mBAAmB,KAAK,IAAI,OAAO,EAAE,QAAQ,eAAe;EAC/D,GAAG,YAAY;GAMb,MAAM;GACN,UAAU,CAAC;GACX,iBAAiB,KAAK;GACtB,UAAU,KAAK;GACf,SAAS,KAAK;GACd,WAAW,KAAK;GAChB,YAAY,KAAK;GACjB,aAAa,KAAK;GAClB,SAAS,KAAK;GACd,WAAW,KAAK;GAChB,SAAS,KAAK;EAChB;EACA,UAA0B,qBAAK,qBAAqB,UAAU;GAAE,OAAO;GAAM,UAAU;IACrF;IACA;IACA;GACF;EAAE,CAAC;CACL;CACA,OAAO;EACL;EACA,OAAO;CACT;AACF"}
|
|
@@ -22,8 +22,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
22
22
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
23
|
var Button_exports = {};
|
|
24
24
|
__export(Button_exports, {
|
|
25
|
-
Button: () => Button2,
|
|
26
|
-
ButtonContext: () => ButtonContext,
|
|
27
25
|
ButtonFrame: () => ButtonFrame,
|
|
28
26
|
ButtonIcon: () => ButtonIcon,
|
|
29
27
|
ButtonText: () => ButtonText,
|
|
@@ -36,35 +34,7 @@ var import_stacks = require("@tamagui/stacks");
|
|
|
36
34
|
var import_text = require("@tamagui/text");
|
|
37
35
|
var import_web = require("@tamagui/web");
|
|
38
36
|
var import_react = require("react");
|
|
39
|
-
function _type_of(obj) {
|
|
40
|
-
"@swc/helpers - typeof";
|
|
41
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
42
|
-
}
|
|
43
|
-
var buttonContextKeys = [
|
|
44
|
-
"color",
|
|
45
|
-
"ellipsis",
|
|
46
|
-
"fontFamily",
|
|
47
|
-
"fontSize",
|
|
48
|
-
"fontStyle",
|
|
49
|
-
"fontWeight",
|
|
50
|
-
"letterSpacing",
|
|
51
|
-
"maxFontSizeMultiplier",
|
|
52
|
-
"textAlign"
|
|
53
|
-
];
|
|
54
|
-
var ButtonContext = (0, import_web.createStyledContext)({
|
|
55
|
-
color: void 0,
|
|
56
|
-
ellipsis: void 0,
|
|
57
|
-
fontFamily: void 0,
|
|
58
|
-
fontSize: void 0,
|
|
59
|
-
fontStyle: void 0,
|
|
60
|
-
fontWeight: void 0,
|
|
61
|
-
letterSpacing: void 0,
|
|
62
|
-
maxFontSizeMultiplier: void 0,
|
|
63
|
-
textAlign: void 0
|
|
64
|
-
}, { keys: buttonContextKeys });
|
|
65
37
|
var ButtonFrame = (0, import_web.styled)(import_web.View, {
|
|
66
|
-
context: ButtonContext,
|
|
67
|
-
displayName: "ButtonFrame",
|
|
68
38
|
role: "button",
|
|
69
39
|
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button" }),
|
|
70
40
|
tabIndex: 0,
|
|
@@ -75,109 +45,47 @@ var ButtonFrame = (0, import_web.styled)(import_web.View, {
|
|
|
75
45
|
variants: { disabled: { true: { pointerEvents: "none" } } }
|
|
76
46
|
});
|
|
77
47
|
var ButtonText = (0, import_web.styled)(import_web.Text, {
|
|
78
|
-
context: ButtonContext,
|
|
79
|
-
displayName: "ButtonText",
|
|
80
48
|
flexGrow: 0,
|
|
81
49
|
flexShrink: 1
|
|
82
50
|
});
|
|
83
|
-
var isOpaqueColor = function(value) {
|
|
84
|
-
return (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null && ("dynamic" in value || "semantic" in value || "resource_paths" in value);
|
|
85
|
-
};
|
|
86
51
|
var ButtonIcon = function(param) {
|
|
87
52
|
var { children, color, scaleIcon = 1, size } = param;
|
|
88
|
-
var styledContext = ButtonContext.useStyledContext();
|
|
89
|
-
var iconColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
|
|
90
53
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
91
|
-
color
|
|
54
|
+
color,
|
|
92
55
|
size: size === void 0 ? void 0 : size * scaleIcon
|
|
93
56
|
});
|
|
94
57
|
return getThemedIcon(children);
|
|
95
58
|
};
|
|
96
|
-
var buttonInternalPropNames = [
|
|
97
|
-
"children",
|
|
98
|
-
"color",
|
|
99
|
-
"disabled",
|
|
100
|
-
"ellipsis",
|
|
101
|
-
"fontFamily",
|
|
102
|
-
"fontSize",
|
|
103
|
-
"fontStyle",
|
|
104
|
-
"fontWeight",
|
|
105
|
-
"icon",
|
|
106
|
-
"iconAfter",
|
|
107
|
-
"iconSize",
|
|
108
|
-
"letterSpacing",
|
|
109
|
-
"maxFontSizeMultiplier",
|
|
110
|
-
"noTextWrap",
|
|
111
|
-
"render",
|
|
112
|
-
"scaleIcon",
|
|
113
|
-
"textAlign",
|
|
114
|
-
"textProps"
|
|
115
|
-
];
|
|
116
59
|
function useButton(propsIn) {
|
|
117
|
-
var { Text: _$Text = ButtonText, iconColor
|
|
60
|
+
var { Text: _$Text = ButtonText, iconColor, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
118
61
|
var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
noExpand: true
|
|
62
|
+
var [wrappedTextProps, buttonProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
63
|
+
expandShorthands: true,
|
|
64
|
+
filter: import_text.textParentProps
|
|
123
65
|
});
|
|
124
|
-
var { children,
|
|
125
|
-
var
|
|
126
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
127
|
-
try {
|
|
128
|
-
for (var _iterator = buttonInternalPropNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
129
|
-
var key = _step.value;
|
|
130
|
-
delete frameProps[key];
|
|
131
|
-
}
|
|
132
|
-
} catch (err) {
|
|
133
|
-
_didIteratorError = true;
|
|
134
|
-
_iteratorError = err;
|
|
135
|
-
} finally {
|
|
136
|
-
try {
|
|
137
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
138
|
-
_iterator.return();
|
|
139
|
-
}
|
|
140
|
-
} finally {
|
|
141
|
-
if (_didIteratorError) {
|
|
142
|
-
throw _iteratorError;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
var contextColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
|
|
147
|
-
var iconColor = iconColorOption !== null && iconColorOption !== void 0 ? iconColorOption : contextColor;
|
|
66
|
+
var { children, disabled, icon, iconAfter, iconSize, render, scaleIcon = 1, ...frameProps } = buttonProps;
|
|
67
|
+
var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
|
|
148
68
|
var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;
|
|
149
69
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
150
|
-
color:
|
|
70
|
+
color: iconColor,
|
|
151
71
|
size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon
|
|
152
72
|
});
|
|
153
73
|
var [themedIcon, themedIconAfter] = [icon, iconAfter].map(function(item) {
|
|
154
74
|
return item ? getThemedIcon(item) : null;
|
|
155
75
|
});
|
|
156
|
-
var textContext = {
|
|
157
|
-
color: contextColor,
|
|
158
|
-
ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,
|
|
159
|
-
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,
|
|
160
|
-
fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,
|
|
161
|
-
fontStyle: fontStyle !== null && fontStyle !== void 0 ? fontStyle : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,
|
|
162
|
-
fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,
|
|
163
|
-
letterSpacing: letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,
|
|
164
|
-
maxFontSizeMultiplier: maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,
|
|
165
|
-
textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign
|
|
166
|
-
};
|
|
167
76
|
var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {
|
|
168
77
|
children,
|
|
169
|
-
...textContext,
|
|
170
78
|
noTextWrap,
|
|
171
79
|
textProps
|
|
172
80
|
}, {
|
|
173
81
|
...textPropsOption,
|
|
174
|
-
...
|
|
82
|
+
...textStyleProps
|
|
175
83
|
});
|
|
176
|
-
var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" :
|
|
84
|
+
var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
177
85
|
type: "button",
|
|
178
86
|
disabled: true
|
|
179
87
|
}) : void 0;
|
|
180
|
-
var
|
|
88
|
+
var resolvedProps = {
|
|
181
89
|
...frameProps,
|
|
182
90
|
...disabled && {
|
|
183
91
|
"aria-disabled": true,
|
|
@@ -198,33 +106,17 @@ function useButton(propsIn) {
|
|
|
198
106
|
onKeyDown: void 0,
|
|
199
107
|
onKeyUp: void 0
|
|
200
108
|
},
|
|
201
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.ButtonNestingContext.Provider, {
|
|
202
110
|
value: true,
|
|
203
|
-
children:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
themedIconAfter
|
|
209
|
-
]
|
|
210
|
-
})
|
|
111
|
+
children: [
|
|
112
|
+
themedIcon,
|
|
113
|
+
wrappedChildren,
|
|
114
|
+
themedIconAfter
|
|
115
|
+
]
|
|
211
116
|
})
|
|
212
117
|
};
|
|
213
118
|
return {
|
|
214
119
|
isNested,
|
|
215
|
-
props
|
|
120
|
+
props: resolvedProps
|
|
216
121
|
};
|
|
217
122
|
}
|
|
218
|
-
var ButtonComponent = (0, import_web.createStyledHOC)(ButtonFrame, function Button(props, ref) {
|
|
219
|
-
var { props: buttonProps } = useButton(props);
|
|
220
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {
|
|
221
|
-
ref,
|
|
222
|
-
...buttonProps
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
var Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
|
|
226
|
-
Apply: ButtonContext.Provider,
|
|
227
|
-
Frame: ButtonFrame,
|
|
228
|
-
Icon: ButtonIcon,
|
|
229
|
-
Text: ButtonText
|
|
230
|
-
});
|
|
@@ -22,8 +22,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
22
22
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
23
|
var Button_exports = {};
|
|
24
24
|
__export(Button_exports, {
|
|
25
|
-
Button: () => Button2,
|
|
26
|
-
ButtonContext: () => ButtonContext,
|
|
27
25
|
ButtonFrame: () => ButtonFrame,
|
|
28
26
|
ButtonIcon: () => ButtonIcon,
|
|
29
27
|
ButtonText: () => ButtonText,
|
|
@@ -36,35 +34,7 @@ var import_stacks = require("@tamagui/stacks");
|
|
|
36
34
|
var import_text = require("@tamagui/text");
|
|
37
35
|
var import_web = require("@tamagui/web");
|
|
38
36
|
var import_react = require("react");
|
|
39
|
-
function _type_of(obj) {
|
|
40
|
-
"@swc/helpers - typeof";
|
|
41
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
42
|
-
}
|
|
43
|
-
var buttonContextKeys = [
|
|
44
|
-
"color",
|
|
45
|
-
"ellipsis",
|
|
46
|
-
"fontFamily",
|
|
47
|
-
"fontSize",
|
|
48
|
-
"fontStyle",
|
|
49
|
-
"fontWeight",
|
|
50
|
-
"letterSpacing",
|
|
51
|
-
"maxFontSizeMultiplier",
|
|
52
|
-
"textAlign"
|
|
53
|
-
];
|
|
54
|
-
var ButtonContext = (0, import_web.createStyledContext)({
|
|
55
|
-
color: void 0,
|
|
56
|
-
ellipsis: void 0,
|
|
57
|
-
fontFamily: void 0,
|
|
58
|
-
fontSize: void 0,
|
|
59
|
-
fontStyle: void 0,
|
|
60
|
-
fontWeight: void 0,
|
|
61
|
-
letterSpacing: void 0,
|
|
62
|
-
maxFontSizeMultiplier: void 0,
|
|
63
|
-
textAlign: void 0
|
|
64
|
-
}, { keys: buttonContextKeys });
|
|
65
37
|
var ButtonFrame = (0, import_web.styled)(import_web.View, {
|
|
66
|
-
context: ButtonContext,
|
|
67
|
-
displayName: "ButtonFrame",
|
|
68
38
|
role: "button",
|
|
69
39
|
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button" }),
|
|
70
40
|
tabIndex: 0,
|
|
@@ -75,109 +45,47 @@ var ButtonFrame = (0, import_web.styled)(import_web.View, {
|
|
|
75
45
|
variants: { disabled: { true: { pointerEvents: "none" } } }
|
|
76
46
|
});
|
|
77
47
|
var ButtonText = (0, import_web.styled)(import_web.Text, {
|
|
78
|
-
context: ButtonContext,
|
|
79
|
-
displayName: "ButtonText",
|
|
80
48
|
flexGrow: 0,
|
|
81
49
|
flexShrink: 1
|
|
82
50
|
});
|
|
83
|
-
var isOpaqueColor = function(value) {
|
|
84
|
-
return (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null && ("dynamic" in value || "semantic" in value || "resource_paths" in value);
|
|
85
|
-
};
|
|
86
51
|
var ButtonIcon = function(param) {
|
|
87
52
|
var { children, color, scaleIcon = 1, size } = param;
|
|
88
|
-
var styledContext = ButtonContext.useStyledContext();
|
|
89
|
-
var iconColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
|
|
90
53
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
91
|
-
color
|
|
54
|
+
color,
|
|
92
55
|
size: size === void 0 ? void 0 : size * scaleIcon
|
|
93
56
|
});
|
|
94
57
|
return getThemedIcon(children);
|
|
95
58
|
};
|
|
96
|
-
var buttonInternalPropNames = [
|
|
97
|
-
"children",
|
|
98
|
-
"color",
|
|
99
|
-
"disabled",
|
|
100
|
-
"ellipsis",
|
|
101
|
-
"fontFamily",
|
|
102
|
-
"fontSize",
|
|
103
|
-
"fontStyle",
|
|
104
|
-
"fontWeight",
|
|
105
|
-
"icon",
|
|
106
|
-
"iconAfter",
|
|
107
|
-
"iconSize",
|
|
108
|
-
"letterSpacing",
|
|
109
|
-
"maxFontSizeMultiplier",
|
|
110
|
-
"noTextWrap",
|
|
111
|
-
"render",
|
|
112
|
-
"scaleIcon",
|
|
113
|
-
"textAlign",
|
|
114
|
-
"textProps"
|
|
115
|
-
];
|
|
116
59
|
function useButton(propsIn) {
|
|
117
|
-
var { Text: _$Text = ButtonText, iconColor
|
|
60
|
+
var { Text: _$Text = ButtonText, iconColor, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
118
61
|
var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
noExpand: true
|
|
62
|
+
var [wrappedTextProps, buttonProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
63
|
+
expandShorthands: true,
|
|
64
|
+
filter: import_text.textParentProps
|
|
123
65
|
});
|
|
124
|
-
var { children,
|
|
125
|
-
var
|
|
126
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
127
|
-
try {
|
|
128
|
-
for (var _iterator = buttonInternalPropNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
129
|
-
var key = _step.value;
|
|
130
|
-
delete frameProps[key];
|
|
131
|
-
}
|
|
132
|
-
} catch (err) {
|
|
133
|
-
_didIteratorError = true;
|
|
134
|
-
_iteratorError = err;
|
|
135
|
-
} finally {
|
|
136
|
-
try {
|
|
137
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
138
|
-
_iterator.return();
|
|
139
|
-
}
|
|
140
|
-
} finally {
|
|
141
|
-
if (_didIteratorError) {
|
|
142
|
-
throw _iteratorError;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
var contextColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
|
|
147
|
-
var iconColor = iconColorOption !== null && iconColorOption !== void 0 ? iconColorOption : contextColor;
|
|
66
|
+
var { children, disabled, icon, iconAfter, iconSize, render, scaleIcon = 1, ...frameProps } = buttonProps;
|
|
67
|
+
var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
|
|
148
68
|
var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;
|
|
149
69
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
150
|
-
color:
|
|
70
|
+
color: iconColor,
|
|
151
71
|
size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon
|
|
152
72
|
});
|
|
153
73
|
var [themedIcon, themedIconAfter] = [icon, iconAfter].map(function(item) {
|
|
154
74
|
return item ? getThemedIcon(item) : null;
|
|
155
75
|
});
|
|
156
|
-
var textContext = {
|
|
157
|
-
color: contextColor,
|
|
158
|
-
ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,
|
|
159
|
-
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,
|
|
160
|
-
fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,
|
|
161
|
-
fontStyle: fontStyle !== null && fontStyle !== void 0 ? fontStyle : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,
|
|
162
|
-
fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,
|
|
163
|
-
letterSpacing: letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,
|
|
164
|
-
maxFontSizeMultiplier: maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,
|
|
165
|
-
textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign
|
|
166
|
-
};
|
|
167
76
|
var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {
|
|
168
77
|
children,
|
|
169
|
-
...textContext,
|
|
170
78
|
noTextWrap,
|
|
171
79
|
textProps
|
|
172
80
|
}, {
|
|
173
81
|
...textPropsOption,
|
|
174
|
-
...
|
|
82
|
+
...textStyleProps
|
|
175
83
|
});
|
|
176
|
-
var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" :
|
|
84
|
+
var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
177
85
|
type: "button",
|
|
178
86
|
disabled: true
|
|
179
87
|
}) : void 0;
|
|
180
|
-
var
|
|
88
|
+
var resolvedProps = {
|
|
181
89
|
...frameProps,
|
|
182
90
|
...disabled && {
|
|
183
91
|
"aria-disabled": true,
|
|
@@ -198,35 +106,19 @@ function useButton(propsIn) {
|
|
|
198
106
|
onKeyDown: void 0,
|
|
199
107
|
onKeyUp: void 0
|
|
200
108
|
},
|
|
201
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.ButtonNestingContext.Provider, {
|
|
202
110
|
value: true,
|
|
203
|
-
children:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
themedIconAfter
|
|
209
|
-
]
|
|
210
|
-
})
|
|
111
|
+
children: [
|
|
112
|
+
themedIcon,
|
|
113
|
+
wrappedChildren,
|
|
114
|
+
themedIconAfter
|
|
115
|
+
]
|
|
211
116
|
})
|
|
212
117
|
};
|
|
213
118
|
return {
|
|
214
119
|
isNested,
|
|
215
|
-
props
|
|
120
|
+
props: resolvedProps
|
|
216
121
|
};
|
|
217
122
|
}
|
|
218
|
-
var ButtonComponent = (0, import_web.createStyledHOC)(ButtonFrame, function Button(props, ref) {
|
|
219
|
-
var { props: buttonProps } = useButton(props);
|
|
220
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {
|
|
221
|
-
ref,
|
|
222
|
-
...buttonProps
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
var Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {
|
|
226
|
-
Apply: ButtonContext.Provider,
|
|
227
|
-
Frame: ButtonFrame,
|
|
228
|
-
Icon: ButtonIcon,
|
|
229
|
-
Text: ButtonText
|
|
230
|
-
});
|
|
231
123
|
|
|
232
124
|
//# sourceMappingURL=Button.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.native.js","names":[],"sources":["jsx/Button.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Button_exports = {};\n__export(Button_exports, {\n Button: () => Button2,\n ButtonContext: () => ButtonContext,\n ButtonFrame: () => ButtonFrame,\n ButtonIcon: () => ButtonIcon,\n ButtonText: () => ButtonText,\n useButton: () => useButton\n});\nmodule.exports = __toCommonJS(Button_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar import_react = require(\"react\");\nfunction _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar buttonContextKeys = [\n \"color\",\n \"ellipsis\",\n \"fontFamily\",\n \"fontSize\",\n \"fontStyle\",\n \"fontWeight\",\n \"letterSpacing\",\n \"maxFontSizeMultiplier\",\n \"textAlign\"\n];\nvar ButtonContext = (0, import_web.createStyledContext)({\n color: void 0,\n ellipsis: void 0,\n fontFamily: void 0,\n fontSize: void 0,\n fontStyle: void 0,\n fontWeight: void 0,\n letterSpacing: void 0,\n maxFontSizeMultiplier: void 0,\n textAlign: void 0\n}, {\n keys: buttonContextKeys\n});\nvar ButtonFrame = (0, import_web.styled)(import_web.View, {\n context: ButtonContext,\n displayName: \"ButtonFrame\",\n role: \"button\",\n render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\"\n }),\n tabIndex: 0,\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"nowrap\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ButtonText = (0, import_web.styled)(import_web.Text, {\n context: ButtonContext,\n displayName: \"ButtonText\",\n // flexGrow 1 pushes text to the start of its parent on native\n flexGrow: 0,\n flexShrink: 1\n});\nvar isOpaqueColor = function(value) {\n return (typeof value === \"undefined\" ? \"undefined\" : _type_of(value)) === \"object\" && value !== null && (\"dynamic\" in value || \"semantic\" in value || \"resource_paths\" in value);\n};\nvar ButtonIcon = function(param) {\n var { children, color, scaleIcon = 1, size } = param;\n var styledContext = ButtonContext.useStyledContext();\n var iconColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n // icons take one concrete color: conditional values (numbers, flat\n // objects) fall back to the theme color\n color: typeof iconColor === \"string\" && iconColor !== \"unset\" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,\n size: size === void 0 ? void 0 : size * scaleIcon\n });\n return getThemedIcon(children);\n};\nvar buttonInternalPropNames = [\n \"children\",\n \"color\",\n \"disabled\",\n \"ellipsis\",\n \"fontFamily\",\n \"fontSize\",\n \"fontStyle\",\n \"fontWeight\",\n \"icon\",\n \"iconAfter\",\n \"iconSize\",\n \"letterSpacing\",\n \"maxFontSizeMultiplier\",\n \"noTextWrap\",\n \"render\",\n \"scaleIcon\",\n \"textAlign\",\n \"textProps\"\n];\nfunction useButton(propsIn) {\n var { Text: _$Text = ButtonText, iconColor: iconColorOption, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);\n var styledContext = ButtonContext.useStyledContext();\n var processedProps = (0, import_web.useProps)(propsIn, {\n noNormalize: true,\n noExpand: true\n });\n var { children, color, disabled, ellipsis, fontFamily, fontSize, fontStyle, fontWeight, icon, iconAfter, iconSize, letterSpacing, maxFontSizeMultiplier, noTextWrap, render, scaleIcon = 1, textAlign, textProps } = processedProps;\n var frameProps = {\n ...propsIn\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = buttonInternalPropNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n delete frameProps[key];\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var contextColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;\n var iconColor = iconColorOption !== null && iconColorOption !== void 0 ? iconColorOption : contextColor;\n var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n // icons take one concrete color: conditional values (numbers, flat\n // objects) fall back to the theme color\n color: typeof iconColor === \"string\" && iconColor !== \"unset\" || (0, import_web.isVariable)(iconColor) || isOpaqueColor(iconColor) ? iconColor : void 0,\n size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon\n });\n var [themedIcon, themedIconAfter] = [\n icon,\n iconAfter\n ].map(function(item) {\n return item ? getThemedIcon(item) : null;\n });\n var textContext = {\n color: contextColor,\n ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,\n fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,\n fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,\n fontStyle: fontStyle !== null && fontStyle !== void 0 ? fontStyle : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,\n fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,\n letterSpacing: letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,\n maxFontSizeMultiplier: maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,\n textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign\n };\n var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {\n children,\n ...textContext,\n noTextWrap,\n textProps\n }, {\n ...textPropsOption,\n ...processedProps.size === void 0 ? null : {\n size: processedProps.size\n }\n });\n var resolvedRender = render !== null && render !== void 0 ? render : isNested ? \"span\" : processedProps.accessibilityRole === \"link\" || processedProps.role === \"link\" ? \"a\" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\",\n disabled: true\n }) : void 0;\n var props = {\n ...frameProps,\n ...disabled && {\n \"aria-disabled\": true,\n disabled: true,\n tabIndex: -1\n },\n ...resolvedRender === void 0 ? null : {\n render: resolvedRender\n },\n ...isNested && {\n // a nested Button is a presentation part, not a control: strip the\n // interactive semantics so we never place a focusable role=button (with\n // its own press/keyboard handlers) inside the outer native <button>. that\n // nesting is invalid html, adds an extra focus stop, and bubbles\n // activation to the outer control. resolvedRender already makes it a span.\n role: \"none\",\n tabIndex: -1,\n \"aria-disabled\": void 0,\n disabled: void 0,\n onPress: void 0,\n onPressIn: void 0,\n onPressOut: void 0,\n onLongPress: void 0,\n onClick: void 0,\n onKeyDown: void 0,\n onKeyUp: void 0\n },\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {\n value: true,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ButtonContext.Provider, {\n ...textContext,\n children: [\n themedIcon,\n wrappedChildren,\n themedIconAfter\n ]\n })\n })\n };\n return {\n isNested,\n props\n };\n}\nvar ButtonComponent = (0, import_web.createStyledHOC)(ButtonFrame, function Button(props, ref) {\n var { props: buttonProps } = useButton(props);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {\n ref,\n ...buttonProps\n });\n});\nvar Button2 = (0, import_web.withStaticProperties)(ButtonComponent, {\n Apply: ButtonContext.Provider,\n Frame: ButtonFrame,\n Icon: ButtonIcon,\n Text: ButtonText\n});\n//# sourceMappingURL=Button.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB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,OAAO,EACpC,QAAQ,eACV;EACA,GAAG,YAAY;GAMb,MAAM;GACN,UAAU,CAAC;GACX,iBAAiB,KAAK;GACtB,UAAU,KAAK;GACf,SAAS,KAAK;GACd,WAAW,KAAK;GAChB,YAAY,KAAK;GACjB,aAAa,KAAK;GAClB,SAAS,KAAK;GACd,WAAW,KAAK;GAChB,SAAS,KAAK;EAChB;EACA,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,cAAc,qBAAqB,UAAU;GACjG,OAAO;GACP,UAA0B,iBAAC,GAAG,mBAAmB,KAAI,CAAE,cAAc,UAAU;IAC7E,GAAG;IACH,UAAU;KACR;KACA;KACA;IACF;GACF,CAAC;EACH,CAAC;CACH;CACA,OAAO;EACL;EACA;CACF;AACF;AACA,IAAI,mBAAmB,GAAG,WAAW,gBAAe,CAAE,aAAa,SAAS,OAAO,OAAO,KAAK;CAC7F,IAAI,EAAE,OAAO,gBAAgB,UAAU,KAAK;CAC5C,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa;EAC9D;EACA,GAAG;CACL,CAAC;AACH,CAAC;AACD,IAAI,WAAW,GAAG,WAAW,qBAAoB,CAAE,iBAAiB;CAClE,OAAO,cAAc;CACrB,OAAO;CACP,MAAM;CACN,MAAM;AACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"Button.native.js","names":[],"sources":["jsx/Button.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Button_exports = {};\n__export(Button_exports, {\n ButtonFrame: () => ButtonFrame,\n ButtonIcon: () => ButtonIcon,\n ButtonText: () => ButtonText,\n useButton: () => useButton\n});\nmodule.exports = __toCommonJS(Button_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar import_react = require(\"react\");\nvar ButtonFrame = (0, import_web.styled)(import_web.View, {\n // role is the cross-platform one; render only lands on web\n role: \"button\",\n render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\"\n }),\n tabIndex: 0,\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"nowrap\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ButtonText = (0, import_web.styled)(import_web.Text, {\n // flexGrow 1 pushes text to the start of its parent on native\n flexGrow: 0,\n flexShrink: 1\n});\nvar ButtonIcon = function(param) {\n var { children, color, scaleIcon = 1, size } = param;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n color,\n size: size === void 0 ? void 0 : size * scaleIcon\n });\n return getThemedIcon(children);\n};\nfunction useButton(propsIn) {\n var { Text: _$Text = ButtonText, iconColor, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);\n var [wrappedTextProps, buttonProps] = (0, import_web.splitStyleProps)(propsIn, {\n expandShorthands: true,\n filter: import_text.textParentProps\n });\n var { children, disabled, icon, iconAfter, iconSize, render, scaleIcon = 1, ...frameProps } = buttonProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n color: iconColor,\n size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon\n });\n var [themedIcon, themedIconAfter] = [\n icon,\n iconAfter\n ].map(function(item) {\n return item ? getThemedIcon(item) : null;\n });\n var wrappedChildren = (0, import_text.wrapChildrenInText)(_$Text, {\n children,\n noTextWrap,\n textProps\n }, {\n ...textPropsOption,\n ...textStyleProps\n });\n var resolvedRender = render !== null && render !== void 0 ? render : isNested ? \"span\" : disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"button\", {\n type: \"button\",\n disabled: true\n }) : void 0;\n var resolvedProps = {\n ...frameProps,\n ...disabled && {\n \"aria-disabled\": true,\n disabled: true,\n tabIndex: -1\n },\n ...resolvedRender === void 0 ? null : {\n render: resolvedRender\n },\n ...isNested && {\n // a nested Button is a presentation part, not a control: strip the\n // interactive semantics so we never place a focusable role=button (with\n // its own press/keyboard handlers) inside the outer native <button>. that\n // nesting is invalid html, adds an extra focus stop, and bubbles\n // activation to the outer control. resolvedRender already makes it a span.\n role: \"none\",\n tabIndex: -1,\n \"aria-disabled\": void 0,\n disabled: void 0,\n onPress: void 0,\n onPressIn: void 0,\n onPressOut: void 0,\n onLongPress: void 0,\n onClick: void 0,\n onKeyDown: void 0,\n onKeyUp: void 0\n },\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.ButtonNestingContext.Provider, {\n value: true,\n children: [\n themedIcon,\n wrappedChildren,\n themedIconAfter\n ]\n })\n };\n return {\n isNested,\n props: resolvedProps\n };\n}\n//# sourceMappingURL=Button.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAA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M;EACN,UAAU;CACZ,CAAC,IAAI,KAAK;CACV,IAAI,gBAAgB;EAClB,GAAG;EACH,GAAG,YAAY;GACb,iBAAiB;GACjB,UAAU;GACV,UAAU,CAAC;EACb;EACA,GAAG,mBAAmB,KAAK,IAAI,OAAO,EACpC,QAAQ,eACV;EACA,GAAG,YAAY;GAMb,MAAM;GACN,UAAU,CAAC;GACX,iBAAiB,KAAK;GACtB,UAAU,KAAK;GACf,SAAS,KAAK;GACd,WAAW,KAAK;GAChB,YAAY,KAAK;GACjB,aAAa,KAAK;GAClB,SAAS,KAAK;GACd,WAAW,KAAK;GAChB,SAAS,KAAK;EAChB;EACA,UAA0B,iBAAC,GAAG,mBAAmB,KAAI,CAAE,cAAc,qBAAqB,UAAU;GAClG,OAAO;GACP,UAAU;IACR;IACA;IACA;GACF;EACF,CAAC;CACH;CACA,OAAO;EACL;EACA,OAAO;CACT;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/button",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.831.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
"clean:build": "tamagui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/config-default": "3.0.0-beta.
|
|
39
|
-
"@tamagui/core": "3.0.0-beta.
|
|
40
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
41
|
-
"@tamagui/helpers-tamagui": "3.0.0-beta.
|
|
42
|
-
"@tamagui/spacer": "3.0.0-beta.
|
|
43
|
-
"@tamagui/stacks": "3.0.0-beta.
|
|
44
|
-
"@tamagui/text": "3.0.0-beta.
|
|
45
|
-
"@tamagui/font-size": "3.0.0-beta.
|
|
46
|
-
"@tamagui/web": "3.0.0-beta.
|
|
38
|
+
"@tamagui/config-default": "3.0.0-beta.831.1",
|
|
39
|
+
"@tamagui/core": "3.0.0-beta.831.1",
|
|
40
|
+
"@tamagui/helpers": "3.0.0-beta.831.1",
|
|
41
|
+
"@tamagui/helpers-tamagui": "3.0.0-beta.831.1",
|
|
42
|
+
"@tamagui/spacer": "3.0.0-beta.831.1",
|
|
43
|
+
"@tamagui/stacks": "3.0.0-beta.831.1",
|
|
44
|
+
"@tamagui/text": "3.0.0-beta.831.1",
|
|
45
|
+
"@tamagui/font-size": "3.0.0-beta.831.1",
|
|
46
|
+
"@tamagui/web": "3.0.0-beta.831.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@tamagui/build": "3.0.0-beta.
|
|
49
|
+
"@tamagui/build": "3.0.0-beta.831.1",
|
|
50
50
|
"react": "19.2.3",
|
|
51
51
|
"vitest": "4.1.0"
|
|
52
52
|
},
|