@mezzanine-ui/react 1.0.0-beta.2 → 1.0.0-beta.3
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/Anchor/Anchor.d.ts +51 -18
- package/Anchor/Anchor.js +15 -15
- package/Anchor/AnchorGroup.d.ts +34 -0
- package/Anchor/AnchorGroup.js +37 -0
- package/Anchor/AnchorItem.d.ts +30 -0
- package/Anchor/AnchorItem.js +65 -0
- package/Anchor/index.d.ts +2 -0
- package/Anchor/index.js +1 -0
- package/Anchor/utils.d.ts +13 -0
- package/Anchor/utils.js +95 -0
- package/AutoComplete/AutoComplete.d.ts +194 -0
- package/AutoComplete/AutoComplete.js +419 -0
- package/AutoComplete/index.d.ts +2 -0
- package/AutoComplete/index.js +1 -0
- package/AutoComplete/useAutoCompleteCreation.d.ts +33 -0
- package/AutoComplete/useAutoCompleteCreation.js +201 -0
- package/AutoComplete/useAutoCompleteKeyboard.d.ts +31 -0
- package/AutoComplete/useAutoCompleteKeyboard.js +149 -0
- package/AutoComplete/useAutoCompleteSearch.d.ts +16 -0
- package/AutoComplete/useAutoCompleteSearch.js +69 -0
- package/AutoComplete/useCreationTracker.d.ts +17 -0
- package/AutoComplete/useCreationTracker.js +47 -0
- package/Button/Button.js +13 -11
- package/Button/index.d.ts +1 -1
- package/Button/typings.d.ts +27 -4
- package/Description/Description.d.ts +12 -22
- package/Description/Description.js +4 -24
- package/Dropdown/Dropdown.d.ts +29 -1
- package/Dropdown/Dropdown.js +95 -14
- package/Dropdown/DropdownAction.d.ts +1 -1
- package/Dropdown/DropdownAction.js +1 -4
- package/Dropdown/DropdownItem.d.ts +18 -1
- package/Dropdown/DropdownItem.js +23 -10
- package/Dropdown/DropdownItemCard.js +11 -10
- package/Dropdown/DropdownStatus.js +29 -0
- package/Dropdown/dropdownKeydownHandler.d.ts +2 -1
- package/Dropdown/dropdownKeydownHandler.js +73 -0
- package/Dropdown/highlightText.js +5 -1
- package/Dropdown/shortcutTextHandler.d.ts +24 -0
- package/Dropdown/shortcutTextHandler.js +171 -0
- package/Form/FormField.js +3 -1
- package/Input/Input.d.ts +29 -3
- package/Input/Input.js +22 -6
- package/Modal/Modal.d.ts +103 -11
- package/Modal/Modal.js +14 -9
- package/Modal/ModalBodyForVerification.d.ts +59 -0
- package/Modal/ModalBodyForVerification.js +99 -0
- package/Modal/ModalControl.d.ts +2 -2
- package/Modal/ModalControl.js +1 -1
- package/Modal/ModalFooter.d.ts +119 -1
- package/Modal/ModalFooter.js +15 -3
- package/Modal/ModalHeader.d.ts +26 -7
- package/Modal/ModalHeader.js +33 -7
- package/Modal/index.d.ts +4 -5
- package/Modal/index.js +1 -2
- package/Modal/useModalContainer.d.ts +12 -3
- package/Modal/useModalContainer.js +28 -6
- package/Navigation/CollapsedMenu.d.ts +6 -0
- package/Navigation/CollapsedMenu.js +16 -0
- package/Navigation/Navigation.d.ts +7 -2
- package/Navigation/Navigation.js +33 -33
- package/Navigation/NavigationHeader.d.ts +4 -0
- package/Navigation/NavigationHeader.js +3 -2
- package/Navigation/NavigationOption.d.ts +2 -1
- package/Navigation/NavigationOption.js +28 -3
- package/Navigation/NavigationOptionCategory.js +1 -0
- package/Navigation/useVisibleItems.d.ts +5 -0
- package/Navigation/useVisibleItems.js +54 -0
- package/NotificationCenter/NotificationCenter.d.ts +124 -0
- package/NotificationCenter/NotificationCenter.js +259 -0
- package/NotificationCenter/NotificationCenterDrawer.d.ts +89 -0
- package/NotificationCenter/index.d.ts +3 -0
- package/NotificationCenter/index.js +1 -0
- package/PageFooter/PageFooter.d.ts +19 -9
- package/PageFooter/PageFooter.js +10 -10
- package/PageHeader/PageHeader.js +4 -12
- package/PageToolbar/PageToolbar.d.ts +2 -6
- package/PageToolbar/utils.js +4 -12
- package/Select/index.d.ts +0 -2
- package/Select/index.js +0 -1
- package/Slider/useSlider.js +1 -1
- package/Table/components/TableActionsCell.js +2 -2
- package/Table/components/TableBulkActions.js +1 -19
- package/Table/components/TableRow.js +2 -2
- package/Table/hooks/useTableFixedOffsets.js +6 -6
- package/Table/utils/useTableRowSelection.js +13 -5
- package/Tag/TagGroup.d.ts +3 -0
- package/Tag/index.d.ts +2 -0
- package/Tag/index.js +1 -0
- package/Upload/UploadPictureCard.js +1 -1
- package/index.d.ts +34 -20
- package/index.js +19 -8
- package/package.json +4 -4
- package/Modal/ModalActions.d.ts +0 -9
- package/Modal/ModalActions.js +0 -20
- package/Modal/ModalBody.d.ts +0 -7
- package/Modal/ModalBody.js +0 -14
- package/Notification/Notification.d.ts +0 -54
- package/Notification/Notification.js +0 -76
- package/Notification/index.d.ts +0 -3
- package/Notification/index.js +0 -1
- package/Select/AutoComplete.d.ts +0 -107
- package/Select/AutoComplete.js +0 -114
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { notificationIcons, notificationClasses } from '@mezzanine-ui/core/notification';
|
|
3
|
-
import { TimesIcon } from '@mezzanine-ui/icons';
|
|
4
|
-
import { useState, useEffect } from 'react';
|
|
5
|
-
import Button from '../Button/Button.js';
|
|
6
|
-
import ButtonGroup from '../Button/ButtonGroup.js';
|
|
7
|
-
import SlideFade from '../Transition/SlideFade.js';
|
|
8
|
-
import Icon from '../Icon/Icon.js';
|
|
9
|
-
import cx from 'clsx';
|
|
10
|
-
import { createNotifier } from '../Notifier/createNotifier.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The react component for `mezzanine` notification.
|
|
14
|
-
*
|
|
15
|
-
* Use the API from the Notification instance such as `Notification.success` and `Notification.error`
|
|
16
|
-
* to display a notification globally.
|
|
17
|
-
*/
|
|
18
|
-
const NotificationElement = ((props) => {
|
|
19
|
-
const { cancelText, children, confirmText, direction = 'left', duration, onCancel: onCancelProp, onClose: onCloseProp, onConfirm: onConfirmProp, onExited: onExitedProp, reference, severity, title, ...restTransitionProps } = props;
|
|
20
|
-
const targetIcon = severity ? notificationIcons[severity] : undefined;
|
|
21
|
-
const [open, setOpen] = useState(true);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (open && duration) {
|
|
24
|
-
const timer = window.setTimeout(() => {
|
|
25
|
-
setOpen(false);
|
|
26
|
-
}, duration);
|
|
27
|
-
return () => {
|
|
28
|
-
window.clearTimeout(timer);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}, [open, duration]);
|
|
32
|
-
const onClose = () => {
|
|
33
|
-
setOpen(false);
|
|
34
|
-
if (onCloseProp) {
|
|
35
|
-
onCloseProp(reference);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const onConfirm = onConfirmProp
|
|
39
|
-
? () => {
|
|
40
|
-
setOpen(false);
|
|
41
|
-
onConfirmProp();
|
|
42
|
-
}
|
|
43
|
-
: undefined;
|
|
44
|
-
const onCancel = onCancelProp
|
|
45
|
-
? () => {
|
|
46
|
-
setOpen(false);
|
|
47
|
-
onCancelProp();
|
|
48
|
-
}
|
|
49
|
-
: undefined;
|
|
50
|
-
const onExited = (node) => {
|
|
51
|
-
if (onExitedProp) {
|
|
52
|
-
onExitedProp(node);
|
|
53
|
-
}
|
|
54
|
-
NotificationElement.remove(reference);
|
|
55
|
-
};
|
|
56
|
-
return (jsx(SlideFade, { in: open, appear: true, onExited: onExited, direction: direction, ...restTransitionProps, children: jsxs("div", { className: cx(notificationClasses.host, severity ? notificationClasses.severity(severity) : undefined), children: [targetIcon ? (jsx("div", { className: notificationClasses.iconContainer, children: jsx(Icon, { icon: targetIcon, className: notificationClasses.severityIcon }) })) : null, jsxs("div", { className: notificationClasses.body, children: [jsx("h4", { className: notificationClasses.title, children: title }), jsx("div", { className: notificationClasses.content, children: children }), onConfirm && !severity ? (jsxs(ButtonGroup, { className: notificationClasses.action, children: [jsx(Button, { variant: "contained", onClick: onConfirm, children: confirmText }), jsx(Button, { variant: "outlined", onClick: onCancel || onClose, children: cancelText })] })) : null] }), jsx(Icon, { icon: TimesIcon, className: notificationClasses.closeIcon, onClick: onClose })] }) }));
|
|
57
|
-
});
|
|
58
|
-
const { add, config, destroy, remove } = createNotifier({
|
|
59
|
-
duration: false,
|
|
60
|
-
render: (notif) => jsx(NotificationElement, { ...notif }),
|
|
61
|
-
setRoot: (root) => {
|
|
62
|
-
root === null || root === void 0 ? void 0 : root.setAttribute('class', notificationClasses.root);
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
NotificationElement.add = add;
|
|
66
|
-
NotificationElement.config = config;
|
|
67
|
-
NotificationElement.destroy = destroy;
|
|
68
|
-
NotificationElement.remove = remove;
|
|
69
|
-
['success', 'warning', 'error', 'info'].forEach((severity) => {
|
|
70
|
-
NotificationElement[severity] = (props) => NotificationElement.add({
|
|
71
|
-
...props,
|
|
72
|
-
severity,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
export { NotificationElement as default };
|
package/Notification/index.d.ts
DELETED
package/Notification/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Notification.js';
|
package/Select/AutoComplete.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction, RefObject } from 'react';
|
|
2
|
-
import { SelectInputSize } from '@mezzanine-ui/core/select';
|
|
3
|
-
import { SelectValue } from './typings';
|
|
4
|
-
import { MenuProps } from '../Menu';
|
|
5
|
-
import { PopperProps } from '../Popper';
|
|
6
|
-
import { PickRenameMulti } from '../utils/general';
|
|
7
|
-
import { SelectTriggerProps, SelectTriggerInputProps } from './SelectTrigger';
|
|
8
|
-
export interface AutoCompleteBaseProps extends Omit<SelectTriggerProps, 'active' | 'clearable' | 'forceHideSuffixActionIcon' | 'mode' | 'onClick' | 'onKeyDown' | 'onChange' | 'renderValue' | 'inputProps' | 'suffixActionIcon' | 'value'>, PickRenameMulti<Pick<MenuProps, 'itemsInView' | 'maxHeight' | 'role' | 'size'>, {
|
|
9
|
-
maxHeight: 'menuMaxHeight';
|
|
10
|
-
role: 'menuRole';
|
|
11
|
-
size: 'menuSize';
|
|
12
|
-
}>, PickRenameMulti<Pick<PopperProps, 'options'>, {
|
|
13
|
-
options: 'popperOptions';
|
|
14
|
-
}> {
|
|
15
|
-
/**
|
|
16
|
-
* Set to true when options can be added dynamically
|
|
17
|
-
* @default false
|
|
18
|
-
*/
|
|
19
|
-
addable?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Should the filter rules be disabled (If you need to control options filter by yourself)
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disabledOptionsFilter?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* The other native props for input element.
|
|
27
|
-
*/
|
|
28
|
-
inputProps?: Omit<SelectTriggerInputProps, 'onChange' | 'placeholder' | 'role' | 'value' | `aria-${'controls' | 'expanded' | 'owns'}`>;
|
|
29
|
-
/**
|
|
30
|
-
* insert callback whenever insert icon is clicked
|
|
31
|
-
* return `true` when insert is successfully
|
|
32
|
-
*/
|
|
33
|
-
onInsert?(text: string): SelectValue;
|
|
34
|
-
/**
|
|
35
|
-
* The search event handler
|
|
36
|
-
*/
|
|
37
|
-
onSearch?(input: string): any;
|
|
38
|
-
/**
|
|
39
|
-
* The options that mapped autocomplete options
|
|
40
|
-
*/
|
|
41
|
-
options: SelectValue[];
|
|
42
|
-
/**
|
|
43
|
-
* select input placeholder
|
|
44
|
-
*/
|
|
45
|
-
placeholder?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Whether the selection is required.
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
required?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
searchTextControlRef?: RefObject<{
|
|
55
|
-
setSearchText: Dispatch<SetStateAction<string>>;
|
|
56
|
-
} | undefined>;
|
|
57
|
-
/**
|
|
58
|
-
* The size of input.
|
|
59
|
-
*/
|
|
60
|
-
size?: SelectInputSize;
|
|
61
|
-
}
|
|
62
|
-
export type AutoCompleteMultipleProps = AutoCompleteBaseProps & {
|
|
63
|
-
/**
|
|
64
|
-
* The default selection
|
|
65
|
-
*/
|
|
66
|
-
defaultValue?: SelectValue[];
|
|
67
|
-
/**
|
|
68
|
-
* Controls the layout of trigger.
|
|
69
|
-
*/
|
|
70
|
-
mode: 'multiple';
|
|
71
|
-
/**
|
|
72
|
-
* The change event handler of input element.
|
|
73
|
-
*/
|
|
74
|
-
onChange?(newOptions: SelectValue[]): any;
|
|
75
|
-
/**
|
|
76
|
-
* The value of selection.
|
|
77
|
-
* @default undefined
|
|
78
|
-
*/
|
|
79
|
-
value?: SelectValue[];
|
|
80
|
-
};
|
|
81
|
-
export type AutoCompleteSingleProps = AutoCompleteBaseProps & {
|
|
82
|
-
/**
|
|
83
|
-
* The default selection
|
|
84
|
-
*/
|
|
85
|
-
defaultValue?: SelectValue;
|
|
86
|
-
/**
|
|
87
|
-
* Controls the layout of trigger.
|
|
88
|
-
*/
|
|
89
|
-
mode?: 'single';
|
|
90
|
-
/**
|
|
91
|
-
* The change event handler of input element.
|
|
92
|
-
*/
|
|
93
|
-
onChange?(newOptions: SelectValue): any;
|
|
94
|
-
/**
|
|
95
|
-
* The value of selection.
|
|
96
|
-
* @default undefined
|
|
97
|
-
*/
|
|
98
|
-
value?: SelectValue | null;
|
|
99
|
-
};
|
|
100
|
-
export type AutoCompleteProps = AutoCompleteMultipleProps | AutoCompleteSingleProps;
|
|
101
|
-
/**
|
|
102
|
-
* The AutoComplete component for react. <br />
|
|
103
|
-
* Note that if you need search for ONLY given options, not included your typings,
|
|
104
|
-
* should considering using the `Select` component with `onSearch` prop.
|
|
105
|
-
*/
|
|
106
|
-
declare const AutoComplete: import("react").ForwardRefExoticComponent<(Omit<AutoCompleteMultipleProps, "ref"> | Omit<AutoCompleteSingleProps, "ref">) & import("react").RefAttributes<HTMLDivElement>>;
|
|
107
|
-
export default AutoComplete;
|
package/Select/AutoComplete.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { forwardRef, useContext, useState, useImperativeHandle, useRef, useMemo } from 'react';
|
|
4
|
-
import { selectClasses } from '@mezzanine-ui/core/select';
|
|
5
|
-
import { PlusIcon } from '@mezzanine-ui/icons';
|
|
6
|
-
import isArray from 'lodash/isArray';
|
|
7
|
-
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
8
|
-
import Option from './Option.js';
|
|
9
|
-
import { SelectControlContext } from './SelectControlContext.js';
|
|
10
|
-
import { useAutoCompleteValueControl } from '../Form/useAutoCompleteValueControl.js';
|
|
11
|
-
import { useClickAway } from '../hooks/useClickAway.js';
|
|
12
|
-
import SelectTrigger from './SelectTrigger.js';
|
|
13
|
-
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
14
|
-
import InputTriggerPopper from '../_internal/InputTriggerPopper/InputTriggerPopper.js';
|
|
15
|
-
import Menu from '../Menu/Menu.js';
|
|
16
|
-
import Icon from '../Icon/Icon.js';
|
|
17
|
-
import cx from 'clsx';
|
|
18
|
-
|
|
19
|
-
const MENU_ID = 'mzn-select-autocomplete-menu-id';
|
|
20
|
-
/**
|
|
21
|
-
* The AutoComplete component for react. <br />
|
|
22
|
-
* Note that if you need search for ONLY given options, not included your typings,
|
|
23
|
-
* should considering using the `Select` component with `onSearch` prop.
|
|
24
|
-
*/
|
|
25
|
-
const AutoComplete = forwardRef(function Select(props, ref) {
|
|
26
|
-
var _a, _b;
|
|
27
|
-
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
28
|
-
const { addable = false, className, disabled = disabledFromFormControl || false, disabledOptionsFilter = false, defaultValue, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputRef, inputProps, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize, mode = 'single', onChange: onChangeProp, onClear: onClearProp, onInsert, onSearch, options: optionsProp, popperOptions = {}, placeholder = '', prefix, required = requiredFromFormControl || false, searchTextControlRef, size, value: valueProp, } = props;
|
|
29
|
-
const [open, toggleOpen] = useState(false);
|
|
30
|
-
const { focused, onFocus, onChange, onClear, options, searchText, selectedOptions, setSearchText, unselectedOptions, value, } = useAutoCompleteValueControl({
|
|
31
|
-
defaultValue,
|
|
32
|
-
disabledOptionsFilter,
|
|
33
|
-
mode,
|
|
34
|
-
onChange: onChangeProp,
|
|
35
|
-
onClear: onClearProp,
|
|
36
|
-
onClose: () => toggleOpen(false),
|
|
37
|
-
onSearch,
|
|
38
|
-
options: optionsProp,
|
|
39
|
-
value: valueProp,
|
|
40
|
-
});
|
|
41
|
-
/** export set search text action to props (allow user to customize search text) */
|
|
42
|
-
useImperativeHandle(searchTextControlRef, () => ({ setSearchText }));
|
|
43
|
-
/** insert feature */
|
|
44
|
-
const [insertText, setInsertText] = useState('');
|
|
45
|
-
const nodeRef = useRef(null);
|
|
46
|
-
const controlRef = useRef(null);
|
|
47
|
-
const popperRef = useRef(null);
|
|
48
|
-
const composedRef = useComposeRefs([ref, controlRef]);
|
|
49
|
-
const renderValue = focused ? () => searchText : undefined;
|
|
50
|
-
useClickAway(() => {
|
|
51
|
-
if (!open || focused)
|
|
52
|
-
return;
|
|
53
|
-
return () => {
|
|
54
|
-
toggleOpen((prev) => !prev);
|
|
55
|
-
};
|
|
56
|
-
}, nodeRef, [focused, nodeRef, open, toggleOpen]);
|
|
57
|
-
function getPlaceholder() {
|
|
58
|
-
if (focused && value && !isArray(value)) {
|
|
59
|
-
return value.name;
|
|
60
|
-
}
|
|
61
|
-
return placeholder;
|
|
62
|
-
}
|
|
63
|
-
/** Trigger input props */
|
|
64
|
-
const onSearchInputChange = (e) => {
|
|
65
|
-
/** should sync both search input and value */
|
|
66
|
-
setSearchText(e.target.value);
|
|
67
|
-
setInsertText(e.target.value);
|
|
68
|
-
/** return current value to onSearch */
|
|
69
|
-
onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value);
|
|
70
|
-
};
|
|
71
|
-
const onSearchInputFocus = (e) => {
|
|
72
|
-
var _a;
|
|
73
|
-
e.stopPropagation();
|
|
74
|
-
toggleOpen(true);
|
|
75
|
-
onFocus(true);
|
|
76
|
-
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
|
|
77
|
-
};
|
|
78
|
-
const onSearchInputBlur = (e) => {
|
|
79
|
-
var _a;
|
|
80
|
-
onFocus(false);
|
|
81
|
-
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
|
|
82
|
-
};
|
|
83
|
-
const onClickSuffixActionIcon = () => {
|
|
84
|
-
toggleOpen((prev) => !prev);
|
|
85
|
-
};
|
|
86
|
-
const resolvedInputProps = {
|
|
87
|
-
...inputProps,
|
|
88
|
-
'aria-controls': MENU_ID,
|
|
89
|
-
'aria-expanded': open,
|
|
90
|
-
'aria-owns': MENU_ID,
|
|
91
|
-
onBlur: onSearchInputBlur,
|
|
92
|
-
onChange: onSearchInputChange,
|
|
93
|
-
onFocus: onSearchInputFocus,
|
|
94
|
-
placeholder: getPlaceholder(),
|
|
95
|
-
role: 'combobox',
|
|
96
|
-
};
|
|
97
|
-
const searchTextExistWithoutOption = !!searchText &&
|
|
98
|
-
options.find((option) => option.name === searchText) === undefined;
|
|
99
|
-
const context = useMemo(() => ({ onChange, value }), [onChange, value]);
|
|
100
|
-
return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, { [selectClasses.hostFullWidth]: fullWidth }), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: true, disabled: disabled, ellipsis: true, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, prefix: prefix, readOnly: false, required: required, inputProps: resolvedInputProps, searchText: searchText, size: size, showTextInputAfterTags: true, suffixAction: onClickSuffixActionIcon, value: value, renderValue: renderValue }), jsxs(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, open: open, sameWidth: true, options: popperOptions, children: [options.length ? (jsx(Menu, { id: MENU_ID, "aria-activedescendant": Array.isArray(value) ? ((_b = (_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '') : value === null || value === void 0 ? void 0 : value.id, itemsInView: itemsInView, maxHeight: menuMaxHeight, role: menuRole, size: menuSize, style: { border: 0 }, children: mode === 'single' ? (jsx(Fragment, { children: options.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))) })) : (jsxs(Fragment, { children: [selectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))), unselectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id)))] })) })) : null, searchTextExistWithoutOption && addable ? (jsxs("button", { type: "button", className: selectClasses.autoComplete, onClick: (e) => {
|
|
101
|
-
var _a;
|
|
102
|
-
e.stopPropagation();
|
|
103
|
-
if (insertText) {
|
|
104
|
-
const newOption = (_a = onInsert === null || onInsert === void 0 ? void 0 : onInsert(insertText)) !== null && _a !== void 0 ? _a : null;
|
|
105
|
-
if (newOption) {
|
|
106
|
-
setInsertText('');
|
|
107
|
-
setSearchText('');
|
|
108
|
-
onChange(newOption);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, children: [jsx("p", { children: insertText }), jsx(Icon, { className: selectClasses.autoCompleteIcon, icon: PlusIcon })] })) : null] })] }) }));
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
export { AutoComplete as default };
|