@rescui/button 0.2.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/button.d.ts +2 -330
- package/lib/button.js +37 -9
- package/lib/button.module.pcss.js +30 -27
- package/lib/index.css +335 -218
- package/package.json +7 -7
package/lib/button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Theme } from '@rescui/ui-contexts';
|
|
3
3
|
export declare type ButtonShiftedSide = 'right' | 'left' | 'top' | 'bottom';
|
|
4
|
-
export declare type ButtonSize = 'l' | 'm' | 's';
|
|
4
|
+
export declare type ButtonSize = 'l' | 'm' | 's' | 'xs';
|
|
5
5
|
export declare type ButtonModeGeneric = 'classic' | 'rock' | 'transparent' | 'outline';
|
|
6
6
|
export declare type ButtonModeClear = 'clear';
|
|
7
7
|
export declare type ButtonType = 'button' | 'submit' | 'reset';
|
|
@@ -69,333 +69,5 @@ export declare type ButtonProps = {
|
|
|
69
69
|
iconPosition?: never;
|
|
70
70
|
});
|
|
71
71
|
export declare type ButtonRef = HTMLDivElement & HTMLAnchorElement & HTMLButtonElement;
|
|
72
|
-
export declare const Button: React.ForwardRefExoticComponent<
|
|
73
|
-
/** Additional class-name */
|
|
74
|
-
className?: string;
|
|
75
|
-
/** Child element */
|
|
76
|
-
children?: React.ReactNode;
|
|
77
|
-
/** Disabled */
|
|
78
|
-
disabled?: boolean;
|
|
79
|
-
/** button size */
|
|
80
|
-
size?: ButtonSize;
|
|
81
|
-
/** Appearance theme */
|
|
82
|
-
theme?: Theme;
|
|
83
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
84
|
-
type?: ButtonType;
|
|
85
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
86
|
-
narrow?: boolean;
|
|
87
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
88
|
-
busy?: boolean;
|
|
89
|
-
/** @ignore */
|
|
90
|
-
highlighted?: boolean;
|
|
91
|
-
/** @ignore */
|
|
92
|
-
flat?: ButtonFlat;
|
|
93
|
-
tabIndex?: number;
|
|
94
|
-
title?: string;
|
|
95
|
-
} & {
|
|
96
|
-
/** button appearance */
|
|
97
|
-
mode?: ButtonModeGeneric;
|
|
98
|
-
shifted?: never;
|
|
99
|
-
} & {
|
|
100
|
-
/** Url path for using component as a link */
|
|
101
|
-
href?: string;
|
|
102
|
-
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
103
|
-
onClick?: never;
|
|
104
|
-
notFocusable?: never;
|
|
105
|
-
} & {
|
|
106
|
-
/** Additional icon */
|
|
107
|
-
icon: React.ReactNode;
|
|
108
|
-
/** Additional icon position */
|
|
109
|
-
iconPosition?: ButtonIconPosition;
|
|
110
|
-
} & React.RefAttributes<ButtonRef>) | ({
|
|
111
|
-
/** Additional class-name */
|
|
112
|
-
className?: string;
|
|
113
|
-
/** Child element */
|
|
114
|
-
children?: React.ReactNode;
|
|
115
|
-
/** Disabled */
|
|
116
|
-
disabled?: boolean;
|
|
117
|
-
/** button size */
|
|
118
|
-
size?: ButtonSize;
|
|
119
|
-
/** Appearance theme */
|
|
120
|
-
theme?: Theme;
|
|
121
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
122
|
-
type?: ButtonType;
|
|
123
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
124
|
-
narrow?: boolean;
|
|
125
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
126
|
-
busy?: boolean;
|
|
127
|
-
/** @ignore */
|
|
128
|
-
highlighted?: boolean;
|
|
129
|
-
/** @ignore */
|
|
130
|
-
flat?: ButtonFlat;
|
|
131
|
-
tabIndex?: number;
|
|
132
|
-
title?: string;
|
|
133
|
-
} & {
|
|
134
|
-
/** button appearance */
|
|
135
|
-
mode?: ButtonModeGeneric;
|
|
136
|
-
shifted?: never;
|
|
137
|
-
} & {
|
|
138
|
-
/** Url path for using component as a link */
|
|
139
|
-
href?: string;
|
|
140
|
-
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
141
|
-
onClick?: never;
|
|
142
|
-
notFocusable?: never;
|
|
143
|
-
} & {
|
|
144
|
-
icon?: never;
|
|
145
|
-
iconPosition?: never;
|
|
146
|
-
} & React.RefAttributes<ButtonRef>) | ({
|
|
147
|
-
/** Additional class-name */
|
|
148
|
-
className?: string;
|
|
149
|
-
/** Child element */
|
|
150
|
-
children?: React.ReactNode;
|
|
151
|
-
/** Disabled */
|
|
152
|
-
disabled?: boolean;
|
|
153
|
-
/** button size */
|
|
154
|
-
size?: ButtonSize;
|
|
155
|
-
/** Appearance theme */
|
|
156
|
-
theme?: Theme;
|
|
157
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
158
|
-
type?: ButtonType;
|
|
159
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
160
|
-
narrow?: boolean;
|
|
161
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
162
|
-
busy?: boolean;
|
|
163
|
-
/** @ignore */
|
|
164
|
-
highlighted?: boolean;
|
|
165
|
-
/** @ignore */
|
|
166
|
-
flat?: ButtonFlat;
|
|
167
|
-
tabIndex?: number;
|
|
168
|
-
title?: string;
|
|
169
|
-
} & {
|
|
170
|
-
/** button appearance */
|
|
171
|
-
mode?: ButtonModeGeneric;
|
|
172
|
-
shifted?: never;
|
|
173
|
-
} & {
|
|
174
|
-
href?: never;
|
|
175
|
-
target?: never;
|
|
176
|
-
/** Click event handler */
|
|
177
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
178
|
-
/**
|
|
179
|
-
* Remove focus ability completely.
|
|
180
|
-
* We use separate property instead of tabIndex
|
|
181
|
-
* because tabIndex doesn't remove some controls behavior
|
|
182
|
-
* for example 'space' button press support.
|
|
183
|
-
* So with special property we can do it.
|
|
184
|
-
* @ignore
|
|
185
|
-
* */
|
|
186
|
-
notFocusable?: boolean;
|
|
187
|
-
} & {
|
|
188
|
-
/** Additional icon */
|
|
189
|
-
icon: React.ReactNode;
|
|
190
|
-
/** Additional icon position */
|
|
191
|
-
iconPosition?: ButtonIconPosition;
|
|
192
|
-
} & React.RefAttributes<ButtonRef>) | ({
|
|
193
|
-
/** Additional class-name */
|
|
194
|
-
className?: string;
|
|
195
|
-
/** Child element */
|
|
196
|
-
children?: React.ReactNode;
|
|
197
|
-
/** Disabled */
|
|
198
|
-
disabled?: boolean;
|
|
199
|
-
/** button size */
|
|
200
|
-
size?: ButtonSize;
|
|
201
|
-
/** Appearance theme */
|
|
202
|
-
theme?: Theme;
|
|
203
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
204
|
-
type?: ButtonType;
|
|
205
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
206
|
-
narrow?: boolean;
|
|
207
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
208
|
-
busy?: boolean;
|
|
209
|
-
/** @ignore */
|
|
210
|
-
highlighted?: boolean;
|
|
211
|
-
/** @ignore */
|
|
212
|
-
flat?: ButtonFlat;
|
|
213
|
-
tabIndex?: number;
|
|
214
|
-
title?: string;
|
|
215
|
-
} & {
|
|
216
|
-
/** button appearance */
|
|
217
|
-
mode?: ButtonModeGeneric;
|
|
218
|
-
shifted?: never;
|
|
219
|
-
} & {
|
|
220
|
-
href?: never;
|
|
221
|
-
target?: never;
|
|
222
|
-
/** Click event handler */
|
|
223
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
224
|
-
/**
|
|
225
|
-
* Remove focus ability completely.
|
|
226
|
-
* We use separate property instead of tabIndex
|
|
227
|
-
* because tabIndex doesn't remove some controls behavior
|
|
228
|
-
* for example 'space' button press support.
|
|
229
|
-
* So with special property we can do it.
|
|
230
|
-
* @ignore
|
|
231
|
-
* */
|
|
232
|
-
notFocusable?: boolean;
|
|
233
|
-
} & {
|
|
234
|
-
icon?: never;
|
|
235
|
-
iconPosition?: never;
|
|
236
|
-
} & React.RefAttributes<ButtonRef>) | ({
|
|
237
|
-
/** Additional class-name */
|
|
238
|
-
className?: string;
|
|
239
|
-
/** Child element */
|
|
240
|
-
children?: React.ReactNode;
|
|
241
|
-
/** Disabled */
|
|
242
|
-
disabled?: boolean;
|
|
243
|
-
/** button size */
|
|
244
|
-
size?: ButtonSize;
|
|
245
|
-
/** Appearance theme */
|
|
246
|
-
theme?: Theme;
|
|
247
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
248
|
-
type?: ButtonType;
|
|
249
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
250
|
-
narrow?: boolean;
|
|
251
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
252
|
-
busy?: boolean;
|
|
253
|
-
/** @ignore */
|
|
254
|
-
highlighted?: boolean;
|
|
255
|
-
/** @ignore */
|
|
256
|
-
flat?: ButtonFlat;
|
|
257
|
-
tabIndex?: number;
|
|
258
|
-
title?: string;
|
|
259
|
-
} & {
|
|
260
|
-
mode?: ButtonModeClear;
|
|
261
|
-
/** Offset a clear button to one or more sides before the text so that the button's background extends beyond its container. */
|
|
262
|
-
shifted?: ButtonShifted;
|
|
263
|
-
} & {
|
|
264
|
-
/** Url path for using component as a link */
|
|
265
|
-
href?: string;
|
|
266
|
-
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
267
|
-
onClick?: never;
|
|
268
|
-
notFocusable?: never;
|
|
269
|
-
} & {
|
|
270
|
-
/** Additional icon */
|
|
271
|
-
icon: React.ReactNode;
|
|
272
|
-
/** Additional icon position */
|
|
273
|
-
iconPosition?: ButtonIconPosition;
|
|
274
|
-
} & React.RefAttributes<ButtonRef>) | ({
|
|
275
|
-
/** Additional class-name */
|
|
276
|
-
className?: string;
|
|
277
|
-
/** Child element */
|
|
278
|
-
children?: React.ReactNode;
|
|
279
|
-
/** Disabled */
|
|
280
|
-
disabled?: boolean;
|
|
281
|
-
/** button size */
|
|
282
|
-
size?: ButtonSize;
|
|
283
|
-
/** Appearance theme */
|
|
284
|
-
theme?: Theme;
|
|
285
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
286
|
-
type?: ButtonType;
|
|
287
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
288
|
-
narrow?: boolean;
|
|
289
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
290
|
-
busy?: boolean;
|
|
291
|
-
/** @ignore */
|
|
292
|
-
highlighted?: boolean;
|
|
293
|
-
/** @ignore */
|
|
294
|
-
flat?: ButtonFlat;
|
|
295
|
-
tabIndex?: number;
|
|
296
|
-
title?: string;
|
|
297
|
-
} & {
|
|
298
|
-
mode?: ButtonModeClear;
|
|
299
|
-
/** Offset a clear button to one or more sides before the text so that the button's background extends beyond its container. */
|
|
300
|
-
shifted?: ButtonShifted;
|
|
301
|
-
} & {
|
|
302
|
-
/** Url path for using component as a link */
|
|
303
|
-
href?: string;
|
|
304
|
-
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
305
|
-
onClick?: never;
|
|
306
|
-
notFocusable?: never;
|
|
307
|
-
} & {
|
|
308
|
-
icon?: never;
|
|
309
|
-
iconPosition?: never;
|
|
310
|
-
} & React.RefAttributes<ButtonRef>) | ({
|
|
311
|
-
/** Additional class-name */
|
|
312
|
-
className?: string;
|
|
313
|
-
/** Child element */
|
|
314
|
-
children?: React.ReactNode;
|
|
315
|
-
/** Disabled */
|
|
316
|
-
disabled?: boolean;
|
|
317
|
-
/** button size */
|
|
318
|
-
size?: ButtonSize;
|
|
319
|
-
/** Appearance theme */
|
|
320
|
-
theme?: Theme;
|
|
321
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
322
|
-
type?: ButtonType;
|
|
323
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
324
|
-
narrow?: boolean;
|
|
325
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
326
|
-
busy?: boolean;
|
|
327
|
-
/** @ignore */
|
|
328
|
-
highlighted?: boolean;
|
|
329
|
-
/** @ignore */
|
|
330
|
-
flat?: ButtonFlat;
|
|
331
|
-
tabIndex?: number;
|
|
332
|
-
title?: string;
|
|
333
|
-
} & {
|
|
334
|
-
mode?: ButtonModeClear;
|
|
335
|
-
/** Offset a clear button to one or more sides before the text so that the button's background extends beyond its container. */
|
|
336
|
-
shifted?: ButtonShifted;
|
|
337
|
-
} & {
|
|
338
|
-
href?: never;
|
|
339
|
-
target?: never;
|
|
340
|
-
/** Click event handler */
|
|
341
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
342
|
-
/**
|
|
343
|
-
* Remove focus ability completely.
|
|
344
|
-
* We use separate property instead of tabIndex
|
|
345
|
-
* because tabIndex doesn't remove some controls behavior
|
|
346
|
-
* for example 'space' button press support.
|
|
347
|
-
* So with special property we can do it.
|
|
348
|
-
* @ignore
|
|
349
|
-
* */
|
|
350
|
-
notFocusable?: boolean;
|
|
351
|
-
} & {
|
|
352
|
-
/** Additional icon */
|
|
353
|
-
icon: React.ReactNode;
|
|
354
|
-
/** Additional icon position */
|
|
355
|
-
iconPosition?: ButtonIconPosition;
|
|
356
|
-
} & React.RefAttributes<ButtonRef>) | ({
|
|
357
|
-
/** Additional class-name */
|
|
358
|
-
className?: string;
|
|
359
|
-
/** Child element */
|
|
360
|
-
children?: React.ReactNode;
|
|
361
|
-
/** Disabled */
|
|
362
|
-
disabled?: boolean;
|
|
363
|
-
/** button size */
|
|
364
|
-
size?: ButtonSize;
|
|
365
|
-
/** Appearance theme */
|
|
366
|
-
theme?: Theme;
|
|
367
|
-
/** [More about button types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) */
|
|
368
|
-
type?: ButtonType;
|
|
369
|
-
/** Reduce horizontal padding. __Use only when providing external width (using className, flexbox, style={{width: 200px}}, etc.)__ */
|
|
370
|
-
narrow?: boolean;
|
|
371
|
-
/** Shows loading icon, use when some action related to button is in progress */
|
|
372
|
-
busy?: boolean;
|
|
373
|
-
/** @ignore */
|
|
374
|
-
highlighted?: boolean;
|
|
375
|
-
/** @ignore */
|
|
376
|
-
flat?: ButtonFlat;
|
|
377
|
-
tabIndex?: number;
|
|
378
|
-
title?: string;
|
|
379
|
-
} & {
|
|
380
|
-
mode?: ButtonModeClear;
|
|
381
|
-
/** Offset a clear button to one or more sides before the text so that the button's background extends beyond its container. */
|
|
382
|
-
shifted?: ButtonShifted;
|
|
383
|
-
} & {
|
|
384
|
-
href?: never;
|
|
385
|
-
target?: never;
|
|
386
|
-
/** Click event handler */
|
|
387
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
388
|
-
/**
|
|
389
|
-
* Remove focus ability completely.
|
|
390
|
-
* We use separate property instead of tabIndex
|
|
391
|
-
* because tabIndex doesn't remove some controls behavior
|
|
392
|
-
* for example 'space' button press support.
|
|
393
|
-
* So with special property we can do it.
|
|
394
|
-
* @ignore
|
|
395
|
-
* */
|
|
396
|
-
notFocusable?: boolean;
|
|
397
|
-
} & {
|
|
398
|
-
icon?: never;
|
|
399
|
-
iconPosition?: never;
|
|
400
|
-
} & React.RefAttributes<ButtonRef>)>;
|
|
72
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<ButtonRef>>;
|
|
401
73
|
export default Button;
|
package/lib/button.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
1
2
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["className", "children", "href", "type", "disabled", "size", "theme", "icon", "iconPosition", "narrow", "busy", "flat", "notFocusable", "highlighted", "shifted", "mode"];
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
+
|
|
4
10
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
5
11
|
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
|
|
6
|
-
import _Object$
|
|
12
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
13
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
14
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
15
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
16
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
17
|
import React, { cloneElement } from 'react';
|
|
8
18
|
import cn from 'classnames';
|
|
9
19
|
import PropTypes from 'prop-types';
|
|
@@ -23,6 +33,7 @@ var MODE_STYLES = {
|
|
|
23
33
|
clear: styles.modeClear
|
|
24
34
|
};
|
|
25
35
|
var SIZE_STYLES = {
|
|
36
|
+
xs: styles.sizeXs,
|
|
26
37
|
s: styles.sizeS,
|
|
27
38
|
m: styles.sizeM,
|
|
28
39
|
l: styles.sizeL
|
|
@@ -31,6 +42,12 @@ var ICON_POSITION_STYLES = {
|
|
|
31
42
|
left: styles.alignIconLeft,
|
|
32
43
|
right: styles.alignIconRight
|
|
33
44
|
};
|
|
45
|
+
var ICON_SIZES = {
|
|
46
|
+
xs: 's',
|
|
47
|
+
s: 's',
|
|
48
|
+
m: 'm',
|
|
49
|
+
l: 'l'
|
|
50
|
+
};
|
|
34
51
|
var Button = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
|
|
35
52
|
function (_ref, ref) {
|
|
36
53
|
var _cn;
|
|
@@ -81,19 +98,30 @@ function (_ref, ref) {
|
|
|
81
98
|
var shiftedBottom = calculateShifted(shifted, 'bottom'); // check for ignored jsx values and empty string, more info https://reactjs.org/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored
|
|
82
99
|
|
|
83
100
|
var isWithoutText = children === null || typeof children === 'undefined' || children === false || children === true || children === '';
|
|
84
|
-
|
|
101
|
+
var iconSlot;
|
|
102
|
+
|
|
103
|
+
if ( /*#__PURE__*/React.isValidElement(icon) && busy) {
|
|
104
|
+
iconSlot = /*#__PURE__*/React.createElement(LoadingIcon, {
|
|
105
|
+
className: styles.icon
|
|
106
|
+
});
|
|
107
|
+
} else if ( /*#__PURE__*/React.isValidElement(icon)) {
|
|
108
|
+
iconSlot = /*#__PURE__*/cloneElement(icon, {
|
|
109
|
+
className: cn(icon.props.className, styles.icon)
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var showBusyOverlay = ! /*#__PURE__*/React.isValidElement(icon) && busy;
|
|
114
|
+
return /*#__PURE__*/React.createElement(ButtonTag, _objectSpread(_objectSpread({
|
|
85
115
|
"data-test": 'button'
|
|
86
|
-
}, restProps, {
|
|
116
|
+
}, restProps), {}, {
|
|
87
117
|
ref: ref,
|
|
88
118
|
href: href,
|
|
89
119
|
type: resolvedType,
|
|
90
120
|
disabled: disabled,
|
|
91
|
-
className: cn(styles.main, MODE_STYLES[mode], SIZE_STYLES[size], ICON_POSITION_STYLES[iconPosition], styles[theme], (_cn = {}, _defineProperty(_cn, styles.disabled, disabled), _defineProperty(_cn, styles.narrow, narrow), _defineProperty(_cn,
|
|
92
|
-
}),
|
|
93
|
-
className: cn(icon.props.className, styles.icon)
|
|
94
|
-
}), busy && /*#__PURE__*/React.createElement(LoadingIcon, {
|
|
121
|
+
className: cn(styles.main, MODE_STYLES[mode], SIZE_STYLES[size], ICON_POSITION_STYLES[iconPosition], styles[theme], (_cn = {}, _defineProperty(_cn, styles.disabled, disabled), _defineProperty(_cn, styles.narrow, narrow), _defineProperty(_cn, styles.flatLeft, flat === 'left'), _defineProperty(_cn, styles.flatRight, flat === 'right'), _defineProperty(_cn, styles.highlighted, highlighted), _defineProperty(_cn, styles.withIcon, !!icon), _defineProperty(_cn, styles.withoutText, isWithoutText), _defineProperty(_cn, styles.shiftedLeft, shiftedLeft), _defineProperty(_cn, styles.shiftedRight, shiftedRight), _defineProperty(_cn, styles.shiftedTop, shiftedTop), _defineProperty(_cn, styles.shiftedBottom, shiftedBottom), _defineProperty(_cn, styles.busy, busy), _defineProperty(_cn, styles.busyOverlay, showBusyOverlay), _cn), className)
|
|
122
|
+
}), iconSlot, showBusyOverlay && /*#__PURE__*/React.createElement(LoadingIcon, {
|
|
95
123
|
className: styles.busyIcon,
|
|
96
|
-
size: size,
|
|
124
|
+
size: ICON_SIZES[size],
|
|
97
125
|
"data-test": "busy-icon"
|
|
98
126
|
}), children);
|
|
99
127
|
});
|
|
@@ -128,7 +156,7 @@ Button.propTypes = {
|
|
|
128
156
|
}),
|
|
129
157
|
icon: PropTypes.node,
|
|
130
158
|
iconPosition: PropTypes.oneOf(['left', 'right']),
|
|
131
|
-
size: PropTypes.oneOf(['l', 'm', 's']),
|
|
159
|
+
size: PropTypes.oneOf(['l', 'm', 's', 'xs']),
|
|
132
160
|
mode: validateAdditional(PropTypes.oneOf(['classic', 'rock', 'transparent', 'outline', 'clear']), function (props) {
|
|
133
161
|
if (typeof props.shifted !== 'undefined' && props.mode !== 'clear') {
|
|
134
162
|
return new Error("'shifted' prop cannot be used when 'mode' prop is not 'clear'.");
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"main": "
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
2
|
+
"main": "_main_p9cwb6_17",
|
|
3
|
+
"rs-reset-letter-spacing": "_rs-reset-letter-spacing_p9cwb6_1",
|
|
4
|
+
"busy": "_busy_p9cwb6_49",
|
|
5
|
+
"busyOverlay": "_busyOverlay_p9cwb6_53",
|
|
6
|
+
"light": "_light_p9cwb6_59",
|
|
7
|
+
"disabled": "_disabled_p9cwb6_61",
|
|
8
|
+
"dark": "_dark_p9cwb6_62",
|
|
9
|
+
"alignIconLeft": "_alignIconLeft_p9cwb6_77",
|
|
10
|
+
"alignIconRight": "_alignIconRight_p9cwb6_81",
|
|
11
|
+
"sizeXs": "_sizeXs_p9cwb6_85",
|
|
12
|
+
"sizeS": "_sizeS_p9cwb6_92",
|
|
13
|
+
"sizeM": "_sizeM_p9cwb6_99",
|
|
14
|
+
"sizeL": "_sizeL_p9cwb6_106",
|
|
15
|
+
"withoutText": "_withoutText_p9cwb6_113",
|
|
16
|
+
"withIcon": "_withIcon_p9cwb6_119",
|
|
17
|
+
"flatRight": "_flatRight_p9cwb6_125",
|
|
18
|
+
"flatLeft": "_flatLeft_p9cwb6_130",
|
|
19
|
+
"modeClassic": "_modeClassic_p9cwb6_135",
|
|
20
|
+
"busyIcon": "_busyIcon_p9cwb6_139",
|
|
21
|
+
"modeRock": "_modeRock_p9cwb6_208",
|
|
22
|
+
"modeTransparent": "_modeTransparent_p9cwb6_286",
|
|
23
|
+
"modeOutline": "_modeOutline_p9cwb6_356",
|
|
24
|
+
"modeClear": "_modeClear_p9cwb6_434",
|
|
25
|
+
"highlighted": "_highlighted_p9cwb6_469",
|
|
26
|
+
"narrow": "_narrow_p9cwb6_510",
|
|
27
|
+
"shiftedLeft": "_shiftedLeft_p9cwb6_524",
|
|
28
|
+
"shiftedRight": "_shiftedRight_p9cwb6_525",
|
|
29
|
+
"shiftedTop": "_shiftedTop_p9cwb6_526",
|
|
30
|
+
"shiftedBottom": "_shiftedBottom_p9cwb6_527",
|
|
31
|
+
"icon": "_icon_p9cwb6_529"
|
|
29
32
|
};
|
|
30
33
|
export default styles;
|