@lumx/react 4.3.2-alpha.12 → 4.3.2-alpha.14
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/Tooltip-CCXZsfG-.d.ts +986 -0
- package/_internal/BCgo9dYV.js +1805 -0
- package/_internal/BCgo9dYV.js.map +1 -0
- package/index.d.ts +335 -672
- package/index.js +1696 -323
- package/index.js.map +1 -1
- package/package.json +3 -7
- package/utils/index.d.ts +35 -1
- package/utils/index.js +3 -1322
- package/utils/index.js.map +1 -1
- package/_internal/DpdvhbTO.js +0 -159
- package/_internal/DpdvhbTO.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, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
|
|
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, REAL_SIZE_FOR_LUMX_SIZE, 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, useContext, createContext, useReducer, Children, useLayoutEffect, cloneElement, isValidElement } from 'react';
|
|
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';
|
|
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,40 +16,43 @@ 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, P as Portal,
|
|
19
|
+
import { u as useDisabledStateContext, a as useVirtualFocusParent, M as MovingFocusContext, i as isComboboxValue, b as useComboboxRefs, c as useCombobox, S as SectionContext, g as generateOptionId, d as useVirtualFocus, A as A11YLiveMessage, C as ComboboxContext, e as MovingFocusProvider, r as reducer$1, f as initialState, h as ComboboxRefsProvider, P as Portal, j as ClickAwayProvider } from './_internal/BCgo9dYV.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';
|
|
23
23
|
import memoize from 'lodash/memoize';
|
|
24
|
-
import { mdiClose } from '@lumx/icons/esm/close
|
|
24
|
+
import { mdiClose } from '@lumx/icons/esm/close';
|
|
25
25
|
import isFunction from 'lodash/isFunction';
|
|
26
|
-
import { mdiImageBroken } from '@lumx/icons/esm/image-broken
|
|
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';
|
|
31
|
-
import castArray from 'lodash/castArray';
|
|
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';
|
|
26
|
+
import { mdiImageBroken } from '@lumx/icons/esm/image-broken';
|
|
35
27
|
import noop from 'lodash/noop';
|
|
28
|
+
import castArray from 'lodash/castArray';
|
|
29
|
+
import { mdiCheck } from '@lumx/icons/esm/check';
|
|
30
|
+
import { mdiMinus } from '@lumx/icons/esm/minus';
|
|
31
|
+
import { visuallyHidden, bem as bem$1 } from '@lumx/core/js/utils/classNames';
|
|
32
|
+
import debounce$1 from 'lodash/debounce';
|
|
33
|
+
import { mdiChevronDown } from '@lumx/icons/esm/chevron-down';
|
|
34
|
+
import { mdiChevronUp } from '@lumx/icons/esm/chevron-up';
|
|
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';
|
|
36
39
|
import pick from 'lodash/pick';
|
|
37
40
|
import isInteger from 'lodash/isInteger';
|
|
38
|
-
import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline
|
|
39
|
-
import { mdiMagnifyPlusOutline } from '@lumx/icons/esm/magnify-plus-outline
|
|
41
|
+
import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline';
|
|
42
|
+
import { mdiMagnifyPlusOutline } from '@lumx/icons/esm/magnify-plus-outline';
|
|
40
43
|
import throttle from 'lodash/throttle';
|
|
41
44
|
import range from 'lodash/range';
|
|
42
|
-
import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline
|
|
43
|
-
import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline
|
|
45
|
+
import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline';
|
|
46
|
+
import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline';
|
|
44
47
|
import chunk from 'lodash/chunk';
|
|
45
48
|
import ReactDOM from 'react-dom';
|
|
46
49
|
import take from 'lodash/take';
|
|
47
|
-
import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank
|
|
48
|
-
import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked
|
|
49
|
-
import { mdiMenuDown } from '@lumx/icons/esm/menu-down
|
|
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';
|
|
50
53
|
import { getWithSelector } from '@lumx/core/js/utils/selectors/getWithSelector';
|
|
51
|
-
import { mdiArrowDown } from '@lumx/icons/esm/arrow-down
|
|
52
|
-
import { mdiArrowUp } from '@lumx/icons/esm/arrow-up
|
|
54
|
+
import { mdiArrowDown } from '@lumx/icons/esm/arrow-down';
|
|
55
|
+
import { mdiArrowUp } from '@lumx/icons/esm/arrow-up';
|
|
53
56
|
import set from 'lodash/set';
|
|
54
57
|
|
|
55
58
|
let i = 0;
|
|
@@ -101,15 +104,15 @@ const COMPONENT_NAME$1l = 'AlertDialog';
|
|
|
101
104
|
/**
|
|
102
105
|
* Component default class name and class prefix.
|
|
103
106
|
*/
|
|
104
|
-
const CLASSNAME$
|
|
107
|
+
const CLASSNAME$1n = 'lumx-alert-dialog';
|
|
105
108
|
const {
|
|
106
|
-
block: block$
|
|
107
|
-
} = classNames.bem(CLASSNAME$
|
|
109
|
+
block: block$19
|
|
110
|
+
} = classNames.bem(CLASSNAME$1n);
|
|
108
111
|
|
|
109
112
|
/**
|
|
110
113
|
* Component default props.
|
|
111
114
|
*/
|
|
112
|
-
const DEFAULT_PROPS$
|
|
115
|
+
const DEFAULT_PROPS$1b = {
|
|
113
116
|
size: Size$1.tiny,
|
|
114
117
|
kind: Kind$1.info
|
|
115
118
|
};
|
|
@@ -130,8 +133,8 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
130
133
|
className,
|
|
131
134
|
cancelProps,
|
|
132
135
|
confirmProps,
|
|
133
|
-
kind = DEFAULT_PROPS$
|
|
134
|
-
size = DEFAULT_PROPS$
|
|
136
|
+
kind = DEFAULT_PROPS$1b.kind,
|
|
137
|
+
size = DEFAULT_PROPS$1b.size,
|
|
135
138
|
dialogProps,
|
|
136
139
|
children,
|
|
137
140
|
...forwardedProps
|
|
@@ -172,7 +175,7 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
172
175
|
'aria-describedby': descriptionId,
|
|
173
176
|
...dialogProps
|
|
174
177
|
},
|
|
175
|
-
className: classNames.join(className, block$
|
|
178
|
+
className: classNames.join(className, block$19({
|
|
176
179
|
[`kind-${kind}`]: Boolean(kind)
|
|
177
180
|
})),
|
|
178
181
|
...forwardedProps,
|
|
@@ -218,8 +221,8 @@ const AlertDialog = forwardRef((props, ref) => {
|
|
|
218
221
|
});
|
|
219
222
|
});
|
|
220
223
|
AlertDialog.displayName = COMPONENT_NAME$1l;
|
|
221
|
-
AlertDialog.className = CLASSNAME$
|
|
222
|
-
AlertDialog.defaultProps = DEFAULT_PROPS$
|
|
224
|
+
AlertDialog.className = CLASSNAME$1n;
|
|
225
|
+
AlertDialog.defaultProps = DEFAULT_PROPS$1b;
|
|
223
226
|
|
|
224
227
|
/**
|
|
225
228
|
* Hook focusing an element when defined and `focus` boolean `true`.
|
|
@@ -316,12 +319,12 @@ const COMPONENT_NAME$1k = 'Autocomplete';
|
|
|
316
319
|
/**
|
|
317
320
|
* Component default class name and class prefix.
|
|
318
321
|
*/
|
|
319
|
-
const CLASSNAME$
|
|
322
|
+
const CLASSNAME$1m = 'lumx-autocomplete';
|
|
320
323
|
|
|
321
324
|
/**
|
|
322
325
|
* Component default props.
|
|
323
326
|
*/
|
|
324
|
-
const DEFAULT_PROPS$
|
|
327
|
+
const DEFAULT_PROPS$1a = {
|
|
325
328
|
anchorToInput: false,
|
|
326
329
|
closeOnClick: false,
|
|
327
330
|
closeOnClickAway: true,
|
|
@@ -343,13 +346,13 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
343
346
|
otherProps
|
|
344
347
|
} = useDisableStateProps(props);
|
|
345
348
|
const {
|
|
346
|
-
anchorToInput = DEFAULT_PROPS$
|
|
349
|
+
anchorToInput = DEFAULT_PROPS$1a.anchorToInput,
|
|
347
350
|
children,
|
|
348
351
|
chips,
|
|
349
352
|
className,
|
|
350
|
-
closeOnClick = DEFAULT_PROPS$
|
|
351
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
352
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
353
|
+
closeOnClick = DEFAULT_PROPS$1a.closeOnClick,
|
|
354
|
+
closeOnClickAway = DEFAULT_PROPS$1a.closeOnClickAway,
|
|
355
|
+
closeOnEscape = DEFAULT_PROPS$1a.closeOnEscape,
|
|
353
356
|
error,
|
|
354
357
|
fitToAnchorWidth,
|
|
355
358
|
hasError,
|
|
@@ -370,7 +373,7 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
370
373
|
onInfiniteScroll,
|
|
371
374
|
placeholder,
|
|
372
375
|
placement,
|
|
373
|
-
shouldFocusOnClose = DEFAULT_PROPS$
|
|
376
|
+
shouldFocusOnClose = DEFAULT_PROPS$1a.shouldFocusOnClose,
|
|
374
377
|
theme = defaultTheme,
|
|
375
378
|
value,
|
|
376
379
|
textFieldProps = {},
|
|
@@ -383,7 +386,7 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
383
386
|
return /*#__PURE__*/jsxs("div", {
|
|
384
387
|
ref: ref,
|
|
385
388
|
...forwardedProps,
|
|
386
|
-
className: classNames.join(className, CLASSNAME$
|
|
389
|
+
className: classNames.join(className, CLASSNAME$1m),
|
|
387
390
|
children: [/*#__PURE__*/jsx(TextField, {
|
|
388
391
|
...textFieldProps,
|
|
389
392
|
chips: chips,
|
|
@@ -424,8 +427,8 @@ const Autocomplete = forwardRef((props, ref) => {
|
|
|
424
427
|
});
|
|
425
428
|
});
|
|
426
429
|
Autocomplete.displayName = COMPONENT_NAME$1k;
|
|
427
|
-
Autocomplete.className = CLASSNAME$
|
|
428
|
-
Autocomplete.defaultProps = DEFAULT_PROPS$
|
|
430
|
+
Autocomplete.className = CLASSNAME$1m;
|
|
431
|
+
Autocomplete.defaultProps = DEFAULT_PROPS$1a;
|
|
429
432
|
|
|
430
433
|
/**
|
|
431
434
|
* Component display name.
|
|
@@ -435,12 +438,12 @@ const COMPONENT_NAME$1j = 'AutocompleteMultiple';
|
|
|
435
438
|
/**
|
|
436
439
|
* Component default class name and class prefix.
|
|
437
440
|
*/
|
|
438
|
-
const CLASSNAME$
|
|
441
|
+
const CLASSNAME$1l = 'lumx-autocomplete-multiple';
|
|
439
442
|
|
|
440
443
|
/**
|
|
441
444
|
* Component default props.
|
|
442
445
|
*/
|
|
443
|
-
const DEFAULT_PROPS$
|
|
446
|
+
const DEFAULT_PROPS$19 = {
|
|
444
447
|
closeOnClickAway: true,
|
|
445
448
|
closeOnEscape: true,
|
|
446
449
|
selectedChipRender(choice, index, onClear, isDisabled) {
|
|
@@ -480,8 +483,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
480
483
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
481
484
|
chipsAlignment,
|
|
482
485
|
className,
|
|
483
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
484
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
486
|
+
closeOnClickAway = DEFAULT_PROPS$19.closeOnClickAway,
|
|
487
|
+
closeOnEscape = DEFAULT_PROPS$19.closeOnEscape,
|
|
485
488
|
fitToAnchorWidth,
|
|
486
489
|
hasError,
|
|
487
490
|
helper,
|
|
@@ -503,19 +506,19 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
503
506
|
onKeyDown,
|
|
504
507
|
placeholder,
|
|
505
508
|
placement,
|
|
506
|
-
selectedChipRender = DEFAULT_PROPS$
|
|
509
|
+
selectedChipRender = DEFAULT_PROPS$19.selectedChipRender,
|
|
507
510
|
shouldFocusOnClose,
|
|
508
511
|
theme = defaultTheme,
|
|
509
512
|
type,
|
|
510
513
|
value,
|
|
511
|
-
values = DEFAULT_PROPS$
|
|
514
|
+
values = DEFAULT_PROPS$19.values,
|
|
512
515
|
...forwardedProps
|
|
513
516
|
} = otherProps;
|
|
514
517
|
return /*#__PURE__*/jsx(Autocomplete, {
|
|
515
518
|
ref: ref,
|
|
516
519
|
...forwardedProps,
|
|
517
520
|
anchorToInput: anchorToInput,
|
|
518
|
-
className: classNames.join(className, CLASSNAME$
|
|
521
|
+
className: classNames.join(className, CLASSNAME$1l),
|
|
519
522
|
name: name,
|
|
520
523
|
value: value,
|
|
521
524
|
onChange: onChange,
|
|
@@ -549,8 +552,8 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
|
|
|
549
552
|
});
|
|
550
553
|
});
|
|
551
554
|
AutocompleteMultiple.displayName = COMPONENT_NAME$1j;
|
|
552
|
-
AutocompleteMultiple.className = CLASSNAME$
|
|
553
|
-
AutocompleteMultiple.defaultProps = DEFAULT_PROPS$
|
|
555
|
+
AutocompleteMultiple.className = CLASSNAME$1l;
|
|
556
|
+
AutocompleteMultiple.defaultProps = DEFAULT_PROPS$19;
|
|
554
557
|
|
|
555
558
|
/**
|
|
556
559
|
* Component display name.
|
|
@@ -560,16 +563,16 @@ const COMPONENT_NAME$1i = 'Avatar';
|
|
|
560
563
|
/**
|
|
561
564
|
* Component default class name and class prefix.
|
|
562
565
|
*/
|
|
563
|
-
const CLASSNAME$
|
|
566
|
+
const CLASSNAME$1k = 'lumx-avatar';
|
|
564
567
|
const {
|
|
565
|
-
block: block$
|
|
566
|
-
element: element$
|
|
567
|
-
} = classNames.bem(CLASSNAME$
|
|
568
|
+
block: block$18,
|
|
569
|
+
element: element$S
|
|
570
|
+
} = classNames.bem(CLASSNAME$1k);
|
|
568
571
|
|
|
569
572
|
/**
|
|
570
573
|
* Component default props.
|
|
571
574
|
*/
|
|
572
|
-
const DEFAULT_PROPS$
|
|
575
|
+
const DEFAULT_PROPS$18 = {
|
|
573
576
|
size: Size$1.m
|
|
574
577
|
};
|
|
575
578
|
|
|
@@ -592,7 +595,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
592
595
|
linkAs,
|
|
593
596
|
onClick,
|
|
594
597
|
onKeyPress,
|
|
595
|
-
size = DEFAULT_PROPS$
|
|
598
|
+
size = DEFAULT_PROPS$18.size,
|
|
596
599
|
theme = defaultTheme,
|
|
597
600
|
thumbnailProps,
|
|
598
601
|
...forwardedProps
|
|
@@ -600,14 +603,14 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
600
603
|
return /*#__PURE__*/jsxs("div", {
|
|
601
604
|
ref: ref,
|
|
602
605
|
...forwardedProps,
|
|
603
|
-
className: classNames.join(className, block$
|
|
606
|
+
className: classNames.join(className, block$18({
|
|
604
607
|
[`size-${size}`]: Boolean(size),
|
|
605
608
|
[`theme-${theme}`]: Boolean(theme)
|
|
606
609
|
})),
|
|
607
610
|
children: [/*#__PURE__*/jsx(Thumbnail, {
|
|
608
611
|
linkProps: linkProps,
|
|
609
612
|
linkAs: linkAs,
|
|
610
|
-
className: element$
|
|
613
|
+
className: element$S('thumbnail'),
|
|
611
614
|
onClick: onClick,
|
|
612
615
|
onKeyPress: onKeyPress,
|
|
613
616
|
...thumbnailProps,
|
|
@@ -617,17 +620,17 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
617
620
|
alt: alt,
|
|
618
621
|
theme: theme
|
|
619
622
|
}), actions && /*#__PURE__*/jsx("div", {
|
|
620
|
-
className: element$
|
|
623
|
+
className: element$S('actions'),
|
|
621
624
|
children: actions
|
|
622
625
|
}), badge && /*#__PURE__*/jsx("div", {
|
|
623
|
-
className: element$
|
|
626
|
+
className: element$S('badge'),
|
|
624
627
|
children: badge
|
|
625
628
|
})]
|
|
626
629
|
});
|
|
627
630
|
});
|
|
628
631
|
Avatar.displayName = COMPONENT_NAME$1i;
|
|
629
|
-
Avatar.className = CLASSNAME$
|
|
630
|
-
Avatar.defaultProps = DEFAULT_PROPS$
|
|
632
|
+
Avatar.className = CLASSNAME$1k;
|
|
633
|
+
Avatar.defaultProps = DEFAULT_PROPS$18;
|
|
631
634
|
|
|
632
635
|
/**
|
|
633
636
|
* Alignments.
|
|
@@ -695,8 +698,6 @@ const ColorPalette = {
|
|
|
695
698
|
red: 'red',
|
|
696
699
|
light: 'light'};
|
|
697
700
|
|
|
698
|
-
/** ColorPalette with all possible color variant combination */
|
|
699
|
-
|
|
700
701
|
function getDefaultExportFromCjs (x) {
|
|
701
702
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
702
703
|
}
|
|
@@ -857,7 +858,7 @@ function modifier$1(baseName, modifiers) {
|
|
|
857
858
|
* block('button', { active: true, disabled: false }); // 'button button--active'
|
|
858
859
|
*/
|
|
859
860
|
|
|
860
|
-
function block$
|
|
861
|
+
function block$17(baseName, modifiersOrAdditionalClasses, additionalClasses) {
|
|
861
862
|
let modifiers;
|
|
862
863
|
let classes;
|
|
863
864
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
@@ -892,11 +893,11 @@ function block$12(baseName, modifiersOrAdditionalClasses, additionalClasses) {
|
|
|
892
893
|
* element('my-button', 'icon', { active: true }); // 'my-button__icon my-button__icon--active'
|
|
893
894
|
*/
|
|
894
895
|
|
|
895
|
-
function element$
|
|
896
|
+
function element$R(baseClass, elem, modifiersOrAdditionalClasses, additionalClasses) {
|
|
896
897
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
897
|
-
return block$
|
|
898
|
+
return block$17(`${baseClass}__${elem}`, modifiersOrAdditionalClasses);
|
|
898
899
|
}
|
|
899
|
-
return block$
|
|
900
|
+
return block$17(`${baseClass}__${elem}`, modifiersOrAdditionalClasses, additionalClasses);
|
|
900
901
|
}
|
|
901
902
|
|
|
902
903
|
/**
|
|
@@ -905,15 +906,15 @@ function element$M(baseClass, elem, modifiersOrAdditionalClasses, additionalClas
|
|
|
905
906
|
function bem(baseName) {
|
|
906
907
|
function blockFn(modifiersOrAdditionalClasses, additionalClasses) {
|
|
907
908
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
908
|
-
return block$
|
|
909
|
+
return block$17(baseName, modifiersOrAdditionalClasses);
|
|
909
910
|
}
|
|
910
|
-
return block$
|
|
911
|
+
return block$17(baseName, modifiersOrAdditionalClasses, additionalClasses);
|
|
911
912
|
}
|
|
912
913
|
function elementFn(elem, modifiersOrAdditionalClasses, additionalClasses) {
|
|
913
914
|
if (Array.isArray(modifiersOrAdditionalClasses)) {
|
|
914
|
-
return element$
|
|
915
|
+
return element$R(baseName, elem, modifiersOrAdditionalClasses);
|
|
915
916
|
}
|
|
916
|
-
return element$
|
|
917
|
+
return element$R(baseName, elem, modifiersOrAdditionalClasses, additionalClasses);
|
|
917
918
|
}
|
|
918
919
|
return {
|
|
919
920
|
block: blockFn,
|
|
@@ -930,15 +931,15 @@ const COMPONENT_NAME$1h = 'Badge';
|
|
|
930
931
|
/**
|
|
931
932
|
* Component default class name and class prefix.
|
|
932
933
|
*/
|
|
933
|
-
const CLASSNAME$
|
|
934
|
+
const CLASSNAME$1j = 'lumx-badge';
|
|
934
935
|
const {
|
|
935
|
-
block: block$
|
|
936
|
-
} = bem(CLASSNAME$
|
|
936
|
+
block: block$16
|
|
937
|
+
} = bem(CLASSNAME$1j);
|
|
937
938
|
|
|
938
939
|
/**
|
|
939
940
|
* Component default props.
|
|
940
941
|
*/
|
|
941
|
-
const DEFAULT_PROPS$
|
|
942
|
+
const DEFAULT_PROPS$17 = {
|
|
942
943
|
color: ColorPalette.primary
|
|
943
944
|
};
|
|
944
945
|
|
|
@@ -952,22 +953,22 @@ const Badge$1 = props => {
|
|
|
952
953
|
const {
|
|
953
954
|
children,
|
|
954
955
|
className,
|
|
955
|
-
color = DEFAULT_PROPS$
|
|
956
|
+
color = DEFAULT_PROPS$17.color,
|
|
956
957
|
ref,
|
|
957
958
|
...forwardedProps
|
|
958
959
|
} = props;
|
|
959
960
|
return /*#__PURE__*/jsx("div", {
|
|
960
961
|
ref: ref,
|
|
961
962
|
...forwardedProps,
|
|
962
|
-
className: classnames(className, block$
|
|
963
|
+
className: classnames(className, block$16({
|
|
963
964
|
[`color-${color}`]: Boolean(color)
|
|
964
965
|
})),
|
|
965
966
|
children: children
|
|
966
967
|
});
|
|
967
968
|
};
|
|
968
969
|
Badge$1.displayName = COMPONENT_NAME$1h;
|
|
969
|
-
Badge$1.className = CLASSNAME$
|
|
970
|
-
Badge$1.defaultProps = DEFAULT_PROPS$
|
|
970
|
+
Badge$1.className = CLASSNAME$1j;
|
|
971
|
+
Badge$1.defaultProps = DEFAULT_PROPS$17;
|
|
971
972
|
|
|
972
973
|
/**
|
|
973
974
|
* Defines the props of the component.
|
|
@@ -991,11 +992,11 @@ Badge.className = Badge$1.className;
|
|
|
991
992
|
Badge.defaultProps = Badge$1.defaultProps;
|
|
992
993
|
|
|
993
994
|
const COMPONENT_NAME$1g = 'BadgeWrapper';
|
|
994
|
-
const CLASSNAME$
|
|
995
|
+
const CLASSNAME$1i = 'lumx-badge-wrapper';
|
|
995
996
|
const {
|
|
996
|
-
block: block$
|
|
997
|
-
element: element$
|
|
998
|
-
} = bem(CLASSNAME$
|
|
997
|
+
block: block$15,
|
|
998
|
+
element: element$Q
|
|
999
|
+
} = bem(CLASSNAME$1i);
|
|
999
1000
|
const BadgeWrapper$1 = props => {
|
|
1000
1001
|
const {
|
|
1001
1002
|
badge,
|
|
@@ -1007,9 +1008,9 @@ const BadgeWrapper$1 = props => {
|
|
|
1007
1008
|
return /*#__PURE__*/jsxs("div", {
|
|
1008
1009
|
ref: ref,
|
|
1009
1010
|
...forwardedProps,
|
|
1010
|
-
className: classnames(className, block$
|
|
1011
|
+
className: classnames(className, block$15()),
|
|
1011
1012
|
children: [children, badge && /*#__PURE__*/jsx("div", {
|
|
1012
|
-
className: element$
|
|
1013
|
+
className: element$Q('badge'),
|
|
1013
1014
|
children: badge
|
|
1014
1015
|
})]
|
|
1015
1016
|
});
|
|
@@ -1022,7 +1023,7 @@ const BadgeWrapper = forwardRef((props, ref) => {
|
|
|
1022
1023
|
});
|
|
1023
1024
|
});
|
|
1024
1025
|
BadgeWrapper.displayName = COMPONENT_NAME$1g;
|
|
1025
|
-
BadgeWrapper.className = CLASSNAME$
|
|
1026
|
+
BadgeWrapper.className = CLASSNAME$1i;
|
|
1026
1027
|
|
|
1027
1028
|
/**
|
|
1028
1029
|
* Render clickable element (link, button or custom element)
|
|
@@ -1183,15 +1184,15 @@ const COMPONENT_NAME$1e = 'Button';
|
|
|
1183
1184
|
/**
|
|
1184
1185
|
* Component default class name and class prefix.
|
|
1185
1186
|
*/
|
|
1186
|
-
const CLASSNAME$
|
|
1187
|
+
const CLASSNAME$1h = 'lumx-button';
|
|
1187
1188
|
const {
|
|
1188
1189
|
modifier
|
|
1189
|
-
} = bem(CLASSNAME$
|
|
1190
|
+
} = bem(CLASSNAME$1h);
|
|
1190
1191
|
|
|
1191
1192
|
/**
|
|
1192
1193
|
* Component default props.
|
|
1193
1194
|
*/
|
|
1194
|
-
const DEFAULT_PROPS$
|
|
1195
|
+
const DEFAULT_PROPS$16 = {
|
|
1195
1196
|
emphasis: Emphasis.high,
|
|
1196
1197
|
size: Size.m
|
|
1197
1198
|
};
|
|
@@ -1205,10 +1206,10 @@ const DEFAULT_PROPS$15 = {
|
|
|
1205
1206
|
const Button$1 = props => {
|
|
1206
1207
|
const {
|
|
1207
1208
|
className,
|
|
1208
|
-
emphasis = DEFAULT_PROPS$
|
|
1209
|
+
emphasis = DEFAULT_PROPS$16.emphasis,
|
|
1209
1210
|
leftIcon,
|
|
1210
1211
|
rightIcon,
|
|
1211
|
-
size = DEFAULT_PROPS$
|
|
1212
|
+
size = DEFAULT_PROPS$16.size,
|
|
1212
1213
|
...forwardedProps
|
|
1213
1214
|
} = props;
|
|
1214
1215
|
const buttonClassName = classnames(className, modifier({
|
|
@@ -1224,8 +1225,8 @@ const Button$1 = props => {
|
|
|
1224
1225
|
});
|
|
1225
1226
|
};
|
|
1226
1227
|
Button$1.displayName = COMPONENT_NAME$1e;
|
|
1227
|
-
Button$1.className = CLASSNAME$
|
|
1228
|
-
Button$1.defaultProps = DEFAULT_PROPS$
|
|
1228
|
+
Button$1.className = CLASSNAME$1h;
|
|
1229
|
+
Button$1.defaultProps = DEFAULT_PROPS$16;
|
|
1229
1230
|
|
|
1230
1231
|
/**
|
|
1231
1232
|
* Properties of a component to use to determine it's name.
|
|
@@ -1292,8 +1293,8 @@ const Button = forwardRef((props, ref) => {
|
|
|
1292
1293
|
});
|
|
1293
1294
|
});
|
|
1294
1295
|
Button.displayName = COMPONENT_NAME$1e;
|
|
1295
|
-
Button.className = CLASSNAME$
|
|
1296
|
-
Button.defaultProps = DEFAULT_PROPS$
|
|
1296
|
+
Button.className = CLASSNAME$1h;
|
|
1297
|
+
Button.defaultProps = DEFAULT_PROPS$16;
|
|
1297
1298
|
|
|
1298
1299
|
const COMPONENT_NAME$1d = 'Icon';
|
|
1299
1300
|
const IconClassName = 'lumx-icon';
|
|
@@ -1302,15 +1303,15 @@ const IconClassName = 'lumx-icon';
|
|
|
1302
1303
|
* Defines the props of the component.
|
|
1303
1304
|
*/
|
|
1304
1305
|
|
|
1305
|
-
const CLASSNAME$
|
|
1306
|
+
const CLASSNAME$1g = IconClassName;
|
|
1306
1307
|
const {
|
|
1307
|
-
block: block
|
|
1308
|
-
} = bem(CLASSNAME$
|
|
1308
|
+
block: block$14
|
|
1309
|
+
} = bem(CLASSNAME$1g);
|
|
1309
1310
|
|
|
1310
1311
|
/**
|
|
1311
1312
|
* Component default props.
|
|
1312
1313
|
*/
|
|
1313
|
-
const DEFAULT_PROPS$
|
|
1314
|
+
const DEFAULT_PROPS$15 = {};
|
|
1314
1315
|
|
|
1315
1316
|
/**
|
|
1316
1317
|
* Icon component.
|
|
@@ -1359,7 +1360,7 @@ const Icon$1 = props => {
|
|
|
1359
1360
|
return /*#__PURE__*/jsx("i", {
|
|
1360
1361
|
ref: ref,
|
|
1361
1362
|
...forwardedProps,
|
|
1362
|
-
className: classnames(className, block
|
|
1363
|
+
className: classnames(className, block$14({
|
|
1363
1364
|
[`color-${iconColor}`]: Boolean(iconColor),
|
|
1364
1365
|
[`color-variant-${iconColorVariant}`]: Boolean(iconColorVariant),
|
|
1365
1366
|
'has-shape': hasShape,
|
|
@@ -1389,8 +1390,8 @@ const Icon$1 = props => {
|
|
|
1389
1390
|
});
|
|
1390
1391
|
};
|
|
1391
1392
|
Icon$1.displayName = COMPONENT_NAME$1d;
|
|
1392
|
-
Icon$1.className = CLASSNAME$
|
|
1393
|
-
Icon$1.defaultProps = DEFAULT_PROPS$
|
|
1393
|
+
Icon$1.className = CLASSNAME$1g;
|
|
1394
|
+
Icon$1.defaultProps = DEFAULT_PROPS$15;
|
|
1394
1395
|
|
|
1395
1396
|
/**
|
|
1396
1397
|
* Component display name.
|
|
@@ -1400,12 +1401,12 @@ const COMPONENT_NAME$1c = 'IconButton';
|
|
|
1400
1401
|
/**
|
|
1401
1402
|
* Component default class name and class prefix.
|
|
1402
1403
|
*/
|
|
1403
|
-
const CLASSNAME$
|
|
1404
|
+
const CLASSNAME$1f = 'lumx-icon-button';
|
|
1404
1405
|
|
|
1405
1406
|
/**
|
|
1406
1407
|
* Component default props.
|
|
1407
1408
|
*/
|
|
1408
|
-
const DEFAULT_PROPS$
|
|
1409
|
+
const DEFAULT_PROPS$14 = {
|
|
1409
1410
|
emphasis: Emphasis.high,
|
|
1410
1411
|
size: Size.m
|
|
1411
1412
|
};
|
|
@@ -1418,11 +1419,11 @@ const DEFAULT_PROPS$13 = {
|
|
|
1418
1419
|
*/
|
|
1419
1420
|
const IconButton$1 = props => {
|
|
1420
1421
|
const {
|
|
1421
|
-
emphasis = DEFAULT_PROPS$
|
|
1422
|
+
emphasis = DEFAULT_PROPS$14.emphasis,
|
|
1422
1423
|
image,
|
|
1423
1424
|
icon,
|
|
1424
1425
|
label,
|
|
1425
|
-
size = DEFAULT_PROPS$
|
|
1426
|
+
size = DEFAULT_PROPS$14.size,
|
|
1426
1427
|
...forwardedProps
|
|
1427
1428
|
} = props;
|
|
1428
1429
|
const defaultChildren = image ? /*#__PURE__*/jsx("img", {
|
|
@@ -1442,8 +1443,8 @@ const IconButton$1 = props => {
|
|
|
1442
1443
|
});
|
|
1443
1444
|
};
|
|
1444
1445
|
IconButton$1.displayName = COMPONENT_NAME$1c;
|
|
1445
|
-
IconButton$1.className = CLASSNAME$
|
|
1446
|
-
IconButton$1.defaultProps = DEFAULT_PROPS$
|
|
1446
|
+
IconButton$1.className = CLASSNAME$1f;
|
|
1447
|
+
IconButton$1.defaultProps = DEFAULT_PROPS$14;
|
|
1447
1448
|
|
|
1448
1449
|
/**
|
|
1449
1450
|
* IconButton component.
|
|
@@ -1479,8 +1480,8 @@ const IconButton = forwardRef((props, ref) => {
|
|
|
1479
1480
|
});
|
|
1480
1481
|
});
|
|
1481
1482
|
IconButton.displayName = COMPONENT_NAME$1c;
|
|
1482
|
-
IconButton.className = CLASSNAME$
|
|
1483
|
-
IconButton.defaultProps = DEFAULT_PROPS$
|
|
1483
|
+
IconButton.className = CLASSNAME$1f;
|
|
1484
|
+
IconButton.defaultProps = DEFAULT_PROPS$14;
|
|
1484
1485
|
|
|
1485
1486
|
/**
|
|
1486
1487
|
* Component display name.
|
|
@@ -1490,12 +1491,12 @@ const COMPONENT_NAME$1b = 'ButtonGroup';
|
|
|
1490
1491
|
/**
|
|
1491
1492
|
* Component default class name and class prefix.
|
|
1492
1493
|
*/
|
|
1493
|
-
const CLASSNAME$
|
|
1494
|
+
const CLASSNAME$1e = 'lumx-button-group';
|
|
1494
1495
|
|
|
1495
1496
|
/**
|
|
1496
1497
|
* Component default props.
|
|
1497
1498
|
*/
|
|
1498
|
-
const DEFAULT_PROPS$
|
|
1499
|
+
const DEFAULT_PROPS$13 = {};
|
|
1499
1500
|
|
|
1500
1501
|
/**
|
|
1501
1502
|
* ButtonGroup component.
|
|
@@ -1511,13 +1512,13 @@ const ButtonGroup$1 = props => {
|
|
|
1511
1512
|
} = props;
|
|
1512
1513
|
return /*#__PURE__*/jsx("div", {
|
|
1513
1514
|
...forwardedProps,
|
|
1514
|
-
className: classnames(className, CLASSNAME$
|
|
1515
|
+
className: classnames(className, CLASSNAME$1e),
|
|
1515
1516
|
children: children
|
|
1516
1517
|
});
|
|
1517
1518
|
};
|
|
1518
1519
|
ButtonGroup$1.displayName = COMPONENT_NAME$1b;
|
|
1519
|
-
ButtonGroup$1.className = CLASSNAME$
|
|
1520
|
-
ButtonGroup$1.defaultProps = DEFAULT_PROPS$
|
|
1520
|
+
ButtonGroup$1.className = CLASSNAME$1e;
|
|
1521
|
+
ButtonGroup$1.defaultProps = DEFAULT_PROPS$13;
|
|
1521
1522
|
|
|
1522
1523
|
/**
|
|
1523
1524
|
* ButtonGroup component.
|
|
@@ -1533,16 +1534,16 @@ const ButtonGroup = forwardRef((props, ref) => {
|
|
|
1533
1534
|
});
|
|
1534
1535
|
});
|
|
1535
1536
|
ButtonGroup.displayName = COMPONENT_NAME$1b;
|
|
1536
|
-
ButtonGroup.className = CLASSNAME$
|
|
1537
|
-
ButtonGroup.defaultProps = DEFAULT_PROPS$
|
|
1537
|
+
ButtonGroup.className = CLASSNAME$1e;
|
|
1538
|
+
ButtonGroup.defaultProps = DEFAULT_PROPS$13;
|
|
1538
1539
|
|
|
1539
1540
|
const COMPONENT_NAME$1a = 'InputLabel';
|
|
1540
1541
|
const InputLabelClassName = 'lumx-input-label';
|
|
1541
|
-
const CLASSNAME$
|
|
1542
|
+
const CLASSNAME$1d = InputLabelClassName;
|
|
1542
1543
|
const {
|
|
1543
|
-
block: block$
|
|
1544
|
-
} = bem(CLASSNAME$
|
|
1545
|
-
const DEFAULT_PROPS$
|
|
1544
|
+
block: block$13
|
|
1545
|
+
} = bem(CLASSNAME$1d);
|
|
1546
|
+
const DEFAULT_PROPS$12 = {};
|
|
1546
1547
|
|
|
1547
1548
|
/**
|
|
1548
1549
|
* InputLabel component.
|
|
@@ -1562,7 +1563,7 @@ function InputLabel$1(props) {
|
|
|
1562
1563
|
ref: ref,
|
|
1563
1564
|
...forwardedProps,
|
|
1564
1565
|
htmlFor: htmlFor,
|
|
1565
|
-
className: classnames(className, block$
|
|
1566
|
+
className: classnames(className, block$13({
|
|
1566
1567
|
'is-required': isRequired,
|
|
1567
1568
|
[`theme-${theme}`]: Boolean(theme),
|
|
1568
1569
|
'has-custom-typography': Boolean(typography$1)
|
|
@@ -1571,8 +1572,8 @@ function InputLabel$1(props) {
|
|
|
1571
1572
|
});
|
|
1572
1573
|
}
|
|
1573
1574
|
InputLabel$1.displayName = COMPONENT_NAME$1a;
|
|
1574
|
-
InputLabel$1.className = CLASSNAME$
|
|
1575
|
-
InputLabel$1.defaultProps = DEFAULT_PROPS$
|
|
1575
|
+
InputLabel$1.className = CLASSNAME$1d;
|
|
1576
|
+
InputLabel$1.defaultProps = DEFAULT_PROPS$12;
|
|
1576
1577
|
|
|
1577
1578
|
const INPUT_HELPER_CONFIGURATION = {
|
|
1578
1579
|
[Kind.error]: {
|
|
@@ -1593,15 +1594,15 @@ const InputHelperClassName = 'lumx-input-helper';
|
|
|
1593
1594
|
* Defines the props of the component.
|
|
1594
1595
|
*/
|
|
1595
1596
|
|
|
1596
|
-
const CLASSNAME$
|
|
1597
|
+
const CLASSNAME$1c = InputHelperClassName;
|
|
1597
1598
|
const {
|
|
1598
|
-
block: block$
|
|
1599
|
-
} = bem(CLASSNAME$
|
|
1599
|
+
block: block$12
|
|
1600
|
+
} = bem(CLASSNAME$1c);
|
|
1600
1601
|
|
|
1601
1602
|
/**
|
|
1602
1603
|
* Component default props.
|
|
1603
1604
|
*/
|
|
1604
|
-
const DEFAULT_PROPS$
|
|
1605
|
+
const DEFAULT_PROPS$11 = {
|
|
1605
1606
|
kind: Kind.info
|
|
1606
1607
|
};
|
|
1607
1608
|
|
|
@@ -1612,7 +1613,7 @@ function InputHelper$1(props) {
|
|
|
1612
1613
|
const {
|
|
1613
1614
|
children,
|
|
1614
1615
|
className,
|
|
1615
|
-
kind = DEFAULT_PROPS$
|
|
1616
|
+
kind = DEFAULT_PROPS$11.kind,
|
|
1616
1617
|
theme,
|
|
1617
1618
|
ref,
|
|
1618
1619
|
...forwardedProps
|
|
@@ -1623,7 +1624,7 @@ function InputHelper$1(props) {
|
|
|
1623
1624
|
return /*#__PURE__*/jsx("p", {
|
|
1624
1625
|
ref: ref,
|
|
1625
1626
|
...forwardedProps,
|
|
1626
|
-
className: classnames(className, block$
|
|
1627
|
+
className: classnames(className, block$12({
|
|
1627
1628
|
[`color-${color}`]: Boolean(color),
|
|
1628
1629
|
[`theme-${theme}`]: Boolean(theme)
|
|
1629
1630
|
})),
|
|
@@ -1631,8 +1632,8 @@ function InputHelper$1(props) {
|
|
|
1631
1632
|
});
|
|
1632
1633
|
}
|
|
1633
1634
|
InputHelper$1.displayName = COMPONENT_NAME$19;
|
|
1634
|
-
InputHelper$1.className = CLASSNAME$
|
|
1635
|
-
InputHelper$1.defaultProps = DEFAULT_PROPS$
|
|
1635
|
+
InputHelper$1.className = CLASSNAME$1c;
|
|
1636
|
+
InputHelper$1.defaultProps = DEFAULT_PROPS$11;
|
|
1636
1637
|
|
|
1637
1638
|
const INTERMEDIATE_STATE = 'intermediate';
|
|
1638
1639
|
|
|
@@ -1648,11 +1649,11 @@ const COMPONENT_NAME$18 = 'Checkbox';
|
|
|
1648
1649
|
/**
|
|
1649
1650
|
* Component default class name and class prefix.
|
|
1650
1651
|
*/
|
|
1651
|
-
const CLASSNAME$
|
|
1652
|
+
const CLASSNAME$1b = 'lumx-checkbox';
|
|
1652
1653
|
const {
|
|
1653
|
-
block: block$
|
|
1654
|
-
element: element$
|
|
1655
|
-
} = bem(CLASSNAME$
|
|
1654
|
+
block: block$11,
|
|
1655
|
+
element: element$P
|
|
1656
|
+
} = bem(CLASSNAME$1b);
|
|
1656
1657
|
|
|
1657
1658
|
/**
|
|
1658
1659
|
* Checkbox component.
|
|
@@ -1688,7 +1689,7 @@ const Checkbox$1 = props => {
|
|
|
1688
1689
|
return /*#__PURE__*/jsxs("div", {
|
|
1689
1690
|
ref: ref,
|
|
1690
1691
|
...forwardedProps,
|
|
1691
|
-
className: classnames(className, block$
|
|
1692
|
+
className: classnames(className, block$11({
|
|
1692
1693
|
// Whether state is intermediate class name will "-checked"
|
|
1693
1694
|
'is-checked': intermediateState ? true : isChecked,
|
|
1694
1695
|
'is-disabled': isDisabled,
|
|
@@ -1696,12 +1697,12 @@ const Checkbox$1 = props => {
|
|
|
1696
1697
|
[`theme-${theme}`]: Boolean(theme)
|
|
1697
1698
|
})),
|
|
1698
1699
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1699
|
-
className: element$
|
|
1700
|
+
className: element$P('input-wrapper'),
|
|
1700
1701
|
children: [/*#__PURE__*/jsx("input", {
|
|
1701
1702
|
ref: inputRef,
|
|
1702
1703
|
type: "checkbox",
|
|
1703
1704
|
id: inputId,
|
|
1704
|
-
className: element$
|
|
1705
|
+
className: element$P('input-native'),
|
|
1705
1706
|
name: name,
|
|
1706
1707
|
value: value,
|
|
1707
1708
|
checked: isChecked,
|
|
@@ -1713,26 +1714,26 @@ const Checkbox$1 = props => {
|
|
|
1713
1714
|
} : {}),
|
|
1714
1715
|
...inputProps
|
|
1715
1716
|
}), /*#__PURE__*/jsxs("div", {
|
|
1716
|
-
className: element$
|
|
1717
|
+
className: element$P('input-placeholder'),
|
|
1717
1718
|
children: [/*#__PURE__*/jsx("div", {
|
|
1718
|
-
className: element$
|
|
1719
|
+
className: element$P('input-background')
|
|
1719
1720
|
}), /*#__PURE__*/jsx("div", {
|
|
1720
|
-
className: element$
|
|
1721
|
+
className: element$P('input-indicator'),
|
|
1721
1722
|
children: Icon$1({
|
|
1722
1723
|
icon: intermediateState ? mdiMinus : mdiCheck
|
|
1723
1724
|
})
|
|
1724
1725
|
})]
|
|
1725
1726
|
})]
|
|
1726
1727
|
}), /*#__PURE__*/jsxs("div", {
|
|
1727
|
-
className: element$
|
|
1728
|
+
className: element$P('content'),
|
|
1728
1729
|
children: [label && InputLabel$1({
|
|
1729
1730
|
htmlFor: inputId,
|
|
1730
|
-
className: element$
|
|
1731
|
+
className: element$P('label'),
|
|
1731
1732
|
theme,
|
|
1732
1733
|
children: label
|
|
1733
1734
|
}), helper && InputHelper$1({
|
|
1734
1735
|
id: `${inputId}-helper`,
|
|
1735
|
-
className: element$
|
|
1736
|
+
className: element$P('helper'),
|
|
1736
1737
|
theme,
|
|
1737
1738
|
children: helper
|
|
1738
1739
|
})]
|
|
@@ -1747,7 +1748,7 @@ const Checkbox$1 = props => {
|
|
|
1747
1748
|
/**
|
|
1748
1749
|
* Component default props.
|
|
1749
1750
|
*/
|
|
1750
|
-
const DEFAULT_PROPS
|
|
1751
|
+
const DEFAULT_PROPS$10 = {};
|
|
1751
1752
|
|
|
1752
1753
|
/**
|
|
1753
1754
|
* Checkbox component.
|
|
@@ -1808,8 +1809,8 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
1808
1809
|
});
|
|
1809
1810
|
});
|
|
1810
1811
|
Checkbox.displayName = COMPONENT_NAME$18;
|
|
1811
|
-
Checkbox.className = CLASSNAME$
|
|
1812
|
-
Checkbox.defaultProps = DEFAULT_PROPS
|
|
1812
|
+
Checkbox.className = CLASSNAME$1b;
|
|
1813
|
+
Checkbox.defaultProps = DEFAULT_PROPS$10;
|
|
1813
1814
|
|
|
1814
1815
|
/**
|
|
1815
1816
|
* Wrap mouse event handler to stop event propagation.
|
|
@@ -1835,16 +1836,16 @@ const COMPONENT_NAME$17 = 'Chip';
|
|
|
1835
1836
|
/**
|
|
1836
1837
|
* Component default class name and class prefix.
|
|
1837
1838
|
*/
|
|
1838
|
-
const CLASSNAME$
|
|
1839
|
+
const CLASSNAME$1a = 'lumx-chip';
|
|
1839
1840
|
const {
|
|
1840
|
-
block: block$
|
|
1841
|
-
element: element$
|
|
1842
|
-
} = classNames.bem(CLASSNAME$
|
|
1841
|
+
block: block$10,
|
|
1842
|
+
element: element$O
|
|
1843
|
+
} = classNames.bem(CLASSNAME$1a);
|
|
1843
1844
|
|
|
1844
1845
|
/**
|
|
1845
1846
|
* Component default props.
|
|
1846
1847
|
*/
|
|
1847
|
-
const DEFAULT_PROPS
|
|
1848
|
+
const DEFAULT_PROPS$$ = {
|
|
1848
1849
|
size: Size$1.m
|
|
1849
1850
|
};
|
|
1850
1851
|
|
|
@@ -1874,7 +1875,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1874
1875
|
onAfterClick,
|
|
1875
1876
|
onBeforeClick,
|
|
1876
1877
|
onClick,
|
|
1877
|
-
size = DEFAULT_PROPS
|
|
1878
|
+
size = DEFAULT_PROPS$$.size,
|
|
1878
1879
|
theme = defaultTheme,
|
|
1879
1880
|
href,
|
|
1880
1881
|
onKeyDown,
|
|
@@ -1905,7 +1906,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1905
1906
|
...forwardedProps,
|
|
1906
1907
|
href: !disabledStateProps.disabled ? href : undefined,
|
|
1907
1908
|
ref: ref,
|
|
1908
|
-
className: classNames.join(className, block$
|
|
1909
|
+
className: classNames.join(className, block$10({
|
|
1909
1910
|
'is-clickable': isClickable,
|
|
1910
1911
|
[`color-${chipColor}`]: Boolean(chipColor),
|
|
1911
1912
|
'is-disabled': isAnyDisabled,
|
|
@@ -1923,19 +1924,19 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1923
1924
|
/*#__PURE__*/
|
|
1924
1925
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1925
1926
|
jsx("div", {
|
|
1926
|
-
className: element$
|
|
1927
|
+
className: element$O('before', {
|
|
1927
1928
|
'is-clickable': hasBeforeClick
|
|
1928
1929
|
}),
|
|
1929
1930
|
onClick: handleOnBeforeClick,
|
|
1930
1931
|
children: before
|
|
1931
1932
|
}), /*#__PURE__*/jsx("div", {
|
|
1932
|
-
className: element$
|
|
1933
|
+
className: element$O('label'),
|
|
1933
1934
|
children: children
|
|
1934
1935
|
}), after &&
|
|
1935
1936
|
/*#__PURE__*/
|
|
1936
1937
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1937
1938
|
jsx("div", {
|
|
1938
|
-
className: element$
|
|
1939
|
+
className: element$O('after', {
|
|
1939
1940
|
'is-clickable': hasAfterClick
|
|
1940
1941
|
}),
|
|
1941
1942
|
onClick: handleOnAfterClick,
|
|
@@ -1945,8 +1946,8 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1945
1946
|
);
|
|
1946
1947
|
});
|
|
1947
1948
|
Chip.displayName = COMPONENT_NAME$17;
|
|
1948
|
-
Chip.className = CLASSNAME$
|
|
1949
|
-
Chip.defaultProps = DEFAULT_PROPS
|
|
1949
|
+
Chip.className = CLASSNAME$1a;
|
|
1950
|
+
Chip.defaultProps = DEFAULT_PROPS$$;
|
|
1950
1951
|
|
|
1951
1952
|
const INITIAL_STATE_ACTIVE_CHIP = -1;
|
|
1952
1953
|
|
|
@@ -2002,7 +2003,7 @@ const useChipGroupNavigation = (chips, onChipDeleted, initialActiveChip = INITIA
|
|
|
2002
2003
|
/**
|
|
2003
2004
|
* Component default props.
|
|
2004
2005
|
*/
|
|
2005
|
-
const DEFAULT_PROPS$
|
|
2006
|
+
const DEFAULT_PROPS$_ = {};
|
|
2006
2007
|
|
|
2007
2008
|
/**
|
|
2008
2009
|
* Component display name.
|
|
@@ -2012,7 +2013,7 @@ const COMPONENT_NAME$16 = 'ChipGroup';
|
|
|
2012
2013
|
/**
|
|
2013
2014
|
* Component default class name and class prefix.
|
|
2014
2015
|
*/
|
|
2015
|
-
const CLASSNAME$
|
|
2016
|
+
const CLASSNAME$19 = 'lumx-chip-group';
|
|
2016
2017
|
|
|
2017
2018
|
/**
|
|
2018
2019
|
* ChipGroup component.
|
|
@@ -2031,13 +2032,13 @@ const InternalChipGroup = forwardRef((props, ref) => {
|
|
|
2031
2032
|
return /*#__PURE__*/jsx("div", {
|
|
2032
2033
|
ref: ref,
|
|
2033
2034
|
...forwardedProps,
|
|
2034
|
-
className: classNames.join(className, CLASSNAME$
|
|
2035
|
+
className: classNames.join(className, CLASSNAME$19),
|
|
2035
2036
|
children: children
|
|
2036
2037
|
});
|
|
2037
2038
|
});
|
|
2038
2039
|
InternalChipGroup.displayName = COMPONENT_NAME$16;
|
|
2039
|
-
InternalChipGroup.className = CLASSNAME$
|
|
2040
|
-
InternalChipGroup.defaultProps = DEFAULT_PROPS$
|
|
2040
|
+
InternalChipGroup.className = CLASSNAME$19;
|
|
2041
|
+
InternalChipGroup.defaultProps = DEFAULT_PROPS$_;
|
|
2041
2042
|
const ChipGroup = Object.assign(InternalChipGroup, {
|
|
2042
2043
|
useChipGroupNavigation
|
|
2043
2044
|
});
|
|
@@ -2111,115 +2112,1465 @@ function useFocusLastChipOnBackspace(chipRefs, inputRef) {
|
|
|
2111
2112
|
lastChip?.focus();
|
|
2112
2113
|
};
|
|
2113
2114
|
|
|
2114
|
-
// Attach keyboard event listener
|
|
2115
|
-
input.addEventListener('keydown', onKeyDown);
|
|
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
|
+
};
|
|
3251
|
+
|
|
3252
|
+
const useBooleanState = defaultValue => {
|
|
3253
|
+
const [booleanValue, setBoolean] = useState(defaultValue);
|
|
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
|
+
};
|
|
2116
3259
|
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
return {
|
|
2123
|
-
findPreviousEnabledChip
|
|
2124
|
-
};
|
|
2125
|
-
}
|
|
3260
|
+
const CLASSNAME$15 = 'lumx-combobox-option-more-info';
|
|
3261
|
+
const {
|
|
3262
|
+
block: block$X,
|
|
3263
|
+
element: element$J
|
|
3264
|
+
} = classNames.bem(CLASSNAME$15);
|
|
2126
3265
|
|
|
2127
3266
|
/**
|
|
2128
|
-
*
|
|
3267
|
+
* Display more info on the option as a popover opening on mouse hover or keyboard nav
|
|
3268
|
+
* Please consider using a simpler option description instead for better UX and a11y.
|
|
3269
|
+
*
|
|
3270
|
+
* @family Combobox
|
|
2129
3271
|
*/
|
|
2130
|
-
const
|
|
3272
|
+
const ComboboxOptionMoreInfo = ({
|
|
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';
|
|
2131
3319
|
const {
|
|
2132
3320
|
block: block$W,
|
|
2133
3321
|
element: element$I
|
|
2134
3322
|
} = classNames.bem(CLASSNAME$14);
|
|
2135
3323
|
|
|
2136
3324
|
/**
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2139
|
-
* @param props Component props.
|
|
2140
|
-
* @param ref Component ref.
|
|
2141
|
-
* @return React element.
|
|
3325
|
+
* Content of the ComboboxSection.
|
|
2142
3326
|
*/
|
|
2143
|
-
const
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
inputLabel,
|
|
2150
|
-
renderChip,
|
|
2151
|
-
theme,
|
|
2152
|
-
isDisabled,
|
|
2153
|
-
chipTooltipLabel,
|
|
2154
|
-
label,
|
|
2155
|
-
...forwardedProps
|
|
3327
|
+
const ComboboxSectionContent = ({
|
|
3328
|
+
className,
|
|
3329
|
+
title,
|
|
3330
|
+
children,
|
|
3331
|
+
isLoading,
|
|
3332
|
+
renderItemSkeleton
|
|
2156
3333
|
}) => {
|
|
2157
|
-
const chipRefs = React__default.useRef([]);
|
|
2158
3334
|
const {
|
|
2159
|
-
|
|
2160
|
-
} =
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
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.
|
|
3372
|
+
*
|
|
3373
|
+
* @family Combobox
|
|
3374
|
+
* @param ComboboxSectionProps
|
|
3375
|
+
* @returns ComboboxSection
|
|
3376
|
+
*/
|
|
3377
|
+
const ComboboxSection = ({
|
|
3378
|
+
children,
|
|
3379
|
+
...props
|
|
3380
|
+
}) => {
|
|
3381
|
+
const sectionId = useId();
|
|
3382
|
+
const value = React__default.useMemo(() => ({
|
|
3383
|
+
sectionId,
|
|
3384
|
+
isLoading: props.isLoading
|
|
3385
|
+
}), [sectionId, props.isLoading]);
|
|
3386
|
+
return /*#__PURE__*/jsx(SectionContext.Provider, {
|
|
3387
|
+
value: value,
|
|
3388
|
+
children: /*#__PURE__*/jsx(ComboboxSectionContent, {
|
|
3389
|
+
...props,
|
|
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
|
|
3436
|
+
}) => {
|
|
3437
|
+
const textFieldRef = useRef(null);
|
|
3438
|
+
const triggerRef = useRef(null);
|
|
3439
|
+
|
|
3440
|
+
// Generate a unique id for the combobox that will be used for every child components.
|
|
3441
|
+
const generatedId = useId();
|
|
3442
|
+
const comboboxId = htmlId || generatedId;
|
|
3443
|
+
const listboxId = `${comboboxId}-popover`;
|
|
3444
|
+
|
|
3445
|
+
/** Generate the selected option id from the given selected id. */
|
|
3446
|
+
const currentSelectedIds = selectedIds?.map(selectedId => generateOptionId(comboboxId, selectedId.toString()));
|
|
3447
|
+
|
|
3448
|
+
/** Generate the state */
|
|
3449
|
+
const [state, dispatch] = useReducer(reducer$1, initialState, defaultState => ({
|
|
3450
|
+
...defaultState,
|
|
3451
|
+
comboboxId,
|
|
3452
|
+
listboxId,
|
|
3453
|
+
// a default input value can be set if needed
|
|
3454
|
+
inputValue: defaultInputValue || defaultState.inputValue
|
|
3455
|
+
}));
|
|
3456
|
+
|
|
3457
|
+
/**
|
|
3458
|
+
* Return the current input value.
|
|
3459
|
+
*/
|
|
3460
|
+
const currentInputValue = useMemo(() => {
|
|
3461
|
+
// If the component is controlled and a value is already set by the parent, use this value
|
|
3462
|
+
if (inputValue !== null && inputValue !== undefined) {
|
|
3463
|
+
return inputValue;
|
|
3464
|
+
}
|
|
3465
|
+
|
|
3466
|
+
// Then use the local value
|
|
3467
|
+
if (state.inputValue) {
|
|
3468
|
+
return state.inputValue;
|
|
3469
|
+
}
|
|
3470
|
+
|
|
3471
|
+
// In all other cases, return an empty string.
|
|
3472
|
+
return '';
|
|
3473
|
+
}, [inputValue, state.inputValue]);
|
|
3474
|
+
|
|
3475
|
+
/** Return a memoized state */
|
|
3476
|
+
const synchedState = useMemo(() => {
|
|
3477
|
+
return {
|
|
3478
|
+
...state,
|
|
3479
|
+
showAll: !autoFilter || state.showAll,
|
|
3480
|
+
inputValue: currentInputValue,
|
|
3481
|
+
status: status || state.status,
|
|
3482
|
+
listboxId
|
|
3483
|
+
};
|
|
3484
|
+
}, [currentInputValue, listboxId, autoFilter, state, status]);
|
|
3485
|
+
|
|
3486
|
+
/** Props to set in the context */
|
|
3487
|
+
const comboboxProviderValue = useMemo(() => ({
|
|
3488
|
+
...synchedState,
|
|
3489
|
+
openOnFocus,
|
|
3490
|
+
openOnClick,
|
|
3491
|
+
onInputChange,
|
|
3492
|
+
onOpen,
|
|
3493
|
+
onSelect,
|
|
3494
|
+
dispatch,
|
|
3495
|
+
selectionType,
|
|
3496
|
+
selectedIds: currentSelectedIds,
|
|
3497
|
+
showEmptyState,
|
|
3498
|
+
showErrorState,
|
|
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
|
|
2219
3507
|
})
|
|
2220
3508
|
});
|
|
2221
3509
|
};
|
|
2222
3510
|
|
|
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
|
+
|
|
2223
3574
|
/**
|
|
2224
3575
|
* Comment block variants.
|
|
2225
3576
|
*/
|
|
@@ -2249,7 +3600,7 @@ const {
|
|
|
2249
3600
|
/**
|
|
2250
3601
|
* Component default props.
|
|
2251
3602
|
*/
|
|
2252
|
-
const DEFAULT_PROPS$
|
|
3603
|
+
const DEFAULT_PROPS$Z = {
|
|
2253
3604
|
variant: CommentBlockVariant.indented
|
|
2254
3605
|
};
|
|
2255
3606
|
|
|
@@ -2279,7 +3630,7 @@ const CommentBlock = forwardRef((props, ref) => {
|
|
|
2279
3630
|
onMouseLeave,
|
|
2280
3631
|
text,
|
|
2281
3632
|
theme = defaultTheme,
|
|
2282
|
-
variant = DEFAULT_PROPS$
|
|
3633
|
+
variant = DEFAULT_PROPS$Z.variant,
|
|
2283
3634
|
...forwardedProps
|
|
2284
3635
|
} = props;
|
|
2285
3636
|
const hasChildren = Children.count(children) > 0;
|
|
@@ -2348,7 +3699,7 @@ const CommentBlock = forwardRef((props, ref) => {
|
|
|
2348
3699
|
});
|
|
2349
3700
|
CommentBlock.displayName = COMPONENT_NAME$15;
|
|
2350
3701
|
CommentBlock.className = CLASSNAME$13;
|
|
2351
|
-
CommentBlock.defaultProps = DEFAULT_PROPS$
|
|
3702
|
+
CommentBlock.defaultProps = DEFAULT_PROPS$Z;
|
|
2352
3703
|
|
|
2353
3704
|
/**
|
|
2354
3705
|
* Add a number of months from a date while resetting the day to prevent month length mismatches.
|
|
@@ -2838,14 +4189,6 @@ const DatePicker = forwardRef((props, ref) => {
|
|
|
2838
4189
|
DatePicker.displayName = COMPONENT_NAME$14;
|
|
2839
4190
|
DatePicker.className = CLASSNAME$12;
|
|
2840
4191
|
|
|
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
|
-
|
|
2849
4192
|
/**
|
|
2850
4193
|
* Component display name.
|
|
2851
4194
|
*/
|
|
@@ -3453,7 +4796,7 @@ const {
|
|
|
3453
4796
|
/**
|
|
3454
4797
|
* Component default props.
|
|
3455
4798
|
*/
|
|
3456
|
-
const DEFAULT_PROPS$
|
|
4799
|
+
const DEFAULT_PROPS$Y = {
|
|
3457
4800
|
size: Size$1.big,
|
|
3458
4801
|
disableBodyScroll: true
|
|
3459
4802
|
};
|
|
@@ -3484,11 +4827,11 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
3484
4827
|
parentElement,
|
|
3485
4828
|
contentRef,
|
|
3486
4829
|
preventAutoClose,
|
|
3487
|
-
size = DEFAULT_PROPS$
|
|
4830
|
+
size = DEFAULT_PROPS$Y.size,
|
|
3488
4831
|
zIndex,
|
|
3489
4832
|
dialogProps,
|
|
3490
4833
|
onVisibilityChange,
|
|
3491
|
-
disableBodyScroll = DEFAULT_PROPS$
|
|
4834
|
+
disableBodyScroll = DEFAULT_PROPS$Y.disableBodyScroll,
|
|
3492
4835
|
preventCloseOnClick,
|
|
3493
4836
|
preventCloseOnEscape,
|
|
3494
4837
|
...forwardedProps
|
|
@@ -3628,7 +4971,7 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
3628
4971
|
});
|
|
3629
4972
|
Dialog.displayName = COMPONENT_NAME$11;
|
|
3630
4973
|
Dialog.className = CLASSNAME$11;
|
|
3631
|
-
Dialog.defaultProps = DEFAULT_PROPS$
|
|
4974
|
+
Dialog.defaultProps = DEFAULT_PROPS$Y;
|
|
3632
4975
|
|
|
3633
4976
|
/**
|
|
3634
4977
|
* Component display name.
|
|
@@ -3672,7 +5015,7 @@ const Divider$1 = props => {
|
|
|
3672
5015
|
/**
|
|
3673
5016
|
* Component default props.
|
|
3674
5017
|
*/
|
|
3675
|
-
const DEFAULT_PROPS$
|
|
5018
|
+
const DEFAULT_PROPS$X = {};
|
|
3676
5019
|
|
|
3677
5020
|
/**
|
|
3678
5021
|
* Divider component.
|
|
@@ -3695,7 +5038,7 @@ const Divider = forwardRef((props, ref) => {
|
|
|
3695
5038
|
});
|
|
3696
5039
|
Divider.displayName = COMPONENT_NAME$10;
|
|
3697
5040
|
Divider.className = CLASSNAME$10;
|
|
3698
|
-
Divider.defaultProps = DEFAULT_PROPS$
|
|
5041
|
+
Divider.defaultProps = DEFAULT_PROPS$X;
|
|
3699
5042
|
|
|
3700
5043
|
/**
|
|
3701
5044
|
* Component display name.
|
|
@@ -3920,7 +5263,7 @@ const {
|
|
|
3920
5263
|
/**
|
|
3921
5264
|
* Component default props.
|
|
3922
5265
|
*/
|
|
3923
|
-
const DEFAULT_PROPS$
|
|
5266
|
+
const DEFAULT_PROPS$W = {
|
|
3924
5267
|
tabIndex: -1
|
|
3925
5268
|
};
|
|
3926
5269
|
|
|
@@ -3939,7 +5282,7 @@ const InternalList = forwardRef((props, ref) => {
|
|
|
3939
5282
|
isClickable,
|
|
3940
5283
|
itemPadding,
|
|
3941
5284
|
onListItemSelected,
|
|
3942
|
-
tabIndex = DEFAULT_PROPS$
|
|
5285
|
+
tabIndex = DEFAULT_PROPS$W.tabIndex,
|
|
3943
5286
|
...forwardedProps
|
|
3944
5287
|
} = props;
|
|
3945
5288
|
const adjustedItemPadding = itemPadding ?? (isClickable ? Size$1.big : undefined);
|
|
@@ -3955,7 +5298,7 @@ const InternalList = forwardRef((props, ref) => {
|
|
|
3955
5298
|
});
|
|
3956
5299
|
InternalList.displayName = COMPONENT_NAME$_;
|
|
3957
5300
|
InternalList.className = CLASSNAME$_;
|
|
3958
|
-
InternalList.defaultProps = DEFAULT_PROPS$
|
|
5301
|
+
InternalList.defaultProps = DEFAULT_PROPS$W;
|
|
3959
5302
|
const List = Object.assign(InternalList, {
|
|
3960
5303
|
useKeyboardListNavigation
|
|
3961
5304
|
});
|
|
@@ -6400,7 +7743,7 @@ const {
|
|
|
6400
7743
|
/**
|
|
6401
7744
|
* Component default props.
|
|
6402
7745
|
*/
|
|
6403
|
-
const DEFAULT_PROPS$
|
|
7746
|
+
const DEFAULT_PROPS$V = {
|
|
6404
7747
|
elevation: 3,
|
|
6405
7748
|
placement: Placement.AUTO,
|
|
6406
7749
|
focusAnchorOnClose: true,
|
|
@@ -6417,24 +7760,24 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
6417
7760
|
className,
|
|
6418
7761
|
closeOnClickAway,
|
|
6419
7762
|
closeOnEscape,
|
|
6420
|
-
elevation = DEFAULT_PROPS$
|
|
7763
|
+
elevation = DEFAULT_PROPS$V.elevation,
|
|
6421
7764
|
focusElement,
|
|
6422
7765
|
hasArrow,
|
|
6423
7766
|
isOpen,
|
|
6424
7767
|
onClose,
|
|
6425
7768
|
parentElement,
|
|
6426
|
-
usePortal = DEFAULT_PROPS$
|
|
6427
|
-
focusAnchorOnClose = DEFAULT_PROPS$
|
|
7769
|
+
usePortal = DEFAULT_PROPS$V.usePortal,
|
|
7770
|
+
focusAnchorOnClose = DEFAULT_PROPS$V.focusAnchorOnClose,
|
|
6428
7771
|
withFocusTrap,
|
|
6429
7772
|
boundaryRef,
|
|
6430
7773
|
fitToAnchorWidth,
|
|
6431
7774
|
fitWithinViewportHeight,
|
|
6432
7775
|
focusTrapZoneElement,
|
|
6433
7776
|
offset,
|
|
6434
|
-
placement = DEFAULT_PROPS$
|
|
7777
|
+
placement = DEFAULT_PROPS$V.placement,
|
|
6435
7778
|
style,
|
|
6436
7779
|
theme,
|
|
6437
|
-
zIndex = DEFAULT_PROPS$
|
|
7780
|
+
zIndex = DEFAULT_PROPS$V.zIndex,
|
|
6438
7781
|
...forwardedProps
|
|
6439
7782
|
} = props;
|
|
6440
7783
|
const popoverRef = useRef(null);
|
|
@@ -6520,7 +7863,7 @@ const Popover = skipRender(
|
|
|
6520
7863
|
() => Boolean(DOCUMENT), _InnerPopover);
|
|
6521
7864
|
Popover.displayName = COMPONENT_NAME$Z;
|
|
6522
7865
|
Popover.className = CLASSNAME$Z;
|
|
6523
|
-
Popover.defaultProps = DEFAULT_PROPS$
|
|
7866
|
+
Popover.defaultProps = DEFAULT_PROPS$V;
|
|
6524
7867
|
|
|
6525
7868
|
// The error margin in px we want to have for triggering infinite scroll
|
|
6526
7869
|
const SCROLL_TRIGGER_MARGIN = 5;
|
|
@@ -6580,7 +7923,7 @@ const {
|
|
|
6580
7923
|
/**
|
|
6581
7924
|
* Component default props.
|
|
6582
7925
|
*/
|
|
6583
|
-
const DEFAULT_PROPS$
|
|
7926
|
+
const DEFAULT_PROPS$U = {
|
|
6584
7927
|
closeOnClick: true,
|
|
6585
7928
|
closeOnClickAway: true,
|
|
6586
7929
|
closeOnEscape: true,
|
|
@@ -6603,18 +7946,18 @@ const Dropdown = forwardRef((props, ref) => {
|
|
|
6603
7946
|
anchorRef,
|
|
6604
7947
|
children,
|
|
6605
7948
|
className,
|
|
6606
|
-
closeOnClick = DEFAULT_PROPS$
|
|
6607
|
-
closeOnClickAway = DEFAULT_PROPS$
|
|
6608
|
-
closeOnEscape = DEFAULT_PROPS$
|
|
6609
|
-
fitToAnchorWidth = DEFAULT_PROPS$
|
|
6610
|
-
fitWithinViewportHeight = DEFAULT_PROPS$
|
|
7949
|
+
closeOnClick = DEFAULT_PROPS$U.closeOnClick,
|
|
7950
|
+
closeOnClickAway = DEFAULT_PROPS$U.closeOnClickAway,
|
|
7951
|
+
closeOnEscape = DEFAULT_PROPS$U.closeOnEscape,
|
|
7952
|
+
fitToAnchorWidth = DEFAULT_PROPS$U.fitToAnchorWidth,
|
|
7953
|
+
fitWithinViewportHeight = DEFAULT_PROPS$U.fitWithinViewportHeight,
|
|
6611
7954
|
isOpen,
|
|
6612
7955
|
offset,
|
|
6613
|
-
focusAnchorOnClose = DEFAULT_PROPS$
|
|
7956
|
+
focusAnchorOnClose = DEFAULT_PROPS$U.focusAnchorOnClose,
|
|
6614
7957
|
onClose,
|
|
6615
7958
|
onInfiniteScroll,
|
|
6616
|
-
placement = DEFAULT_PROPS$
|
|
6617
|
-
shouldFocusOnOpen = DEFAULT_PROPS$
|
|
7959
|
+
placement = DEFAULT_PROPS$U.placement,
|
|
7960
|
+
shouldFocusOnOpen = DEFAULT_PROPS$U.shouldFocusOnOpen,
|
|
6618
7961
|
zIndex,
|
|
6619
7962
|
...forwardedProps
|
|
6620
7963
|
} = props;
|
|
@@ -6660,7 +8003,7 @@ const Dropdown = forwardRef((props, ref) => {
|
|
|
6660
8003
|
});
|
|
6661
8004
|
Dropdown.displayName = COMPONENT_NAME$Y;
|
|
6662
8005
|
Dropdown.className = CLASSNAME$Y;
|
|
6663
|
-
Dropdown.defaultProps = DEFAULT_PROPS$
|
|
8006
|
+
Dropdown.defaultProps = DEFAULT_PROPS$U;
|
|
6664
8007
|
|
|
6665
8008
|
/**
|
|
6666
8009
|
* Component display name.
|
|
@@ -6679,7 +8022,7 @@ const {
|
|
|
6679
8022
|
/**
|
|
6680
8023
|
* Component default props.
|
|
6681
8024
|
*/
|
|
6682
|
-
const DEFAULT_PROPS$
|
|
8025
|
+
const DEFAULT_PROPS$T = {
|
|
6683
8026
|
closeMode: 'unmount'
|
|
6684
8027
|
};
|
|
6685
8028
|
const isDragHandle = isComponent(DragHandle);
|
|
@@ -6697,7 +8040,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6697
8040
|
const defaultTheme = useTheme() || Theme$1.light;
|
|
6698
8041
|
const {
|
|
6699
8042
|
className,
|
|
6700
|
-
closeMode = DEFAULT_PROPS$
|
|
8043
|
+
closeMode = DEFAULT_PROPS$T.closeMode,
|
|
6701
8044
|
children: anyChildren,
|
|
6702
8045
|
hasBackground,
|
|
6703
8046
|
hasHeaderDivider,
|
|
@@ -6814,11 +8157,11 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6814
8157
|
});
|
|
6815
8158
|
ExpansionPanel.displayName = COMPONENT_NAME$X;
|
|
6816
8159
|
ExpansionPanel.className = CLASSNAME$X;
|
|
6817
|
-
ExpansionPanel.defaultProps = DEFAULT_PROPS$
|
|
8160
|
+
ExpansionPanel.defaultProps = DEFAULT_PROPS$T;
|
|
6818
8161
|
|
|
6819
8162
|
const COMPONENT_NAME$W = 'Flag';
|
|
6820
8163
|
const CLASSNAME$W = 'lumx-flag';
|
|
6821
|
-
const DEFAULT_PROPS$
|
|
8164
|
+
const DEFAULT_PROPS$S = {};
|
|
6822
8165
|
const {
|
|
6823
8166
|
block: block$N,
|
|
6824
8167
|
element: element$B
|
|
@@ -6882,7 +8225,7 @@ const Flag = forwardRef((props, ref) => {
|
|
|
6882
8225
|
});
|
|
6883
8226
|
Flag.displayName = COMPONENT_NAME$W;
|
|
6884
8227
|
Flag.className = CLASSNAME$W;
|
|
6885
|
-
Flag.defaultProps = DEFAULT_PROPS$
|
|
8228
|
+
Flag.defaultProps = DEFAULT_PROPS$S;
|
|
6886
8229
|
|
|
6887
8230
|
/**
|
|
6888
8231
|
* Defines the props of the component.
|
|
@@ -6975,7 +8318,7 @@ const {
|
|
|
6975
8318
|
/**
|
|
6976
8319
|
* Component default props.
|
|
6977
8320
|
*/
|
|
6978
|
-
const DEFAULT_PROPS$
|
|
8321
|
+
const DEFAULT_PROPS$R = {
|
|
6979
8322
|
gap: Size$1.big,
|
|
6980
8323
|
orientation: Orientation$1.horizontal
|
|
6981
8324
|
};
|
|
@@ -7005,8 +8348,8 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
7005
8348
|
children,
|
|
7006
8349
|
actions,
|
|
7007
8350
|
actionsProps,
|
|
7008
|
-
gap = DEFAULT_PROPS$
|
|
7009
|
-
orientation = DEFAULT_PROPS$
|
|
8351
|
+
gap = DEFAULT_PROPS$R.gap,
|
|
8352
|
+
orientation = DEFAULT_PROPS$R.orientation,
|
|
7010
8353
|
contentProps,
|
|
7011
8354
|
...forwardedProps
|
|
7012
8355
|
} = props;
|
|
@@ -7060,7 +8403,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
7060
8403
|
});
|
|
7061
8404
|
BaseGenericBlock.displayName = COMPONENT_NAME$U;
|
|
7062
8405
|
BaseGenericBlock.className = CLASSNAME$U;
|
|
7063
|
-
BaseGenericBlock.defaultProps = DEFAULT_PROPS$
|
|
8406
|
+
BaseGenericBlock.defaultProps = DEFAULT_PROPS$R;
|
|
7064
8407
|
const GenericBlock = Object.assign(BaseGenericBlock, {
|
|
7065
8408
|
Figure,
|
|
7066
8409
|
Content,
|
|
@@ -7108,7 +8451,7 @@ const CLASSNAME$T = 'lumx-heading';
|
|
|
7108
8451
|
/**
|
|
7109
8452
|
* Component default props.
|
|
7110
8453
|
*/
|
|
7111
|
-
const DEFAULT_PROPS$
|
|
8454
|
+
const DEFAULT_PROPS$Q = {};
|
|
7112
8455
|
|
|
7113
8456
|
/**
|
|
7114
8457
|
* Get Heading component common props
|
|
@@ -7209,7 +8552,7 @@ const {
|
|
|
7209
8552
|
/**
|
|
7210
8553
|
* Component default props.
|
|
7211
8554
|
*/
|
|
7212
|
-
const DEFAULT_PROPS$
|
|
8555
|
+
const DEFAULT_PROPS$P = {};
|
|
7213
8556
|
|
|
7214
8557
|
/**
|
|
7215
8558
|
* Text component common props
|
|
@@ -7296,7 +8639,7 @@ const Text = forwardRef((props, ref) => {
|
|
|
7296
8639
|
});
|
|
7297
8640
|
Text.displayName = COMPONENT_NAME$S;
|
|
7298
8641
|
Text.className = CLASSNAME$S;
|
|
7299
|
-
Text.defaultProps = DEFAULT_PROPS$
|
|
8642
|
+
Text.defaultProps = DEFAULT_PROPS$P;
|
|
7300
8643
|
|
|
7301
8644
|
const HeadingLevelContext = /*#__PURE__*/createContext(defaultContext);
|
|
7302
8645
|
|
|
@@ -7333,7 +8676,7 @@ const Heading = forwardRef((props, ref) => {
|
|
|
7333
8676
|
});
|
|
7334
8677
|
Heading.displayName = COMPONENT_NAME$T;
|
|
7335
8678
|
Heading.className = CLASSNAME$T;
|
|
7336
|
-
Heading.defaultProps = DEFAULT_PROPS$
|
|
8679
|
+
Heading.defaultProps = DEFAULT_PROPS$Q;
|
|
7337
8680
|
|
|
7338
8681
|
/**
|
|
7339
8682
|
* Computes the next heading level based on the optional prop level or the parent context level.
|
|
@@ -7384,7 +8727,7 @@ const {
|
|
|
7384
8727
|
/**
|
|
7385
8728
|
* Component default props.
|
|
7386
8729
|
*/
|
|
7387
|
-
const DEFAULT_PROPS$
|
|
8730
|
+
const DEFAULT_PROPS$O = {
|
|
7388
8731
|
orientation: Orientation$1.horizontal,
|
|
7389
8732
|
wrap: 'nowrap'
|
|
7390
8733
|
};
|
|
@@ -7402,9 +8745,9 @@ const Grid = forwardRef((props, ref) => {
|
|
|
7402
8745
|
className,
|
|
7403
8746
|
gutter,
|
|
7404
8747
|
hAlign,
|
|
7405
|
-
orientation = DEFAULT_PROPS$
|
|
8748
|
+
orientation = DEFAULT_PROPS$O.orientation,
|
|
7406
8749
|
vAlign,
|
|
7407
|
-
wrap = DEFAULT_PROPS$
|
|
8750
|
+
wrap = DEFAULT_PROPS$O.wrap,
|
|
7408
8751
|
...forwardedProps
|
|
7409
8752
|
} = props;
|
|
7410
8753
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -7422,7 +8765,7 @@ const Grid = forwardRef((props, ref) => {
|
|
|
7422
8765
|
});
|
|
7423
8766
|
Grid.displayName = COMPONENT_NAME$R;
|
|
7424
8767
|
Grid.className = CLASSNAME$R;
|
|
7425
|
-
Grid.defaultProps = DEFAULT_PROPS$
|
|
8768
|
+
Grid.defaultProps = DEFAULT_PROPS$O;
|
|
7426
8769
|
|
|
7427
8770
|
/**
|
|
7428
8771
|
* Component display name.
|
|
@@ -7480,7 +8823,7 @@ const CLASSNAME$P = 'lumx-grid-column';
|
|
|
7480
8823
|
/**
|
|
7481
8824
|
* Component default props.
|
|
7482
8825
|
*/
|
|
7483
|
-
const DEFAULT_PROPS$
|
|
8826
|
+
const DEFAULT_PROPS$N = {};
|
|
7484
8827
|
|
|
7485
8828
|
/**
|
|
7486
8829
|
* The GridColumn is a layout component that can display children in a grid
|
|
@@ -7488,10 +8831,9 @@ const DEFAULT_PROPS$M = {};
|
|
|
7488
8831
|
* with a number of column that reduce when there is not enough space for each item.
|
|
7489
8832
|
*
|
|
7490
8833
|
* @param props Component props.
|
|
7491
|
-
* @
|
|
7492
|
-
* @return React element.
|
|
8834
|
+
* @return JSX element.
|
|
7493
8835
|
*/
|
|
7494
|
-
const GridColumn =
|
|
8836
|
+
const GridColumn$1 = props => {
|
|
7495
8837
|
const {
|
|
7496
8838
|
as: Component = 'div',
|
|
7497
8839
|
gap,
|
|
@@ -7500,12 +8842,13 @@ const GridColumn = forwardRef((props, ref) => {
|
|
|
7500
8842
|
children,
|
|
7501
8843
|
className,
|
|
7502
8844
|
style = {},
|
|
8845
|
+
ref,
|
|
7503
8846
|
...forwardedProps
|
|
7504
8847
|
} = props;
|
|
7505
8848
|
return /*#__PURE__*/jsx(Component, {
|
|
7506
8849
|
...forwardedProps,
|
|
7507
8850
|
ref: ref,
|
|
7508
|
-
className:
|
|
8851
|
+
className: classnames(className, CLASSNAME$P),
|
|
7509
8852
|
style: {
|
|
7510
8853
|
...style,
|
|
7511
8854
|
['--lumx-grid-column-item-min-width']: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
@@ -7514,6 +8857,36 @@ const GridColumn = forwardRef((props, ref) => {
|
|
|
7514
8857
|
},
|
|
7515
8858
|
children: children
|
|
7516
8859
|
});
|
|
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
|
+
});
|
|
7517
8890
|
});
|
|
7518
8891
|
GridColumn.displayName = COMPONENT_NAME$P;
|
|
7519
8892
|
GridColumn.className = CLASSNAME$P;
|
|
@@ -15304,5 +16677,5 @@ UserBlock.displayName = COMPONENT_NAME;
|
|
|
15304
16677
|
UserBlock.className = CLASSNAME;
|
|
15305
16678
|
UserBlock.defaultProps = DEFAULT_PROPS;
|
|
15306
16679
|
|
|
15307
|
-
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonGroup, CLASSNAME$
|
|
16680
|
+
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonGroup, CLASSNAME$1h as CLASSNAME, COMBOBOX_OPTION_CLASSNAME, COMPONENT_NAME$1e as COMPONENT_NAME, Checkbox, Chip, ChipGroup, Combobox, ComboboxButton, ComboboxDivider, ComboboxInput, ComboboxListBox, ComboboxOption, ComboboxOptionAction, ComboboxOptionMoreInfo, ComboboxOptionSkeleton, ComboboxSection, CommentBlock, CommentBlockVariant, DEFAULT_PROPS$16 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, LUMX_CLASSNAME, 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, SUB_COMPONENTS, 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 };
|
|
15308
16681
|
//# sourceMappingURL=index.js.map
|