@hanzogui/button 2.0.0

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