@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,218 @@
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: () => Button,
24
+ ButtonContext: () => ButtonContext
25
+ });
26
+ module.exports = __toCommonJS(Button_exports);
27
+ var import_gui_font_size = require("@hanzo/gui-font-size"),
28
+ import_gui_get_button_sized = require("@hanzo/gui-get-button-sized"),
29
+ import_gui_helpers = require("@hanzo/gui-helpers"),
30
+ import_gui_stacks = require("@hanzo/gui-stacks"),
31
+ import_gui_text = require("@hanzo/gui-text"),
32
+ import_gui_web = require("@hanzo/gui-web"),
33
+ import_react = require("react"),
34
+ import_jsx_runtime = require("react/jsx-runtime");
35
+ const context = (0, import_gui_web.createStyledContext)({
36
+ size: void 0,
37
+ variant: void 0,
38
+ color: void 0,
39
+ elevation: void 0
40
+ }),
41
+ Frame = (0, import_gui_web.styled)(import_gui_web.View, {
42
+ context,
43
+ name: "Button",
44
+ role: "button",
45
+ render: /* @__PURE__ */(0, import_jsx_runtime.jsx)("button", {
46
+ type: "button"
47
+ }),
48
+ tabIndex: 0,
49
+ variants: {
50
+ unstyled: {
51
+ false: {
52
+ size: "$true",
53
+ justifyContent: "center",
54
+ alignItems: "center",
55
+ flexWrap: "nowrap",
56
+ flexDirection: "row",
57
+ cursor: "pointer",
58
+ backgroundColor: "$background",
59
+ borderWidth: 1,
60
+ borderColor: "transparent",
61
+ hoverStyle: {
62
+ backgroundColor: "$backgroundHover",
63
+ borderColor: "$borderColorHover"
64
+ },
65
+ pressStyle: {
66
+ backgroundColor: "$backgroundPress",
67
+ borderColor: "$borderColorHover"
68
+ },
69
+ focusVisibleStyle: {
70
+ outlineColor: "$outlineColor",
71
+ outlineStyle: "solid",
72
+ outlineWidth: 2
73
+ }
74
+ }
75
+ },
76
+ variant: {
77
+ outlined: process.env.HANZO_GUI_HEADLESS === "1" ? {} : {
78
+ backgroundColor: "transparent",
79
+ borderWidth: 1,
80
+ borderColor: "$borderColor",
81
+ hoverStyle: {
82
+ backgroundColor: "transparent",
83
+ borderColor: "$borderColorHover"
84
+ },
85
+ pressStyle: {
86
+ backgroundColor: "transparent",
87
+ borderColor: "$borderColorPress"
88
+ }
89
+ }
90
+ },
91
+ circular: import_gui_stacks.themeableVariants.circular,
92
+ chromeless: import_gui_stacks.themeableVariants.chromeless,
93
+ size: {
94
+ "...size": (val, extras) => {
95
+ const buttonStyle = (0, import_gui_get_button_sized.getButtonSized)(val, extras),
96
+ gap = (0, import_gui_web.getTokenValue)(val);
97
+ return {
98
+ ...buttonStyle,
99
+ gap
100
+ };
101
+ },
102
+ ":number": (val, extras) => {
103
+ const buttonStyle = (0, import_gui_get_button_sized.getButtonSized)(val, extras),
104
+ gap = val * 0.4;
105
+ return {
106
+ ...buttonStyle,
107
+ gap
108
+ };
109
+ }
110
+ },
111
+ elevation: {
112
+ "...size": import_gui_stacks.getElevation,
113
+ ":number": import_gui_stacks.getElevation
114
+ },
115
+ disabled: {
116
+ true: {
117
+ pointerEvents: "none",
118
+ // @ts-ignore
119
+ "aria-disabled": !0
120
+ }
121
+ }
122
+ },
123
+ defaultVariants: {
124
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
125
+ }
126
+ }),
127
+ Text = (0, import_gui_web.styled)(import_gui_text.SizableText, {
128
+ context,
129
+ variants: {
130
+ unstyled: {
131
+ false: {
132
+ userSelect: "none",
133
+ cursor: "pointer",
134
+ // flexGrow 1 leads to inconsistent native style where text pushes to start of view
135
+ flexGrow: 0,
136
+ flexShrink: 1,
137
+ ellipsis: !0,
138
+ color: "$color"
139
+ }
140
+ }
141
+ },
142
+ defaultVariants: {
143
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
144
+ }
145
+ }),
146
+ Icon = props => {
147
+ const {
148
+ children,
149
+ scaleIcon = 1,
150
+ size
151
+ } = props,
152
+ styledContext = context.useStyledContext();
153
+ if (!styledContext) throw new Error("Button.Icon must be used within a Button");
154
+ const sizeToken = size ?? styledContext.size,
155
+ iconColor = (0, import_gui_helpers.useCurrentColor)(styledContext.color),
156
+ iconSize = (typeof sizeToken == "number" ? sizeToken * 0.5 : (0, import_gui_font_size.getFontSize)(sizeToken)) * scaleIcon;
157
+ return (0, import_gui_helpers.getIcon)(children, {
158
+ size: iconSize,
159
+ color: iconColor
160
+ });
161
+ },
162
+ ButtonContext = (0, import_gui_web.createStyledContext)({
163
+ size: void 0,
164
+ variant: void 0,
165
+ color: void 0
166
+ }),
167
+ ButtonComponent = Frame.styleable((propsIn, ref) => {
168
+ const isNested = (0, import_react.useContext)(import_gui_stacks.ButtonNestingContext),
169
+ processedProps = (0, import_gui_web.useProps)(propsIn, {
170
+ noNormalize: !0,
171
+ noExpand: !0
172
+ }),
173
+ {
174
+ children,
175
+ iconSize,
176
+ icon,
177
+ iconAfter,
178
+ scaleIcon = 1,
179
+ ...props
180
+ } = processedProps,
181
+ size = propsIn.size || (propsIn.unstyled ? void 0 : "$true"),
182
+ styledContext = context.useStyledContext(),
183
+ iconColor = (0, import_gui_helpers.useCurrentColor)(styledContext?.color),
184
+ finalSize = iconSize ?? size ?? styledContext?.size,
185
+ iconSizeNumber = (typeof finalSize == "number" ? finalSize * 0.5 : (0, import_gui_font_size.getFontSize)(finalSize)) * scaleIcon,
186
+ [themedIcon, themedIconAfter] = [icon, iconAfter].map(icon2 => icon2 ? (0, import_gui_helpers.getIcon)(icon2, {
187
+ size: iconSizeNumber,
188
+ color: iconColor
189
+ // No marginLeft or marginRight needed - spacing is handled by the gap property in Frame's size variants
190
+ }) : null),
191
+ wrappedChildren = (0, import_gui_text.wrapChildrenInText)(Text, {
192
+ children
193
+ }, {
194
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1",
195
+ size: finalSize ?? styledContext?.size
196
+ });
197
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_stacks.ButtonNestingContext.Provider, {
198
+ value: !0,
199
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(Frame, {
200
+ ref,
201
+ ...props,
202
+ ...(isNested && {
203
+ render: "span"
204
+ }),
205
+ ...(props.circular && !propsIn.size && {
206
+ size
207
+ }),
208
+ tabIndex: 0,
209
+ children: [themedIcon, wrappedChildren, themedIconAfter]
210
+ })
211
+ });
212
+ }),
213
+ Button = (0, import_gui_web.withStaticProperties)(ButtonComponent, {
214
+ Apply: context.Provider,
215
+ Frame,
216
+ Text,
217
+ Icon
218
+ });
@@ -0,0 +1,224 @@
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: () => Button,
26
+ ButtonContext: () => ButtonContext
27
+ });
28
+ module.exports = __toCommonJS(Button_exports);
29
+ var import_jsx_runtime = require("react/jsx-runtime"),
30
+ import_gui_font_size = require("@hanzo/gui-font-size"),
31
+ import_gui_get_button_sized = require("@hanzo/gui-get-button-sized"),
32
+ import_gui_helpers = require("@hanzo/gui-helpers"),
33
+ import_gui_stacks = require("@hanzo/gui-stacks"),
34
+ import_gui_text = require("@hanzo/gui-text"),
35
+ import_gui_web = require("@hanzo/gui-web"),
36
+ import_react = require("react"),
37
+ context = (0, import_gui_web.createStyledContext)({
38
+ size: void 0,
39
+ variant: void 0,
40
+ color: void 0,
41
+ elevation: void 0
42
+ }),
43
+ Frame = (0, import_gui_web.styled)(import_gui_web.View, {
44
+ context,
45
+ name: "Button",
46
+ role: "button",
47
+ render: /* @__PURE__ */(0, import_jsx_runtime.jsx)("button", {
48
+ type: "button"
49
+ }),
50
+ tabIndex: 0,
51
+ variants: {
52
+ unstyled: {
53
+ false: {
54
+ size: "$true",
55
+ justifyContent: "center",
56
+ alignItems: "center",
57
+ flexWrap: "nowrap",
58
+ flexDirection: "row",
59
+ cursor: "pointer",
60
+ backgroundColor: "$background",
61
+ borderWidth: 1,
62
+ borderColor: "transparent",
63
+ hoverStyle: {
64
+ backgroundColor: "$backgroundHover",
65
+ borderColor: "$borderColorHover"
66
+ },
67
+ pressStyle: {
68
+ backgroundColor: "$backgroundPress",
69
+ borderColor: "$borderColorHover"
70
+ },
71
+ focusVisibleStyle: {
72
+ outlineColor: "$outlineColor",
73
+ outlineStyle: "solid",
74
+ outlineWidth: 2
75
+ }
76
+ }
77
+ },
78
+ variant: {
79
+ outlined: process.env.HANZO_GUI_HEADLESS === "1" ? {} : {
80
+ backgroundColor: "transparent",
81
+ borderWidth: 1,
82
+ borderColor: "$borderColor",
83
+ hoverStyle: {
84
+ backgroundColor: "transparent",
85
+ borderColor: "$borderColorHover"
86
+ },
87
+ pressStyle: {
88
+ backgroundColor: "transparent",
89
+ borderColor: "$borderColorPress"
90
+ }
91
+ }
92
+ },
93
+ circular: import_gui_stacks.themeableVariants.circular,
94
+ chromeless: import_gui_stacks.themeableVariants.chromeless,
95
+ size: {
96
+ "...size": function (val, extras) {
97
+ var buttonStyle = (0, import_gui_get_button_sized.getButtonSized)(val, extras),
98
+ gap = (0, import_gui_web.getTokenValue)(val);
99
+ return {
100
+ ...buttonStyle,
101
+ gap
102
+ };
103
+ },
104
+ ":number": function (val, extras) {
105
+ var buttonStyle = (0, import_gui_get_button_sized.getButtonSized)(val, extras),
106
+ gap = val * 0.4;
107
+ return {
108
+ ...buttonStyle,
109
+ gap
110
+ };
111
+ }
112
+ },
113
+ elevation: {
114
+ "...size": import_gui_stacks.getElevation,
115
+ ":number": import_gui_stacks.getElevation
116
+ },
117
+ disabled: {
118
+ true: {
119
+ pointerEvents: "none",
120
+ // @ts-ignore
121
+ "aria-disabled": !0
122
+ }
123
+ }
124
+ },
125
+ defaultVariants: {
126
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
127
+ }
128
+ }),
129
+ Text = (0, import_gui_web.styled)(import_gui_text.SizableText, {
130
+ context,
131
+ variants: {
132
+ unstyled: {
133
+ false: {
134
+ userSelect: "none",
135
+ cursor: "pointer",
136
+ // flexGrow 1 leads to inconsistent native style where text pushes to start of view
137
+ flexGrow: 0,
138
+ flexShrink: 1,
139
+ ellipsis: !0,
140
+ color: "$color"
141
+ }
142
+ }
143
+ },
144
+ defaultVariants: {
145
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
146
+ }
147
+ }),
148
+ Icon = function (props) {
149
+ var {
150
+ children,
151
+ scaleIcon = 1,
152
+ size
153
+ } = props,
154
+ styledContext = context.useStyledContext();
155
+ if (!styledContext) throw new Error("Button.Icon must be used within a Button");
156
+ var sizeToken = size ?? styledContext.size,
157
+ iconColor = (0, import_gui_helpers.useCurrentColor)(styledContext.color),
158
+ iconSize = (typeof sizeToken == "number" ? sizeToken * 0.5 : (0, import_gui_font_size.getFontSize)(sizeToken)) * scaleIcon;
159
+ return (0, import_gui_helpers.getIcon)(children, {
160
+ size: iconSize,
161
+ color: iconColor
162
+ });
163
+ },
164
+ ButtonContext = (0, import_gui_web.createStyledContext)({
165
+ size: void 0,
166
+ variant: void 0,
167
+ color: void 0
168
+ }),
169
+ ButtonComponent = Frame.styleable(function (propsIn, ref) {
170
+ var isNested = (0, import_react.useContext)(import_gui_stacks.ButtonNestingContext),
171
+ processedProps = (0, import_gui_web.useProps)(propsIn, {
172
+ noNormalize: !0,
173
+ noExpand: !0
174
+ }),
175
+ {
176
+ children,
177
+ iconSize,
178
+ icon,
179
+ iconAfter,
180
+ scaleIcon = 1,
181
+ ...props
182
+ } = processedProps,
183
+ size = propsIn.size || (propsIn.unstyled ? void 0 : "$true"),
184
+ styledContext = context.useStyledContext(),
185
+ iconColor = (0, import_gui_helpers.useCurrentColor)(styledContext?.color),
186
+ _ref,
187
+ finalSize = (_ref = iconSize ?? size) !== null && _ref !== void 0 ? _ref : styledContext?.size,
188
+ iconSizeNumber = (typeof finalSize == "number" ? finalSize * 0.5 : (0, import_gui_font_size.getFontSize)(finalSize)) * scaleIcon,
189
+ [themedIcon, themedIconAfter] = [icon, iconAfter].map(function (icon2) {
190
+ return icon2 ? (0, import_gui_helpers.getIcon)(icon2, {
191
+ size: iconSizeNumber,
192
+ color: iconColor
193
+ }) : null;
194
+ }),
195
+ wrappedChildren = (0, import_gui_text.wrapChildrenInText)(Text, {
196
+ children
197
+ }, {
198
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1",
199
+ size: finalSize ?? styledContext?.size
200
+ });
201
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_stacks.ButtonNestingContext.Provider, {
202
+ value: !0,
203
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(Frame, {
204
+ ref,
205
+ ...props,
206
+ ...(isNested && {
207
+ render: "span"
208
+ }),
209
+ // Pass resolved size to circular variant when no explicit size provided
210
+ ...(props.circular && !propsIn.size && {
211
+ size
212
+ }),
213
+ tabIndex: 0,
214
+ children: [themedIcon, wrappedChildren, themedIconAfter]
215
+ })
216
+ });
217
+ }),
218
+ Button = (0, import_gui_web.withStaticProperties)(ButtonComponent, {
219
+ Apply: context.Provider,
220
+ Frame,
221
+ Text,
222
+ Icon
223
+ });
224
+ //# sourceMappingURL=Button.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Button_exports","__export","Button","ButtonContext","module","exports","import_jsx_runtime","require","import_gui_font_size","import_gui_get_button_sized","import_gui_helpers","import_gui_stacks","import_gui_text","import_gui_web","import_react","context","createStyledContext","size","variant","color","elevation","Frame","styled","View","name","role","render","jsx","type","tabIndex","variants","unstyled","false","justifyContent","alignItems","flexWrap","flexDirection","cursor","backgroundColor","borderWidth","borderColor","hoverStyle","pressStyle","focusVisibleStyle","outlineColor","outlineStyle","outlineWidth","outlined","process","env","HANZO_GUI_HEADLESS","circular","themeableVariants","chromeless","...size","val","extras","buttonStyle","getButtonSized","gap","getTokenValue",":number","getElevation","disabled","true","pointerEvents","defaultVariants","Text","SizableText","userSelect","flexGrow","flexShrink","ellipsis","Icon","props","children","scaleIcon","styledContext","useStyledContext","Error","sizeToken","iconColor","useCurrentColor","iconSize","getFontSize","getIcon","ButtonComponent","styleable","propsIn","ref","isNested","useContext","ButtonNestingContext","processedProps","useProps","noNormalize","noExpand","icon","iconAfter","_ref","finalSize","iconSizeNumber","themedIcon","themedIconAfter","map","icon2","wrappedChildren","wrapChildrenInText","Provider","jsxs"],"sources":["../../src/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,KAAAA,MAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAA4B,CAAAK,cAAA;AAmB5B,IAAAM,kBAAgB,GAAAC,OAAA;EAAAC,oBAKb,GAAAD,OAAA;EAAAE,2BAAA,GAAAF,OAAA;EAAAG,kBAAA,GAAAH,OAAA;EAAAI,iBAAA,GAAAJ,OAAA;EAAAK,eAAA,GA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F,KAAA,EAAA8D;QAA6C,EAC7C,OAAM;MAA4B,EACpC;MAAAyB,eAAA,OAAA9F,eAAA,CAAA+F,kBAAA,EAAAxC,IAAA;QACFQ;MAEA;QAEK5C,QAAA,EAAAiB,OAAA,CAAAC,GAAA,CAAAC,kBAAA;QAAAjC,IAAA,EAAAmF,SAAA,IAAAvB,aAAA,EAAA5D;MAAA;IACC,OACI,mBAAAX,kBAAA,CAAAqB,GAAA,EAAAhB,iBAAA,CAAAiF,oBAAA,CAAAgB,QAAA;MAAA7G,KACC;MAA6B4E,QAE7B,iBAAmB,IAAArE,kBAAuB,CAAAuG,IAAA,EAAAxF,KAAA;QAC/CoE,GAAA;QAEC,GAAAf,KAAA;QAAA,IAAAgB,QAAA;UACAhE,MAAA;QAAA;QACA;QAAA,IAAAgD,KAAA,CAAAvB,QAAA,KAAAqC,OAAA,CAAAvE,IAAA;UAELA;QAIS;QACXY,QAAO,GAAQ;QACf8C,QAAA,GACA2B,UAAA,EACAI,eAAA,EACDH,eAAA","ignoreList":[]}
@@ -0,0 +1,36 @@
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
+ import_Button = require("./Button.cjs"),
5
+ import_jsx_runtime = require("react/jsx-runtime");
6
+ const conf = (0, import_gui_core.createTamagui)((0, import_gui_config_default.getDefaultTamaguiConfig)());
7
+ (0, import_vitest.describe)("Button", () => {
8
+ (0, import_vitest.test)("123", () => {
9
+ (0, import_vitest.expect)(!0).toBeTruthy();
10
+ }), (0, import_vitest.test)("accepts native button html props", () => {
11
+ const _submitBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
12
+ type: "submit",
13
+ children: "Submit"
14
+ }),
15
+ _resetBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
16
+ type: "reset",
17
+ children: "Reset"
18
+ }),
19
+ _buttonBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
20
+ type: "button",
21
+ children: "Button"
22
+ }),
23
+ _formBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
24
+ type: "submit",
25
+ form: "myForm",
26
+ formAction: "/submit",
27
+ formMethod: "post",
28
+ formTarget: "_blank",
29
+ formNoValidate: !0,
30
+ name: "submitBtn",
31
+ value: "submit",
32
+ children: "Submit"
33
+ });
34
+ (0, import_vitest.expect)(!0).toBeTruthy();
35
+ });
36
+ });
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var import_jsx_runtime = require("react/jsx-runtime"),
4
+ import_gui_config_default = require("@hanzo/gui-config-default"),
5
+ import_gui_core = require("@hanzo/gui-core"),
6
+ import_vitest = require("vitest"),
7
+ import_Button = require("./Button.native.js"),
8
+ conf = (0, import_gui_core.createTamagui)((0, import_gui_config_default.getDefaultTamaguiConfig)());
9
+ (0, import_vitest.describe)("Button", function () {
10
+ (0, import_vitest.test)("123", function () {
11
+ (0, import_vitest.expect)(!0).toBeTruthy();
12
+ }), (0, import_vitest.test)("accepts native button html props", function () {
13
+ var _submitBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
14
+ type: "submit",
15
+ children: "Submit"
16
+ }),
17
+ _resetBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
18
+ type: "reset",
19
+ children: "Reset"
20
+ }),
21
+ _buttonBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
22
+ type: "button",
23
+ children: "Button"
24
+ }),
25
+ _formBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
26
+ type: "submit",
27
+ form: "myForm",
28
+ formAction: "/submit",
29
+ formMethod: "post",
30
+ formTarget: "_blank",
31
+ formNoValidate: !0,
32
+ name: "submitBtn",
33
+ value: "submit",
34
+ children: "Submit"
35
+ });
36
+ (0, import_vitest.expect)(!0).toBeTruthy();
37
+ });
38
+ });
39
+ //# sourceMappingURL=Button.test.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["import_jsx_runtime","require","import_gui_config_default","import_gui_core","import_vitest","import_Button","conf","createTamagui","getDefaultTamaguiConfig","describe","test","expect","toBeTruthy","_submitBtn","jsx","Button","type","children","_resetBtn","_buttonBtn","_formBtn","form","formAction","formMethod","formTarget","formNoValidate","name"],"sources":["../../src/Button.test.tsx"],"sourcesContent":[null],"mappings":"AAAA;;AAKA,IAAAA,kBAAa,GAAAC,OAAA,oBAAc;EAAAC,yBAAA,GAAAD,OAAA,4BAAyB;EAAAE,eAAA,GAAAF,OAAA;EAAAG,aAAA,GAAAH,OAAA;EAAAI,aAAA,GAAAJ,OAAA;EAAAK,IAAA,OAAAH,eAAA,CAAAI,aAAA,MAAAL,yBAAA,CAAAM,uBAAA;AAAA,IAEpDJ,aAAA,CAAAK,QAAA,EAAS,UAAU,YAAM;EACvB,IAAAL,aAAA,CAAAM,IAAA,EAAK,OAAO,YAAM;IAChB,IAAAN,aAAA,CAAAO,MAAA,EAAO,EAAI,EAAEC,UAAA,CAAW;EAC1B,CAAC,OAGDR,aAAA,CAAAM,IAAA,EAAK,oCAAoC,YAAM;IAE7C,IAAAG,UAAM,kBAAa,IAAAb,kBAAA,CAAAc,GAAA,EAAAT,aAAC,CAAAU,MAAA;QAIjBC,IAAA;QAAAC,QAAA;MAAA;MACCC,SAAK,sBAAAlB,kBAAA,CAAAc,GAAA,EAAAT,aAAA,CAAAU,MAAA;QAAAC,IACL,SAAK;QAAAC,QACL;MAAW;MACXE,UAAA,GAAW,mBAAAnB,kBAAA,CAAAc,GAAA,EAAAT,aAAA,CAAAU,MAAA;QAAAC,IACX,UAAW;QAAAC,QACX;MAAc;MACdG,QAAK,sBAAApB,kBAAA,CAAAc,GAAA,EAAAT,aAAA,CAAAU,MAAA;QAAAC,IACL,UAAM;QAAAK,IACP;QAAAC,UAAA;QAEDC,UAAA;QAEFC,UAAA;QACDC,cAAA;QAWFC,IAAA","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 index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
18
+ __reExport(index_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 index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_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","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}