@lumx/react 4.3.2-alpha.11 → 4.3.2-alpha.12
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 +612 -386
- package/index.js +326 -1699
- package/index.js.map +1 -1
- package/package.json +7 -3
- package/utils/index.d.ts +1 -35
- package/utils/index.js +1322 -3
- package/utils/index.js.map +1 -1
- package/Tooltip-sXtC5rw3.d.ts +0 -873
- package/_internal/BCgo9dYV.js +0 -1805
- package/_internal/BCgo9dYV.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,43 +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
|
|
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';
|
|
28
31
|
import castArray from 'lodash/castArray';
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
33
|
-
import { mdiChevronDown } from '@lumx/icons/esm/chevron-down';
|
|
34
|
-
import { mdiChevronUp } from '@lumx/icons/esm/chevron-up';
|
|
35
|
-
import { mdiInformationOutline } from '@lumx/icons/esm/information-outline';
|
|
36
|
-
import { mdiChevronLeft } from '@lumx/icons/esm/chevron-left';
|
|
37
|
-
import { mdiChevronRight } from '@lumx/icons/esm/chevron-right';
|
|
38
|
-
import { mdiDragVertical } from '@lumx/icons/esm/drag-vertical';
|
|
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';
|
|
39
36
|
import pick from 'lodash/pick';
|
|
40
37
|
import isInteger from 'lodash/isInteger';
|
|
41
|
-
import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline';
|
|
42
|
-
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';
|
|
43
40
|
import throttle from 'lodash/throttle';
|
|
44
41
|
import range from 'lodash/range';
|
|
45
|
-
import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline';
|
|
46
|
-
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';
|
|
47
44
|
import chunk from 'lodash/chunk';
|
|
48
45
|
import ReactDOM from 'react-dom';
|
|
49
46
|
import take from 'lodash/take';
|
|
50
|
-
import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank';
|
|
51
|
-
import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked';
|
|
52
|
-
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';
|
|
53
50
|
import { getWithSelector } from '@lumx/core/js/utils/selectors/getWithSelector';
|
|
54
|
-
import { mdiArrowDown } from '@lumx/icons/esm/arrow-down';
|
|
55
|
-
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';
|
|
56
53
|
import set from 'lodash/set';
|
|
57
54
|
|
|
58
55
|
let i = 0;
|
|
@@ -104,15 +101,15 @@ const COMPONENT_NAME$1l = 'AlertDialog';
|
|
|
104
101
|
/**
|
|
105
102
|
* Component default class name and class prefix.
|
|
106
103
|
*/
|
|
107
|
-
const CLASSNAME$
|
|
104
|
+
const CLASSNAME$1j = 'lumx-alert-dialog';
|
|
108
105
|
const {
|
|
109
|
-
block: block$
|
|
110
|
-
} = classNames.bem(CLASSNAME$
|
|
106
|
+
block: block$14
|
|
107
|
+
} = classNames.bem(CLASSNAME$1j);
|
|
111
108
|
|
|
112
109
|
/**
|
|
113
110
|
* Component default props.
|
|
114
111
|
*/
|
|
115
|
-
const DEFAULT_PROPS$
|
|
112
|
+
const DEFAULT_PROPS$1a = {
|
|
116
113
|
size: Size$1.tiny,
|
|
117
114
|
kind: Kind$1.info
|
|
118
115
|
};
|
|
@@ -133,8 +130,8 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
133
130
|
className,
|
|
134
131
|
cancelProps,
|
|
135
132
|
confirmProps,
|
|
136
|
-
kind = DEFAULT_PROPS$
|
|
137
|
-
size = DEFAULT_PROPS$
|
|
133
|
+
kind = DEFAULT_PROPS$1a.kind,
|
|
134
|
+
size = DEFAULT_PROPS$1a.size,
|
|
138
135
|
dialogProps,
|
|
139
136
|
children,
|
|
140
137
|
...forwardedProps
|
|
@@ -175,7 +172,7 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
175
172
|
'aria-describedby': descriptionId,
|
|
176
173
|
...dialogProps
|
|
177
174
|
},
|
|
178
|
-
className: classNames.join(className, block$
|
|
175
|
+
className: classNames.join(className, block$14({
|
|
179
176
|
[`kind-${kind}`]: Boolean(kind)
|
|
180
177
|
})),
|
|
181
178
|
...forwardedProps,
|
|
@@ -221,8 +218,8 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
221
218
|
});
|
|
222
219
|
});
|
|
223
220
|
AlertDialog.displayName = COMPONENT_NAME$1l;
|
|
224
|
-
AlertDialog.className = CLASSNAME$
|
|
225
|
-
AlertDialog.defaultProps = DEFAULT_PROPS$
|
|
221
|
+
AlertDialog.className = CLASSNAME$1j;
|
|
222
|
+
AlertDialog.defaultProps = DEFAULT_PROPS$1a;
|
|
226
223
|
|
|
227
224
|
/**
|
|
228
225
|
* Hook focusing an element when defined and `focus` boolean `true`.
|
|
@@ -319,12 +316,12 @@ const COMPONENT_NAME$1k = 'Autocomplete';
|
|
|
319
316
|
/**
|
|
320
317
|
* Component default class name and class prefix.
|
|
321
318
|
*/
|
|
322
|
-
const CLASSNAME$
|
|
319
|
+
const CLASSNAME$1i = 'lumx-autocomplete';
|
|
323
320
|
|
|
324
321
|
/**
|
|
325
322
|
* Component default props.
|
|
326
323
|
*/
|
|
327
|
-
const DEFAULT_PROPS$
|
|
324
|
+
const DEFAULT_PROPS$19 = {
|
|
328
325
|
anchorToInput: false,
|
|
329
326
|
closeOnClick: false,
|
|
330
327
|
closeOnClickAway: true,
|
|
@@ -346,13 +343,13 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
346
343
|
otherProps
|
|
347
344
|
} = useDisableStateProps(props);
|
|
348
345
|
const {
|
|
349
|
-
anchorToInput = DEFAULT_PROPS$
|
|
346
|
+
anchorToInput = DEFAULT_PROPS$19.anchorToInput,
|
|
350
347
|
children,
|
|
351
348
|
chips,
|
|
352
349
|
className,
|
|
353
|
-
closeOnClick = DEFAULT_PROPS$
|
|
354
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
355
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
350
|
+
closeOnClick = DEFAULT_PROPS$19.closeOnClick,
|
|
351
|
+
closeOnClickAway = DEFAULT_PROPS$19.closeOnClickAway,
|
|
352
|
+
closeOnEscape = DEFAULT_PROPS$19.closeOnEscape,
|
|
356
353
|
error,
|
|
357
354
|
fitToAnchorWidth,
|
|
358
355
|
hasError,
|
|
@@ -373,7 +370,7 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
373
370
|
onInfiniteScroll,
|
|
374
371
|
placeholder,
|
|
375
372
|
placement,
|
|
376
|
-
shouldFocusOnClose = DEFAULT_PROPS$
|
|
373
|
+
shouldFocusOnClose = DEFAULT_PROPS$19.shouldFocusOnClose,
|
|
377
374
|
theme = defaultTheme,
|
|
378
375
|
value,
|
|
379
376
|
textFieldProps = {},
|
|
@@ -386,7 +383,7 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
386
383
|
return /*#__PURE__*/jsxs("div", {
|
|
387
384
|
ref: ref,
|
|
388
385
|
...forwardedProps,
|
|
389
|
-
className: classNames.join(className, CLASSNAME$
|
|
386
|
+
className: classNames.join(className, CLASSNAME$1i),
|
|
390
387
|
children: [/*#__PURE__*/jsx(TextField, {
|
|
391
388
|
...textFieldProps,
|
|
392
389
|
chips: chips,
|
|
@@ -427,8 +424,8 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
427
424
|
});
|
|
428
425
|
});
|
|
429
426
|
Autocomplete.displayName = COMPONENT_NAME$1k;
|
|
430
|
-
Autocomplete.className = CLASSNAME$
|
|
431
|
-
Autocomplete.defaultProps = DEFAULT_PROPS$
|
|
427
|
+
Autocomplete.className = CLASSNAME$1i;
|
|
428
|
+
Autocomplete.defaultProps = DEFAULT_PROPS$19;
|
|
432
429
|
|
|
433
430
|
/**
|
|
434
431
|
* Component display name.
|
|
@@ -438,12 +435,12 @@ const COMPONENT_NAME$1j = 'AutocompleteMultiple';
|
|
|
438
435
|
/**
|
|
439
436
|
* Component default class name and class prefix.
|
|
440
437
|
*/
|
|
441
|
-
const CLASSNAME$
|
|
438
|
+
const CLASSNAME$1h = 'lumx-autocomplete-multiple';
|
|
442
439
|
|
|
443
440
|
/**
|
|
444
441
|
* Component default props.
|
|
445
442
|
*/
|
|
446
|
-
const DEFAULT_PROPS$
|
|
443
|
+
const DEFAULT_PROPS$18 = {
|
|
447
444
|
closeOnClickAway: true,
|
|
448
445
|
closeOnEscape: true,
|
|
449
446
|
selectedChipRender(choice, index, onClear, isDisabled) {
|
|
@@ -483,8 +480,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
483
480
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
484
481
|
chipsAlignment,
|
|
485
482
|
className,
|
|
486
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
487
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
483
|
+
closeOnClickAway = DEFAULT_PROPS$18.closeOnClickAway,
|
|
484
|
+
closeOnEscape = DEFAULT_PROPS$18.closeOnEscape,
|
|
488
485
|
fitToAnchorWidth,
|
|
489
486
|
hasError,
|
|
490
487
|
helper,
|
|
@@ -506,19 +503,19 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
506
503
|
onKeyDown,
|
|
507
504
|
placeholder,
|
|
508
505
|
placement,
|
|
509
|
-
selectedChipRender = DEFAULT_PROPS$
|
|
506
|
+
selectedChipRender = DEFAULT_PROPS$18.selectedChipRender,
|
|
510
507
|
shouldFocusOnClose,
|
|
511
508
|
theme = defaultTheme,
|
|
512
509
|
type,
|
|
513
510
|
value,
|
|
514
|
-
values = DEFAULT_PROPS$
|
|
511
|
+
values = DEFAULT_PROPS$18.values,
|
|
515
512
|
...forwardedProps
|
|
516
513
|
} = otherProps;
|
|
517
514
|
return /*#__PURE__*/jsx(Autocomplete, {
|
|
518
515
|
ref: ref,
|
|
519
516
|
...forwardedProps,
|
|
520
517
|
anchorToInput: anchorToInput,
|
|
521
|
-
className: classNames.join(className, CLASSNAME$
|
|
518
|
+
className: classNames.join(className, CLASSNAME$1h),
|
|
522
519
|
name: name,
|
|
523
520
|
value: value,
|
|
524
521
|
onChange: onChange,
|
|
@@ -552,8 +549,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
552
549
|
});
|
|
553
550
|
});
|
|
554
551
|
AutocompleteMultiple.displayName = COMPONENT_NAME$1j;
|
|
555
|
-
AutocompleteMultiple.className = CLASSNAME$
|
|
556
|
-
AutocompleteMultiple.defaultProps = DEFAULT_PROPS$
|
|
552
|
+
AutocompleteMultiple.className = CLASSNAME$1h;
|
|
553
|
+
AutocompleteMultiple.defaultProps = DEFAULT_PROPS$18;
|
|
557
554
|
|
|
558
555
|
/**
|
|
559
556
|
* Component display name.
|
|
@@ -563,16 +560,16 @@ const COMPONENT_NAME$1i = 'Avatar';
|
|
|
563
560
|
/**
|
|
564
561
|
* Component default class name and class prefix.
|
|
565
562
|
*/
|
|
566
|
-
const CLASSNAME$
|
|
563
|
+
const CLASSNAME$1g = 'lumx-avatar';
|
|
567
564
|
const {
|
|
568
|
-
block: block$
|
|
569
|
-
element: element$
|
|
570
|
-
} = classNames.bem(CLASSNAME$
|
|
565
|
+
block: block$13,
|
|
566
|
+
element: element$N
|
|
567
|
+
} = classNames.bem(CLASSNAME$1g);
|
|
571
568
|
|
|
572
569
|
/**
|
|
573
570
|
* Component default props.
|
|
574
571
|
*/
|
|
575
|
-
const DEFAULT_PROPS$
|
|
572
|
+
const DEFAULT_PROPS$17 = {
|
|
576
573
|
size: Size$1.m
|
|
577
574
|
};
|
|
578
575
|
|
|
@@ -595,7 +592,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
595
592
|
linkAs,
|
|
596
593
|
onClick,
|
|
597
594
|
onKeyPress,
|
|
598
|
-
size = DEFAULT_PROPS$
|
|
595
|
+
size = DEFAULT_PROPS$17.size,
|
|
599
596
|
theme = defaultTheme,
|
|
600
597
|
thumbnailProps,
|
|
601
598
|
...forwardedProps
|
|
@@ -603,14 +600,14 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
603
600
|
return /*#__PURE__*/jsxs("div", {
|
|
604
601
|
ref: ref,
|
|
605
602
|
...forwardedProps,
|
|
606
|
-
className: classNames.join(className, block$
|
|
603
|
+
className: classNames.join(className, block$13({
|
|
607
604
|
[`size-${size}`]: Boolean(size),
|
|
608
605
|
[`theme-${theme}`]: Boolean(theme)
|
|
609
606
|
})),
|
|
610
607
|
children: [/*#__PURE__*/jsx(Thumbnail, {
|
|
611
608
|
linkProps: linkProps,
|
|
612
609
|
linkAs: linkAs,
|
|
613
|
-
className: element$
|
|
610
|
+
className: element$N('thumbnail'),
|
|
614
611
|
onClick: onClick,
|
|
615
612
|
onKeyPress: onKeyPress,
|
|
616
613
|
...thumbnailProps,
|
|
@@ -620,17 +617,17 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
620
617
|
alt: alt,
|
|
621
618
|
theme: theme
|
|
622
619
|
}), actions && /*#__PURE__*/jsx("div", {
|
|
623
|
-
className: element$
|
|
620
|
+
className: element$N('actions'),
|
|
624
621
|
children: actions
|
|
625
622
|
}), badge && /*#__PURE__*/jsx("div", {
|
|
626
|
-
className: element$
|
|
623
|
+
className: element$N('badge'),
|
|
627
624
|
children: badge
|
|
628
625
|
})]
|
|
629
626
|
});
|
|
630
627
|
});
|
|
631
628
|
Avatar.displayName = COMPONENT_NAME$1i;
|
|
632
|
-
Avatar.className = CLASSNAME$
|
|
633
|
-
Avatar.defaultProps = DEFAULT_PROPS$
|
|
629
|
+
Avatar.className = CLASSNAME$1g;
|
|
630
|
+
Avatar.defaultProps = DEFAULT_PROPS$17;
|
|
634
631
|
|
|
635
632
|
/**
|
|
636
633
|
* Alignments.
|
|
@@ -698,6 +695,8 @@ const ColorPalette = {
|
|
|
698
695
|
red: 'red',
|
|
699
696
|
light: 'light'};
|
|
700
697
|
|
|
698
|
+
/** ColorPalette with all possible color variant combination */
|
|
699
|
+
|
|
701
700
|
function getDefaultExportFromCjs (x) {
|
|
702
701
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
703
702
|
}
|
|
@@ -858,7 +857,7 @@ function modifier$1(baseName, modifiers) {
|
|
|
858
857
|
* block('button', { active: true, disabled: false }); // 'button button--active'
|
|
859
858
|
*/
|
|
860
859
|
|
|
861
|
-
function block$
|
|
860
|
+
function block$12(baseName, modifiersOrAdditionalClasses, additionalClasses) {
|
|
862
861
|
let modifiers;
|
|
863
862
|
let classes;
|
|
864
863
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
@@ -893,11 +892,11 @@ function block$17(baseName, modifiersOrAdditionalClasses, additionalClasses) {
|
|
|
893
892
|
* element('my-button', 'icon', { active: true }); // 'my-button__icon my-button__icon--active'
|
|
894
893
|
*/
|
|
895
894
|
|
|
896
|
-
function element$
|
|
895
|
+
function element$M(baseClass, elem, modifiersOrAdditionalClasses, additionalClasses) {
|
|
897
896
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
898
|
-
return block$
|
|
897
|
+
return block$12(`${baseClass}__${elem}`, modifiersOrAdditionalClasses);
|
|
899
898
|
}
|
|
900
|
-
return block$
|
|
899
|
+
return block$12(`${baseClass}__${elem}`, modifiersOrAdditionalClasses, additionalClasses);
|
|
901
900
|
}
|
|
902
901
|
|
|
903
902
|
/**
|
|
@@ -906,15 +905,15 @@ function element$R(baseClass, elem, modifiersOrAdditionalClasses, additionalClas
|
|
|
906
905
|
function bem(baseName) {
|
|
907
906
|
function blockFn(modifiersOrAdditionalClasses, additionalClasses) {
|
|
908
907
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
909
|
-
return block$
|
|
908
|
+
return block$12(baseName, modifiersOrAdditionalClasses);
|
|
910
909
|
}
|
|
911
|
-
return block$
|
|
910
|
+
return block$12(baseName, modifiersOrAdditionalClasses, additionalClasses);
|
|
912
911
|
}
|
|
913
912
|
function elementFn(elem, modifiersOrAdditionalClasses, additionalClasses) {
|
|
914
913
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
915
|
-
return element$
|
|
914
|
+
return element$M(baseName, elem, modifiersOrAdditionalClasses);
|
|
916
915
|
}
|
|
917
|
-
return element$
|
|
916
|
+
return element$M(baseName, elem, modifiersOrAdditionalClasses, additionalClasses);
|
|
918
917
|
}
|
|
919
918
|
return {
|
|
920
919
|
block: blockFn,
|
|
@@ -931,15 +930,15 @@ const COMPONENT_NAME$1h = 'Badge';
|
|
|
931
930
|
/**
|
|
932
931
|
* Component default class name and class prefix.
|
|
933
932
|
*/
|
|
934
|
-
const CLASSNAME$
|
|
933
|
+
const CLASSNAME$1f = 'lumx-badge';
|
|
935
934
|
const {
|
|
936
|
-
block: block$
|
|
937
|
-
} = bem(CLASSNAME$
|
|
935
|
+
block: block$11
|
|
936
|
+
} = bem(CLASSNAME$1f);
|
|
938
937
|
|
|
939
938
|
/**
|
|
940
939
|
* Component default props.
|
|
941
940
|
*/
|
|
942
|
-
const DEFAULT_PROPS$
|
|
941
|
+
const DEFAULT_PROPS$16 = {
|
|
943
942
|
color: ColorPalette.primary
|
|
944
943
|
};
|
|
945
944
|
|
|
@@ -953,22 +952,22 @@ const Badge$1 = props => {
|
|
|
953
952
|
const {
|
|
954
953
|
children,
|
|
955
954
|
className,
|
|
956
|
-
color = DEFAULT_PROPS$
|
|
955
|
+
color = DEFAULT_PROPS$16.color,
|
|
957
956
|
ref,
|
|
958
957
|
...forwardedProps
|
|
959
958
|
} = props;
|
|
960
959
|
return /*#__PURE__*/jsx("div", {
|
|
961
960
|
ref: ref,
|
|
962
961
|
...forwardedProps,
|
|
963
|
-
className: classnames(className, block$
|
|
962
|
+
className: classnames(className, block$11({
|
|
964
963
|
[`color-${color}`]: Boolean(color)
|
|
965
964
|
})),
|
|
966
965
|
children: children
|
|
967
966
|
});
|
|
968
967
|
};
|
|
969
968
|
Badge$1.displayName = COMPONENT_NAME$1h;
|
|
970
|
-
Badge$1.className = CLASSNAME$
|
|
971
|
-
Badge$1.defaultProps = DEFAULT_PROPS$
|
|
969
|
+
Badge$1.className = CLASSNAME$1f;
|
|
970
|
+
Badge$1.defaultProps = DEFAULT_PROPS$16;
|
|
972
971
|
|
|
973
972
|
/**
|
|
974
973
|
* Defines the props of the component.
|
|
@@ -992,11 +991,11 @@ Badge.className = Badge$1.className;
|
|
|
992
991
|
Badge.defaultProps = Badge$1.defaultProps;
|
|
993
992
|
|
|
994
993
|
const COMPONENT_NAME$1g = 'BadgeWrapper';
|
|
995
|
-
const CLASSNAME$
|
|
994
|
+
const CLASSNAME$1e = 'lumx-badge-wrapper';
|
|
996
995
|
const {
|
|
997
|
-
block: block$
|
|
998
|
-
element: element$
|
|
999
|
-
} = bem(CLASSNAME$
|
|
996
|
+
block: block$10,
|
|
997
|
+
element: element$L
|
|
998
|
+
} = bem(CLASSNAME$1e);
|
|
1000
999
|
const BadgeWrapper$1 = props => {
|
|
1001
1000
|
const {
|
|
1002
1001
|
badge,
|
|
@@ -1008,9 +1007,9 @@ const BadgeWrapper$1 = props => {
|
|
|
1008
1007
|
return /*#__PURE__*/jsxs("div", {
|
|
1009
1008
|
ref: ref,
|
|
1010
1009
|
...forwardedProps,
|
|
1011
|
-
className: classnames(className, block$
|
|
1010
|
+
className: classnames(className, block$10()),
|
|
1012
1011
|
children: [children, badge && /*#__PURE__*/jsx("div", {
|
|
1013
|
-
className: element$
|
|
1012
|
+
className: element$L('badge'),
|
|
1014
1013
|
children: badge
|
|
1015
1014
|
})]
|
|
1016
1015
|
});
|
|
@@ -1023,7 +1022,7 @@ const BadgeWrapper = forwardRef((props, ref) => {
|
|
|
1023
1022
|
});
|
|
1024
1023
|
});
|
|
1025
1024
|
BadgeWrapper.displayName = COMPONENT_NAME$1g;
|
|
1026
|
-
BadgeWrapper.className = CLASSNAME$
|
|
1025
|
+
BadgeWrapper.className = CLASSNAME$1e;
|
|
1027
1026
|
|
|
1028
1027
|
/**
|
|
1029
1028
|
* Render clickable element (link, button or custom element)
|
|
@@ -1184,15 +1183,15 @@ const COMPONENT_NAME$1e = 'Button';
|
|
|
1184
1183
|
/**
|
|
1185
1184
|
* Component default class name and class prefix.
|
|
1186
1185
|
*/
|
|
1187
|
-
const CLASSNAME$
|
|
1186
|
+
const CLASSNAME$1d = 'lumx-button';
|
|
1188
1187
|
const {
|
|
1189
1188
|
modifier
|
|
1190
|
-
} = bem(CLASSNAME$
|
|
1189
|
+
} = bem(CLASSNAME$1d);
|
|
1191
1190
|
|
|
1192
1191
|
/**
|
|
1193
1192
|
* Component default props.
|
|
1194
1193
|
*/
|
|
1195
|
-
const DEFAULT_PROPS$
|
|
1194
|
+
const DEFAULT_PROPS$15 = {
|
|
1196
1195
|
emphasis: Emphasis.high,
|
|
1197
1196
|
size: Size.m
|
|
1198
1197
|
};
|
|
@@ -1206,10 +1205,10 @@ const DEFAULT_PROPS$16 = {
|
|
|
1206
1205
|
const Button$1 = props => {
|
|
1207
1206
|
const {
|
|
1208
1207
|
className,
|
|
1209
|
-
emphasis = DEFAULT_PROPS$
|
|
1208
|
+
emphasis = DEFAULT_PROPS$15.emphasis,
|
|
1210
1209
|
leftIcon,
|
|
1211
1210
|
rightIcon,
|
|
1212
|
-
size = DEFAULT_PROPS$
|
|
1211
|
+
size = DEFAULT_PROPS$15.size,
|
|
1213
1212
|
...forwardedProps
|
|
1214
1213
|
} = props;
|
|
1215
1214
|
const buttonClassName = classnames(className, modifier({
|
|
@@ -1225,8 +1224,8 @@ const Button$1 = props => {
|
|
|
1225
1224
|
});
|
|
1226
1225
|
};
|
|
1227
1226
|
Button$1.displayName = COMPONENT_NAME$1e;
|
|
1228
|
-
Button$1.className = CLASSNAME$
|
|
1229
|
-
Button$1.defaultProps = DEFAULT_PROPS$
|
|
1227
|
+
Button$1.className = CLASSNAME$1d;
|
|
1228
|
+
Button$1.defaultProps = DEFAULT_PROPS$15;
|
|
1230
1229
|
|
|
1231
1230
|
/**
|
|
1232
1231
|
* Properties of a component to use to determine it's name.
|
|
@@ -1293,8 +1292,8 @@ const Button = forwardRef((props, ref) => {
|
|
|
1293
1292
|
});
|
|
1294
1293
|
});
|
|
1295
1294
|
Button.displayName = COMPONENT_NAME$1e;
|
|
1296
|
-
Button.className = CLASSNAME$
|
|
1297
|
-
Button.defaultProps = DEFAULT_PROPS$
|
|
1295
|
+
Button.className = CLASSNAME$1d;
|
|
1296
|
+
Button.defaultProps = DEFAULT_PROPS$15;
|
|
1298
1297
|
|
|
1299
1298
|
const COMPONENT_NAME$1d = 'Icon';
|
|
1300
1299
|
const IconClassName = 'lumx-icon';
|
|
@@ -1303,15 +1302,15 @@ const IconClassName = 'lumx-icon';
|
|
|
1303
1302
|
* Defines the props of the component.
|
|
1304
1303
|
*/
|
|
1305
1304
|
|
|
1306
|
-
const CLASSNAME$
|
|
1305
|
+
const CLASSNAME$1c = IconClassName;
|
|
1307
1306
|
const {
|
|
1308
|
-
block: block
|
|
1309
|
-
} = bem(CLASSNAME$
|
|
1307
|
+
block: block$$
|
|
1308
|
+
} = bem(CLASSNAME$1c);
|
|
1310
1309
|
|
|
1311
1310
|
/**
|
|
1312
1311
|
* Component default props.
|
|
1313
1312
|
*/
|
|
1314
|
-
const DEFAULT_PROPS$
|
|
1313
|
+
const DEFAULT_PROPS$14 = {};
|
|
1315
1314
|
|
|
1316
1315
|
/**
|
|
1317
1316
|
* Icon component.
|
|
@@ -1360,7 +1359,7 @@ const Icon$1 = props => {
|
|
|
1360
1359
|
return /*#__PURE__*/jsx("i", {
|
|
1361
1360
|
ref: ref,
|
|
1362
1361
|
...forwardedProps,
|
|
1363
|
-
className: classnames(className, block
|
|
1362
|
+
className: classnames(className, block$$({
|
|
1364
1363
|
[`color-${iconColor}`]: Boolean(iconColor),
|
|
1365
1364
|
[`color-variant-${iconColorVariant}`]: Boolean(iconColorVariant),
|
|
1366
1365
|
'has-shape': hasShape,
|
|
@@ -1390,8 +1389,8 @@ const Icon$1 = props => {
|
|
|
1390
1389
|
});
|
|
1391
1390
|
};
|
|
1392
1391
|
Icon$1.displayName = COMPONENT_NAME$1d;
|
|
1393
|
-
Icon$1.className = CLASSNAME$
|
|
1394
|
-
Icon$1.defaultProps = DEFAULT_PROPS$
|
|
1392
|
+
Icon$1.className = CLASSNAME$1c;
|
|
1393
|
+
Icon$1.defaultProps = DEFAULT_PROPS$14;
|
|
1395
1394
|
|
|
1396
1395
|
/**
|
|
1397
1396
|
* Component display name.
|
|
@@ -1401,12 +1400,12 @@ const COMPONENT_NAME$1c = 'IconButton';
|
|
|
1401
1400
|
/**
|
|
1402
1401
|
* Component default class name and class prefix.
|
|
1403
1402
|
*/
|
|
1404
|
-
const CLASSNAME$
|
|
1403
|
+
const CLASSNAME$1b = 'lumx-icon-button';
|
|
1405
1404
|
|
|
1406
1405
|
/**
|
|
1407
1406
|
* Component default props.
|
|
1408
1407
|
*/
|
|
1409
|
-
const DEFAULT_PROPS$
|
|
1408
|
+
const DEFAULT_PROPS$13 = {
|
|
1410
1409
|
emphasis: Emphasis.high,
|
|
1411
1410
|
size: Size.m
|
|
1412
1411
|
};
|
|
@@ -1419,11 +1418,11 @@ const DEFAULT_PROPS$14 = {
|
|
|
1419
1418
|
*/
|
|
1420
1419
|
const IconButton$1 = props => {
|
|
1421
1420
|
const {
|
|
1422
|
-
emphasis = DEFAULT_PROPS$
|
|
1421
|
+
emphasis = DEFAULT_PROPS$13.emphasis,
|
|
1423
1422
|
image,
|
|
1424
1423
|
icon,
|
|
1425
1424
|
label,
|
|
1426
|
-
size = DEFAULT_PROPS$
|
|
1425
|
+
size = DEFAULT_PROPS$13.size,
|
|
1427
1426
|
...forwardedProps
|
|
1428
1427
|
} = props;
|
|
1429
1428
|
const defaultChildren = image ? /*#__PURE__*/jsx("img", {
|
|
@@ -1443,8 +1442,8 @@ const IconButton$1 = props => {
|
|
|
1443
1442
|
});
|
|
1444
1443
|
};
|
|
1445
1444
|
IconButton$1.displayName = COMPONENT_NAME$1c;
|
|
1446
|
-
IconButton$1.className = CLASSNAME$
|
|
1447
|
-
IconButton$1.defaultProps = DEFAULT_PROPS$
|
|
1445
|
+
IconButton$1.className = CLASSNAME$1b;
|
|
1446
|
+
IconButton$1.defaultProps = DEFAULT_PROPS$13;
|
|
1448
1447
|
|
|
1449
1448
|
/**
|
|
1450
1449
|
* IconButton component.
|
|
@@ -1480,8 +1479,8 @@ const IconButton = forwardRef((props, ref) => {
|
|
|
1480
1479
|
});
|
|
1481
1480
|
});
|
|
1482
1481
|
IconButton.displayName = COMPONENT_NAME$1c;
|
|
1483
|
-
IconButton.className = CLASSNAME$
|
|
1484
|
-
IconButton.defaultProps = DEFAULT_PROPS$
|
|
1482
|
+
IconButton.className = CLASSNAME$1b;
|
|
1483
|
+
IconButton.defaultProps = DEFAULT_PROPS$13;
|
|
1485
1484
|
|
|
1486
1485
|
/**
|
|
1487
1486
|
* Component display name.
|
|
@@ -1491,12 +1490,12 @@ const COMPONENT_NAME$1b = 'ButtonGroup';
|
|
|
1491
1490
|
/**
|
|
1492
1491
|
* Component default class name and class prefix.
|
|
1493
1492
|
*/
|
|
1494
|
-
const CLASSNAME$
|
|
1493
|
+
const CLASSNAME$1a = 'lumx-button-group';
|
|
1495
1494
|
|
|
1496
1495
|
/**
|
|
1497
1496
|
* Component default props.
|
|
1498
1497
|
*/
|
|
1499
|
-
const DEFAULT_PROPS$
|
|
1498
|
+
const DEFAULT_PROPS$12 = {};
|
|
1500
1499
|
|
|
1501
1500
|
/**
|
|
1502
1501
|
* ButtonGroup component.
|
|
@@ -1512,13 +1511,13 @@ const ButtonGroup$1 = props => {
|
|
|
1512
1511
|
} = props;
|
|
1513
1512
|
return /*#__PURE__*/jsx("div", {
|
|
1514
1513
|
...forwardedProps,
|
|
1515
|
-
className: classnames(className, CLASSNAME$
|
|
1514
|
+
className: classnames(className, CLASSNAME$1a),
|
|
1516
1515
|
children: children
|
|
1517
1516
|
});
|
|
1518
1517
|
};
|
|
1519
1518
|
ButtonGroup$1.displayName = COMPONENT_NAME$1b;
|
|
1520
|
-
ButtonGroup$1.className = CLASSNAME$
|
|
1521
|
-
ButtonGroup$1.defaultProps = DEFAULT_PROPS$
|
|
1519
|
+
ButtonGroup$1.className = CLASSNAME$1a;
|
|
1520
|
+
ButtonGroup$1.defaultProps = DEFAULT_PROPS$12;
|
|
1522
1521
|
|
|
1523
1522
|
/**
|
|
1524
1523
|
* ButtonGroup component.
|
|
@@ -1534,16 +1533,16 @@ const ButtonGroup = forwardRef((props, ref) => {
|
|
|
1534
1533
|
});
|
|
1535
1534
|
});
|
|
1536
1535
|
ButtonGroup.displayName = COMPONENT_NAME$1b;
|
|
1537
|
-
ButtonGroup.className = CLASSNAME$
|
|
1538
|
-
ButtonGroup.defaultProps = DEFAULT_PROPS$
|
|
1536
|
+
ButtonGroup.className = CLASSNAME$1a;
|
|
1537
|
+
ButtonGroup.defaultProps = DEFAULT_PROPS$12;
|
|
1539
1538
|
|
|
1540
1539
|
const COMPONENT_NAME$1a = 'InputLabel';
|
|
1541
1540
|
const InputLabelClassName = 'lumx-input-label';
|
|
1542
|
-
const CLASSNAME$
|
|
1541
|
+
const CLASSNAME$19 = InputLabelClassName;
|
|
1543
1542
|
const {
|
|
1544
|
-
block: block$
|
|
1545
|
-
} = bem(CLASSNAME$
|
|
1546
|
-
const DEFAULT_PROPS$
|
|
1543
|
+
block: block$_
|
|
1544
|
+
} = bem(CLASSNAME$19);
|
|
1545
|
+
const DEFAULT_PROPS$11 = {};
|
|
1547
1546
|
|
|
1548
1547
|
/**
|
|
1549
1548
|
* InputLabel component.
|
|
@@ -1563,7 +1562,7 @@ function InputLabel$1(props) {
|
|
|
1563
1562
|
ref: ref,
|
|
1564
1563
|
...forwardedProps,
|
|
1565
1564
|
htmlFor: htmlFor,
|
|
1566
|
-
className: classnames(className, block$
|
|
1565
|
+
className: classnames(className, block$_({
|
|
1567
1566
|
'is-required': isRequired,
|
|
1568
1567
|
[`theme-${theme}`]: Boolean(theme),
|
|
1569
1568
|
'has-custom-typography': Boolean(typography$1)
|
|
@@ -1572,8 +1571,8 @@ function InputLabel$1(props) {
|
|
|
1572
1571
|
});
|
|
1573
1572
|
}
|
|
1574
1573
|
InputLabel$1.displayName = COMPONENT_NAME$1a;
|
|
1575
|
-
InputLabel$1.className = CLASSNAME$
|
|
1576
|
-
InputLabel$1.defaultProps = DEFAULT_PROPS$
|
|
1574
|
+
InputLabel$1.className = CLASSNAME$19;
|
|
1575
|
+
InputLabel$1.defaultProps = DEFAULT_PROPS$11;
|
|
1577
1576
|
|
|
1578
1577
|
const INPUT_HELPER_CONFIGURATION = {
|
|
1579
1578
|
[Kind.error]: {
|
|
@@ -1594,15 +1593,15 @@ const InputHelperClassName = 'lumx-input-helper';
|
|
|
1594
1593
|
* Defines the props of the component.
|
|
1595
1594
|
*/
|
|
1596
1595
|
|
|
1597
|
-
const CLASSNAME$
|
|
1596
|
+
const CLASSNAME$18 = InputHelperClassName;
|
|
1598
1597
|
const {
|
|
1599
|
-
block: block$
|
|
1600
|
-
} = bem(CLASSNAME$
|
|
1598
|
+
block: block$Z
|
|
1599
|
+
} = bem(CLASSNAME$18);
|
|
1601
1600
|
|
|
1602
1601
|
/**
|
|
1603
1602
|
* Component default props.
|
|
1604
1603
|
*/
|
|
1605
|
-
const DEFAULT_PROPS$
|
|
1604
|
+
const DEFAULT_PROPS$10 = {
|
|
1606
1605
|
kind: Kind.info
|
|
1607
1606
|
};
|
|
1608
1607
|
|
|
@@ -1613,7 +1612,7 @@ function InputHelper$1(props) {
|
|
|
1613
1612
|
const {
|
|
1614
1613
|
children,
|
|
1615
1614
|
className,
|
|
1616
|
-
kind = DEFAULT_PROPS$
|
|
1615
|
+
kind = DEFAULT_PROPS$10.kind,
|
|
1617
1616
|
theme,
|
|
1618
1617
|
ref,
|
|
1619
1618
|
...forwardedProps
|
|
@@ -1624,7 +1623,7 @@ function InputHelper$1(props) {
|
|
|
1624
1623
|
return /*#__PURE__*/jsx("p", {
|
|
1625
1624
|
ref: ref,
|
|
1626
1625
|
...forwardedProps,
|
|
1627
|
-
className: classnames(className, block$
|
|
1626
|
+
className: classnames(className, block$Z({
|
|
1628
1627
|
[`color-${color}`]: Boolean(color),
|
|
1629
1628
|
[`theme-${theme}`]: Boolean(theme)
|
|
1630
1629
|
})),
|
|
@@ -1632,8 +1631,8 @@ function InputHelper$1(props) {
|
|
|
1632
1631
|
});
|
|
1633
1632
|
}
|
|
1634
1633
|
InputHelper$1.displayName = COMPONENT_NAME$19;
|
|
1635
|
-
InputHelper$1.className = CLASSNAME$
|
|
1636
|
-
InputHelper$1.defaultProps = DEFAULT_PROPS$
|
|
1634
|
+
InputHelper$1.className = CLASSNAME$18;
|
|
1635
|
+
InputHelper$1.defaultProps = DEFAULT_PROPS$10;
|
|
1637
1636
|
|
|
1638
1637
|
const INTERMEDIATE_STATE = 'intermediate';
|
|
1639
1638
|
|
|
@@ -1649,11 +1648,11 @@ const COMPONENT_NAME$18 = 'Checkbox';
|
|
|
1649
1648
|
/**
|
|
1650
1649
|
* Component default class name and class prefix.
|
|
1651
1650
|
*/
|
|
1652
|
-
const CLASSNAME$
|
|
1651
|
+
const CLASSNAME$17 = 'lumx-checkbox';
|
|
1653
1652
|
const {
|
|
1654
|
-
block: block$
|
|
1655
|
-
element: element$
|
|
1656
|
-
} = bem(CLASSNAME$
|
|
1653
|
+
block: block$Y,
|
|
1654
|
+
element: element$K
|
|
1655
|
+
} = bem(CLASSNAME$17);
|
|
1657
1656
|
|
|
1658
1657
|
/**
|
|
1659
1658
|
* Checkbox component.
|
|
@@ -1689,7 +1688,7 @@ const Checkbox$1 = props => {
|
|
|
1689
1688
|
return /*#__PURE__*/jsxs("div", {
|
|
1690
1689
|
ref: ref,
|
|
1691
1690
|
...forwardedProps,
|
|
1692
|
-
className: classnames(className, block$
|
|
1691
|
+
className: classnames(className, block$Y({
|
|
1693
1692
|
// Whether state is intermediate class name will "-checked"
|
|
1694
1693
|
'is-checked': intermediateState ? true : isChecked,
|
|
1695
1694
|
'is-disabled': isDisabled,
|
|
@@ -1697,12 +1696,12 @@ const Checkbox$1 = props => {
|
|
|
1697
1696
|
[`theme-${theme}`]: Boolean(theme)
|
|
1698
1697
|
})),
|
|
1699
1698
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1700
|
-
className: element$
|
|
1699
|
+
className: element$K('input-wrapper'),
|
|
1701
1700
|
children: [/*#__PURE__*/jsx("input", {
|
|
1702
1701
|
ref: inputRef,
|
|
1703
1702
|
type: "checkbox",
|
|
1704
1703
|
id: inputId,
|
|
1705
|
-
className: element$
|
|
1704
|
+
className: element$K('input-native'),
|
|
1706
1705
|
name: name,
|
|
1707
1706
|
value: value,
|
|
1708
1707
|
checked: isChecked,
|
|
@@ -1714,26 +1713,26 @@ const Checkbox$1 = props => {
|
|
|
1714
1713
|
} : {}),
|
|
1715
1714
|
...inputProps
|
|
1716
1715
|
}), /*#__PURE__*/jsxs("div", {
|
|
1717
|
-
className: element$
|
|
1716
|
+
className: element$K('input-placeholder'),
|
|
1718
1717
|
children: [/*#__PURE__*/jsx("div", {
|
|
1719
|
-
className: element$
|
|
1718
|
+
className: element$K('input-background')
|
|
1720
1719
|
}), /*#__PURE__*/jsx("div", {
|
|
1721
|
-
className: element$
|
|
1720
|
+
className: element$K('input-indicator'),
|
|
1722
1721
|
children: Icon$1({
|
|
1723
1722
|
icon: intermediateState ? mdiMinus : mdiCheck
|
|
1724
1723
|
})
|
|
1725
1724
|
})]
|
|
1726
1725
|
})]
|
|
1727
1726
|
}), /*#__PURE__*/jsxs("div", {
|
|
1728
|
-
className: element$
|
|
1727
|
+
className: element$K('content'),
|
|
1729
1728
|
children: [label && InputLabel$1({
|
|
1730
1729
|
htmlFor: inputId,
|
|
1731
|
-
className: element$
|
|
1730
|
+
className: element$K('label'),
|
|
1732
1731
|
theme,
|
|
1733
1732
|
children: label
|
|
1734
1733
|
}), helper && InputHelper$1({
|
|
1735
1734
|
id: `${inputId}-helper`,
|
|
1736
|
-
className: element$
|
|
1735
|
+
className: element$K('helper'),
|
|
1737
1736
|
theme,
|
|
1738
1737
|
children: helper
|
|
1739
1738
|
})]
|
|
@@ -1748,7 +1747,7 @@ const Checkbox$1 = props => {
|
|
|
1748
1747
|
/**
|
|
1749
1748
|
* Component default props.
|
|
1750
1749
|
*/
|
|
1751
|
-
const DEFAULT_PROPS
|
|
1750
|
+
const DEFAULT_PROPS$$ = {};
|
|
1752
1751
|
|
|
1753
1752
|
/**
|
|
1754
1753
|
* Checkbox component.
|
|
@@ -1809,8 +1808,8 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
1809
1808
|
});
|
|
1810
1809
|
});
|
|
1811
1810
|
Checkbox.displayName = COMPONENT_NAME$18;
|
|
1812
|
-
Checkbox.className = CLASSNAME$
|
|
1813
|
-
Checkbox.defaultProps = DEFAULT_PROPS
|
|
1811
|
+
Checkbox.className = CLASSNAME$17;
|
|
1812
|
+
Checkbox.defaultProps = DEFAULT_PROPS$$;
|
|
1814
1813
|
|
|
1815
1814
|
/**
|
|
1816
1815
|
* Wrap mouse event handler to stop event propagation.
|
|
@@ -1836,16 +1835,16 @@ const COMPONENT_NAME$17 = 'Chip';
|
|
|
1836
1835
|
/**
|
|
1837
1836
|
* Component default class name and class prefix.
|
|
1838
1837
|
*/
|
|
1839
|
-
const CLASSNAME$
|
|
1838
|
+
const CLASSNAME$16 = 'lumx-chip';
|
|
1840
1839
|
const {
|
|
1841
|
-
block: block$
|
|
1842
|
-
element: element$
|
|
1843
|
-
} = classNames.bem(CLASSNAME$
|
|
1840
|
+
block: block$X,
|
|
1841
|
+
element: element$J
|
|
1842
|
+
} = classNames.bem(CLASSNAME$16);
|
|
1844
1843
|
|
|
1845
1844
|
/**
|
|
1846
1845
|
* Component default props.
|
|
1847
1846
|
*/
|
|
1848
|
-
const DEFAULT_PROPS
|
|
1847
|
+
const DEFAULT_PROPS$_ = {
|
|
1849
1848
|
size: Size$1.m
|
|
1850
1849
|
};
|
|
1851
1850
|
|
|
@@ -1875,7 +1874,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1875
1874
|
onAfterClick,
|
|
1876
1875
|
onBeforeClick,
|
|
1877
1876
|
onClick,
|
|
1878
|
-
size = DEFAULT_PROPS
|
|
1877
|
+
size = DEFAULT_PROPS$_.size,
|
|
1879
1878
|
theme = defaultTheme,
|
|
1880
1879
|
href,
|
|
1881
1880
|
onKeyDown,
|
|
@@ -1906,7 +1905,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1906
1905
|
...forwardedProps,
|
|
1907
1906
|
href: !disabledStateProps.disabled ? href : undefined,
|
|
1908
1907
|
ref: ref,
|
|
1909
|
-
className: classNames.join(className, block$
|
|
1908
|
+
className: classNames.join(className, block$X({
|
|
1910
1909
|
'is-clickable': isClickable,
|
|
1911
1910
|
[`color-${chipColor}`]: Boolean(chipColor),
|
|
1912
1911
|
'is-disabled': isAnyDisabled,
|
|
@@ -1924,19 +1923,19 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1924
1923
|
/*#__PURE__*/
|
|
1925
1924
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1926
1925
|
jsx("div", {
|
|
1927
|
-
className: element$
|
|
1926
|
+
className: element$J('before', {
|
|
1928
1927
|
'is-clickable': hasBeforeClick
|
|
1929
1928
|
}),
|
|
1930
1929
|
onClick: handleOnBeforeClick,
|
|
1931
1930
|
children: before
|
|
1932
1931
|
}), /*#__PURE__*/jsx("div", {
|
|
1933
|
-
className: element$
|
|
1932
|
+
className: element$J('label'),
|
|
1934
1933
|
children: children
|
|
1935
1934
|
}), after &&
|
|
1936
1935
|
/*#__PURE__*/
|
|
1937
1936
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1938
1937
|
jsx("div", {
|
|
1939
|
-
className: element$
|
|
1938
|
+
className: element$J('after', {
|
|
1940
1939
|
'is-clickable': hasAfterClick
|
|
1941
1940
|
}),
|
|
1942
1941
|
onClick: handleOnAfterClick,
|
|
@@ -1946,8 +1945,8 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1946
1945
|
);
|
|
1947
1946
|
});
|
|
1948
1947
|
Chip.displayName = COMPONENT_NAME$17;
|
|
1949
|
-
Chip.className = CLASSNAME$
|
|
1950
|
-
Chip.defaultProps = DEFAULT_PROPS
|
|
1948
|
+
Chip.className = CLASSNAME$16;
|
|
1949
|
+
Chip.defaultProps = DEFAULT_PROPS$_;
|
|
1951
1950
|
|
|
1952
1951
|
const INITIAL_STATE_ACTIVE_CHIP = -1;
|
|
1953
1952
|
|
|
@@ -2003,7 +2002,7 @@ const useChipGroupNavigation = (chips, onChipDeleted, initialActiveChip = INITIA
|
|
|
2003
2002
|
/**
|
|
2004
2003
|
* Component default props.
|
|
2005
2004
|
*/
|
|
2006
|
-
const DEFAULT_PROPS$
|
|
2005
|
+
const DEFAULT_PROPS$Z = {};
|
|
2007
2006
|
|
|
2008
2007
|
/**
|
|
2009
2008
|
* Component display name.
|
|
@@ -2013,7 +2012,7 @@ const COMPONENT_NAME$16 = 'ChipGroup';
|
|
|
2013
2012
|
/**
|
|
2014
2013
|
* Component default class name and class prefix.
|
|
2015
2014
|
*/
|
|
2016
|
-
const CLASSNAME$
|
|
2015
|
+
const CLASSNAME$15 = 'lumx-chip-group';
|
|
2017
2016
|
|
|
2018
2017
|
/**
|
|
2019
2018
|
* ChipGroup component.
|
|
@@ -2032,13 +2031,13 @@ const InternalChipGroup = forwardRef((props, ref) => {
|
|
|
2032
2031
|
return /*#__PURE__*/jsx("div", {
|
|
2033
2032
|
ref: ref,
|
|
2034
2033
|
...forwardedProps,
|
|
2035
|
-
className: classNames.join(className, CLASSNAME$
|
|
2034
|
+
className: classNames.join(className, CLASSNAME$15),
|
|
2036
2035
|
children: children
|
|
2037
2036
|
});
|
|
2038
2037
|
});
|
|
2039
2038
|
InternalChipGroup.displayName = COMPONENT_NAME$16;
|
|
2040
|
-
InternalChipGroup.className = CLASSNAME$
|
|
2041
|
-
InternalChipGroup.defaultProps = DEFAULT_PROPS$
|
|
2039
|
+
InternalChipGroup.className = CLASSNAME$15;
|
|
2040
|
+
InternalChipGroup.defaultProps = DEFAULT_PROPS$Z;
|
|
2042
2041
|
const ChipGroup = Object.assign(InternalChipGroup, {
|
|
2043
2042
|
useChipGroupNavigation
|
|
2044
2043
|
});
|
|
@@ -2108,1469 +2107,119 @@ function useFocusLastChipOnBackspace(chipRefs, inputRef) {
|
|
|
2108
2107
|
evt.preventDefault();
|
|
2109
2108
|
|
|
2110
2109
|
// Focus the last enabled chip (if any exists)
|
|
2111
|
-
const lastChip = findPreviousEnabledChip();
|
|
2112
|
-
lastChip?.focus();
|
|
2113
|
-
};
|
|
2114
|
-
|
|
2115
|
-
// Attach keyboard event listener
|
|
2116
|
-
input.addEventListener('keydown', onKeyDown);
|
|
2117
|
-
|
|
2118
|
-
// Cleanup listener on unmount
|
|
2119
|
-
return () => {
|
|
2120
|
-
input.removeEventListener('keydown', onKeyDown);
|
|
2121
|
-
};
|
|
2122
|
-
}, [inputRef, findPreviousEnabledChip]);
|
|
2123
|
-
return {
|
|
2124
|
-
findPreviousEnabledChip
|
|
2125
|
-
};
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
/**
|
|
2129
|
-
* Component default class name and class prefix.
|
|
2130
|
-
*/
|
|
2131
|
-
const CLASSNAME$18 = 'lumx-selection-chip-group';
|
|
2132
|
-
const {
|
|
2133
|
-
block: block$$,
|
|
2134
|
-
element: element$N
|
|
2135
|
-
} = classNames.bem(CLASSNAME$18);
|
|
2136
|
-
|
|
2137
|
-
/**
|
|
2138
|
-
* SelectionChipGroup component.
|
|
2139
|
-
*
|
|
2140
|
-
* @param props Component props.
|
|
2141
|
-
* @param ref Component ref.
|
|
2142
|
-
* @return React element.
|
|
2143
|
-
*/
|
|
2144
|
-
const SelectionChipGroup = ({
|
|
2145
|
-
onChange,
|
|
2146
|
-
value,
|
|
2147
|
-
getOptionId,
|
|
2148
|
-
getOptionName,
|
|
2149
|
-
inputRef,
|
|
2150
|
-
inputLabel,
|
|
2151
|
-
renderChip,
|
|
2152
|
-
theme,
|
|
2153
|
-
isDisabled,
|
|
2154
|
-
chipTooltipLabel,
|
|
2155
|
-
label,
|
|
2156
|
-
...forwardedProps
|
|
2157
|
-
}) => {
|
|
2158
|
-
const chipRefs = React__default.useRef([]);
|
|
2159
|
-
const {
|
|
2160
|
-
findPreviousEnabledChip
|
|
2161
|
-
} = useFocusLastChipOnBackspace(chipRefs, inputRef);
|
|
2162
|
-
return /*#__PURE__*/jsx(ChipGroup, {
|
|
2163
|
-
role: "group",
|
|
2164
|
-
"aria-label": label,
|
|
2165
|
-
className: block$$(),
|
|
2166
|
-
...forwardedProps,
|
|
2167
|
-
children: value?.map((v, index) => {
|
|
2168
|
-
const name = getWithSelector(getOptionName, v);
|
|
2169
|
-
const id = getWithSelector(getOptionId, v);
|
|
2170
|
-
const onClick = () => {
|
|
2171
|
-
const newValue = [...value];
|
|
2172
|
-
const existingIndex = value.findIndex(vi => getWithSelector(getOptionId, vi) === id);
|
|
2173
|
-
if (existingIndex === -1) {
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
// Remove value
|
|
2177
|
-
newValue.splice(existingIndex, 1);
|
|
2178
|
-
onChange?.(newValue);
|
|
2179
|
-
};
|
|
2180
|
-
const onKeyDown = evt => {
|
|
2181
|
-
if (evt.key !== 'Backspace') {
|
|
2182
|
-
return;
|
|
2183
|
-
}
|
|
2184
|
-
// Activate (remove value) on Backspace pressed
|
|
2185
|
-
onClick();
|
|
2186
|
-
const previousChip = findPreviousEnabledChip(index - 1);
|
|
2187
|
-
const input = inputRef?.current;
|
|
2188
|
-
// Focus the previous chip or the input
|
|
2189
|
-
(previousChip || input)?.focus();
|
|
2190
|
-
};
|
|
2191
|
-
if (!chipRefs.current[index]) {
|
|
2192
|
-
chipRefs.current[index] = /*#__PURE__*/React__default.createRef();
|
|
2193
|
-
}
|
|
2194
|
-
const ref = chipRefs.current[index];
|
|
2195
|
-
const customChip = renderChip?.(v);
|
|
2196
|
-
const props = isComponentType(Chip)(customChip) ? customChip.props : undefined;
|
|
2197
|
-
const chipIsDisabled = props?.isDisabled || isDisabled;
|
|
2198
|
-
const chipName = typeof props?.children === 'string' ? props.children : name;
|
|
2199
|
-
const tooltipLabel = chipTooltipLabel(chipName);
|
|
2200
|
-
return /*#__PURE__*/jsx(Tooltip, {
|
|
2201
|
-
label: !chipIsDisabled ? tooltipLabel : undefined,
|
|
2202
|
-
closeMode: "hide",
|
|
2203
|
-
ariaLinkMode: "aria-labelledby",
|
|
2204
|
-
children: /*#__PURE__*/jsx(Chip, {
|
|
2205
|
-
...props,
|
|
2206
|
-
after: /*#__PURE__*/jsx(Icon, {
|
|
2207
|
-
icon: mdiClose
|
|
2208
|
-
}),
|
|
2209
|
-
className: element$N('chip', [props?.className]),
|
|
2210
|
-
size: "s",
|
|
2211
|
-
ref: ref,
|
|
2212
|
-
onClick: onClick,
|
|
2213
|
-
onKeyDown: onKeyDown,
|
|
2214
|
-
theme: theme,
|
|
2215
|
-
isDisabled: chipIsDisabled,
|
|
2216
|
-
tabIndex: chipIsDisabled ? -1 : 0,
|
|
2217
|
-
children: props?.children || name
|
|
2218
|
-
})
|
|
2219
|
-
}, id);
|
|
2220
|
-
})
|
|
2221
|
-
});
|
|
2222
|
-
};
|
|
2223
|
-
|
|
2224
|
-
/**
|
|
2225
|
-
* Provide props for the semantic and behaviors the combobox trigger.
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2228
|
-
*/
|
|
2229
|
-
function useComboboxTrigger({
|
|
2230
|
-
context,
|
|
2231
|
-
refs,
|
|
2232
|
-
onBlur,
|
|
2233
|
-
onFocus,
|
|
2234
|
-
onKeyDown
|
|
2235
|
-
}) {
|
|
2236
|
-
const {
|
|
2237
|
-
comboboxId,
|
|
2238
|
-
listboxId,
|
|
2239
|
-
isOpen,
|
|
2240
|
-
options,
|
|
2241
|
-
optionsLength,
|
|
2242
|
-
selectedIds,
|
|
2243
|
-
openOnFocus,
|
|
2244
|
-
handleClose,
|
|
2245
|
-
handleOpen,
|
|
2246
|
-
handleSelected,
|
|
2247
|
-
showEmptyState = false,
|
|
2248
|
-
showErrorState = false,
|
|
2249
|
-
status
|
|
2250
|
-
} = context;
|
|
2251
|
-
const highlightedId = useVirtualFocusParent(refs.triggerRef);
|
|
2252
|
-
const {
|
|
2253
|
-
dispatch: movingFocusDispatch
|
|
2254
|
-
} = React__default.useContext(MovingFocusContext);
|
|
2255
|
-
const isErrorStateDisplayed = showErrorState && isOpen && status === 'error';
|
|
2256
|
-
const isEmptyStateDisplayed = showEmptyState && isOpen && status === 'idle' && optionsLength === 0;
|
|
2257
|
-
const showPopover = isOpen && optionsLength > 0 || isEmptyStateDisplayed || isErrorStateDisplayed;
|
|
2258
|
-
|
|
2259
|
-
/**
|
|
2260
|
-
* A debounce close to use to leave time for the
|
|
2261
|
-
* listbox to process things before closing.
|
|
2262
|
-
* This can be useful when clicking an option to leave time for the
|
|
2263
|
-
* event to be processed before closing the popover.
|
|
2264
|
-
*/
|
|
2265
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2266
|
-
const debouncedClose = React__default.useCallback(debounce$1(handleClose, 200), []);
|
|
2267
|
-
|
|
2268
|
-
/** Cleanup any ongoing cleanup */
|
|
2269
|
-
React__default.useEffect(() => {
|
|
2270
|
-
return () => {
|
|
2271
|
-
if (debouncedClose?.cancel) {
|
|
2272
|
-
debouncedClose.cancel();
|
|
2273
|
-
}
|
|
2274
|
-
};
|
|
2275
|
-
}, [debouncedClose]);
|
|
2276
|
-
const handleBlur = React__default.useCallback(event => {
|
|
2277
|
-
debouncedClose();
|
|
2278
|
-
if (onBlur) {
|
|
2279
|
-
onBlur(event);
|
|
2280
|
-
}
|
|
2281
|
-
}, [debouncedClose, onBlur]);
|
|
2282
|
-
|
|
2283
|
-
/** Actions triggered when the input field is focused */
|
|
2284
|
-
const handleFocus = event => {
|
|
2285
|
-
// If the field is refocused in the process of closing, cancel close
|
|
2286
|
-
if (debouncedClose?.cancel) {
|
|
2287
|
-
debouncedClose.cancel();
|
|
2288
|
-
}
|
|
2289
|
-
if (onFocus) {
|
|
2290
|
-
onFocus(event);
|
|
2291
|
-
}
|
|
2292
|
-
/**
|
|
2293
|
-
* Only set the open on focus if the combobox isn't already opened.
|
|
2294
|
-
* This avoids the popover re-opening when an option is selected and the
|
|
2295
|
-
* field is refocused
|
|
2296
|
-
*/
|
|
2297
|
-
if (openOnFocus && !showPopover) {
|
|
2298
|
-
handleOpen({
|
|
2299
|
-
manual: true
|
|
2300
|
-
});
|
|
2301
|
-
}
|
|
2302
|
-
};
|
|
2303
|
-
const handleClick = () => {
|
|
2304
|
-
handleOpen({
|
|
2305
|
-
manual: true
|
|
2306
|
-
});
|
|
2307
|
-
};
|
|
2308
|
-
|
|
2309
|
-
/**
|
|
2310
|
-
* Keyboard shortcut management following the WAI APG pattern
|
|
2311
|
-
* https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/#kbd_label
|
|
2312
|
-
*/
|
|
2313
|
-
const handleKeyDown = React__default.useCallback(async event => {
|
|
2314
|
-
const {
|
|
2315
|
-
key,
|
|
2316
|
-
altKey
|
|
2317
|
-
} = event;
|
|
2318
|
-
|
|
2319
|
-
/**
|
|
2320
|
-
* On Enter key
|
|
2321
|
-
* * Select option that is currently highlighted, if any
|
|
2322
|
-
* * Close suggestions, event if none is highlighted
|
|
2323
|
-
*/
|
|
2324
|
-
if (event.key === 'Enter') {
|
|
2325
|
-
if (!showPopover) {
|
|
2326
|
-
return;
|
|
2327
|
-
}
|
|
2328
|
-
if (highlightedId) {
|
|
2329
|
-
// prevent any potential form submission
|
|
2330
|
-
event.preventDefault();
|
|
2331
|
-
const option = options[highlightedId];
|
|
2332
|
-
handleSelected(option, 'keyboard');
|
|
2333
|
-
} else {
|
|
2334
|
-
handleClose();
|
|
2335
|
-
}
|
|
2336
|
-
return;
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
/**
|
|
2340
|
-
* On arrow up/down
|
|
2341
|
-
* * If popover is already opened, do nothing
|
|
2342
|
-
* * If alt key pressed, show the listbox without focusing an option
|
|
2343
|
-
* * If arrow Up is pressed, select last option
|
|
2344
|
-
* * If arrow Down is pressed, select first option
|
|
2345
|
-
* */
|
|
2346
|
-
if (key === 'ArrowDown' || key === 'ArrowUp') {
|
|
2347
|
-
if (showPopover) {
|
|
2348
|
-
return;
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
/** Open the listbox */
|
|
2352
|
-
const listBoxOptions = await handleOpen({
|
|
2353
|
-
manual: true
|
|
2354
|
-
});
|
|
2355
|
-
if (!listBoxOptions) {
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
|
-
/**
|
|
2360
|
-
* If alt key is pressed, only open without changing visual focus
|
|
2361
|
-
* as per WAI Guidelines
|
|
2362
|
-
*/
|
|
2363
|
-
if (!altKey) {
|
|
2364
|
-
/** If a selected id is set, set it as current tabstop */
|
|
2365
|
-
if (selectedIds?.length) {
|
|
2366
|
-
movingFocusDispatch({
|
|
2367
|
-
type: 'SELECT_TAB_STOP',
|
|
2368
|
-
payload: {
|
|
2369
|
-
id: selectedIds?.[0],
|
|
2370
|
-
type: 'keyboard'
|
|
2371
|
-
}
|
|
2372
|
-
});
|
|
2373
|
-
} else {
|
|
2374
|
-
/** Focus either the first or last item depending on the keyboard arrow pressed */
|
|
2375
|
-
movingFocusDispatch({
|
|
2376
|
-
type: 'KEY_NAV',
|
|
2377
|
-
payload: {
|
|
2378
|
-
ctrlKey: false,
|
|
2379
|
-
key: key === 'ArrowUp' ? 'End' : 'Home'
|
|
2380
|
-
}
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
return;
|
|
2385
|
-
}
|
|
2386
|
-
|
|
2387
|
-
// Forward event
|
|
2388
|
-
onKeyDown?.(event);
|
|
2389
|
-
}, [onKeyDown, showPopover, highlightedId, options, handleSelected, handleClose, handleOpen, selectedIds, movingFocusDispatch]);
|
|
2390
|
-
return {
|
|
2391
|
-
id: comboboxId,
|
|
2392
|
-
role: 'combobox',
|
|
2393
|
-
'aria-activedescendant': showPopover && highlightedId ? highlightedId : '',
|
|
2394
|
-
'aria-controls': listboxId,
|
|
2395
|
-
'aria-owns': listboxId,
|
|
2396
|
-
'aria-expanded': showPopover,
|
|
2397
|
-
onFocus: handleFocus,
|
|
2398
|
-
onBlur: handleBlur,
|
|
2399
|
-
onClick: handleClick,
|
|
2400
|
-
onKeyDown: handleKeyDown
|
|
2401
|
-
};
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
/** Is printable character key press */
|
|
2405
|
-
const isTypeEvent = ({
|
|
2406
|
-
key,
|
|
2407
|
-
altKey,
|
|
2408
|
-
ctrlKey,
|
|
2409
|
-
metaKey
|
|
2410
|
-
}) => key.length === 1 && key !== ' ' && !altKey && !ctrlKey && !metaKey;
|
|
2411
|
-
|
|
2412
|
-
/**
|
|
2413
|
-
* Provide props for the semantic and behaviors the combobox button trigger
|
|
2414
|
-
*
|
|
2415
|
-
* Overrides the useComboboxTrigger() props & behavior to add a jump to option
|
|
2416
|
-
* on printable character key down.
|
|
2417
|
-
*/
|
|
2418
|
-
function useComboboxButton(args) {
|
|
2419
|
-
const {
|
|
2420
|
-
context: {
|
|
2421
|
-
handleOpen
|
|
2422
|
-
},
|
|
2423
|
-
onKeyDown: parentOnKeyDown
|
|
2424
|
-
} = args;
|
|
2425
|
-
const {
|
|
2426
|
-
dispatch: movingFocusDispatch,
|
|
2427
|
-
state: {
|
|
2428
|
-
selectedId: highlightedId
|
|
2429
|
-
}
|
|
2430
|
-
} = React__default.useContext(MovingFocusContext);
|
|
2431
|
-
const searchValueRef = React__default.useRef('');
|
|
2432
|
-
const searchTimeoutRef = React__default.useRef();
|
|
2433
|
-
const onKeyDown = React__default.useMemo(() => {
|
|
2434
|
-
function clearSearchTimeout() {
|
|
2435
|
-
const searchTimeout = searchTimeoutRef.current;
|
|
2436
|
-
if (!searchTimeout) {
|
|
2437
|
-
return;
|
|
2438
|
-
}
|
|
2439
|
-
clearTimeout(searchTimeout);
|
|
2440
|
-
searchTimeoutRef.current = undefined;
|
|
2441
|
-
}
|
|
2442
|
-
function clearSearch() {
|
|
2443
|
-
searchValueRef.current = '';
|
|
2444
|
-
clearSearchTimeout();
|
|
2445
|
-
}
|
|
2446
|
-
return async event => {
|
|
2447
|
-
if (!isTypeEvent(event)) {
|
|
2448
|
-
// Forward key down event
|
|
2449
|
-
parentOnKeyDown?.(event);
|
|
2450
|
-
return undefined;
|
|
2451
|
-
}
|
|
2452
|
-
event.stopPropagation();
|
|
2453
|
-
|
|
2454
|
-
// Clear current search timeout
|
|
2455
|
-
clearSearchTimeout();
|
|
2456
|
-
|
|
2457
|
-
// Open combobox and wait for options to mount
|
|
2458
|
-
const options = await handleOpen({
|
|
2459
|
-
manual: false
|
|
2460
|
-
});
|
|
2461
|
-
const optionArray = options && Object.values(options);
|
|
2462
|
-
if (!optionArray?.length) {
|
|
2463
|
-
return undefined;
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
// Append key to current search
|
|
2467
|
-
searchValueRef.current += event.key.toLowerCase();
|
|
2468
|
-
const searchValue = searchValueRef.current;
|
|
2469
|
-
|
|
2470
|
-
// Clear search after 500ms
|
|
2471
|
-
searchTimeoutRef.current = setTimeout(clearSearch, 500);
|
|
2472
|
-
|
|
2473
|
-
// Search is containing all the same letters (ex: aaaa)
|
|
2474
|
-
const allTheSameLetters = searchValue.split('').every(letter => letter === searchValue[0]);
|
|
2475
|
-
|
|
2476
|
-
// start from currently selected option
|
|
2477
|
-
let startIndex = optionArray.findIndex(option => option.generatedId === highlightedId);
|
|
2478
|
-
if (startIndex === -1) {
|
|
2479
|
-
startIndex = 0;
|
|
2480
|
-
}
|
|
2481
|
-
let index = startIndex;
|
|
2482
|
-
do {
|
|
2483
|
-
// Increment index and loop around to 0 if we get over the array length
|
|
2484
|
-
index = (index + 1) % optionArray.length;
|
|
2485
|
-
const option = optionArray[index];
|
|
2486
|
-
// Search by text value or fallback on id.
|
|
2487
|
-
const optionText = isComboboxValue(option) ? option?.textValue || option?.id : null;
|
|
2488
|
-
if (isComboboxValue(option) && optionText) {
|
|
2489
|
-
const optionTextValue = optionText.toLowerCase();
|
|
2490
|
-
|
|
2491
|
-
// Search on first letter if search is all the same letters
|
|
2492
|
-
const searchText = allTheSameLetters ? searchValue[0] : searchValue;
|
|
2493
|
-
|
|
2494
|
-
// Option text value starts with searched text
|
|
2495
|
-
if (optionTextValue.startsWith(searchText)) {
|
|
2496
|
-
movingFocusDispatch({
|
|
2497
|
-
type: 'SELECT_TAB_STOP',
|
|
2498
|
-
payload: {
|
|
2499
|
-
id: option.generatedId,
|
|
2500
|
-
type: 'keyboard'
|
|
2501
|
-
}
|
|
2502
|
-
});
|
|
2503
|
-
break;
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
} while (index !== startIndex);
|
|
2507
|
-
return clearSearchTimeout;
|
|
2508
|
-
};
|
|
2509
|
-
}, [handleOpen, parentOnKeyDown, highlightedId, movingFocusDispatch]);
|
|
2510
|
-
return useComboboxTrigger({
|
|
2511
|
-
...args,
|
|
2512
|
-
onKeyDown
|
|
2513
|
-
});
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
/**
|
|
2517
|
-
* Combobox button trigger.
|
|
2518
|
-
*
|
|
2519
|
-
* @family Combobox
|
|
2520
|
-
*/
|
|
2521
|
-
const ComboboxButton = forwardRef((props, ref) => {
|
|
2522
|
-
const {
|
|
2523
|
-
as,
|
|
2524
|
-
label,
|
|
2525
|
-
onFocus,
|
|
2526
|
-
onBlur,
|
|
2527
|
-
labelDisplayMode = 'show-selection',
|
|
2528
|
-
...forwardedProps
|
|
2529
|
-
} = props;
|
|
2530
|
-
const refs = useComboboxRefs();
|
|
2531
|
-
const context = useCombobox();
|
|
2532
|
-
const buttonProps = useComboboxButton({
|
|
2533
|
-
context,
|
|
2534
|
-
refs,
|
|
2535
|
-
onBlur,
|
|
2536
|
-
onFocus
|
|
2537
|
-
});
|
|
2538
|
-
const Element = as || Button;
|
|
2539
|
-
const showSelection = labelDisplayMode === 'show-selection';
|
|
2540
|
-
const tooltipOnly = labelDisplayMode === 'show-tooltip';
|
|
2541
|
-
const selectionLabel = showSelection && context.selectedIds?.length && context.inputValue;
|
|
2542
|
-
let content = null;
|
|
2543
|
-
if (!tooltipOnly) {
|
|
2544
|
-
// Display selection label or label
|
|
2545
|
-
content = selectionLabel || label;
|
|
2546
|
-
}
|
|
2547
|
-
const hideTooltip =
|
|
2548
|
-
// Hide tooltip if the displayed label and tooltip label are the same
|
|
2549
|
-
label === content ||
|
|
2550
|
-
// Hide tooltip when the combobox is open
|
|
2551
|
-
context.isOpen;
|
|
2552
|
-
const mergedRefs = useMergeRefs(ref, refs.triggerRef, refs.anchorRef);
|
|
2553
|
-
return /*#__PURE__*/jsx(Tooltip, {
|
|
2554
|
-
className: hideTooltip ? visuallyHidden() : undefined,
|
|
2555
|
-
label: label,
|
|
2556
|
-
closeMode: "hide",
|
|
2557
|
-
ariaLinkMode: "aria-labelledby",
|
|
2558
|
-
children: /*#__PURE__*/jsx(Element, {
|
|
2559
|
-
ref: mergedRefs,
|
|
2560
|
-
...forwardedProps,
|
|
2561
|
-
...buttonProps,
|
|
2562
|
-
children: content
|
|
2563
|
-
})
|
|
2564
|
-
});
|
|
2565
|
-
});
|
|
2566
|
-
|
|
2567
|
-
const CLASSNAME$17 = 'lumx-combobox-divider';
|
|
2568
|
-
|
|
2569
|
-
/** Combobox option divider */
|
|
2570
|
-
function ComboboxDivider() {
|
|
2571
|
-
return /*#__PURE__*/jsx(ListDivider, {
|
|
2572
|
-
className: CLASSNAME$17,
|
|
2573
|
-
role: "presentation"
|
|
2574
|
-
});
|
|
2575
|
-
}
|
|
2576
|
-
|
|
2577
|
-
/**
|
|
2578
|
-
* Provide props for the semantic and behaviors the combobox input trigger
|
|
2579
|
-
*
|
|
2580
|
-
* Overrides the useComboboxTrigger() props & behavior to prevent open on click
|
|
2581
|
-
* if `openOnFocus` is not enabled.
|
|
2582
|
-
*/
|
|
2583
|
-
function useComboboxInput({
|
|
2584
|
-
onKeyDown: propsOnKeyDown,
|
|
2585
|
-
...args
|
|
2586
|
-
}) {
|
|
2587
|
-
const triggerProps = useComboboxTrigger(args);
|
|
2588
|
-
const {
|
|
2589
|
-
onClick,
|
|
2590
|
-
onKeyDown,
|
|
2591
|
-
'aria-expanded': showPopover
|
|
2592
|
-
} = triggerProps;
|
|
2593
|
-
const handleClick = () => {
|
|
2594
|
-
if (!args.context.openOnFocus && !args.context.openOnClick) {
|
|
2595
|
-
// Skip if input should not opening on focus nor click
|
|
2596
|
-
return;
|
|
2597
|
-
}
|
|
2598
|
-
onClick();
|
|
2599
|
-
};
|
|
2600
|
-
const handleKeyDown = evt => {
|
|
2601
|
-
if (evt.key === 'Escape') {
|
|
2602
|
-
// Reset field if closed
|
|
2603
|
-
if (!showPopover) {
|
|
2604
|
-
args.context.handleInputChange('');
|
|
2605
|
-
}
|
|
2606
|
-
return;
|
|
2607
|
-
}
|
|
2608
|
-
onKeyDown(evt);
|
|
2609
|
-
if (propsOnKeyDown) {
|
|
2610
|
-
propsOnKeyDown(evt);
|
|
2611
|
-
}
|
|
2612
|
-
};
|
|
2613
|
-
return {
|
|
2614
|
-
...triggerProps,
|
|
2615
|
-
onClick: handleClick,
|
|
2616
|
-
onKeyDown: handleKeyDown
|
|
2617
|
-
};
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
/**
|
|
2621
|
-
* Combobox input trigger.
|
|
2622
|
-
*
|
|
2623
|
-
* @family Combobox
|
|
2624
|
-
*/
|
|
2625
|
-
const ComboboxInput = ({
|
|
2626
|
-
hideToggle,
|
|
2627
|
-
inputRef,
|
|
2628
|
-
textFieldRef,
|
|
2629
|
-
afterElement,
|
|
2630
|
-
onFocus,
|
|
2631
|
-
onBlur,
|
|
2632
|
-
onKeyDown,
|
|
2633
|
-
clearButtonProps,
|
|
2634
|
-
hasClearButton,
|
|
2635
|
-
theme,
|
|
2636
|
-
...textFieldProps
|
|
2637
|
-
}) => {
|
|
2638
|
-
const refs = useComboboxRefs();
|
|
2639
|
-
const context = useCombobox();
|
|
2640
|
-
const inputProps = useComboboxInput({
|
|
2641
|
-
refs,
|
|
2642
|
-
context,
|
|
2643
|
-
onBlur,
|
|
2644
|
-
onFocus,
|
|
2645
|
-
onKeyDown
|
|
2646
|
-
});
|
|
2647
|
-
const {
|
|
2648
|
-
listboxId,
|
|
2649
|
-
isOpen,
|
|
2650
|
-
handleOpen,
|
|
2651
|
-
handleClose,
|
|
2652
|
-
inputValue,
|
|
2653
|
-
handleInputChange
|
|
2654
|
-
} = context;
|
|
2655
|
-
|
|
2656
|
-
/** Callback for when the toggle button is trigged */
|
|
2657
|
-
const handleManualToggle = () => {
|
|
2658
|
-
if (isOpen) {
|
|
2659
|
-
handleClose();
|
|
2660
|
-
} else {
|
|
2661
|
-
handleOpen({
|
|
2662
|
-
manual: true
|
|
2663
|
-
});
|
|
2664
|
-
}
|
|
2665
|
-
refs.triggerRef?.current?.focus();
|
|
2666
|
-
};
|
|
2667
|
-
return /*#__PURE__*/jsx(TextField
|
|
2668
|
-
// Disable native autocomplete
|
|
2669
|
-
, {
|
|
2670
|
-
autoComplete: "off",
|
|
2671
|
-
...textFieldProps,
|
|
2672
|
-
inputRef: mergeRefs(refs.triggerRef, inputRef),
|
|
2673
|
-
textFieldRef: mergeRefs(refs.anchorRef, textFieldRef)
|
|
2674
|
-
// Combobox props
|
|
2675
|
-
,
|
|
2676
|
-
...inputProps,
|
|
2677
|
-
theme: theme,
|
|
2678
|
-
value: inputValue,
|
|
2679
|
-
onClear: () => handleInputChange(''),
|
|
2680
|
-
onChange: handleInputChange,
|
|
2681
|
-
clearButtonProps: hasClearButton ? {
|
|
2682
|
-
...clearButtonProps,
|
|
2683
|
-
label: context.translations.clearLabel
|
|
2684
|
-
} : undefined,
|
|
2685
|
-
afterElement: (!hideToggle || afterElement) && /*#__PURE__*/jsxs(Fragment, {
|
|
2686
|
-
children: [afterElement, !hideToggle && /*#__PURE__*/jsx(IconButton, {
|
|
2687
|
-
theme: theme,
|
|
2688
|
-
onClick: handleManualToggle,
|
|
2689
|
-
label: context.translations.showSuggestionsLabel,
|
|
2690
|
-
emphasis: Emphasis$1.low,
|
|
2691
|
-
size: Size$1.s,
|
|
2692
|
-
icon: inputProps['aria-expanded'] ? mdiChevronUp : mdiChevronDown,
|
|
2693
|
-
type: "button",
|
|
2694
|
-
tabIndex: -1,
|
|
2695
|
-
"aria-expanded": inputProps['aria-expanded'],
|
|
2696
|
-
"aria-haspopup": "listbox",
|
|
2697
|
-
"aria-controls": listboxId
|
|
2698
|
-
})]
|
|
2699
|
-
})
|
|
2700
|
-
});
|
|
2701
|
-
};
|
|
2702
|
-
|
|
2703
|
-
const ComboboxOptionContext = /*#__PURE__*/createContext({});
|
|
2704
|
-
/** Context Provider to store the current combobox option id. */
|
|
2705
|
-
const ComboboxOptionContextProvider = ({
|
|
2706
|
-
optionId,
|
|
2707
|
-
isKeyboardHighlighted,
|
|
2708
|
-
children
|
|
2709
|
-
}) => {
|
|
2710
|
-
const value = React__default.useMemo(() => ({
|
|
2711
|
-
optionId,
|
|
2712
|
-
isKeyboardHighlighted
|
|
2713
|
-
}), [optionId, isKeyboardHighlighted]);
|
|
2714
|
-
return /*#__PURE__*/jsx(ComboboxOptionContext.Provider, {
|
|
2715
|
-
value: value,
|
|
2716
|
-
children: children
|
|
2717
|
-
});
|
|
2718
|
-
};
|
|
2719
|
-
|
|
2720
|
-
/**
|
|
2721
|
-
* Retrieve the current combobox option id.
|
|
2722
|
-
* Must be used within a ComboboxOptionIdProvider
|
|
2723
|
-
*/
|
|
2724
|
-
const useComboboxOptionContext = () => {
|
|
2725
|
-
const comboboxOption = useContext(ComboboxOptionContext);
|
|
2726
|
-
if (!comboboxOption?.optionId) {
|
|
2727
|
-
throw new Error('This hook must be used within a ComboboxOptionIdProvider');
|
|
2728
|
-
}
|
|
2729
|
-
return comboboxOption;
|
|
2730
|
-
};
|
|
2731
|
-
|
|
2732
|
-
/** Retrieve the current combobox section id */
|
|
2733
|
-
const useComboboxSectionId = () => {
|
|
2734
|
-
return useContext(SectionContext);
|
|
2735
|
-
};
|
|
2736
|
-
|
|
2737
|
-
/**
|
|
2738
|
-
* Register the given option to the context
|
|
2739
|
-
*/
|
|
2740
|
-
const useRegisterOption = (registerId, option, shouldRegister) => {
|
|
2741
|
-
const {
|
|
2742
|
-
dispatch
|
|
2743
|
-
} = useCombobox();
|
|
2744
|
-
|
|
2745
|
-
/** Register the given options */
|
|
2746
|
-
React__default.useEffect(() => {
|
|
2747
|
-
if (option && shouldRegister) {
|
|
2748
|
-
dispatch({
|
|
2749
|
-
type: 'ADD_OPTION',
|
|
2750
|
-
payload: {
|
|
2751
|
-
id: registerId,
|
|
2752
|
-
option
|
|
2753
|
-
}
|
|
2754
|
-
});
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
|
-
// Unregister ids if/when the component unmounts or if option changes
|
|
2758
|
-
return () => {
|
|
2759
|
-
if (option) {
|
|
2760
|
-
dispatch({
|
|
2761
|
-
type: 'REMOVE_OPTION',
|
|
2762
|
-
payload: {
|
|
2763
|
-
id: registerId
|
|
2764
|
-
}
|
|
2765
|
-
});
|
|
2766
|
-
}
|
|
2767
|
-
};
|
|
2768
|
-
}, [dispatch, option, registerId, shouldRegister]);
|
|
2769
|
-
};
|
|
2770
|
-
|
|
2771
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
2772
|
-
const COMBOBOX_OPTION_CLASSNAME = 'lumx-combobox-option';
|
|
2773
|
-
const LUMX_CLASSNAME = 'lumx-list-item';
|
|
2774
|
-
const {
|
|
2775
|
-
block: block$_,
|
|
2776
|
-
element: element$M
|
|
2777
|
-
} = classNames.bem(COMBOBOX_OPTION_CLASSNAME);
|
|
2778
|
-
const lumxListItem = classNames.bem(LUMX_CLASSNAME);
|
|
2779
|
-
|
|
2780
|
-
/**
|
|
2781
|
-
* Content of the option.
|
|
2782
|
-
* This should only be rendered if the option is shown.
|
|
2783
|
-
*/
|
|
2784
|
-
const OptionContent = forwardRef((props, ref) => {
|
|
2785
|
-
const {
|
|
2786
|
-
id,
|
|
2787
|
-
onSelect,
|
|
2788
|
-
isSelected,
|
|
2789
|
-
isDisabled,
|
|
2790
|
-
children,
|
|
2791
|
-
className,
|
|
2792
|
-
before,
|
|
2793
|
-
after,
|
|
2794
|
-
as,
|
|
2795
|
-
size = Size$1.tiny,
|
|
2796
|
-
comboboxType,
|
|
2797
|
-
tooltipProps,
|
|
2798
|
-
description,
|
|
2799
|
-
'aria-hidden': ariaHidden,
|
|
2800
|
-
autofocus,
|
|
2801
|
-
...forwardedProps
|
|
2802
|
-
} = props;
|
|
2803
|
-
const itemRef = React__default.useRef(null);
|
|
2804
|
-
const {
|
|
2805
|
-
state
|
|
2806
|
-
} = React__default.useContext(MovingFocusContext);
|
|
2807
|
-
const {
|
|
2808
|
-
selectedIds
|
|
2809
|
-
} = useCombobox();
|
|
2810
|
-
const hasSelection = selectedIds !== undefined;
|
|
2811
|
-
const isHighlighted = useVirtualFocus(id, itemRef, false, comboboxType === 'grid' ? id : undefined, autofocus);
|
|
2812
|
-
const Element = as || 'span';
|
|
2813
|
-
const ariaSelected = isSelected ? 'true' : 'false';
|
|
2814
|
-
const ariaDescriptionId = description ? `${id}-description` : undefined;
|
|
2815
|
-
const isKeyboardHighlighted = state.isUsingKeyboard && isHighlighted;
|
|
2816
|
-
|
|
2817
|
-
/**
|
|
2818
|
-
* The DS `ListItem` component has a lot of behavior / default props we do not want here.
|
|
2819
|
-
* Notably the before/after items are within the interactive element, which we do not want.
|
|
2820
|
-
* So we use a native li tag.
|
|
2821
|
-
*/
|
|
2822
|
-
return /*#__PURE__*/jsx("li", {
|
|
2823
|
-
className: block$_(undefined, [className ?? '', lumxListItem.block({
|
|
2824
|
-
[`size-${size}`]: !!size
|
|
2825
|
-
})]),
|
|
2826
|
-
role: "presentation",
|
|
2827
|
-
ref: itemRef,
|
|
2828
|
-
"aria-hidden": ariaHidden,
|
|
2829
|
-
style: {
|
|
2830
|
-
display: ariaHidden ? 'none' : undefined
|
|
2831
|
-
},
|
|
2832
|
-
...forwardedProps,
|
|
2833
|
-
children: /*#__PURE__*/jsxs(GenericBlock, {
|
|
2834
|
-
as: "div",
|
|
2835
|
-
role: comboboxType === 'grid' ? 'row' : 'presentation',
|
|
2836
|
-
className: element$M('content', {
|
|
2837
|
-
// Not using the lumx list item disabled style as it blocks pointer events
|
|
2838
|
-
'is-disabled': !!isDisabled
|
|
2839
|
-
},
|
|
2840
|
-
// TODO: migrate away from using lumx-list-item styles https://lumapps.atlassian.net/browse/DSW-288
|
|
2841
|
-
[lumxListItem.element('link', {
|
|
2842
|
-
'is-selected': Boolean(isSelected),
|
|
2843
|
-
'is-highlighted': Boolean(isHighlighted)
|
|
2844
|
-
})]),
|
|
2845
|
-
"data-focus-visible-added": isKeyboardHighlighted ? 'true' : undefined,
|
|
2846
|
-
children: [before && /*#__PURE__*/jsx(GenericBlock.Figure, {
|
|
2847
|
-
as: "span",
|
|
2848
|
-
role: "presentation",
|
|
2849
|
-
className: element$M('before', undefined, [lumxListItem.element('before')]),
|
|
2850
|
-
children: before
|
|
2851
|
-
}), /*#__PURE__*/jsxs(GenericBlock.Content, {
|
|
2852
|
-
as: "span",
|
|
2853
|
-
role: "presentation",
|
|
2854
|
-
className: lumxListItem.element('content'),
|
|
2855
|
-
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
2856
|
-
forceOpen: isKeyboardHighlighted,
|
|
2857
|
-
closeMode: "hide",
|
|
2858
|
-
...tooltipProps,
|
|
2859
|
-
children: /*#__PURE__*/jsx(Element, {
|
|
2860
|
-
id: id,
|
|
2861
|
-
className: element$M('trigger'),
|
|
2862
|
-
role: comboboxType === 'grid' ? 'gridcell' : 'option',
|
|
2863
|
-
"aria-selected": hasSelection ? ariaSelected : undefined,
|
|
2864
|
-
"aria-disabled": isDisabled,
|
|
2865
|
-
"aria-describedby": ariaDescriptionId,
|
|
2866
|
-
onClick: onSelect
|
|
2867
|
-
// Prevent mouse down to avoid blur before the click is activated
|
|
2868
|
-
,
|
|
2869
|
-
onMouseDown: event => event.preventDefault(),
|
|
2870
|
-
ref: ref,
|
|
2871
|
-
...forwardedProps,
|
|
2872
|
-
children: children
|
|
2873
|
-
})
|
|
2874
|
-
}), description && /*#__PURE__*/jsx(Text, {
|
|
2875
|
-
as: "span",
|
|
2876
|
-
id: ariaDescriptionId,
|
|
2877
|
-
role: "presentation",
|
|
2878
|
-
className: element$M('description'),
|
|
2879
|
-
typography: "caption",
|
|
2880
|
-
color: "dark",
|
|
2881
|
-
colorVariant: "L2",
|
|
2882
|
-
children: description
|
|
2883
|
-
})]
|
|
2884
|
-
}), after && /*#__PURE__*/jsx(GenericBlock.Actions, {
|
|
2885
|
-
as: "span",
|
|
2886
|
-
role: "presentation",
|
|
2887
|
-
className: element$M('after', undefined, [lumxListItem.element('after')]),
|
|
2888
|
-
children: /*#__PURE__*/jsx(ComboboxOptionContextProvider, {
|
|
2889
|
-
optionId: id,
|
|
2890
|
-
isKeyboardHighlighted: isKeyboardHighlighted,
|
|
2891
|
-
children: after
|
|
2892
|
-
})
|
|
2893
|
-
})]
|
|
2894
|
-
})
|
|
2895
|
-
});
|
|
2896
|
-
});
|
|
2897
|
-
|
|
2898
|
-
/**
|
|
2899
|
-
* Props for ComboboxOption with additional generic properties.
|
|
2900
|
-
*/
|
|
2901
|
-
|
|
2902
|
-
/**
|
|
2903
|
-
* Option to set within a combobox list.
|
|
2904
|
-
*
|
|
2905
|
-
* @family Combobox
|
|
2906
|
-
* @param ComboboxOptionProps
|
|
2907
|
-
* @returns ComboboxOption
|
|
2908
|
-
*/
|
|
2909
|
-
const ComboboxOption = forwardRef((props, ref) => {
|
|
2910
|
-
const {
|
|
2911
|
-
children,
|
|
2912
|
-
id,
|
|
2913
|
-
textValue,
|
|
2914
|
-
data,
|
|
2915
|
-
filterFromInput = true,
|
|
2916
|
-
onSelect: onOptionSelect,
|
|
2917
|
-
isDisabled,
|
|
2918
|
-
as = 'span',
|
|
2919
|
-
...optionProps
|
|
2920
|
-
} = props;
|
|
2921
|
-
|
|
2922
|
-
// Get the id of the current group, if any.
|
|
2923
|
-
const section = useComboboxSectionId();
|
|
2924
|
-
const {
|
|
2925
|
-
comboboxId,
|
|
2926
|
-
selectedIds,
|
|
2927
|
-
showAll,
|
|
2928
|
-
inputValue,
|
|
2929
|
-
handleSelected,
|
|
2930
|
-
type
|
|
2931
|
-
} = useCombobox();
|
|
2932
|
-
// Generate a unique id for this option.
|
|
2933
|
-
const generatedId = generateOptionId(comboboxId, id);
|
|
2934
|
-
const isSelected = selectedIds?.includes(generatedId);
|
|
2935
|
-
|
|
2936
|
-
// If no text value is set and the direct child is a simple string, use it as value.
|
|
2937
|
-
const isStringChild = typeof children === 'string' || typeof children === 'number';
|
|
2938
|
-
const value = children && !textValue && isStringChild ? children.toString() : textValue;
|
|
2939
|
-
const showOption = !filterFromInput || showAll || value?.toString()?.toLowerCase().includes(inputValue?.toLowerCase());
|
|
2940
|
-
const registeredOption = React__default.useMemo(() => ({
|
|
2941
|
-
id,
|
|
2942
|
-
generatedId,
|
|
2943
|
-
textValue: value,
|
|
2944
|
-
data,
|
|
2945
|
-
filter: filterFromInput,
|
|
2946
|
-
isDisabled: isDisabled || !showOption,
|
|
2947
|
-
sectionId: section.sectionId,
|
|
2948
|
-
onSelect: onOptionSelect
|
|
2949
|
-
}), [data, filterFromInput, generatedId, section.sectionId, id, isDisabled, onOptionSelect, showOption, value]);
|
|
2950
|
-
|
|
2951
|
-
// Register the option
|
|
2952
|
-
useRegisterOption(generatedId, registeredOption, showOption);
|
|
2953
|
-
const handleSelect = React__default.useCallback(() => handleSelected(registeredOption, 'click'), [handleSelected, registeredOption]);
|
|
2954
|
-
if (!id || !showOption) {
|
|
2955
|
-
return null;
|
|
2956
|
-
}
|
|
2957
|
-
return /*#__PURE__*/jsx(OptionContent, {
|
|
2958
|
-
id: generatedId,
|
|
2959
|
-
onSelect: handleSelect,
|
|
2960
|
-
isSelected: isSelected,
|
|
2961
|
-
isDisabled: isDisabled,
|
|
2962
|
-
as: as,
|
|
2963
|
-
ref: ref,
|
|
2964
|
-
comboboxType: type,
|
|
2965
|
-
"aria-hidden": section.isLoading,
|
|
2966
|
-
...optionProps,
|
|
2967
|
-
children: children || textValue
|
|
2968
|
-
});
|
|
2969
|
-
});
|
|
2970
|
-
|
|
2971
|
-
// Default widths the skeletons must have
|
|
2972
|
-
const defaultWidths = [REAL_SIZE_FOR_LUMX_SIZE.xxl, REAL_SIZE_FOR_LUMX_SIZE.xl, REAL_SIZE_FOR_LUMX_SIZE.l];
|
|
2973
|
-
const {
|
|
2974
|
-
block: block$Z,
|
|
2975
|
-
element: element$L
|
|
2976
|
-
} = classNames.bem(COMBOBOX_OPTION_CLASSNAME);
|
|
2977
|
-
|
|
2978
|
-
/**
|
|
2979
|
-
* Skeleton for a combobox option.
|
|
2980
|
-
* A typography skeleton is rendered by default but can be overridden by passing children.
|
|
2981
|
-
*/
|
|
2982
|
-
const ComboboxOptionSkeleton = ({
|
|
2983
|
-
className,
|
|
2984
|
-
index,
|
|
2985
|
-
before,
|
|
2986
|
-
after,
|
|
2987
|
-
size = Size$1.tiny,
|
|
2988
|
-
children
|
|
2989
|
-
}) => {
|
|
2990
|
-
const renderedChildren = typeof children === 'function' ? children({
|
|
2991
|
-
index
|
|
2992
|
-
}) : children;
|
|
2993
|
-
const content = renderedChildren || /*#__PURE__*/jsx(SkeletonTypography, {
|
|
2994
|
-
typography: "body1",
|
|
2995
|
-
width: index !== undefined && defaultWidths[index] ? defaultWidths[index] : REAL_SIZE_FOR_LUMX_SIZE.xl
|
|
2996
|
-
});
|
|
2997
|
-
return /*#__PURE__*/jsxs("li", {
|
|
2998
|
-
role: "presentation",
|
|
2999
|
-
className: block$Z({
|
|
3000
|
-
skeleton: true
|
|
3001
|
-
}, ['lumx-list-item', `lumx-list-item--size-${size}`, className]),
|
|
3002
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
3003
|
-
role: "presentation",
|
|
3004
|
-
className: element$L('content', ['lumx-list-item__wrapper']),
|
|
3005
|
-
children: [before && /*#__PURE__*/jsx(Text, {
|
|
3006
|
-
as: "span",
|
|
3007
|
-
role: "presentation",
|
|
3008
|
-
className: element$L('before', ['lumx-list-item__before']),
|
|
3009
|
-
children: before
|
|
3010
|
-
}), content]
|
|
3011
|
-
}), after && /*#__PURE__*/jsx("div", {
|
|
3012
|
-
role: "presentation",
|
|
3013
|
-
className: element$L('after', ['lumx-list-item__after']),
|
|
3014
|
-
children: after
|
|
3015
|
-
})]
|
|
3016
|
-
});
|
|
3017
|
-
};
|
|
3018
|
-
|
|
3019
|
-
/** Default skeleton for the options list of the combobox */
|
|
3020
|
-
const ComboboxListSkeleton = ({
|
|
3021
|
-
isLoadingMore,
|
|
3022
|
-
children
|
|
3023
|
-
}) => /*#__PURE__*/jsx(Fragment, {
|
|
3024
|
-
children: Array.from({
|
|
3025
|
-
length: isLoadingMore ? 1 : 3
|
|
3026
|
-
}).map((_, index) => {
|
|
3027
|
-
const renderedChildren = typeof children === 'function' ? children({
|
|
3028
|
-
index
|
|
3029
|
-
}) : children || /*#__PURE__*/jsx(ComboboxOptionSkeleton, {
|
|
3030
|
-
index: index
|
|
3031
|
-
});
|
|
3032
|
-
return (
|
|
3033
|
-
/*#__PURE__*/
|
|
3034
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
3035
|
-
jsx(React__default.Fragment, {
|
|
3036
|
-
children: renderedChildren
|
|
3037
|
-
}, index)
|
|
3038
|
-
);
|
|
3039
|
-
})
|
|
3040
|
-
});
|
|
3041
|
-
|
|
3042
|
-
/** The states in which the full loading must be displayed */
|
|
3043
|
-
const FULL_LOADING_STATES = ['loading', 'debouncing', 'filtering'];
|
|
3044
|
-
const CLASSNAME$16 = 'lumx-combobox-listbox';
|
|
3045
|
-
const {
|
|
3046
|
-
block: block$Y,
|
|
3047
|
-
element: element$K
|
|
3048
|
-
} = bem$1(CLASSNAME$16);
|
|
3049
|
-
|
|
3050
|
-
/**
|
|
3051
|
-
* The listbox containing the combobox's options.
|
|
3052
|
-
*
|
|
3053
|
-
* @family Combobox
|
|
3054
|
-
* @param ComboboxListBoxProps
|
|
3055
|
-
* @returns ComboboxListBox
|
|
3056
|
-
*/
|
|
3057
|
-
const ComboboxListBox = ({
|
|
3058
|
-
children,
|
|
3059
|
-
renderItemSkeleton,
|
|
3060
|
-
label,
|
|
3061
|
-
popoverProps,
|
|
3062
|
-
footer,
|
|
3063
|
-
listRef,
|
|
3064
|
-
...forwardedProps
|
|
3065
|
-
}) => {
|
|
3066
|
-
const {
|
|
3067
|
-
status,
|
|
3068
|
-
listboxId,
|
|
3069
|
-
isOpen,
|
|
3070
|
-
optionsLength,
|
|
3071
|
-
handleClose: contextHandleClose,
|
|
3072
|
-
type,
|
|
3073
|
-
inputValue,
|
|
3074
|
-
showEmptyState,
|
|
3075
|
-
showErrorState,
|
|
3076
|
-
translations
|
|
3077
|
-
} = useCombobox();
|
|
3078
|
-
const {
|
|
3079
|
-
anchorRef
|
|
3080
|
-
} = useComboboxRefs();
|
|
3081
|
-
const {
|
|
3082
|
-
onClose,
|
|
3083
|
-
...otherPopoverProps
|
|
3084
|
-
} = popoverProps || {};
|
|
3085
|
-
const {
|
|
3086
|
-
style,
|
|
3087
|
-
className,
|
|
3088
|
-
...listProps
|
|
3089
|
-
} = forwardedProps;
|
|
3090
|
-
// The states to show a full skeleton instead of the options
|
|
3091
|
-
const showFullLoading = FULL_LOADING_STATES.includes(status);
|
|
3092
|
-
const isErrorStateDisplayed = showErrorState && isOpen && status === 'error';
|
|
3093
|
-
const isEmptyStateDisplayed = showEmptyState && isOpen && status === 'idle' && optionsLength === 0;
|
|
3094
|
-
|
|
3095
|
-
/**
|
|
3096
|
-
* The conditions in which we want to show the content of the popover
|
|
3097
|
-
* * The parent asked for the popover to be opened
|
|
3098
|
-
* * There is at least one option to displayed OR a skeleton
|
|
3099
|
-
*/
|
|
3100
|
-
const showPopover = isOpen && (optionsLength > 0 || showFullLoading) || isEmptyStateDisplayed || isErrorStateDisplayed;
|
|
3101
|
-
const handleClose = () => {
|
|
3102
|
-
if (isOpen) {
|
|
3103
|
-
contextHandleClose?.();
|
|
3104
|
-
onClose?.();
|
|
3105
|
-
}
|
|
3106
|
-
};
|
|
3107
|
-
const emptyMessage = translations.noResultsForInputLabel(inputValue);
|
|
3108
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
3109
|
-
children: [/*#__PURE__*/jsxs(Text, {
|
|
3110
|
-
as: "p",
|
|
3111
|
-
className: visuallyHidden(),
|
|
3112
|
-
role: "log",
|
|
3113
|
-
"aria-live": "assertive",
|
|
3114
|
-
children: [isOpen && !showFullLoading && !isEmptyStateDisplayed && !isErrorStateDisplayed && translations.nbOptionsLabel(optionsLength), isErrorStateDisplayed && `${translations.serviceUnavailableLabel} ${translations.tryReloadLabel}`, showFullLoading && translations.loadingLabel, isEmptyStateDisplayed && emptyMessage]
|
|
3115
|
-
}), /*#__PURE__*/jsx(Popover, {
|
|
3116
|
-
role: "none",
|
|
3117
|
-
onClose: handleClose,
|
|
3118
|
-
anchorRef: anchorRef,
|
|
3119
|
-
fitToAnchorWidth: true,
|
|
3120
|
-
fitWithinViewportHeight: true,
|
|
3121
|
-
closeOnEscape: true,
|
|
3122
|
-
closeOnClickAway: true,
|
|
3123
|
-
placement: Placement.BOTTOM,
|
|
3124
|
-
isOpen: isOpen,
|
|
3125
|
-
...otherPopoverProps,
|
|
3126
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
3127
|
-
style: {
|
|
3128
|
-
...style,
|
|
3129
|
-
overflowY: 'auto',
|
|
3130
|
-
display: showPopover ? 'flex' : 'none',
|
|
3131
|
-
flexDirection: 'column'
|
|
3132
|
-
},
|
|
3133
|
-
children: [/*#__PURE__*/jsxs("ul", {
|
|
3134
|
-
ref: listRef,
|
|
3135
|
-
id: listboxId,
|
|
3136
|
-
role: type,
|
|
3137
|
-
"aria-label": label,
|
|
3138
|
-
className: block$Y([className, 'lumx-list lumx-list--item-padding-big']),
|
|
3139
|
-
style: {
|
|
3140
|
-
flex: 1,
|
|
3141
|
-
overflowY: 'auto'
|
|
3142
|
-
},
|
|
3143
|
-
...listProps,
|
|
3144
|
-
children: [!showFullLoading && children, [...FULL_LOADING_STATES, 'loadingMore'].includes(status) && /*#__PURE__*/jsx(ComboboxListSkeleton, {
|
|
3145
|
-
isLoadingMore: status === 'loadingMore',
|
|
3146
|
-
children: renderItemSkeleton
|
|
3147
|
-
})]
|
|
3148
|
-
}), footer, (isEmptyStateDisplayed || isErrorStateDisplayed) && /*#__PURE__*/jsx(GenericBlock, {
|
|
3149
|
-
className: element$K('state'),
|
|
3150
|
-
orientation: "vertical",
|
|
3151
|
-
vAlign: "center",
|
|
3152
|
-
children: /*#__PURE__*/jsxs(GenericBlock.Content, {
|
|
3153
|
-
children: [inputValue && isEmptyStateDisplayed && /*#__PURE__*/jsx(Text, {
|
|
3154
|
-
as: "p",
|
|
3155
|
-
typography: "body1",
|
|
3156
|
-
color: "dark",
|
|
3157
|
-
colorVariant: "L2",
|
|
3158
|
-
dangerouslySetInnerHTML: {
|
|
3159
|
-
__html: translations.noResultsForInputLabel(inputValue)
|
|
3160
|
-
}
|
|
3161
|
-
}), !inputValue && isEmptyStateDisplayed && /*#__PURE__*/jsx(Text, {
|
|
3162
|
-
as: "p",
|
|
3163
|
-
typography: "body1",
|
|
3164
|
-
color: "dark",
|
|
3165
|
-
colorVariant: "L2",
|
|
3166
|
-
children: translations.noResultsForInputLabel()
|
|
3167
|
-
}), isErrorStateDisplayed && /*#__PURE__*/jsxs(Fragment, {
|
|
3168
|
-
children: [/*#__PURE__*/jsx(Heading, {
|
|
3169
|
-
as: "h2",
|
|
3170
|
-
typography: "subtitle2",
|
|
3171
|
-
children: translations.serviceUnavailableLabel
|
|
3172
|
-
}), /*#__PURE__*/jsx(Text, {
|
|
3173
|
-
as: "p",
|
|
3174
|
-
typography: "body1",
|
|
3175
|
-
color: "dark",
|
|
3176
|
-
colorVariant: "L2",
|
|
3177
|
-
children: translations.tryReloadLabel
|
|
3178
|
-
})]
|
|
3179
|
-
})]
|
|
3180
|
-
})
|
|
3181
|
-
})]
|
|
3182
|
-
})
|
|
3183
|
-
})]
|
|
3184
|
-
});
|
|
3185
|
-
};
|
|
3186
|
-
|
|
3187
|
-
/**
|
|
3188
|
-
* Action to set on a Combobox Option.
|
|
3189
|
-
* Allows to add an interactive element that
|
|
3190
|
-
* can be navigated to and triggered using the keyboard.
|
|
3191
|
-
*
|
|
3192
|
-
* Defaults as "button"
|
|
3193
|
-
*
|
|
3194
|
-
* @family Combobox
|
|
3195
|
-
* @param ComboboxOptionActionProps
|
|
3196
|
-
* @returns ComboboxOptionAction
|
|
3197
|
-
*/
|
|
3198
|
-
const ComboboxOptionAction = props => {
|
|
3199
|
-
const {
|
|
3200
|
-
as,
|
|
3201
|
-
isDisabled,
|
|
3202
|
-
onClick,
|
|
3203
|
-
id: originalId,
|
|
3204
|
-
...forwardedProps
|
|
3205
|
-
} = props;
|
|
3206
|
-
const {
|
|
3207
|
-
optionId
|
|
3208
|
-
} = useComboboxOptionContext();
|
|
3209
|
-
const {
|
|
3210
|
-
triggerRef
|
|
3211
|
-
} = useComboboxRefs();
|
|
3212
|
-
const itemRef = React__default.useRef(null);
|
|
3213
|
-
const generatedId = useId();
|
|
3214
|
-
const id = originalId || generatedId;
|
|
3215
|
-
const isHighlighted = useVirtualFocus(id, itemRef, isDisabled, optionId);
|
|
3216
|
-
const {
|
|
3217
|
-
state
|
|
3218
|
-
} = React__default.useContext(MovingFocusContext);
|
|
3219
|
-
const Component = as || 'button';
|
|
3220
|
-
const registeredActionOption = React__default.useMemo(() => ({
|
|
3221
|
-
id,
|
|
3222
|
-
generatedId: id,
|
|
3223
|
-
isAction: true,
|
|
3224
|
-
isDisabled,
|
|
3225
|
-
onSelect: () => {
|
|
3226
|
-
itemRef.current?.click();
|
|
3227
|
-
}
|
|
3228
|
-
}), [id, isDisabled]);
|
|
3229
|
-
|
|
3230
|
-
// Register the option
|
|
3231
|
-
useRegisterOption(id, registeredActionOption, !isDisabled);
|
|
3232
|
-
const handleActionClick = React__default.useCallback(() => {
|
|
3233
|
-
if (onClick) {
|
|
3234
|
-
onClick();
|
|
3235
|
-
}
|
|
3236
|
-
if (triggerRef?.current) {
|
|
3237
|
-
triggerRef.current?.focus();
|
|
3238
|
-
}
|
|
3239
|
-
}, [triggerRef, onClick]);
|
|
3240
|
-
return /*#__PURE__*/jsx(Component, {
|
|
3241
|
-
...forwardedProps,
|
|
3242
|
-
isDisabled: isDisabled,
|
|
3243
|
-
id: id,
|
|
3244
|
-
role: "gridcell",
|
|
3245
|
-
ref: itemRef,
|
|
3246
|
-
"data-focus-visible-added": state.isUsingKeyboard && isHighlighted ? 'true' : undefined,
|
|
3247
|
-
"aria-disabled": isDisabled,
|
|
3248
|
-
onClick: handleActionClick
|
|
3249
|
-
});
|
|
3250
|
-
};
|
|
2110
|
+
const lastChip = findPreviousEnabledChip();
|
|
2111
|
+
lastChip?.focus();
|
|
2112
|
+
};
|
|
3251
2113
|
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
const setToFalse = useCallback(() => setBoolean(false), []);
|
|
3255
|
-
const setToTrue = useCallback(() => setBoolean(true), []);
|
|
3256
|
-
const toggleBoolean = useCallback(() => setBoolean(previousValue => !previousValue), []);
|
|
3257
|
-
return [booleanValue, setToFalse, setToTrue, toggleBoolean];
|
|
3258
|
-
};
|
|
2114
|
+
// Attach keyboard event listener
|
|
2115
|
+
input.addEventListener('keydown', onKeyDown);
|
|
3259
2116
|
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
}
|
|
2117
|
+
// Cleanup listener on unmount
|
|
2118
|
+
return () => {
|
|
2119
|
+
input.removeEventListener('keydown', onKeyDown);
|
|
2120
|
+
};
|
|
2121
|
+
}, [inputRef, findPreviousEnabledChip]);
|
|
2122
|
+
return {
|
|
2123
|
+
findPreviousEnabledChip
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
3265
2126
|
|
|
3266
2127
|
/**
|
|
3267
|
-
*
|
|
3268
|
-
* Please consider using a simpler option description instead for better UX and a11y.
|
|
3269
|
-
*
|
|
3270
|
-
* @family Combobox
|
|
2128
|
+
* Component default class name and class prefix.
|
|
3271
2129
|
*/
|
|
3272
|
-
const
|
|
3273
|
-
buttonProps,
|
|
3274
|
-
popoverProps,
|
|
3275
|
-
onToggle,
|
|
3276
|
-
children
|
|
3277
|
-
}) => {
|
|
3278
|
-
const ref = React__default.useRef(null);
|
|
3279
|
-
const [isHovered,, onMouseLeave, onMouseEnter] = useBooleanState(false);
|
|
3280
|
-
const comboboxOption = useComboboxOptionContext();
|
|
3281
|
-
|
|
3282
|
-
// Open on mouse hover or key nav
|
|
3283
|
-
const isOpen = isHovered || comboboxOption.isKeyboardHighlighted;
|
|
3284
|
-
React__default.useEffect(() => {
|
|
3285
|
-
onToggle?.(isOpen);
|
|
3286
|
-
}, [isOpen, onToggle]);
|
|
3287
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
3288
|
-
children: [/*#__PURE__*/jsx(IconButton, {
|
|
3289
|
-
...buttonProps,
|
|
3290
|
-
ref: ref,
|
|
3291
|
-
className: block$X([buttonProps?.className]),
|
|
3292
|
-
icon: mdiInformationOutline,
|
|
3293
|
-
size: "s",
|
|
3294
|
-
emphasis: "low",
|
|
3295
|
-
onMouseEnter: onMouseEnter,
|
|
3296
|
-
onMouseLeave: onMouseLeave
|
|
3297
|
-
// Button actually plays no role here other than a target for the mouse hover
|
|
3298
|
-
// Keyboard accessibility is handled via combobox keyboard highlighting
|
|
3299
|
-
,
|
|
3300
|
-
"aria-hidden": true,
|
|
3301
|
-
label: ""
|
|
3302
|
-
}), /*#__PURE__*/jsx(Popover, {
|
|
3303
|
-
...popoverProps,
|
|
3304
|
-
className: element$J('popover', [popoverProps?.className]),
|
|
3305
|
-
anchorRef: ref,
|
|
3306
|
-
isOpen: isOpen,
|
|
3307
|
-
closeOnEscape: true,
|
|
3308
|
-
closeOnClickAway: true,
|
|
3309
|
-
placement: "bottom-start",
|
|
3310
|
-
children: children
|
|
3311
|
-
}), /*#__PURE__*/jsx(A11YLiveMessage, {
|
|
3312
|
-
hidden: true,
|
|
3313
|
-
children: isOpen ? children : undefined
|
|
3314
|
-
})]
|
|
3315
|
-
});
|
|
3316
|
-
};
|
|
3317
|
-
|
|
3318
|
-
const CLASSNAME$14 = 'lumx-combobox-section';
|
|
2130
|
+
const CLASSNAME$14 = 'lumx-selection-chip-group';
|
|
3319
2131
|
const {
|
|
3320
2132
|
block: block$W,
|
|
3321
2133
|
element: element$I
|
|
3322
2134
|
} = classNames.bem(CLASSNAME$14);
|
|
3323
2135
|
|
|
3324
2136
|
/**
|
|
3325
|
-
*
|
|
3326
|
-
*/
|
|
3327
|
-
const ComboboxSectionContent = ({
|
|
3328
|
-
className,
|
|
3329
|
-
title,
|
|
3330
|
-
children,
|
|
3331
|
-
isLoading,
|
|
3332
|
-
renderItemSkeleton
|
|
3333
|
-
}) => {
|
|
3334
|
-
const {
|
|
3335
|
-
options
|
|
3336
|
-
} = useCombobox();
|
|
3337
|
-
const {
|
|
3338
|
-
sectionId
|
|
3339
|
-
} = useComboboxSectionId();
|
|
3340
|
-
const hasRegisteredChildren = Boolean(Object.values(options).find(option => isComboboxValue(option) && option.sectionId === sectionId));
|
|
3341
|
-
const titleId = title && `${sectionId}-title`;
|
|
3342
|
-
if (!children && !isLoading) {
|
|
3343
|
-
return null;
|
|
3344
|
-
}
|
|
3345
|
-
const isHidden = !hasRegisteredChildren && !isLoading;
|
|
3346
|
-
return /*#__PURE__*/jsxs("li", {
|
|
3347
|
-
className: block$W([className]),
|
|
3348
|
-
role: !isHidden ? 'none' : undefined,
|
|
3349
|
-
"aria-hidden": isHidden,
|
|
3350
|
-
style: {
|
|
3351
|
-
display: isHidden ? 'none' : undefined
|
|
3352
|
-
},
|
|
3353
|
-
children: [title && /*#__PURE__*/jsx(Text, {
|
|
3354
|
-
as: "span",
|
|
3355
|
-
className: element$I('header', [ListSubheader.className]),
|
|
3356
|
-
"aria-hidden": "true",
|
|
3357
|
-
id: titleId,
|
|
3358
|
-
children: title
|
|
3359
|
-
}), /*#__PURE__*/jsxs("ul", {
|
|
3360
|
-
className: element$I('content'),
|
|
3361
|
-
role: "group",
|
|
3362
|
-
"aria-labelledby": titleId,
|
|
3363
|
-
children: [children, isLoading && /*#__PURE__*/jsx(ComboboxListSkeleton, {
|
|
3364
|
-
children: renderItemSkeleton
|
|
3365
|
-
})]
|
|
3366
|
-
})]
|
|
3367
|
-
});
|
|
3368
|
-
};
|
|
3369
|
-
|
|
3370
|
-
/**
|
|
3371
|
-
* Section for options of a Combobox.
|
|
2137
|
+
* SelectionChipGroup component.
|
|
3372
2138
|
*
|
|
3373
|
-
* @
|
|
3374
|
-
* @param
|
|
3375
|
-
* @
|
|
2139
|
+
* @param props Component props.
|
|
2140
|
+
* @param ref Component ref.
|
|
2141
|
+
* @return React element.
|
|
3376
2142
|
*/
|
|
3377
|
-
const
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
children: children
|
|
3391
|
-
})
|
|
3392
|
-
});
|
|
3393
|
-
};
|
|
3394
|
-
|
|
3395
|
-
/** Context provider for the combobox. */
|
|
3396
|
-
const ComboboxProvider = ({
|
|
3397
|
-
children,
|
|
3398
|
-
value
|
|
3399
|
-
}) => {
|
|
3400
|
-
return /*#__PURE__*/jsx(ComboboxContext.Provider, {
|
|
3401
|
-
value: value,
|
|
3402
|
-
children: /*#__PURE__*/jsx(MovingFocusProvider, {
|
|
3403
|
-
options: {
|
|
3404
|
-
direction: value.type === 'grid' ? 'both' : 'vertical',
|
|
3405
|
-
firstFocusDirection: value.type === 'grid' ? 'vertical' : undefined,
|
|
3406
|
-
loopAround: {
|
|
3407
|
-
row: 'next-loop',
|
|
3408
|
-
col: 'inside'
|
|
3409
|
-
},
|
|
3410
|
-
gridJumpToShortcutDirection: 'vertical',
|
|
3411
|
-
defaultSelectedId: value.selectedIds?.[0],
|
|
3412
|
-
listKey: value.inputValue
|
|
3413
|
-
},
|
|
3414
|
-
children: children
|
|
3415
|
-
})
|
|
3416
|
-
});
|
|
3417
|
-
};
|
|
3418
|
-
|
|
3419
|
-
const Combobox$1 = ({
|
|
3420
|
-
id: htmlId,
|
|
3421
|
-
inputValue,
|
|
3422
|
-
defaultInputValue,
|
|
3423
|
-
autoFilter = true,
|
|
3424
|
-
openOnClick,
|
|
3425
|
-
openOnFocus,
|
|
3426
|
-
status,
|
|
3427
|
-
showEmptyState = !autoFilter,
|
|
3428
|
-
showErrorState = !!status,
|
|
3429
|
-
selectedIds,
|
|
3430
|
-
onInputChange,
|
|
3431
|
-
onSelect,
|
|
3432
|
-
onOpen,
|
|
3433
|
-
children,
|
|
3434
|
-
selectionType,
|
|
3435
|
-
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
|
|
3436
2156
|
}) => {
|
|
3437
|
-
const
|
|
3438
|
-
const
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
translations
|
|
3500
|
-
}), [synchedState, openOnFocus, openOnClick, onInputChange, onOpen, onSelect, selectionType, currentSelectedIds, showEmptyState, showErrorState, translations]);
|
|
3501
|
-
return /*#__PURE__*/jsx(ComboboxRefsProvider, {
|
|
3502
|
-
triggerRef: triggerRef,
|
|
3503
|
-
anchorRef: textFieldRef,
|
|
3504
|
-
children: /*#__PURE__*/jsx(ComboboxProvider, {
|
|
3505
|
-
value: comboboxProviderValue,
|
|
3506
|
-
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);
|
|
3507
2219
|
})
|
|
3508
2220
|
});
|
|
3509
2221
|
};
|
|
3510
2222
|
|
|
3511
|
-
const SUB_COMPONENTS = {
|
|
3512
|
-
/**
|
|
3513
|
-
* Option to set within a combobox list.
|
|
3514
|
-
*
|
|
3515
|
-
* @family Combobox
|
|
3516
|
-
* @param ComboboxOptionProps
|
|
3517
|
-
* @returns ComboboxOption
|
|
3518
|
-
*/
|
|
3519
|
-
Option: ComboboxOption,
|
|
3520
|
-
/**
|
|
3521
|
-
* Skeleton for a combobox option.
|
|
3522
|
-
* A typography skeleton is rendered by default but can be overridden by passing children.
|
|
3523
|
-
*/
|
|
3524
|
-
OptionSkeleton: ComboboxOptionSkeleton,
|
|
3525
|
-
/**
|
|
3526
|
-
* Section for options of a Combobox.
|
|
3527
|
-
*
|
|
3528
|
-
* @family Combobox
|
|
3529
|
-
* @param ComboboxSectionProps
|
|
3530
|
-
* @returns ComboboxSection
|
|
3531
|
-
*/
|
|
3532
|
-
Section: ComboboxSection,
|
|
3533
|
-
/**
|
|
3534
|
-
* Combobox input trigger.
|
|
3535
|
-
*
|
|
3536
|
-
* @family Combobox
|
|
3537
|
-
*/
|
|
3538
|
-
Input: ComboboxInput,
|
|
3539
|
-
/**
|
|
3540
|
-
* The listbox containing the combobox's options.
|
|
3541
|
-
*
|
|
3542
|
-
* @family Combobox
|
|
3543
|
-
* @param ComboboxListBoxProps
|
|
3544
|
-
* @returns ComboboxListBox
|
|
3545
|
-
*/
|
|
3546
|
-
List: ComboboxListBox,
|
|
3547
|
-
/**
|
|
3548
|
-
* Combobox button trigger.
|
|
3549
|
-
*
|
|
3550
|
-
* @family Combobox
|
|
3551
|
-
*/
|
|
3552
|
-
Button: ComboboxButton
|
|
3553
|
-
};
|
|
3554
|
-
|
|
3555
|
-
/**
|
|
3556
|
-
*
|
|
3557
|
-
* A Combobox is a combination of two components:
|
|
3558
|
-
* * An input to enter the user's value
|
|
3559
|
-
* * A popover with a list of suggestions to fill the value.
|
|
3560
|
-
*
|
|
3561
|
-
* These two components are included via the Combobox.Input and Combobox.ListBox components.
|
|
3562
|
-
*
|
|
3563
|
-
* In its simplest implementation the component will automatically filter the given options
|
|
3564
|
-
* from the value of the input and fill the input with the textValue of the selected option.
|
|
3565
|
-
*
|
|
3566
|
-
* Props are available for more complex implementations.
|
|
3567
|
-
*
|
|
3568
|
-
* @family Combobox
|
|
3569
|
-
* @param ComboboxProps
|
|
3570
|
-
* @returns Combobox
|
|
3571
|
-
*/
|
|
3572
|
-
const Combobox = Object.assign(Combobox$1, SUB_COMPONENTS);
|
|
3573
|
-
|
|
3574
2223
|
/**
|
|
3575
2224
|
* Comment block variants.
|
|
3576
2225
|
*/
|
|
@@ -3600,7 +2249,7 @@ const {
|
|
|
3600
2249
|
/**
|
|
3601
2250
|
* Component default props.
|
|
3602
2251
|
*/
|
|
3603
|
-
const DEFAULT_PROPS$
|
|
2252
|
+
const DEFAULT_PROPS$Y = {
|
|
3604
2253
|
variant: CommentBlockVariant.indented
|
|
3605
2254
|
};
|
|
3606
2255
|
|
|
@@ -3630,7 +2279,7 @@ const CommentBlock = forwardRef((props, ref) => {
|
|
|
3630
2279
|
onMouseLeave,
|
|
3631
2280
|
text,
|
|
3632
2281
|
theme = defaultTheme,
|
|
3633
|
-
variant = DEFAULT_PROPS$
|
|
2282
|
+
variant = DEFAULT_PROPS$Y.variant,
|
|
3634
2283
|
...forwardedProps
|
|
3635
2284
|
} = props;
|
|
3636
2285
|
const hasChildren = Children.count(children) > 0;
|
|
@@ -3699,7 +2348,7 @@ const CommentBlock = forwardRef((props, ref) => {
|
|
|
3699
2348
|
});
|
|
3700
2349
|
CommentBlock.displayName = COMPONENT_NAME$15;
|
|
3701
2350
|
CommentBlock.className = CLASSNAME$13;
|
|
3702
|
-
CommentBlock.defaultProps = DEFAULT_PROPS$
|
|
2351
|
+
CommentBlock.defaultProps = DEFAULT_PROPS$Y;
|
|
3703
2352
|
|
|
3704
2353
|
/**
|
|
3705
2354
|
* Add a number of months from a date while resetting the day to prevent month length mismatches.
|
|
@@ -4189,6 +2838,14 @@ const DatePicker = forwardRef((props, ref) => {
|
|
|
4189
2838
|
DatePicker.displayName = COMPONENT_NAME$14;
|
|
4190
2839
|
DatePicker.className = CLASSNAME$12;
|
|
4191
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
|
+
|
|
4192
2849
|
/**
|
|
4193
2850
|
* Component display name.
|
|
4194
2851
|
*/
|
|
@@ -4796,7 +3453,7 @@ const {
|
|
|
4796
3453
|
/**
|
|
4797
3454
|
* Component default props.
|
|
4798
3455
|
*/
|
|
4799
|
-
const DEFAULT_PROPS$
|
|
3456
|
+
const DEFAULT_PROPS$X = {
|
|
4800
3457
|
size: Size$1.big,
|
|
4801
3458
|
disableBodyScroll: true
|
|
4802
3459
|
};
|
|
@@ -4827,11 +3484,11 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
4827
3484
|
parentElement,
|
|
4828
3485
|
contentRef,
|
|
4829
3486
|
preventAutoClose,
|
|
4830
|
-
size = DEFAULT_PROPS$
|
|
3487
|
+
size = DEFAULT_PROPS$X.size,
|
|
4831
3488
|
zIndex,
|
|
4832
3489
|
dialogProps,
|
|
4833
3490
|
onVisibilityChange,
|
|
4834
|
-
disableBodyScroll = DEFAULT_PROPS$
|
|
3491
|
+
disableBodyScroll = DEFAULT_PROPS$X.disableBodyScroll,
|
|
4835
3492
|
preventCloseOnClick,
|
|
4836
3493
|
preventCloseOnEscape,
|
|
4837
3494
|
...forwardedProps
|
|
@@ -4971,7 +3628,7 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
4971
3628
|
});
|
|
4972
3629
|
Dialog.displayName = COMPONENT_NAME$11;
|
|
4973
3630
|
Dialog.className = CLASSNAME$11;
|
|
4974
|
-
Dialog.defaultProps = DEFAULT_PROPS$
|
|
3631
|
+
Dialog.defaultProps = DEFAULT_PROPS$X;
|
|
4975
3632
|
|
|
4976
3633
|
/**
|
|
4977
3634
|
* Component display name.
|
|
@@ -5015,7 +3672,7 @@ const Divider$1 = props => {
|
|
|
5015
3672
|
/**
|
|
5016
3673
|
* Component default props.
|
|
5017
3674
|
*/
|
|
5018
|
-
const DEFAULT_PROPS$
|
|
3675
|
+
const DEFAULT_PROPS$W = {};
|
|
5019
3676
|
|
|
5020
3677
|
/**
|
|
5021
3678
|
* Divider component.
|
|
@@ -5038,7 +3695,7 @@ const Divider = forwardRef((props, ref) => {
|
|
|
5038
3695
|
});
|
|
5039
3696
|
Divider.displayName = COMPONENT_NAME$10;
|
|
5040
3697
|
Divider.className = CLASSNAME$10;
|
|
5041
|
-
Divider.defaultProps = DEFAULT_PROPS$
|
|
3698
|
+
Divider.defaultProps = DEFAULT_PROPS$W;
|
|
5042
3699
|
|
|
5043
3700
|
/**
|
|
5044
3701
|
* Component display name.
|
|
@@ -5263,7 +3920,7 @@ const {
|
|
|
5263
3920
|
/**
|
|
5264
3921
|
* Component default props.
|
|
5265
3922
|
*/
|
|
5266
|
-
const DEFAULT_PROPS$
|
|
3923
|
+
const DEFAULT_PROPS$V = {
|
|
5267
3924
|
tabIndex: -1
|
|
5268
3925
|
};
|
|
5269
3926
|
|
|
@@ -5282,7 +3939,7 @@ const InternalList = forwardRef((props, ref) => {
|
|
|
5282
3939
|
isClickable,
|
|
5283
3940
|
itemPadding,
|
|
5284
3941
|
onListItemSelected,
|
|
5285
|
-
tabIndex = DEFAULT_PROPS$
|
|
3942
|
+
tabIndex = DEFAULT_PROPS$V.tabIndex,
|
|
5286
3943
|
...forwardedProps
|
|
5287
3944
|
} = props;
|
|
5288
3945
|
const adjustedItemPadding = itemPadding ?? (isClickable ? Size$1.big : undefined);
|
|
@@ -5298,7 +3955,7 @@ const InternalList = forwardRef((props, ref) => {
|
|
|
5298
3955
|
});
|
|
5299
3956
|
InternalList.displayName = COMPONENT_NAME$_;
|
|
5300
3957
|
InternalList.className = CLASSNAME$_;
|
|
5301
|
-
InternalList.defaultProps = DEFAULT_PROPS$
|
|
3958
|
+
InternalList.defaultProps = DEFAULT_PROPS$V;
|
|
5302
3959
|
const List = Object.assign(InternalList, {
|
|
5303
3960
|
useKeyboardListNavigation
|
|
5304
3961
|
});
|
|
@@ -7743,7 +6400,7 @@ const {
|
|
|
7743
6400
|
/**
|
|
7744
6401
|
* Component default props.
|
|
7745
6402
|
*/
|
|
7746
|
-
const DEFAULT_PROPS$
|
|
6403
|
+
const DEFAULT_PROPS$U = {
|
|
7747
6404
|
elevation: 3,
|
|
7748
6405
|
placement: Placement.AUTO,
|
|
7749
6406
|
focusAnchorOnClose: true,
|
|
@@ -7760,24 +6417,24 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
7760
6417
|
className,
|
|
7761
6418
|
closeOnClickAway,
|
|
7762
6419
|
closeOnEscape,
|
|
7763
|
-
elevation = DEFAULT_PROPS$
|
|
6420
|
+
elevation = DEFAULT_PROPS$U.elevation,
|
|
7764
6421
|
focusElement,
|
|
7765
6422
|
hasArrow,
|
|
7766
6423
|
isOpen,
|
|
7767
6424
|
onClose,
|
|
7768
6425
|
parentElement,
|
|
7769
|
-
usePortal = DEFAULT_PROPS$
|
|
7770
|
-
focusAnchorOnClose = DEFAULT_PROPS$
|
|
6426
|
+
usePortal = DEFAULT_PROPS$U.usePortal,
|
|
6427
|
+
focusAnchorOnClose = DEFAULT_PROPS$U.focusAnchorOnClose,
|
|
7771
6428
|
withFocusTrap,
|
|
7772
6429
|
boundaryRef,
|
|
7773
6430
|
fitToAnchorWidth,
|
|
7774
6431
|
fitWithinViewportHeight,
|
|
7775
6432
|
focusTrapZoneElement,
|
|
7776
6433
|
offset,
|
|
7777
|
-
placement = DEFAULT_PROPS$
|
|
6434
|
+
placement = DEFAULT_PROPS$U.placement,
|
|
7778
6435
|
style,
|
|
7779
6436
|
theme,
|
|
7780
|
-
zIndex = DEFAULT_PROPS$
|
|
6437
|
+
zIndex = DEFAULT_PROPS$U.zIndex,
|
|
7781
6438
|
...forwardedProps
|
|
7782
6439
|
} = props;
|
|
7783
6440
|
const popoverRef = useRef(null);
|
|
@@ -7863,7 +6520,7 @@ const Popover = skipRender(
|
|
|
7863
6520
|
() => Boolean(DOCUMENT), _InnerPopover);
|
|
7864
6521
|
Popover.displayName = COMPONENT_NAME$Z;
|
|
7865
6522
|
Popover.className = CLASSNAME$Z;
|
|
7866
|
-
Popover.defaultProps = DEFAULT_PROPS$
|
|
6523
|
+
Popover.defaultProps = DEFAULT_PROPS$U;
|
|
7867
6524
|
|
|
7868
6525
|
// The error margin in px we want to have for triggering infinite scroll
|
|
7869
6526
|
const SCROLL_TRIGGER_MARGIN = 5;
|
|
@@ -7923,7 +6580,7 @@ const {
|
|
|
7923
6580
|
/**
|
|
7924
6581
|
* Component default props.
|
|
7925
6582
|
*/
|
|
7926
|
-
const DEFAULT_PROPS$
|
|
6583
|
+
const DEFAULT_PROPS$T = {
|
|
7927
6584
|
closeOnClick: true,
|
|
7928
6585
|
closeOnClickAway: true,
|
|
7929
6586
|
closeOnEscape: true,
|
|
@@ -7946,18 +6603,18 @@ const Dropdown = forwardRef((props, ref) => {
|
|
|
7946
6603
|
anchorRef,
|
|
7947
6604
|
children,
|
|
7948
6605
|
className,
|
|
7949
|
-
closeOnClick = DEFAULT_PROPS$
|
|
7950
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
7951
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
7952
|
-
fitToAnchorWidth = DEFAULT_PROPS$
|
|
7953
|
-
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,
|
|
7954
6611
|
isOpen,
|
|
7955
6612
|
offset,
|
|
7956
|
-
focusAnchorOnClose = DEFAULT_PROPS$
|
|
6613
|
+
focusAnchorOnClose = DEFAULT_PROPS$T.focusAnchorOnClose,
|
|
7957
6614
|
onClose,
|
|
7958
6615
|
onInfiniteScroll,
|
|
7959
|
-
placement = DEFAULT_PROPS$
|
|
7960
|
-
shouldFocusOnOpen = DEFAULT_PROPS$
|
|
6616
|
+
placement = DEFAULT_PROPS$T.placement,
|
|
6617
|
+
shouldFocusOnOpen = DEFAULT_PROPS$T.shouldFocusOnOpen,
|
|
7961
6618
|
zIndex,
|
|
7962
6619
|
...forwardedProps
|
|
7963
6620
|
} = props;
|
|
@@ -8003,7 +6660,7 @@ const Dropdown = forwardRef((props, ref) => {
|
|
|
8003
6660
|
});
|
|
8004
6661
|
Dropdown.displayName = COMPONENT_NAME$Y;
|
|
8005
6662
|
Dropdown.className = CLASSNAME$Y;
|
|
8006
|
-
Dropdown.defaultProps = DEFAULT_PROPS$
|
|
6663
|
+
Dropdown.defaultProps = DEFAULT_PROPS$T;
|
|
8007
6664
|
|
|
8008
6665
|
/**
|
|
8009
6666
|
* Component display name.
|
|
@@ -8022,7 +6679,7 @@ const {
|
|
|
8022
6679
|
/**
|
|
8023
6680
|
* Component default props.
|
|
8024
6681
|
*/
|
|
8025
|
-
const DEFAULT_PROPS$
|
|
6682
|
+
const DEFAULT_PROPS$S = {
|
|
8026
6683
|
closeMode: 'unmount'
|
|
8027
6684
|
};
|
|
8028
6685
|
const isDragHandle = isComponent(DragHandle);
|
|
@@ -8040,7 +6697,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
8040
6697
|
const defaultTheme = useTheme() || Theme$1.light;
|
|
8041
6698
|
const {
|
|
8042
6699
|
className,
|
|
8043
|
-
closeMode = DEFAULT_PROPS$
|
|
6700
|
+
closeMode = DEFAULT_PROPS$S.closeMode,
|
|
8044
6701
|
children: anyChildren,
|
|
8045
6702
|
hasBackground,
|
|
8046
6703
|
hasHeaderDivider,
|
|
@@ -8157,11 +6814,11 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
8157
6814
|
});
|
|
8158
6815
|
ExpansionPanel.displayName = COMPONENT_NAME$X;
|
|
8159
6816
|
ExpansionPanel.className = CLASSNAME$X;
|
|
8160
|
-
ExpansionPanel.defaultProps = DEFAULT_PROPS$
|
|
6817
|
+
ExpansionPanel.defaultProps = DEFAULT_PROPS$S;
|
|
8161
6818
|
|
|
8162
6819
|
const COMPONENT_NAME$W = 'Flag';
|
|
8163
6820
|
const CLASSNAME$W = 'lumx-flag';
|
|
8164
|
-
const DEFAULT_PROPS$
|
|
6821
|
+
const DEFAULT_PROPS$R = {};
|
|
8165
6822
|
const {
|
|
8166
6823
|
block: block$N,
|
|
8167
6824
|
element: element$B
|
|
@@ -8225,7 +6882,7 @@ const Flag = forwardRef((props, ref) => {
|
|
|
8225
6882
|
});
|
|
8226
6883
|
Flag.displayName = COMPONENT_NAME$W;
|
|
8227
6884
|
Flag.className = CLASSNAME$W;
|
|
8228
|
-
Flag.defaultProps = DEFAULT_PROPS$
|
|
6885
|
+
Flag.defaultProps = DEFAULT_PROPS$R;
|
|
8229
6886
|
|
|
8230
6887
|
/**
|
|
8231
6888
|
* Defines the props of the component.
|
|
@@ -8318,7 +6975,7 @@ const {
|
|
|
8318
6975
|
/**
|
|
8319
6976
|
* Component default props.
|
|
8320
6977
|
*/
|
|
8321
|
-
const DEFAULT_PROPS$
|
|
6978
|
+
const DEFAULT_PROPS$Q = {
|
|
8322
6979
|
gap: Size$1.big,
|
|
8323
6980
|
orientation: Orientation$1.horizontal
|
|
8324
6981
|
};
|
|
@@ -8348,8 +7005,8 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
8348
7005
|
children,
|
|
8349
7006
|
actions,
|
|
8350
7007
|
actionsProps,
|
|
8351
|
-
gap = DEFAULT_PROPS$
|
|
8352
|
-
orientation = DEFAULT_PROPS$
|
|
7008
|
+
gap = DEFAULT_PROPS$Q.gap,
|
|
7009
|
+
orientation = DEFAULT_PROPS$Q.orientation,
|
|
8353
7010
|
contentProps,
|
|
8354
7011
|
...forwardedProps
|
|
8355
7012
|
} = props;
|
|
@@ -8403,7 +7060,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
8403
7060
|
});
|
|
8404
7061
|
BaseGenericBlock.displayName = COMPONENT_NAME$U;
|
|
8405
7062
|
BaseGenericBlock.className = CLASSNAME$U;
|
|
8406
|
-
BaseGenericBlock.defaultProps = DEFAULT_PROPS$
|
|
7063
|
+
BaseGenericBlock.defaultProps = DEFAULT_PROPS$Q;
|
|
8407
7064
|
const GenericBlock = Object.assign(BaseGenericBlock, {
|
|
8408
7065
|
Figure,
|
|
8409
7066
|
Content,
|
|
@@ -8451,7 +7108,7 @@ const CLASSNAME$T = 'lumx-heading';
|
|
|
8451
7108
|
/**
|
|
8452
7109
|
* Component default props.
|
|
8453
7110
|
*/
|
|
8454
|
-
const DEFAULT_PROPS$
|
|
7111
|
+
const DEFAULT_PROPS$P = {};
|
|
8455
7112
|
|
|
8456
7113
|
/**
|
|
8457
7114
|
* Get Heading component common props
|
|
@@ -8552,7 +7209,7 @@ const {
|
|
|
8552
7209
|
/**
|
|
8553
7210
|
* Component default props.
|
|
8554
7211
|
*/
|
|
8555
|
-
const DEFAULT_PROPS$
|
|
7212
|
+
const DEFAULT_PROPS$O = {};
|
|
8556
7213
|
|
|
8557
7214
|
/**
|
|
8558
7215
|
* Text component common props
|
|
@@ -8639,7 +7296,7 @@ const Text = forwardRef((props, ref) => {
|
|
|
8639
7296
|
});
|
|
8640
7297
|
Text.displayName = COMPONENT_NAME$S;
|
|
8641
7298
|
Text.className = CLASSNAME$S;
|
|
8642
|
-
Text.defaultProps = DEFAULT_PROPS$
|
|
7299
|
+
Text.defaultProps = DEFAULT_PROPS$O;
|
|
8643
7300
|
|
|
8644
7301
|
const HeadingLevelContext = /*#__PURE__*/createContext(defaultContext);
|
|
8645
7302
|
|
|
@@ -8676,7 +7333,7 @@ const Heading = forwardRef((props, ref) => {
|
|
|
8676
7333
|
});
|
|
8677
7334
|
Heading.displayName = COMPONENT_NAME$T;
|
|
8678
7335
|
Heading.className = CLASSNAME$T;
|
|
8679
|
-
Heading.defaultProps = DEFAULT_PROPS$
|
|
7336
|
+
Heading.defaultProps = DEFAULT_PROPS$P;
|
|
8680
7337
|
|
|
8681
7338
|
/**
|
|
8682
7339
|
* Computes the next heading level based on the optional prop level or the parent context level.
|
|
@@ -8727,7 +7384,7 @@ const {
|
|
|
8727
7384
|
/**
|
|
8728
7385
|
* Component default props.
|
|
8729
7386
|
*/
|
|
8730
|
-
const DEFAULT_PROPS$
|
|
7387
|
+
const DEFAULT_PROPS$N = {
|
|
8731
7388
|
orientation: Orientation$1.horizontal,
|
|
8732
7389
|
wrap: 'nowrap'
|
|
8733
7390
|
};
|
|
@@ -8745,9 +7402,9 @@ const Grid = forwardRef((props, ref) => {
|
|
|
8745
7402
|
className,
|
|
8746
7403
|
gutter,
|
|
8747
7404
|
hAlign,
|
|
8748
|
-
orientation = DEFAULT_PROPS$
|
|
7405
|
+
orientation = DEFAULT_PROPS$N.orientation,
|
|
8749
7406
|
vAlign,
|
|
8750
|
-
wrap = DEFAULT_PROPS$
|
|
7407
|
+
wrap = DEFAULT_PROPS$N.wrap,
|
|
8751
7408
|
...forwardedProps
|
|
8752
7409
|
} = props;
|
|
8753
7410
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -8765,7 +7422,7 @@ const Grid = forwardRef((props, ref) => {
|
|
|
8765
7422
|
});
|
|
8766
7423
|
Grid.displayName = COMPONENT_NAME$R;
|
|
8767
7424
|
Grid.className = CLASSNAME$R;
|
|
8768
|
-
Grid.defaultProps = DEFAULT_PROPS$
|
|
7425
|
+
Grid.defaultProps = DEFAULT_PROPS$N;
|
|
8769
7426
|
|
|
8770
7427
|
/**
|
|
8771
7428
|
* Component display name.
|
|
@@ -8823,7 +7480,7 @@ const CLASSNAME$P = 'lumx-grid-column';
|
|
|
8823
7480
|
/**
|
|
8824
7481
|
* Component default props.
|
|
8825
7482
|
*/
|
|
8826
|
-
const DEFAULT_PROPS$
|
|
7483
|
+
const DEFAULT_PROPS$M = {};
|
|
8827
7484
|
|
|
8828
7485
|
/**
|
|
8829
7486
|
* The GridColumn is a layout component that can display children in a grid
|
|
@@ -8831,9 +7488,10 @@ const DEFAULT_PROPS$N = {};
|
|
|
8831
7488
|
* with a number of column that reduce when there is not enough space for each item.
|
|
8832
7489
|
*
|
|
8833
7490
|
* @param props Component props.
|
|
8834
|
-
* @
|
|
7491
|
+
* @param ref Component ref.
|
|
7492
|
+
* @return React element.
|
|
8835
7493
|
*/
|
|
8836
|
-
const GridColumn
|
|
7494
|
+
const GridColumn = forwardRef((props, ref) => {
|
|
8837
7495
|
const {
|
|
8838
7496
|
as: Component = 'div',
|
|
8839
7497
|
gap,
|
|
@@ -8842,13 +7500,12 @@ const GridColumn$1 = props => {
|
|
|
8842
7500
|
children,
|
|
8843
7501
|
className,
|
|
8844
7502
|
style = {},
|
|
8845
|
-
ref,
|
|
8846
7503
|
...forwardedProps
|
|
8847
7504
|
} = props;
|
|
8848
7505
|
return /*#__PURE__*/jsx(Component, {
|
|
8849
7506
|
...forwardedProps,
|
|
8850
7507
|
ref: ref,
|
|
8851
|
-
className:
|
|
7508
|
+
className: classNames.join(className, CLASSNAME$P),
|
|
8852
7509
|
style: {
|
|
8853
7510
|
...style,
|
|
8854
7511
|
['--lumx-grid-column-item-min-width']: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
@@ -8857,36 +7514,6 @@ const GridColumn$1 = props => {
|
|
|
8857
7514
|
},
|
|
8858
7515
|
children: children
|
|
8859
7516
|
});
|
|
8860
|
-
};
|
|
8861
|
-
GridColumn$1.displayName = COMPONENT_NAME$P;
|
|
8862
|
-
GridColumn$1.className = CLASSNAME$P;
|
|
8863
|
-
GridColumn$1.defaultProps = DEFAULT_PROPS$N;
|
|
8864
|
-
|
|
8865
|
-
/**
|
|
8866
|
-
* Defines the props of the component.
|
|
8867
|
-
*/
|
|
8868
|
-
|
|
8869
|
-
// Re-export types for backward compatibility
|
|
8870
|
-
|
|
8871
|
-
/**
|
|
8872
|
-
* Component default props.
|
|
8873
|
-
*/
|
|
8874
|
-
const DEFAULT_PROPS$M = {};
|
|
8875
|
-
|
|
8876
|
-
/**
|
|
8877
|
-
* The GridColumn is a layout component that can display children in a grid
|
|
8878
|
-
* with custom display properties. It also comes with a responsive design,
|
|
8879
|
-
* with a number of column that reduce when there is not enough space for each item.
|
|
8880
|
-
*
|
|
8881
|
-
* @param props Component props.
|
|
8882
|
-
* @param ref Component ref.
|
|
8883
|
-
* @return React element.
|
|
8884
|
-
*/
|
|
8885
|
-
const GridColumn = forwardRef((props, ref) => {
|
|
8886
|
-
return GridColumn$1({
|
|
8887
|
-
ref,
|
|
8888
|
-
...props
|
|
8889
|
-
});
|
|
8890
7517
|
});
|
|
8891
7518
|
GridColumn.displayName = COMPONENT_NAME$P;
|
|
8892
7519
|
GridColumn.className = CLASSNAME$P;
|
|
@@ -16677,5 +15304,5 @@ UserBlock.displayName = COMPONENT_NAME;
|
|
|
16677
15304
|
UserBlock.className = CLASSNAME;
|
|
16678
15305
|
UserBlock.defaultProps = DEFAULT_PROPS;
|
|
16679
15306
|
|
|
16680
|
-
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonGroup, CLASSNAME$
|
|
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 };
|
|
16681
15308
|
//# sourceMappingURL=index.js.map
|