@lumx/react 4.3.2-alpha.7 → 4.3.2-alpha.8
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/_internal/DpdvhbTO.js +159 -0
- package/_internal/DpdvhbTO.js.map +1 -0
- package/index.d.ts +19 -521
- package/index.js +326 -2024
- package/index.js.map +1 -1
- package/package.json +7 -3
- package/utils/index.js +1322 -3
- package/utils/index.js.map +1 -1
- package/_internal/BcRzrT9Y.js +0 -1480
- package/_internal/BcRzrT9Y.js.map +0 -1
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio as AspectRatio$1, ColorVariant,
|
|
1
|
+
import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio as AspectRatio$1, ColorVariant, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
|
|
2
2
|
export * from '@lumx/core/js/constants';
|
|
3
3
|
export * from '@lumx/core/js/types';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default, { useState, useEffect, useMemo, useRef, useCallback,
|
|
6
|
-
import { mdiAlert } from '@lumx/icons/esm/alert';
|
|
7
|
-
import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle';
|
|
8
|
-
import { mdiCheckCircle } from '@lumx/icons/esm/check-circle';
|
|
9
|
-
import { mdiInformation } from '@lumx/icons/esm/information';
|
|
5
|
+
import React__default, { useState, useEffect, useMemo, useRef, useCallback, Children, useLayoutEffect, cloneElement, createContext, isValidElement, useContext, useReducer } from 'react';
|
|
6
|
+
import { mdiAlert } from '@lumx/icons/esm/alert.js';
|
|
7
|
+
import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle.js';
|
|
8
|
+
import { mdiCheckCircle } from '@lumx/icons/esm/check-circle.js';
|
|
9
|
+
import { mdiInformation } from '@lumx/icons/esm/information.js';
|
|
10
10
|
import { classNames, onEnterPressed, onEscapePressed, onButtonPressed, detectHorizontalSwipe } from '@lumx/core/js/utils';
|
|
11
11
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
12
12
|
import last from 'lodash/last';
|
|
@@ -16,44 +16,40 @@ import concat from 'lodash/concat';
|
|
|
16
16
|
import dropRight from 'lodash/dropRight';
|
|
17
17
|
import partition from 'lodash/partition';
|
|
18
18
|
import reduce from 'lodash/reduce';
|
|
19
|
-
import { u as useDisabledStateContext,
|
|
19
|
+
import { u as useDisabledStateContext, P as Portal, C as ClickAwayProvider } from './_internal/DpdvhbTO.js';
|
|
20
20
|
import isEmpty from 'lodash/isEmpty';
|
|
21
21
|
import { getDisabledState } from '@lumx/core/js/utils/disabledState';
|
|
22
|
-
import { mdiCloseCircle } from '@lumx/icons/esm/close-circle';
|
|
22
|
+
import { mdiCloseCircle } from '@lumx/icons/esm/close-circle.js';
|
|
23
23
|
import memoize from 'lodash/memoize';
|
|
24
|
-
import { mdiClose } from '@lumx/icons/esm/close';
|
|
24
|
+
import { mdiClose } from '@lumx/icons/esm/close.js';
|
|
25
25
|
import isFunction from 'lodash/isFunction';
|
|
26
|
-
import { mdiImageBroken } from '@lumx/icons/esm/image-broken';
|
|
27
|
-
import { mdiCheck } from '@lumx/icons/esm/check';
|
|
28
|
-
import { mdiMinus } from '@lumx/icons/esm/minus';
|
|
29
|
-
import {
|
|
30
|
-
import
|
|
31
|
-
import uniqueId from 'lodash/uniqueId';
|
|
32
|
-
import debounce$1 from 'lodash/debounce';
|
|
33
|
-
import { mdiChevronDown } from '@lumx/icons/esm/chevron-down';
|
|
34
|
-
import { mdiChevronUp } from '@lumx/icons/esm/chevron-up';
|
|
26
|
+
import { mdiImageBroken } from '@lumx/icons/esm/image-broken.js';
|
|
27
|
+
import { mdiCheck } from '@lumx/icons/esm/check.js';
|
|
28
|
+
import { mdiMinus } from '@lumx/icons/esm/minus.js';
|
|
29
|
+
import { mdiChevronLeft } from '@lumx/icons/esm/chevron-left.js';
|
|
30
|
+
import { mdiChevronRight } from '@lumx/icons/esm/chevron-right.js';
|
|
35
31
|
import castArray from 'lodash/castArray';
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import
|
|
32
|
+
import { mdiDragVertical } from '@lumx/icons/esm/drag-vertical.js';
|
|
33
|
+
import { mdiChevronDown } from '@lumx/icons/esm/chevron-down.js';
|
|
34
|
+
import { mdiChevronUp } from '@lumx/icons/esm/chevron-up.js';
|
|
35
|
+
import noop from 'lodash/noop';
|
|
40
36
|
import pick from 'lodash/pick';
|
|
41
37
|
import isInteger from 'lodash/isInteger';
|
|
42
|
-
import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline';
|
|
43
|
-
import { mdiMagnifyPlusOutline } from '@lumx/icons/esm/magnify-plus-outline';
|
|
38
|
+
import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline.js';
|
|
39
|
+
import { mdiMagnifyPlusOutline } from '@lumx/icons/esm/magnify-plus-outline.js';
|
|
44
40
|
import throttle from 'lodash/throttle';
|
|
45
41
|
import range from 'lodash/range';
|
|
46
|
-
import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline';
|
|
47
|
-
import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline';
|
|
42
|
+
import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline.js';
|
|
43
|
+
import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline.js';
|
|
48
44
|
import chunk from 'lodash/chunk';
|
|
49
45
|
import ReactDOM from 'react-dom';
|
|
50
46
|
import take from 'lodash/take';
|
|
51
|
-
import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank';
|
|
52
|
-
import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked';
|
|
53
|
-
import { mdiMenuDown } from '@lumx/icons/esm/menu-down';
|
|
47
|
+
import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank.js';
|
|
48
|
+
import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked.js';
|
|
49
|
+
import { mdiMenuDown } from '@lumx/icons/esm/menu-down.js';
|
|
54
50
|
import { getWithSelector } from '@lumx/core/js/utils/selectors/getWithSelector';
|
|
55
|
-
import { mdiArrowDown } from '@lumx/icons/esm/arrow-down';
|
|
56
|
-
import { mdiArrowUp } from '@lumx/icons/esm/arrow-up';
|
|
51
|
+
import { mdiArrowDown } from '@lumx/icons/esm/arrow-down.js';
|
|
52
|
+
import { mdiArrowUp } from '@lumx/icons/esm/arrow-up.js';
|
|
57
53
|
import set from 'lodash/set';
|
|
58
54
|
|
|
59
55
|
let i = 0;
|
|
@@ -105,15 +101,15 @@ const COMPONENT_NAME$1l = 'AlertDialog';
|
|
|
105
101
|
/**
|
|
106
102
|
* Component default class name and class prefix.
|
|
107
103
|
*/
|
|
108
|
-
const CLASSNAME$
|
|
104
|
+
const CLASSNAME$1j = 'lumx-alert-dialog';
|
|
109
105
|
const {
|
|
110
|
-
block: block$
|
|
111
|
-
} = classNames.bem(CLASSNAME$
|
|
106
|
+
block: block$14
|
|
107
|
+
} = classNames.bem(CLASSNAME$1j);
|
|
112
108
|
|
|
113
109
|
/**
|
|
114
110
|
* Component default props.
|
|
115
111
|
*/
|
|
116
|
-
const DEFAULT_PROPS$
|
|
112
|
+
const DEFAULT_PROPS$1a = {
|
|
117
113
|
size: Size$1.tiny,
|
|
118
114
|
kind: Kind$1.info
|
|
119
115
|
};
|
|
@@ -134,8 +130,8 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
134
130
|
className,
|
|
135
131
|
cancelProps,
|
|
136
132
|
confirmProps,
|
|
137
|
-
kind = DEFAULT_PROPS$
|
|
138
|
-
size = DEFAULT_PROPS$
|
|
133
|
+
kind = DEFAULT_PROPS$1a.kind,
|
|
134
|
+
size = DEFAULT_PROPS$1a.size,
|
|
139
135
|
dialogProps,
|
|
140
136
|
children,
|
|
141
137
|
...forwardedProps
|
|
@@ -176,7 +172,7 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
176
172
|
'aria-describedby': descriptionId,
|
|
177
173
|
...dialogProps
|
|
178
174
|
},
|
|
179
|
-
className: classNames.join(className, block$
|
|
175
|
+
className: classNames.join(className, block$14({
|
|
180
176
|
[`kind-${kind}`]: Boolean(kind)
|
|
181
177
|
})),
|
|
182
178
|
...forwardedProps,
|
|
@@ -222,8 +218,8 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
222
218
|
});
|
|
223
219
|
});
|
|
224
220
|
AlertDialog.displayName = COMPONENT_NAME$1l;
|
|
225
|
-
AlertDialog.className = CLASSNAME$
|
|
226
|
-
AlertDialog.defaultProps = DEFAULT_PROPS$
|
|
221
|
+
AlertDialog.className = CLASSNAME$1j;
|
|
222
|
+
AlertDialog.defaultProps = DEFAULT_PROPS$1a;
|
|
227
223
|
|
|
228
224
|
/**
|
|
229
225
|
* Hook focusing an element when defined and `focus` boolean `true`.
|
|
@@ -320,12 +316,12 @@ const COMPONENT_NAME$1k = 'Autocomplete';
|
|
|
320
316
|
/**
|
|
321
317
|
* Component default class name and class prefix.
|
|
322
318
|
*/
|
|
323
|
-
const CLASSNAME$
|
|
319
|
+
const CLASSNAME$1i = 'lumx-autocomplete';
|
|
324
320
|
|
|
325
321
|
/**
|
|
326
322
|
* Component default props.
|
|
327
323
|
*/
|
|
328
|
-
const DEFAULT_PROPS$
|
|
324
|
+
const DEFAULT_PROPS$19 = {
|
|
329
325
|
anchorToInput: false,
|
|
330
326
|
closeOnClick: false,
|
|
331
327
|
closeOnClickAway: true,
|
|
@@ -347,13 +343,13 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
347
343
|
otherProps
|
|
348
344
|
} = useDisableStateProps(props);
|
|
349
345
|
const {
|
|
350
|
-
anchorToInput = DEFAULT_PROPS$
|
|
346
|
+
anchorToInput = DEFAULT_PROPS$19.anchorToInput,
|
|
351
347
|
children,
|
|
352
348
|
chips,
|
|
353
349
|
className,
|
|
354
|
-
closeOnClick = DEFAULT_PROPS$
|
|
355
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
356
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
350
|
+
closeOnClick = DEFAULT_PROPS$19.closeOnClick,
|
|
351
|
+
closeOnClickAway = DEFAULT_PROPS$19.closeOnClickAway,
|
|
352
|
+
closeOnEscape = DEFAULT_PROPS$19.closeOnEscape,
|
|
357
353
|
error,
|
|
358
354
|
fitToAnchorWidth,
|
|
359
355
|
hasError,
|
|
@@ -374,7 +370,7 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
374
370
|
onInfiniteScroll,
|
|
375
371
|
placeholder,
|
|
376
372
|
placement,
|
|
377
|
-
shouldFocusOnClose = DEFAULT_PROPS$
|
|
373
|
+
shouldFocusOnClose = DEFAULT_PROPS$19.shouldFocusOnClose,
|
|
378
374
|
theme = defaultTheme,
|
|
379
375
|
value,
|
|
380
376
|
textFieldProps = {},
|
|
@@ -387,7 +383,7 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
387
383
|
return /*#__PURE__*/jsxs("div", {
|
|
388
384
|
ref: ref,
|
|
389
385
|
...forwardedProps,
|
|
390
|
-
className: classNames.join(className, CLASSNAME$
|
|
386
|
+
className: classNames.join(className, CLASSNAME$1i),
|
|
391
387
|
children: [/*#__PURE__*/jsx(TextField, {
|
|
392
388
|
...textFieldProps,
|
|
393
389
|
chips: chips,
|
|
@@ -428,8 +424,8 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
428
424
|
});
|
|
429
425
|
});
|
|
430
426
|
Autocomplete.displayName = COMPONENT_NAME$1k;
|
|
431
|
-
Autocomplete.className = CLASSNAME$
|
|
432
|
-
Autocomplete.defaultProps = DEFAULT_PROPS$
|
|
427
|
+
Autocomplete.className = CLASSNAME$1i;
|
|
428
|
+
Autocomplete.defaultProps = DEFAULT_PROPS$19;
|
|
433
429
|
|
|
434
430
|
/**
|
|
435
431
|
* Component display name.
|
|
@@ -439,12 +435,12 @@ const COMPONENT_NAME$1j = 'AutocompleteMultiple';
|
|
|
439
435
|
/**
|
|
440
436
|
* Component default class name and class prefix.
|
|
441
437
|
*/
|
|
442
|
-
const CLASSNAME$
|
|
438
|
+
const CLASSNAME$1h = 'lumx-autocomplete-multiple';
|
|
443
439
|
|
|
444
440
|
/**
|
|
445
441
|
* Component default props.
|
|
446
442
|
*/
|
|
447
|
-
const DEFAULT_PROPS$
|
|
443
|
+
const DEFAULT_PROPS$18 = {
|
|
448
444
|
closeOnClickAway: true,
|
|
449
445
|
closeOnEscape: true,
|
|
450
446
|
selectedChipRender(choice, index, onClear, isDisabled) {
|
|
@@ -484,8 +480,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
484
480
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
485
481
|
chipsAlignment,
|
|
486
482
|
className,
|
|
487
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
488
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
483
|
+
closeOnClickAway = DEFAULT_PROPS$18.closeOnClickAway,
|
|
484
|
+
closeOnEscape = DEFAULT_PROPS$18.closeOnEscape,
|
|
489
485
|
fitToAnchorWidth,
|
|
490
486
|
hasError,
|
|
491
487
|
helper,
|
|
@@ -507,19 +503,19 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
507
503
|
onKeyDown,
|
|
508
504
|
placeholder,
|
|
509
505
|
placement,
|
|
510
|
-
selectedChipRender = DEFAULT_PROPS$
|
|
506
|
+
selectedChipRender = DEFAULT_PROPS$18.selectedChipRender,
|
|
511
507
|
shouldFocusOnClose,
|
|
512
508
|
theme = defaultTheme,
|
|
513
509
|
type,
|
|
514
510
|
value,
|
|
515
|
-
values = DEFAULT_PROPS$
|
|
511
|
+
values = DEFAULT_PROPS$18.values,
|
|
516
512
|
...forwardedProps
|
|
517
513
|
} = otherProps;
|
|
518
514
|
return /*#__PURE__*/jsx(Autocomplete, {
|
|
519
515
|
ref: ref,
|
|
520
516
|
...forwardedProps,
|
|
521
517
|
anchorToInput: anchorToInput,
|
|
522
|
-
className: classNames.join(className, CLASSNAME$
|
|
518
|
+
className: classNames.join(className, CLASSNAME$1h),
|
|
523
519
|
name: name,
|
|
524
520
|
value: value,
|
|
525
521
|
onChange: onChange,
|
|
@@ -553,8 +549,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
553
549
|
});
|
|
554
550
|
});
|
|
555
551
|
AutocompleteMultiple.displayName = COMPONENT_NAME$1j;
|
|
556
|
-
AutocompleteMultiple.className = CLASSNAME$
|
|
557
|
-
AutocompleteMultiple.defaultProps = DEFAULT_PROPS$
|
|
552
|
+
AutocompleteMultiple.className = CLASSNAME$1h;
|
|
553
|
+
AutocompleteMultiple.defaultProps = DEFAULT_PROPS$18;
|
|
558
554
|
|
|
559
555
|
/**
|
|
560
556
|
* Component display name.
|
|
@@ -564,16 +560,16 @@ const COMPONENT_NAME$1i = 'Avatar';
|
|
|
564
560
|
/**
|
|
565
561
|
* Component default class name and class prefix.
|
|
566
562
|
*/
|
|
567
|
-
const CLASSNAME$
|
|
563
|
+
const CLASSNAME$1g = 'lumx-avatar';
|
|
568
564
|
const {
|
|
569
|
-
block: block$
|
|
570
|
-
element: element$
|
|
571
|
-
} = classNames.bem(CLASSNAME$
|
|
565
|
+
block: block$13,
|
|
566
|
+
element: element$N
|
|
567
|
+
} = classNames.bem(CLASSNAME$1g);
|
|
572
568
|
|
|
573
569
|
/**
|
|
574
570
|
* Component default props.
|
|
575
571
|
*/
|
|
576
|
-
const DEFAULT_PROPS$
|
|
572
|
+
const DEFAULT_PROPS$17 = {
|
|
577
573
|
size: Size$1.m
|
|
578
574
|
};
|
|
579
575
|
|
|
@@ -596,7 +592,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
596
592
|
linkAs,
|
|
597
593
|
onClick,
|
|
598
594
|
onKeyPress,
|
|
599
|
-
size = DEFAULT_PROPS$
|
|
595
|
+
size = DEFAULT_PROPS$17.size,
|
|
600
596
|
theme = defaultTheme,
|
|
601
597
|
thumbnailProps,
|
|
602
598
|
...forwardedProps
|
|
@@ -604,14 +600,14 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
604
600
|
return /*#__PURE__*/jsxs("div", {
|
|
605
601
|
ref: ref,
|
|
606
602
|
...forwardedProps,
|
|
607
|
-
className: classNames.join(className, block$
|
|
603
|
+
className: classNames.join(className, block$13({
|
|
608
604
|
[`size-${size}`]: Boolean(size),
|
|
609
605
|
[`theme-${theme}`]: Boolean(theme)
|
|
610
606
|
})),
|
|
611
607
|
children: [/*#__PURE__*/jsx(Thumbnail, {
|
|
612
608
|
linkProps: linkProps,
|
|
613
609
|
linkAs: linkAs,
|
|
614
|
-
className: element$
|
|
610
|
+
className: element$N('thumbnail'),
|
|
615
611
|
onClick: onClick,
|
|
616
612
|
onKeyPress: onKeyPress,
|
|
617
613
|
...thumbnailProps,
|
|
@@ -621,17 +617,17 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
621
617
|
alt: alt,
|
|
622
618
|
theme: theme
|
|
623
619
|
}), actions && /*#__PURE__*/jsx("div", {
|
|
624
|
-
className: element$
|
|
620
|
+
className: element$N('actions'),
|
|
625
621
|
children: actions
|
|
626
622
|
}), badge && /*#__PURE__*/jsx("div", {
|
|
627
|
-
className: element$
|
|
623
|
+
className: element$N('badge'),
|
|
628
624
|
children: badge
|
|
629
625
|
})]
|
|
630
626
|
});
|
|
631
627
|
});
|
|
632
628
|
Avatar.displayName = COMPONENT_NAME$1i;
|
|
633
|
-
Avatar.className = CLASSNAME$
|
|
634
|
-
Avatar.defaultProps = DEFAULT_PROPS$
|
|
629
|
+
Avatar.className = CLASSNAME$1g;
|
|
630
|
+
Avatar.defaultProps = DEFAULT_PROPS$17;
|
|
635
631
|
|
|
636
632
|
/**
|
|
637
633
|
* Alignments.
|
|
@@ -699,6 +695,8 @@ const ColorPalette = {
|
|
|
699
695
|
red: 'red',
|
|
700
696
|
light: 'light'};
|
|
701
697
|
|
|
698
|
+
/** ColorPalette with all possible color variant combination */
|
|
699
|
+
|
|
702
700
|
function getDefaultExportFromCjs (x) {
|
|
703
701
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
704
702
|
}
|
|
@@ -859,7 +857,7 @@ function modifier$1(baseName, modifiers) {
|
|
|
859
857
|
* block('button', { active: true, disabled: false }); // 'button button--active'
|
|
860
858
|
*/
|
|
861
859
|
|
|
862
|
-
function block$
|
|
860
|
+
function block$12(baseName, modifiersOrAdditionalClasses, additionalClasses) {
|
|
863
861
|
let modifiers;
|
|
864
862
|
let classes;
|
|
865
863
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
@@ -894,11 +892,11 @@ function block$17(baseName, modifiersOrAdditionalClasses, additionalClasses) {
|
|
|
894
892
|
* element('my-button', 'icon', { active: true }); // 'my-button__icon my-button__icon--active'
|
|
895
893
|
*/
|
|
896
894
|
|
|
897
|
-
function element$
|
|
895
|
+
function element$M(baseClass, elem, modifiersOrAdditionalClasses, additionalClasses) {
|
|
898
896
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
899
|
-
return block$
|
|
897
|
+
return block$12(`${baseClass}__${elem}`, modifiersOrAdditionalClasses);
|
|
900
898
|
}
|
|
901
|
-
return block$
|
|
899
|
+
return block$12(`${baseClass}__${elem}`, modifiersOrAdditionalClasses, additionalClasses);
|
|
902
900
|
}
|
|
903
901
|
|
|
904
902
|
/**
|
|
@@ -907,15 +905,15 @@ function element$R(baseClass, elem, modifiersOrAdditionalClasses, additionalClas
|
|
|
907
905
|
function bem(baseName) {
|
|
908
906
|
function blockFn(modifiersOrAdditionalClasses, additionalClasses) {
|
|
909
907
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
910
|
-
return block$
|
|
908
|
+
return block$12(baseName, modifiersOrAdditionalClasses);
|
|
911
909
|
}
|
|
912
|
-
return block$
|
|
910
|
+
return block$12(baseName, modifiersOrAdditionalClasses, additionalClasses);
|
|
913
911
|
}
|
|
914
912
|
function elementFn(elem, modifiersOrAdditionalClasses, additionalClasses) {
|
|
915
913
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
916
|
-
return element$
|
|
914
|
+
return element$M(baseName, elem, modifiersOrAdditionalClasses);
|
|
917
915
|
}
|
|
918
|
-
return element$
|
|
916
|
+
return element$M(baseName, elem, modifiersOrAdditionalClasses, additionalClasses);
|
|
919
917
|
}
|
|
920
918
|
return {
|
|
921
919
|
block: blockFn,
|
|
@@ -932,15 +930,15 @@ const COMPONENT_NAME$1h = 'Badge';
|
|
|
932
930
|
/**
|
|
933
931
|
* Component default class name and class prefix.
|
|
934
932
|
*/
|
|
935
|
-
const CLASSNAME$
|
|
933
|
+
const CLASSNAME$1f = 'lumx-badge';
|
|
936
934
|
const {
|
|
937
|
-
block: block$
|
|
938
|
-
} = bem(CLASSNAME$
|
|
935
|
+
block: block$11
|
|
936
|
+
} = bem(CLASSNAME$1f);
|
|
939
937
|
|
|
940
938
|
/**
|
|
941
939
|
* Component default props.
|
|
942
940
|
*/
|
|
943
|
-
const DEFAULT_PROPS$
|
|
941
|
+
const DEFAULT_PROPS$16 = {
|
|
944
942
|
color: ColorPalette.primary
|
|
945
943
|
};
|
|
946
944
|
|
|
@@ -954,22 +952,22 @@ const Badge$1 = props => {
|
|
|
954
952
|
const {
|
|
955
953
|
children,
|
|
956
954
|
className,
|
|
957
|
-
color = DEFAULT_PROPS$
|
|
955
|
+
color = DEFAULT_PROPS$16.color,
|
|
958
956
|
ref,
|
|
959
957
|
...forwardedProps
|
|
960
958
|
} = props;
|
|
961
959
|
return /*#__PURE__*/jsx("div", {
|
|
962
960
|
ref: ref,
|
|
963
961
|
...forwardedProps,
|
|
964
|
-
className: classnames(className, block$
|
|
962
|
+
className: classnames(className, block$11({
|
|
965
963
|
[`color-${color}`]: Boolean(color)
|
|
966
964
|
})),
|
|
967
965
|
children: children
|
|
968
966
|
});
|
|
969
967
|
};
|
|
970
968
|
Badge$1.displayName = COMPONENT_NAME$1h;
|
|
971
|
-
Badge$1.className = CLASSNAME$
|
|
972
|
-
Badge$1.defaultProps = DEFAULT_PROPS$
|
|
969
|
+
Badge$1.className = CLASSNAME$1f;
|
|
970
|
+
Badge$1.defaultProps = DEFAULT_PROPS$16;
|
|
973
971
|
|
|
974
972
|
/**
|
|
975
973
|
* Defines the props of the component.
|
|
@@ -993,11 +991,11 @@ Badge.className = Badge$1.className;
|
|
|
993
991
|
Badge.defaultProps = Badge$1.defaultProps;
|
|
994
992
|
|
|
995
993
|
const COMPONENT_NAME$1g = 'BadgeWrapper';
|
|
996
|
-
const CLASSNAME$
|
|
994
|
+
const CLASSNAME$1e = 'lumx-badge-wrapper';
|
|
997
995
|
const {
|
|
998
|
-
block: block$
|
|
999
|
-
element: element$
|
|
1000
|
-
} = bem(CLASSNAME$
|
|
996
|
+
block: block$10,
|
|
997
|
+
element: element$L
|
|
998
|
+
} = bem(CLASSNAME$1e);
|
|
1001
999
|
const BadgeWrapper$1 = props => {
|
|
1002
1000
|
const {
|
|
1003
1001
|
badge,
|
|
@@ -1009,9 +1007,9 @@ const BadgeWrapper$1 = props => {
|
|
|
1009
1007
|
return /*#__PURE__*/jsxs("div", {
|
|
1010
1008
|
ref: ref,
|
|
1011
1009
|
...forwardedProps,
|
|
1012
|
-
className: classnames(className, block$
|
|
1010
|
+
className: classnames(className, block$10()),
|
|
1013
1011
|
children: [children, badge && /*#__PURE__*/jsx("div", {
|
|
1014
|
-
className: element$
|
|
1012
|
+
className: element$L('badge'),
|
|
1015
1013
|
children: badge
|
|
1016
1014
|
})]
|
|
1017
1015
|
});
|
|
@@ -1024,7 +1022,7 @@ const BadgeWrapper = forwardRef((props, ref) => {
|
|
|
1024
1022
|
});
|
|
1025
1023
|
});
|
|
1026
1024
|
BadgeWrapper.displayName = COMPONENT_NAME$1g;
|
|
1027
|
-
BadgeWrapper.className = CLASSNAME$
|
|
1025
|
+
BadgeWrapper.className = CLASSNAME$1e;
|
|
1028
1026
|
|
|
1029
1027
|
/**
|
|
1030
1028
|
* Render clickable element (link, button or custom element)
|
|
@@ -1185,15 +1183,15 @@ const COMPONENT_NAME$1e = 'Button';
|
|
|
1185
1183
|
/**
|
|
1186
1184
|
* Component default class name and class prefix.
|
|
1187
1185
|
*/
|
|
1188
|
-
const CLASSNAME$
|
|
1186
|
+
const CLASSNAME$1d = 'lumx-button';
|
|
1189
1187
|
const {
|
|
1190
1188
|
modifier
|
|
1191
|
-
} = bem(CLASSNAME$
|
|
1189
|
+
} = bem(CLASSNAME$1d);
|
|
1192
1190
|
|
|
1193
1191
|
/**
|
|
1194
1192
|
* Component default props.
|
|
1195
1193
|
*/
|
|
1196
|
-
const DEFAULT_PROPS$
|
|
1194
|
+
const DEFAULT_PROPS$15 = {
|
|
1197
1195
|
emphasis: Emphasis.high,
|
|
1198
1196
|
size: Size.m
|
|
1199
1197
|
};
|
|
@@ -1207,10 +1205,10 @@ const DEFAULT_PROPS$16 = {
|
|
|
1207
1205
|
const Button$1 = props => {
|
|
1208
1206
|
const {
|
|
1209
1207
|
className,
|
|
1210
|
-
emphasis = DEFAULT_PROPS$
|
|
1208
|
+
emphasis = DEFAULT_PROPS$15.emphasis,
|
|
1211
1209
|
leftIcon,
|
|
1212
1210
|
rightIcon,
|
|
1213
|
-
size = DEFAULT_PROPS$
|
|
1211
|
+
size = DEFAULT_PROPS$15.size,
|
|
1214
1212
|
...forwardedProps
|
|
1215
1213
|
} = props;
|
|
1216
1214
|
const buttonClassName = classnames(className, modifier({
|
|
@@ -1226,8 +1224,8 @@ const Button$1 = props => {
|
|
|
1226
1224
|
});
|
|
1227
1225
|
};
|
|
1228
1226
|
Button$1.displayName = COMPONENT_NAME$1e;
|
|
1229
|
-
Button$1.className = CLASSNAME$
|
|
1230
|
-
Button$1.defaultProps = DEFAULT_PROPS$
|
|
1227
|
+
Button$1.className = CLASSNAME$1d;
|
|
1228
|
+
Button$1.defaultProps = DEFAULT_PROPS$15;
|
|
1231
1229
|
|
|
1232
1230
|
/**
|
|
1233
1231
|
* Properties of a component to use to determine it's name.
|
|
@@ -1294,8 +1292,8 @@ const Button = forwardRef((props, ref) => {
|
|
|
1294
1292
|
});
|
|
1295
1293
|
});
|
|
1296
1294
|
Button.displayName = COMPONENT_NAME$1e;
|
|
1297
|
-
Button.className = CLASSNAME$
|
|
1298
|
-
Button.defaultProps = DEFAULT_PROPS$
|
|
1295
|
+
Button.className = CLASSNAME$1d;
|
|
1296
|
+
Button.defaultProps = DEFAULT_PROPS$15;
|
|
1299
1297
|
|
|
1300
1298
|
const COMPONENT_NAME$1d = 'Icon';
|
|
1301
1299
|
const IconClassName = 'lumx-icon';
|
|
@@ -1304,15 +1302,15 @@ const IconClassName = 'lumx-icon';
|
|
|
1304
1302
|
* Defines the props of the component.
|
|
1305
1303
|
*/
|
|
1306
1304
|
|
|
1307
|
-
const CLASSNAME$
|
|
1305
|
+
const CLASSNAME$1c = IconClassName;
|
|
1308
1306
|
const {
|
|
1309
|
-
block: block
|
|
1310
|
-
} = bem(CLASSNAME$
|
|
1307
|
+
block: block$$
|
|
1308
|
+
} = bem(CLASSNAME$1c);
|
|
1311
1309
|
|
|
1312
1310
|
/**
|
|
1313
1311
|
* Component default props.
|
|
1314
1312
|
*/
|
|
1315
|
-
const DEFAULT_PROPS$
|
|
1313
|
+
const DEFAULT_PROPS$14 = {};
|
|
1316
1314
|
|
|
1317
1315
|
/**
|
|
1318
1316
|
* Icon component.
|
|
@@ -1361,7 +1359,7 @@ const Icon$1 = props => {
|
|
|
1361
1359
|
return /*#__PURE__*/jsx("i", {
|
|
1362
1360
|
ref: ref,
|
|
1363
1361
|
...forwardedProps,
|
|
1364
|
-
className: classnames(className, block
|
|
1362
|
+
className: classnames(className, block$$({
|
|
1365
1363
|
[`color-${iconColor}`]: Boolean(iconColor),
|
|
1366
1364
|
[`color-variant-${iconColorVariant}`]: Boolean(iconColorVariant),
|
|
1367
1365
|
'has-shape': hasShape,
|
|
@@ -1391,8 +1389,8 @@ const Icon$1 = props => {
|
|
|
1391
1389
|
});
|
|
1392
1390
|
};
|
|
1393
1391
|
Icon$1.displayName = COMPONENT_NAME$1d;
|
|
1394
|
-
Icon$1.className = CLASSNAME$
|
|
1395
|
-
Icon$1.defaultProps = DEFAULT_PROPS$
|
|
1392
|
+
Icon$1.className = CLASSNAME$1c;
|
|
1393
|
+
Icon$1.defaultProps = DEFAULT_PROPS$14;
|
|
1396
1394
|
|
|
1397
1395
|
/**
|
|
1398
1396
|
* Component display name.
|
|
@@ -1402,12 +1400,12 @@ const COMPONENT_NAME$1c = 'IconButton';
|
|
|
1402
1400
|
/**
|
|
1403
1401
|
* Component default class name and class prefix.
|
|
1404
1402
|
*/
|
|
1405
|
-
const CLASSNAME$
|
|
1403
|
+
const CLASSNAME$1b = 'lumx-icon-button';
|
|
1406
1404
|
|
|
1407
1405
|
/**
|
|
1408
1406
|
* Component default props.
|
|
1409
1407
|
*/
|
|
1410
|
-
const DEFAULT_PROPS$
|
|
1408
|
+
const DEFAULT_PROPS$13 = {
|
|
1411
1409
|
emphasis: Emphasis.high,
|
|
1412
1410
|
size: Size.m
|
|
1413
1411
|
};
|
|
@@ -1420,11 +1418,11 @@ const DEFAULT_PROPS$14 = {
|
|
|
1420
1418
|
*/
|
|
1421
1419
|
const IconButton$1 = props => {
|
|
1422
1420
|
const {
|
|
1423
|
-
emphasis = DEFAULT_PROPS$
|
|
1421
|
+
emphasis = DEFAULT_PROPS$13.emphasis,
|
|
1424
1422
|
image,
|
|
1425
1423
|
icon,
|
|
1426
1424
|
label,
|
|
1427
|
-
size = DEFAULT_PROPS$
|
|
1425
|
+
size = DEFAULT_PROPS$13.size,
|
|
1428
1426
|
...forwardedProps
|
|
1429
1427
|
} = props;
|
|
1430
1428
|
const defaultChildren = image ? /*#__PURE__*/jsx("img", {
|
|
@@ -1444,8 +1442,8 @@ const IconButton$1 = props => {
|
|
|
1444
1442
|
});
|
|
1445
1443
|
};
|
|
1446
1444
|
IconButton$1.displayName = COMPONENT_NAME$1c;
|
|
1447
|
-
IconButton$1.className = CLASSNAME$
|
|
1448
|
-
IconButton$1.defaultProps = DEFAULT_PROPS$
|
|
1445
|
+
IconButton$1.className = CLASSNAME$1b;
|
|
1446
|
+
IconButton$1.defaultProps = DEFAULT_PROPS$13;
|
|
1449
1447
|
|
|
1450
1448
|
/**
|
|
1451
1449
|
* IconButton component.
|
|
@@ -1481,8 +1479,8 @@ const IconButton = forwardRef((props, ref) => {
|
|
|
1481
1479
|
});
|
|
1482
1480
|
});
|
|
1483
1481
|
IconButton.displayName = COMPONENT_NAME$1c;
|
|
1484
|
-
IconButton.className = CLASSNAME$
|
|
1485
|
-
IconButton.defaultProps = DEFAULT_PROPS$
|
|
1482
|
+
IconButton.className = CLASSNAME$1b;
|
|
1483
|
+
IconButton.defaultProps = DEFAULT_PROPS$13;
|
|
1486
1484
|
|
|
1487
1485
|
/**
|
|
1488
1486
|
* Component display name.
|
|
@@ -1492,12 +1490,12 @@ const COMPONENT_NAME$1b = 'ButtonGroup';
|
|
|
1492
1490
|
/**
|
|
1493
1491
|
* Component default class name and class prefix.
|
|
1494
1492
|
*/
|
|
1495
|
-
const CLASSNAME$
|
|
1493
|
+
const CLASSNAME$1a = 'lumx-button-group';
|
|
1496
1494
|
|
|
1497
1495
|
/**
|
|
1498
1496
|
* Component default props.
|
|
1499
1497
|
*/
|
|
1500
|
-
const DEFAULT_PROPS$
|
|
1498
|
+
const DEFAULT_PROPS$12 = {};
|
|
1501
1499
|
|
|
1502
1500
|
/**
|
|
1503
1501
|
* ButtonGroup component.
|
|
@@ -1513,13 +1511,13 @@ const ButtonGroup$1 = props => {
|
|
|
1513
1511
|
} = props;
|
|
1514
1512
|
return /*#__PURE__*/jsx("div", {
|
|
1515
1513
|
...forwardedProps,
|
|
1516
|
-
className: classnames(className, CLASSNAME$
|
|
1514
|
+
className: classnames(className, CLASSNAME$1a),
|
|
1517
1515
|
children: children
|
|
1518
1516
|
});
|
|
1519
1517
|
};
|
|
1520
1518
|
ButtonGroup$1.displayName = COMPONENT_NAME$1b;
|
|
1521
|
-
ButtonGroup$1.className = CLASSNAME$
|
|
1522
|
-
ButtonGroup$1.defaultProps = DEFAULT_PROPS$
|
|
1519
|
+
ButtonGroup$1.className = CLASSNAME$1a;
|
|
1520
|
+
ButtonGroup$1.defaultProps = DEFAULT_PROPS$12;
|
|
1523
1521
|
|
|
1524
1522
|
/**
|
|
1525
1523
|
* ButtonGroup component.
|
|
@@ -1535,16 +1533,16 @@ const ButtonGroup = forwardRef((props, ref) => {
|
|
|
1535
1533
|
});
|
|
1536
1534
|
});
|
|
1537
1535
|
ButtonGroup.displayName = COMPONENT_NAME$1b;
|
|
1538
|
-
ButtonGroup.className = CLASSNAME$
|
|
1539
|
-
ButtonGroup.defaultProps = DEFAULT_PROPS$
|
|
1536
|
+
ButtonGroup.className = CLASSNAME$1a;
|
|
1537
|
+
ButtonGroup.defaultProps = DEFAULT_PROPS$12;
|
|
1540
1538
|
|
|
1541
1539
|
const COMPONENT_NAME$1a = 'InputLabel';
|
|
1542
1540
|
const InputLabelClassName = 'lumx-input-label';
|
|
1543
|
-
const CLASSNAME$
|
|
1541
|
+
const CLASSNAME$19 = InputLabelClassName;
|
|
1544
1542
|
const {
|
|
1545
|
-
block: block$
|
|
1546
|
-
} = bem(CLASSNAME$
|
|
1547
|
-
const DEFAULT_PROPS$
|
|
1543
|
+
block: block$_
|
|
1544
|
+
} = bem(CLASSNAME$19);
|
|
1545
|
+
const DEFAULT_PROPS$11 = {};
|
|
1548
1546
|
|
|
1549
1547
|
/**
|
|
1550
1548
|
* InputLabel component.
|
|
@@ -1564,7 +1562,7 @@ function InputLabel$1(props) {
|
|
|
1564
1562
|
ref: ref,
|
|
1565
1563
|
...forwardedProps,
|
|
1566
1564
|
htmlFor: htmlFor,
|
|
1567
|
-
className: classnames(className, block$
|
|
1565
|
+
className: classnames(className, block$_({
|
|
1568
1566
|
'is-required': isRequired,
|
|
1569
1567
|
[`theme-${theme}`]: Boolean(theme),
|
|
1570
1568
|
'has-custom-typography': Boolean(typography$1)
|
|
@@ -1573,8 +1571,8 @@ function InputLabel$1(props) {
|
|
|
1573
1571
|
});
|
|
1574
1572
|
}
|
|
1575
1573
|
InputLabel$1.displayName = COMPONENT_NAME$1a;
|
|
1576
|
-
InputLabel$1.className = CLASSNAME$
|
|
1577
|
-
InputLabel$1.defaultProps = DEFAULT_PROPS$
|
|
1574
|
+
InputLabel$1.className = CLASSNAME$19;
|
|
1575
|
+
InputLabel$1.defaultProps = DEFAULT_PROPS$11;
|
|
1578
1576
|
|
|
1579
1577
|
const INPUT_HELPER_CONFIGURATION = {
|
|
1580
1578
|
[Kind.error]: {
|
|
@@ -1595,15 +1593,15 @@ const InputHelperClassName = 'lumx-input-helper';
|
|
|
1595
1593
|
* Defines the props of the component.
|
|
1596
1594
|
*/
|
|
1597
1595
|
|
|
1598
|
-
const CLASSNAME$
|
|
1596
|
+
const CLASSNAME$18 = InputHelperClassName;
|
|
1599
1597
|
const {
|
|
1600
|
-
block: block$
|
|
1601
|
-
} = bem(CLASSNAME$
|
|
1598
|
+
block: block$Z
|
|
1599
|
+
} = bem(CLASSNAME$18);
|
|
1602
1600
|
|
|
1603
1601
|
/**
|
|
1604
1602
|
* Component default props.
|
|
1605
1603
|
*/
|
|
1606
|
-
const DEFAULT_PROPS$
|
|
1604
|
+
const DEFAULT_PROPS$10 = {
|
|
1607
1605
|
kind: Kind.info
|
|
1608
1606
|
};
|
|
1609
1607
|
|
|
@@ -1614,7 +1612,7 @@ function InputHelper$1(props) {
|
|
|
1614
1612
|
const {
|
|
1615
1613
|
children,
|
|
1616
1614
|
className,
|
|
1617
|
-
kind = DEFAULT_PROPS$
|
|
1615
|
+
kind = DEFAULT_PROPS$10.kind,
|
|
1618
1616
|
theme,
|
|
1619
1617
|
ref,
|
|
1620
1618
|
...forwardedProps
|
|
@@ -1625,7 +1623,7 @@ function InputHelper$1(props) {
|
|
|
1625
1623
|
return /*#__PURE__*/jsx("p", {
|
|
1626
1624
|
ref: ref,
|
|
1627
1625
|
...forwardedProps,
|
|
1628
|
-
className: classnames(className, block$
|
|
1626
|
+
className: classnames(className, block$Z({
|
|
1629
1627
|
[`color-${color}`]: Boolean(color),
|
|
1630
1628
|
[`theme-${theme}`]: Boolean(theme)
|
|
1631
1629
|
})),
|
|
@@ -1633,8 +1631,8 @@ function InputHelper$1(props) {
|
|
|
1633
1631
|
});
|
|
1634
1632
|
}
|
|
1635
1633
|
InputHelper$1.displayName = COMPONENT_NAME$19;
|
|
1636
|
-
InputHelper$1.className = CLASSNAME$
|
|
1637
|
-
InputHelper$1.defaultProps = DEFAULT_PROPS$
|
|
1634
|
+
InputHelper$1.className = CLASSNAME$18;
|
|
1635
|
+
InputHelper$1.defaultProps = DEFAULT_PROPS$10;
|
|
1638
1636
|
|
|
1639
1637
|
const INTERMEDIATE_STATE = 'intermediate';
|
|
1640
1638
|
|
|
@@ -1650,11 +1648,11 @@ const COMPONENT_NAME$18 = 'Checkbox';
|
|
|
1650
1648
|
/**
|
|
1651
1649
|
* Component default class name and class prefix.
|
|
1652
1650
|
*/
|
|
1653
|
-
const CLASSNAME$
|
|
1651
|
+
const CLASSNAME$17 = 'lumx-checkbox';
|
|
1654
1652
|
const {
|
|
1655
|
-
block: block$
|
|
1656
|
-
element: element$
|
|
1657
|
-
} = bem(CLASSNAME$
|
|
1653
|
+
block: block$Y,
|
|
1654
|
+
element: element$K
|
|
1655
|
+
} = bem(CLASSNAME$17);
|
|
1658
1656
|
|
|
1659
1657
|
/**
|
|
1660
1658
|
* Checkbox component.
|
|
@@ -1690,7 +1688,7 @@ const Checkbox$1 = props => {
|
|
|
1690
1688
|
return /*#__PURE__*/jsxs("div", {
|
|
1691
1689
|
ref: ref,
|
|
1692
1690
|
...forwardedProps,
|
|
1693
|
-
className: classnames(className, block$
|
|
1691
|
+
className: classnames(className, block$Y({
|
|
1694
1692
|
// Whether state is intermediate class name will "-checked"
|
|
1695
1693
|
'is-checked': intermediateState ? true : isChecked,
|
|
1696
1694
|
'is-disabled': isDisabled,
|
|
@@ -1698,12 +1696,12 @@ const Checkbox$1 = props => {
|
|
|
1698
1696
|
[`theme-${theme}`]: Boolean(theme)
|
|
1699
1697
|
})),
|
|
1700
1698
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1701
|
-
className: element$
|
|
1699
|
+
className: element$K('input-wrapper'),
|
|
1702
1700
|
children: [/*#__PURE__*/jsx("input", {
|
|
1703
1701
|
ref: inputRef,
|
|
1704
1702
|
type: "checkbox",
|
|
1705
1703
|
id: inputId,
|
|
1706
|
-
className: element$
|
|
1704
|
+
className: element$K('input-native'),
|
|
1707
1705
|
name: name,
|
|
1708
1706
|
value: value,
|
|
1709
1707
|
checked: isChecked,
|
|
@@ -1715,26 +1713,26 @@ const Checkbox$1 = props => {
|
|
|
1715
1713
|
} : {}),
|
|
1716
1714
|
...inputProps
|
|
1717
1715
|
}), /*#__PURE__*/jsxs("div", {
|
|
1718
|
-
className: element$
|
|
1716
|
+
className: element$K('input-placeholder'),
|
|
1719
1717
|
children: [/*#__PURE__*/jsx("div", {
|
|
1720
|
-
className: element$
|
|
1718
|
+
className: element$K('input-background')
|
|
1721
1719
|
}), /*#__PURE__*/jsx("div", {
|
|
1722
|
-
className: element$
|
|
1720
|
+
className: element$K('input-indicator'),
|
|
1723
1721
|
children: Icon$1({
|
|
1724
1722
|
icon: intermediateState ? mdiMinus : mdiCheck
|
|
1725
1723
|
})
|
|
1726
1724
|
})]
|
|
1727
1725
|
})]
|
|
1728
1726
|
}), /*#__PURE__*/jsxs("div", {
|
|
1729
|
-
className: element$
|
|
1727
|
+
className: element$K('content'),
|
|
1730
1728
|
children: [label && InputLabel$1({
|
|
1731
1729
|
htmlFor: inputId,
|
|
1732
|
-
className: element$
|
|
1730
|
+
className: element$K('label'),
|
|
1733
1731
|
theme,
|
|
1734
1732
|
children: label
|
|
1735
1733
|
}), helper && InputHelper$1({
|
|
1736
1734
|
id: `${inputId}-helper`,
|
|
1737
|
-
className: element$
|
|
1735
|
+
className: element$K('helper'),
|
|
1738
1736
|
theme,
|
|
1739
1737
|
children: helper
|
|
1740
1738
|
})]
|
|
@@ -1749,7 +1747,7 @@ const Checkbox$1 = props => {
|
|
|
1749
1747
|
/**
|
|
1750
1748
|
* Component default props.
|
|
1751
1749
|
*/
|
|
1752
|
-
const DEFAULT_PROPS
|
|
1750
|
+
const DEFAULT_PROPS$$ = {};
|
|
1753
1751
|
|
|
1754
1752
|
/**
|
|
1755
1753
|
* Checkbox component.
|
|
@@ -1810,8 +1808,8 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
1810
1808
|
});
|
|
1811
1809
|
});
|
|
1812
1810
|
Checkbox.displayName = COMPONENT_NAME$18;
|
|
1813
|
-
Checkbox.className = CLASSNAME$
|
|
1814
|
-
Checkbox.defaultProps = DEFAULT_PROPS
|
|
1811
|
+
Checkbox.className = CLASSNAME$17;
|
|
1812
|
+
Checkbox.defaultProps = DEFAULT_PROPS$$;
|
|
1815
1813
|
|
|
1816
1814
|
/**
|
|
1817
1815
|
* Wrap mouse event handler to stop event propagation.
|
|
@@ -1837,16 +1835,16 @@ const COMPONENT_NAME$17 = 'Chip';
|
|
|
1837
1835
|
/**
|
|
1838
1836
|
* Component default class name and class prefix.
|
|
1839
1837
|
*/
|
|
1840
|
-
const CLASSNAME$
|
|
1838
|
+
const CLASSNAME$16 = 'lumx-chip';
|
|
1841
1839
|
const {
|
|
1842
|
-
block: block$
|
|
1843
|
-
element: element$
|
|
1844
|
-
} = classNames.bem(CLASSNAME$
|
|
1840
|
+
block: block$X,
|
|
1841
|
+
element: element$J
|
|
1842
|
+
} = classNames.bem(CLASSNAME$16);
|
|
1845
1843
|
|
|
1846
1844
|
/**
|
|
1847
1845
|
* Component default props.
|
|
1848
1846
|
*/
|
|
1849
|
-
const DEFAULT_PROPS
|
|
1847
|
+
const DEFAULT_PROPS$_ = {
|
|
1850
1848
|
size: Size$1.m
|
|
1851
1849
|
};
|
|
1852
1850
|
|
|
@@ -1876,7 +1874,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1876
1874
|
onAfterClick,
|
|
1877
1875
|
onBeforeClick,
|
|
1878
1876
|
onClick,
|
|
1879
|
-
size = DEFAULT_PROPS
|
|
1877
|
+
size = DEFAULT_PROPS$_.size,
|
|
1880
1878
|
theme = defaultTheme,
|
|
1881
1879
|
href,
|
|
1882
1880
|
onKeyDown,
|
|
@@ -1907,7 +1905,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1907
1905
|
...forwardedProps,
|
|
1908
1906
|
href: !disabledStateProps.disabled ? href : undefined,
|
|
1909
1907
|
ref: ref,
|
|
1910
|
-
className: classNames.join(className, block$
|
|
1908
|
+
className: classNames.join(className, block$X({
|
|
1911
1909
|
'is-clickable': isClickable,
|
|
1912
1910
|
[`color-${chipColor}`]: Boolean(chipColor),
|
|
1913
1911
|
'is-disabled': isAnyDisabled,
|
|
@@ -1925,19 +1923,19 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1925
1923
|
/*#__PURE__*/
|
|
1926
1924
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1927
1925
|
jsx("div", {
|
|
1928
|
-
className: element$
|
|
1926
|
+
className: element$J('before', {
|
|
1929
1927
|
'is-clickable': hasBeforeClick
|
|
1930
1928
|
}),
|
|
1931
1929
|
onClick: handleOnBeforeClick,
|
|
1932
1930
|
children: before
|
|
1933
1931
|
}), /*#__PURE__*/jsx("div", {
|
|
1934
|
-
className: element$
|
|
1932
|
+
className: element$J('label'),
|
|
1935
1933
|
children: children
|
|
1936
1934
|
}), after &&
|
|
1937
1935
|
/*#__PURE__*/
|
|
1938
1936
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1939
1937
|
jsx("div", {
|
|
1940
|
-
className: element$
|
|
1938
|
+
className: element$J('after', {
|
|
1941
1939
|
'is-clickable': hasAfterClick
|
|
1942
1940
|
}),
|
|
1943
1941
|
onClick: handleOnAfterClick,
|
|
@@ -1947,8 +1945,8 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1947
1945
|
);
|
|
1948
1946
|
});
|
|
1949
1947
|
Chip.displayName = COMPONENT_NAME$17;
|
|
1950
|
-
Chip.className = CLASSNAME$
|
|
1951
|
-
Chip.defaultProps = DEFAULT_PROPS
|
|
1948
|
+
Chip.className = CLASSNAME$16;
|
|
1949
|
+
Chip.defaultProps = DEFAULT_PROPS$_;
|
|
1952
1950
|
|
|
1953
1951
|
const INITIAL_STATE_ACTIVE_CHIP = -1;
|
|
1954
1952
|
|
|
@@ -2004,7 +2002,7 @@ const useChipGroupNavigation = (chips, onChipDeleted, initialActiveChip = INITIA
|
|
|
2004
2002
|
/**
|
|
2005
2003
|
* Component default props.
|
|
2006
2004
|
*/
|
|
2007
|
-
const DEFAULT_PROPS$
|
|
2005
|
+
const DEFAULT_PROPS$Z = {};
|
|
2008
2006
|
|
|
2009
2007
|
/**
|
|
2010
2008
|
* Component display name.
|
|
@@ -2014,7 +2012,7 @@ const COMPONENT_NAME$16 = 'ChipGroup';
|
|
|
2014
2012
|
/**
|
|
2015
2013
|
* Component default class name and class prefix.
|
|
2016
2014
|
*/
|
|
2017
|
-
const CLASSNAME$
|
|
2015
|
+
const CLASSNAME$15 = 'lumx-chip-group';
|
|
2018
2016
|
|
|
2019
2017
|
/**
|
|
2020
2018
|
* ChipGroup component.
|
|
@@ -2033,13 +2031,13 @@ const InternalChipGroup = forwardRef((props, ref) => {
|
|
|
2033
2031
|
return /*#__PURE__*/jsx("div", {
|
|
2034
2032
|
ref: ref,
|
|
2035
2033
|
...forwardedProps,
|
|
2036
|
-
className: classNames.join(className, CLASSNAME$
|
|
2034
|
+
className: classNames.join(className, CLASSNAME$15),
|
|
2037
2035
|
children: children
|
|
2038
2036
|
});
|
|
2039
2037
|
});
|
|
2040
2038
|
InternalChipGroup.displayName = COMPONENT_NAME$16;
|
|
2041
|
-
InternalChipGroup.className = CLASSNAME$
|
|
2042
|
-
InternalChipGroup.defaultProps = DEFAULT_PROPS$
|
|
2039
|
+
InternalChipGroup.className = CLASSNAME$15;
|
|
2040
|
+
InternalChipGroup.defaultProps = DEFAULT_PROPS$Z;
|
|
2043
2041
|
const ChipGroup = Object.assign(InternalChipGroup, {
|
|
2044
2042
|
useChipGroupNavigation
|
|
2045
2043
|
});
|
|
@@ -2109,1793 +2107,119 @@ function useFocusLastChipOnBackspace(chipRefs, inputRef) {
|
|
|
2109
2107
|
evt.preventDefault();
|
|
2110
2108
|
|
|
2111
2109
|
// Focus the last enabled chip (if any exists)
|
|
2112
|
-
const lastChip = findPreviousEnabledChip();
|
|
2113
|
-
lastChip?.focus();
|
|
2114
|
-
};
|
|
2115
|
-
|
|
2116
|
-
// Attach keyboard event listener
|
|
2117
|
-
input.addEventListener('keydown', onKeyDown);
|
|
2118
|
-
|
|
2119
|
-
// Cleanup listener on unmount
|
|
2120
|
-
return () => {
|
|
2121
|
-
input.removeEventListener('keydown', onKeyDown);
|
|
2122
|
-
};
|
|
2123
|
-
}, [inputRef, findPreviousEnabledChip]);
|
|
2124
|
-
return {
|
|
2125
|
-
findPreviousEnabledChip
|
|
2126
|
-
};
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
/**
|
|
2130
|
-
* Component default class name and class prefix.
|
|
2131
|
-
*/
|
|
2132
|
-
const CLASSNAME$19 = 'lumx-selection-chip-group';
|
|
2133
|
-
const {
|
|
2134
|
-
block: block$$,
|
|
2135
|
-
element: element$N
|
|
2136
|
-
} = classNames.bem(CLASSNAME$19);
|
|
2137
|
-
|
|
2138
|
-
/**
|
|
2139
|
-
* SelectionChipGroup component.
|
|
2140
|
-
*
|
|
2141
|
-
* @param props Component props.
|
|
2142
|
-
* @param ref Component ref.
|
|
2143
|
-
* @return React element.
|
|
2144
|
-
*/
|
|
2145
|
-
const SelectionChipGroup = ({
|
|
2146
|
-
onChange,
|
|
2147
|
-
value,
|
|
2148
|
-
getOptionId,
|
|
2149
|
-
getOptionName,
|
|
2150
|
-
inputRef,
|
|
2151
|
-
inputLabel,
|
|
2152
|
-
renderChip,
|
|
2153
|
-
theme,
|
|
2154
|
-
isDisabled,
|
|
2155
|
-
chipTooltipLabel,
|
|
2156
|
-
label,
|
|
2157
|
-
...forwardedProps
|
|
2158
|
-
}) => {
|
|
2159
|
-
const chipRefs = React__default.useRef([]);
|
|
2160
|
-
const {
|
|
2161
|
-
findPreviousEnabledChip
|
|
2162
|
-
} = useFocusLastChipOnBackspace(chipRefs, inputRef);
|
|
2163
|
-
return /*#__PURE__*/jsx(ChipGroup, {
|
|
2164
|
-
role: "group",
|
|
2165
|
-
"aria-label": label,
|
|
2166
|
-
className: block$$(),
|
|
2167
|
-
...forwardedProps,
|
|
2168
|
-
children: value?.map((v, index) => {
|
|
2169
|
-
const name = getWithSelector(getOptionName, v);
|
|
2170
|
-
const id = getWithSelector(getOptionId, v);
|
|
2171
|
-
const onClick = () => {
|
|
2172
|
-
const newValue = [...value];
|
|
2173
|
-
const existingIndex = value.findIndex(vi => getWithSelector(getOptionId, vi) === id);
|
|
2174
|
-
if (existingIndex === -1) {
|
|
2175
|
-
return;
|
|
2176
|
-
}
|
|
2177
|
-
// Remove value
|
|
2178
|
-
newValue.splice(existingIndex, 1);
|
|
2179
|
-
onChange?.(newValue);
|
|
2180
|
-
};
|
|
2181
|
-
const onKeyDown = evt => {
|
|
2182
|
-
if (evt.key !== 'Backspace') {
|
|
2183
|
-
return;
|
|
2184
|
-
}
|
|
2185
|
-
// Activate (remove value) on Backspace pressed
|
|
2186
|
-
onClick();
|
|
2187
|
-
const previousChip = findPreviousEnabledChip(index - 1);
|
|
2188
|
-
const input = inputRef?.current;
|
|
2189
|
-
// Focus the previous chip or the input
|
|
2190
|
-
(previousChip || input)?.focus();
|
|
2191
|
-
};
|
|
2192
|
-
if (!chipRefs.current[index]) {
|
|
2193
|
-
chipRefs.current[index] = /*#__PURE__*/React__default.createRef();
|
|
2194
|
-
}
|
|
2195
|
-
const ref = chipRefs.current[index];
|
|
2196
|
-
const customChip = renderChip?.(v);
|
|
2197
|
-
const props = isComponentType(Chip)(customChip) ? customChip.props : undefined;
|
|
2198
|
-
const chipIsDisabled = props?.isDisabled || isDisabled;
|
|
2199
|
-
const chipName = typeof props?.children === 'string' ? props.children : name;
|
|
2200
|
-
const tooltipLabel = chipTooltipLabel(chipName);
|
|
2201
|
-
return /*#__PURE__*/jsx(Tooltip, {
|
|
2202
|
-
label: !chipIsDisabled ? tooltipLabel : undefined,
|
|
2203
|
-
closeMode: "hide",
|
|
2204
|
-
ariaLinkMode: "aria-labelledby",
|
|
2205
|
-
children: /*#__PURE__*/jsx(Chip, {
|
|
2206
|
-
...props,
|
|
2207
|
-
after: /*#__PURE__*/jsx(Icon, {
|
|
2208
|
-
icon: mdiClose
|
|
2209
|
-
}),
|
|
2210
|
-
className: element$N('chip', [props?.className]),
|
|
2211
|
-
size: "s",
|
|
2212
|
-
ref: ref,
|
|
2213
|
-
onClick: onClick,
|
|
2214
|
-
onKeyDown: onKeyDown,
|
|
2215
|
-
theme: theme,
|
|
2216
|
-
isDisabled: chipIsDisabled,
|
|
2217
|
-
tabIndex: chipIsDisabled ? -1 : 0,
|
|
2218
|
-
children: props?.children || name
|
|
2219
|
-
})
|
|
2220
|
-
}, id);
|
|
2221
|
-
})
|
|
2222
|
-
});
|
|
2223
|
-
};
|
|
2224
|
-
|
|
2225
|
-
/** Context to store the refs of the combobox elements */
|
|
2226
|
-
const ComboboxRefsContext = /*#__PURE__*/createContext({
|
|
2227
|
-
triggerRef: {
|
|
2228
|
-
current: null
|
|
2229
|
-
},
|
|
2230
|
-
anchorRef: {
|
|
2231
|
-
current: null
|
|
2232
|
-
}
|
|
2233
|
-
});
|
|
2234
|
-
/** Provider to store the required refs for the Combobox */
|
|
2235
|
-
const ComboboxRefsProvider = ({
|
|
2236
|
-
triggerRef,
|
|
2237
|
-
anchorRef,
|
|
2238
|
-
children
|
|
2239
|
-
}) => {
|
|
2240
|
-
const value = useMemo(() => ({
|
|
2241
|
-
triggerRef,
|
|
2242
|
-
anchorRef
|
|
2243
|
-
}), [triggerRef, anchorRef]);
|
|
2244
|
-
return /*#__PURE__*/jsx(ComboboxRefsContext.Provider, {
|
|
2245
|
-
value: value,
|
|
2246
|
-
children: children
|
|
2247
|
-
});
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
/** Retrieves the combobox elements references from context */
|
|
2251
|
-
const useComboboxRefs = () => {
|
|
2252
|
-
const refs = useContext(ComboboxRefsContext);
|
|
2253
|
-
if (!refs) {
|
|
2254
|
-
throw new Error('The useComboboxRefs hook must be called within a ComboboxRefsProvider');
|
|
2255
|
-
}
|
|
2256
|
-
return refs;
|
|
2257
|
-
};
|
|
2258
|
-
|
|
2259
|
-
/** Generate the combobox option id from the combobox id and the given id */
|
|
2260
|
-
const generateOptionId = (comboboxId, optionId) => `${comboboxId}-option-${optionId}`;
|
|
2261
|
-
|
|
2262
|
-
/** Verifies that the combobox registered option is an action */
|
|
2263
|
-
const isComboboxAction = option => Boolean(option?.isAction);
|
|
2264
|
-
|
|
2265
|
-
/** Verifies that the combobox registered option is the option's value */
|
|
2266
|
-
const isComboboxValue = option => {
|
|
2267
|
-
return !isComboboxAction(option);
|
|
2268
|
-
};
|
|
2269
|
-
|
|
2270
|
-
const comboboxId = `combobox-${uniqueId()}`;
|
|
2271
|
-
const initialState = {
|
|
2272
|
-
comboboxId,
|
|
2273
|
-
listboxId: `${comboboxId}-popover`,
|
|
2274
|
-
status: 'idle',
|
|
2275
|
-
isOpen: false,
|
|
2276
|
-
inputValue: '',
|
|
2277
|
-
showAll: true,
|
|
2278
|
-
options: {},
|
|
2279
|
-
type: 'listbox',
|
|
2280
|
-
optionsLength: 0
|
|
2281
|
-
};
|
|
2282
|
-
|
|
2283
|
-
/** Actions when the combobox opens. */
|
|
2284
|
-
const OPEN_COMBOBOX = (state, action) => {
|
|
2285
|
-
const {
|
|
2286
|
-
manual
|
|
2287
|
-
} = action.payload || {};
|
|
2288
|
-
// If the combobox was manually opened, show all suggestions
|
|
2289
|
-
return {
|
|
2290
|
-
...state,
|
|
2291
|
-
showAll: Boolean(manual),
|
|
2292
|
-
isOpen: true
|
|
2293
|
-
};
|
|
2294
|
-
};
|
|
2295
|
-
|
|
2296
|
-
/** Actions when the combobox closes */
|
|
2297
|
-
const CLOSE_COMBOBOX = state => {
|
|
2298
|
-
return {
|
|
2299
|
-
...state,
|
|
2300
|
-
showAll: true,
|
|
2301
|
-
isOpen: false
|
|
2302
|
-
};
|
|
2303
|
-
};
|
|
2304
|
-
|
|
2305
|
-
/** Actions on input update. */
|
|
2306
|
-
const SET_INPUT_VALUE = (state, action) => {
|
|
2307
|
-
return {
|
|
2308
|
-
...state,
|
|
2309
|
-
inputValue: action.payload,
|
|
2310
|
-
// When the user is changing the value, show only values that are related to the input value.
|
|
2311
|
-
showAll: false,
|
|
2312
|
-
isOpen: true
|
|
2313
|
-
};
|
|
2314
|
-
};
|
|
2315
|
-
|
|
2316
|
-
/** Register an option to the state */
|
|
2317
|
-
const ADD_OPTION = (state, action) => {
|
|
2318
|
-
const {
|
|
2319
|
-
id,
|
|
2320
|
-
option
|
|
2321
|
-
} = action.payload;
|
|
2322
|
-
const {
|
|
2323
|
-
options
|
|
2324
|
-
} = state;
|
|
2325
|
-
if (options[id]) {
|
|
2326
|
-
// Option already exists, return state unchanged
|
|
2327
|
-
return state;
|
|
2328
|
-
}
|
|
2329
|
-
const newOptions = {
|
|
2330
|
-
...options,
|
|
2331
|
-
[id]: option
|
|
2332
|
-
};
|
|
2333
|
-
let newType = state.type;
|
|
2334
|
-
if (isComboboxAction(option)) {
|
|
2335
|
-
newType = 'grid';
|
|
2336
|
-
}
|
|
2337
|
-
let newOptionsLength = state.optionsLength;
|
|
2338
|
-
if (isComboboxValue(option)) {
|
|
2339
|
-
newOptionsLength += 1;
|
|
2340
|
-
}
|
|
2341
|
-
return {
|
|
2342
|
-
...state,
|
|
2343
|
-
options: newOptions,
|
|
2344
|
-
type: newType,
|
|
2345
|
-
optionsLength: newOptionsLength
|
|
2346
|
-
};
|
|
2347
|
-
};
|
|
2348
|
-
|
|
2349
|
-
/** Remove an option from the state */
|
|
2350
|
-
const REMOVE_OPTION = (state, action) => {
|
|
2351
|
-
const {
|
|
2352
|
-
id
|
|
2353
|
-
} = action.payload;
|
|
2354
|
-
const {
|
|
2355
|
-
options
|
|
2356
|
-
} = state;
|
|
2357
|
-
const option = options[id];
|
|
2358
|
-
if (!options[id]) {
|
|
2359
|
-
// Option doesn't exist, return state unchanged
|
|
2360
|
-
return state;
|
|
2361
|
-
}
|
|
2362
|
-
const newOptions = {
|
|
2363
|
-
...options
|
|
2364
|
-
};
|
|
2365
|
-
delete newOptions[id];
|
|
2366
|
-
let newOptionsLength = state.optionsLength;
|
|
2367
|
-
if (isComboboxValue(option)) {
|
|
2368
|
-
newOptionsLength -= 1;
|
|
2369
|
-
}
|
|
2370
|
-
return {
|
|
2371
|
-
...state,
|
|
2372
|
-
options: newOptions,
|
|
2373
|
-
optionsLength: newOptionsLength
|
|
2374
|
-
};
|
|
2375
|
-
};
|
|
2376
|
-
|
|
2377
|
-
/** Reducers for each action type: */
|
|
2378
|
-
const REDUCERS = {
|
|
2379
|
-
OPEN_COMBOBOX,
|
|
2380
|
-
CLOSE_COMBOBOX,
|
|
2381
|
-
SET_INPUT_VALUE,
|
|
2382
|
-
ADD_OPTION,
|
|
2383
|
-
REMOVE_OPTION
|
|
2384
|
-
};
|
|
2385
|
-
|
|
2386
|
-
/** Main reducer */
|
|
2387
|
-
const reducer$1 = (state, action) => {
|
|
2388
|
-
return REDUCERS[action.type]?.(state, action) || state;
|
|
2389
|
-
};
|
|
2390
|
-
|
|
2391
|
-
/** Dispatch for the combobox component */
|
|
2392
|
-
|
|
2393
|
-
/** Context for the Combobox component */
|
|
2394
|
-
const ComboboxContext = /*#__PURE__*/React__default.createContext({
|
|
2395
|
-
...initialState,
|
|
2396
|
-
openOnFocus: false,
|
|
2397
|
-
openOnClick: false,
|
|
2398
|
-
selectionType: 'single',
|
|
2399
|
-
optionsLength: 0,
|
|
2400
|
-
onSelect: noop,
|
|
2401
|
-
onInputChange: noop,
|
|
2402
|
-
onOpen: noop,
|
|
2403
|
-
dispatch: noop,
|
|
2404
|
-
translations: {
|
|
2405
|
-
clearLabel: '',
|
|
2406
|
-
tryReloadLabel: '',
|
|
2407
|
-
showSuggestionsLabel: '',
|
|
2408
|
-
noResultsForInputLabel: input => input || '',
|
|
2409
|
-
loadingLabel: '',
|
|
2410
|
-
serviceUnavailableLabel: '',
|
|
2411
|
-
nbOptionsLabel: options => `${options}`
|
|
2412
|
-
}
|
|
2413
|
-
});
|
|
2414
|
-
|
|
2415
|
-
/** Context for a combobox section to store its unique id */
|
|
2416
|
-
const SectionContext = /*#__PURE__*/React__default.createContext({
|
|
2417
|
-
sectionId: ''
|
|
2418
|
-
});
|
|
2419
|
-
|
|
2420
|
-
/** Retrieve the current combobox state and actions */
|
|
2421
|
-
const useCombobox = () => {
|
|
2422
|
-
const comboboxContext = React__default.useContext(ComboboxContext);
|
|
2423
|
-
const {
|
|
2424
|
-
dispatch: movingFocusDispatch
|
|
2425
|
-
} = React__default.useContext(MovingFocusContext);
|
|
2426
|
-
const {
|
|
2427
|
-
onSelect,
|
|
2428
|
-
onInputChange,
|
|
2429
|
-
onOpen,
|
|
2430
|
-
dispatch,
|
|
2431
|
-
inputValue,
|
|
2432
|
-
...contextValues
|
|
2433
|
-
} = comboboxContext;
|
|
2434
|
-
const {
|
|
2435
|
-
triggerRef
|
|
2436
|
-
} = useComboboxRefs();
|
|
2437
|
-
|
|
2438
|
-
/** Action triggered when the listBox is closed without selecting any option */
|
|
2439
|
-
const handleClose = React__default.useCallback(() => {
|
|
2440
|
-
dispatch({
|
|
2441
|
-
type: 'CLOSE_COMBOBOX'
|
|
2442
|
-
});
|
|
2443
|
-
// Reset visual focus
|
|
2444
|
-
movingFocusDispatch({
|
|
2445
|
-
type: 'RESET_SELECTED_TAB_STOP'
|
|
2446
|
-
});
|
|
2447
|
-
}, [dispatch, movingFocusDispatch]);
|
|
2448
|
-
|
|
2449
|
-
// Handle callbacks on options mounted
|
|
2450
|
-
const [optionsMountedCallbacks, setOptionsMountedCallback] = React__default.useState();
|
|
2451
|
-
React__default.useEffect(() => {
|
|
2452
|
-
if (comboboxContext.optionsLength > 0 && optionsMountedCallbacks?.length) {
|
|
2453
|
-
const optionsArray = Object.values(comboboxContext.options);
|
|
2454
|
-
// Execute callbacks
|
|
2455
|
-
for (const callback of optionsMountedCallbacks) {
|
|
2456
|
-
callback(optionsArray);
|
|
2457
|
-
}
|
|
2458
|
-
setOptionsMountedCallback(undefined);
|
|
2459
|
-
}
|
|
2460
|
-
}, [comboboxContext.options, comboboxContext.optionsLength, optionsMountedCallbacks]);
|
|
2461
|
-
|
|
2462
|
-
/** Callback for when an option is selected */
|
|
2463
|
-
const handleSelected = React__default.useCallback((option, source) => {
|
|
2464
|
-
if (option?.isDisabled) {
|
|
2465
|
-
return;
|
|
2466
|
-
}
|
|
2467
|
-
if (isComboboxValue(option)) {
|
|
2468
|
-
/**
|
|
2469
|
-
* We only close the list if the selection type is single.
|
|
2470
|
-
* If it is multiple, we want to allow the user to continue
|
|
2471
|
-
* selecting multiple options.
|
|
2472
|
-
*/
|
|
2473
|
-
if (comboboxContext.selectionType !== 'multiple') {
|
|
2474
|
-
handleClose();
|
|
2475
|
-
}
|
|
2476
|
-
/** Call parent onSelect callback */
|
|
2477
|
-
if (onSelect) {
|
|
2478
|
-
onSelect(option);
|
|
2479
|
-
}
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
/** If the option itself has a custom action, also call it */
|
|
2483
|
-
if (option?.onSelect) {
|
|
2484
|
-
option.onSelect(option, source);
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
/** Reset focus on input */
|
|
2488
|
-
if (triggerRef?.current) {
|
|
2489
|
-
triggerRef.current?.focus();
|
|
2490
|
-
}
|
|
2491
|
-
}, [comboboxContext.selectionType, handleClose, onSelect, triggerRef]);
|
|
2492
|
-
|
|
2493
|
-
/** Callback for when the input must be updated */
|
|
2494
|
-
const handleInputChange = React__default.useCallback((value, ...args) => {
|
|
2495
|
-
// Update the local state
|
|
2496
|
-
dispatch({
|
|
2497
|
-
type: 'SET_INPUT_VALUE',
|
|
2498
|
-
payload: value
|
|
2499
|
-
});
|
|
2500
|
-
// If a callback if given, call it with the value
|
|
2501
|
-
if (onInputChange) {
|
|
2502
|
-
onInputChange(value, ...args);
|
|
2503
|
-
}
|
|
2504
|
-
// Reset visual focus
|
|
2505
|
-
movingFocusDispatch({
|
|
2506
|
-
type: 'RESET_SELECTED_TAB_STOP'
|
|
2507
|
-
});
|
|
2508
|
-
}, [dispatch, movingFocusDispatch, onInputChange]);
|
|
2509
|
-
|
|
2510
|
-
/**
|
|
2511
|
-
* Open the popover
|
|
2512
|
-
*
|
|
2513
|
-
* @returns a promise with the updated context once all options are mounted
|
|
2514
|
-
*/
|
|
2515
|
-
const handleOpen = React__default.useCallback(params => {
|
|
2516
|
-
/** update the local state */
|
|
2517
|
-
dispatch({
|
|
2518
|
-
type: 'OPEN_COMBOBOX',
|
|
2519
|
-
payload: params
|
|
2520
|
-
});
|
|
2521
|
-
/** If a parent callback was given, trigger it with state information */
|
|
2522
|
-
if (onOpen) {
|
|
2523
|
-
onOpen({
|
|
2524
|
-
currentValue: inputValue,
|
|
2525
|
-
manual: Boolean(params?.manual)
|
|
2526
|
-
});
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
// Promise resolving options on mount
|
|
2530
|
-
return new Promise(resolve => {
|
|
2531
|
-
// Append to the list of callback on options mounted
|
|
2532
|
-
setOptionsMountedCallback((callbacks = []) => {
|
|
2533
|
-
callbacks.push(resolve);
|
|
2534
|
-
return callbacks;
|
|
2535
|
-
});
|
|
2536
|
-
});
|
|
2537
|
-
}, [dispatch, inputValue, onOpen]);
|
|
2538
|
-
return React__default.useMemo(() => ({
|
|
2539
|
-
handleClose,
|
|
2540
|
-
handleOpen,
|
|
2541
|
-
handleInputChange,
|
|
2542
|
-
handleSelected,
|
|
2543
|
-
dispatch,
|
|
2544
|
-
inputValue,
|
|
2545
|
-
...contextValues
|
|
2546
|
-
}), [contextValues, dispatch, handleClose, handleInputChange, handleOpen, handleSelected, inputValue]);
|
|
2547
|
-
};
|
|
2548
|
-
|
|
2549
|
-
/**
|
|
2550
|
-
* Provide props for the semantic and behaviors the combobox trigger.
|
|
2551
|
-
*
|
|
2552
|
-
*
|
|
2553
|
-
*/
|
|
2554
|
-
function useComboboxTrigger({
|
|
2555
|
-
context,
|
|
2556
|
-
refs,
|
|
2557
|
-
onBlur,
|
|
2558
|
-
onFocus,
|
|
2559
|
-
onKeyDown
|
|
2560
|
-
}) {
|
|
2561
|
-
const {
|
|
2562
|
-
comboboxId,
|
|
2563
|
-
listboxId,
|
|
2564
|
-
isOpen,
|
|
2565
|
-
options,
|
|
2566
|
-
optionsLength,
|
|
2567
|
-
selectedIds,
|
|
2568
|
-
openOnFocus,
|
|
2569
|
-
handleClose,
|
|
2570
|
-
handleOpen,
|
|
2571
|
-
handleSelected,
|
|
2572
|
-
showEmptyState = false,
|
|
2573
|
-
showErrorState = false,
|
|
2574
|
-
status
|
|
2575
|
-
} = context;
|
|
2576
|
-
const highlightedId = useVirtualFocusParent(refs.triggerRef);
|
|
2577
|
-
const {
|
|
2578
|
-
dispatch: movingFocusDispatch
|
|
2579
|
-
} = React__default.useContext(MovingFocusContext);
|
|
2580
|
-
const isErrorStateDisplayed = showErrorState && isOpen && status === 'error';
|
|
2581
|
-
const isEmptyStateDisplayed = showEmptyState && isOpen && status === 'idle' && optionsLength === 0;
|
|
2582
|
-
const showPopover = isOpen && optionsLength > 0 || isEmptyStateDisplayed || isErrorStateDisplayed;
|
|
2583
|
-
|
|
2584
|
-
/**
|
|
2585
|
-
* A debounce close to use to leave time for the
|
|
2586
|
-
* listbox to process things before closing.
|
|
2587
|
-
* This can be useful when clicking an option to leave time for the
|
|
2588
|
-
* event to be processed before closing the popover.
|
|
2589
|
-
*/
|
|
2590
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2591
|
-
const debouncedClose = React__default.useCallback(debounce$1(handleClose, 200), []);
|
|
2592
|
-
|
|
2593
|
-
/** Cleanup any ongoing cleanup */
|
|
2594
|
-
React__default.useEffect(() => {
|
|
2595
|
-
return () => {
|
|
2596
|
-
if (debouncedClose?.cancel) {
|
|
2597
|
-
debouncedClose.cancel();
|
|
2598
|
-
}
|
|
2599
|
-
};
|
|
2600
|
-
}, [debouncedClose]);
|
|
2601
|
-
const handleBlur = React__default.useCallback(event => {
|
|
2602
|
-
debouncedClose();
|
|
2603
|
-
if (onBlur) {
|
|
2604
|
-
onBlur(event);
|
|
2605
|
-
}
|
|
2606
|
-
}, [debouncedClose, onBlur]);
|
|
2607
|
-
|
|
2608
|
-
/** Actions triggered when the input field is focused */
|
|
2609
|
-
const handleFocus = event => {
|
|
2610
|
-
// If the field is refocused in the process of closing, cancel close
|
|
2611
|
-
if (debouncedClose?.cancel) {
|
|
2612
|
-
debouncedClose.cancel();
|
|
2613
|
-
}
|
|
2614
|
-
if (onFocus) {
|
|
2615
|
-
onFocus(event);
|
|
2616
|
-
}
|
|
2617
|
-
/**
|
|
2618
|
-
* Only set the open on focus if the combobox isn't already opened.
|
|
2619
|
-
* This avoids the popover re-opening when an option is selected and the
|
|
2620
|
-
* field is refocused
|
|
2621
|
-
*/
|
|
2622
|
-
if (openOnFocus && !showPopover) {
|
|
2623
|
-
handleOpen({
|
|
2624
|
-
manual: true
|
|
2625
|
-
});
|
|
2626
|
-
}
|
|
2627
|
-
};
|
|
2628
|
-
const handleClick = () => {
|
|
2629
|
-
handleOpen({
|
|
2630
|
-
manual: true
|
|
2631
|
-
});
|
|
2632
|
-
};
|
|
2633
|
-
|
|
2634
|
-
/**
|
|
2635
|
-
* Keyboard shortcut management following the WAI APG pattern
|
|
2636
|
-
* https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/#kbd_label
|
|
2637
|
-
*/
|
|
2638
|
-
const handleKeyDown = React__default.useCallback(async event => {
|
|
2639
|
-
const {
|
|
2640
|
-
key,
|
|
2641
|
-
altKey
|
|
2642
|
-
} = event;
|
|
2643
|
-
|
|
2644
|
-
/**
|
|
2645
|
-
* On Enter key
|
|
2646
|
-
* * Select option that is currently highlighted, if any
|
|
2647
|
-
* * Close suggestions, event if none is highlighted
|
|
2648
|
-
*/
|
|
2649
|
-
if (event.key === 'Enter') {
|
|
2650
|
-
if (!showPopover) {
|
|
2651
|
-
return;
|
|
2652
|
-
}
|
|
2653
|
-
if (highlightedId) {
|
|
2654
|
-
// prevent any potential form submission
|
|
2655
|
-
event.preventDefault();
|
|
2656
|
-
const option = options[highlightedId];
|
|
2657
|
-
handleSelected(option, 'keyboard');
|
|
2658
|
-
} else {
|
|
2659
|
-
handleClose();
|
|
2660
|
-
}
|
|
2661
|
-
return;
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
/**
|
|
2665
|
-
* On arrow up/down
|
|
2666
|
-
* * If popover is already opened, do nothing
|
|
2667
|
-
* * If alt key pressed, show the listbox without focusing an option
|
|
2668
|
-
* * If arrow Up is pressed, select last option
|
|
2669
|
-
* * If arrow Down is pressed, select first option
|
|
2670
|
-
* */
|
|
2671
|
-
if (key === 'ArrowDown' || key === 'ArrowUp') {
|
|
2672
|
-
if (showPopover) {
|
|
2673
|
-
return;
|
|
2674
|
-
}
|
|
2675
|
-
|
|
2676
|
-
/** Open the listbox */
|
|
2677
|
-
const listBoxOptions = await handleOpen({
|
|
2678
|
-
manual: true
|
|
2679
|
-
});
|
|
2680
|
-
if (!listBoxOptions) {
|
|
2681
|
-
return;
|
|
2682
|
-
}
|
|
2683
|
-
|
|
2684
|
-
/**
|
|
2685
|
-
* If alt key is pressed, only open without changing visual focus
|
|
2686
|
-
* as per WAI Guidelines
|
|
2687
|
-
*/
|
|
2688
|
-
if (!altKey) {
|
|
2689
|
-
/** If a selected id is set, set it as current tabstop */
|
|
2690
|
-
if (selectedIds?.length) {
|
|
2691
|
-
movingFocusDispatch({
|
|
2692
|
-
type: 'SELECT_TAB_STOP',
|
|
2693
|
-
payload: {
|
|
2694
|
-
id: selectedIds?.[0],
|
|
2695
|
-
type: 'keyboard'
|
|
2696
|
-
}
|
|
2697
|
-
});
|
|
2698
|
-
} else {
|
|
2699
|
-
/** Focus either the first or last item depending on the keyboard arrow pressed */
|
|
2700
|
-
movingFocusDispatch({
|
|
2701
|
-
type: 'KEY_NAV',
|
|
2702
|
-
payload: {
|
|
2703
|
-
ctrlKey: false,
|
|
2704
|
-
key: key === 'ArrowUp' ? 'End' : 'Home'
|
|
2705
|
-
}
|
|
2706
|
-
});
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
return;
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
|
-
// Forward event
|
|
2713
|
-
onKeyDown?.(event);
|
|
2714
|
-
}, [onKeyDown, showPopover, highlightedId, options, handleSelected, handleClose, handleOpen, selectedIds, movingFocusDispatch]);
|
|
2715
|
-
return {
|
|
2716
|
-
id: comboboxId,
|
|
2717
|
-
role: 'combobox',
|
|
2718
|
-
'aria-activedescendant': showPopover && highlightedId ? highlightedId : '',
|
|
2719
|
-
'aria-controls': listboxId,
|
|
2720
|
-
'aria-owns': listboxId,
|
|
2721
|
-
'aria-expanded': showPopover,
|
|
2722
|
-
onFocus: handleFocus,
|
|
2723
|
-
onBlur: handleBlur,
|
|
2724
|
-
onClick: handleClick,
|
|
2725
|
-
onKeyDown: handleKeyDown
|
|
2726
|
-
};
|
|
2727
|
-
}
|
|
2728
|
-
|
|
2729
|
-
/** Is printable character key press */
|
|
2730
|
-
const isTypeEvent = ({
|
|
2731
|
-
key,
|
|
2732
|
-
altKey,
|
|
2733
|
-
ctrlKey,
|
|
2734
|
-
metaKey
|
|
2735
|
-
}) => key.length === 1 && key !== ' ' && !altKey && !ctrlKey && !metaKey;
|
|
2736
|
-
|
|
2737
|
-
/**
|
|
2738
|
-
* Provide props for the semantic and behaviors the combobox button trigger
|
|
2739
|
-
*
|
|
2740
|
-
* Overrides the useComboboxTrigger() props & behavior to add a jump to option
|
|
2741
|
-
* on printable character key down.
|
|
2742
|
-
*/
|
|
2743
|
-
function useComboboxButton(args) {
|
|
2744
|
-
const {
|
|
2745
|
-
context: {
|
|
2746
|
-
handleOpen
|
|
2747
|
-
},
|
|
2748
|
-
onKeyDown: parentOnKeyDown
|
|
2749
|
-
} = args;
|
|
2750
|
-
const {
|
|
2751
|
-
dispatch: movingFocusDispatch,
|
|
2752
|
-
state: {
|
|
2753
|
-
selectedId: highlightedId
|
|
2754
|
-
}
|
|
2755
|
-
} = React__default.useContext(MovingFocusContext);
|
|
2756
|
-
const searchValueRef = React__default.useRef('');
|
|
2757
|
-
const searchTimeoutRef = React__default.useRef();
|
|
2758
|
-
const onKeyDown = React__default.useMemo(() => {
|
|
2759
|
-
function clearSearchTimeout() {
|
|
2760
|
-
const searchTimeout = searchTimeoutRef.current;
|
|
2761
|
-
if (!searchTimeout) {
|
|
2762
|
-
return;
|
|
2763
|
-
}
|
|
2764
|
-
clearTimeout(searchTimeout);
|
|
2765
|
-
searchTimeoutRef.current = undefined;
|
|
2766
|
-
}
|
|
2767
|
-
function clearSearch() {
|
|
2768
|
-
searchValueRef.current = '';
|
|
2769
|
-
clearSearchTimeout();
|
|
2770
|
-
}
|
|
2771
|
-
return async event => {
|
|
2772
|
-
if (!isTypeEvent(event)) {
|
|
2773
|
-
// Forward key down event
|
|
2774
|
-
parentOnKeyDown?.(event);
|
|
2775
|
-
return undefined;
|
|
2776
|
-
}
|
|
2777
|
-
event.stopPropagation();
|
|
2778
|
-
|
|
2779
|
-
// Clear current search timeout
|
|
2780
|
-
clearSearchTimeout();
|
|
2781
|
-
|
|
2782
|
-
// Open combobox and wait for options to mount
|
|
2783
|
-
const options = await handleOpen({
|
|
2784
|
-
manual: false
|
|
2785
|
-
});
|
|
2786
|
-
const optionArray = options && Object.values(options);
|
|
2787
|
-
if (!optionArray?.length) {
|
|
2788
|
-
return undefined;
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
// Append key to current search
|
|
2792
|
-
searchValueRef.current += event.key.toLowerCase();
|
|
2793
|
-
const searchValue = searchValueRef.current;
|
|
2794
|
-
|
|
2795
|
-
// Clear search after 500ms
|
|
2796
|
-
searchTimeoutRef.current = setTimeout(clearSearch, 500);
|
|
2797
|
-
|
|
2798
|
-
// Search is containing all the same letters (ex: aaaa)
|
|
2799
|
-
const allTheSameLetters = searchValue.split('').every(letter => letter === searchValue[0]);
|
|
2800
|
-
|
|
2801
|
-
// start from currently selected option
|
|
2802
|
-
let startIndex = optionArray.findIndex(option => option.generatedId === highlightedId);
|
|
2803
|
-
if (startIndex === -1) {
|
|
2804
|
-
startIndex = 0;
|
|
2805
|
-
}
|
|
2806
|
-
let index = startIndex;
|
|
2807
|
-
do {
|
|
2808
|
-
// Increment index and loop around to 0 if we get over the array length
|
|
2809
|
-
index = (index + 1) % optionArray.length;
|
|
2810
|
-
const option = optionArray[index];
|
|
2811
|
-
// Search by text value or fallback on id.
|
|
2812
|
-
const optionText = isComboboxValue(option) ? option?.textValue || option?.id : null;
|
|
2813
|
-
if (isComboboxValue(option) && optionText) {
|
|
2814
|
-
const optionTextValue = optionText.toLowerCase();
|
|
2815
|
-
|
|
2816
|
-
// Search on first letter if search is all the same letters
|
|
2817
|
-
const searchText = allTheSameLetters ? searchValue[0] : searchValue;
|
|
2818
|
-
|
|
2819
|
-
// Option text value starts with searched text
|
|
2820
|
-
if (optionTextValue.startsWith(searchText)) {
|
|
2821
|
-
movingFocusDispatch({
|
|
2822
|
-
type: 'SELECT_TAB_STOP',
|
|
2823
|
-
payload: {
|
|
2824
|
-
id: option.generatedId,
|
|
2825
|
-
type: 'keyboard'
|
|
2826
|
-
}
|
|
2827
|
-
});
|
|
2828
|
-
break;
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
} while (index !== startIndex);
|
|
2832
|
-
return clearSearchTimeout;
|
|
2833
|
-
};
|
|
2834
|
-
}, [handleOpen, parentOnKeyDown, highlightedId, movingFocusDispatch]);
|
|
2835
|
-
return useComboboxTrigger({
|
|
2836
|
-
...args,
|
|
2837
|
-
onKeyDown
|
|
2838
|
-
});
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
|
-
/**
|
|
2842
|
-
* Combobox button trigger.
|
|
2843
|
-
*
|
|
2844
|
-
* @family Combobox
|
|
2845
|
-
*/
|
|
2846
|
-
const ComboboxButton = forwardRef((props, ref) => {
|
|
2847
|
-
const {
|
|
2848
|
-
as,
|
|
2849
|
-
label,
|
|
2850
|
-
onFocus,
|
|
2851
|
-
onBlur,
|
|
2852
|
-
labelDisplayMode = 'show-selection',
|
|
2853
|
-
...forwardedProps
|
|
2854
|
-
} = props;
|
|
2855
|
-
const refs = useComboboxRefs();
|
|
2856
|
-
const context = useCombobox();
|
|
2857
|
-
const buttonProps = useComboboxButton({
|
|
2858
|
-
context,
|
|
2859
|
-
refs,
|
|
2860
|
-
onBlur,
|
|
2861
|
-
onFocus
|
|
2862
|
-
});
|
|
2863
|
-
const Element = as || Button;
|
|
2864
|
-
const showSelection = labelDisplayMode === 'show-selection';
|
|
2865
|
-
const tooltipOnly = labelDisplayMode === 'show-tooltip';
|
|
2866
|
-
const selectionLabel = showSelection && context.selectedIds?.length && context.inputValue;
|
|
2867
|
-
let content = null;
|
|
2868
|
-
if (!tooltipOnly) {
|
|
2869
|
-
// Display selection label or label
|
|
2870
|
-
content = selectionLabel || label;
|
|
2871
|
-
}
|
|
2872
|
-
const hideTooltip =
|
|
2873
|
-
// Hide tooltip if the displayed label and tooltip label are the same
|
|
2874
|
-
label === content ||
|
|
2875
|
-
// Hide tooltip when the combobox is open
|
|
2876
|
-
context.isOpen;
|
|
2877
|
-
const mergedRefs = useMergeRefs(ref, refs.triggerRef, refs.anchorRef);
|
|
2878
|
-
return /*#__PURE__*/jsx(Tooltip, {
|
|
2879
|
-
className: hideTooltip ? visuallyHidden() : undefined,
|
|
2880
|
-
label: label,
|
|
2881
|
-
closeMode: "hide",
|
|
2882
|
-
ariaLinkMode: "aria-labelledby",
|
|
2883
|
-
children: /*#__PURE__*/jsx(Element, {
|
|
2884
|
-
ref: mergedRefs,
|
|
2885
|
-
...forwardedProps,
|
|
2886
|
-
...buttonProps,
|
|
2887
|
-
children: content
|
|
2888
|
-
})
|
|
2889
|
-
});
|
|
2890
|
-
});
|
|
2891
|
-
|
|
2892
|
-
const CLASSNAME$18 = 'lumx-combobox-divider';
|
|
2893
|
-
|
|
2894
|
-
/** Combobox option divider */
|
|
2895
|
-
function ComboboxDivider() {
|
|
2896
|
-
return /*#__PURE__*/jsx(ListDivider, {
|
|
2897
|
-
className: CLASSNAME$18,
|
|
2898
|
-
role: "presentation"
|
|
2899
|
-
});
|
|
2900
|
-
}
|
|
2901
|
-
|
|
2902
|
-
/**
|
|
2903
|
-
* Provide props for the semantic and behaviors the combobox input trigger
|
|
2904
|
-
*
|
|
2905
|
-
* Overrides the useComboboxTrigger() props & behavior to prevent open on click
|
|
2906
|
-
* if `openOnFocus` is not enabled.
|
|
2907
|
-
*/
|
|
2908
|
-
function useComboboxInput({
|
|
2909
|
-
onKeyDown: propsOnKeyDown,
|
|
2910
|
-
...args
|
|
2911
|
-
}) {
|
|
2912
|
-
const triggerProps = useComboboxTrigger(args);
|
|
2913
|
-
const {
|
|
2914
|
-
onClick,
|
|
2915
|
-
onKeyDown,
|
|
2916
|
-
'aria-expanded': showPopover
|
|
2917
|
-
} = triggerProps;
|
|
2918
|
-
const handleClick = () => {
|
|
2919
|
-
if (!args.context.openOnFocus && !args.context.openOnClick) {
|
|
2920
|
-
// Skip if input should not opening on focus nor click
|
|
2921
|
-
return;
|
|
2922
|
-
}
|
|
2923
|
-
onClick();
|
|
2924
|
-
};
|
|
2925
|
-
const handleKeyDown = evt => {
|
|
2926
|
-
if (evt.key === 'Escape') {
|
|
2927
|
-
// Reset field if closed
|
|
2928
|
-
if (!showPopover) {
|
|
2929
|
-
args.context.handleInputChange('');
|
|
2930
|
-
}
|
|
2931
|
-
return;
|
|
2932
|
-
}
|
|
2933
|
-
onKeyDown(evt);
|
|
2934
|
-
if (propsOnKeyDown) {
|
|
2935
|
-
propsOnKeyDown(evt);
|
|
2936
|
-
}
|
|
2937
|
-
};
|
|
2938
|
-
return {
|
|
2939
|
-
...triggerProps,
|
|
2940
|
-
onClick: handleClick,
|
|
2941
|
-
onKeyDown: handleKeyDown
|
|
2942
|
-
};
|
|
2943
|
-
}
|
|
2944
|
-
|
|
2945
|
-
/**
|
|
2946
|
-
* Combobox input trigger.
|
|
2947
|
-
*
|
|
2948
|
-
* @family Combobox
|
|
2949
|
-
*/
|
|
2950
|
-
const ComboboxInput = ({
|
|
2951
|
-
hideToggle,
|
|
2952
|
-
inputRef,
|
|
2953
|
-
textFieldRef,
|
|
2954
|
-
afterElement,
|
|
2955
|
-
onFocus,
|
|
2956
|
-
onBlur,
|
|
2957
|
-
onKeyDown,
|
|
2958
|
-
clearButtonProps,
|
|
2959
|
-
hasClearButton,
|
|
2960
|
-
theme,
|
|
2961
|
-
...textFieldProps
|
|
2962
|
-
}) => {
|
|
2963
|
-
const refs = useComboboxRefs();
|
|
2964
|
-
const context = useCombobox();
|
|
2965
|
-
const inputProps = useComboboxInput({
|
|
2966
|
-
refs,
|
|
2967
|
-
context,
|
|
2968
|
-
onBlur,
|
|
2969
|
-
onFocus,
|
|
2970
|
-
onKeyDown
|
|
2971
|
-
});
|
|
2972
|
-
const {
|
|
2973
|
-
listboxId,
|
|
2974
|
-
isOpen,
|
|
2975
|
-
handleOpen,
|
|
2976
|
-
handleClose,
|
|
2977
|
-
inputValue,
|
|
2978
|
-
handleInputChange
|
|
2979
|
-
} = context;
|
|
2980
|
-
|
|
2981
|
-
/** Callback for when the toggle button is trigged */
|
|
2982
|
-
const handleManualToggle = () => {
|
|
2983
|
-
if (isOpen) {
|
|
2984
|
-
handleClose();
|
|
2985
|
-
} else {
|
|
2986
|
-
handleOpen({
|
|
2987
|
-
manual: true
|
|
2988
|
-
});
|
|
2989
|
-
}
|
|
2990
|
-
refs.triggerRef?.current?.focus();
|
|
2991
|
-
};
|
|
2992
|
-
return /*#__PURE__*/jsx(TextField
|
|
2993
|
-
// Disable native autocomplete
|
|
2994
|
-
, {
|
|
2995
|
-
autoComplete: "off",
|
|
2996
|
-
...textFieldProps,
|
|
2997
|
-
inputRef: mergeRefs(refs.triggerRef, inputRef),
|
|
2998
|
-
textFieldRef: mergeRefs(refs.anchorRef, textFieldRef)
|
|
2999
|
-
// Combobox props
|
|
3000
|
-
,
|
|
3001
|
-
...inputProps,
|
|
3002
|
-
theme: theme,
|
|
3003
|
-
value: inputValue,
|
|
3004
|
-
onClear: () => handleInputChange(''),
|
|
3005
|
-
onChange: handleInputChange,
|
|
3006
|
-
clearButtonProps: hasClearButton ? {
|
|
3007
|
-
...clearButtonProps,
|
|
3008
|
-
label: context.translations.clearLabel
|
|
3009
|
-
} : undefined,
|
|
3010
|
-
afterElement: (!hideToggle || afterElement) && /*#__PURE__*/jsxs(Fragment, {
|
|
3011
|
-
children: [afterElement, !hideToggle && /*#__PURE__*/jsx(IconButton, {
|
|
3012
|
-
theme: theme,
|
|
3013
|
-
onClick: handleManualToggle,
|
|
3014
|
-
label: context.translations.showSuggestionsLabel,
|
|
3015
|
-
emphasis: Emphasis$1.low,
|
|
3016
|
-
size: Size$1.s,
|
|
3017
|
-
icon: inputProps['aria-expanded'] ? mdiChevronUp : mdiChevronDown,
|
|
3018
|
-
type: "button",
|
|
3019
|
-
tabIndex: -1,
|
|
3020
|
-
"aria-expanded": inputProps['aria-expanded'],
|
|
3021
|
-
"aria-haspopup": "listbox",
|
|
3022
|
-
"aria-controls": listboxId
|
|
3023
|
-
})]
|
|
3024
|
-
})
|
|
3025
|
-
});
|
|
3026
|
-
};
|
|
3027
|
-
|
|
3028
|
-
const ComboboxOptionContext = /*#__PURE__*/createContext({});
|
|
3029
|
-
/** Context Provider to store the current combobox option id. */
|
|
3030
|
-
const ComboboxOptionContextProvider = ({
|
|
3031
|
-
optionId,
|
|
3032
|
-
isKeyboardHighlighted,
|
|
3033
|
-
children
|
|
3034
|
-
}) => {
|
|
3035
|
-
const value = React__default.useMemo(() => ({
|
|
3036
|
-
optionId,
|
|
3037
|
-
isKeyboardHighlighted
|
|
3038
|
-
}), [optionId, isKeyboardHighlighted]);
|
|
3039
|
-
return /*#__PURE__*/jsx(ComboboxOptionContext.Provider, {
|
|
3040
|
-
value: value,
|
|
3041
|
-
children: children
|
|
3042
|
-
});
|
|
3043
|
-
};
|
|
3044
|
-
|
|
3045
|
-
/**
|
|
3046
|
-
* Retrieve the current combobox option id.
|
|
3047
|
-
* Must be used within a ComboboxOptionIdProvider
|
|
3048
|
-
*/
|
|
3049
|
-
const useComboboxOptionContext = () => {
|
|
3050
|
-
const comboboxOption = useContext(ComboboxOptionContext);
|
|
3051
|
-
if (!comboboxOption?.optionId) {
|
|
3052
|
-
throw new Error('This hook must be used within a ComboboxOptionIdProvider');
|
|
3053
|
-
}
|
|
3054
|
-
return comboboxOption;
|
|
3055
|
-
};
|
|
3056
|
-
|
|
3057
|
-
/** Retrieve the current combobox section id */
|
|
3058
|
-
const useComboboxSectionId = () => {
|
|
3059
|
-
return useContext(SectionContext);
|
|
3060
|
-
};
|
|
3061
|
-
|
|
3062
|
-
/**
|
|
3063
|
-
* Register the given option to the context
|
|
3064
|
-
*/
|
|
3065
|
-
const useRegisterOption = (registerId, option, shouldRegister) => {
|
|
3066
|
-
const {
|
|
3067
|
-
dispatch
|
|
3068
|
-
} = useCombobox();
|
|
3069
|
-
|
|
3070
|
-
/** Register the given options */
|
|
3071
|
-
React__default.useEffect(() => {
|
|
3072
|
-
if (option && shouldRegister) {
|
|
3073
|
-
dispatch({
|
|
3074
|
-
type: 'ADD_OPTION',
|
|
3075
|
-
payload: {
|
|
3076
|
-
id: registerId,
|
|
3077
|
-
option
|
|
3078
|
-
}
|
|
3079
|
-
});
|
|
3080
|
-
}
|
|
3081
|
-
|
|
3082
|
-
// Unregister ids if/when the component unmounts or if option changes
|
|
3083
|
-
return () => {
|
|
3084
|
-
if (option) {
|
|
3085
|
-
dispatch({
|
|
3086
|
-
type: 'REMOVE_OPTION',
|
|
3087
|
-
payload: {
|
|
3088
|
-
id: registerId
|
|
3089
|
-
}
|
|
3090
|
-
});
|
|
3091
|
-
}
|
|
3092
|
-
};
|
|
3093
|
-
}, [dispatch, option, registerId, shouldRegister]);
|
|
3094
|
-
};
|
|
3095
|
-
|
|
3096
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
3097
|
-
const CLASSNAME$17 = 'lumx-combobox-option';
|
|
3098
|
-
const LUMX_CLASSNAME = 'lumx-list-item';
|
|
3099
|
-
const {
|
|
3100
|
-
block: block$_,
|
|
3101
|
-
element: element$M
|
|
3102
|
-
} = classNames.bem(CLASSNAME$17);
|
|
3103
|
-
const lumxListItem = classNames.bem(LUMX_CLASSNAME);
|
|
3104
|
-
|
|
3105
|
-
/**
|
|
3106
|
-
* Content of the option.
|
|
3107
|
-
* This should only be rendered if the option is shown.
|
|
3108
|
-
*/
|
|
3109
|
-
const OptionContent = forwardRef((props, ref) => {
|
|
3110
|
-
const {
|
|
3111
|
-
id,
|
|
3112
|
-
onSelect,
|
|
3113
|
-
isSelected,
|
|
3114
|
-
isDisabled,
|
|
3115
|
-
children,
|
|
3116
|
-
className,
|
|
3117
|
-
before,
|
|
3118
|
-
after,
|
|
3119
|
-
as,
|
|
3120
|
-
size = Size$1.tiny,
|
|
3121
|
-
comboboxType,
|
|
3122
|
-
tooltipProps,
|
|
3123
|
-
description,
|
|
3124
|
-
'aria-hidden': ariaHidden,
|
|
3125
|
-
autofocus,
|
|
3126
|
-
...forwardedProps
|
|
3127
|
-
} = props;
|
|
3128
|
-
const itemRef = React__default.useRef(null);
|
|
3129
|
-
const {
|
|
3130
|
-
state
|
|
3131
|
-
} = React__default.useContext(MovingFocusContext);
|
|
3132
|
-
const {
|
|
3133
|
-
selectedIds
|
|
3134
|
-
} = useCombobox();
|
|
3135
|
-
const hasSelection = selectedIds !== undefined;
|
|
3136
|
-
const isHighlighted = useVirtualFocus(id, itemRef, false, comboboxType === 'grid' ? id : undefined, autofocus);
|
|
3137
|
-
const Element = as || 'span';
|
|
3138
|
-
const ariaSelected = isSelected ? 'true' : 'false';
|
|
3139
|
-
const ariaDescriptionId = description ? `${id}-description` : undefined;
|
|
3140
|
-
const isKeyboardHighlighted = state.isUsingKeyboard && isHighlighted;
|
|
3141
|
-
|
|
3142
|
-
/**
|
|
3143
|
-
* The DS `ListItem` component has a lot of behavior / default props we do not want here.
|
|
3144
|
-
* Notably the before/after items are within the interactive element, which we do not want.
|
|
3145
|
-
* So we use a native li tag.
|
|
3146
|
-
*/
|
|
3147
|
-
return /*#__PURE__*/jsx("li", {
|
|
3148
|
-
className: block$_(undefined, [className ?? '', lumxListItem.block({
|
|
3149
|
-
[`size-${size}`]: !!size
|
|
3150
|
-
})]),
|
|
3151
|
-
role: "presentation",
|
|
3152
|
-
ref: itemRef,
|
|
3153
|
-
"aria-hidden": ariaHidden,
|
|
3154
|
-
style: {
|
|
3155
|
-
display: ariaHidden ? 'none' : undefined
|
|
3156
|
-
},
|
|
3157
|
-
...forwardedProps,
|
|
3158
|
-
children: /*#__PURE__*/jsxs(GenericBlock, {
|
|
3159
|
-
as: "div",
|
|
3160
|
-
role: comboboxType === 'grid' ? 'row' : 'presentation',
|
|
3161
|
-
className: element$M('content', {
|
|
3162
|
-
// Not using the lumx list item disabled style as it blocks pointer events
|
|
3163
|
-
'is-disabled': !!isDisabled
|
|
3164
|
-
},
|
|
3165
|
-
// TODO: migrate away from using lumx-list-item styles https://lumapps.atlassian.net/browse/DSW-288
|
|
3166
|
-
[lumxListItem.element('link', {
|
|
3167
|
-
'is-selected': Boolean(isSelected),
|
|
3168
|
-
'is-highlighted': Boolean(isHighlighted)
|
|
3169
|
-
})]),
|
|
3170
|
-
"data-focus-visible-added": isKeyboardHighlighted ? 'true' : undefined,
|
|
3171
|
-
children: [before && /*#__PURE__*/jsx(GenericBlock.Figure, {
|
|
3172
|
-
as: "span",
|
|
3173
|
-
role: "presentation",
|
|
3174
|
-
className: element$M('before', undefined, [lumxListItem.element('before')]),
|
|
3175
|
-
children: before
|
|
3176
|
-
}), /*#__PURE__*/jsxs(GenericBlock.Content, {
|
|
3177
|
-
as: "span",
|
|
3178
|
-
role: "presentation",
|
|
3179
|
-
className: lumxListItem.element('content'),
|
|
3180
|
-
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
3181
|
-
forceOpen: isKeyboardHighlighted,
|
|
3182
|
-
closeMode: "hide",
|
|
3183
|
-
...tooltipProps,
|
|
3184
|
-
children: /*#__PURE__*/jsx(Element, {
|
|
3185
|
-
id: id,
|
|
3186
|
-
className: element$M('trigger'),
|
|
3187
|
-
role: comboboxType === 'grid' ? 'gridcell' : 'option',
|
|
3188
|
-
"aria-selected": hasSelection ? ariaSelected : undefined,
|
|
3189
|
-
"aria-disabled": isDisabled,
|
|
3190
|
-
"aria-describedby": ariaDescriptionId,
|
|
3191
|
-
onClick: onSelect
|
|
3192
|
-
// Prevent mouse down to avoid blur before the click is activated
|
|
3193
|
-
,
|
|
3194
|
-
onMouseDown: event => event.preventDefault(),
|
|
3195
|
-
ref: ref,
|
|
3196
|
-
...forwardedProps,
|
|
3197
|
-
children: children
|
|
3198
|
-
})
|
|
3199
|
-
}), description && /*#__PURE__*/jsx(Text, {
|
|
3200
|
-
as: "span",
|
|
3201
|
-
id: ariaDescriptionId,
|
|
3202
|
-
role: "presentation",
|
|
3203
|
-
className: element$M('description'),
|
|
3204
|
-
typography: "caption",
|
|
3205
|
-
color: "dark",
|
|
3206
|
-
colorVariant: "L2",
|
|
3207
|
-
children: description
|
|
3208
|
-
})]
|
|
3209
|
-
}), after && /*#__PURE__*/jsx(GenericBlock.Actions, {
|
|
3210
|
-
as: "span",
|
|
3211
|
-
role: "presentation",
|
|
3212
|
-
className: element$M('after', undefined, [lumxListItem.element('after')]),
|
|
3213
|
-
children: /*#__PURE__*/jsx(ComboboxOptionContextProvider, {
|
|
3214
|
-
optionId: id,
|
|
3215
|
-
isKeyboardHighlighted: isKeyboardHighlighted,
|
|
3216
|
-
children: after
|
|
3217
|
-
})
|
|
3218
|
-
})]
|
|
3219
|
-
})
|
|
3220
|
-
});
|
|
3221
|
-
});
|
|
3222
|
-
|
|
3223
|
-
/**
|
|
3224
|
-
* Props for ComboboxOption with additional generic properties.
|
|
3225
|
-
*/
|
|
3226
|
-
|
|
3227
|
-
/**
|
|
3228
|
-
* Option to set within a combobox list.
|
|
3229
|
-
*
|
|
3230
|
-
* @family Combobox
|
|
3231
|
-
* @param ComboboxOptionProps
|
|
3232
|
-
* @returns ComboboxOption
|
|
3233
|
-
*/
|
|
3234
|
-
const ComboboxOption = forwardRef((props, ref) => {
|
|
3235
|
-
const {
|
|
3236
|
-
children,
|
|
3237
|
-
id,
|
|
3238
|
-
textValue,
|
|
3239
|
-
data,
|
|
3240
|
-
filterFromInput = true,
|
|
3241
|
-
onSelect: onOptionSelect,
|
|
3242
|
-
isDisabled,
|
|
3243
|
-
as = 'span',
|
|
3244
|
-
...optionProps
|
|
3245
|
-
} = props;
|
|
3246
|
-
|
|
3247
|
-
// Get the id of the current group, if any.
|
|
3248
|
-
const section = useComboboxSectionId();
|
|
3249
|
-
const {
|
|
3250
|
-
comboboxId,
|
|
3251
|
-
selectedIds,
|
|
3252
|
-
showAll,
|
|
3253
|
-
inputValue,
|
|
3254
|
-
handleSelected,
|
|
3255
|
-
type
|
|
3256
|
-
} = useCombobox();
|
|
3257
|
-
// Generate a unique id for this option.
|
|
3258
|
-
const generatedId = generateOptionId(comboboxId, id);
|
|
3259
|
-
const isSelected = selectedIds?.includes(generatedId);
|
|
3260
|
-
|
|
3261
|
-
// If no text value is set and the direct child is a simple string, use it as value.
|
|
3262
|
-
const isStringChild = typeof children === 'string' || typeof children === 'number';
|
|
3263
|
-
const value = children && !textValue && isStringChild ? children.toString() : textValue;
|
|
3264
|
-
const showOption = !filterFromInput || showAll || value?.toString()?.toLowerCase().includes(inputValue?.toLowerCase());
|
|
3265
|
-
const registeredOption = React__default.useMemo(() => ({
|
|
3266
|
-
id,
|
|
3267
|
-
generatedId,
|
|
3268
|
-
textValue: value,
|
|
3269
|
-
data,
|
|
3270
|
-
filter: filterFromInput,
|
|
3271
|
-
isDisabled: isDisabled || !showOption,
|
|
3272
|
-
sectionId: section.sectionId,
|
|
3273
|
-
onSelect: onOptionSelect
|
|
3274
|
-
}), [data, filterFromInput, generatedId, section.sectionId, id, isDisabled, onOptionSelect, showOption, value]);
|
|
3275
|
-
|
|
3276
|
-
// Register the option
|
|
3277
|
-
useRegisterOption(generatedId, registeredOption, showOption);
|
|
3278
|
-
const handleSelect = React__default.useCallback(() => handleSelected(registeredOption, 'click'), [handleSelected, registeredOption]);
|
|
3279
|
-
if (!id || !showOption) {
|
|
3280
|
-
return null;
|
|
3281
|
-
}
|
|
3282
|
-
return /*#__PURE__*/jsx(OptionContent, {
|
|
3283
|
-
id: generatedId,
|
|
3284
|
-
onSelect: handleSelect,
|
|
3285
|
-
isSelected: isSelected,
|
|
3286
|
-
isDisabled: isDisabled,
|
|
3287
|
-
as: as,
|
|
3288
|
-
ref: ref,
|
|
3289
|
-
comboboxType: type,
|
|
3290
|
-
"aria-hidden": section.isLoading,
|
|
3291
|
-
...optionProps,
|
|
3292
|
-
children: children || textValue
|
|
3293
|
-
});
|
|
3294
|
-
});
|
|
3295
|
-
|
|
3296
|
-
// Default widths the skeletons must have
|
|
3297
|
-
const defaultWidths = [REAL_SIZE_FOR_LUMX_SIZE.xxl, REAL_SIZE_FOR_LUMX_SIZE.xl, REAL_SIZE_FOR_LUMX_SIZE.l];
|
|
3298
|
-
const {
|
|
3299
|
-
block: block$Z,
|
|
3300
|
-
element: element$L
|
|
3301
|
-
} = classNames.bem(CLASSNAME$17);
|
|
3302
|
-
|
|
3303
|
-
/**
|
|
3304
|
-
* Skeleton for a combobox option.
|
|
3305
|
-
* A typography skeleton is rendered by default but can be overridden by passing children.
|
|
3306
|
-
*/
|
|
3307
|
-
const ComboboxOptionSkeleton = ({
|
|
3308
|
-
className,
|
|
3309
|
-
index,
|
|
3310
|
-
before,
|
|
3311
|
-
after,
|
|
3312
|
-
size = Size$1.tiny,
|
|
3313
|
-
children
|
|
3314
|
-
}) => {
|
|
3315
|
-
const renderedChildren = typeof children === 'function' ? children({
|
|
3316
|
-
index
|
|
3317
|
-
}) : children;
|
|
3318
|
-
const content = renderedChildren || /*#__PURE__*/jsx(SkeletonTypography, {
|
|
3319
|
-
typography: "body1",
|
|
3320
|
-
width: index !== undefined && defaultWidths[index] ? defaultWidths[index] : REAL_SIZE_FOR_LUMX_SIZE.xl
|
|
3321
|
-
});
|
|
3322
|
-
return /*#__PURE__*/jsxs("li", {
|
|
3323
|
-
role: "presentation",
|
|
3324
|
-
className: block$Z({
|
|
3325
|
-
skeleton: true
|
|
3326
|
-
}, ['lumx-list-item', `lumx-list-item--size-${size}`, className]),
|
|
3327
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
3328
|
-
role: "presentation",
|
|
3329
|
-
className: element$L('content', ['lumx-list-item__wrapper']),
|
|
3330
|
-
children: [before && /*#__PURE__*/jsx(Text, {
|
|
3331
|
-
as: "span",
|
|
3332
|
-
role: "presentation",
|
|
3333
|
-
className: element$L('before', ['lumx-list-item__before']),
|
|
3334
|
-
children: before
|
|
3335
|
-
}), content]
|
|
3336
|
-
}), after && /*#__PURE__*/jsx("div", {
|
|
3337
|
-
role: "presentation",
|
|
3338
|
-
className: element$L('after', ['lumx-list-item__after']),
|
|
3339
|
-
children: after
|
|
3340
|
-
})]
|
|
3341
|
-
});
|
|
3342
|
-
};
|
|
3343
|
-
|
|
3344
|
-
/** Default skeleton for the options list of the combobox */
|
|
3345
|
-
const ComboboxListSkeleton = ({
|
|
3346
|
-
isLoadingMore,
|
|
3347
|
-
children
|
|
3348
|
-
}) => /*#__PURE__*/jsx(Fragment, {
|
|
3349
|
-
children: Array.from({
|
|
3350
|
-
length: isLoadingMore ? 1 : 3
|
|
3351
|
-
}).map((_, index) => {
|
|
3352
|
-
const renderedChildren = typeof children === 'function' ? children({
|
|
3353
|
-
index
|
|
3354
|
-
}) : children || /*#__PURE__*/jsx(ComboboxOptionSkeleton, {
|
|
3355
|
-
index: index
|
|
3356
|
-
});
|
|
3357
|
-
return (
|
|
3358
|
-
/*#__PURE__*/
|
|
3359
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
3360
|
-
jsx(React__default.Fragment, {
|
|
3361
|
-
children: renderedChildren
|
|
3362
|
-
}, index)
|
|
3363
|
-
);
|
|
3364
|
-
})
|
|
3365
|
-
});
|
|
3366
|
-
|
|
3367
|
-
/** The states in which the full loading must be displayed */
|
|
3368
|
-
const FULL_LOADING_STATES = ['loading', 'debouncing', 'filtering'];
|
|
3369
|
-
const CLASSNAME$16 = 'lumx-combobox-listbox';
|
|
3370
|
-
const {
|
|
3371
|
-
block: block$Y,
|
|
3372
|
-
element: element$K
|
|
3373
|
-
} = bem$1(CLASSNAME$16);
|
|
3374
|
-
|
|
3375
|
-
/**
|
|
3376
|
-
* The listbox containing the combobox's options.
|
|
3377
|
-
*
|
|
3378
|
-
* @family Combobox
|
|
3379
|
-
* @param ComboboxListBoxProps
|
|
3380
|
-
* @returns ComboboxListBox
|
|
3381
|
-
*/
|
|
3382
|
-
const ComboboxListBox = ({
|
|
3383
|
-
children,
|
|
3384
|
-
renderItemSkeleton,
|
|
3385
|
-
label,
|
|
3386
|
-
popoverProps,
|
|
3387
|
-
footer,
|
|
3388
|
-
listRef,
|
|
3389
|
-
...forwardedProps
|
|
3390
|
-
}) => {
|
|
3391
|
-
const {
|
|
3392
|
-
status,
|
|
3393
|
-
listboxId,
|
|
3394
|
-
isOpen,
|
|
3395
|
-
optionsLength,
|
|
3396
|
-
handleClose: contextHandleClose,
|
|
3397
|
-
type,
|
|
3398
|
-
inputValue,
|
|
3399
|
-
showEmptyState,
|
|
3400
|
-
showErrorState,
|
|
3401
|
-
translations
|
|
3402
|
-
} = useCombobox();
|
|
3403
|
-
const {
|
|
3404
|
-
anchorRef
|
|
3405
|
-
} = useComboboxRefs();
|
|
3406
|
-
const {
|
|
3407
|
-
onClose,
|
|
3408
|
-
...otherPopoverProps
|
|
3409
|
-
} = popoverProps || {};
|
|
3410
|
-
const {
|
|
3411
|
-
style,
|
|
3412
|
-
className,
|
|
3413
|
-
...listProps
|
|
3414
|
-
} = forwardedProps;
|
|
3415
|
-
// The states to show a full skeleton instead of the options
|
|
3416
|
-
const showFullLoading = FULL_LOADING_STATES.includes(status);
|
|
3417
|
-
const isErrorStateDisplayed = showErrorState && isOpen && status === 'error';
|
|
3418
|
-
const isEmptyStateDisplayed = showEmptyState && isOpen && status === 'idle' && optionsLength === 0;
|
|
3419
|
-
|
|
3420
|
-
/**
|
|
3421
|
-
* The conditions in which we want to show the content of the popover
|
|
3422
|
-
* * The parent asked for the popover to be opened
|
|
3423
|
-
* * There is at least one option to displayed OR a skeleton
|
|
3424
|
-
*/
|
|
3425
|
-
const showPopover = isOpen && (optionsLength > 0 || showFullLoading) || isEmptyStateDisplayed || isErrorStateDisplayed;
|
|
3426
|
-
const handleClose = () => {
|
|
3427
|
-
if (isOpen) {
|
|
3428
|
-
contextHandleClose?.();
|
|
3429
|
-
onClose?.();
|
|
3430
|
-
}
|
|
3431
|
-
};
|
|
3432
|
-
const emptyMessage = translations.noResultsForInputLabel(inputValue);
|
|
3433
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
3434
|
-
children: [/*#__PURE__*/jsxs(Text, {
|
|
3435
|
-
as: "p",
|
|
3436
|
-
className: visuallyHidden(),
|
|
3437
|
-
role: "log",
|
|
3438
|
-
"aria-live": "assertive",
|
|
3439
|
-
children: [isOpen && !showFullLoading && !isEmptyStateDisplayed && !isErrorStateDisplayed && translations.nbOptionsLabel(optionsLength), isErrorStateDisplayed && `${translations.serviceUnavailableLabel} ${translations.tryReloadLabel}`, showFullLoading && translations.loadingLabel, isEmptyStateDisplayed && emptyMessage]
|
|
3440
|
-
}), /*#__PURE__*/jsx(Popover, {
|
|
3441
|
-
role: "none",
|
|
3442
|
-
onClose: handleClose,
|
|
3443
|
-
anchorRef: anchorRef,
|
|
3444
|
-
fitToAnchorWidth: true,
|
|
3445
|
-
fitWithinViewportHeight: true,
|
|
3446
|
-
closeOnEscape: true,
|
|
3447
|
-
closeOnClickAway: true,
|
|
3448
|
-
placement: Placement.BOTTOM,
|
|
3449
|
-
isOpen: isOpen,
|
|
3450
|
-
...otherPopoverProps,
|
|
3451
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
3452
|
-
style: {
|
|
3453
|
-
...style,
|
|
3454
|
-
overflowY: 'auto',
|
|
3455
|
-
display: showPopover ? 'flex' : 'none',
|
|
3456
|
-
flexDirection: 'column'
|
|
3457
|
-
},
|
|
3458
|
-
children: [/*#__PURE__*/jsxs("ul", {
|
|
3459
|
-
ref: listRef,
|
|
3460
|
-
id: listboxId,
|
|
3461
|
-
role: type,
|
|
3462
|
-
"aria-label": label,
|
|
3463
|
-
className: block$Y([className, 'lumx-list lumx-list--item-padding-big']),
|
|
3464
|
-
style: {
|
|
3465
|
-
flex: 1,
|
|
3466
|
-
overflowY: 'auto'
|
|
3467
|
-
},
|
|
3468
|
-
...listProps,
|
|
3469
|
-
children: [!showFullLoading && children, [...FULL_LOADING_STATES, 'loadingMore'].includes(status) && /*#__PURE__*/jsx(ComboboxListSkeleton, {
|
|
3470
|
-
isLoadingMore: status === 'loadingMore',
|
|
3471
|
-
children: renderItemSkeleton
|
|
3472
|
-
})]
|
|
3473
|
-
}), footer, (isEmptyStateDisplayed || isErrorStateDisplayed) && /*#__PURE__*/jsx(GenericBlock, {
|
|
3474
|
-
className: element$K('state'),
|
|
3475
|
-
orientation: "vertical",
|
|
3476
|
-
vAlign: "center",
|
|
3477
|
-
children: /*#__PURE__*/jsxs(GenericBlock.Content, {
|
|
3478
|
-
children: [inputValue && isEmptyStateDisplayed && /*#__PURE__*/jsx(Text, {
|
|
3479
|
-
as: "p",
|
|
3480
|
-
typography: "body1",
|
|
3481
|
-
color: "dark",
|
|
3482
|
-
colorVariant: "L2",
|
|
3483
|
-
dangerouslySetInnerHTML: {
|
|
3484
|
-
__html: translations.noResultsForInputLabel(inputValue)
|
|
3485
|
-
}
|
|
3486
|
-
}), !inputValue && isEmptyStateDisplayed && /*#__PURE__*/jsx(Text, {
|
|
3487
|
-
as: "p",
|
|
3488
|
-
typography: "body1",
|
|
3489
|
-
color: "dark",
|
|
3490
|
-
colorVariant: "L2",
|
|
3491
|
-
children: translations.noResultsForInputLabel()
|
|
3492
|
-
}), isErrorStateDisplayed && /*#__PURE__*/jsxs(Fragment, {
|
|
3493
|
-
children: [/*#__PURE__*/jsx(Heading, {
|
|
3494
|
-
as: "h2",
|
|
3495
|
-
typography: "subtitle2",
|
|
3496
|
-
children: translations.serviceUnavailableLabel
|
|
3497
|
-
}), /*#__PURE__*/jsx(Text, {
|
|
3498
|
-
as: "p",
|
|
3499
|
-
typography: "body1",
|
|
3500
|
-
color: "dark",
|
|
3501
|
-
colorVariant: "L2",
|
|
3502
|
-
children: translations.tryReloadLabel
|
|
3503
|
-
})]
|
|
3504
|
-
})]
|
|
3505
|
-
})
|
|
3506
|
-
})]
|
|
3507
|
-
})
|
|
3508
|
-
})]
|
|
3509
|
-
});
|
|
3510
|
-
};
|
|
3511
|
-
|
|
3512
|
-
/**
|
|
3513
|
-
* Action to set on a Combobox Option.
|
|
3514
|
-
* Allows to add an interactive element that
|
|
3515
|
-
* can be navigated to and triggered using the keyboard.
|
|
3516
|
-
*
|
|
3517
|
-
* Defaults as "button"
|
|
3518
|
-
*
|
|
3519
|
-
* @family Combobox
|
|
3520
|
-
* @param ComboboxOptionActionProps
|
|
3521
|
-
* @returns ComboboxOptionAction
|
|
3522
|
-
*/
|
|
3523
|
-
const ComboboxOptionAction = props => {
|
|
3524
|
-
const {
|
|
3525
|
-
as,
|
|
3526
|
-
isDisabled,
|
|
3527
|
-
onClick,
|
|
3528
|
-
id: originalId,
|
|
3529
|
-
...forwardedProps
|
|
3530
|
-
} = props;
|
|
3531
|
-
const {
|
|
3532
|
-
optionId
|
|
3533
|
-
} = useComboboxOptionContext();
|
|
3534
|
-
const {
|
|
3535
|
-
triggerRef
|
|
3536
|
-
} = useComboboxRefs();
|
|
3537
|
-
const itemRef = React__default.useRef(null);
|
|
3538
|
-
const generatedId = useId();
|
|
3539
|
-
const id = originalId || generatedId;
|
|
3540
|
-
const isHighlighted = useVirtualFocus(id, itemRef, isDisabled, optionId);
|
|
3541
|
-
const {
|
|
3542
|
-
state
|
|
3543
|
-
} = React__default.useContext(MovingFocusContext);
|
|
3544
|
-
const Component = as || 'button';
|
|
3545
|
-
const registeredActionOption = React__default.useMemo(() => ({
|
|
3546
|
-
id,
|
|
3547
|
-
generatedId: id,
|
|
3548
|
-
isAction: true,
|
|
3549
|
-
isDisabled,
|
|
3550
|
-
onSelect: () => {
|
|
3551
|
-
itemRef.current?.click();
|
|
3552
|
-
}
|
|
3553
|
-
}), [id, isDisabled]);
|
|
3554
|
-
|
|
3555
|
-
// Register the option
|
|
3556
|
-
useRegisterOption(id, registeredActionOption, !isDisabled);
|
|
3557
|
-
const handleActionClick = React__default.useCallback(() => {
|
|
3558
|
-
if (onClick) {
|
|
3559
|
-
onClick();
|
|
3560
|
-
}
|
|
3561
|
-
if (triggerRef?.current) {
|
|
3562
|
-
triggerRef.current?.focus();
|
|
3563
|
-
}
|
|
3564
|
-
}, [triggerRef, onClick]);
|
|
3565
|
-
return /*#__PURE__*/jsx(Component, {
|
|
3566
|
-
...forwardedProps,
|
|
3567
|
-
isDisabled: isDisabled,
|
|
3568
|
-
id: id,
|
|
3569
|
-
role: "gridcell",
|
|
3570
|
-
ref: itemRef,
|
|
3571
|
-
"data-focus-visible-added": state.isUsingKeyboard && isHighlighted ? 'true' : undefined,
|
|
3572
|
-
"aria-disabled": isDisabled,
|
|
3573
|
-
onClick: handleActionClick
|
|
3574
|
-
});
|
|
3575
|
-
};
|
|
2110
|
+
const lastChip = findPreviousEnabledChip();
|
|
2111
|
+
lastChip?.focus();
|
|
2112
|
+
};
|
|
3576
2113
|
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
const setToFalse = useCallback(() => setBoolean(false), []);
|
|
3580
|
-
const setToTrue = useCallback(() => setBoolean(true), []);
|
|
3581
|
-
const toggleBoolean = useCallback(() => setBoolean(previousValue => !previousValue), []);
|
|
3582
|
-
return [booleanValue, setToFalse, setToTrue, toggleBoolean];
|
|
3583
|
-
};
|
|
2114
|
+
// Attach keyboard event listener
|
|
2115
|
+
input.addEventListener('keydown', onKeyDown);
|
|
3584
2116
|
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
}
|
|
2117
|
+
// Cleanup listener on unmount
|
|
2118
|
+
return () => {
|
|
2119
|
+
input.removeEventListener('keydown', onKeyDown);
|
|
2120
|
+
};
|
|
2121
|
+
}, [inputRef, findPreviousEnabledChip]);
|
|
2122
|
+
return {
|
|
2123
|
+
findPreviousEnabledChip
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
3590
2126
|
|
|
3591
2127
|
/**
|
|
3592
|
-
*
|
|
3593
|
-
* Please consider using a simpler option description instead for better UX and a11y.
|
|
3594
|
-
*
|
|
3595
|
-
* @family Combobox
|
|
2128
|
+
* Component default class name and class prefix.
|
|
3596
2129
|
*/
|
|
3597
|
-
const
|
|
3598
|
-
buttonProps,
|
|
3599
|
-
popoverProps,
|
|
3600
|
-
onToggle,
|
|
3601
|
-
children
|
|
3602
|
-
}) => {
|
|
3603
|
-
const ref = React__default.useRef(null);
|
|
3604
|
-
const [isHovered,, onMouseLeave, onMouseEnter] = useBooleanState(false);
|
|
3605
|
-
const comboboxOption = useComboboxOptionContext();
|
|
3606
|
-
|
|
3607
|
-
// Open on mouse hover or key nav
|
|
3608
|
-
const isOpen = isHovered || comboboxOption.isKeyboardHighlighted;
|
|
3609
|
-
React__default.useEffect(() => {
|
|
3610
|
-
onToggle?.(isOpen);
|
|
3611
|
-
}, [isOpen, onToggle]);
|
|
3612
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
3613
|
-
children: [/*#__PURE__*/jsx(IconButton, {
|
|
3614
|
-
...buttonProps,
|
|
3615
|
-
ref: ref,
|
|
3616
|
-
className: block$X([buttonProps?.className]),
|
|
3617
|
-
icon: mdiInformationOutline,
|
|
3618
|
-
size: "s",
|
|
3619
|
-
emphasis: "low",
|
|
3620
|
-
onMouseEnter: onMouseEnter,
|
|
3621
|
-
onMouseLeave: onMouseLeave
|
|
3622
|
-
// Button actually plays no role here other than a target for the mouse hover
|
|
3623
|
-
// Keyboard accessibility is handled via combobox keyboard highlighting
|
|
3624
|
-
,
|
|
3625
|
-
"aria-hidden": true,
|
|
3626
|
-
label: ""
|
|
3627
|
-
}), /*#__PURE__*/jsx(Popover, {
|
|
3628
|
-
...popoverProps,
|
|
3629
|
-
className: element$J('popover', [popoverProps?.className]),
|
|
3630
|
-
anchorRef: ref,
|
|
3631
|
-
isOpen: isOpen,
|
|
3632
|
-
closeOnEscape: true,
|
|
3633
|
-
closeOnClickAway: true,
|
|
3634
|
-
placement: "bottom-start",
|
|
3635
|
-
children: children
|
|
3636
|
-
}), /*#__PURE__*/jsx(A11YLiveMessage, {
|
|
3637
|
-
hidden: true,
|
|
3638
|
-
children: isOpen ? children : undefined
|
|
3639
|
-
})]
|
|
3640
|
-
});
|
|
3641
|
-
};
|
|
3642
|
-
|
|
3643
|
-
const CLASSNAME$14 = 'lumx-combobox-section';
|
|
2130
|
+
const CLASSNAME$14 = 'lumx-selection-chip-group';
|
|
3644
2131
|
const {
|
|
3645
2132
|
block: block$W,
|
|
3646
2133
|
element: element$I
|
|
3647
2134
|
} = classNames.bem(CLASSNAME$14);
|
|
3648
2135
|
|
|
3649
2136
|
/**
|
|
3650
|
-
*
|
|
3651
|
-
*/
|
|
3652
|
-
const ComboboxSectionContent = ({
|
|
3653
|
-
className,
|
|
3654
|
-
title,
|
|
3655
|
-
children,
|
|
3656
|
-
isLoading,
|
|
3657
|
-
renderItemSkeleton
|
|
3658
|
-
}) => {
|
|
3659
|
-
const {
|
|
3660
|
-
options
|
|
3661
|
-
} = useCombobox();
|
|
3662
|
-
const {
|
|
3663
|
-
sectionId
|
|
3664
|
-
} = useComboboxSectionId();
|
|
3665
|
-
const hasRegisteredChildren = Boolean(Object.values(options).find(option => isComboboxValue(option) && option.sectionId === sectionId));
|
|
3666
|
-
const titleId = title && `${sectionId}-title`;
|
|
3667
|
-
if (!children && !isLoading) {
|
|
3668
|
-
return null;
|
|
3669
|
-
}
|
|
3670
|
-
const isHidden = !hasRegisteredChildren && !isLoading;
|
|
3671
|
-
return /*#__PURE__*/jsxs("li", {
|
|
3672
|
-
className: block$W([className]),
|
|
3673
|
-
role: !isHidden ? 'none' : undefined,
|
|
3674
|
-
"aria-hidden": isHidden,
|
|
3675
|
-
style: {
|
|
3676
|
-
display: isHidden ? 'none' : undefined
|
|
3677
|
-
},
|
|
3678
|
-
children: [title && /*#__PURE__*/jsx(Text, {
|
|
3679
|
-
as: "span",
|
|
3680
|
-
className: element$I('header', [ListSubheader.className]),
|
|
3681
|
-
"aria-hidden": "true",
|
|
3682
|
-
id: titleId,
|
|
3683
|
-
children: title
|
|
3684
|
-
}), /*#__PURE__*/jsxs("ul", {
|
|
3685
|
-
className: element$I('content'),
|
|
3686
|
-
role: "group",
|
|
3687
|
-
"aria-labelledby": titleId,
|
|
3688
|
-
children: [children, isLoading && /*#__PURE__*/jsx(ComboboxListSkeleton, {
|
|
3689
|
-
children: renderItemSkeleton
|
|
3690
|
-
})]
|
|
3691
|
-
})]
|
|
3692
|
-
});
|
|
3693
|
-
};
|
|
3694
|
-
|
|
3695
|
-
/**
|
|
3696
|
-
* Section for options of a Combobox.
|
|
2137
|
+
* SelectionChipGroup component.
|
|
3697
2138
|
*
|
|
3698
|
-
* @
|
|
3699
|
-
* @param
|
|
3700
|
-
* @
|
|
2139
|
+
* @param props Component props.
|
|
2140
|
+
* @param ref Component ref.
|
|
2141
|
+
* @return React element.
|
|
3701
2142
|
*/
|
|
3702
|
-
const
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
children: children
|
|
3716
|
-
})
|
|
3717
|
-
});
|
|
3718
|
-
};
|
|
3719
|
-
|
|
3720
|
-
/** Context provider for the combobox. */
|
|
3721
|
-
const ComboboxProvider = ({
|
|
3722
|
-
children,
|
|
3723
|
-
value
|
|
3724
|
-
}) => {
|
|
3725
|
-
return /*#__PURE__*/jsx(ComboboxContext.Provider, {
|
|
3726
|
-
value: value,
|
|
3727
|
-
children: /*#__PURE__*/jsx(MovingFocusProvider, {
|
|
3728
|
-
options: {
|
|
3729
|
-
direction: value.type === 'grid' ? 'both' : 'vertical',
|
|
3730
|
-
firstFocusDirection: value.type === 'grid' ? 'vertical' : undefined,
|
|
3731
|
-
loopAround: {
|
|
3732
|
-
row: 'next-loop',
|
|
3733
|
-
col: 'inside'
|
|
3734
|
-
},
|
|
3735
|
-
gridJumpToShortcutDirection: 'vertical',
|
|
3736
|
-
defaultSelectedId: value.selectedIds?.[0],
|
|
3737
|
-
listKey: value.inputValue
|
|
3738
|
-
},
|
|
3739
|
-
children: children
|
|
3740
|
-
})
|
|
3741
|
-
});
|
|
3742
|
-
};
|
|
3743
|
-
|
|
3744
|
-
const Combobox$1 = ({
|
|
3745
|
-
id: htmlId,
|
|
3746
|
-
inputValue,
|
|
3747
|
-
defaultInputValue,
|
|
3748
|
-
autoFilter = true,
|
|
3749
|
-
openOnClick,
|
|
3750
|
-
openOnFocus,
|
|
3751
|
-
status,
|
|
3752
|
-
showEmptyState = !autoFilter,
|
|
3753
|
-
showErrorState = !!status,
|
|
3754
|
-
selectedIds,
|
|
3755
|
-
onInputChange,
|
|
3756
|
-
onSelect,
|
|
3757
|
-
onOpen,
|
|
3758
|
-
children,
|
|
3759
|
-
selectionType,
|
|
3760
|
-
translations
|
|
2143
|
+
const SelectionChipGroup = ({
|
|
2144
|
+
onChange,
|
|
2145
|
+
value,
|
|
2146
|
+
getOptionId,
|
|
2147
|
+
getOptionName,
|
|
2148
|
+
inputRef,
|
|
2149
|
+
inputLabel,
|
|
2150
|
+
renderChip,
|
|
2151
|
+
theme,
|
|
2152
|
+
isDisabled,
|
|
2153
|
+
chipTooltipLabel,
|
|
2154
|
+
label,
|
|
2155
|
+
...forwardedProps
|
|
3761
2156
|
}) => {
|
|
3762
|
-
const
|
|
3763
|
-
const
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
translations
|
|
3825
|
-
}), [synchedState, openOnFocus, openOnClick, onInputChange, onOpen, onSelect, selectionType, currentSelectedIds, showEmptyState, showErrorState, translations]);
|
|
3826
|
-
return /*#__PURE__*/jsx(ComboboxRefsProvider, {
|
|
3827
|
-
triggerRef: triggerRef,
|
|
3828
|
-
anchorRef: textFieldRef,
|
|
3829
|
-
children: /*#__PURE__*/jsx(ComboboxProvider, {
|
|
3830
|
-
value: comboboxProviderValue,
|
|
3831
|
-
children: children
|
|
2157
|
+
const chipRefs = React__default.useRef([]);
|
|
2158
|
+
const {
|
|
2159
|
+
findPreviousEnabledChip
|
|
2160
|
+
} = useFocusLastChipOnBackspace(chipRefs, inputRef);
|
|
2161
|
+
return /*#__PURE__*/jsx(ChipGroup, {
|
|
2162
|
+
role: "group",
|
|
2163
|
+
"aria-label": label,
|
|
2164
|
+
className: block$W(),
|
|
2165
|
+
...forwardedProps,
|
|
2166
|
+
children: value?.map((v, index) => {
|
|
2167
|
+
const name = getWithSelector(getOptionName, v);
|
|
2168
|
+
const id = getWithSelector(getOptionId, v);
|
|
2169
|
+
const onClick = () => {
|
|
2170
|
+
const newValue = [...value];
|
|
2171
|
+
const existingIndex = value.findIndex(vi => getWithSelector(getOptionId, vi) === id);
|
|
2172
|
+
if (existingIndex === -1) {
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
// Remove value
|
|
2176
|
+
newValue.splice(existingIndex, 1);
|
|
2177
|
+
onChange?.(newValue);
|
|
2178
|
+
};
|
|
2179
|
+
const onKeyDown = evt => {
|
|
2180
|
+
if (evt.key !== 'Backspace') {
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
// Activate (remove value) on Backspace pressed
|
|
2184
|
+
onClick();
|
|
2185
|
+
const previousChip = findPreviousEnabledChip(index - 1);
|
|
2186
|
+
const input = inputRef?.current;
|
|
2187
|
+
// Focus the previous chip or the input
|
|
2188
|
+
(previousChip || input)?.focus();
|
|
2189
|
+
};
|
|
2190
|
+
if (!chipRefs.current[index]) {
|
|
2191
|
+
chipRefs.current[index] = /*#__PURE__*/React__default.createRef();
|
|
2192
|
+
}
|
|
2193
|
+
const ref = chipRefs.current[index];
|
|
2194
|
+
const customChip = renderChip?.(v);
|
|
2195
|
+
const props = isComponentType(Chip)(customChip) ? customChip.props : undefined;
|
|
2196
|
+
const chipIsDisabled = props?.isDisabled || isDisabled;
|
|
2197
|
+
const chipName = typeof props?.children === 'string' ? props.children : name;
|
|
2198
|
+
const tooltipLabel = chipTooltipLabel(chipName);
|
|
2199
|
+
return /*#__PURE__*/jsx(Tooltip, {
|
|
2200
|
+
label: !chipIsDisabled ? tooltipLabel : undefined,
|
|
2201
|
+
closeMode: "hide",
|
|
2202
|
+
ariaLinkMode: "aria-labelledby",
|
|
2203
|
+
children: /*#__PURE__*/jsx(Chip, {
|
|
2204
|
+
...props,
|
|
2205
|
+
after: /*#__PURE__*/jsx(Icon, {
|
|
2206
|
+
icon: mdiClose
|
|
2207
|
+
}),
|
|
2208
|
+
className: element$I('chip', [props?.className]),
|
|
2209
|
+
size: "s",
|
|
2210
|
+
ref: ref,
|
|
2211
|
+
onClick: onClick,
|
|
2212
|
+
onKeyDown: onKeyDown,
|
|
2213
|
+
theme: theme,
|
|
2214
|
+
isDisabled: chipIsDisabled,
|
|
2215
|
+
tabIndex: chipIsDisabled ? -1 : 0,
|
|
2216
|
+
children: props?.children || name
|
|
2217
|
+
})
|
|
2218
|
+
}, id);
|
|
3832
2219
|
})
|
|
3833
2220
|
});
|
|
3834
2221
|
};
|
|
3835
2222
|
|
|
3836
|
-
const SUB_COMPONENTS = {
|
|
3837
|
-
/**
|
|
3838
|
-
* Option to set within a combobox list.
|
|
3839
|
-
*
|
|
3840
|
-
* @family Combobox
|
|
3841
|
-
* @param ComboboxOptionProps
|
|
3842
|
-
* @returns ComboboxOption
|
|
3843
|
-
*/
|
|
3844
|
-
Option: ComboboxOption,
|
|
3845
|
-
/**
|
|
3846
|
-
* Skeleton for a combobox option.
|
|
3847
|
-
* A typography skeleton is rendered by default but can be overridden by passing children.
|
|
3848
|
-
*/
|
|
3849
|
-
OptionSkeleton: ComboboxOptionSkeleton,
|
|
3850
|
-
/**
|
|
3851
|
-
* Section for options of a Combobox.
|
|
3852
|
-
*
|
|
3853
|
-
* @family Combobox
|
|
3854
|
-
* @param ComboboxSectionProps
|
|
3855
|
-
* @returns ComboboxSection
|
|
3856
|
-
*/
|
|
3857
|
-
Section: ComboboxSection,
|
|
3858
|
-
/**
|
|
3859
|
-
* Combobox input trigger.
|
|
3860
|
-
*
|
|
3861
|
-
* @family Combobox
|
|
3862
|
-
*/
|
|
3863
|
-
Input: ComboboxInput,
|
|
3864
|
-
/**
|
|
3865
|
-
* The listbox containing the combobox's options.
|
|
3866
|
-
*
|
|
3867
|
-
* @family Combobox
|
|
3868
|
-
* @param ComboboxListBoxProps
|
|
3869
|
-
* @returns ComboboxListBox
|
|
3870
|
-
*/
|
|
3871
|
-
List: ComboboxListBox,
|
|
3872
|
-
/**
|
|
3873
|
-
* Combobox button trigger.
|
|
3874
|
-
*
|
|
3875
|
-
* @family Combobox
|
|
3876
|
-
*/
|
|
3877
|
-
Button: ComboboxButton
|
|
3878
|
-
};
|
|
3879
|
-
|
|
3880
|
-
/**
|
|
3881
|
-
*
|
|
3882
|
-
* A Combobox is a combination of two components:
|
|
3883
|
-
* * An input to enter the user's value
|
|
3884
|
-
* * A popover with a list of suggestions to fill the value.
|
|
3885
|
-
*
|
|
3886
|
-
* These two components are included via the Combobox.Input and Combobox.ListBox components.
|
|
3887
|
-
*
|
|
3888
|
-
* In its simplest implementation the component will automatically filter the given options
|
|
3889
|
-
* from the value of the input and fill the input with the textValue of the selected option.
|
|
3890
|
-
*
|
|
3891
|
-
* Props are available for more complex implementations.
|
|
3892
|
-
*
|
|
3893
|
-
* @family Combobox
|
|
3894
|
-
* @param ComboboxProps
|
|
3895
|
-
* @returns Combobox
|
|
3896
|
-
*/
|
|
3897
|
-
const Combobox = Object.assign(Combobox$1, SUB_COMPONENTS);
|
|
3898
|
-
|
|
3899
2223
|
/**
|
|
3900
2224
|
* Comment block variants.
|
|
3901
2225
|
*/
|
|
@@ -3925,7 +2249,7 @@ const {
|
|
|
3925
2249
|
/**
|
|
3926
2250
|
* Component default props.
|
|
3927
2251
|
*/
|
|
3928
|
-
const DEFAULT_PROPS$
|
|
2252
|
+
const DEFAULT_PROPS$Y = {
|
|
3929
2253
|
variant: CommentBlockVariant.indented
|
|
3930
2254
|
};
|
|
3931
2255
|
|
|
@@ -3955,7 +2279,7 @@ const CommentBlock = forwardRef((props, ref) => {
|
|
|
3955
2279
|
onMouseLeave,
|
|
3956
2280
|
text,
|
|
3957
2281
|
theme = defaultTheme,
|
|
3958
|
-
variant = DEFAULT_PROPS$
|
|
2282
|
+
variant = DEFAULT_PROPS$Y.variant,
|
|
3959
2283
|
...forwardedProps
|
|
3960
2284
|
} = props;
|
|
3961
2285
|
const hasChildren = Children.count(children) > 0;
|
|
@@ -4024,7 +2348,7 @@ const CommentBlock = forwardRef((props, ref) => {
|
|
|
4024
2348
|
});
|
|
4025
2349
|
CommentBlock.displayName = COMPONENT_NAME$15;
|
|
4026
2350
|
CommentBlock.className = CLASSNAME$13;
|
|
4027
|
-
CommentBlock.defaultProps = DEFAULT_PROPS$
|
|
2351
|
+
CommentBlock.defaultProps = DEFAULT_PROPS$Y;
|
|
4028
2352
|
|
|
4029
2353
|
/**
|
|
4030
2354
|
* Add a number of months from a date while resetting the day to prevent month length mismatches.
|
|
@@ -4514,6 +2838,14 @@ const DatePicker = forwardRef((props, ref) => {
|
|
|
4514
2838
|
DatePicker.displayName = COMPONENT_NAME$14;
|
|
4515
2839
|
DatePicker.className = CLASSNAME$12;
|
|
4516
2840
|
|
|
2841
|
+
const useBooleanState = defaultValue => {
|
|
2842
|
+
const [booleanValue, setBoolean] = useState(defaultValue);
|
|
2843
|
+
const setToFalse = useCallback(() => setBoolean(false), []);
|
|
2844
|
+
const setToTrue = useCallback(() => setBoolean(true), []);
|
|
2845
|
+
const toggleBoolean = useCallback(() => setBoolean(previousValue => !previousValue), []);
|
|
2846
|
+
return [booleanValue, setToFalse, setToTrue, toggleBoolean];
|
|
2847
|
+
};
|
|
2848
|
+
|
|
4517
2849
|
/**
|
|
4518
2850
|
* Component display name.
|
|
4519
2851
|
*/
|
|
@@ -5121,7 +3453,7 @@ const {
|
|
|
5121
3453
|
/**
|
|
5122
3454
|
* Component default props.
|
|
5123
3455
|
*/
|
|
5124
|
-
const DEFAULT_PROPS$
|
|
3456
|
+
const DEFAULT_PROPS$X = {
|
|
5125
3457
|
size: Size$1.big,
|
|
5126
3458
|
disableBodyScroll: true
|
|
5127
3459
|
};
|
|
@@ -5152,11 +3484,11 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
5152
3484
|
parentElement,
|
|
5153
3485
|
contentRef,
|
|
5154
3486
|
preventAutoClose,
|
|
5155
|
-
size = DEFAULT_PROPS$
|
|
3487
|
+
size = DEFAULT_PROPS$X.size,
|
|
5156
3488
|
zIndex,
|
|
5157
3489
|
dialogProps,
|
|
5158
3490
|
onVisibilityChange,
|
|
5159
|
-
disableBodyScroll = DEFAULT_PROPS$
|
|
3491
|
+
disableBodyScroll = DEFAULT_PROPS$X.disableBodyScroll,
|
|
5160
3492
|
preventCloseOnClick,
|
|
5161
3493
|
preventCloseOnEscape,
|
|
5162
3494
|
...forwardedProps
|
|
@@ -5296,7 +3628,7 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
5296
3628
|
});
|
|
5297
3629
|
Dialog.displayName = COMPONENT_NAME$11;
|
|
5298
3630
|
Dialog.className = CLASSNAME$11;
|
|
5299
|
-
Dialog.defaultProps = DEFAULT_PROPS$
|
|
3631
|
+
Dialog.defaultProps = DEFAULT_PROPS$X;
|
|
5300
3632
|
|
|
5301
3633
|
/**
|
|
5302
3634
|
* Component display name.
|
|
@@ -5340,7 +3672,7 @@ const Divider$1 = props => {
|
|
|
5340
3672
|
/**
|
|
5341
3673
|
* Component default props.
|
|
5342
3674
|
*/
|
|
5343
|
-
const DEFAULT_PROPS$
|
|
3675
|
+
const DEFAULT_PROPS$W = {};
|
|
5344
3676
|
|
|
5345
3677
|
/**
|
|
5346
3678
|
* Divider component.
|
|
@@ -5363,7 +3695,7 @@ const Divider = forwardRef((props, ref) => {
|
|
|
5363
3695
|
});
|
|
5364
3696
|
Divider.displayName = COMPONENT_NAME$10;
|
|
5365
3697
|
Divider.className = CLASSNAME$10;
|
|
5366
|
-
Divider.defaultProps = DEFAULT_PROPS$
|
|
3698
|
+
Divider.defaultProps = DEFAULT_PROPS$W;
|
|
5367
3699
|
|
|
5368
3700
|
/**
|
|
5369
3701
|
* Component display name.
|
|
@@ -5588,7 +3920,7 @@ const {
|
|
|
5588
3920
|
/**
|
|
5589
3921
|
* Component default props.
|
|
5590
3922
|
*/
|
|
5591
|
-
const DEFAULT_PROPS$
|
|
3923
|
+
const DEFAULT_PROPS$V = {
|
|
5592
3924
|
tabIndex: -1
|
|
5593
3925
|
};
|
|
5594
3926
|
|
|
@@ -5607,7 +3939,7 @@ const InternalList = forwardRef((props, ref) => {
|
|
|
5607
3939
|
isClickable,
|
|
5608
3940
|
itemPadding,
|
|
5609
3941
|
onListItemSelected,
|
|
5610
|
-
tabIndex = DEFAULT_PROPS$
|
|
3942
|
+
tabIndex = DEFAULT_PROPS$V.tabIndex,
|
|
5611
3943
|
...forwardedProps
|
|
5612
3944
|
} = props;
|
|
5613
3945
|
const adjustedItemPadding = itemPadding ?? (isClickable ? Size$1.big : undefined);
|
|
@@ -5623,7 +3955,7 @@ const InternalList = forwardRef((props, ref) => {
|
|
|
5623
3955
|
});
|
|
5624
3956
|
InternalList.displayName = COMPONENT_NAME$_;
|
|
5625
3957
|
InternalList.className = CLASSNAME$_;
|
|
5626
|
-
InternalList.defaultProps = DEFAULT_PROPS$
|
|
3958
|
+
InternalList.defaultProps = DEFAULT_PROPS$V;
|
|
5627
3959
|
const List = Object.assign(InternalList, {
|
|
5628
3960
|
useKeyboardListNavigation
|
|
5629
3961
|
});
|
|
@@ -8068,7 +6400,7 @@ const {
|
|
|
8068
6400
|
/**
|
|
8069
6401
|
* Component default props.
|
|
8070
6402
|
*/
|
|
8071
|
-
const DEFAULT_PROPS$
|
|
6403
|
+
const DEFAULT_PROPS$U = {
|
|
8072
6404
|
elevation: 3,
|
|
8073
6405
|
placement: Placement.AUTO,
|
|
8074
6406
|
focusAnchorOnClose: true,
|
|
@@ -8085,24 +6417,24 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
8085
6417
|
className,
|
|
8086
6418
|
closeOnClickAway,
|
|
8087
6419
|
closeOnEscape,
|
|
8088
|
-
elevation = DEFAULT_PROPS$
|
|
6420
|
+
elevation = DEFAULT_PROPS$U.elevation,
|
|
8089
6421
|
focusElement,
|
|
8090
6422
|
hasArrow,
|
|
8091
6423
|
isOpen,
|
|
8092
6424
|
onClose,
|
|
8093
6425
|
parentElement,
|
|
8094
|
-
usePortal = DEFAULT_PROPS$
|
|
8095
|
-
focusAnchorOnClose = DEFAULT_PROPS$
|
|
6426
|
+
usePortal = DEFAULT_PROPS$U.usePortal,
|
|
6427
|
+
focusAnchorOnClose = DEFAULT_PROPS$U.focusAnchorOnClose,
|
|
8096
6428
|
withFocusTrap,
|
|
8097
6429
|
boundaryRef,
|
|
8098
6430
|
fitToAnchorWidth,
|
|
8099
6431
|
fitWithinViewportHeight,
|
|
8100
6432
|
focusTrapZoneElement,
|
|
8101
6433
|
offset,
|
|
8102
|
-
placement = DEFAULT_PROPS$
|
|
6434
|
+
placement = DEFAULT_PROPS$U.placement,
|
|
8103
6435
|
style,
|
|
8104
6436
|
theme,
|
|
8105
|
-
zIndex = DEFAULT_PROPS$
|
|
6437
|
+
zIndex = DEFAULT_PROPS$U.zIndex,
|
|
8106
6438
|
...forwardedProps
|
|
8107
6439
|
} = props;
|
|
8108
6440
|
const popoverRef = useRef(null);
|
|
@@ -8188,7 +6520,7 @@ const Popover = skipRender(
|
|
|
8188
6520
|
() => Boolean(DOCUMENT), _InnerPopover);
|
|
8189
6521
|
Popover.displayName = COMPONENT_NAME$Z;
|
|
8190
6522
|
Popover.className = CLASSNAME$Z;
|
|
8191
|
-
Popover.defaultProps = DEFAULT_PROPS$
|
|
6523
|
+
Popover.defaultProps = DEFAULT_PROPS$U;
|
|
8192
6524
|
|
|
8193
6525
|
// The error margin in px we want to have for triggering infinite scroll
|
|
8194
6526
|
const SCROLL_TRIGGER_MARGIN = 5;
|
|
@@ -8248,7 +6580,7 @@ const {
|
|
|
8248
6580
|
/**
|
|
8249
6581
|
* Component default props.
|
|
8250
6582
|
*/
|
|
8251
|
-
const DEFAULT_PROPS$
|
|
6583
|
+
const DEFAULT_PROPS$T = {
|
|
8252
6584
|
closeOnClick: true,
|
|
8253
6585
|
closeOnClickAway: true,
|
|
8254
6586
|
closeOnEscape: true,
|
|
@@ -8271,18 +6603,18 @@ const Dropdown = forwardRef((props, ref) => {
|
|
|
8271
6603
|
anchorRef,
|
|
8272
6604
|
children,
|
|
8273
6605
|
className,
|
|
8274
|
-
closeOnClick = DEFAULT_PROPS$
|
|
8275
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
8276
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
8277
|
-
fitToAnchorWidth = DEFAULT_PROPS$
|
|
8278
|
-
fitWithinViewportHeight = DEFAULT_PROPS$
|
|
6606
|
+
closeOnClick = DEFAULT_PROPS$T.closeOnClick,
|
|
6607
|
+
closeOnClickAway = DEFAULT_PROPS$T.closeOnClickAway,
|
|
6608
|
+
closeOnEscape = DEFAULT_PROPS$T.closeOnEscape,
|
|
6609
|
+
fitToAnchorWidth = DEFAULT_PROPS$T.fitToAnchorWidth,
|
|
6610
|
+
fitWithinViewportHeight = DEFAULT_PROPS$T.fitWithinViewportHeight,
|
|
8279
6611
|
isOpen,
|
|
8280
6612
|
offset,
|
|
8281
|
-
focusAnchorOnClose = DEFAULT_PROPS$
|
|
6613
|
+
focusAnchorOnClose = DEFAULT_PROPS$T.focusAnchorOnClose,
|
|
8282
6614
|
onClose,
|
|
8283
6615
|
onInfiniteScroll,
|
|
8284
|
-
placement = DEFAULT_PROPS$
|
|
8285
|
-
shouldFocusOnOpen = DEFAULT_PROPS$
|
|
6616
|
+
placement = DEFAULT_PROPS$T.placement,
|
|
6617
|
+
shouldFocusOnOpen = DEFAULT_PROPS$T.shouldFocusOnOpen,
|
|
8286
6618
|
zIndex,
|
|
8287
6619
|
...forwardedProps
|
|
8288
6620
|
} = props;
|
|
@@ -8328,7 +6660,7 @@ const Dropdown = forwardRef((props, ref) => {
|
|
|
8328
6660
|
});
|
|
8329
6661
|
Dropdown.displayName = COMPONENT_NAME$Y;
|
|
8330
6662
|
Dropdown.className = CLASSNAME$Y;
|
|
8331
|
-
Dropdown.defaultProps = DEFAULT_PROPS$
|
|
6663
|
+
Dropdown.defaultProps = DEFAULT_PROPS$T;
|
|
8332
6664
|
|
|
8333
6665
|
/**
|
|
8334
6666
|
* Component display name.
|
|
@@ -8347,7 +6679,7 @@ const {
|
|
|
8347
6679
|
/**
|
|
8348
6680
|
* Component default props.
|
|
8349
6681
|
*/
|
|
8350
|
-
const DEFAULT_PROPS$
|
|
6682
|
+
const DEFAULT_PROPS$S = {
|
|
8351
6683
|
closeMode: 'unmount'
|
|
8352
6684
|
};
|
|
8353
6685
|
const isDragHandle = isComponent(DragHandle);
|
|
@@ -8365,7 +6697,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
8365
6697
|
const defaultTheme = useTheme() || Theme$1.light;
|
|
8366
6698
|
const {
|
|
8367
6699
|
className,
|
|
8368
|
-
closeMode = DEFAULT_PROPS$
|
|
6700
|
+
closeMode = DEFAULT_PROPS$S.closeMode,
|
|
8369
6701
|
children: anyChildren,
|
|
8370
6702
|
hasBackground,
|
|
8371
6703
|
hasHeaderDivider,
|
|
@@ -8482,11 +6814,11 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
8482
6814
|
});
|
|
8483
6815
|
ExpansionPanel.displayName = COMPONENT_NAME$X;
|
|
8484
6816
|
ExpansionPanel.className = CLASSNAME$X;
|
|
8485
|
-
ExpansionPanel.defaultProps = DEFAULT_PROPS$
|
|
6817
|
+
ExpansionPanel.defaultProps = DEFAULT_PROPS$S;
|
|
8486
6818
|
|
|
8487
6819
|
const COMPONENT_NAME$W = 'Flag';
|
|
8488
6820
|
const CLASSNAME$W = 'lumx-flag';
|
|
8489
|
-
const DEFAULT_PROPS$
|
|
6821
|
+
const DEFAULT_PROPS$R = {};
|
|
8490
6822
|
const {
|
|
8491
6823
|
block: block$N,
|
|
8492
6824
|
element: element$B
|
|
@@ -8550,7 +6882,7 @@ const Flag = forwardRef((props, ref) => {
|
|
|
8550
6882
|
});
|
|
8551
6883
|
Flag.displayName = COMPONENT_NAME$W;
|
|
8552
6884
|
Flag.className = CLASSNAME$W;
|
|
8553
|
-
Flag.defaultProps = DEFAULT_PROPS$
|
|
6885
|
+
Flag.defaultProps = DEFAULT_PROPS$R;
|
|
8554
6886
|
|
|
8555
6887
|
/**
|
|
8556
6888
|
* Defines the props of the component.
|
|
@@ -8643,7 +6975,7 @@ const {
|
|
|
8643
6975
|
/**
|
|
8644
6976
|
* Component default props.
|
|
8645
6977
|
*/
|
|
8646
|
-
const DEFAULT_PROPS$
|
|
6978
|
+
const DEFAULT_PROPS$Q = {
|
|
8647
6979
|
gap: Size$1.big,
|
|
8648
6980
|
orientation: Orientation$1.horizontal
|
|
8649
6981
|
};
|
|
@@ -8673,8 +7005,8 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
8673
7005
|
children,
|
|
8674
7006
|
actions,
|
|
8675
7007
|
actionsProps,
|
|
8676
|
-
gap = DEFAULT_PROPS$
|
|
8677
|
-
orientation = DEFAULT_PROPS$
|
|
7008
|
+
gap = DEFAULT_PROPS$Q.gap,
|
|
7009
|
+
orientation = DEFAULT_PROPS$Q.orientation,
|
|
8678
7010
|
contentProps,
|
|
8679
7011
|
...forwardedProps
|
|
8680
7012
|
} = props;
|
|
@@ -8728,7 +7060,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
8728
7060
|
});
|
|
8729
7061
|
BaseGenericBlock.displayName = COMPONENT_NAME$U;
|
|
8730
7062
|
BaseGenericBlock.className = CLASSNAME$U;
|
|
8731
|
-
BaseGenericBlock.defaultProps = DEFAULT_PROPS$
|
|
7063
|
+
BaseGenericBlock.defaultProps = DEFAULT_PROPS$Q;
|
|
8732
7064
|
const GenericBlock = Object.assign(BaseGenericBlock, {
|
|
8733
7065
|
Figure,
|
|
8734
7066
|
Content,
|
|
@@ -8776,7 +7108,7 @@ const CLASSNAME$T = 'lumx-heading';
|
|
|
8776
7108
|
/**
|
|
8777
7109
|
* Component default props.
|
|
8778
7110
|
*/
|
|
8779
|
-
const DEFAULT_PROPS$
|
|
7111
|
+
const DEFAULT_PROPS$P = {};
|
|
8780
7112
|
|
|
8781
7113
|
/**
|
|
8782
7114
|
* Get Heading component common props
|
|
@@ -8877,7 +7209,7 @@ const {
|
|
|
8877
7209
|
/**
|
|
8878
7210
|
* Component default props.
|
|
8879
7211
|
*/
|
|
8880
|
-
const DEFAULT_PROPS$
|
|
7212
|
+
const DEFAULT_PROPS$O = {};
|
|
8881
7213
|
|
|
8882
7214
|
/**
|
|
8883
7215
|
* Text component common props
|
|
@@ -8964,7 +7296,7 @@ const Text = forwardRef((props, ref) => {
|
|
|
8964
7296
|
});
|
|
8965
7297
|
Text.displayName = COMPONENT_NAME$S;
|
|
8966
7298
|
Text.className = CLASSNAME$S;
|
|
8967
|
-
Text.defaultProps = DEFAULT_PROPS$
|
|
7299
|
+
Text.defaultProps = DEFAULT_PROPS$O;
|
|
8968
7300
|
|
|
8969
7301
|
const HeadingLevelContext = /*#__PURE__*/createContext(defaultContext);
|
|
8970
7302
|
|
|
@@ -9001,7 +7333,7 @@ const Heading = forwardRef((props, ref) => {
|
|
|
9001
7333
|
});
|
|
9002
7334
|
Heading.displayName = COMPONENT_NAME$T;
|
|
9003
7335
|
Heading.className = CLASSNAME$T;
|
|
9004
|
-
Heading.defaultProps = DEFAULT_PROPS$
|
|
7336
|
+
Heading.defaultProps = DEFAULT_PROPS$P;
|
|
9005
7337
|
|
|
9006
7338
|
/**
|
|
9007
7339
|
* Computes the next heading level based on the optional prop level or the parent context level.
|
|
@@ -9052,7 +7384,7 @@ const {
|
|
|
9052
7384
|
/**
|
|
9053
7385
|
* Component default props.
|
|
9054
7386
|
*/
|
|
9055
|
-
const DEFAULT_PROPS$
|
|
7387
|
+
const DEFAULT_PROPS$N = {
|
|
9056
7388
|
orientation: Orientation$1.horizontal,
|
|
9057
7389
|
wrap: 'nowrap'
|
|
9058
7390
|
};
|
|
@@ -9070,9 +7402,9 @@ const Grid = forwardRef((props, ref) => {
|
|
|
9070
7402
|
className,
|
|
9071
7403
|
gutter,
|
|
9072
7404
|
hAlign,
|
|
9073
|
-
orientation = DEFAULT_PROPS$
|
|
7405
|
+
orientation = DEFAULT_PROPS$N.orientation,
|
|
9074
7406
|
vAlign,
|
|
9075
|
-
wrap = DEFAULT_PROPS$
|
|
7407
|
+
wrap = DEFAULT_PROPS$N.wrap,
|
|
9076
7408
|
...forwardedProps
|
|
9077
7409
|
} = props;
|
|
9078
7410
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -9090,7 +7422,7 @@ const Grid = forwardRef((props, ref) => {
|
|
|
9090
7422
|
});
|
|
9091
7423
|
Grid.displayName = COMPONENT_NAME$R;
|
|
9092
7424
|
Grid.className = CLASSNAME$R;
|
|
9093
|
-
Grid.defaultProps = DEFAULT_PROPS$
|
|
7425
|
+
Grid.defaultProps = DEFAULT_PROPS$N;
|
|
9094
7426
|
|
|
9095
7427
|
/**
|
|
9096
7428
|
* Component display name.
|
|
@@ -9148,7 +7480,7 @@ const CLASSNAME$P = 'lumx-grid-column';
|
|
|
9148
7480
|
/**
|
|
9149
7481
|
* Component default props.
|
|
9150
7482
|
*/
|
|
9151
|
-
const DEFAULT_PROPS$
|
|
7483
|
+
const DEFAULT_PROPS$M = {};
|
|
9152
7484
|
|
|
9153
7485
|
/**
|
|
9154
7486
|
* The GridColumn is a layout component that can display children in a grid
|
|
@@ -9156,9 +7488,10 @@ const DEFAULT_PROPS$N = {};
|
|
|
9156
7488
|
* with a number of column that reduce when there is not enough space for each item.
|
|
9157
7489
|
*
|
|
9158
7490
|
* @param props Component props.
|
|
9159
|
-
* @
|
|
7491
|
+
* @param ref Component ref.
|
|
7492
|
+
* @return React element.
|
|
9160
7493
|
*/
|
|
9161
|
-
const GridColumn
|
|
7494
|
+
const GridColumn = forwardRef((props, ref) => {
|
|
9162
7495
|
const {
|
|
9163
7496
|
as: Component = 'div',
|
|
9164
7497
|
gap,
|
|
@@ -9167,13 +7500,12 @@ const GridColumn$1 = props => {
|
|
|
9167
7500
|
children,
|
|
9168
7501
|
className,
|
|
9169
7502
|
style = {},
|
|
9170
|
-
ref,
|
|
9171
7503
|
...forwardedProps
|
|
9172
7504
|
} = props;
|
|
9173
7505
|
return /*#__PURE__*/jsx(Component, {
|
|
9174
7506
|
...forwardedProps,
|
|
9175
7507
|
ref: ref,
|
|
9176
|
-
className:
|
|
7508
|
+
className: classNames.join(className, CLASSNAME$P),
|
|
9177
7509
|
style: {
|
|
9178
7510
|
...style,
|
|
9179
7511
|
['--lumx-grid-column-item-min-width']: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
@@ -9182,36 +7514,6 @@ const GridColumn$1 = props => {
|
|
|
9182
7514
|
},
|
|
9183
7515
|
children: children
|
|
9184
7516
|
});
|
|
9185
|
-
};
|
|
9186
|
-
GridColumn$1.displayName = COMPONENT_NAME$P;
|
|
9187
|
-
GridColumn$1.className = CLASSNAME$P;
|
|
9188
|
-
GridColumn$1.defaultProps = DEFAULT_PROPS$N;
|
|
9189
|
-
|
|
9190
|
-
/**
|
|
9191
|
-
* Defines the props of the component.
|
|
9192
|
-
*/
|
|
9193
|
-
|
|
9194
|
-
// Re-export types for backward compatibility
|
|
9195
|
-
|
|
9196
|
-
/**
|
|
9197
|
-
* Component default props.
|
|
9198
|
-
*/
|
|
9199
|
-
const DEFAULT_PROPS$M = {};
|
|
9200
|
-
|
|
9201
|
-
/**
|
|
9202
|
-
* The GridColumn is a layout component that can display children in a grid
|
|
9203
|
-
* with custom display properties. It also comes with a responsive design,
|
|
9204
|
-
* with a number of column that reduce when there is not enough space for each item.
|
|
9205
|
-
*
|
|
9206
|
-
* @param props Component props.
|
|
9207
|
-
* @param ref Component ref.
|
|
9208
|
-
* @return React element.
|
|
9209
|
-
*/
|
|
9210
|
-
const GridColumn = forwardRef((props, ref) => {
|
|
9211
|
-
return GridColumn$1({
|
|
9212
|
-
ref,
|
|
9213
|
-
...props
|
|
9214
|
-
});
|
|
9215
7517
|
});
|
|
9216
7518
|
GridColumn.displayName = COMPONENT_NAME$P;
|
|
9217
7519
|
GridColumn.className = CLASSNAME$P;
|
|
@@ -17002,5 +15304,5 @@ UserBlock.displayName = COMPONENT_NAME;
|
|
|
17002
15304
|
UserBlock.className = CLASSNAME;
|
|
17003
15305
|
UserBlock.defaultProps = DEFAULT_PROPS;
|
|
17004
15306
|
|
|
17005
|
-
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonGroup, COMPONENT_NAME$1e as COMPONENT_NAME, Checkbox, Chip, ChipGroup,
|
|
15307
|
+
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonGroup, CLASSNAME$1d as CLASSNAME, COMPONENT_NAME$1e as COMPONENT_NAME, Checkbox, Chip, ChipGroup, CommentBlock, CommentBlockVariant, DEFAULT_PROPS$15 as DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSubheader, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, Select, SelectMultiple, SelectMultipleField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, isClickable, useFocusPointStyle, useHeadingLevel, useTheme };
|
|
17006
15308
|
//# sourceMappingURL=index.js.map
|