widenarrow-ui 1.1.34 → 1.1.37
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/components/MultiActionButton/MultiActionButton.types.d.ts +2 -1
- package/lib/components/SwitchButton/SwitchButton.types.d.ts +2 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.esm.js +187 -172
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +186 -171
- package/lib/index.js.map +1 -1
- package/lib/utils.d.ts +6 -0
- package/package.json +1 -1
- package/src/components/Button/Button.tsx +3 -3
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/IconButton/IconButton.tsx +4 -5
- package/src/components/InlineButton/InlineButton.tsx +3 -4
- package/src/components/MultiActionButton/MultiActionButton.tsx +18 -3
- package/src/components/MultiActionButton/MultiActionButton.types.ts +2 -1
- package/src/components/SwitchButton/SwitchButton.tsx +42 -40
- package/src/components/SwitchButton/SwitchButton.types.ts +2 -1
- package/src/utils.ts +8 -1
package/lib/index.d.ts
CHANGED
|
@@ -867,7 +867,8 @@ interface MultiActionButtonProps {
|
|
|
867
867
|
loading?: boolean;
|
|
868
868
|
withEllipsis?: boolean;
|
|
869
869
|
autoFocus?: boolean;
|
|
870
|
-
|
|
870
|
+
leftAriaLabel?: string;
|
|
871
|
+
rightAriaLabel?: string;
|
|
871
872
|
tabIndex?: number;
|
|
872
873
|
}
|
|
873
874
|
|
|
@@ -936,8 +937,9 @@ declare const SortableTable: FC<SortableTableProps>;
|
|
|
936
937
|
|
|
937
938
|
interface SwitchButtonProps {
|
|
938
939
|
checked: boolean;
|
|
939
|
-
name
|
|
940
|
+
name: string;
|
|
940
941
|
label?: string;
|
|
942
|
+
ariaLabel?: string;
|
|
941
943
|
disabled?: boolean;
|
|
942
944
|
alignCenter?: boolean;
|
|
943
945
|
className?: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, Fragment, memo, useRef, useEffect, useState, useMemo, isValidElement, cloneElement, createContext, useContext, useCallback } from 'react';
|
|
3
|
-
import { is, isEmpty, path, times, sort, pipe, prop, ascend, descend,
|
|
3
|
+
import { is, pickBy, isEmpty, path, times, sort, pipe, prop, ascend, descend, has } from 'ramda';
|
|
4
4
|
import { Tooltip } from 'react-tooltip';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
import { usePopper } from 'react-popper';
|
|
@@ -200,6 +200,165 @@ var Box = forwardRef(function (_a, ref) {
|
|
|
200
200
|
_b.position_relative = ref, _b["position_".concat(position)] = is(String, position), _b["showOnBreakpoint_".concat(showOnBreakpoint)] = is(String, showOnBreakpoint), _b[className] = className, _b))), style: style, ref: ref, onClick: onClick }, otherProps, { children: children && children })));
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
+
function uuid() {
|
|
204
|
+
function chr4() {
|
|
205
|
+
return Math.random().toString(16).slice(-4);
|
|
206
|
+
}
|
|
207
|
+
return "".concat(chr4()).concat(chr4(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr4());
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Helper function to verify that passed argument is a valid
|
|
211
|
+
* array with content. Used both as a truthy value and as a plucker
|
|
212
|
+
* @function isArrayWithContent
|
|
213
|
+
* @param {Array} array
|
|
214
|
+
* @returns {Boolean}
|
|
215
|
+
*/
|
|
216
|
+
var isArrayWithContent = function (array) {
|
|
217
|
+
if (!array) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
return is(Array, array) && !isEmpty(array);
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Helper function to verify that passed argument is a valid
|
|
224
|
+
* object with content. Used both as a truthy value and as a plucker
|
|
225
|
+
* @function isObjectWithContent
|
|
226
|
+
* @returns {Boolean}
|
|
227
|
+
*/
|
|
228
|
+
var isObjectWithContent = function (object) { return is(Object, object) && !isEmpty(object); };
|
|
229
|
+
/**
|
|
230
|
+
* @function toLowerCustom
|
|
231
|
+
* @param {Any} val
|
|
232
|
+
* @returns {String} if string it is lowerCased otherwise the initial value
|
|
233
|
+
*/
|
|
234
|
+
var toLowerCustom = function (val) {
|
|
235
|
+
if (is(String, val)) {
|
|
236
|
+
return val.toLowerCase();
|
|
237
|
+
}
|
|
238
|
+
return val;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* @function masterSort
|
|
242
|
+
* @param sortOptions {Object} { keyName, ascending }
|
|
243
|
+
* @param array {Array}
|
|
244
|
+
* @returns {Array} sorted array
|
|
245
|
+
*/
|
|
246
|
+
var masterSort = function (array, _a) {
|
|
247
|
+
var keyName = _a.keyName, ascending = _a.ascending;
|
|
248
|
+
var f = ascending ? ascend : descend;
|
|
249
|
+
return sort(f(pipe(prop(keyName), toLowerCustom)), array);
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* @function sortObjectsInArrayByMultipleKeys
|
|
253
|
+
* @param {Array} array
|
|
254
|
+
* @param {Array} sortOptions
|
|
255
|
+
* @returns {Array} with objects sorted
|
|
256
|
+
*/
|
|
257
|
+
var sortObjectsInArrayByMultipleKeys = function (array, sortOptions) {
|
|
258
|
+
if (!isArrayWithContent(array) || !sortOptions) {
|
|
259
|
+
return [];
|
|
260
|
+
}
|
|
261
|
+
if (isArrayWithContent(array) && is(Array, sortOptions) && !sortOptions.length) {
|
|
262
|
+
return array;
|
|
263
|
+
}
|
|
264
|
+
return masterSort(array, sortOptions[0]);
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* @function getSortableTableState
|
|
268
|
+
* @param currentState
|
|
269
|
+
* @param newSortOption
|
|
270
|
+
*/
|
|
271
|
+
var getSortableTableState = function (currentState, newSortOption) {
|
|
272
|
+
if (!isArrayWithContent(currentState)) {
|
|
273
|
+
return [__assign(__assign({}, newSortOption), { ascending: true })];
|
|
274
|
+
}
|
|
275
|
+
if (!isObjectWithContent(newSortOption)) {
|
|
276
|
+
return currentState;
|
|
277
|
+
}
|
|
278
|
+
var itemInArray = currentState.find(function (val) { return val.keyName === newSortOption.keyName; });
|
|
279
|
+
// Is clicking something that has been clicked before
|
|
280
|
+
if (itemInArray) {
|
|
281
|
+
// If toggling same column as previous click
|
|
282
|
+
if (currentState[0].keyName === newSortOption.keyName) {
|
|
283
|
+
return __spreadArray([
|
|
284
|
+
__assign(__assign({}, itemInArray), { ascending: !itemInArray.ascending })
|
|
285
|
+
], currentState.filter(function (val) { return val.keyName !== newSortOption.keyName; }), true);
|
|
286
|
+
}
|
|
287
|
+
// If going back to one already selected
|
|
288
|
+
return __spreadArray([
|
|
289
|
+
__assign({}, itemInArray)
|
|
290
|
+
], currentState.filter(function (val) { return val.keyName !== newSortOption.keyName; }), true);
|
|
291
|
+
}
|
|
292
|
+
// Selecting and option that has not yet been selected - Set ascending to true
|
|
293
|
+
return __spreadArray([{ ascending: true, keyName: newSortOption.keyName }], currentState, true);
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* @function getSortableTableState
|
|
297
|
+
* @param {Array} state [{}]
|
|
298
|
+
* @param {String} cellKey [{}]
|
|
299
|
+
* @returns {Boolean}
|
|
300
|
+
*/
|
|
301
|
+
var tableColumnIsActive = function (_a) {
|
|
302
|
+
var state = _a.state, cellKey = _a.cellKey;
|
|
303
|
+
return path([0, 'keyName'], state) === cellKey;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* @function isSortingAscending
|
|
307
|
+
* @param {Array} state [{}]
|
|
308
|
+
* @returns {Boolean}
|
|
309
|
+
*/
|
|
310
|
+
var isSortingAscending = function (state) { return path([0, 'ascending'], state); };
|
|
311
|
+
/**
|
|
312
|
+
* @function getPaginationArray
|
|
313
|
+
* @param pagination
|
|
314
|
+
* @returns {Array}
|
|
315
|
+
*/
|
|
316
|
+
var getPaginationArray = function (pagination) {
|
|
317
|
+
var pages = pagination.pages || 0;
|
|
318
|
+
var maxButtons = 5;
|
|
319
|
+
if (pages <= maxButtons + 1) {
|
|
320
|
+
return __spreadArray([], times(function (i) { return ({
|
|
321
|
+
page: i + 1,
|
|
322
|
+
type: 'page'
|
|
323
|
+
}); }, pages), true);
|
|
324
|
+
}
|
|
325
|
+
var closeToStart = pagination.currentPage < maxButtons;
|
|
326
|
+
if (closeToStart) {
|
|
327
|
+
return __spreadArray(__spreadArray([], times(function (i) { return ({
|
|
328
|
+
page: i + 1,
|
|
329
|
+
type: 'page'
|
|
330
|
+
}); }, maxButtons), true), [
|
|
331
|
+
{ page: 0, type: 'dots' },
|
|
332
|
+
{ page: pages, type: 'page' }
|
|
333
|
+
], false);
|
|
334
|
+
}
|
|
335
|
+
var closeToEnd = maxButtons - 1 > pages - pagination.currentPage;
|
|
336
|
+
if (closeToEnd) {
|
|
337
|
+
return __spreadArray([
|
|
338
|
+
{ page: 1, type: 'page' },
|
|
339
|
+
{ page: 0, type: 'dots' }
|
|
340
|
+
], times(function (i) { return ({
|
|
341
|
+
page: pages - i,
|
|
342
|
+
type: 'page'
|
|
343
|
+
}); }, maxButtons).reverse(), true);
|
|
344
|
+
}
|
|
345
|
+
return [
|
|
346
|
+
{ page: 1, type: 'page' },
|
|
347
|
+
{ page: 0, type: 'dots' },
|
|
348
|
+
{ page: pagination.currentPage - 1, type: 'page' },
|
|
349
|
+
{ page: pagination.currentPage, type: 'page' },
|
|
350
|
+
{ page: pagination.currentPage + 1, type: 'page' },
|
|
351
|
+
{ page: 0, type: 'dots' },
|
|
352
|
+
{ page: pages, type: 'page' }
|
|
353
|
+
];
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* @function pickAttributes
|
|
357
|
+
* @param {Object} attr
|
|
358
|
+
* @returns {Object}
|
|
359
|
+
*/
|
|
360
|
+
var pickAttributes = function (attributes) { return pickBy(function (val) { return val !== undefined; }, attributes); };
|
|
361
|
+
|
|
203
362
|
var IconTypes;
|
|
204
363
|
(function (IconTypes) {
|
|
205
364
|
IconTypes["ACCOUNT_SETTINGS"] = "iconAccountSettings";
|
|
@@ -526,159 +685,6 @@ var AppColors;
|
|
|
526
685
|
AppColors["MAIN_DARK"] = "#1c202b";
|
|
527
686
|
})(AppColors || (AppColors = {}));
|
|
528
687
|
|
|
529
|
-
function uuid() {
|
|
530
|
-
function chr4() {
|
|
531
|
-
return Math.random().toString(16).slice(-4);
|
|
532
|
-
}
|
|
533
|
-
return "".concat(chr4()).concat(chr4(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr4());
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Helper function to verify that passed argument is a valid
|
|
537
|
-
* array with content. Used both as a truthy value and as a plucker
|
|
538
|
-
* @function isArrayWithContent
|
|
539
|
-
* @param {Array} array
|
|
540
|
-
* @returns {Boolean}
|
|
541
|
-
*/
|
|
542
|
-
var isArrayWithContent = function (array) {
|
|
543
|
-
if (!array) {
|
|
544
|
-
return false;
|
|
545
|
-
}
|
|
546
|
-
return is(Array, array) && !isEmpty(array);
|
|
547
|
-
};
|
|
548
|
-
/**
|
|
549
|
-
* Helper function to verify that passed argument is a valid
|
|
550
|
-
* object with content. Used both as a truthy value and as a plucker
|
|
551
|
-
* @function isObjectWithContent
|
|
552
|
-
* @returns {Boolean}
|
|
553
|
-
*/
|
|
554
|
-
var isObjectWithContent = function (object) { return is(Object, object) && !isEmpty(object); };
|
|
555
|
-
/**
|
|
556
|
-
* @function toLowerCustom
|
|
557
|
-
* @param {Any} val
|
|
558
|
-
* @returns {String} if string it is lowerCased otherwise the initial value
|
|
559
|
-
*/
|
|
560
|
-
var toLowerCustom = function (val) {
|
|
561
|
-
if (is(String, val)) {
|
|
562
|
-
return val.toLowerCase();
|
|
563
|
-
}
|
|
564
|
-
return val;
|
|
565
|
-
};
|
|
566
|
-
/**
|
|
567
|
-
* @function masterSort
|
|
568
|
-
* @param sortOptions {Object} { keyName, ascending }
|
|
569
|
-
* @param array {Array}
|
|
570
|
-
* @returns {Array} sorted array
|
|
571
|
-
*/
|
|
572
|
-
var masterSort = function (array, _a) {
|
|
573
|
-
var keyName = _a.keyName, ascending = _a.ascending;
|
|
574
|
-
var f = ascending ? ascend : descend;
|
|
575
|
-
return sort(f(pipe(prop(keyName), toLowerCustom)), array);
|
|
576
|
-
};
|
|
577
|
-
/**
|
|
578
|
-
* @function sortObjectsInArrayByMultipleKeys
|
|
579
|
-
* @param {Array} array
|
|
580
|
-
* @param {Array} sortOptions
|
|
581
|
-
* @returns {Array} with objects sorted
|
|
582
|
-
*/
|
|
583
|
-
var sortObjectsInArrayByMultipleKeys = function (array, sortOptions) {
|
|
584
|
-
if (!isArrayWithContent(array) || !sortOptions) {
|
|
585
|
-
return [];
|
|
586
|
-
}
|
|
587
|
-
if (isArrayWithContent(array) && is(Array, sortOptions) && !sortOptions.length) {
|
|
588
|
-
return array;
|
|
589
|
-
}
|
|
590
|
-
return masterSort(array, sortOptions[0]);
|
|
591
|
-
};
|
|
592
|
-
/**
|
|
593
|
-
* @function getSortableTableState
|
|
594
|
-
* @param currentState
|
|
595
|
-
* @param newSortOption
|
|
596
|
-
*/
|
|
597
|
-
var getSortableTableState = function (currentState, newSortOption) {
|
|
598
|
-
if (!isArrayWithContent(currentState)) {
|
|
599
|
-
return [__assign(__assign({}, newSortOption), { ascending: true })];
|
|
600
|
-
}
|
|
601
|
-
if (!isObjectWithContent(newSortOption)) {
|
|
602
|
-
return currentState;
|
|
603
|
-
}
|
|
604
|
-
var itemInArray = currentState.find(function (val) { return val.keyName === newSortOption.keyName; });
|
|
605
|
-
// Is clicking something that has been clicked before
|
|
606
|
-
if (itemInArray) {
|
|
607
|
-
// If toggling same column as previous click
|
|
608
|
-
if (currentState[0].keyName === newSortOption.keyName) {
|
|
609
|
-
return __spreadArray([
|
|
610
|
-
__assign(__assign({}, itemInArray), { ascending: !itemInArray.ascending })
|
|
611
|
-
], currentState.filter(function (val) { return val.keyName !== newSortOption.keyName; }), true);
|
|
612
|
-
}
|
|
613
|
-
// If going back to one already selected
|
|
614
|
-
return __spreadArray([
|
|
615
|
-
__assign({}, itemInArray)
|
|
616
|
-
], currentState.filter(function (val) { return val.keyName !== newSortOption.keyName; }), true);
|
|
617
|
-
}
|
|
618
|
-
// Selecting and option that has not yet been selected - Set ascending to true
|
|
619
|
-
return __spreadArray([{ ascending: true, keyName: newSortOption.keyName }], currentState, true);
|
|
620
|
-
};
|
|
621
|
-
/**
|
|
622
|
-
* @function getSortableTableState
|
|
623
|
-
* @param {Array} state [{}]
|
|
624
|
-
* @param {String} cellKey [{}]
|
|
625
|
-
* @returns {Boolean}
|
|
626
|
-
*/
|
|
627
|
-
var tableColumnIsActive = function (_a) {
|
|
628
|
-
var state = _a.state, cellKey = _a.cellKey;
|
|
629
|
-
return path([0, 'keyName'], state) === cellKey;
|
|
630
|
-
};
|
|
631
|
-
/**
|
|
632
|
-
* @function isSortingAscending
|
|
633
|
-
* @param {Array} state [{}]
|
|
634
|
-
* @returns {Boolean}
|
|
635
|
-
*/
|
|
636
|
-
var isSortingAscending = function (state) { return path([0, 'ascending'], state); };
|
|
637
|
-
/**
|
|
638
|
-
* @function getPaginationArray
|
|
639
|
-
* @param pagination
|
|
640
|
-
* @returns {Array}
|
|
641
|
-
*/
|
|
642
|
-
var getPaginationArray = function (pagination) {
|
|
643
|
-
var pages = pagination.pages || 0;
|
|
644
|
-
var maxButtons = 5;
|
|
645
|
-
if (pages <= maxButtons + 1) {
|
|
646
|
-
return __spreadArray([], times(function (i) { return ({
|
|
647
|
-
page: i + 1,
|
|
648
|
-
type: 'page'
|
|
649
|
-
}); }, pages), true);
|
|
650
|
-
}
|
|
651
|
-
var closeToStart = pagination.currentPage < maxButtons;
|
|
652
|
-
if (closeToStart) {
|
|
653
|
-
return __spreadArray(__spreadArray([], times(function (i) { return ({
|
|
654
|
-
page: i + 1,
|
|
655
|
-
type: 'page'
|
|
656
|
-
}); }, maxButtons), true), [
|
|
657
|
-
{ page: 0, type: 'dots' },
|
|
658
|
-
{ page: pages, type: 'page' }
|
|
659
|
-
], false);
|
|
660
|
-
}
|
|
661
|
-
var closeToEnd = maxButtons - 1 > pages - pagination.currentPage;
|
|
662
|
-
if (closeToEnd) {
|
|
663
|
-
return __spreadArray([
|
|
664
|
-
{ page: 1, type: 'page' },
|
|
665
|
-
{ page: 0, type: 'dots' }
|
|
666
|
-
], times(function (i) { return ({
|
|
667
|
-
page: pages - i,
|
|
668
|
-
type: 'page'
|
|
669
|
-
}); }, maxButtons).reverse(), true);
|
|
670
|
-
}
|
|
671
|
-
return [
|
|
672
|
-
{ page: 1, type: 'page' },
|
|
673
|
-
{ page: 0, type: 'dots' },
|
|
674
|
-
{ page: pagination.currentPage - 1, type: 'page' },
|
|
675
|
-
{ page: pagination.currentPage, type: 'page' },
|
|
676
|
-
{ page: pagination.currentPage + 1, type: 'page' },
|
|
677
|
-
{ page: 0, type: 'dots' },
|
|
678
|
-
{ page: pages, type: 'page' }
|
|
679
|
-
];
|
|
680
|
-
};
|
|
681
|
-
|
|
682
688
|
var styles$r = {"body":"ToolTip-module_EfvT16","container":"ToolTip-module_rxb-Ce","withEllipsis":"ToolTip-module_vea-tI"};
|
|
683
689
|
|
|
684
690
|
var s$r = classNames.bind(styles$r);
|
|
@@ -2318,8 +2324,7 @@ var Button = memo(function (_a) {
|
|
|
2318
2324
|
_c.autoFocus = autoFocus,
|
|
2319
2325
|
_c.tabIndex = tabIndex,
|
|
2320
2326
|
_c);
|
|
2321
|
-
var
|
|
2322
|
-
var buttonMarkup = (jsxs("button", __assign({}, buttonAttributes, { children: [loading && !icon ? (jsx("div", { className: s$n('spinnerContainer'), children: jsx(SolidSpinner, { className: s$n('spinner'), type: HierarchyTypes.SECONDARY, size: SizeTypes.SMALL, disabled: true }) })) : null, children ? jsx("div", { className: s$n('childrenContainer'), children: children }) : getInnerMarkup()] })));
|
|
2327
|
+
var buttonMarkup = (jsxs("button", __assign({}, pickAttributes(baseAttributes), { children: [loading && !icon ? (jsx("div", { className: s$n('spinnerContainer'), children: jsx(SolidSpinner, { className: s$n('spinner'), type: HierarchyTypes.SECONDARY, size: SizeTypes.SMALL, disabled: true }) })) : null, children ? jsx("div", { className: s$n('childrenContainer'), children: children }) : getInnerMarkup()] })));
|
|
2323
2328
|
if (toolTip) {
|
|
2324
2329
|
return (jsx(ToolTip, { text: "".concat(toolTip), id: id ? "".concat(id) : undefined, withEllipsis: withEllipsis, children: buttonMarkup }));
|
|
2325
2330
|
}
|
|
@@ -2417,7 +2422,7 @@ var Card = function (_a) {
|
|
|
2417
2422
|
role: !!onClickCallback ? 'button' : 'presentation',
|
|
2418
2423
|
onClick: !!onClickCallback ? onClickCallback : undefined
|
|
2419
2424
|
};
|
|
2420
|
-
var sharedAttributes =
|
|
2425
|
+
var sharedAttributes = pickAttributes(baseAttributes);
|
|
2421
2426
|
var mergedClassNames = s$k('container', __assign(__assign(__assign({ container_withHoverEffect: withHoverEffect }, paddingClassNames({ padding: padding, paddingX: paddingX, paddingY: paddingY, paddingTop: paddingTop, paddingBottom: paddingBottom, paddingRight: paddingRight, paddingLeft: paddingLeft })), flexClassNames({
|
|
2422
2427
|
displayFlex: displayFlex,
|
|
2423
2428
|
displayFlexCenter: displayFlexCenter,
|
|
@@ -2750,8 +2755,7 @@ var InlineButton = memo(function (_a) {
|
|
|
2750
2755
|
_c['aria-label'] = ariaLabel || text,
|
|
2751
2756
|
_c.style = style,
|
|
2752
2757
|
_c);
|
|
2753
|
-
var
|
|
2754
|
-
var button = (jsxs("button", __assign({}, buttonAttributes, { children: [loading && !icon ? (jsx("div", { className: s$f('spinnerContainer'), children: jsx(SolidSpinner, { className: s$f('spinner'), type: type, size: SizeTypes.EXTRA_SMALL, disabled: true }) })) : null, getInnerMarkup()] })));
|
|
2758
|
+
var button = (jsxs("button", __assign({}, pickAttributes(baseAttributes), { children: [loading && !icon ? (jsx("div", { className: s$f('spinnerContainer'), children: jsx(SolidSpinner, { className: s$f('spinner'), type: type, size: SizeTypes.EXTRA_SMALL, disabled: true }) })) : null, getInnerMarkup()] })));
|
|
2755
2759
|
return toolTip ? (jsx(ToolTip, { text: "".concat(toolTip), withEllipsis: withEllipsis, id: id ? "".concat(id) : undefined, offset: 12, className: s$f('toolTip'), children: button })) : (button);
|
|
2756
2760
|
});
|
|
2757
2761
|
|
|
@@ -2946,12 +2950,11 @@ var IconButton = memo(function (_a) {
|
|
|
2946
2950
|
_c.target = href ? '_blank' : undefined,
|
|
2947
2951
|
_c.rel = href ? 'noopener noreferrer' : undefined,
|
|
2948
2952
|
_c);
|
|
2949
|
-
var buttonAttributes = pickBy(function (val) { return val !== undefined; }, baseAttributes);
|
|
2950
2953
|
var buttonMarkup = function () {
|
|
2951
2954
|
if (href) {
|
|
2952
|
-
return (jsxs("a", __assign({},
|
|
2955
|
+
return (jsxs("a", __assign({}, pickAttributes(baseAttributes), { children: [jsx("span", { className: s$a('text'), children: text || toolTip || ariaLabel || 'link' }), iconMarkup] })));
|
|
2953
2956
|
}
|
|
2954
|
-
return (jsxs("button", __assign({},
|
|
2957
|
+
return (jsxs("button", __assign({}, pickAttributes(baseAttributes), { children: [jsx("span", { className: s$a('text'), children: text || toolTip || ariaLabel || 'button' }), iconMarkup] })));
|
|
2955
2958
|
};
|
|
2956
2959
|
if (toolTip) {
|
|
2957
2960
|
return (jsx(ToolTip, { text: "".concat(toolTip), id: id ? "".concat(id) : undefined, offset: 12, children: buttonMarkup() }));
|
|
@@ -3129,7 +3132,16 @@ var styles$5 = {"body":"MultiActionButton-module_BqAJK-","button":"MultiActionBu
|
|
|
3129
3132
|
var s$5 = classNames.bind(styles$5);
|
|
3130
3133
|
var MultiActionButton = function (_a) {
|
|
3131
3134
|
var _b, _c, _d, _e, _f;
|
|
3132
|
-
var className = _a.className, iconClassName = _a.iconClassName, innerClassName = _a.innerClassName, id = _a.id, _g = _a.type, type = _g === void 0 ? HierarchyTypes.PRIMARY : _g, _h = _a.size, size = _h === void 0 ? SizeTypes.MEDIUM : _h, sizeMd = _a.sizeMd, sizeLg = _a.sizeLg, sizeXl = _a.sizeXl, rotateLeftIconByDegree = _a.rotateLeftIconByDegree, rotateMiddleIconByDegree = _a.rotateMiddleIconByDegree, rotateRightIconByDegree = _a.rotateRightIconByDegree, text = _a.text, toolTip = _a.toolTip, iconSize = _a.iconSize, leftIcon = _a.leftIcon, middleIcon = _a.middleIcon, rightIcon = _a.rightIcon, withEllipsis = _a.withEllipsis, onRightClickCallback = _a.onRightClickCallback, onLeftClickCallback = _a.onLeftClickCallback, loading = _a.loading, disabled = _a.disabled, autoFocus = _a.autoFocus,
|
|
3135
|
+
var className = _a.className, iconClassName = _a.iconClassName, innerClassName = _a.innerClassName, id = _a.id, _g = _a.type, type = _g === void 0 ? HierarchyTypes.PRIMARY : _g, _h = _a.size, size = _h === void 0 ? SizeTypes.MEDIUM : _h, sizeMd = _a.sizeMd, sizeLg = _a.sizeLg, sizeXl = _a.sizeXl, rotateLeftIconByDegree = _a.rotateLeftIconByDegree, rotateMiddleIconByDegree = _a.rotateMiddleIconByDegree, rotateRightIconByDegree = _a.rotateRightIconByDegree, text = _a.text, toolTip = _a.toolTip, iconSize = _a.iconSize, leftIcon = _a.leftIcon, middleIcon = _a.middleIcon, rightIcon = _a.rightIcon, withEllipsis = _a.withEllipsis, onRightClickCallback = _a.onRightClickCallback, onLeftClickCallback = _a.onLeftClickCallback, loading = _a.loading, disabled = _a.disabled, autoFocus = _a.autoFocus, leftAriaLabel = _a.leftAriaLabel, rightAriaLabel = _a.rightAriaLabel, tabIndex = _a.tabIndex;
|
|
3136
|
+
var getFallbackAriaLabel = function (position) {
|
|
3137
|
+
if (text) {
|
|
3138
|
+
return "".concat(text, " - ").concat(position, " button");
|
|
3139
|
+
}
|
|
3140
|
+
if (toolTip) {
|
|
3141
|
+
return "".concat(toolTip, " - ").concat(position, " button");
|
|
3142
|
+
}
|
|
3143
|
+
return "".concat(position, " button");
|
|
3144
|
+
};
|
|
3133
3145
|
var buttonMarkup = (jsxs("div", { role: 'group', className: s$5('container', (_b = {},
|
|
3134
3146
|
_b[className] = className,
|
|
3135
3147
|
_b)), children: [loading ? (jsx(SolidSpinner, { className: s$5('spinner'), type: type === HierarchyTypes.PRIMARY ? HierarchyTypes.QUATERNARY : HierarchyTypes.SECONDARY, size: SizeTypes.SMALL })) : null, jsxs("div", { className: s$5('innerContainer', (_c = {},
|
|
@@ -3147,9 +3159,9 @@ var MultiActionButton = function (_a) {
|
|
|
3147
3159
|
button_disabled: loading || disabled,
|
|
3148
3160
|
button_noButtonRight: !rightIcon,
|
|
3149
3161
|
button_withEllipsis: withEllipsis
|
|
3150
|
-
}), disabled: loading || disabled, onClick: !loading ? onLeftClickCallback : undefined, autoFocus: autoFocus, "aria-label":
|
|
3162
|
+
}), disabled: loading || disabled, onClick: !loading ? onLeftClickCallback : undefined, autoFocus: autoFocus, "aria-label": leftAriaLabel || getFallbackAriaLabel('left'), tabIndex: tabIndex, children: [leftIcon ? (jsx(Icon, { icon: leftIcon, size: iconSize, rotateIconByDegree: rotateLeftIconByDegree, className: s$5((_d = { icon: !iconSize, marginRight: !!text }, _d[iconClassName] = iconClassName, _d)) })) : null, jsx("span", { className: s$5('text', {
|
|
3151
3163
|
text_withEllipsis: withEllipsis
|
|
3152
|
-
}), children: text }), middleIcon ? (jsx(Icon, { icon: middleIcon, size: iconSize, rotateIconByDegree: rotateMiddleIconByDegree, className: s$5((_e = { icon: !iconSize, marginLeft: !!text }, _e[iconClassName] = iconClassName, _e)) })) : null] }), rightIcon ? (jsx("button", { className: s$5({ button: true, button_right: true, button_disabled: loading || disabled }), onClick: onRightClickCallback, children: jsx(Icon, { icon: rightIcon, size: iconSize, className: s$5((_f = { icon: !iconSize }, _f[iconClassName] = iconClassName, _f)), rotateIconByDegree: rotateRightIconByDegree }) })) : null] })] }));
|
|
3164
|
+
}), children: text }), middleIcon ? (jsx(Icon, { icon: middleIcon, size: iconSize, rotateIconByDegree: rotateMiddleIconByDegree, className: s$5((_e = { icon: !iconSize, marginLeft: !!text }, _e[iconClassName] = iconClassName, _e)) })) : null] }), rightIcon ? (jsx("button", { className: s$5({ button: true, button_right: true, button_disabled: loading || disabled }), "aria-label": rightAriaLabel || getFallbackAriaLabel('right'), onClick: onRightClickCallback, children: jsx(Icon, { icon: rightIcon, size: iconSize, className: s$5((_f = { icon: !iconSize }, _f[iconClassName] = iconClassName, _f)), rotateIconByDegree: rotateRightIconByDegree }) })) : null] })] }));
|
|
3153
3165
|
if (toolTip) {
|
|
3154
3166
|
return (jsx(ToolTip, { text: "".concat(toolTip), id: "".concat(id), withEllipsis: withEllipsis, children: buttonMarkup }));
|
|
3155
3167
|
}
|
|
@@ -3277,22 +3289,25 @@ var styles$2 = {"body":"SwitchButton-module_BSiKOl","container":"SwitchButton-mo
|
|
|
3277
3289
|
|
|
3278
3290
|
var s$2 = classNames.bind(styles$2);
|
|
3279
3291
|
var SwitchButton = function (_a) {
|
|
3280
|
-
var _b;
|
|
3281
|
-
var className = _a.className, onClickCallback = _a.onClickCallback, checked = _a.checked, disabled = _a.disabled, label = _a.label, inlineLabel = _a.inlineLabel,
|
|
3282
|
-
|
|
3292
|
+
var _b, _c;
|
|
3293
|
+
var className = _a.className, onClickCallback = _a.onClickCallback, checked = _a.checked, disabled = _a.disabled, label = _a.label, inlineLabel = _a.inlineLabel, ariaLabel = _a.ariaLabel, name = _a.name, alignCenter = _a.alignCenter, marginBottom = _a.marginBottom;
|
|
3294
|
+
var baseAttributes = (_b = {},
|
|
3295
|
+
_b['aria-label'] = ariaLabel || label || name,
|
|
3296
|
+
_b);
|
|
3297
|
+
return (jsxs("div", __assign({ className: s$2('container', (_c = {
|
|
3283
3298
|
disabled: disabled,
|
|
3284
3299
|
checked: checked,
|
|
3285
3300
|
notChecked: !checked,
|
|
3286
3301
|
container_marginBottom: marginBottom,
|
|
3287
3302
|
container_withInlineLabel: !!(label && inlineLabel)
|
|
3288
3303
|
},
|
|
3289
|
-
|
|
3290
|
-
|
|
3304
|
+
_c[className] = className,
|
|
3305
|
+
_c)), role: 'button', onClick: function (e) {
|
|
3291
3306
|
e.stopPropagation();
|
|
3292
3307
|
onClickCallback();
|
|
3293
|
-
}, children: [label ? (jsx("label", { className: s$2('label', { label_alignCenter: alignCenter, label_inlineLabel: inlineLabel, label_disabled: disabled }), htmlFor: name, children: label })) : null, jsxs("div", { className: s$2('button', {
|
|
3308
|
+
} }, pickAttributes(baseAttributes), { children: [label ? (jsx("label", { className: s$2('label', { label_alignCenter: alignCenter, label_inlineLabel: inlineLabel, label_disabled: disabled }), htmlFor: name, children: label })) : null, jsxs("div", { className: s$2('button', {
|
|
3294
3309
|
button_alignCenter: alignCenter
|
|
3295
|
-
}), children: [jsx("input", { className: s$2('input'), type: 'checkbox',
|
|
3310
|
+
}), children: [jsx("input", { className: s$2('input'), type: 'checkbox', checked: checked, disabled: disabled, onChange: function () { return undefined; }, name: name }), jsx("span", { className: s$2('line') }), jsx("span", { className: s$2('circle') })] })] })));
|
|
3296
3311
|
};
|
|
3297
3312
|
|
|
3298
3313
|
var styles$1 = {"body":"SelectInput-module_w2mdUW","container":"SelectInput-module_hAgG55","container_marginBottom":"SelectInput-module_2lOd3w","container_disabled":"SelectInput-module_gU2gdL","inputContainer":"SelectInput-module_SGwhru","input":"SelectInput-module_Gn75Yy","input_disabled":"SelectInput-module_2fbHpO","input_hasError":"SelectInput-module_7qVlVo","input_sizeSm_small":"SelectInput-module_1LUt-c","input_sizeSm_medium":"SelectInput-module_VPhg9x","input_sizeSm_large":"SelectInput-module_Dpw8UL","input_sizeMd_small":"SelectInput-module_DM5Arh","input_sizeMd_medium":"SelectInput-module_NdCawf","input_sizeMd_large":"SelectInput-module_-tRhea","input_sizeLg_small":"SelectInput-module_BcApb-","input_sizeLg_medium":"SelectInput-module_YJn5Z8","input_sizeLg_large":"SelectInput-module_Omz8y0","input_sizeXl_small":"SelectInput-module_Mr9cBg","input_sizeXl_medium":"SelectInput-module_nlHNAR","input_sizeXl_large":"SelectInput-module_dChlCy","button":"SelectInput-module_KonxcG","dropDown":"SelectInput-module_MFE3na","spinner":"SelectInput-module_3OYBJ6","helperText":"SelectInput-module_u9GtGN"};
|