@hanzogui/button 2.0.0-rc.41-hanzoai.3

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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Button.cjs +225 -0
  3. package/dist/cjs/Button.native.js +229 -0
  4. package/dist/cjs/Button.native.js.map +1 -0
  5. package/dist/cjs/Button.test.cjs +37 -0
  6. package/dist/cjs/Button.test.native.js +40 -0
  7. package/dist/cjs/Button.test.native.js.map +1 -0
  8. package/dist/cjs/index.cjs +20 -0
  9. package/dist/cjs/index.native.js +23 -0
  10. package/dist/cjs/index.native.js.map +1 -0
  11. package/dist/cjs/v1/Button.cjs +262 -0
  12. package/dist/cjs/v1/Button.native.js +267 -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 +20 -0
  18. package/dist/cjs/v1/index.native.js +23 -0
  19. package/dist/cjs/v1/index.native.js.map +1 -0
  20. package/dist/esm/Button.mjs +199 -0
  21. package/dist/esm/Button.mjs.map +1 -0
  22. package/dist/esm/Button.native.js +200 -0
  23. package/dist/esm/Button.native.js.map +1 -0
  24. package/dist/esm/Button.test.mjs +38 -0
  25. package/dist/esm/Button.test.mjs.map +1 -0
  26. package/dist/esm/Button.test.native.js +38 -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 +232 -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 +199 -0
  47. package/dist/jsx/Button.mjs.map +1 -0
  48. package/dist/jsx/Button.native.js +229 -0
  49. package/dist/jsx/Button.native.js.map +1 -0
  50. package/dist/jsx/Button.test.mjs +38 -0
  51. package/dist/jsx/Button.test.mjs.map +1 -0
  52. package/dist/jsx/Button.test.native.js +40 -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 +23 -0
  59. package/dist/jsx/index.native.js.map +1 -0
  60. package/dist/jsx/v1/Button.mjs +232 -0
  61. package/dist/jsx/v1/Button.mjs.map +1 -0
  62. package/dist/jsx/v1/Button.native.js +267 -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 +23 -0
  71. package/dist/jsx/v1/index.native.js.map +1 -0
  72. package/package.json +60 -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.d.ts.map +1 -0
  81. package/types/Button.test.d.ts +2 -0
  82. package/types/Button.test.d.ts.map +1 -0
  83. package/types/index.d.ts +2 -0
  84. package/types/index.d.ts.map +1 -0
  85. package/types/v1/Button.d.ts +302 -0
  86. package/types/v1/Button.d.ts.map +1 -0
  87. package/types/v1/Button.test.d.ts +2 -0
  88. package/types/v1/Button.test.d.ts.map +1 -0
  89. package/types/v1/index.d.ts +2 -0
  90. package/types/v1/index.d.ts.map +1 -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,225 @@
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: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
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_font_size = require("@hanzogui/font-size");
30
+ var import_get_button_sized = require("@hanzogui/get-button-sized");
31
+ var import_component_helpers = require("@hanzogui/component-helpers");
32
+ var import_stacks = require("@hanzogui/stacks");
33
+ var import_text = require("@hanzogui/text");
34
+ var import_web = require("@hanzogui/web");
35
+ var import_react = require("react");
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ const context = (0, import_web.createStyledContext)({
38
+ size: void 0,
39
+ variant: void 0,
40
+ color: void 0,
41
+ elevation: void 0
42
+ });
43
+ const Frame = (0, import_web.styled)(import_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.HANZOGUI_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_stacks.themeableVariants.circular,
94
+ chromeless: import_stacks.themeableVariants.chromeless,
95
+ size: {
96
+ "...size": (val, extras) => {
97
+ const buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras);
98
+ const gap = (0, import_web.getTokenValue)(val);
99
+ return {
100
+ ...buttonStyle,
101
+ gap
102
+ };
103
+ },
104
+ ":number": (val, extras) => {
105
+ const buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras);
106
+ const gap = val * 0.4;
107
+ return {
108
+ ...buttonStyle,
109
+ gap
110
+ };
111
+ }
112
+ },
113
+ elevation: {
114
+ "...size": import_stacks.getElevation,
115
+ ":number": import_stacks.getElevation
116
+ },
117
+ disabled: {
118
+ true: {
119
+ pointerEvents: "none",
120
+ // @ts-ignore
121
+ "aria-disabled": true
122
+ }
123
+ }
124
+ },
125
+ defaultVariants: {
126
+ unstyled: process.env.HANZOGUI_HEADLESS === "1"
127
+ }
128
+ });
129
+ const Text = (0, import_web.styled)(import_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: true,
140
+ color: "$color"
141
+ }
142
+ }
143
+ },
144
+ defaultVariants: {
145
+ unstyled: process.env.HANZOGUI_HEADLESS === "1"
146
+ }
147
+ });
148
+ const Icon = props => {
149
+ const {
150
+ children,
151
+ scaleIcon = 1,
152
+ size
153
+ } = props;
154
+ const styledContext = context.useStyledContext();
155
+ if (!styledContext) {
156
+ throw new Error("Button.Icon must be used within a Button");
157
+ }
158
+ const sizeToken = size ?? styledContext.size;
159
+ const iconColor = (0, import_component_helpers.useCurrentColor)(styledContext.color);
160
+ const iconSize = (typeof sizeToken === "number" ? sizeToken * 0.5 : (0, import_font_size.getFontSize)(sizeToken)) * scaleIcon;
161
+ return (0, import_component_helpers.getIcon)(children, {
162
+ size: iconSize,
163
+ color: iconColor
164
+ });
165
+ };
166
+ const ButtonContext = (0, import_web.createStyledContext)({
167
+ size: void 0,
168
+ variant: void 0,
169
+ color: void 0
170
+ });
171
+ const ButtonComponent = Frame.styleable((propsIn, ref) => {
172
+ const isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
173
+ const processedProps = (0, import_web.useProps)(propsIn, {
174
+ noNormalize: true,
175
+ noExpand: true
176
+ });
177
+ const {
178
+ children,
179
+ iconSize,
180
+ icon,
181
+ iconAfter,
182
+ scaleIcon = 1,
183
+ ...props
184
+ } = processedProps;
185
+ const size = propsIn.size || (propsIn.unstyled ? void 0 : "$true");
186
+ const styledContext = context.useStyledContext();
187
+ const iconColor = (0, import_component_helpers.useCurrentColor)(styledContext?.color);
188
+ const finalSize = iconSize ?? size ?? styledContext?.size;
189
+ const iconSizeNumber = (typeof finalSize === "number" ? finalSize * 0.5 : (0, import_font_size.getFontSize)(finalSize)) * scaleIcon;
190
+ const [themedIcon, themedIconAfter] = [icon, iconAfter].map(icon2 => {
191
+ if (!icon2) return null;
192
+ return (0, import_component_helpers.getIcon)(icon2, {
193
+ size: iconSizeNumber,
194
+ color: iconColor
195
+ // No marginLeft or marginRight needed - spacing is handled by the gap property in Frame's size variants
196
+ });
197
+ });
198
+ const wrappedChildren = (0, import_text.wrapChildrenInText)(Text, {
199
+ children
200
+ }, {
201
+ unstyled: process.env.HANZOGUI_HEADLESS === "1",
202
+ size: finalSize ?? styledContext?.size
203
+ });
204
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
205
+ value: true,
206
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(Frame, {
207
+ ref,
208
+ ...props,
209
+ ...(isNested && {
210
+ render: "span"
211
+ }),
212
+ ...(props.circular && !propsIn.size && {
213
+ size
214
+ }),
215
+ tabIndex: 0,
216
+ children: [themedIcon, wrappedChildren, themedIconAfter]
217
+ })
218
+ });
219
+ });
220
+ const Button = (0, import_web.withStaticProperties)(ButtonComponent, {
221
+ Apply: context.Provider,
222
+ Frame,
223
+ Text,
224
+ Icon
225
+ });
@@ -0,0 +1,229 @@
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: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var Button_exports = {};
26
+ __export(Button_exports, {
27
+ Button: () => Button,
28
+ ButtonContext: () => ButtonContext
29
+ });
30
+ module.exports = __toCommonJS(Button_exports);
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var import_font_size = require("@hanzogui/font-size");
33
+ var import_get_button_sized = require("@hanzogui/get-button-sized");
34
+ var import_component_helpers = require("@hanzogui/component-helpers");
35
+ var import_stacks = require("@hanzogui/stacks");
36
+ var import_text = require("@hanzogui/text");
37
+ var import_web = require("@hanzogui/web");
38
+ var import_react = require("react");
39
+ var context = (0, import_web.createStyledContext)({
40
+ size: void 0,
41
+ variant: void 0,
42
+ color: void 0,
43
+ elevation: void 0
44
+ });
45
+ var Frame = (0, import_web.styled)(import_web.View, {
46
+ context,
47
+ name: "Button",
48
+ role: "button",
49
+ render: /* @__PURE__ */(0, import_jsx_runtime.jsx)("button", {
50
+ type: "button"
51
+ }),
52
+ tabIndex: 0,
53
+ variants: {
54
+ unstyled: {
55
+ false: {
56
+ size: "$true",
57
+ justifyContent: "center",
58
+ alignItems: "center",
59
+ flexWrap: "nowrap",
60
+ flexDirection: "row",
61
+ cursor: "pointer",
62
+ backgroundColor: "$background",
63
+ borderWidth: 1,
64
+ borderColor: "transparent",
65
+ hoverStyle: {
66
+ backgroundColor: "$backgroundHover",
67
+ borderColor: "$borderColorHover"
68
+ },
69
+ pressStyle: {
70
+ backgroundColor: "$backgroundPress",
71
+ borderColor: "$borderColorHover"
72
+ },
73
+ focusVisibleStyle: {
74
+ outlineColor: "$outlineColor",
75
+ outlineStyle: "solid",
76
+ outlineWidth: 2
77
+ }
78
+ }
79
+ },
80
+ variant: {
81
+ outlined: process.env.HANZOGUI_HEADLESS === "1" ? {} : {
82
+ backgroundColor: "transparent",
83
+ borderWidth: 1,
84
+ borderColor: "$borderColor",
85
+ hoverStyle: {
86
+ backgroundColor: "transparent",
87
+ borderColor: "$borderColorHover"
88
+ },
89
+ pressStyle: {
90
+ backgroundColor: "transparent",
91
+ borderColor: "$borderColorPress"
92
+ }
93
+ }
94
+ },
95
+ circular: import_stacks.themeableVariants.circular,
96
+ chromeless: import_stacks.themeableVariants.chromeless,
97
+ size: {
98
+ "...size": function (val, extras) {
99
+ var buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras);
100
+ var gap = (0, import_web.getTokenValue)(val);
101
+ return {
102
+ ...buttonStyle,
103
+ gap
104
+ };
105
+ },
106
+ ":number": function (val, extras) {
107
+ var buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras);
108
+ var gap = val * 0.4;
109
+ return {
110
+ ...buttonStyle,
111
+ gap
112
+ };
113
+ }
114
+ },
115
+ elevation: {
116
+ "...size": import_stacks.getElevation,
117
+ ":number": import_stacks.getElevation
118
+ },
119
+ disabled: {
120
+ true: {
121
+ pointerEvents: "none",
122
+ // @ts-ignore
123
+ "aria-disabled": true
124
+ }
125
+ }
126
+ },
127
+ defaultVariants: {
128
+ unstyled: process.env.HANZOGUI_HEADLESS === "1"
129
+ }
130
+ });
131
+ var Text = (0, import_web.styled)(import_text.SizableText, {
132
+ context,
133
+ variants: {
134
+ unstyled: {
135
+ false: {
136
+ userSelect: "none",
137
+ cursor: "pointer",
138
+ // flexGrow 1 leads to inconsistent native style where text pushes to start of view
139
+ flexGrow: 0,
140
+ flexShrink: 1,
141
+ ellipsis: true,
142
+ color: "$color"
143
+ }
144
+ }
145
+ },
146
+ defaultVariants: {
147
+ unstyled: process.env.HANZOGUI_HEADLESS === "1"
148
+ }
149
+ });
150
+ var Icon = function (props) {
151
+ var {
152
+ children,
153
+ scaleIcon = 1,
154
+ size
155
+ } = props;
156
+ var styledContext = context.useStyledContext();
157
+ if (!styledContext) {
158
+ throw new Error("Button.Icon must be used within a Button");
159
+ }
160
+ var sizeToken = size !== null && size !== void 0 ? size : styledContext.size;
161
+ var iconColor = (0, import_component_helpers.useCurrentColor)(styledContext.color);
162
+ var iconSize = (typeof sizeToken === "number" ? sizeToken * 0.5 : (0, import_font_size.getFontSize)(sizeToken)) * scaleIcon;
163
+ return (0, import_component_helpers.getIcon)(children, {
164
+ size: iconSize,
165
+ color: iconColor
166
+ });
167
+ };
168
+ var ButtonContext = (0, import_web.createStyledContext)({
169
+ size: void 0,
170
+ variant: void 0,
171
+ color: void 0
172
+ });
173
+ var ButtonComponent = Frame.styleable(function (propsIn, ref) {
174
+ var isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
175
+ var processedProps = (0, import_web.useProps)(propsIn, {
176
+ noNormalize: true,
177
+ noExpand: true
178
+ });
179
+ var {
180
+ children,
181
+ iconSize,
182
+ icon,
183
+ iconAfter,
184
+ scaleIcon = 1,
185
+ ...props
186
+ } = processedProps;
187
+ var size = propsIn.size || (propsIn.unstyled ? void 0 : "$true");
188
+ var styledContext = context.useStyledContext();
189
+ var iconColor = (0, import_component_helpers.useCurrentColor)(styledContext === null || styledContext === void 0 ? void 0 : styledContext.color);
190
+ var _ref;
191
+ var finalSize = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : size) !== null && _ref !== void 0 ? _ref : styledContext === null || styledContext === void 0 ? void 0 : styledContext.size;
192
+ var iconSizeNumber = (typeof finalSize === "number" ? finalSize * 0.5 : (0, import_font_size.getFontSize)(finalSize)) * scaleIcon;
193
+ var [themedIcon, themedIconAfter] = [icon, iconAfter].map(function (icon2) {
194
+ if (!icon2) return null;
195
+ return (0, import_component_helpers.getIcon)(icon2, {
196
+ size: iconSizeNumber,
197
+ color: iconColor
198
+ });
199
+ });
200
+ var wrappedChildren = (0, import_text.wrapChildrenInText)(Text, {
201
+ children
202
+ }, {
203
+ unstyled: process.env.HANZOGUI_HEADLESS === "1",
204
+ size: finalSize !== null && finalSize !== void 0 ? finalSize : styledContext === null || styledContext === void 0 ? void 0 : styledContext.size
205
+ });
206
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
207
+ value: true,
208
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(Frame, {
209
+ ref,
210
+ ...props,
211
+ ...(isNested && {
212
+ render: "span"
213
+ }),
214
+ // Pass resolved size to circular variant when no explicit size provided
215
+ ...(props.circular && !propsIn.size && {
216
+ size
217
+ }),
218
+ tabIndex: 0,
219
+ children: [themedIcon, wrappedChildren, themedIconAfter]
220
+ })
221
+ });
222
+ });
223
+ var Button = (0, import_web.withStaticProperties)(ButtonComponent, {
224
+ Apply: context.Provider,
225
+ Frame,
226
+ Text,
227
+ Icon
228
+ });
229
+ //# 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_font_size","import_get_button_sized","import_component_helpers","import_stacks","import_text","import_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","HANZOGUI_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,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AAM,SAAAA,QAAA,GAAAlE,IAAA,cAAAkF,IAAA,cAAAA,IAAA,GAAAtB,aAAA,aAAAA,aAAA,uBAAAA,aAAA,CAAA5D,IAAA;EAAA,IACnBoF,cAAM,WAAAD,SAAA,gBAAAA,SAAA,aAAA5F,gBAAA,CAAA4E,WAAA,EAAAgB,SAAA,KAAAxB,SAAA;EAAA,IACN,CAAA0B,UAAO,EAAAC,eAAA,KAAAN,IAAA,EAETC,SAAC,CACF,CAAAM,GAAA,WAAAC,KAAA;IAED,IAAM,CAAAA,KAAA;IACJ,WAAA/F,wBAAA,CAAA2E,OAAA,EAAAoB,KAAA;MACExF,IAAA,EAAAoF,cAAS;MACXlF,KAAA,EAAA8D;IAAA,EACE;EAA4C;EACV,IACpCyB,eAAA,OAAA9F,WAAA,CAAA+F,kBAAA,EAAAxC,IAAA;IACFQ;EAEA;IAEK5C,QAAA,EAAAiB,OAAA,CAAAC,GAAA,CAAAC,iBAAA;IAAAjC,IAAA,EAAAmF,SAAA,aAAAA,SAAA,cAAAA,SAAA,GAAAvB,aAAA,aAAAA,aAAA,uBAAAA,aAAA,CAAA5D;EAAA;EACC,OACI,mBAAAX,kBAAA,CAAAqB,GAAA,EAAAhB,aAAA,CAAAiF,oBAAA,CAAAgB,QAAA;IAAA7G,KACC;IAA6B4E,QAE7B,iBAAmB,IAAArE,kBAAuB,CAAAuG,IAAA,EAAAxF,KAAA;MAC/CoE,GAAA;MAEC,GAAAf,KAAA;MAAA,IAAAgB,QAAA;QACAhE,MAAA;MAAA;MACA;MAAA,IAAAgD,KAAA,CAAAvB,QAAA,KAAAqC,OAAA,CAAAvE,IAAA;QAELA;MAEH;MAEYY,QAAA;MACX8C,QAAO,GACP2B,UAAA,EACAI,eAAA,EACAH,eAAA","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ var import_config_default = require("@hanzogui/config-default");
2
+ var import_core = require("@hanzogui/core");
3
+ var import_vitest = require("vitest");
4
+ var import_Button = require("./Button.cjs");
5
+ var import_jsx_runtime = require("react/jsx-runtime");
6
+ const conf = (0, import_core.createHanzogui)((0, import_config_default.getDefaultHanzoguiConfig)());
7
+ (0, import_vitest.describe)("Button", () => {
8
+ (0, import_vitest.test)(`123`, () => {
9
+ (0, import_vitest.expect)(true).toBeTruthy();
10
+ });
11
+ (0, import_vitest.test)("accepts native button html props", () => {
12
+ const _submitBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
13
+ type: "submit",
14
+ children: "Submit"
15
+ });
16
+ const _resetBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
17
+ type: "reset",
18
+ children: "Reset"
19
+ });
20
+ const _buttonBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
21
+ type: "button",
22
+ children: "Button"
23
+ });
24
+ const _formBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
25
+ type: "submit",
26
+ form: "myForm",
27
+ formAction: "/submit",
28
+ formMethod: "post",
29
+ formTarget: "_blank",
30
+ formNoValidate: true,
31
+ name: "submitBtn",
32
+ value: "submit",
33
+ children: "Submit"
34
+ });
35
+ (0, import_vitest.expect)(true).toBeTruthy();
36
+ });
37
+ });
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var import_jsx_runtime = require("react/jsx-runtime");
4
+ var import_config_default = require("@hanzogui/config-default");
5
+ var import_core = require("@hanzogui/core");
6
+ var import_vitest = require("vitest");
7
+ var import_Button = require("./Button.native.js");
8
+ var conf = (0, import_core.createHanzogui)((0, import_config_default.getDefaultHanzoguiConfig)());
9
+ (0, import_vitest.describe)("Button", function () {
10
+ (0, import_vitest.test)(`123`, function () {
11
+ (0, import_vitest.expect)(true).toBeTruthy();
12
+ });
13
+ (0, import_vitest.test)("accepts native button html props", function () {
14
+ var _submitBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
15
+ type: "submit",
16
+ children: "Submit"
17
+ });
18
+ var _resetBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
19
+ type: "reset",
20
+ children: "Reset"
21
+ });
22
+ var _buttonBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
23
+ type: "button",
24
+ children: "Button"
25
+ });
26
+ var _formBtn = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.Button, {
27
+ type: "submit",
28
+ form: "myForm",
29
+ formAction: "/submit",
30
+ formMethod: "post",
31
+ formTarget: "_blank",
32
+ formNoValidate: true,
33
+ name: "submitBtn",
34
+ value: "submit",
35
+ children: "Submit"
36
+ });
37
+ (0, import_vitest.expect)(true).toBeTruthy();
38
+ });
39
+ });
40
+ //# sourceMappingURL=Button.test.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["import_jsx_runtime","require","import_config_default","import_core","import_vitest","import_Button","conf","createHanzogui","getDefaultHanzoguiConfig","describe","test","expect","toBeTruthy","_submitBtn","jsx","Button","type","children","_resetBtn","_buttonBtn","_formBtn","form","formAction","formMethod","formTarget","formNoValidate"],"sources":["../../src/Button.test.tsx"],"sourcesContent":[null],"mappings":"AAAA;;AACA,IAAAA,kBAA+B,GAAAC,OAAA;AAC/B,IAAAC,qBAAuC,GAAAD,OAAA;AACvC,IAAAE,WAAA,GAAAF,OAAuB;AAYA,IAAAG,aAAA,GAAAH,OAAA;AAVvB,IAAAI,aAAa,GAAAJ,OAAA;AAAyC,IAEtDK,IAAA,OAAAH,WAAA,CAAAI,cAAmB,GAAM,GAAAL,qBAAA,CAAAM,wBAAA;AACvB,IAAAJ,aAAA,CAAAK,QAAK,UAAO,cAAM;EAChB,IAAAL,aAAA,CAAAM,IAAA,OAAO,cAAM;IACd,IAAAN,aAAA,CAAAO,MAAA,QAAAC,UAAA;EAGD;EAEE,IAAAR,aAAM,CAAAM,IAAa,kDAAC;IACpB,IAAAG,UAAM,kBAAY,IAAAb,kBAAA,CAAAc,GAAA,EAAAT,aAAC,CAAAU,MAAA;MACnBC,IAAM;MACNC,QAAM;IACJ,EAAC;IAAA,IAAAC,SAAA,sBAAAlB,kBAAA,CAAAc,GAAA,EAAAT,aAAA,CAAAU,MAAA;MAAAC,IACC,SAAK;MAAAC,QACA;IAAA;IACM,IACXE,UAAA,GAAW,mBAAAnB,kBAAA,CAAAc,GAAA,EAAAT,aAAA,CAAAU,MAAA;MAAAC,IACX,UAAW;MAAAC,QACX;IAAc;IACT,IACLG,QAAM,sBAAApB,kBAAA,CAAAc,GAAA,EAAAT,aAAA,CAAAU,MAAA;MAAAC,IACP;MAAAK,IAAA;MAEDC,UAAA;MAEFC,UAAA;MACDC,UAAA;MAWFC,cAAA","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
+ value: true
17
+ }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Button.cjs"), module.exports);
@@ -0,0 +1,23 @@
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") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
+ value: true
19
+ }), mod);
20
+ var index_exports = {};
21
+ module.exports = __toCommonJS(index_exports);
22
+ __reExport(index_exports, require("./Button.native.js"), module.exports);
23
+ //# 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":[]}