@tamagui/button 2.7.7 → 3.0.0-beta.643.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.
Files changed (48) hide show
  1. package/dist/cjs/Button.cjs +180 -266
  2. package/dist/cjs/Button.native.cjs +224 -0
  3. package/dist/cjs/Button.native.js +200 -271
  4. package/dist/cjs/Button.native.js.map +1 -1
  5. package/dist/cjs/index.cjs +10 -11
  6. package/dist/cjs/index.native.cjs +21 -0
  7. package/dist/cjs/index.native.js +10 -10
  8. package/dist/cjs/index.native.js.map +1 -1
  9. package/dist/esm/Button.mjs +168 -255
  10. package/dist/esm/Button.mjs.map +1 -1
  11. package/dist/esm/Button.native.js +188 -261
  12. package/dist/esm/Button.native.js.map +1 -1
  13. package/dist/esm/index.js +1 -2
  14. package/dist/esm/index.mjs +1 -2
  15. package/dist/esm/index.native.js +1 -2
  16. package/dist/jsx/Button.mjs +168 -255
  17. package/dist/jsx/Button.mjs.map +1 -1
  18. package/dist/jsx/Button.native.cjs +224 -0
  19. package/dist/jsx/Button.native.js +200 -271
  20. package/dist/jsx/Button.native.js.map +1 -1
  21. package/dist/jsx/index.js +1 -2
  22. package/dist/jsx/index.mjs +1 -2
  23. package/dist/jsx/index.native.cjs +21 -0
  24. package/dist/jsx/index.native.js +10 -10
  25. package/dist/jsx/index.native.js.map +1 -1
  26. package/package.json +11 -12
  27. package/src/Button.tsx +222 -280
  28. package/types/Button.d.ts +218 -114
  29. package/types/Button.d.ts.map +1 -1
  30. package/dist/cjs/Button.test.cjs +0 -37
  31. package/dist/cjs/Button.test.native.js +0 -40
  32. package/dist/cjs/Button.test.native.js.map +0 -1
  33. package/dist/esm/Button.test.mjs +0 -38
  34. package/dist/esm/Button.test.mjs.map +0 -1
  35. package/dist/esm/Button.test.native.js +0 -38
  36. package/dist/esm/Button.test.native.js.map +0 -1
  37. package/dist/esm/index.js.map +0 -1
  38. package/dist/esm/index.mjs.map +0 -1
  39. package/dist/esm/index.native.js.map +0 -1
  40. package/dist/jsx/Button.test.mjs +0 -38
  41. package/dist/jsx/Button.test.mjs.map +0 -1
  42. package/dist/jsx/Button.test.native.js +0 -40
  43. package/dist/jsx/Button.test.native.js.map +0 -1
  44. package/dist/jsx/index.js.map +0 -1
  45. package/dist/jsx/index.mjs.map +0 -1
  46. package/src/Button.test.tsx +0 -45
  47. package/types/Button.test.d.ts +0 -2
  48. package/types/Button.test.d.ts.map +0 -1
@@ -1,268 +1,195 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getFontSize } from "@tamagui/font-size";
3
- import { getButtonSized } from "@tamagui/get-button-sized";
4
- import { getIcon, useCurrentColor } from "@tamagui/helpers-tamagui";
5
- import { ButtonNestingContext, getElevation, themeableVariants } from "@tamagui/stacks";
6
- import { SizableText, wrapChildrenInText } from "@tamagui/text";
7
- import { createStyledContext, getTokenValue, styled, useProps, View, withStaticProperties } from "@tamagui/web";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
3
+ import { ButtonNestingContext } from "@tamagui/stacks";
4
+ import { wrapChildrenInText } from "@tamagui/text";
5
+ import { Text, View, createStyledContext, createStyledHOC, styled, useProps, withStaticProperties } from "@tamagui/web";
8
6
  import { useContext } from "react";
