@hanzogui/button 8.3.0 → 8.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Button.js +238 -0
- package/dist/cjs/Button.js.map +1 -0
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/Button.js +235 -0
- package/dist/esm/Button.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +24 -24
- package/src/Button.test.tsx +1 -1
- package/src/index.ts +1 -1
- package/types/Button.d.ts +58 -57
- package/types/Button.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/dist/cjs/Button.cjs +0 -289
- package/dist/cjs/Button.native.js +0 -297
- package/dist/cjs/Button.native.js.map +0 -1
- package/dist/cjs/Button.test.cjs +0 -37
- package/dist/cjs/Button.test.native.js +0 -40
- package/dist/cjs/Button.test.native.js.map +0 -1
- package/dist/cjs/index.cjs +0 -20
- package/dist/cjs/index.native.js +0 -23
- package/dist/cjs/index.native.js.map +0 -1
- package/dist/esm/Button.mjs +0 -263
- package/dist/esm/Button.mjs.map +0 -1
- package/dist/esm/Button.native.js +0 -268
- package/dist/esm/Button.native.js.map +0 -1
- package/dist/esm/Button.test.mjs +0 -38
- package/dist/esm/Button.test.mjs.map +0 -1
- package/dist/esm/Button.test.native.js +0 -38
- package/dist/esm/Button.test.native.js.map +0 -1
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -2
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/Button.mjs +0 -263
- package/dist/jsx/Button.mjs.map +0 -1
- package/dist/jsx/Button.native.js +0 -297
- package/dist/jsx/Button.native.js.map +0 -1
- package/dist/jsx/Button.test.mjs +0 -38
- package/dist/jsx/Button.test.mjs.map +0 -1
- package/dist/jsx/Button.test.native.js +0 -40
- package/dist/jsx/Button.test.native.js.map +0 -1
- package/dist/jsx/index.js +0 -2
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs +0 -2
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/index.native.js +0 -23
- package/dist/jsx/index.native.js.map +0 -1
- package/types/Button.test.d.ts +0 -2
- package/types/Button.test.d.ts.map +0 -1
package/types/Button.d.ts
CHANGED
|
@@ -7,24 +7,29 @@ type ButtonContextStyles = TextContextStyles & {
|
|
|
7
7
|
variant?: ButtonVariant;
|
|
8
8
|
elevation?: SizeTokens | number;
|
|
9
9
|
};
|
|
10
|
+
declare const Icon: (props: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
scaleIcon?: number;
|
|
13
|
+
size?: SizeTokens;
|
|
14
|
+
}) => any;
|
|
10
15
|
export declare const ButtonContext: import("@hanzogui/web").StyledContext<{
|
|
11
16
|
size?: SizeTokens;
|
|
12
17
|
variant?: ButtonVariant;
|
|
13
|
-
color?: ButtonContextStyles[
|
|
18
|
+
color?: ButtonContextStyles['color'];
|
|
14
19
|
}>;
|
|
15
20
|
type IconProp = JSX.Element | FunctionComponent<{
|
|
16
21
|
color?: any;
|
|
17
22
|
size?: any;
|
|
18
23
|
}> | null;
|
|
19
24
|
declare const ButtonComponent: import("@hanzogui/web").GuiComponent<Omit<import("@hanzogui/web").GetFinalProps<import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
chromeless?: "all" | boolean | undefined;
|
|
26
|
+
circular?: boolean | undefined;
|
|
22
27
|
disabled?: boolean | undefined;
|
|
23
|
-
unstyled?: boolean | undefined;
|
|
24
28
|
elevation?: number | SizeTokens | undefined;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
size?: number | SizeTokens | undefined;
|
|
30
|
+
unstyled?: boolean | undefined;
|
|
31
|
+
variant?: "outlined" | undefined;
|
|
32
|
+
}>, "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "icon" | "iconAfter" | "iconSize" | "name" | "noTextWrap" | "scaleIcon" | "textProps" | "type" | "value" | keyof TextContextStyles> & TextContextStyles & {
|
|
28
33
|
textProps?: Partial<import("@hanzogui/text").SizableTextProps>;
|
|
29
34
|
noTextWrap?: boolean;
|
|
30
35
|
} & {
|
|
@@ -32,7 +37,7 @@ declare const ButtonComponent: import("@hanzogui/web").GuiComponent<Omit<import(
|
|
|
32
37
|
iconAfter?: IconProp;
|
|
33
38
|
scaleIcon?: number;
|
|
34
39
|
iconSize?: SizeTokens;
|
|
35
|
-
type?:
|
|
40
|
+
type?: 'submit' | 'reset' | 'button';
|
|
36
41
|
form?: string;
|
|
37
42
|
formAction?: string;
|
|
38
43
|
formEncType?: string;
|
|
@@ -49,7 +54,7 @@ declare const ButtonComponent: import("@hanzogui/web").GuiComponent<Omit<import(
|
|
|
49
54
|
iconAfter?: IconProp;
|
|
50
55
|
scaleIcon?: number;
|
|
51
56
|
iconSize?: SizeTokens;
|
|
52
|
-
type?:
|
|
57
|
+
type?: 'submit' | 'reset' | 'button';
|
|
53
58
|
form?: string;
|
|
54
59
|
formAction?: string;
|
|
55
60
|
formEncType?: string;
|
|
@@ -59,23 +64,23 @@ declare const ButtonComponent: import("@hanzogui/web").GuiComponent<Omit<import(
|
|
|
59
64
|
name?: string;
|
|
60
65
|
value?: string | readonly string[] | number;
|
|
61
66
|
}, import("@hanzogui/web").StackStyleBase, {
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
chromeless?: "all" | boolean | undefined;
|
|
68
|
+
circular?: boolean | undefined;
|
|
64
69
|
disabled?: boolean | undefined;
|
|
65
|
-
unstyled?: boolean | undefined;
|
|
66
70
|
elevation?: number | SizeTokens | undefined;
|
|
67
|
-
circular?: boolean | undefined;
|
|
68
|
-
chromeless?: boolean | "all" | undefined;
|
|
69
|
-
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
70
|
-
export declare const Button: import("react").ForwardRefExoticComponent<Omit<import("@hanzogui/web").GetFinalProps<import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
71
71
|
size?: number | SizeTokens | undefined;
|
|
72
|
+
unstyled?: boolean | undefined;
|
|
72
73
|
variant?: "outlined" | undefined;
|
|
74
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
75
|
+
export declare const Button: import("react").ForwardRefExoticComponent<Omit<import("@hanzogui/web").GetFinalProps<import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
76
|
+
chromeless?: "all" | boolean | undefined;
|
|
77
|
+
circular?: boolean | undefined;
|
|
73
78
|
disabled?: boolean | undefined;
|
|
74
|
-
unstyled?: boolean | undefined;
|
|
75
79
|
elevation?: number | SizeTokens | undefined;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
size?: number | SizeTokens | undefined;
|
|
81
|
+
unstyled?: boolean | undefined;
|
|
82
|
+
variant?: "outlined" | undefined;
|
|
83
|
+
}>, "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "icon" | "iconAfter" | "iconSize" | "name" | "noTextWrap" | "scaleIcon" | "textProps" | "type" | "value" | keyof TextContextStyles> & TextContextStyles & {
|
|
79
84
|
textProps?: Partial<import("@hanzogui/text").SizableTextProps>;
|
|
80
85
|
noTextWrap?: boolean;
|
|
81
86
|
} & {
|
|
@@ -83,7 +88,7 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
83
88
|
iconAfter?: IconProp;
|
|
84
89
|
scaleIcon?: number;
|
|
85
90
|
iconSize?: SizeTokens;
|
|
86
|
-
type?:
|
|
91
|
+
type?: 'submit' | 'reset' | 'button';
|
|
87
92
|
form?: string;
|
|
88
93
|
formAction?: string;
|
|
89
94
|
formEncType?: string;
|
|
@@ -93,14 +98,14 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
93
98
|
name?: string;
|
|
94
99
|
value?: string | readonly string[] | number;
|
|
95
100
|
} & import("react").RefAttributes<import("@hanzogui/web").GuiElement>> & import("@hanzogui/web").StaticComponentObject<Omit<import("@hanzogui/web").GetFinalProps<import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
chromeless?: "all" | boolean | undefined;
|
|
102
|
+
circular?: boolean | undefined;
|
|
98
103
|
disabled?: boolean | undefined;
|
|
99
|
-
unstyled?: boolean | undefined;
|
|
100
104
|
elevation?: number | SizeTokens | undefined;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
size?: number | SizeTokens | undefined;
|
|
106
|
+
unstyled?: boolean | undefined;
|
|
107
|
+
variant?: "outlined" | undefined;
|
|
108
|
+
}>, "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "icon" | "iconAfter" | "iconSize" | "name" | "noTextWrap" | "scaleIcon" | "textProps" | "type" | "value" | keyof TextContextStyles> & TextContextStyles & {
|
|
104
109
|
textProps?: Partial<import("@hanzogui/text").SizableTextProps>;
|
|
105
110
|
noTextWrap?: boolean;
|
|
106
111
|
} & {
|
|
@@ -108,7 +113,7 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
108
113
|
iconAfter?: IconProp;
|
|
109
114
|
scaleIcon?: number;
|
|
110
115
|
iconSize?: SizeTokens;
|
|
111
|
-
type?:
|
|
116
|
+
type?: 'submit' | 'reset' | 'button';
|
|
112
117
|
form?: string;
|
|
113
118
|
formAction?: string;
|
|
114
119
|
formEncType?: string;
|
|
@@ -125,7 +130,7 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
125
130
|
iconAfter?: IconProp;
|
|
126
131
|
scaleIcon?: number;
|
|
127
132
|
iconSize?: SizeTokens;
|
|
128
|
-
type?:
|
|
133
|
+
type?: 'submit' | 'reset' | 'button';
|
|
129
134
|
form?: string;
|
|
130
135
|
formAction?: string;
|
|
131
136
|
formEncType?: string;
|
|
@@ -135,23 +140,23 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
135
140
|
name?: string;
|
|
136
141
|
value?: string | readonly string[] | number;
|
|
137
142
|
}, import("@hanzogui/web").StackStyleBase, {
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
chromeless?: "all" | boolean | undefined;
|
|
144
|
+
circular?: boolean | undefined;
|
|
140
145
|
disabled?: boolean | undefined;
|
|
141
|
-
unstyled?: boolean | undefined;
|
|
142
146
|
elevation?: number | SizeTokens | undefined;
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
size?: number | SizeTokens | undefined;
|
|
148
|
+
unstyled?: boolean | undefined;
|
|
149
|
+
variant?: "outlined" | undefined;
|
|
145
150
|
}, import("@hanzogui/web").StaticConfigPublic> & Omit<import("@hanzogui/web").StaticConfigPublic, "staticConfig" | "styleable"> & {
|
|
146
151
|
__tama: [Omit<import("@hanzogui/web").GetFinalProps<import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
147
|
-
|
|
148
|
-
|
|
152
|
+
chromeless?: "all" | boolean | undefined;
|
|
153
|
+
circular?: boolean | undefined;
|
|
149
154
|
disabled?: boolean | undefined;
|
|
150
|
-
unstyled?: boolean | undefined;
|
|
151
155
|
elevation?: number | SizeTokens | undefined;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
size?: number | SizeTokens | undefined;
|
|
157
|
+
unstyled?: boolean | undefined;
|
|
158
|
+
variant?: "outlined" | undefined;
|
|
159
|
+
}>, "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "icon" | "iconAfter" | "iconSize" | "name" | "noTextWrap" | "scaleIcon" | "textProps" | "type" | "value" | keyof TextContextStyles> & TextContextStyles & {
|
|
155
160
|
textProps?: Partial<import("@hanzogui/text").SizableTextProps>;
|
|
156
161
|
noTextWrap?: boolean;
|
|
157
162
|
} & {
|
|
@@ -159,7 +164,7 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
159
164
|
iconAfter?: IconProp;
|
|
160
165
|
scaleIcon?: number;
|
|
161
166
|
iconSize?: SizeTokens;
|
|
162
|
-
type?:
|
|
167
|
+
type?: 'submit' | 'reset' | 'button';
|
|
163
168
|
form?: string;
|
|
164
169
|
formAction?: string;
|
|
165
170
|
formEncType?: string;
|
|
@@ -176,7 +181,7 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
176
181
|
iconAfter?: IconProp;
|
|
177
182
|
scaleIcon?: number;
|
|
178
183
|
iconSize?: SizeTokens;
|
|
179
|
-
type?:
|
|
184
|
+
type?: 'submit' | 'reset' | 'button';
|
|
180
185
|
form?: string;
|
|
181
186
|
formAction?: string;
|
|
182
187
|
formEncType?: string;
|
|
@@ -186,13 +191,13 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
186
191
|
name?: string;
|
|
187
192
|
value?: string | readonly string[] | number;
|
|
188
193
|
}, import("@hanzogui/web").StackStyleBase, {
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
chromeless?: "all" | boolean | undefined;
|
|
195
|
+
circular?: boolean | undefined;
|
|
191
196
|
disabled?: boolean | undefined;
|
|
192
|
-
unstyled?: boolean | undefined;
|
|
193
197
|
elevation?: number | SizeTokens | undefined;
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
size?: number | SizeTokens | undefined;
|
|
199
|
+
unstyled?: boolean | undefined;
|
|
200
|
+
variant?: "outlined" | undefined;
|
|
196
201
|
}, import("@hanzogui/web").StaticConfigPublic];
|
|
197
202
|
} & {
|
|
198
203
|
Apply: import("react").Provider<ButtonContextStyles> & import("react").ProviderExoticComponent<Partial<ButtonContextStyles> & {
|
|
@@ -200,23 +205,19 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<impo
|
|
|
200
205
|
scope?: string;
|
|
201
206
|
}>;
|
|
202
207
|
Frame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
chromeless?: "all" | boolean | undefined;
|
|
209
|
+
circular?: boolean | undefined;
|
|
205
210
|
disabled?: boolean | undefined;
|
|
206
|
-
unstyled?: boolean | undefined;
|
|
207
211
|
elevation?: number | SizeTokens | undefined;
|
|
208
|
-
|
|
209
|
-
|
|
212
|
+
size?: number | SizeTokens | undefined;
|
|
213
|
+
unstyled?: boolean | undefined;
|
|
214
|
+
variant?: "outlined" | undefined;
|
|
210
215
|
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
211
216
|
Text: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
|
|
212
217
|
size?: import("@hanzogui/web").FontSizeTokens | undefined;
|
|
213
218
|
unstyled?: boolean | undefined;
|
|
214
219
|
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
215
|
-
Icon:
|
|
216
|
-
children: React.ReactNode;
|
|
217
|
-
scaleIcon?: number;
|
|
218
|
-
size?: SizeTokens;
|
|
219
|
-
}) => any;
|
|
220
|
+
Icon: typeof Icon;
|
|
220
221
|
};
|
|
221
222
|
export type ButtonProps = GetProps<typeof ButtonComponent>;
|
|
222
223
|
export {};
|
package/types/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAA;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAS,MAAM,eAAe,CAAA;AAShE,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGnD,KAAK,aAAa,GAAG,UAAU,CAAA;AAE/B,KAAK,mBAAmB,GAAG,iBAAiB,GAAG;IAC7C,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CAChC,CAAA;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAA;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAS,MAAM,eAAe,CAAA;AAShE,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGnD,KAAK,aAAa,GAAG,UAAU,CAAA;AAE/B,KAAK,mBAAmB,GAAG,iBAAiB,GAAG;IAC7C,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CAChC,CAAA;AAwJD,QAAA,MAAM,IAAI,UAAW;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,QAsBA,CAAA;AAED,eAAO,MAAM,aAAa;WACjB,UAAU;cACP,aAAa;YACf,mBAAmB,CAAC,OAAO,CAAC;EAKpC,CAAA;AAEF,KAAK,QAAQ,GAAG,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC;IAAE,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,GAAG,IAAI,CAAA;AAoBnF,QAAA,MAAM,eAAe;;;;;;;;;;;;WAjBZ,QAAQ;gBACH,QAAQ;gBACR,MAAM;eACP,UAAU;WAGd,QAAQ,GAAG,OAAO,GAAG,QAAQ;WAC7B,MAAM;iBACA,MAAM;kBACL,MAAM;iBACP,MAAM;qBACF,OAAO;iBACX,MAAM;WACZ,MAAM;YACL,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;8CA0H3C,CAAA;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;WA1IV,QAAQ;gBACH,QAAQ;gBACR,MAAM;eACP,UAAU;WAGd,QAAQ,GAAG,OAAO,GAAG,QAAQ;WAC7B,MAAM;iBACA,MAAM;kBACL,MAAM;iBACP,MAAM;qBACF,OAAO;iBACX,MAAM;WACZ,MAAM;YACL,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAdpC,QAAQ;oBACH,QAAQ;oBACR,MAAM;mBACP,UAAU;eAGd,QAAQ,GAAG,OAAO,GAAG,QAAQ;eAC7B,MAAM;qBACA,MAAM;sBACL,MAAM;qBACP,MAAM;yBACF,OAAO;qBACX,MAAM;eACZ,MAAM;gBACL,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiI3C,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,eAAe,CAAC,CAAA"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Button';
|
|
1
|
+
export * from './Button.tsx';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
package/dist/cjs/Button.cjs
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
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
|
-
ellipsis: void 0,
|
|
43
|
-
fontFamily: void 0,
|
|
44
|
-
fontSize: void 0,
|
|
45
|
-
fontStyle: void 0,
|
|
46
|
-
fontWeight: void 0,
|
|
47
|
-
letterSpacing: void 0,
|
|
48
|
-
maxFontSizeMultiplier: void 0,
|
|
49
|
-
textAlign: void 0
|
|
50
|
-
});
|
|
51
|
-
const Frame = (0, import_web.styled)(import_web.View, {
|
|
52
|
-
context,
|
|
53
|
-
name: "Button",
|
|
54
|
-
role: "button",
|
|
55
|
-
render: /* @__PURE__ */(0, import_jsx_runtime.jsx)("button", {
|
|
56
|
-
type: "button"
|
|
57
|
-
}),
|
|
58
|
-
tabIndex: 0,
|
|
59
|
-
variants: {
|
|
60
|
-
unstyled: {
|
|
61
|
-
true: {
|
|
62
|
-
// reset browser <button> defaults
|
|
63
|
-
outlineWidth: 0,
|
|
64
|
-
borderWidth: 0,
|
|
65
|
-
backgroundColor: "transparent"
|
|
66
|
-
},
|
|
67
|
-
false: {
|
|
68
|
-
size: "$true",
|
|
69
|
-
justifyContent: "center",
|
|
70
|
-
alignItems: "center",
|
|
71
|
-
flexWrap: "nowrap",
|
|
72
|
-
flexDirection: "row",
|
|
73
|
-
backgroundColor: "$background",
|
|
74
|
-
borderWidth: 1,
|
|
75
|
-
borderColor: "transparent",
|
|
76
|
-
"$platform-web": {
|
|
77
|
-
cursor: "pointer"
|
|
78
|
-
},
|
|
79
|
-
hoverStyle: {
|
|
80
|
-
backgroundColor: "$backgroundHover",
|
|
81
|
-
borderColor: "$borderColorHover"
|
|
82
|
-
},
|
|
83
|
-
pressStyle: {
|
|
84
|
-
backgroundColor: "$backgroundPress",
|
|
85
|
-
borderColor: "$borderColorHover"
|
|
86
|
-
},
|
|
87
|
-
focusVisibleStyle: {
|
|
88
|
-
outlineColor: "$outlineColor",
|
|
89
|
-
outlineStyle: "solid",
|
|
90
|
-
outlineWidth: 2
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
variant: {
|
|
95
|
-
outlined: process.env.GUI_HEADLESS === "1" ? {} : {
|
|
96
|
-
backgroundColor: "transparent",
|
|
97
|
-
borderWidth: 1,
|
|
98
|
-
borderColor: "$borderColor",
|
|
99
|
-
hoverStyle: {
|
|
100
|
-
backgroundColor: "transparent",
|
|
101
|
-
borderColor: "$borderColorHover"
|
|
102
|
-
},
|
|
103
|
-
pressStyle: {
|
|
104
|
-
backgroundColor: "transparent",
|
|
105
|
-
borderColor: "$borderColorPress"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
circular: import_stacks.themeableVariants.circular,
|
|
110
|
-
chromeless: import_stacks.themeableVariants.chromeless,
|
|
111
|
-
size: {
|
|
112
|
-
"...size": (val, extras) => {
|
|
113
|
-
const buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras);
|
|
114
|
-
const gap = (0, import_web.getTokenValue)(val);
|
|
115
|
-
return {
|
|
116
|
-
...buttonStyle,
|
|
117
|
-
gap
|
|
118
|
-
};
|
|
119
|
-
},
|
|
120
|
-
":number": (val, extras) => {
|
|
121
|
-
const buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras);
|
|
122
|
-
const gap = val * 0.4;
|
|
123
|
-
return {
|
|
124
|
-
...buttonStyle,
|
|
125
|
-
gap
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
elevation: {
|
|
130
|
-
"...size": import_stacks.getElevation,
|
|
131
|
-
":number": import_stacks.getElevation
|
|
132
|
-
},
|
|
133
|
-
disabled: {
|
|
134
|
-
true: {
|
|
135
|
-
pointerEvents: "none",
|
|
136
|
-
// @ts-ignore
|
|
137
|
-
"aria-disabled": true
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
defaultVariants: {
|
|
142
|
-
unstyled: process.env.GUI_HEADLESS === "1"
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
const Text = (0, import_web.styled)(import_text.SizableText, {
|
|
146
|
-
context,
|
|
147
|
-
variants: {
|
|
148
|
-
unstyled: {
|
|
149
|
-
false: {
|
|
150
|
-
userSelect: "none",
|
|
151
|
-
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
152
|
-
flexGrow: 0,
|
|
153
|
-
flexShrink: 1,
|
|
154
|
-
ellipsis: true,
|
|
155
|
-
color: "$color",
|
|
156
|
-
"$platform-web": {
|
|
157
|
-
cursor: "pointer"
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
defaultVariants: {
|
|
163
|
-
unstyled: process.env.GUI_HEADLESS === "1"
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
const Icon = props => {
|
|
167
|
-
const {
|
|
168
|
-
children,
|
|
169
|
-
scaleIcon = 1,
|
|
170
|
-
size
|
|
171
|
-
} = props;
|
|
172
|
-
const styledContext = context.useStyledContext();
|
|
173
|
-
if (!styledContext) {
|
|
174
|
-
throw new Error("Button.Icon must be used within a Button");
|
|
175
|
-
}
|
|
176
|
-
const sizeToken = size ?? styledContext.size;
|
|
177
|
-
const iconColorProp = styledContext.color === "unset" || typeof styledContext.color === "number" ? void 0 : styledContext.color;
|
|
178
|
-
const iconColor = (0, import_component_helpers.useCurrentColor)(iconColorProp);
|
|
179
|
-
const iconSize = (typeof sizeToken === "number" ? sizeToken * 0.5 : (0, import_font_size.getFontSize)(sizeToken)) * scaleIcon;
|
|
180
|
-
return (0, import_component_helpers.getIcon)(children, {
|
|
181
|
-
size: iconSize,
|
|
182
|
-
color: iconColor
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
const ButtonContext = (0, import_web.createStyledContext)({
|
|
186
|
-
size: void 0,
|
|
187
|
-
variant: void 0,
|
|
188
|
-
color: void 0
|
|
189
|
-
});
|
|
190
|
-
const ButtonComponent = Frame.styleable((propsIn, ref) => {
|
|
191
|
-
const isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext);
|
|
192
|
-
const processedProps = (0, import_web.useProps)(propsIn, {
|
|
193
|
-
noNormalize: true,
|
|
194
|
-
noExpand: true
|
|
195
|
-
});
|
|
196
|
-
const {
|
|
197
|
-
children,
|
|
198
|
-
iconSize,
|
|
199
|
-
icon,
|
|
200
|
-
iconAfter,
|
|
201
|
-
scaleIcon = 1,
|
|
202
|
-
noTextWrap,
|
|
203
|
-
textProps,
|
|
204
|
-
color,
|
|
205
|
-
ellipsis,
|
|
206
|
-
fontFamily,
|
|
207
|
-
fontSize,
|
|
208
|
-
fontStyle,
|
|
209
|
-
fontWeight,
|
|
210
|
-
letterSpacing,
|
|
211
|
-
maxFontSizeMultiplier,
|
|
212
|
-
textAlign,
|
|
213
|
-
...props
|
|
214
|
-
} = processedProps;
|
|
215
|
-
const size = propsIn.size || (propsIn.unstyled ? void 0 : "$true");
|
|
216
|
-
const styledContext = context.useStyledContext();
|
|
217
|
-
const contextColor = color ?? propsIn.color ?? styledContext?.color;
|
|
218
|
-
const iconColorProp = contextColor === "unset" || typeof contextColor === "number" ? void 0 : contextColor;
|
|
219
|
-
const iconColor = (0, import_component_helpers.useCurrentColor)(iconColorProp);
|
|
220
|
-
const finalSize = iconSize ?? size ?? styledContext?.size;
|
|
221
|
-
const iconSizeNumber = (typeof finalSize === "number" ? finalSize * 0.5 : (0, import_font_size.getFontSize)(finalSize)) * scaleIcon;
|
|
222
|
-
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(icon2 => {
|
|
223
|
-
if (!icon2) return null;
|
|
224
|
-
return (0, import_component_helpers.getIcon)(icon2, {
|
|
225
|
-
size: iconSizeNumber,
|
|
226
|
-
color: iconColor
|
|
227
|
-
// No marginLeft or marginRight needed - spacing is handled by the gap property in Frame's size variants
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
const wrappedChildren = (0, import_text.wrapChildrenInText)(Text, {
|
|
231
|
-
children,
|
|
232
|
-
color: contextColor,
|
|
233
|
-
ellipsis: ellipsis ?? propsIn.ellipsis ?? styledContext?.ellipsis,
|
|
234
|
-
fontFamily: fontFamily ?? propsIn.fontFamily ?? styledContext?.fontFamily,
|
|
235
|
-
fontSize: fontSize ?? propsIn.fontSize ?? styledContext?.fontSize,
|
|
236
|
-
fontStyle: fontStyle ?? propsIn.fontStyle ?? styledContext?.fontStyle,
|
|
237
|
-
fontWeight: fontWeight ?? propsIn.fontWeight ?? styledContext?.fontWeight,
|
|
238
|
-
letterSpacing: letterSpacing ?? propsIn.letterSpacing ?? styledContext?.letterSpacing,
|
|
239
|
-
maxFontSizeMultiplier: maxFontSizeMultiplier ?? propsIn.maxFontSizeMultiplier ?? styledContext?.maxFontSizeMultiplier,
|
|
240
|
-
noTextWrap: noTextWrap ?? propsIn.noTextWrap,
|
|
241
|
-
textAlign: textAlign ?? propsIn.textAlign ?? styledContext?.textAlign,
|
|
242
|
-
textProps: textProps ?? propsIn.textProps
|
|
243
|
-
}, {
|
|
244
|
-
unstyled: process.env.GUI_HEADLESS === "1",
|
|
245
|
-
size: finalSize ?? styledContext?.size
|
|
246
|
-
});
|
|
247
|
-
const textContext = {
|
|
248
|
-
color: contextColor,
|
|
249
|
-
ellipsis: ellipsis ?? propsIn.ellipsis ?? styledContext?.ellipsis,
|
|
250
|
-
fontFamily: fontFamily ?? propsIn.fontFamily ?? styledContext?.fontFamily,
|
|
251
|
-
fontSize: fontSize ?? propsIn.fontSize ?? styledContext?.fontSize,
|
|
252
|
-
fontStyle: fontStyle ?? propsIn.fontStyle ?? styledContext?.fontStyle,
|
|
253
|
-
fontWeight: fontWeight ?? propsIn.fontWeight ?? styledContext?.fontWeight,
|
|
254
|
-
letterSpacing: letterSpacing ?? propsIn.letterSpacing ?? styledContext?.letterSpacing,
|
|
255
|
-
maxFontSizeMultiplier: maxFontSizeMultiplier ?? propsIn.maxFontSizeMultiplier ?? styledContext?.maxFontSizeMultiplier,
|
|
256
|
-
textAlign: textAlign ?? propsIn.textAlign ?? styledContext?.textAlign
|
|
257
|
-
};
|
|
258
|
-
const buttonContext = {
|
|
259
|
-
...styledContext,
|
|
260
|
-
...textContext,
|
|
261
|
-
size: props.size ?? propsIn.size ?? styledContext?.size,
|
|
262
|
-
variant: props.variant ?? propsIn.variant ?? styledContext?.variant,
|
|
263
|
-
elevation: props.elevation ?? propsIn.elevation ?? styledContext?.elevation
|
|
264
|
-
};
|
|
265
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
|
|
266
|
-
value: true,
|
|
267
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(context.Provider, {
|
|
268
|
-
...buttonContext,
|
|
269
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(Frame, {
|
|
270
|
-
ref,
|
|
271
|
-
...props,
|
|
272
|
-
...(isNested && {
|
|
273
|
-
render: "span"
|
|
274
|
-
}),
|
|
275
|
-
...(props.circular && !propsIn.size && {
|
|
276
|
-
size
|
|
277
|
-
}),
|
|
278
|
-
tabIndex: 0,
|
|
279
|
-
children: [themedIcon, wrappedChildren, themedIconAfter]
|
|
280
|
-
})
|
|
281
|
-
})
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
const Button = (0, import_web.withStaticProperties)(ButtonComponent, {
|
|
285
|
-
Apply: context.Provider,
|
|
286
|
-
Frame,
|
|
287
|
-
Text,
|
|
288
|
-
Icon
|
|
289
|
-
});
|