9
- var context = createStyledContext({
10
- size: void 0,
11
- variant: void 0,
12
- color: void 0,
13
- elevation: void 0,
14
- ellipsis: void 0,
15
- fontFamily: void 0,
16
- fontSize: void 0,
17
- fontStyle: void 0,
18
- fontWeight: void 0,
19
- letterSpacing: void 0,
20
- maxFontSizeMultiplier: void 0,
21
- textAlign: void 0
22
- });
23
- var Frame = styled(View, {
24
- context,
25
- name: "Button",
26
- role: "button",
27
- render: /* @__PURE__ */_jsx("button", {
28
- type: "button"
29
- }),
30
- tabIndex: 0,
31
- variants: {
32
- unstyled: {
33
- true: {
34
- // reset browser <button> defaults
35
- outlineWidth: 0,
36
- borderWidth: 0,
37
- backgroundColor: "transparent"
38
- },
39
- false: {
40
- size: "$true",
41
- justifyContent: "center",
42
- alignItems: "center",
43
- flexWrap: "nowrap",
44
- flexDirection: "row",
45
- backgroundColor: "$background",
46
- borderWidth: 1,
47
- borderColor: "transparent",
48
- "$platform-web": {
49
- cursor: "pointer"
50
- },
51
- hoverStyle: {
52
- backgroundColor: "$backgroundHover",
53
- borderColor: "$borderColorHover"
54
- },
55
- pressStyle: {
56
- backgroundColor: "$backgroundPress",
57
- borderColor: "$borderColorHover"
58
- },
59
- focusVisibleStyle: {
60
- outlineColor: "$outlineColor",
61
- outlineStyle: "solid",
62
- outlineWidth: 2
63
- }
64
- }
65
- },
66
- variant: {
67
- outlined: process.env.TAMAGUI_HEADLESS === "1" ? {} : {
68
- backgroundColor: "transparent",
69
- borderWidth: 1,
70
- borderColor: "$borderColor",
71
- hoverStyle: {
72
- backgroundColor: "transparent",
73
- borderColor: "$borderColorHover"
74
- },
75
- pressStyle: {
76
- backgroundColor: "transparent",
77
- borderColor: "$borderColorPress"
78
- }
79
- }
80
- },
81
- circular: themeableVariants.circular,
82
- chromeless: themeableVariants.chromeless,
83
- size: {
84
- "...size": function (val, extras) {
85
- var buttonStyle = getButtonSized(val, extras);
86
- var gap = getTokenValue(val);
87
- return {
88
- ...buttonStyle,
89
- gap
90
- };
91
- },
92
- ":number": function (val, extras) {
93
- var buttonStyle = getButtonSized(val, extras);
94
- var gap = val * 0.4;
95
- return {
96
- ...buttonStyle,
97
- gap
98
- };
99
- }
100
- },
101
- elevation: {
102
- "...size": getElevation,
103
- ":number": getElevation
104
- },
105
- disabled: {
106
- true: {
107
- pointerEvents: "none",
108
- // @ts-ignore
109
- "aria-disabled": true
110
- }
111
- }
112
- },
113
- defaultVariants: {
114
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
115
- }
7
+
8
+ var buttonContextKeys = [
9
+ "color",
10
+ "ellipsis",
11
+ "fontFamily",
12
+ "fontSize",
13
+ "fontStyle",
14
+ "fontWeight",
15
+ "letterSpacing",
16
+ "maxFontSizeMultiplier",
17
+ "textAlign"
18
+ ];
19
+ var ButtonContext = createStyledContext({
20
+ color: void 0,
21
+ ellipsis: void 0,
22
+ fontFamily: void 0,
23
+ fontSize: void 0,
24
+ fontStyle: void 0,
25
+ fontWeight: void 0,
26
+ letterSpacing: void 0,
27
+ maxFontSizeMultiplier: void 0,
28
+ textAlign: void 0
29
+ }, { keys: buttonContextKeys });
30
+ var ButtonFrame = styled(View, {
31
+ context: ButtonContext,
32
+ displayName: "ButtonFrame",
33
+ role: "button",
34
+ render: /* @__PURE__ */ jsx("button", { type: "button" }),
35
+ tabIndex: 0,
36
+ alignItems: "center",
37
+ flexDirection: "row",
38
+ flexWrap: "nowrap",
39
+ justifyContent: "center",
40
+ variants: { disabled: { true: { pointerEvents: "none" } } }
116
41
  });
117
- var Text = styled(SizableText, {
118
- context,
119
- variants: {
120
- unstyled: {
121
- false: {
122
- userSelect: "none",
123
- // flexGrow 1 leads to inconsistent native style where text pushes to start of view
124
- flexGrow: 0,
125
- flexShrink: 1,
126
- ellipsis: true,
127
- color: "$color",
128
- "$platform-web": {
129
- cursor: "pointer"
130
- }
131
- }
132
- }
133
- },
134
- defaultVariants: {
135
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
136
- }
42
+ var ButtonText = styled(Text, {
43
+ context: ButtonContext,
44
+ displayName: "ButtonText",
45
+ flexGrow: 0,
46
+ flexShrink: 1
137
47
  });
138
- var Icon = function (props) {
139
- var {
140
- children,
141
- scaleIcon = 1,
142
- size
143
- } = props;
144
- var styledContext = context.useStyledContext();
145
- if (!styledContext) {
146
- throw new Error("Button.Icon must be used within a Button");
147
- }
148
- var sizeToken = size !== null && size !== void 0 ? size : styledContext.size;
149
- var iconColorProp = styledContext.color === "unset" || typeof styledContext.color === "number" ? void 0 : styledContext.color;
150
- var iconColor = useCurrentColor(iconColorProp);
151
- var iconSize = (typeof sizeToken === "number" ? sizeToken * 0.5 : getFontSize(sizeToken)) * scaleIcon;
152
- return getIcon(children, {
153
- size: iconSize,
154
- color: iconColor
155
- });
48
+ var ButtonIcon = function(param) {
49
+ var { children, color, scaleIcon = 1, size } = param;
50
+ var styledContext = ButtonContext.useStyledContext();
51
+ var iconColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
52
+ var getThemedIcon = useGetThemedIcon({
53
+ color: iconColor === "unset" || typeof iconColor === "number" ? void 0 : iconColor,
54
+ size: size === void 0 ? void 0 : size * scaleIcon
55
+ });
56
+ return getThemedIcon(children);
156
57
  };
157
- var ButtonContext = createStyledContext({
158
- size: void 0,
159
- variant: void 0,
160
- color: void 0
161
- });
162
- var ButtonComponent = Frame.styleable(function (propsIn, ref) {
163
- var isNested = useContext(ButtonNestingContext);
164
- var processedProps = useProps(propsIn, {
165
- noNormalize: true,
166
- noExpand: true
167
- });
168
- var {
169
- children,
170
- iconSize,
171
- icon,
172
- iconAfter,
173
- scaleIcon = 1,
174
- noTextWrap,
175
- textProps,
176
- color,
177
- ellipsis,
178
- fontFamily,
179
- fontSize,
180
- fontStyle,
181
- fontWeight,
182
- letterSpacing,
183
- maxFontSizeMultiplier,
184
- textAlign,
185
- ...props
186
- } = processedProps;
187
- var size = propsIn.size || (propsIn.unstyled ? void 0 : "$true");
188
- var styledContext = context.useStyledContext();
189
- var _ref;
190
- var contextColor = (_ref = color !== null && color !== void 0 ? color : propsIn.color) !== null && _ref !== void 0 ? _ref : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
191
- var iconColorProp = contextColor === "unset" || typeof contextColor === "number" ? void 0 : contextColor;
192
- var iconColor = useCurrentColor(iconColorProp);
193
- var _ref1;
194
- var finalSize = (_ref1 = iconSize !== null && iconSize !== void 0 ? iconSize : size) !== null && _ref1 !== void 0 ? _ref1 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.size;
195
- var iconSizeNumber = (typeof finalSize === "number" ? finalSize * 0.5 : getFontSize(finalSize)) * scaleIcon;
196
- var [themedIcon, themedIconAfter] = [icon, iconAfter].map(function (icon2) {
197
- if (!icon2) return null;
198
- return getIcon(icon2, {
199
- size: iconSizeNumber,
200
- color: iconColor
201
- });
202
- });
203
- var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
204
- var wrappedChildren = wrapChildrenInText(Text, {
205
- children,
206
- color: contextColor,
207
- ellipsis: (_ref2 = ellipsis !== null && ellipsis !== void 0 ? ellipsis : propsIn.ellipsis) !== null && _ref2 !== void 0 ? _ref2 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,
208
- fontFamily: (_ref3 = fontFamily !== null && fontFamily !== void 0 ? fontFamily : propsIn.fontFamily) !== null && _ref3 !== void 0 ? _ref3 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,
209
- fontSize: (_ref4 = fontSize !== null && fontSize !== void 0 ? fontSize : propsIn.fontSize) !== null && _ref4 !== void 0 ? _ref4 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,
210
- fontStyle: (_ref5 = fontStyle !== null && fontStyle !== void 0 ? fontStyle : propsIn.fontStyle) !== null && _ref5 !== void 0 ? _ref5 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,
211
- fontWeight: (_ref6 = fontWeight !== null && fontWeight !== void 0 ? fontWeight : propsIn.fontWeight) !== null && _ref6 !== void 0 ? _ref6 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,
212
- letterSpacing: (_ref7 = letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : propsIn.letterSpacing) !== null && _ref7 !== void 0 ? _ref7 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,
213
- maxFontSizeMultiplier: (_ref8 = maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : propsIn.maxFontSizeMultiplier) !== null && _ref8 !== void 0 ? _ref8 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,
214
- noTextWrap: noTextWrap !== null && noTextWrap !== void 0 ? noTextWrap : propsIn.noTextWrap,
215
- textAlign: (_ref9 = textAlign !== null && textAlign !== void 0 ? textAlign : propsIn.textAlign) !== null && _ref9 !== void 0 ? _ref9 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign,
216
- textProps: textProps !== null && textProps !== void 0 ? textProps : propsIn.textProps
217
- }, {
218
- unstyled: process.env.TAMAGUI_HEADLESS === "1",
219
- size: finalSize !== null && finalSize !== void 0 ? finalSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.size
220
- });
221
- var _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17;
222
- var textContext = {
223
- color: contextColor,
224
- ellipsis: (_ref10 = ellipsis !== null && ellipsis !== void 0 ? ellipsis : propsIn.ellipsis) !== null && _ref10 !== void 0 ? _ref10 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,
225
- fontFamily: (_ref11 = fontFamily !== null && fontFamily !== void 0 ? fontFamily : propsIn.fontFamily) !== null && _ref11 !== void 0 ? _ref11 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,
226
- fontSize: (_ref12 = fontSize !== null && fontSize !== void 0 ? fontSize : propsIn.fontSize) !== null && _ref12 !== void 0 ? _ref12 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,
227
- fontStyle: (_ref13 = fontStyle !== null && fontStyle !== void 0 ? fontStyle : propsIn.fontStyle) !== null && _ref13 !== void 0 ? _ref13 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,
228
- fontWeight: (_ref14 = fontWeight !== null && fontWeight !== void 0 ? fontWeight : propsIn.fontWeight) !== null && _ref14 !== void 0 ? _ref14 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,
229
- letterSpacing: (_ref15 = letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : propsIn.letterSpacing) !== null && _ref15 !== void 0 ? _ref15 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,
230
- maxFontSizeMultiplier: (_ref16 = maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : propsIn.maxFontSizeMultiplier) !== null && _ref16 !== void 0 ? _ref16 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,
231
- textAlign: (_ref17 = textAlign !== null && textAlign !== void 0 ? textAlign : propsIn.textAlign) !== null && _ref17 !== void 0 ? _ref17 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign
232
- };
233
- var _props_size, _ref18, _props_variant, _ref19, _props_elevation, _ref20;
234
- var buttonContext = {
235
- ...styledContext,
236
- ...textContext,
237
- size: (_ref18 = (_props_size = props.size) !== null && _props_size !== void 0 ? _props_size : propsIn.size) !== null && _ref18 !== void 0 ? _ref18 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.size,
238
- variant: (_ref19 = (_props_variant = props.variant) !== null && _props_variant !== void 0 ? _props_variant : propsIn.variant) !== null && _ref19 !== void 0 ? _ref19 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.variant,
239
- elevation: (_ref20 = (_props_elevation = props.elevation) !== null && _props_elevation !== void 0 ? _props_elevation : propsIn.elevation) !== null && _ref20 !== void 0 ? _ref20 : styledContext === null || styledContext === void 0 ? void 0 : styledContext.elevation
240
- };
241
- return /* @__PURE__ */_jsx(ButtonNestingContext.Provider, {
242
- value: true,
243
- children: /* @__PURE__ */_jsx(context.Provider, {
244
- ...buttonContext,
245
- children: /* @__PURE__ */_jsxs(Frame, {
246
- ref,
247
- ...props,
248
- ...(isNested && {
249
- render: "span"
250
- }),
251
- // pass resolved size to circular variant when no explicit size provided
252
- ...(props.circular && !propsIn.size && {
253
- size
254
- }),
255
- tabIndex: 0,
256
- children: [themedIcon, wrappedChildren, themedIconAfter]
257
- })
258
- })
259
- });
58
+ var buttonInternalPropNames = [
59
+ "children",
60
+ "color",
61
+ "disabled",
62
+ "ellipsis",
63
+ "fontFamily",
64
+ "fontSize",
65
+ "fontStyle",
66
+ "fontWeight",
67
+ "icon",
68
+ "iconAfter",
69
+ "iconSize",
70
+ "letterSpacing",
71
+ "maxFontSizeMultiplier",
72
+ "noTextWrap",
73
+ "render",
74
+ "scaleIcon",
75
+ "textAlign",
76
+ "textProps"
77
+ ];
78
+ function useButton(propsIn) {
79
+ var { Text: _$Text = ButtonText, iconColor: iconColorOption, iconSize: iconSizeOption, textProps: textPropsOption } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
80
+ var isNested = useContext(ButtonNestingContext);
81
+ var styledContext = ButtonContext.useStyledContext();
82
+ var processedProps = useProps(propsIn, {
83
+ noNormalize: true,
84
+ noExpand: true
85
+ });
86
+ var { children, color, disabled, ellipsis, fontFamily, fontSize, fontStyle, fontWeight, icon, iconAfter, iconSize, letterSpacing, maxFontSizeMultiplier, noTextWrap, render, scaleIcon = 1, textAlign, textProps } = processedProps;
87
+ var frameProps = { ...propsIn };
88
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
89
+ try {
90
+ for (var _iterator = buttonInternalPropNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
91
+ var key = _step.value;
92
+ delete frameProps[key];
93
+ }
94
+ } catch (err) {
95
+ _didIteratorError = true;
96
+ _iteratorError = err;
97
+ } finally {
98
+ try {
99
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
100
+ _iterator.return();
101
+ }
102
+ } finally {
103
+ if (_didIteratorError) {
104
+ throw _iteratorError;
105
+ }
106
+ }
107
+ }
108
+ var contextColor = color !== null && color !== void 0 ? color : styledContext === null || styledContext === void 0 ? void 0 : styledContext.color;
109
+ var iconColor = iconColorOption !== null && iconColorOption !== void 0 ? iconColorOption : contextColor;
110
+ var resolvedIconSize = iconSize !== null && iconSize !== void 0 ? iconSize : iconSizeOption;
111
+ var getThemedIcon = useGetThemedIcon({
112
+ color: iconColor === "unset" || typeof iconColor === "number" ? void 0 : iconColor,
113
+ size: resolvedIconSize === void 0 ? void 0 : resolvedIconSize * scaleIcon
114
+ });
115
+ var [themedIcon, themedIconAfter] = [icon, iconAfter].map(function(item) {
116
+ return item ? getThemedIcon(item) : null;
117
+ });
118
+ var textContext = {
119
+ color: contextColor,
120
+ ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : styledContext === null || styledContext === void 0 ? void 0 : styledContext.ellipsis,
121
+ fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontFamily,
122
+ fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontSize,
123
+ fontStyle: fontStyle !== null && fontStyle !== void 0 ? fontStyle : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontStyle,
124
+ fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : styledContext === null || styledContext === void 0 ? void 0 : styledContext.fontWeight,
125
+ letterSpacing: letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : styledContext === null || styledContext === void 0 ? void 0 : styledContext.letterSpacing,
126
+ maxFontSizeMultiplier: maxFontSizeMultiplier !== null && maxFontSizeMultiplier !== void 0 ? maxFontSizeMultiplier : styledContext === null || styledContext === void 0 ? void 0 : styledContext.maxFontSizeMultiplier,
127
+ textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : styledContext === null || styledContext === void 0 ? void 0 : styledContext.textAlign
128
+ };
129
+ var wrappedChildren = wrapChildrenInText(_$Text, {
130
+ children,
131
+ ...textContext,
132
+ noTextWrap,
133
+ textProps
134
+ }, {
135
+ ...textPropsOption,
136
+ ...processedProps.size === void 0 ? null : { size: processedProps.size }
137
+ });
138
+ var resolvedRender = render !== null && render !== void 0 ? render : isNested ? "span" : processedProps.accessibilityRole === "link" || processedProps.role === "link" ? "a" : disabled ? /* @__PURE__ */ jsx("button", {
139
+ type: "button",
140
+ disabled: true
141
+ }) : void 0;
142
+ var props = {
143
+ ...frameProps,
144
+ ...disabled && {
145
+ "aria-disabled": true,
146
+ disabled: true,
147
+ tabIndex: -1
148
+ },
149
+ ...resolvedRender === void 0 ? null : { render: resolvedRender },
150
+ ...isNested && {
151
+ role: "none",
152
+ tabIndex: -1,
153
+ "aria-disabled": void 0,
154
+ disabled: void 0,
155
+ onPress: void 0,
156
+ onPressIn: void 0,
157
+ onPressOut: void 0,
158
+ onLongPress: void 0,
159
+ onClick: void 0,
160
+ onKeyDown: void 0,
161
+ onKeyUp: void 0
162
+ },
163
+ children: /* @__PURE__ */ jsx(ButtonNestingContext.Provider, {
164
+ value: true,
165
+ children: /* @__PURE__ */ jsxs(ButtonContext.Provider, {
166
+ ...textContext,
167
+ children: [
168
+ themedIcon,
169
+ wrappedChildren,
170
+ themedIconAfter
171
+ ]
172
+ })
173
+ })
174
+ };
175
+ return {
176
+ isNested,
177
+ props
178
+ };
179
+ }
180
+ var ButtonComponent = createStyledHOC(ButtonFrame, function Button(props, ref) {
181
+ var { props: buttonProps } = useButton(props);
182
+ return /* @__PURE__ */ jsx(ButtonFrame, {
183
+ ref,
184
+ ...buttonProps
185
+ });
260
186
  });
261
- var Button = withStaticProperties(ButtonComponent, {
262
- Apply: context.Provider,
263
- Frame,
264
- Text,
265
- Icon
187
+ var Button2 = withStaticProperties(ButtonComponent, {
188
+ Apply: ButtonContext.Provider,
189
+ Frame: ButtonFrame,
190
+ Icon: ButtonIcon,
191
+ Text: ButtonText
266
192
  });
267
- export { Button, ButtonContext };
193
+
194
+ export { Button2 as Button, ButtonContext, ButtonFrame, ButtonIcon, ButtonText, useButton };
268
195
  //# sourceMappingURL=Button.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsx","_jsx","jsxs","_jsxs","getFontSize","getButtonSized","getIcon","useCurrentColor","ButtonNestingContext","getElevation","themeableVariants","SizableText","wrapChildrenInText","createStyledContext","getTokenValue","styled","useProps","View","withStaticProperties","useContext","context","size","variant","color","elevation","ellipsis","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","maxFontSizeMultiplier","textAlign","Frame","name","role","render","type","tabIndex","variants","unstyled","true","outlineWidth","borderWidth","backgroundColor","false","justifyContent","alignItems","flexWrap","flexDirection","borderColor","cursor","hoverStyle","pressStyle","focusVisibleStyle","outlineColor","outlineStyle","outlined","process","env","TAMAGUI_HEADLESS","circular","chromeless","...size","val","extras","buttonStyle","gap",":number","disabled","pointerEvents","defaultVariants","Text","userSelect","flexGrow","flexShrink","Icon","props","children","scaleIcon","styledContext","useStyledContext","Error","sizeToken","iconColorProp","iconColor","iconSize","ButtonContext","ButtonComponent","styleable","propsIn","ref","isNested","processedProps","noNormalize","noExpand","icon","iconAfter","noTextWrap","textProps","_ref","contextColor","_ref1","finalSize","iconSizeNumber","themedIcon","themedIconAfter","map","icon2","_ref2","_ref3","_ref4","_ref5","_ref6","_ref7","_ref8","_ref9","wrappedChildren","_ref10","_ref11","_ref12","_ref13","_ref14","_ref15","_ref16","_ref17","textContext","_props_size","_ref18","_props_variant","_ref19","_props_elevation","_ref20","buttonContext","Provider","value","Button","Apply"],"sources":["../../src/Button.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAmBC,KAAA;AAC5B,SAASC,WAAA,4BAAsB;AAC/B,SAASC,cAAS,mCAAuB;AACzC,SAASC,OAAA,EAAAC,eAAsB,kCAAc;AAE7C,SAASC,oBAAa,EAAAC,YAAA,EAAAC,iBAA0B;AAEhD,SAAAC,WAAA,EAAAC,kBAAA;AAAA,SACEC,mBAAA,EAAAC,aAAA,EAAAC,MAAA,EAAAC,QAAA,EAAAC,IAAA,EAAAC,oBAAA;AAAA,SACAC,UAAA;AAAA,IACAC,OAAA,GAAAP,mBAAA;EACAQ,IAAA;EACAC,OAAA;EACAC,KAAA;EAAAC,SACK;EAEPC,QAAS;EA6BCC,UAAA,EAqSF;EAxTRC,QAAM,OAAU;EACdC,SAAM;EACNC,UAAS;EACTC,a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kH,QAAA;MACrC,GAAAD,aAAO;MACPvD,QAAU,iBAAY3E,KAAQ,CAAA8B,KAAA;QAC9B0D,GAAA;QACA,GAAAd,KAAU;QACV,IAAAe,QAAW;UACXxD,MAAY;QACZ;QACA;QAIA,IAAAyC,KAAW,CAAAhB,QAAA,IAAa,CAAA6B,OAAQ,CAAArE,IAAA;UAClCA;QAEM;QACDiB,QAAA;QACAwC,QAAA,GACG2B,UAAM,EACZY,eAAe,EACfX,eAAiB;MAGnB;IAGO;EAAA;AAAA;AACC,IAAA8B,MACI,GAAAtH,oBAAA,CAAAsE,eAAA;EAAAiD,KACH,EAAIrH,OAAA,CAAAkH,QAAc;EAAerG,KAEjC;EAA8CuC,IAC/C;EAAUI;AAET;AAAA,SACA4D,MACA,EAAAjD,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"Button.native.js","names":[],"sources":["esm/Button.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { ButtonNestingContext } from \"@tamagui/stacks\";\nimport { wrapChildrenInText } from \"@tamagui/text\";\nimport { createStyledContext, createStyledHOC, styled, Text, useProps, View, withStaticProperties } from \"@tamagui/web\";\nimport { useContext } from \"react\";\nvar buttonContextKeys = [\n \"color\",\n \"ellipsis\",\n \"fontFamily\",\n \"fontSize\",\n \"fontStyle\",\n \"fontWeight\",\n \"letterSpacing\",\n \"maxFontSizeMultiplier\",\n \"textAlign\"\n];\nvar ButtonContext = 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 = styled(View, {\n context: ButtonContext,\n displayName: \"ButtonFrame\",\n role: \"button\",\n render: /* @__PURE__ */ _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 = 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});\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 = useGetThemedIcon({\n color: iconColor === \"unset\" || typeof iconColor === \"number\" ? void 0 : iconColor,\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 = useContext(ButtonNestingContext);\n var styledContext = ButtonContext.useStyledContext();\n var processedProps = 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 = useGetThemedIcon({\n color: iconColor === \"unset\" || typeof iconColor === \"number\" ? void 0 : 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 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 = 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__ */ _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__ */ _jsx(ButtonNestingContext.Provider, {\n value: true,\n children: /* @__PURE__ */ _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 = createStyledHOC(ButtonFrame, function Button(props, ref) {\n var { props: buttonProps } = useButton(props);\n return /* @__PURE__ */ _jsx(ButtonFrame, {\n ref,\n ...buttonProps\n });\n});\nvar 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":";;;;;;;;AAMA,IAAI,oBAAoB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAI,gBAAgB,oBAAoB;CACtC,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,GAAG,EACD,MAAM,kBACR,CAAC;AACD,IAAI,cAAc,OAAO,MAAM;CAC7B,SAAS;CACT,aAAa;CACb,MAAM;CACN,QAAwB,oBAAK,UAAU,EACrC,MAAM,SACR,CAAC;CACD,UAAU;CACV,YAAY;CACZ,eAAe;CACf,UAAU;CACV,gBAAgB;CAChB,UAAU,EACR,UAAU,EACR,MAAM,EACJ,eAAe,OACjB,EACF,EACF;AACF,CAAC;AACD,IAAI,aAAa,OAAO,MAAM;CAC5B,SAAS;CACT,aAAa;CAEb,UAAU;CACV,YAAY;AACd,CAAC;AACD,IAAI,aAAa,SAAS,OAAO;CAC/B,IAAI,EAAE,UAAU,OAAO,YAAY,GAAG,SAAS;CAC/C,IAAI,gBAAgB,cAAc,iBAAiB;CACnD,IAAI,YAAY,UAAU,QAAQ,UAAU,KAAK,IAAI,QAAQ,kBAAkB,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc;CACzI,IAAI,gBAAgB,iBAAiB;EACnC,OAAO,cAAc,WAAW,OAAO,cAAc,WAAW,KAAK,IAAI;EACzE,MAAM,SAAS,KAAK,IAAI,KAAK,IAAI,OAAO;CAC1C,CAAC;CACD,OAAO,cAAc,QAAQ;AAC/B;AACA,IAAI,0BAA0B;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,U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KAAK,IAAI,SAAS,WAAW,SAAS,eAAe,sBAAsB,UAAU,eAAe,SAAS,SAAS,MAAM,WAA2B,oBAAK,UAAU;EACvN,MAAM;EACN,UAAU;CACZ,CAAC,IAAI,KAAK;CACV,IAAI,QAAQ;EACV,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,oBAAK,qBAAqB,UAAU;GAC5D,OAAO;GACP,UAA0B,qBAAM,cAAc,UAAU;IACtD,GAAG;IACH,UAAU;KACR;KACA;KACA;IACF;GACF,CAAC;EACH,CAAC;CACH;CACA,OAAO;EACL;EACA;CACF;AACF;AACA,IAAI,kBAAkB,gBAAgB,aAAa,SAAS,OAAO,OAAO,KAAK;CAC7E,IAAI,EAAE,OAAO,gBAAgB,UAAU,KAAK;CAC5C,OAAuB,oBAAK,aAAa;EACvC;EACA,GAAG;CACL,CAAC;AACH,CAAC;AACD,IAAI,UAAU,qBAAqB,iBAAiB;CAClD,OAAO,cAAc;CACrB,OAAO;CACP,MAAM;CACN,MAAM;AACR,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./Button.mjs";
2
- //# sourceMappingURL=index.js.map
1
+ export * from "./Button.mjs"
@@ -1,2 +1 @@
1
- export * from "./Button.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ export * from "./Button.mjs"
@@ -1,2 +1 @@
1
- export * from "./Button.native.js";
2
- //# sourceMappingURL=index.native.js.map
1
+ export * from "./Button.native.js"